I'm using a popup plugin that's causing problems with SSL. Specifically, the plugin relies on two deprecated Wordpress functions which are known to break SSL compatibility (WP_PLUGIN_URL and WP_PLUGIN_DIR). See wordpress documentation at: http://codex.wordpress.org/Determining_Plugin_and_Content_Directories
I'm trying to figure out how to appropriately rewrite these functions. In theory the wordpress codex page has instructions, but I haven't been able to get it right yet. Here's the section of code from the plugin that's using these functions:
$plugin_dir = substr_replace(plugin_basename(dirname(__FILE__)), '', -6); // strip off _core directory
$this->url = WP_PLUGIN_URL . '/' . $plugin_dir;
$this->path = WP_PLUGIN_DIR . '/' . $plugin_dir;
$upload_dir = wp_upload_dir();
$this->upload_url = $upload_dir['baseurl'];
$this->upload_path = $upload_dir['basedir'];
$this->tpls = $this->path . '/_tpls';
Any assistance in correctly rewriting this would be much appreciated!
Arnav Joy answers:
try this
$plugin_dir = substr_replace(plugin_basename(dirname(__FILE__)), '', -6); // strip off _core directory
$this->url = plugins_url() . '/' . $plugin_dir;
$this->path = plugin_dir_path() . '/' . $plugin_dir;
$upload_dir = wp_upload_dir();
$this->upload_url = $upload_dir['baseurl'];
$this->upload_path = $upload_dir['basedir'];
$this->tpls = $this->path . '/_tpls';
sheas comments:
Hi Arnav,
Thanks for your suggestion (and sorry for my delayed reply -- I just realized that these emails were going to my spam box). I tried this approach and unfortunately it just makes my whole site go blank (i.e. nothing loads on any of the pages), so that's not going to work. Any other ideas??
Luis Abarca answers:
You can use this kind of url to avoid that
//yourdomain.com/anypath
Im using this way on my site for javascript
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript">!window.jQuery && document.write(unescape('%3Cscript src="//cdn.mydomain.com/js/jquery/1.5.1/jquery.min.js"%3E%3C/script%3E'))</script>
So maybe this can do the trick!
$this->url = str_replace('http:', '', $this->url);
sheas comments:
Hi Luis,
Thanks for your suggestion (and sorry for my delayed reply -- I just realized that these emails were going to my spam box).
I'm not totally following what you're recommending here. Can you be more specific about what you suggest with this code (i.e. where to put it)?
Luis Abarca comments:
Hi, i suggest to remove the protocol part of the URL, that way your site works with or without https.
Check my example, my site get javascript or stylesheets, with just //domain.com instead of http://domain.com, the files are valid with or without SSL
sheas comments:
Hi Luis,
Unfortunately that doesn't really solve the problem. Most of my site is not https, but for the parts that are (i.e. login and admin) I need to ensure absolute security. Currently, the ssl portion of the site is loading and workable but because files loading through this plugin are showing as http instead of https, it's breaking the security on the page which is the problem. Make sense?
Jurre Hanema answers:
I think Arnav Joy's suggestion should work. If your site goes blank, that usually means there's an error in your code somewhere. I suggest you open up your wp-config.php and change this line:
define('WP_DEBUG', false);
to this:
define('WP_DEBUG', true);
Most of the time this allows you to see what's going wrong. When you are done, you can change WP_DEBUG back to false.