Skip to content

Categories:

Patch: Sociable WordPress Plugin to load pictures from https if browsing with https

I’ve made a tiny little patch for Sociable WordPress Plugin I’m using. I got rather annoyed that it loaded it pictures over http while browsing with https. Plugin will pick up https if you use it in SITE_URL on your WordPress blog, but I don’t like to bother my visitors with my self-signed certificate, so I only require https to login.

Sociable loading pictures over http while using https causes this annoying warning in firefox

Sociable loading pictures over http while using https causes this annoying warning in Firefox

Save the quoted content below as a random-filename.patch in your sociable plugin directory , make a backup of current sociable.php to sociable.orginal and apply it with patch -p0 < random-filename.patch in your sociable plugin directory.

Patch:

— sociable.orginal 2008-12-05 00:49:37.000000000 +0100
+++ sociable.php 2008-12-05 01:08:23.000000000 +0100
@@ -33,6 +33,9 @@

// Guess the location
$sociablepluginpath = WP_CONTENT_URL.’/plugins/’.plugin_basename(dirname(__FILE__)).’/';
+if ( isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT']==443){
+ $sociablepluginpath = preg_replace(‘/^http:/’,'https:’, $sociablepluginpath);
+}

function sociable_init_locale(){
load_plugin_textdomain(‘sociable’, $sociablepluginpath);

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • LinkedIn
  • Live
  • StumbleUpon

Posted in /dev/random.

Tagged with , , , , , , , , .


One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. norrs says

    The annoying warning will still appear on your blog if you have other things loading resources over http while browsing https. Example: like embedded flash videos :(



Some HTML is OK

or, reply to this post via trackback.