Support » Plugin: Codestyling Localization » *** FIX *** Script analyze

  • A lot of Scripts are not text/javascript. The media manager and other plugins can add text/css or text/html. That code will be parsed and make some problems (see Screenshots):

    Screenshot 1
    Screenshot 2

    Here is a little fix to check the <script>-Tag type:

    First: Replace all $scripts[1][$i] from line 2608 up to line 2641 with $scripts[2][$i]

    And than modify the code-analyze block:
    OLD regular expression on line 2608:

    if (preg_match_all("/<script[^>]*>([\s\S]*?)<\/script>/i", $content, $scripts)) {

    NEW (Modify first RegExpr to ([^>]+)):

    if (preg_match_all("/<script([^>]+)*>([\s\S]*?)<\/script>/i", $content, $scripts)) {

    OLD line 2610:

    for($i=0; $i<$num; $i++) {

    NEW (Adding new line to check the type):

    for($i=0; $i<$num; $i++) {
    	if(preg_match('/type="(text\/html|text\/css)"/Uis', $scripts[1][$i])) {

    Info: This fix is only for the Footer scripts (function csp_self_script_protection_footer). The same fix must be replaced for the header scripts.

  • The topic ‘*** FIX *** Script analyze’ is closed to new replies.