original_string: protected function maybeCompressInlineJsonCode($html)
      {
          if (($benchmark = !empty($this->options['benchmark']) && $this->options['benchmark'] === 'details')) {
              $time = microtime(true);
          }
          $html = (string) $html; // Force string value.
  
          if (isset($this->options['compress_js_code'])) {
              if (!$this->options['compress_js_code']) {
                  $disabled = true; // Disabled flag.
              }
          }
          if (isset($this->options['compress_inline_js_code'])) {
              if (!$this->options['compress_inline_js_code']) {
                  $disabled = true; // Disabled flag.
              }
          }
          if (!$html || !empty($disabled)) {
              goto finale; // Nothing to do.
          }
          if (($html_frag = $this->getHtmlFrag($html)) && ($js_tag_frags = $this->getJsTagFrags($html_frag))) {
              foreach ($js_tag_frags as $_js_tag_frag_key => $_js_tag_frag) {
                  if (!$_js_tag_frag['exclude'] && $_js_tag_frag['script_json']) {
                      $js_tag_frags_script_json_parts[]                             = $_js_tag_frag['all'];
                      $js_tag_frags_script_json_part_placeholders[]                 = '%%htmlc-'.$_js_tag_frag_key.'%%';
                      $js_tag_frags_script_json_part_placeholder_key_replacements[] = $_js_tag_frag_key;
                  }
              } // unset($_js_tag_frag_key, $_js_tag_frag); // Housekeeping.
  
              if (isset($js_tag_frags_script_json_parts, $js_tag_frags_script_json_part_placeholders, $js_tag_frags_script_json_part_placeholder_key_replacements)) {
                  $html = $this->replaceOnce($js_tag_frags_script_json_parts, $js_tag_frags_script_json_part_placeholders, $html);
  
                  foreach ($js_tag_frags_script_json_part_placeholder_key_replacements as &$_json_tag_frag_key_replacement) {
                      $_js_tag_frag = $js_tag_frags[$_json_tag_frag_key_replacement];
  
                      $_json_tag_frag_key_replacement = $_js_tag_frag['if_open_tag'];
                      $_json_tag_frag_key_replacement .= $_js_tag_frag['script_open_tag'];
                      $_json_tag_frag_key_replacement .= $this->compressInlineJsonCode($_js_tag_frag['script_json']);
                      $_json_tag_frag_key_replacement .= $_js_tag_frag['script_closing_tag'];
                      $_json_tag_frag_key_replacement .= $_js_tag_frag['if_closing_tag'];
                  } // unset($_json_tag_frag_key_replacement, $_js_tag_frag); // Housekeeping.
  
                  $html = $this->replaceOnce($js_tag_frags_script_json_part_placeholders, $js_tag_frags_script_json_part_placeholder_key_replacements, $html);
  
                  if ($benchmark) {
                      $this->benchmark->addData(
                          __FUNCTION__,
                          compact(
                              'js_tag_frags',
                              'js_tag_frags_script_json_parts',
                              'js_tag_frags_script_json_part_placeholders',
                              'js_tag_frags_script_json_part_placeholder_key_replacements'
                          )
                      );
                  }
              }
          }
          finale: // Target point; finale/return value.
  
          if ($html) {
              $html = trim($html);
          } // Trim it up now!
  
          if ($benchmark && !empty($time) && $html && empty($disabled)) {
              $this->benchmark->addTime(
                  __FUNCTION__,
                  $time, // Caller, start time, task performed.
                  sprintf('compressing inline JSON in checksum: `%1$s`', md5($html))
              );
          }
          return $html; // With possible compression having been applied here.
      }
code: protected function maybeCompressInlineJsonCode($html)
      {
          if (($benchmark = !empty($this->options['benchmark']) && $this->options['benchmark'] === 'details')) {
              $time = microtime(true);
          }
          $html = (string) $html; // Force string value.
  
          if (isset($this->options['compress_js_code'])) {
              if (!$this->options['compress_js_code']) {
                  $disabled = true; // Disabled flag.
              }
          }
          if (isset($this->options['compress_inline_js_code'])) {
              if (!$this->options['compress_inline_js_code']) {
                  $disabled = true; // Disabled flag.
              }
          }
          if (!$html || !empty($disabled)) {
              goto finale; // Nothing to do.
          }
          if (($html_frag = $this->getHtmlFrag($html)) && ($js_tag_frags = $this->getJsTagFrags($html_frag))) {
              foreach ($js_tag_frags as $_js_tag_frag_key => $_js_tag_frag) {
                  if (!$_js_tag_frag['exclude'] && $_js_tag_frag['script_json']) {
                      $js_tag_frags_script_json_parts[]                             = $_js_tag_frag['all'];
                      $js_tag_frags_script_json_part_placeholders[]                 = '%%htmlc-'.$_js_tag_frag_key.'%%';
                      $js_tag_frags_script_json_part_placeholder_key_replacements[] = $_js_tag_frag_key;
                  }
              } // unset($_js_tag_frag_key, $_js_tag_frag); // Housekeeping.
  
              if (isset($js_tag_frags_script_json_parts, $js_tag_frags_script_json_part_placeholders, $js_tag_frags_script_json_part_placeholder_key_replacements)) {
                  $html = $this->replaceOnce($js_tag_frags_script_json_parts, $js_tag_frags_script_json_part_placeholders, $html);
  
                  foreach ($js_tag_frags_script_json_part_placeholder_key_replacements as &$_json_tag_frag_key_replacement) {
                      $_js_tag_frag = $js_tag_frags[$_json_tag_frag_key_replacement];
  
                      $_json_tag_frag_key_replacement = $_js_tag_frag['if_open_tag'];
                      $_json_tag_frag_key_replacement .= $_js_tag_frag['script_open_tag'];
                      $_json_tag_frag_key_replacement .= $this->compressInlineJsonCode($_js_tag_frag['script_json']);
                      $_json_tag_frag_key_replacement .= $_js_tag_frag['script_closing_tag'];
                      $_json_tag_frag_key_replacement .= $_js_tag_frag['if_closing_tag'];
                  } // unset($_json_tag_frag_key_replacement, $_js_tag_frag); // Housekeeping.
  
                  $html = $this->replaceOnce($js_tag_frags_script_json_part_placeholders, $js_tag_frags_script_json_part_placeholder_key_replacements, $html);
  
                  if ($benchmark) {
                      $this->benchmark->addData(
                          __FUNCTION__,
                          compact(
                              'js_tag_frags',
                              'js_tag_frags_script_json_parts',
                              'js_tag_frags_script_json_part_placeholders',
                              'js_tag_frags_script_json_part_placeholder_key_replacements'
                          )
                      );
                  }
              }
          }
          finale: // Target point; finale/return value.
  
          if ($html) {
              $html = trim($html);
          } // Trim it up now!
  
          if ($benchmark && !empty($time) && $html && empty($disabled)) {
              $this->benchmark->addTime(
                  __FUNCTION__,
                  $time, // Caller, start time, task performed.
                  sprintf('compressing inline JSON in checksum: `%1$s`', md5($html))
              );
          }
          return $html; // With possible compression having been applied here.
      }
