Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,591
    Plugin Contributions
    30

    Default [Done v1.6.0] Product description listing: inline javascript may not be stripped

    Not sure whether this would be classed as a bug but function zen_clean_html does not get rid of inline javascript in the product description cleanly/completely.

    Why is there javascript in the product description: I have a few products that use an expanding table function which I really don't need to be loaded globally on all product pages so its used in that product description only.

    This results in this type of thing in the product listing:
    Singled-sided paddock stand pins are available in a range of outer diameters, choose the one appropriate for the inner diameter of your bike hub. $(document).ready(function() {$("table").tablesorter({widgets: ["zebra"],
    from this source
    <p>Singled-sided paddock stand pins are available in a range of outer diameters, choose the one appropriate for the inner diameter of your bike hub.</p>
    <script type="text/javascript" src="includes/templates/My template/jscript/jquery.tablesorter.js"></script>
    <script type="text/javascript">$(document).ready(function() {$("table").tablesorter({widgets: ["zebra"], widgetOptions:{zebra:["normal-row", "alt-row"]}});});</script>
    Suggestions?
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Product description listing: inline javascript and tags may not be stripped

    I suspect the following will accomplish the task. I'd be interested in knowing any negative effects you encounter by using it:

    Code:
        if (!is_array($extraTags)) $extraTags = array($extraTags);
    
        // remove any embedded javascript
        $clean_it = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $clean_it);
    
        $clean_it = preg_replace('/\r/', ' ', $clean_it);
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,591
    Plugin Contributions
    30

    Default Re: Product description listing: inline javascript and tags may not be stripped

    forgot about this....but yes it works fine!

    thanks
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

 

 

Similar Threads

  1. v151 Product listing columns - how do I get 3 products inline rather than vertical
    By paintersinn in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 10 Jan 2013, 12:10 PM
  2. Product listing, struggling to get items inline.
    By DigitalShadow in forum General Questions
    Replies: 5
    Last Post: 22 Jul 2011, 03:08 PM
  3. Replies: 8
    Last Post: 21 Jul 2010, 07:25 PM
  4. backslashes stripped from product description?
    By scatzc in forum General Questions
    Replies: 14
    Last Post: 6 Nov 2009, 01:38 AM
  5. Inline product listing
    By thomasjay in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 22 Jul 2009, 10:22 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR