WordPress.org

Ready to get started?Download WordPress

Forums

WordPress HTTPS (SSL)
[resolved] Why normalizeElements??? I don't get it. (6 posts)

  1. saas
    Member
    Posted 2 years ago #

    Hi Mvied,

    I am having issue with internal / local links. The plugin is setting all my local links to http and shouldn't it be allowing https when I have set the force ssl exclusively???.

    I debugged the plugin & found that your this function

    normalizeElements() forcibly making internal links to http????????

    Quick reply will be appreciated. And if you need my help in fixing it, let me know.

    Syed

    http://wordpress.org/extend/plugins/wordpress-https/

  2. Mvied
    Member
    Plugin Author

    Posted 2 years ago #

    Any page that isn't forced to HTTPS will be set to HTTP with that setting, so it's doing what it's supposed to do.

    What are you trying to do?

  3. saas
    Member
    Posted 2 years ago #

    I am trying to use

    Force SSL Exclusively ??? I set it to checked. But It still normalize my https links (which they are as I have set my home url & site url to https).

    But in normalizeElements()

    you are checking for "ssl_host_diff" value which is hidden value

    <input type="hidden" name="ssl_host_diff" value="<?php echo (($this->getPlugin()->getSetting('ssl_host_diff') != 1) ? 0 : 1); ?>" />

    So I suppose it should have either be available in settings or Force SSL Exclusively should have been considered to making decision whether to go for http or https????????????

    What are your thoughts?

  4. saas
    Member
    Posted 2 years ago #

    I have further investigated it & found out your this logic doesn't make any sense

    $this->getPlugin()->makeUrlHttp($url)????????????? why???????????
    
    $matches = array_merge($httpMatches, $httpsMatches);

    this gets me all https links

    and you are forcing all those to be http???????

    Shouldn't it considered either Force SSL Exclusively ????? if its set to yes then it should not convert to http.

    Like if it set to true it should have converted all none http to https
    or if false

    converted all https to http.

    if ($this->getPlugin()->getSetting('exclusive_https')) {
                                  $this->_html = str_replace($url, $this->getPlugin()->makeUrlHttps($url), $this->_html);
                                 } else {
                                $this->_html = str_replace($url, $this->getPlugin()->makeUrlHttp($url), $this->_html);
                                }

    I modified like this and now I have got partial http & https links (means mix) if I comment the normalize function all of my links are https.

    Can you explain the original logic of normalize function so I can be of help????

  5. saas
    Member
    Posted 2 years ago #

    The second area where the https links are forced to http

    function fixLinksAndForms();

    else if ($this->getPlugin()->isUrlLocal($url) && ($post = get_page_by_path($url_parts['path']))) {
                    $post = $post->ID;
                    //TODO When logged in to HTTP and visiting an HTTPS page, admin links will always be forced to HTTPS, even if the user is not logged in via HTTPS. I need to find a way to detect this.
                }

    so both the normalizeElements & fixLinksAndForms are causing issue for me

    I modified the normalizeElements as per this code

    if ($this->getPlugin()->getSetting('exclusive_https')) {
                                  $this->_html = str_replace($url, $this->getPlugin()->makeUrlHttps($url), $this->_html);
                                 } else {
                                $this->_html = str_replace($url, $this->getPlugin()->makeUrlHttp($url), $this->_html);
                                }

    but not sure how I can fix the above fixLinksAndForms code????????

    I will appreciate if you let me know or I will have to digg more :( I have already spent too much time on this. Hope you have the answer quick.

  6. saas
    Member
    Posted 2 years ago #

    :D Its fixed now. I have get the source from github & upload it and it fixed the issue. And I found you have fixed it a week ago. And its working for me. I will appreciate if you update the wordpress plugins repository as I am sure there will be lots of guys like me having this issue.

    Thanks for fixing it.
    Kind Regards,
    Syed

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic