original_string: protected function isScriptTagFragJson(array $tag_frag)
      {
          if (empty($tag_frag['script_open_tag']) || empty($tag_frag['script_closing_tag'])) {
              return false; // Nope; missing open|closing tag.
          }
          $type = $language = ''; // Initialize.
  
          if (mb_stripos($tag_frag['script_open_tag'], 'type') !== 0) {
              if (preg_match('/\stype\s*\=\s*(["\'])(?P<value>.+?)\\1/ui', $tag_frag['script_open_tag'], $_m)) {
                  $type = $_m['value'];
              }
          } // unset($_m); // Just a little housekeeping.
  
          if (mb_stripos($tag_frag['script_open_tag'], 'language') !== 0) {
              if (preg_match('/\slanguage\s*\=\s*(["\'])(?P<value>.+?)\\1/ui', $tag_frag['script_open_tag'], $_m)) {
                  $language = $_m['value'];
              }
          } // unset($_m); // Just a little housekeeping.
  
          if (($type && mb_stripos($type, 'javascript') === false) || ($language && mb_stripos($language, 'javascript') === false)) {
              if ($type && mb_stripos($type, 'json') !== false) {
                  return true; // Yes, this is JSON.
              }
              if ($language && mb_stripos($language, 'json') !== false) {
                  return true; // Yes, this is JSON.
              }
          }
          return false; // No, not JSON.
      }
code: protected function isScriptTagFragJson(array $tag_frag)
      {
          if (empty($tag_frag['script_open_tag']) || empty($tag_frag['script_closing_tag'])) {
              return false; // Nope; missing open|closing tag.
          }
          $type = $language = ''; // Initialize.
  
          if (mb_stripos($tag_frag['script_open_tag'], 'type') !== 0) {
              if (preg_match('/\stype\s*\=\s*(["\'])(?P<value>.+?)\\1/ui', $tag_frag['script_open_tag'], $_m)) {
                  $type = $_m['value'];
              }
          } // unset($_m); // Just a little housekeeping.
  
          if (mb_stripos($tag_frag['script_open_tag'], 'language') !== 0) {
              if (preg_match('/\slanguage\s*\=\s*(["\'])(?P<value>.+?)\\1/ui', $tag_frag['script_open_tag'], $_m)) {
                  $language = $_m['value'];
              }
          } // unset($_m); // Just a little housekeeping.
  
          if (($type && mb_stripos($type, 'javascript') === false) || ($language && mb_stripos($language, 'javascript') === false)) {
              if ($type && mb_stripos($type, 'json') !== false) {
                  return true; // Yes, this is JSON.
              }
              if ($language && mb_stripos($language, 'json') !== false) {
                  return true; // Yes, this is JSON.
              }
          }
          return false; // No, not JSON.
      }
code_tokens: protected function isScriptTagFragJson ( array $ tag_frag ) { if ( empty ( $ tag_frag [ 'script_open_tag' ] ) || empty ( $ tag_frag [ 'script_closing_tag' ] ) ) { return false ; // Nope; missing open|closing tag. } $ type = $ language = '' ; // Initialize. if ( mb_stripos ( $ tag_frag [ 'script_open_tag' ] , 'type' ) !== 0 ) { if ( preg_match ( '/\stype\s*\=\s*(["\'])(?P<value>.+?)\\1/ui' , $ tag_frag [ 'script_open_tag' ] , $ _m ) ) { $ type = $ _m [ 'value' ] ; } } // unset($_m); // Just a little housekeeping. if ( mb_stripos ( $ tag_frag [ 'script_open_tag' ] , 'language' ) !== 0 ) { if ( preg_match ( '/\slanguage\s*\=\s*(["\'])(?P<value>.+?)\\1/ui' , $ tag_frag [ 'script_open_tag' ] , $ _m ) ) { $ language = $ _m [ 'value' ] ; } } // unset($_m); // Just a little housekeeping. if ( ( $ type && mb_stripos ( $ type , 'javascript' ) === false ) || ( $ language && mb_stripos ( $ language , 'javascript' ) === false ) ) { if ( $ type && mb_stripos ( $ type , 'json' ) !== false ) { return true ; // Yes, this is JSON. } if ( $ language && mb_stripos ( $ language , 'json' ) !== false ) { return true ; // Yes, this is JSON. } } return false ; // No, not JSON. }
docstring: Test a script tag fragment to see if it's JSON.
  
  @since 150424 Adding support for JSON compression.
  
  @param array $tag_frag A JS tag fragment.
  
  @return bool TRUE if it contains JSON.
docstring_tokens: Test a script tag fragment to see if it s JSON .