Plugin Directory

Changeset 1069464


Ignore:
Timestamp:
01/16/2015 03:11:19 PM (11 years ago)
Author:
srijith.v
Message:

Created tag 4.0.2.

Location:
addthis/tags/4.0.2
Files:
6 edited
2 copied

Legend:

Unmodified
Added
Removed
  • addthis/tags/4.0.2

    • Property svn:ignore set to
      *.mdown
  • addthis/tags/4.0.2/addthis-for-wordpress.php

    r1025147 r1069464  
    7474    /** Addthis Profile id **/
    7575    private $_pubid;
     76   
     77    /** Addthis Settings **/
     78    private $_options;
    7679
    7780    /**
     
    8487    public function __construct($upgrade)
    8588    {
     89        // Save async load settings via ajax request
     90        add_action( 'wp_ajax_at_async_loading', array($this, 'addthisAsyncLoading'));
    8691        $this->_upgrade = $upgrade;
    8792        $this->_getVariables = $_GET;
    8893        $this->_postVariables = $_POST;
    89        
    90         $this->_pubid = self::getPubid();
     94        $this->_options = $this->getSettings();
     95       
     96        $this->_pubid = (isset($this->_options)
     97                        && isset($this->_options['profile']))
     98                        ? $this->_options['profile'] : null;
    9199
    92100        include_once 'addthis-toolbox.php';
     
    163171
    164172        if ($this->_checkAddPubid()) {
    165             $updateResult = $this->updatePubid($this->_postVariables['pubid']);
     173            $updateResult = $this->updateSettings($this->_postVariables);
    166174        }
    167175        wp_enqueue_script(
     
    183191     *  @return string
    184192     */
    185     public function updatePubid($pubId)
    186     {
    187         global $addthis_addjs;
    188         $addthis_addjs->setProfileId($pubId);
    189         $this->_pubid = $pubId;
     193    public function updateSettings($settings)
     194    {
     195        if(isset($settings['pubid'])){
     196            $this->_options['profile'] = $settings['pubid'];
     197        }
     198        if(isset($settings['async_loading'])){
     199            $this->_options['addthis_asynchronous_loading'] = $settings['async_loading'];
     200        }
     201        update_option('addthis_settings', $this->_options);
     202        $this->_pubid = $this->_options['profile'];
    190203        return "<div class='addthis_updated wrap'>".
    191                     "AddThis Profile ID updated successfully!!!".
     204                    "AddThis Profile Settings updated successfully!!!".
    192205               "</div>";
    193206    }
     
    207220        }
    208221    }
     222   
     223    /**
     224     *  Get addthis settings array
     225     *
     226     *  @return string
     227     */
     228    public function getSettings()
     229    {
     230        return get_option('addthis_settings');
     231    }
    209232
    210233    /**
     
    252275
    253276        return $successReturn;
     277    }
     278   
     279    /**
     280     *  Check if there is request to update async loading
     281     *
     282     *  @return boolean
     283     */
     284    private function _checkAsyncLoading()
     285    {
     286        $successReturn = isset ($this->_postVariables['async_loading']);
     287
     288        return $successReturn;
     289    }
     290   
     291    public function addthisAsyncLoading()
     292    {
     293        if ($this->_checkAsyncLoading()) {
     294            $updateResult = $this->updateSettings($this->_postVariables);
     295        }
     296        die; //exit from the ajax request
    254297    }
    255298
     
    466509                      "name='pubid' id='addthis-pubid'/>";
    467510        $html .=  "</div></div>";
     511
    468512        $submitButtonValue = "Confirm and Save";
    469513       
  • addthis/tags/4.0.2/addthis-toolbox.php

    r1023701 r1069464  
    5050    const AT_ABOVE_POST = "at-above-post";
    5151    const AT_BELOW_POST = "at-below-post";
     52    const AT_ABOVE_POST_CAT_PAGE = "at-above-post-cat-page";
     53    const AT_BELOW_POST_CAT_PAGE = "at-below-post-cat-page";
     54    const AT_ABOVE_POST_ARCH_PAGE = "at-above-post-arch-page";
     55    const AT_BELOW_POST_ARCH_PAGE = "at-below-post-arch-page";   
    5256    const AT_CONTENT_BELOW_POST_HOME = "at-below-post-homepage-recommended";
    5357    const AT_CONTENT_BELOW_POST_PAGE = "at-below-post-page-recommended";
    5458    const AT_CONTENT_BELOW_POST = "at-below-post-recommended";
     59    const AT_CONTENT_BELOW_CAT_PAGE = "at-below-post-cat-page-recommended";
     60    const AT_CONTENT_BELOW_ARCH_PAGE = "at-below-post-arch-page-recommended";   
    5561    const AT_CONTENT_ABOVE_POST_HOME = "at-above-post-homepage-recommended";
    5662    const AT_CONTENT_ABOVE_POST_PAGE = "at-above-post-page-recommended";
    5763    const AT_CONTENT_ABOVE_POST = "at-above-post-recommended";
     64    const AT_CONTENT_ABOVE_CAT_PAGE = "at-above-post-cat-page-recommended";
     65    const AT_CONTENT_ABOVE_ARCH_PAGE = "at-above-post-arch-page-recommended";
    5866
    5967    /**
     
    7987    public function addWidget($content)
    8088    {
    81         if (Addthis_Wordpress::getPubid()) {
     89        if (Addthis_Wordpress::getPubid() && !is_404()) {
     90            global $post;
     91            $postid = $post->ID;
     92            $at_flag = get_post_meta( $postid, '_at_widget', TRUE );
    8293            if (is_home() || is_front_page()) {
    83                 $content  = self::_buildDiv(self::AT_ABOVE_POST_HOME) .
    84                             self::_buildDiv(self::AT_CONTENT_ABOVE_POST_HOME) .
    85                             $content;
    86                 $content .= self::_buildDiv(self::AT_BELOW_POST_HOME);
    87                 $content .= self::_buildDiv(self::AT_CONTENT_BELOW_POST_HOME);
     94                if($at_flag == '' || $at_flag == '1'){
     95                    $content  = self::_buildDiv(self::AT_ABOVE_POST_HOME) .
     96                                self::_buildDiv(self::AT_CONTENT_ABOVE_POST_HOME) .
     97                                $content;
     98                    $content .= self::_buildDiv(self::AT_BELOW_POST_HOME);
     99                    $content .= self::_buildDiv(self::AT_CONTENT_BELOW_POST_HOME);
     100                }
    88101            } else if (is_page()) {
    89                 $content  = self::_buildDiv(self::AT_ABOVE_POST_PAGE) .
    90                             self::_buildDiv(self::AT_CONTENT_ABOVE_POST_PAGE) .
    91                             $content;
    92                 $content .= self::_buildDiv(self::AT_BELOW_POST_PAGE);
    93                 $content .= self::_buildDiv(self::AT_CONTENT_BELOW_POST_PAGE);
     102                if($at_flag == '' || $at_flag == '1'){
     103                    $content  = self::_buildDiv(self::AT_ABOVE_POST_PAGE) .
     104                                self::_buildDiv(self::AT_CONTENT_ABOVE_POST_PAGE) .
     105                                $content;
     106                    $content .= self::_buildDiv(self::AT_BELOW_POST_PAGE);
     107                    $content .= self::_buildDiv(self::AT_CONTENT_BELOW_POST_PAGE);
     108                }
    94109            } else if (is_single()) {
    95                 $content  = self::_buildDiv(self::AT_ABOVE_POST) .
    96                             self::_buildDiv(self::AT_CONTENT_ABOVE_POST) .
    97                             $content;
    98                 $content .= self::_buildDiv(self::AT_BELOW_POST);
    99                 $content .= self::_buildDiv(self::AT_CONTENT_BELOW_POST);
    100             }
     110                if($at_flag == '' || $at_flag == '1'){
     111                    $content  = self::_buildDiv(self::AT_ABOVE_POST) .
     112                                self::_buildDiv(self::AT_CONTENT_ABOVE_POST) .
     113                                $content;
     114                    $content .= self::_buildDiv(self::AT_BELOW_POST);
     115                    $content .= self::_buildDiv(self::AT_CONTENT_BELOW_POST);
     116                }
     117            }  else if (is_category()) {
     118                if($at_flag == '' || $at_flag == '1'){
     119                    $content  = self::_buildDiv(self::AT_ABOVE_POST_CAT_PAGE) .
     120                                self::_buildDiv(self::AT_CONTENT_ABOVE_CAT_PAGE) .
     121                                $content;
     122                    $content .= self::_buildDiv(self::AT_BELOW_POST_CAT_PAGE);
     123                    $content .= self::_buildDiv(self::AT_CONTENT_BELOW_CAT_PAGE);
     124                }
     125            }  else if (is_archive()) {
     126                if($at_flag == '' || $at_flag == '1'){
     127                    $content  = self::_buildDiv(self::AT_ABOVE_POST_ARCH_PAGE) .
     128                                self::_buildDiv(self::AT_CONTENT_ABOVE_ARCH_PAGE) .
     129                                $content;
     130                    $content .= self::_buildDiv(self::AT_BELOW_POST_ARCH_PAGE);
     131                    $content .= self::_buildDiv(self::AT_CONTENT_BELOW_ARCH_PAGE);
     132                }
     133            }     
    101134        }
    102135
     
    115148        $title = get_the_title();
    116149        $url   = get_permalink();
    117         return "<div class='".$class." addthis-toolbox'".
     150        return "<div class='".$class." addthis-toolbox at-wordpress-hide'".
    118151                   " data-title='".$title."' data-url='".$url."'>".
    119152                "</div>";
  • addthis/tags/4.0.2/addthis_social_widget.php

    r1025150 r1069464  
    2424* Plugin URI: http://www.addthis.com
    2525* Description: Use the AddThis suite of website tools which includes sharing, following, recommended content, and conversion tools to help you make your website smarter. With AddThis, you can see how your users are engaging with your content, provide a personalized experience for each user and encourage them to share, subscribe or follow.
    26 * Version: 4.0.1
     26* Version: 4.0.2
    2727*
    2828* Author: The AddThis Team
     
    3333
    3434define( 'addthis_style_default' , 'fb_tw_p1_sc');
    35 define( 'ADDTHIS_PLUGIN_VERSION' , '4.0');
    36 define( 'ADDTHIS_PRODUCT_VERSION' , 'wpp-4.0');
     35define( 'ADDTHIS_PLUGIN_VERSION' , '4.0.2');
     36define( 'ADDTHIS_PRODUCT_VERSION' , 'wpp-4.0.2');
    3737define( 'ADDTHIS_ATVERSION', '300');
    3838define( 'ADDTHIS_ATVERSION_MANUAL_UPDATE', -1);
  • addthis/tags/4.0.2/css/style.css

    r1010585 r1069464  
    229229    padding: 3px;
    230230    text-align: center;
    231     width: 155px;
     231    width: 160px;
    232232    text-decoration: none;
    233233    font-size: inherit;
     
    249249    font-size: 12px;
    250250}
     251
     252.addthis_async {
     253    border: 0px solid gray;
     254    width: 180px;
     255}
     256
     257.hide {
     258    visibility: hidden;
     259}
  • addthis/tags/4.0.2/includes/addthis_addjs_new.php

    r1010585 r1069464  
    6464        add_action('init', array($this, 'maybe_add_footer_comment'));
    6565
     66        // for adding option for show/hide addthis sharing button in admin post add/edit page.
     67        add_action('admin_init', array($this, 'register_post_at_flag'));
     68
     69        // for saving custom field value for show/hide addthis sharing button in admin post add/edit page.
     70        add_action('save_post', array($this, 'save_at_flag'));
    6671
    6772        // Footer
     
    152157
    153158    function addWidgetToJs(){
    154         $addthis_settings_options = get_option('addthis_settings');
    155         $addthis_asynchronous_loading = (isset($addthis_settings_options['addthis_asynchronous_loading']))?$addthis_settings_options['addthis_asynchronous_loading']:false;
    156         if(isset($addthis_asynchronous_loading) && $addthis_asynchronous_loading) {
    157             $this->jsToAdd .= '<script type="text/javascript" src="//s7.addthis.com/js/'.$this->atversion.'/addthis_widget.js#pubid='. urlencode( $this->pubid ).'&async=1"></script>';
    158             //$this->jsToAdd .= '<script type="text/javascript" src="http://cache-dev.addthis.com/cachefly/js/300/addthis_widget.js&async=1"></script>';
     159        if (!is_404()) {
     160            //Load addthis script only if the page is not 404
     161            $addthis_settings_options = get_option('addthis_settings');
     162            $addthis_asynchronous_loading = (isset($addthis_settings_options['addthis_asynchronous_loading']))?$addthis_settings_options['addthis_asynchronous_loading']:false;
     163            $this->jsToAdd .= '<script type="text/javascript" src="//s7.addthis.com/js/'.$this->atversion.'/addthis_widget.js#pubid='. urlencode( $this->pubid ).'" async="async"></script>';
    159164            $this->jsToAdd .= '<script type="text/javascript">jQuery(document).ready(function($) { addthis.init(); }); </script>';
    160         } else {
    161             //$this->jsToAdd .= '<script type="text/javascript" src="http://cache-dev.addthis.com/cachefly/js/300/addthis_widget.js#pubid='. urlencode( $this->pubid ).'"></script>';
    162             $this->jsToAdd .= '<script type="text/javascript" src="//s7.addthis.com/js/'.$this->atversion.'/addthis_widget.js#pubid='. urlencode( $this->pubid ).'"></script>';
    163165        }
    164166    }
     
    193195        return null;
    194196    }
     197
     198    /*
     199     * Function to add checkbox to show/hide Addthis sharing buttons in admin post add/edit page.
     200     */
     201    public function register_post_at_flag() {
     202        add_meta_box('at_widget', __('AddThis For Wordpress'), array($this, 'add_at_flag_meta_box'), 'post', 'advanced', 'high');
     203        add_meta_box('at_widget', __('AddThis For Wordpress'), array($this, 'add_at_flag_meta_box'), 'page', 'advanced', 'high');
     204    }
     205    /*
     206     * Function to add checkbox to show/hide Addthis sharing buttons in admin post add/edit page.
     207     */
     208    public function add_at_flag_meta_box($post){
     209        $at_flag = get_post_meta($post->ID, '_at_widget', true);
     210        echo "<label for='_at_widget'>".__('Show AddThis Sharing buttons: ', 'foobar')."</label>";
     211        if($at_flag == '' || $at_flag == '1'){
     212            echo "<input type='checkbox' name='_at_widget' id='at_widget' value='1' checked='checked'/>";
     213        } else if($at_flag == '0'){
     214            echo "<input type='checkbox' name='_at_widget' id='at_widget' value='1'/>";
     215        }
     216    }
     217    /*
     218     * Function to save the value of checkbox to show/hide Addthis sharing buttons in admin post add/edit page.
     219     */
     220    function save_at_flag(){
     221        global $post;
     222        if(isset($_POST['_at_widget']))
     223            update_post_meta($post->ID, '_at_widget', $_POST['_at_widget']);
     224        else
     225            update_post_meta($post->ID, '_at_widget', '0');
     226    }
    195227}
  • addthis/tags/4.0.2/js/addthis-for-wordpress.js

    r1010585 r1069464  
    2424        }
    2525    });
     26   
     27    jQuery('#async_load').change(function(){
     28       
     29        var syncLoad = jQuery(this).is(':checked')?1:0;
     30        var data     = {
     31                            action: "at_async_loading",
     32                            async_loading: syncLoad
     33        };
     34        jQuery('.at-loader').css('visibility', 'visible');
     35        jQuery.post(ajaxurl, data, function(response){
     36            jQuery('.at-loader').css('visibility', 'hidden');
     37        });   
     38    });
    2639});
  • addthis/tags/4.0.2/readme.txt

    r1025147 r1069464  
    33Tags: AddThis, addtoany, bookmark, bookmarking, email, e-mail, sharing buttons, share, share this, facebook, google+, pinterest, instagram, linkedin, whatsapp, social tools, website tools, twitter, content marketing, recommended content, conversion tool, subscription button, conversion tools, email tools, ecommerce tools, social marketing, personalization tools
    44Requires at least: 3.0
    5 Tested up to: 4.0
    6 Stable tag: 4.0.1
     5Tested up to: 4.1
     6Stable tag: 4.0.2
    77
    88AddThis provides the best sharing, social, recommended content, and conversion tools to help you make
     
    8282
    8383== Changelog ==
     84
     85= 4.0.2 =
     86* Control inline share buttons for each page/post
     87* Bug fixes
    8488
    8589= 4.0.1 =
     
    276280
    277281== Upgrade Notice ==
     282
     283= 4.0.2 =
     284* Control inline share buttons for each page/post
     285* Bug fixes
     286
    278287= 4.0.1 =
    279288* Fix for automatically converting profile types to Wordpress type.
Note: See TracChangeset for help on using the changeset viewer.