logo
Ask your WordPress questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$5
Fixing Plugin SSL Conflict

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!

sheas | 05/14/12 at 11:48am Edit | Withdraw your refund request?
Tutorial: How to assign prize money


(3) Possible Answers Submitted...

Note: sheas requested a refund. They offered no explanation.

If you disagree with this refund request, post your reasons.

If no one challenges a refund request, then they are automatically granted and proccessed after 48 hours. Admins of this site only review refund requests if someone challenges the request. If you are curious about how we handled previous refund requests, you may read over all refund requests and their challenges.

See a chronological view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    05/14/12
    12:07pm
    Arnav Joy says:

    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';

    • 05/15/12 4:45pm

      sheas says:

      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??

  • avatar
    Last edited:
    05/14/12
    12:19pm
    Luis Abarca says:

    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);

    Previous versions of this answer: 05/14/12 at 12:19pm

    • 05/15/12 4:52pm

      sheas says:

      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)?

    • 05/15/12 5:31pm

      Luis Abarca says:

      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

    • 05/15/12 6:08pm

      sheas says:

      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?

  • avatar
    Last edited:
    05/17/12
    8:28am
    Jurre Hanema says:

    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.

This question has expired.





Current status of this question: Refund requested



Please log in to add additional discourse to this page.





Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.