code_tokens: protected function maybeCompressInlineJsonCode ( $ html ) { if ( ( $ benchmark = ! empty ( $ this -> options [ 'benchmark' ] ) && $ this -> options [ 'benchmark' ] === 'details' ) ) { $ time = microtime ( true ) ; } $ html = ( string ) $ html ; // Force string value. if ( isset ( $ this -> options [ 'compress_js_code' ] ) ) { if ( ! $ this -> options [ 'compress_js_code' ] ) { $ disabled = true ; // Disabled flag. } } if ( isset ( $ this -> options [ 'compress_inline_js_code' ] ) ) { if ( ! $ this -> options [ 'compress_inline_js_code' ] ) { $ disabled = true ; // Disabled flag. } } if ( ! $ html || ! empty ( $ disabled ) ) { goto finale ; // Nothing to do. } if ( ( $ html_frag = $ this -> getHtmlFrag ( $ html ) ) && ( $ js_tag_frags = $ this -> getJsTagFrags ( $ html_frag ) ) ) { foreach ( $ js_tag_frags as $ _js_tag_frag_key => $ _js_tag_frag ) { if ( ! $ _js_tag_frag [ 'exclude' ] && $ _js_tag_frag [ 'script_json' ] ) { $ js_tag_frags_script_json_parts [ ] = $ _js_tag_frag [ 'all' ] ; $ js_tag_frags_script_json_part_placeholders [ ] = '%%htmlc-' . $ _js_tag_frag_key . '%%' ; $ js_tag_frags_script_json_part_placeholder_key_replacements [ ] = $ _js_tag_frag_key ; } } // unset($_js_tag_frag_key, $_js_tag_frag); // Housekeeping. if ( isset ( $ js_tag_frags_script_json_parts , $ js_tag_frags_script_json_part_placeholders , $ js_tag_frags_script_json_part_placeholder_key_replacements ) ) { $ html = $ this -> replaceOnce ( $ js_tag_frags_script_json_parts , $ js_tag_frags_script_json_part_placeholders , $ html ) ; foreach ( $ js_tag_frags_script_json_part_placeholder_key_replacements as & $ _json_tag_frag_key_replacement ) { $ _js_tag_frag = $ js_tag_frags [ $ _json_tag_frag_key_replacement ] ; $ _json_tag_frag_key_replacement = $ _js_tag_frag [ 'if_open_tag' ] ; $ _json_tag_frag_key_replacement .= $ _js_tag_frag [ 'script_open_tag' ] ; $ _json_tag_frag_key_replacement .= $ this -> compressInlineJsonCode ( $ _js_tag_frag [ 'script_json' ] ) ; $ _json_tag_frag_key_replacement .= $ _js_tag_frag [ 'script_closing_tag' ] ; $ _json_tag_frag_key_replacement .= $ _js_tag_frag [ 'if_closing_tag' ] ; } // unset($_json_tag_frag_key_replacement, $_js_tag_frag); // Housekeeping. $ html = $ this -> replaceOnce ( $ js_tag_frags_script_json_part_placeholders , $ js_tag_frags_script_json_part_placeholder_key_replacements , $ html ) ; if ( $ benchmark ) { $ this -> benchmark -> addData ( __FUNCTION__ , compact ( 'js_tag_frags' , 'js_tag_frags_script_json_parts' , 'js_tag_frags_script_json_part_placeholders' , 'js_tag_frags_script_json_part_placeholder_key_replacements' ) ) ; } } } finale : // Target point; finale/return value. if ( $ html ) { $ html = trim ( $ html ) ; } // Trim it up now! if ( $ benchmark && ! empty ( $ time ) && $ html && empty ( $ disabled ) ) { $ this -> benchmark -> addTime ( __FUNCTION__ , $ time , // Caller, start time, task performed. sprintf ( 'compressing inline JSON in checksum: `%1$s`' , md5 ( $ html ) ) ) ; } return $ html ; // With possible compression having been applied here. }
docstring: Maybe compress inline JSON code within the HTML source.
  
  @since 150424 Adding support for JSON compression.
  
  @param string $html Raw HTML code.
  
  @return string HTML source code, with possible inline JSON compression.
docstring_tokens: Maybe compress inline JSON code within the HTML source .