WordPress.org

Ready to get started?Download WordPress

Forums

WP Tweet Button
[resolved] Patch submission to make the plugin compatible with SSL (2 posts)

  1. phoflame
    Member
    Posted 2 years ago #

    Currently the plugin uses WP_PLUGIN_URL in all of the paths for where the button image is located at, WP_PLUGIN_URL is a derivative of WP_CONTENT_URL, which in turn is based on what the user specifies as their 'siteurl'.

    If the 'siteurl' is set for http, and only some pages are served via https, then those secure pages which this plugin is used on will have the button image served from http instead of https causing insecure content warnings from browsers.

    I submit the following changes to correct this issue in the hopes that you will include them, or similar changes, in future releases so I do not have to maintain a separate code base for this plugin for the sites I use it on.

    wp-tweet-button.php original lines 46-49

    var $hasbutton 		= array();
    var $postid;
    /**
    * The following are default settings for the plugin's configuration.

    wp-tweet-button.php changes

    var $hasbutton 		= array();
    var $postid;
    var $wpt_pluginpath;
    /**
    * The following are default settings for the plugin's configuration.

    wp-tweet-button.php original lines 1205-1208

    } else {
        $StyleStrDiv = ' style="' . $this->tw_get_option('tw_style_c') .$dssep. $alignstr . '"';
        $StyleStrBtn = ' style="width:55px;height:22px;background:transparent url(\''. WP_PLUGIN_URL.'/wp-tweet-button/tweetn.png\') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;"';
     }

    wp-tweet-button.php changes

    } else {
        $wpt_pluginpath = (empty($_SERVER['HTTPS'])) ? WP_PLUGIN_URL : str_replace("http://", "https://", WP_PLUGIN_URL);
        $StyleStrDiv = ' style="' . $this->tw_get_option('tw_style_c') .$dssep. $alignstr . '"';
        $StyleStrBtn = ' style="width:55px;height:22px;background:transparent url(\''. $wpt_pluginpath.'/wp-tweet-button/tweetn.png\') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;"';
     }

    settings.inc.php original lines 179-192

    <td class="twhdata">
      <div style="float:left;margin-right:10px;">
      <input type="radio" value="vertical" class="floatleftm10" <?php if ($this->tw_get_option('tw_count') == 'vertical') echo 'checked="checked"'; ?> name="tw_count" id="tw_count_vertical" group="tw_count"/>
      <label for="tw_count_vertical" class="tweetbtnc" style="border-right: 1px solid #E3E3E3;width:70px;background:transparent url('<?php echo WP_PLUGIN_URL; ?>/wp-tweet-button/tweetv.png') no-repeat 0 24px"><?php _e('Vertical',$this->txtdom);?></label>
      </div>
      <div style="float:left;margin-right:10px;">
      <input type="radio" value="horizontal" class="floatleftm10" <?php if ($this->tw_get_option('tw_count') == 'horizontal') echo 'checked="checked"'; ?> name="tw_count" id="tw_count_horizontal" group="tw_count"/>
      <label for="tw_count_horizontal" class="tweetbtnc" style="border-right: 1px solid #E3E3E3;width:120px;background:transparent url('<?php echo WP_PLUGIN_URL; ?>/wp-tweet-button/tweeth.png') no-repeat  0 24px"><?php _e('Horizontal',$this->txtdom);?></label>
      </div>
      <div style="float:left;">
      <input type="radio" value="none" class="floatleftm10" <?php if ($this->tw_get_option('tw_count') == 'none') echo 'checked="checked"'; ?> name="tw_count" id="tw_count_none" group="tw_count" />
      <label for="tw_count_none" class="tweetbtnc" style="width:60px;background:transparent url('<?php echo WP_PLUGIN_URL; ?>/wp-tweet-button/tweetn.png') no-repeat  0 24px"><?php _e('No count',$this->txtdom);?></label>
      </div>
    </td>

    settings.inc.php changes

    <td class="twhdata">
      <div style="float:left;margin-right:10px;">
      <input type="radio" value="vertical" class="floatleftm10" <?php if ($this->tw_get_option('tw_count') == 'vertical') echo 'checked="checked"'; ?> name="tw_count" id="tw_count_vertical" group="tw_count"/>
      <label for="tw_count_vertical" class="tweetbtnc" style="border-right: 1px solid #E3E3E3;width:70px;background:transparent url('<?php $wpt_pluginpath = (empty($_SERVER['HTTPS'])) ? WP_PLUGIN_URL : str_replace("http://", "https://", WP_PLUGIN_URL); echo $wpt_pluginpath; ?>/wp-tweet-button/tweetv.png') no-repeat 0 24px"><?php _e('Vertical',$this->txtdom);?></label>
      </div>
      <div style="float:left;margin-right:10px;">
      <input type="radio" value="horizontal" class="floatleftm10" <?php if ($this->tw_get_option('tw_count') == 'horizontal') echo 'checked="checked"'; ?> name="tw_count" id="tw_count_horizontal" group="tw_count"/>
      <label for="tw_count_horizontal" class="tweetbtnc" style="border-right: 1px solid #E3E3E3;width:120px;background:transparent url('<?php $wpt_pluginpath = (empty($_SERVER['HTTPS'])) ? WP_PLUGIN_URL : str_replace("http://", "https://", WP_PLUGIN_URL); echo $wpt_pluginpath; ?>/wp-tweet-button/tweeth.png') no-repeat  0 24px"><?php _e('Horizontal',$this->txtdom);?></label>
      </div>
      <div style="float:left;">
      <input type="radio" value="none" class="floatleftm10" <?php if ($this->tw_get_option('tw_count') == 'none') echo 'checked="checked"'; ?> name="tw_count" id="tw_count_none" group="tw_count" />
      <label for="tw_count_none" class="tweetbtnc" style="width:60px;background:transparent url('<?php $wpt_pluginpath = (empty($_SERVER['HTTPS'])) ? WP_PLUGIN_URL : str_replace("http://", "https://", WP_PLUGIN_URL); echo $wpt_pluginpath; ?>/wp-tweet-button/tweetn.png') no-repeat  0 24px"><?php _e('No count',$this->txtdom);?></label>
      </div>
    </td>

    perpostsettings.inc.php original line 33-35

    <div class="misc-pub-section">
      <img src="<?php echo WP_PLUGIN_URL; ?>/wp-tweet-button/tweetn.png" id="tw_tweet_button_image" style="float:right;margin:-3px 10px 0 10px"/>
      <input style="min-width:20px;" onclick="var twimgp=document.getElementById('tw_tweet_button_image');twimgp.style.display=(this.checked)?'none':'block';" type="checkbox" value="1" <?php if ($tw_exclude_tweet_button == '1') echo 'checked="checked"'; ?> name="tw_exclude_tweet_button" id="tw_exclude_tweet_button"/>

    perpostsettings.in.php changes

    <div class="misc-pub-section">
      <img src="<?php $wpt_pluginpath = (empty($_SERVER['HTTPS'])) ? WP_PLUGIN_URL : str_replace("http://", "https://", WP_PLUGIN_URL); echo $wpt_pluginpath; ?>/wp-tweet-button/tweetn.png" id="tw_tweet_button_image" style="float:right;margin:-3px 10px 0 10px"/>
      <input style="min-width:20px;" onclick="var twimgp=document.getElementById('tw_tweet_button_image');twimgp.style.display=(this.checked)?'none':'block';" type="checkbox" value="1" <?php if ($tw_exclude_tweet_button == '1') echo 'checked="checked"'; ?> name="tw_exclude_tweet_button" id="tw_exclude_tweet_button"/>

    http://wordpress.org/extend/plugins/wp-tweet-button/

  2. Tanin
    Member
    Plugin Author

    Posted 2 years ago #

    Changes accepted. Will be incorporated in version 2.1.2

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic