• Hi,

    I am the developer of the mapping plugin “Leaflet Maps Marker” (http://www.mapsmarker.com). A user of my plugin just informed me that when the latest version of SEO friendly image-plugin is active, maps produced by my plugin are broken.

    I could confirm this. This is due to the fact, that you add “un-slashed” double quotes to my javascript code which breaks it. To make it clear here an extract of the javascript produced by my plugin:

    var mapquest_osm = new L.TileLayer("http://{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png", {maxZoom: 18, minZoom: 1, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", attribution: "Map: Tiles Courtesy of MapQuest <img src=\"http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/logo-mapquest.png\" style=\"display:inline;\" /> (OpenStreetMap, CC-BY-SA)", subdomains: ["otile1","otile2","otile3","otile4"], detectRetina: true});

    after activating SEO friendly images this becomes

    var mapquest_osm = new L.TileLayer("http://{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png", {maxZoom: 18, minZoom: 1, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", attribution: "Map: Tiles Courtesy of MapQuest <img src=\"http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/logo-mapquest.png\" style=\"display:inline;\" title="image test" alt=" image test" /> (OpenStreetMap, CC-BY-SA)", subdomains: ["otile1","otile2","otile3","otile4"], detectRetina: true});

    the solution would be to add

    title=\"image test\" alt=\" image test\"

    instead of

    title="image test" alt=" image test"

    Could it be possible to change this in your plugin? Currently I dont know how to prevent your plugin adding this html-tags to my javascript code. I can only include your plugin in my built-in-compatibility-check and warn users that they cant use my plugin together with yours…

    Any help is really appreciated!
    regards,

    Robert

    http://wordpress.org/extend/plugins/seo-image/

Viewing 6 replies - 1 through 6 (of 6 total)
  • I also posted a question on wpquestion.com on how to best solve this problem. A user suggested to change the regular ex responsible for adding this html-tags:

    function seo_friendly_images($content) {
    return preg_replace_callback('/<img[^>]+/', 'seo_friendly_images_process', $content);
    }
    add_filter('the_content', 'seo_friendly_images', 100);

    could this be changed not to be executed for code withing a <script>-tag?

    Plugin Author Vladimir Prelovac

    (@freediver)

    The free version is only community supported (400,000 users, one guy on the other end, I cant be doing it). Please purchase the premium version which is updates and supported by me.

    to bad – I will see if I can find time to make a regex which doesnt replace <img> tags within <script>-tags…

    I found a fix for the bug – it would be great if the following code could be changed in your next update:

    seo-friendly-images.php before (line 192-197):

    if (!in_array('title=', $pieces)) {
    				array_push($pieces, ' title="' . $titletext_rep . '"');
    			} else {
    				$key=array_search('title=',$pieces);
    				$pieces[$key+1]='"'.$titletext_rep.'" ';
    			}

    would have to be changed to:

    if (!in_array('title=', $pieces)) {
    				array_push($pieces, ' title=\"' . $titletext_rep . '\"');
    			} else {
    				$key=array_search('title=',$pieces);
    				$pieces[$key+1]='\"'.$titletext_rep.'\" ';
    			}

    seo-friendly-images.php before (line 210-215):

    if (!in_array('alt=', $pieces)) {
    				array_push($pieces, ' alt="' . $alttext_rep . '"');
    			} else {
    				$key=array_search('alt=',$pieces);
    				$pieces[$key+1]='"'.$alttext_rep.'" ';
    			}

    would have to be changed to:

    if (!in_array('alt=', $pieces)) {
    				array_push($pieces, ' alt=\"' . $alttext_rep . '\"');
    			} else {
    				$key=array_search('alt=',$pieces);
    				$pieces[$key+1]='\"'.$alttext_rep.'\" ';
    			}

    I’d be really glad if you could change this in the next version of your plugin!

    @vladmir,

    The new update actually broke the plugin.. Now single post page shows alt and title attribute for images with unnecessary \ which is causing wrong alt & title attribute..

    for example: <img src=”image-name.png” alt=\”image name”\ title=\”image post name\” />
    The backslash is appearing in html source code and therefore browser is not reading the attribute properly.
    I fixed it for myself by removing the backslash in the source code of the plugin..
    But you should urgently fix it otherwise thousands of your users will face this problem

    Plugin Author Vladimir Prelovac

    (@freediver)

    Working on a new patch

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: SEO Friendly Images] plugin conflict: "SEO friendly images" breaks "Leaflet’ is closed to new replies.