Plugin Directory

Changeset 620715


Ignore:
Timestamp:
11/03/2012 03:43:17 PM (13 years ago)
Author:
TM3909
Message:

Adding Language Support and CPT custom display options.

Location:
wpsocialite/trunk
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • wpsocialite/trunk/readme.txt

    r615367 r620715  
    55Requires at least: 3.0
    66Tested up to: 3.4.2
    7 Stable tag: 1.4.2
     7Stable tag: 1.4.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3535= Can I add the social links myself instead of letting the plugin place them? =
    3636
    37 Of course! Use the "manual" setting under the plugin settings (Settings->Discussion) and then use the following PHP in your template to display the links however you please.
     37Of course! Use the "manual" setting under the plugin settings (Settings->Discussion) and then use the following template tags in your template to display the links however you please.
    3838
    39 `<?php echo wpsocialite::wpsocialite_markup('large'); ?>`
     39The first template tag is to echo out the markup and display WPSocialite:
     40
     41`<?php wpsocialite_markup('large'); ?>`
     42
     43The second template tag is to get WPSocialite's mark up and place it in an object, if needed:
     44
     45`<?php
     46    $wpsocialite =  get_wpsocialite_markup('small');
     47    echo $wpsocialite;
     48?>`
    4049
    4150When using this method, be sure to include "large" or "small" inside the function (as seen above) to define which style WPSocialite will use to display your social links.
     
    4756`define('WPSOCIALITE_LOADSCRIPTS', false);`
    4857
    49 Setting this to false tells the plugin to not load any Javascript or CSS. If you want the plugin to automatically load it again, simply set this to true or remove it completely.
     58Setting this to false tells the plugin to not load any Javascript. If you want the plugin to automatically load it again, simply set this to true or remove it completely.
     59
     60To stop the plugin from automatically loading its CSS, you would use the following line in the same way:
     61
     62`define( 'WPSOCIALITE_LOADSTYLES', false);`
     63
    5064
    5165Please note, when using this method if you are loading any social networks with an external file (Pinterest, for example), you will also have to load the javascript file associated with the network (wpsocialite/Socialite/extensions/socialite.pinterest.js).
     
    5973
    6074== Changelog ==
     75
     76= 1.4.3 =
     77* Adds localization support and allows you to select the CPT WPSocialite displays on.
    6178
    6279= 1.4.2 =
     
    85102== Upgrade Notice ==
    86103
     104= 1.4.3 =
     105* Adds localization support and allows you to select the CPT WPSocialite displays on.
     106
    87107= 1.4.2 =
    88108Fixed Pinterest loading all at once. Removed class selection option.
  • wpsocialite/trunk/wpsocialite.php

    r615367 r620715  
    55Description: No one likes long load times! Yet we all want to be able to share our content via Facebook, Twitter, and all other social networks. These take a long time to load. Paradox? Not anymore! With WPSocialite (utilizing David Bushnell's amazing SocialiteJS plugin [http://www.socialitejs.com/]) we can manage the loading process of our social sharing links. Load them on hover, on page scroll, and more!
    66Author: Tom Morton
    7 Version: 1.4.2
     7Version: 1.4.3
    88Author URI: http://twmorton.com/
    99
    10 This plugin uses the Socialitejs library created by David Bushell. The author of this plugin does not wish to claim this tool as his own but ensure that David gets proper credit for his work. I've simply wrapped his fantastic tool into a Wordpress plugin for us all to use. Please be sure to check him out: @dbushell or '.$postlink.'
    11 
    12     This program is free software; you can redistribute it and/or modify
    13     it under the terms of the GNU General Public License as published by
    14     the Free Software Foundation; either version 2 of the License, or
    15     (at your option) any later version.
    16 
    17     This program is distributed in the hope that it will be useful,
    18     but WITHOUT ANY WARRANTY; without even the implied warranty of
    19     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    20     GNU General Public License for more details.
    21 
    22     You should have received a copy of the GNU General Public License
    23     along with this program; if not, write to the Free Software
    24     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     10This plugin uses the Socialitejs library created by David Bushell. The author of this plugin does not wish to claim this tool as his own but ensure that David gets proper credit for his work. I've simply wrapped his fantastic tool into a Wordpress plugin for us all to use. Please be sure to check him out: @dbushell or http://socialitejs.com
     11
     12    This program is free software; you can redistribute it and/or modify
     13    it under the terms of the GNU General Public License as published by
     14    the Free Software Foundation; either version 2 of the License, or
     15    (at your option) any later version.
     16
     17    This program is distributed in the hope that it will be useful,
     18    but WITHOUT ANY WARRANTY; without even the implied warranty of
     19    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     20    GNU General Public License for more details.
     21
     22    You should have received a copy of the GNU General Public License
     23    along with this program; if not, write to the Free Software
     24    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2525
    2626*/
     
    3535if ( !defined('WPSOCIALITE_LOADSCRIPTS') )
    3636    define( 'WPSOCIALITE_LOADSCRIPTS', true );
     37// split style from scripts
     38if ( !defined('WPSOCIALITE_LOADSTYLES') )
     39    define( 'WPSOCIALITE_LOADSTYLES', true );
     40
    3741
    3842if (!class_exists("wpsocialite")) {
     
    5054
    5155            add_action( 'init', array( &$this, 'init' ) );
     56
     57            // localizes the buttons depending on the get_locale().
     58            add_action( 'wp_footer', array( &$this, 'wpsocialite_localize_script'),20);
    5259
    5360            add_filter( 'body_class', array( &$this, 'wpsocialite_body_class' ) );
     
    6875        function init()
    6976        {
     77            load_plugin_textdomain('wpsocialite', false, dirname(plugin_basename(__FILE__)).'/lang/');
     78
    7079            if( WPSOCIALITE_LOADSCRIPTS ){
    7180                $this->wpsocialite_enqueue_scripts();
     81            }
     82            if( WPSOCIALITE_LOADSTYLES ){
    7283                $this->wpsocialite_enqueue_styles();
    7384            }
     
    91102            if(!is_admin()){
    92103
    93                 wp_enqueue_script('socialite-lib', WPSOCIALITE_URL_SOCIALITE.'/socialite.min.js', array('jquery'), '1.0', true);
    94 
    95                 wp_enqueue_script('wpsocialite', WPSOCIALITE_URL.'wpsocialite.js', array('jquery'), '1.0', true);
     104                wp_enqueue_script('socialite-lib', WPSOCIALITE_URL_SOCIALITE.'/socialite.min.js', array('jquery'), '2.0', true);
     105
     106                wp_enqueue_script('wpsocialite', WPSOCIALITE_URL.'wpsocialite.js', array('socialite-lib'), '1.0', true);
    96107
    97108                $scripts = WPSocialite_Options::wpsocialite_list_network_options(null, null, null, null);
     
    108119        } // wpsocialite_enqueue_scripts()
    109120
     121        function wpsocialite_localize_script()
     122        {
     123            // overrides Socialite setup with valid locales
     124
     125            $locale = get_locale();
     126            $c5 = $locale;
     127            $c2 = substr($c5, 0, 2);
     128
     129            $fb_locales = array('af_ZA','ar_AR','az_AZ','be_BY','bg_BG','bn_IN','bs_BA','ca_ES','cs_CZ','cy_GB','da_DK','de_DE','el_GR','en_GB','en_US','eo_EO','es_ES','es_LA','et_EE','eu_ES','fa_IR','fi_FI','fo_FO','fr_CA','fr_FR','fy_NL','ga_IE','gl_ES','he_IL','hi_IN','hr_HR','hu_HU','hy_AM','id_ID','is_IS','it_IT','ja_JP','ka_GE','km_KH','ko_KR','ku_TR','la_VA','lt_LT','lv_LV','mk_MK','ml_IN','ms_MY','nb_NO','ne_NP','nl_NL','nn_NO','pa_IN','pl_PL','ps_AF','pt_BR','pt_PT','ro_RO','ru_RU','sk_SK','sl_SI','sq_AL','sr_RS','sv_SE','sw_KE','ta_IN','te_IN','th_TH','tl_PH','tr_TR','uk_UA','vi_VN','zh_CN','zh_HK','zh_TW');
     130            $tw_locales = array('en','fr','de','it','es','ko','ja');
     131            $gp_locales = array('af','am','ar','eu','bn','bg','ca','zh-HK','zh-CN','zh-TW','hr','cs','da','nl','en-GB','en-US','et','fil','fi','fr','fr-CA','gl','de','el','gu','iw','hi','hu','is','id','it','ja','kn','ko','lb','lt','ms','ml','mr','no','fa','pl','pt-BR','pt-PT','ro','ru','sr','sk','sl','es','es-419','sw','sv','ta','te','th','tr','uk','ur','vi','zu');
     132
     133            $fb_locale = (in_array($c5,$fb_locales))? $c5 : 'en_US';
     134            $tw_locale = (in_array($c2,$tw_locales))? $c2 : 'en';
     135            $gp_locale = (in_array($c5,$gp_locales))? str_replace('_', '-', $c5) : (in_array($c2,$gp_locales))? $c2 : 'en';
     136
     137
     138            echo "<script type=\"text/javascript\">Socialite.setup({facebook:{lang:'$fb_locale',appId:null},twitter:{lang:'$tw_locale'},googleplus:{lang:'$gp_locale'}});</script>";
     139
     140        }
     141
    110142        function wpsocialite_enqueue_styles()
    111143        {
     
    121153
    122154
    123         function wpsocialite_markup($size = null)
    124         {
     155        function wpsocialite_markup($args = array())
     156        {
     157            // use the wp_parse_arg paradigm to permit easy addition of parameters in the future.
     158            $default_args = array(
     159                'size'=>get_option('wpsocialite_style')
     160            );
     161            extract(wp_parse_args($args,$default_args),EXTR_SKIP);
     162
    125163            global $wp_query;
    126164            $post = $wp_query->post; //get post content
     
    155193        function wpsocialite_add_to_content( $content )
    156194        {
     195            // added single and post type filters
     196
     197            $single = get_option('wpsocialite_single');
    157198
    158199            $position = get_option('wpsocialite_position');
    159200
    160             $size = get_option('wpsocialite_style');
     201            $post_types = get_option('wpsocialite_post_types',array());
     202            $pt = get_post_type();
     203
     204            if ($single && !is_single()) //Do not display unless single if user specified
     205                return $content;
     206
     207            if(!in_array($pt,$post_types)) //Do not display on the specified post type
     208                return $content;
    161209
    162210            if(is_feed())
     
    171219                case 'before':
    172220
    173                     $content = $this->wpsocialite_markup($size) . $content;
     221                    $content = $this->wpsocialite_markup() . $content;
    174222
    175223                break;
     
    177225                case 'after':
    178226
    179                     $content .= $this->wpsocialite_markup($size);
     227                    $content .= $this->wpsocialite_markup();
    180228
    181229                break;
     
    207255        function admin_init()
    208256        {
     257            add_settings_section(
     258                $id = 'wpsocialite',
     259                $title = __('WPSocialite','wpsocialite'),
     260                $callback = array(&$this,'wpsocialite_section'),
     261                $page = 'discussion'
     262            );
    209263            add_settings_field(
    210264                $id = 'wpsocialite_mode',
    211                 $title = "WPSocialite Mode",
     265                $title = __('Mode','wpsocialite'),
    212266                $callback = array( &$this, 'wpsocialite_mode' ),
    213                 $page = 'discussion'
    214                 );
     267                $page = 'discussion',
     268                $section = 'wpsocialite'
     269            );
    215270            register_setting( $option_group = 'discussion', $option_name = 'wpsocialite_mode' );
    216271
    217272            add_settings_field(
    218273                $id = 'wpsocialite_excerpt',
    219                 $title = "WPSocialite Excerpt",
     274                $title = __('Apply to Excerpt','wpsocialite'),
    220275                $callback = array( &$this, 'wpsocialite_excerpt' ),
    221                 $page = 'discussion'
    222                 );
     276                $page = 'discussion',
     277                $section = 'wpsocialite'
     278            );
    223279            register_setting( $option_group = 'discussion', $option_name = 'wpsocialite_excerpt' );
    224280
    225281            add_settings_field(
     282                $id = 'wpsocialite_single',
     283                $title = __('Apply to Single only','wpsocialite'),
     284                $callback = array( &$this, 'wpsocialite_single' ),
     285                $page = 'discussion',
     286                $section = 'wpsocialite'
     287            );
     288            register_setting( $option_group = 'discussion', $option_name = 'wpsocialite_single' );
     289
     290            add_settings_field(
    226291                $id = 'wpsocialite_style',
    227                 $title = "WPSocialite Style",
     292                $title = __('Style','wpsocialite'),
    228293                $callback = array( &$this, 'wpsocialite_style' ),
    229                 $page = 'discussion'
    230                 );
     294                $page = 'discussion',
     295                $section = 'wpsocialite'
     296            );
    231297            register_setting( $option_group = 'discussion', $option_name = 'wpsocialite_style' );
    232298
    233299            add_settings_field(
    234300                $id = 'wpsocialite_position',
    235                 $title = "WPSocialite Position",
     301                $title = __('Position','wpsocialite'),
    236302                $callback = array( &$this, 'wpsocialite_position' ),
    237                 $page = 'discussion'
    238                 );
     303                $page = 'discussion',
     304                $section = 'wpsocialite'
     305            );
    239306            register_setting( $option_group = 'discussion', $option_name = 'wpsocialite_position' );
    240307
    241308            add_settings_field(
    242                 $id = 'wpsocialite_position',
    243                 $title = "WPSocialite Position",
    244                 $callback = array( &$this, 'wpsocialite_position' ),
    245                 $page = 'discussion'
    246                 );
    247             register_setting( $option_group = 'discussion', $option_name = 'wpsocialite_position' );
     309                $id = 'wpsocialite_post_types',
     310                $title = __('Post Types','wpsocialite'),
     311                $callback = array( &$this, 'wpsocialite_post_types' ),
     312                $page = 'discussion',
     313                $section = 'wpsocialite'
     314            );
     315            register_setting( $option_group = 'discussion', $option_name = 'wpsocialite_post_types' );
    248316
    249317            add_settings_field(
    250318                $id = 'wpsocialite_networkoptions',
    251                 $title = "WPSocialite Options",
     319                $title = __('Network Options','wpsocialite'),
    252320                $callback = array( &$this, 'wpsocialite_networkoptions' ),
    253                 $page = 'discussion'
    254                 );
     321                $page = 'discussion',
     322                $section = 'wpsocialite'
     323            );
    255324            register_setting( $option_group = 'discussion', $option_name = 'wpsocialite_networkoptions' );
    256325
    257326
    258327        } // function
     328
     329        function wpsocialite_section(){
     330            _e('The configuration of the WP Socialite Plugin.','wpsocialite');
     331        }
    259332
    260333        function wpsocialite_mode()
     
    263336            # echo your form fields here containing the value received from get_option
    264337
    265             if($value == 'hover'){
    266             $options = '<option value="hover" selected="selected">Hover</option>
    267                         <option value="scroll">Scroll</option>';
    268 
    269             } elseif($value == 'scroll'){
    270             $options = '<option value="hover">Hover</option>
    271                         <option value="scroll" selected="selected">Scroll</option>';
    272             } else{
    273             $options = '<option value="hover">Hover</option>
    274                         <option value="scroll" selected="selected">Scroll</option>';
    275             }
    276 
    277338            echo '<label for="wpsocialite_mode">
    278339                    <select name="wpsocialite_mode" id="wpsocialite_mode">
    279                         '.$options.'
     340                        <option value="scroll" '.selected($value,'scroll',false).'>'.__('Scroll','wpsocialite').'</option>
     341                        <option value="hover" '.selected($value,'hover',false).'>'.__('Hover','wpsocialite').'</option>
    280342                    </select>
    281                     Choose the type of socialite style you would like to use.
     343                    '.__('Choose the event to which Socialite will activate.','wpsocialite').'
    282344                </label>';
    283345
     
    288350            $value = get_option('wpsocialite_excerpt');
    289351            # echo your form fields here containing the value received from get_option
    290             if($value == 1) :
    291                 $checked = 'checked';
    292             else :
    293                 $checked = '';
    294             endif;
    295352
    296353            echo '<label for="wpsocialite_excerpt">
    297                     <input name="wpsocialite_excerpt" type="checkbox" id="wpsocialite_excerpt" value="1" '.$checked.'>
    298                     Display WPSocialite sharing options in the excerpt of your posts.
     354                    <input name="wpsocialite_excerpt" type="checkbox" id="wpsocialite_excerpt" value="1" '.checked($value,1,false).'>
     355                    '.__('Display WPSocialite sharing buttons in the excerpt of your posts.','wpsocialite').'
    299356                </label>';
    300357
    301358        } // function
    302359
    303         function wpsocialite_position()
     360        function wpsocialite_single()
     361        {
     362            $value = get_option('wpsocialite_single');
     363            # echo your form fields here containing the value received from get_option
     364
     365            echo '<label for="wpsocialite_single">
     366                    <input name="wpsocialite_single" type="checkbox" id="wpsocialite_single" value="1" '.checked($value,1,false).'>
     367                    '.__('Display WPSocialite sharing buttons only on single posts.','wpsocialite').'
     368                </label>';
     369
     370        } // function
     371
     372                function wpsocialite_position()
    304373        {
    305374            $value = get_option('wpsocialite_position');
    306375            # echo your form fields here containing the value received from get_option
    307376
    308             if($value == 'before'){
    309             $options = '<option value="before" selected="selected">Before</option>
    310                         <option value="after">After</option>
    311                         <option value="manual">Manual</option>';
    312             } elseif($value == 'after'){
    313             $options = '<option value="before">Before</option>
    314                         <option value="after" selected="selected">After</option>
    315                         <option value="manual">Manual</option>';
    316             } elseif($value == 'manual'){
    317             $options = '<option value="before">Before</option>
    318                         <option value="after">After</option>
    319                         <option value="manual" selected="selected">Manual</option>';
    320             } else {
    321             $options = '<option value="before" selected="selected">Before</option>
    322                         <option value="after">After</option>
    323                         <option value="manual">Manual</option>';
    324             }
    325 
    326377            echo '<label for="wpsocialite_position">
    327378                    <select name="wpsocialite_position" id="wpsocialite_position">
    328                         '.$options.'
     379                        <option value="before" '.selected($value,'before',false).'>'.__('Before','wpsocialite').'</option>
     380                        <option value="after" '.selected($value,'after',false).'>'.__('After','wpsocialite').'</option>
     381                        <option value="manual" '.selected($value,'manual',false).'>'.__('Manual','wpsocialite').'</option>
    329382                    </select>
    330                     Choose where you would like the social icons to appear, before or after the main content. If set to <strong>Manual</strong>, you can use this code to place your Social links anywhere you like: <pre>&lt;?php echo wpsocialite::wpsocialite_markup("large"); ?&gt;</pre>
     383                    '.sprintf(__('Choose where you would like the social icons to appear, before or after the main content. If set to <strong>Manual</strong>, you can use this code to place your Social links anywhere you like in your templates files: %s','wpsocialite'),'<pre>&lt;?php wpsocialite_markup(); ?&gt;</pre>').'
    331384                </label>';
    332385
     
    340393            # echo your form fields here containing the value received from get_option
    341394
    342             if($value == 'small'){
    343             $options = '<option value="large">Large</option>
    344                         <option value="small" selected="selected">Small</option>';
    345             } else {
    346             $options = '<option value="large" selected="selected">Large</option>
    347                         <option value="small">Small</option>';
    348             }
    349 
    350395            echo '<label for="wpsocialite_style">
    351396                    <select name="wpsocialite_style" id="wpsocialite_style">
    352                         '.$options.'
     397                        <option value="large" '.selected($value,'large',false).'>'.__('Large','wpsocialite').'</option>
     398                        <option value="small" '.selected($value,'small',false).'>'.__('Small','wpsocialite').'</option>
    353399                    </select>
    354                     Choose the type of socialite style you would like to use.
     400                    '.__('Choose the type of socialite style you would like to use.','wpsocialite').'
    355401                </label>';
    356402
     
    358404
    359405        } // function
     406
     407        // specify to which post type to show the buttons
     408        function wpsocialite_post_types(){
     409            $value = get_option('wpsocialite_post_types',array());
     410                $post_types = get_post_types(array('public'=>true),'objects');
     411
     412                foreach($post_types as $pt=>$ptobj){
     413                    $checked = (in_array($pt, $value))?' checked="CHECKED"': '';
     414                    echo '<label for="wpsocialite_post_type_'.$pt.'">
     415                            <input name="wpsocialite_post_types[]" type="checkbox" id="wpsocialite_post_type_'.$pt.'" value="'.$pt.'" '.$checked.' > '
     416                            .$ptobj->label.
     417                        '</label><br />';
     418                }
     419
     420        }// function
    360421
    361422        function wpsocialite_networkoptions(){
     
    371432                endif;
    372433
    373                 if($buttonvalue == 1) :
    374                     $checked = 'checked';
    375                 else :
    376                     $checked = '';
    377                 endif;
    378 
    379434                $output .= '
    380435                <label for="wpsocialite_networkoptions['.$button['slug'].']">
    381                     <input name="wpsocialite_networkoptions['.$button['slug'].']" type="checkbox" id="wpsocialite_networkoptions['.$button['slug'].']" value="1" '.$checked.'>
     436                    <input name="wpsocialite_networkoptions['.$button['slug'].']" type="checkbox" id="wpsocialite_networkoptions['.$button['slug'].']" value="1" '.checked($buttonvalue,1,false).'>
    382437                    '.$button['name'].'
    383438                </label><br />';
    384439            }
    385440
    386             echo 'Select the social networks to display.<br />
    387                 '.$output.'
    388             ';
     441            echo __('Select the social networks to display.','wpsocialite').'<br />
     442                '.$output;
    389443
    390444        }
     
    392446        function wpsocialite_list_network_options($link = null, $title = null, $size = null, $image = null) {
    393447            if( $image == '') { $image = null; } //link post featured image with Pinterest, if available
    394 
    395             $buttons = array(
    396                 'facebook' => array(
    397                     'name' => 'Facebook',
    398                     'slug' => 'facebook',
    399                     'markup_large' => '<a href="http://www.facebook.com/sharer.php?u='.$link.'&amp;t='.$title.'" class="socialite facebook-like" data-href="'.$link.'" data-send="false" data-layout="box_count" data-width="60" data-show-faces="false" rel="nofollow" target="_blank"><span class="vhidden">Share on Facebook</span></a>',
    400                     'markup_small' => '<a href="http://www.facebook.com/sharer.php?u='.$link.'&amp;t='.$title.'" class="socialite facebook-like" data-href="'.$link.'" data-send="false" data-layout="button_count" data-width="60" data-show-faces="false" rel="nofollow" target="_blank"><span class="vhidden">Share on Facebook</span></a>',
    401                     'external_file' => false
    402                 ),
    403                 'twitter' => array(
    404                     'name' => 'Twitter',
    405                     'slug' => 'twitter',
    406                     'markup_large' => '<a href="http://twitter.com/share" class="socialite twitter-share" data-text="'.$title.'" data-url="'.$link.'" data-count="vertical" rel="nofollow" target="_blank"><span class="vhidden">Share on Twitter</span></a>',
    407                     'markup_small' => '<a href="http://twitter.com/share" class="socialite twitter-share" data-text="'.$title.'" data-url="'.$link.'" data-count="horizontal" data-via="" rel="nofollow" target="_blank"><span class="vhidden">Share on Twitter</span></a>',
    408                     'external_file' => false
    409                 ),
    410                 'gplus' => array(
    411                     'name' => 'Google Plus',
    412                     'slug' => 'gplus',
    413                     'markup_large' => '<a href="https://plus.google.com/share?url='.$link.'" class="socialite googleplus-one" data-size="tall" data-href="'.$link.'" rel="nofollow" target="_blank"><span class="vhidden">Share on Google+</span></a>',
    414                     'markup_small' => '<a href="https://plus.google.com/share?url='.$link.'" class="socialite googleplus-one" data-size="medium" data-href="'.$link.'" rel="nofollow" target="_blank"><span class="vhidden">Share on Google+</span></a>',
    415                     'external_file' => false
    416                 ),
    417                 'linkedin' => array(
    418                     'name' => 'Linkedin',
    419                     'slug' => 'linkedin',
    420                     'markup_large' => '<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url='.$link.'&amp;title='.$title.'" class="socialite linkedin-share" data-url="'.$link.'" data-counter="top" rel="nofollow" target="_blank"><span class="vhidden">Share on LinkedIn</span></a>',
    421                     'markup_small' => '<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url='.$link.'&amp;title='.$title.'" class="socialite linkedin-share" data-url="'.$link.'" data-counter="right" rel="nofollow" target="_blank"><span class="vhidden">Share on LinkedIn</span></a>',
    422                     'external_file' => false
    423                 ),
    424                 'pinterest' => array(
    425                     'name' => 'Pinterest',
    426                     'slug' => 'pinterest',
    427                     'markup_large' => '<a href="http://pinterest.com/pin/create/button/?url='.$link.'&amp;media=' . $image . '&amp;description='.$title.'" class="socialite pinterest-pinit" data-count-layout="vertical"><span class="vhidden">Pin It!</span></a>',
    428                     'markup_small' => '<a href="http://pinterest.com/pin/create/button/?url='.$link.'&amp;media=' . $image . '&amp;description='.$title.'" class="socialite pinterest-pinit" data-count-layout="horizontal"><span class="vhidden">Pin It!</span></a>',
    429                     'external_file' => 'socialite.pinterest.js'
    430                 ),
    431             );
     448                        $locale = get_locale();
     449            $buttons = array(
     450                'facebook' => array(
     451                    'name' => 'Facebook',
     452                    'slug' => 'facebook',
     453                    'markup_large' => '<a href="http://www.facebook.com/sharer.php?u='.$link.'&amp;locale='.$locale.'&amp;t='.$title.'" class="socialite facebook-like" data-lang="'.$locale.'" data-href="'.$link.'" data-send="false" data-layout="box_count" data-width="60" data-show-faces="false" rel="nofollow" target="_blank"><span class="vhidden">'.apply_filters('wpsocialite_share_facebook_label',__('Share on Facebook.','wpsocialite')).'</span></a>',
     454                    'markup_small' => '<a href="http://www.facebook.com/sharer.php?u='.$link.'&amp;locale='.$locale.'&amp;t='.$title.'" class="socialite facebook-like" data-lang="'.$locale.'" data-href="'.$link.'" data-send="false" data-layout="button_count" data-width="60" data-show-faces="false" rel="nofollow" target="_blank"><span class="vhidden">'.apply_filters('wpsocialite_share_facebook_label',__('Share on Facebook.','wpsocialite')).'</span></a>',
     455                    'external_file' => false
     456                ),
     457                'twitter' => array(
     458                    'name' => 'Twitter',
     459                    'slug' => 'twitter',
     460                    'markup_large' => '<a href="http://twitter.com/share" class="socialite twitter-share" data-text="'.$title.'" data-url="'.$link.'" data-count="vertical" data-lang="'.$locale.'" rel="nofollow" target="_blank"><span class="vhidden">'.apply_filters('wpsocialite_share_twitter_label',__('Share on Twitter.','wpsocialite')).'</span></a>',
     461                    'markup_small' => '<a href="http://twitter.com/share" class="socialite twitter-share" data-text="'.$title.'" data-url="'.$link.'" data-count="horizontal" data-lang="'.$locale.'" data-via="" rel="nofollow" target="_blank"><span class="vhidden">'.apply_filters('wpsocialite_share_twitter_label',__('Share on Twitter.','wpsocialite')).'</span></a>',
     462                    'external_file' => false
     463                ),
     464                'gplus' => array(
     465                    'name' => 'Google Plus',
     466                    'slug' => 'gplus',
     467                    'markup_large' => '<a href="https://plus.google.com/share?url='.$link.'" class="socialite googleplus-one" data-size="tall" data-href="'.$link.'" rel="nofollow" target="_blank"><span class="vhidden">'.apply_filters('wpsocialite_share_googleplus_label',__('Share on Google+','wpsocialite')).'</span></a>',
     468                    'markup_small' => '<a href="https://plus.google.com/share?url='.$link.'" class="socialite googleplus-one" data-size="medium" data-href="'.$link.'" rel="nofollow" target="_blank"><span class="vhidden">'.apply_filters('wpsocialite_share_googleplus_label',__('Share on Google+','wpsocialite')).'</span></a>',
     469                    'external_file' => false
     470                ),
     471                'linkedin' => array(
     472                    'name' => 'Linkedin',
     473                    'slug' => 'linkedin',
     474                    'markup_large' => '<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url='.$link.'&amp;title='.$title.'" class="socialite linkedin-share" data-url="'.$link.'" data-counter="top" rel="nofollow" target="_blank"><span class="vhidden">'.apply_filters('wpsocialite_share_linkedin_label',__('Share on LinkedIn','wpsocialite')).'</span></a>',
     475                    'markup_small' => '<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url='.$link.'&amp;title='.$title.'" class="socialite linkedin-share" data-url="'.$link.'" data-counter="right" rel="nofollow" target="_blank"><span class="vhidden">'.apply_filters('wpsocialite_share_linkedin_label',__('Share on LinkedIn','wpsocialite')).'</span></a>',
     476                    'external_file' => false
     477                ),
     478                'pinterest' => array(
     479                    'name' => 'Pinterest',
     480                    'slug' => 'pinterest',
     481                    'markup_large' => '<a href="http://pinterest.com/pin/create/button/?url='.$link.'&amp;media=' . $image . '&amp;description='.$title.'" class="socialite pinterest-pinit" data-count-layout="vertical"><span class="vhidden">'.apply_filters('wpsocialite_share_pinterest_label',__('Pin It!','wpsocialite')).'</span></a>',
     482                    'markup_small' => '<a href="http://pinterest.com/pin/create/button/?url='.$link.'&amp;media=' . $image . '&amp;description='.$title.'" class="socialite pinterest-pinit" data-count-layout="horizontal"><span class="vhidden">'.apply_filters('wpsocialite_share_pinterest_label',__('Pin It!','wpsocialite')).'</span></a>',
     483                    'external_file' => 'socialite.pinterest.js'
     484                ),
     485            );
    432486
    433487            return $buttons;
    434488        }
    435 
    436489
    437490        function wpsocialite_settings_link($links, $file) {
     
    440493
    441494            if ($file == $this_plugin){
    442                 $settings_link = '<a href="options-discussion.php#wpsocialite_mode">'.__("Settings", "wpsocialite").'</a>';
     495                $settings_link = '<a href="options-discussion.php#wpsocialite_mode">'.__('Settings', 'wpsocialite').'</a>';
    443496                array_unshift($links, $settings_link);
    444497            }
     
    452505
    453506$wpsocialite = new wpsocialite;
     507
     508/* Template Tags
     509 *
     510 */
     511function get_wpsocialite_markup($args = array()){
     512    $wpsocialite = wpsocialite::wpsocialite_markup($args);
     513    return $wpsocialite;
     514}
     515function wpsocialite_markup($args = array()){
     516    $wpsocialite = get_wpsocialite_markup($args);
     517    echo $wpsocialite;
     518}
Note: See TracChangeset for help on using the changeset viewer.