/** * * get info in script tag,is external & js * @param string $tag */ public static function getScriptTagInfo($tag = '', Fl_Base $instance) { $tagInfo = $instance->getInstance("Fl_Html_TagToken", $tag)->run(); $isExternal = false; $isScript = true; $isTpl = false; $isInline = false; $src = ''; foreach ($tagInfo['attrs'] as $item) { $nameLower = strtolower($item[0]); if (count($item) == 3) { $valueDetail = Fl_Html_Static::getUnquoteText($item[2]); $value = $valueDetail['text']; $tagInfo[$nameLower] = $value; if ($nameLower === 'src') { $isExternal = true; $src = $item[2]; } elseif ($nameLower === 'type') { if ($value && strtolower($value) != 'text/javascript') { $isScript = false; } //前端模版 if (strtolower($value) == 'text/html' || strtolower($value) == 'text/template') { $isTpl = true; } } } if ($nameLower == 'inline') { $isInline = true; } } $tagInfo['external'] = $isExternal; $tagInfo['script'] = $isScript; $tagInfo['tpl'] = $isTpl; $tagInfo['inline'] = $isInline; $tagInfo['src'] = $src; return $tagInfo; }