WordPress.org

Ready to get started?Download WordPress

Forums

Trackable Social Share Icons
[resolved] It wrongly thinks my site uses https (6 posts)

  1. RonStrilaeff
    Member
    Posted 2 years ago #

    The icons were not loading in this trackable social share icons plugin.

    I seems the value of $_SERVER['HTTPS'] is "off" but the logic of the functions _trackableshare_buildurl() and _trackableshare_setpaths in the index.php file was changing the "http" to "https" anyways. That created a non-existent url for the icon image file.

    So in order to make the icons show up I replaced that chunk of code with this ('on' == strtolower($_SERVER['HTTPS']))

    I don't know why this was happening on my site but maybe it's because I'm using WP Multisite, or something is funky with my redirects within my shared host or something. I hope this helps someone.

    http://wordpress.org/extend/plugins/trackable-social-share-icons/

  2. EcreativeIM
    Member
    Plugin Author

    Posted 2 years ago #

    This is a known issue with certain versions of Windows servers (which we don't support) -- which I'm guessing is why you're seeing it.

  3. RonStrilaeff
    Member
    Posted 2 years ago #

    Yeah I read a bit about that, but since I'm on bluehost which uses Linux and Apache (near bottom of page), that's probably not the issue. I used to have an SSL setup with them so maybe there is some strange artifact getting picked up. It is not a problem for me anymore since I modified that bit of code.

  4. David Radovanovic
    Member
    Posted 1 year ago #

    @RonStrilaeff - would be so kind as to help a php nob? Where in the below code does your fix (('on' == strtolower($_SERVER['HTTPS'])) belong?

    // Return Current URL
    	function _trackableshare_buildurl() {
    		return 'http'.($_SERVER['HTTPS']?'s':'').'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    	}
    
    	// Return Button Paths
    	function _trackableshare_setpaths($file,$admin=false) {
    		if($file == 'custom') {
    			$path = WP_CONTENT_DIR.'/uploads/trackableshare/';
    			$url = ($_SERVER['HTTPS']?str_replace('http://','https://',WP_CONTENT_URL):WP_CONTENT_URL).'/uploads/trackableshare/';
    		} else {
    			$path = ($admin?'../':'').TRACKABLESHARE_PLUGINS.'/'.TRACKABLESHARE_DIRNAME.'/buttons/'.$file.'/';
    			$url = ($_SERVER['HTTPS']?str_replace('http://','https://',WP_PLUGIN_URL):WP_PLUGIN_URL).'/'.TRACKABLESHARE_DIRNAME.'/buttons/'.$file.'/';
    		}
    		return array($path,$url);
    	}

    Thank you!

  5. RonStrilaeff
    Member
    Posted 1 year ago #

    Hi dpaule..

    See the lines below //ronedit
    Hope this helps.

    // Return Current URL
    	function _trackableshare_buildurl() {
    		//ronedit replaced by line below return 'http'.($_SERVER['HTTPS']?'s':'').'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    		//ronedit this plugin always thinks that my site is https even when it is not
    		return 'http'.(('on' == strtolower($_SERVER['HTTPS']))?'s':'').'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    	}
    // Return Button Paths
    	function _trackableshare_setpaths($file,$admin=false) {
    		if($file == 'custom') {
    			$path = WP_CONTENT_DIR.'/uploads/trackableshare/';
    		        //ronedit replaced by line below $url = ($_SERVER['HTTPS']?str_replace('http://','https://',WP_CONTENT_URL):WP_CONTENT_URL).'/uploads/trackableshare/';
    			$url = (('on' == strtolower($_SERVER['HTTPS']))?str_replace('http://','https://',WP_CONTENT_URL):WP_CONTENT_URL).'/uploads/trackableshare/';
    		} else {
    			$path = ($admin?'../':'').TRACKABLESHARE_PLUGINS.'/'.TRACKABLESHARE_DIRNAME.'/buttons/'.$file.'/';
    			//ronedit replaced by line below $url = ($_SERVER['HTTPS']?str_replace('http://','https://',WP_PLUGIN_URL):WP_PLUGIN_URL).'/'.TRACKABLESHARE_DIRNAME.'/buttons/'.$file.'/';
    			$url = (('on' == strtolower($_SERVER['HTTPS']))?str_replace('http://','https://',WP_PLUGIN_URL):WP_PLUGIN_URL).'/'.TRACKABLESHARE_DIRNAME.'/buttons/'.$file.'/';
    		}
    		return array($path,$url);
    	}

    oh, and btw .. the correct spelling is "nub" and I are one :-)

  6. David Radovanovic
    Member
    Posted 1 year ago #

    Yea! It works beautifully. Thank you for sharing your fix. Nub, yes. Shows what a nub I really am.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic