Title: *** FIX *** Script analyze
Last modified: August 21, 2016

---

# *** FIX *** Script analyze

 *  Resolved [Patrick Nießen](https://wordpress.org/support/users/hovida/)
 * (@hovida)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/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](http://abload.de/img/cl141ue3.png)
    [Screenshot 2](http://abload.de/img/cl2vpudi.png)
 * Here is a little fix to check the <script>-Tag type:
 * **codestyling-localization.php**
    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])) {
       				continue;
       			}
       ```
   
 * 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.
    [https://wordpress.org/plugins/codestyling-localization/](https://wordpress.org/plugins/codestyling-localization/)

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

 * ![](https://s.w.org/plugins/geopattern-icon/codestyling-localization_e6e1e3.svg)
 * [Codestyling Localization](https://wordpress.org/plugins/codestyling-localization/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/codestyling-localization/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/codestyling-localization/)
 * [Active Topics](https://wordpress.org/support/plugin/codestyling-localization/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/codestyling-localization/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/codestyling-localization/reviews/)

## Tags

 * [javascript error](https://wordpress.org/support/topic-tag/javascript-error/)

 * 0 replies
 * 1 participant
 * Last reply from: [Patrick Nießen](https://wordpress.org/support/users/hovida/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/fix-script-analyze/)
 * Status: resolved