Forum Replies Created

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author jvandemerwe

    (@jvandemerwe)

    Thanks @hnzz for posting your solution.

    Plugin Author jvandemerwe

    (@jvandemerwe)

    This bug has been solved with version 1.5 (3 December 2015). It appeared that the makers of WPML decided to use a class name with the same name as in my plugin (WPML_Flags).

    I had that problem too. It showed that the jquery ui “tabs” function was not found. I added the following to my functions.php (not so nice though):

    add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' );
    
    function load_custom_wp_admin_style() {
        wp_enqueue_script('jquery-ui', 'http://code.jquery.com/ui/1.11.4/jquery-ui.js', array('jquery'));
    }

    Now it seems to work again.

    I had the same problem on version 1.3.1 and I have the following code that works on multiple urls (not so different where @mads_boll refers to:

    (in file: open-external-links-in-a-new-window.php)

    function external_links_in_new_windows_loop() {
        if (!document.links) {
    	document.links = document.getElementsByTagName('a');
        }
        var change_link = false;
        var force = '".get_option("external_links_in_new_windows_force")."';
        var ignore = '".get_option("external_links_in_new_windows_ignore")."';
    
        var force_split = force.split(';');
        var ignore_split = ignore.split(';');
    
        for (var t=0; t<document.links.length; t++) {
    	var all_links = document.links[t];
    	change_link = false;
    
    	if(document.links[t].hasAttribute('onClick') == false) {
    	  // forced if the address starts with http (or also https), but does not link to the current domain
    	  if(all_links.href.search(/^http/) != -1 && all_links.href.search('" . $blogdomain['host'] . "') == -1) {
                  // alert('Changeda '+all_links.href);
    	      change_link = true;
    	}
    
    	var found_force = -1;
            for (var i = 0; i < force.length; i++) {
                  if (all_links.href.search(trim(force_split[i])) != -1) {
                     found_force = 0;
                 }
            }
    
    	var found_ignore = -1;
            for (var i = 0; i < ignore.length; i++) {
                if (all_links.href.search(trim(ignore_split[i])) != -1) {
                    found_ignore = 0;
                }
            }
    
    	if(force != '' && found_force != -1) {
    	   // forced
    	   // alert('force '+all_links.href);
    	   change_link = true;
    	}
    
    	if(ignore != '' && found_ignore != -1) {
    	  // alert('ignore '+all_links.href);
    	  // ignored
    	  change_link = false;
    	}
    
    	if(change_link == true) {
    	  // alert('Changed '+all_links.href);
      	  document.links[t].setAttribute('onClick', 'javascript:window.open(\\''+all_links.href+'\\'); return false;');
    	 document.links[t].removeAttribute('target');
    	}
         }
      }
    }

    But that isn’t the account for the website I’m working on. Let’s not turn this in an investigation if I’m an honest citizen please. I wasn’t the only one with this problem. Now it’s working and my customer happy. It is not about that I want to show that someone was wrong. And @puravida1976, before assuming that my name corresponds with your researched one you could have asked me what account it concerned in this case. But as I said it works now, I almost regret that I posted the code.

    I have some additional information that might show that it is maybe not a coincident. When I submit the curl string in the browser directly it returns the full xml. But when I did a refresh of the thumbnail within the plugins admin it returned empty data.

    I am not a great expert in CURL, but until now the modification works on all the browsers I tested.

    Here is the solution to this problem. Change the CURL request in the thumbnailer.inc.php file to:

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $request_url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // forces response into return string, not echo
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_HTTPHEADER, Array("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.15) Gecko/20080623 Firefox/2.0.0.15") );
    $remotedata = curl_exec($ch);
    curl_close($ch);

    I had the same problem, but now it is working fine. It is important however that Dan Harrison will also update this in the next update of the plugin, otherwise you have to change it again.

    @dan Harrison,

    I had the same problem, but I have solved it. I took a peek at another plugin (Webphysiology) and look what was different, because that one was working without a problem. Maybe it worth to update your plugin with the following code.

    This curl request is working in the thumbnailer.inc.php:

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $request_url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // forces response into return string, not echo
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_HTTPHEADER, Array("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.15) Gecko/20080623 Firefox/2.0.0.15") );
    $remotedata = curl_exec($ch);
    curl_close($ch);
    Plugin Author jvandemerwe

    (@jvandemerwe)

    Well that the URL is switching back is not an issue, because it is not using the URL, but the the title. If you see on your website the URL link however rather than the flags menu, it means that you have not selected this (single) menu in the menu selecter of the plugin.

    Select all the menu translation, not just the original !!!

    Make sure that every time you add a language to your site that you select the menu in the selecter. Maybe you can give some more information what is not working.

    This is certainly a pain on this plugin. I think the programmer abonded the ship just a bit too early here. But I have modified the code and the following code is working for multi URL’s. Hopefully the programmer will modify this, otherwise on an update you might have to do it again.

    File: open-external-links-in-a-new-window.php

    If you want to add multiple URL’s to force or ignore, separate them by a semicolon(;). The modified code will split and iterate the URL’s you have entered. For the rest it follows the original code of the maker of this plugin.

    Replace the function external_links_in_new_window_client with this one:

    // Loads the code for the website
    function external_links_in_new_windows_client() {
        echo "\n\n<!-- " . __("Plugin: Open external links a new window.", "open-external-links-in-a-new-window") . " " . __("Plugin by", "open-external-links-in-a-new-window") . " Kristian Risager Larsen, http://kristianrisagerlarsen.dk . " . __("Download it at", "open-external-links-in-a-new-window") . " http://wordpress.org/extend/plugins/open-external-links-in-a-new-window/ -->\n";
    
        $blogdomain = parse_url(get_option('home'));
        echo "<script type=\"text/javascript\">//<![CDATA[";
        echo "
    	function external_links_in_new_windows_loop() {
    		if (!document.links) {
    			document.links = document.getElementsByTagName('a');
    		}
    		var change_link = false;
    		var force = '" . get_option("external_links_in_new_windows_force") . "';
    		var ignore = '" . get_option("external_links_in_new_windows_ignore") . "';
    
                    var force_split = force.split(';');
                    var ignore_split = ignore.split(';');
    
    		for (var t=0; t<document.links.length; t++) {
    			var all_links = document.links[t];
    			change_link = false;
    
    			if(document.links[t].hasAttribute('onClick') == false) {
    				// forced if the address starts with http (or also https), but does not link to the current domain
    				if(all_links.href.search(/^http/) != -1 && all_links.href.search('" . $blogdomain['host'] . "') == -1) {
    					// alert('Changeda '+all_links.href);
    					change_link = true;
    				}
    
                                    var found_force = -1;
                                    for (var i = 0; i < force.length; i++) {
                                        if (all_links.href.search(trim(force_split[i])) != -1) {
                                           found_force = 0;
                                        }
                                    }
    
                                    var found_ignore = -1;
                                    for (var i = 0; i < ignore.length; i++) {
                                        if (all_links.href.search(trim(ignore_split[i])) != -1) {
                                           found_ignore = 0;
                                        }
                                    }
    
    				if(force != '' && found_force != -1) {
    					// forced
    					// alert('force '+all_links.href);
    					change_link = true;
    				}
    
    				if(ignore != '' && found_ignore != -1) {
    					// alert('ignore '+all_links.href);
    					// ignored
    					change_link = false;
    				}
    
    				if(change_link == true) {
    					// alert('Changed '+all_links.href);
    					document.links[t].setAttribute('onClick', 'javascript:window.open(\\''+all_links.href+'\\'); return false;');
    					document.links[t].removeAttribute('target');
    				}
    			}
    		}
    	}
    
    	// Load
    	function external_links_in_new_windows_load(func)
    	{
    		var oldonload = window.onload;
    		if (typeof window.onload != 'function'){
    			window.onload = func;
    		} else {
    			window.onload = function(){
    				oldonload();
    				func();
    			}
    		}
    	}
    
    	external_links_in_new_windows_load(external_links_in_new_windows_loop);
    	";
    
        echo "//]]></script>\n\n";
    }
    Plugin Author jvandemerwe

    (@jvandemerwe)

    @mick222, what is not working then in Internet Explorer 8. I don’t see anything that looks strange. Please give some more information.

    Plugin Author jvandemerwe

    (@jvandemerwe)

    @nebu1980, I have updated the plugin with respect for your request. I hope you like it. The new version is version 1.2

    Plugin Author jvandemerwe

    (@jvandemerwe)

    @nebu1980, Thank you for your compliment. I will update the plugin, so that it is optional if you want to show the language text next to the flag. Or maybe even only to show the language text (without the flag).

    The plugin does not work with the Hypercache plugin.

Viewing 15 replies - 1 through 15 (of 18 total)