Version Description
- More Customization Option
- optionally shorten urls with one bit.ly account
Download this release
Release Info
Developer | jorbin |
Plugin | WordPress Share Buttons Plugin – AddThis |
Version | 2.2.0 |
Comparing to | |
See all releases |
Code changes from version 2.0.0 to 2.2.0
- addthis_post_metabox.php +71 -0
- addthis_settings_functions.php +161 -0
- addthis_sidebar_widget.php +3 -3
- addthis_social_widget.php +884 -304
- css/addthis.css +3 -29
- css/options-page.css +0 -36
- js/addthis.js +1 -1
- js/options-page.32.js +0 -164
- js/options-page.js +4 -57
- readme.txt +76 -9
addthis_post_metabox.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class addthis_post_metabox{
|
3 |
+
|
4 |
+
function admin_init()
|
5 |
+
{
|
6 |
+
$screens = apply_filters('addthis_post_metabox_screens', array('post', 'page') );
|
7 |
+
foreach($screens as $screen)
|
8 |
+
{
|
9 |
+
add_meta_box('addthis', 'AddThis', array($this, 'post_metabox'), $screen, 'side', 'default' );
|
10 |
+
}
|
11 |
+
add_action('save_post', array($this, 'save_post') );
|
12 |
+
|
13 |
+
add_filter('default_hidden_meta_boxes', array($this, 'default_hidden_meta_boxes' ) );
|
14 |
+
}
|
15 |
+
|
16 |
+
function default_hidden_meta_boxes($hidden)
|
17 |
+
{
|
18 |
+
$hidden[] = 'addthis';
|
19 |
+
return $hidden;
|
20 |
+
}
|
21 |
+
|
22 |
+
function post_metabox(){
|
23 |
+
global $post_id;
|
24 |
+
|
25 |
+
if ( is_null($post_id) )
|
26 |
+
$checked = '';
|
27 |
+
else
|
28 |
+
{
|
29 |
+
$custom_fields = get_post_custom($post_id);
|
30 |
+
$checked = ( isset ($custom_fields['addthis_exclude']) ) ? 'checked="checked"' : '' ;
|
31 |
+
}
|
32 |
+
|
33 |
+
wp_nonce_field('addthis_postmetabox_nonce', 'addthis_postmetabox_nonce');
|
34 |
+
echo '<label for="addthis_show_option">';
|
35 |
+
_e("Remove AddThis:", 'myplugin_textdomain' );
|
36 |
+
echo '</label> ';
|
37 |
+
echo '<input type="checkbox" id="addthis_show_option" name="addthis_show_option" value="1" '.$checked.'>';
|
38 |
+
}
|
39 |
+
|
40 |
+
function save_post($post_id)
|
41 |
+
{
|
42 |
+
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
43 |
+
return;
|
44 |
+
|
45 |
+
if ( ! isset($_POST['addthis_postmetabox_nonce'] ) || !wp_verify_nonce( $_POST['addthis_postmetabox_nonce'], 'addthis_postmetabox_nonce' ) )
|
46 |
+
return;
|
47 |
+
|
48 |
+
if ( ! isset($_POST['addthis_show_option']) )
|
49 |
+
{
|
50 |
+
delete_post_meta($post_id, 'addthis_exclude');
|
51 |
+
}
|
52 |
+
else
|
53 |
+
{
|
54 |
+
$custom_fields = get_post_custom($post_id);
|
55 |
+
if (! isset ($custom_fields['addthis_exclude'][0]) )
|
56 |
+
{
|
57 |
+
add_post_meta($post_id, 'addthis_exclude', 'true');
|
58 |
+
}
|
59 |
+
else
|
60 |
+
{
|
61 |
+
update_post_meta($post_id, 'addthis_exclude', 'true' , $custom_fields['addthis_exclude'][0] );
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
}
|
66 |
+
|
67 |
+
}
|
68 |
+
|
69 |
+
$addthis_post_metabox = new addthis_post_metabox;
|
70 |
+
add_action('admin_init', array($addthis_post_metabox, 'admin_init'));
|
71 |
+
|
addthis_settings_functions.php
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Get the list of styles
|
4 |
+
*/
|
5 |
+
|
6 |
+
function _get_style_options()
|
7 |
+
{
|
8 |
+
global $addthis_new_styles;
|
9 |
+
return apply_filters('addthis_style_options', $addthis_new_styles );
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* AddThis replacement for kses
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
function addthis_kses($string)
|
17 |
+
{
|
18 |
+
global $allowedposttags;
|
19 |
+
$mytags = $allowedposttags;
|
20 |
+
$mytags['a'][ 'gplusonesize' ] = array();
|
21 |
+
$mytags['a'][ 'gplusonecount' ]= array();
|
22 |
+
$mytags['a'][ 'fblikelayout' ]= array();
|
23 |
+
$mytags['a'][ 'fblikesend' ]= array();
|
24 |
+
$mytags['a'][ 'fblikeshow_faces' ]= array();
|
25 |
+
$mytags['a'][ 'fblikewidth' ]= array();
|
26 |
+
$mytags['a'][ 'fblikeaction' ]= array();
|
27 |
+
$mytags['a'][ 'fblikefont' ]= array();
|
28 |
+
$mytags['a'][ 'fblikecolorscheme' ]= array();
|
29 |
+
$mytags['a'][ 'fblikeref' ]= array();
|
30 |
+
$mytags['a'][ 'fblikehref' ]= array();
|
31 |
+
$mytags['a'][ 'twcount' ]= array();
|
32 |
+
$mytags['a'][ 'twurl' ]= array();
|
33 |
+
$mytags['a'][ 'twvia' ]= array();
|
34 |
+
$mytags['a'][ 'twtext' ]= array();
|
35 |
+
$mytags['a'][ 'twrelated' ]= array();
|
36 |
+
$mytags['a'][ 'twlang' ]= array();
|
37 |
+
$mytags['a'][ 'twcounturl' ]= array();
|
38 |
+
|
39 |
+
$pretags = array( 'g:plusone:', 'fb:like:', 'tw:');
|
40 |
+
$posttags = array('gplusone', 'fblike', 'tw');
|
41 |
+
|
42 |
+
foreach($pretags as $attr)
|
43 |
+
{
|
44 |
+
$pre_pattern[] = '/'.$attr.'/';
|
45 |
+
}
|
46 |
+
foreach($posttags as $attr)
|
47 |
+
{
|
48 |
+
$post_pattern[] = '/'.$attr.'/';
|
49 |
+
}
|
50 |
+
$temp_string = preg_replace( $pre_pattern, $posttags, $string);
|
51 |
+
$new_temp_string = wp_kses($temp_string, $mytags);
|
52 |
+
$new_string = preg_replace( $post_pattern, $pretags, $new_temp_string);
|
53 |
+
|
54 |
+
// Add in our %s so that the url and title get added properly
|
55 |
+
|
56 |
+
|
57 |
+
return $new_string;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* The icon choser row. Should be made to look a bit prettier
|
62 |
+
*/
|
63 |
+
function _addthis_choose_icons($name, $options)
|
64 |
+
{
|
65 |
+
$addthis_new_styles = _get_style_options();
|
66 |
+
extract($options);
|
67 |
+
if ($name == 'above')
|
68 |
+
{
|
69 |
+
$option = $above;
|
70 |
+
$custom_size = $above_custom_size;
|
71 |
+
$do_custom_services = ( isset( $above_do_custom_services ) && $above_do_custom_services ) ? 'checked="checked"' : '';
|
72 |
+
$do_custom_preferred = ( isset( $above_do_custom_preferred ) && $above_do_custom_preferred ) ? 'checked="checked"' : '';
|
73 |
+
$custom_services = $above_custom_services;
|
74 |
+
$custom_preferred = $above_custom_preferred;
|
75 |
+
$custom_more = $above_custom_more;
|
76 |
+
$custom_string = $above_custom_string;
|
77 |
+
}
|
78 |
+
else
|
79 |
+
{
|
80 |
+
$option = $below;
|
81 |
+
$custom_size = $below_custom_size;
|
82 |
+
$do_custom_services = ( isset( $below_do_custom_services ) && $below_do_custom_services ) ? 'checked="checked"' : '';
|
83 |
+
$do_custom_preferred = ( isset( $below_do_custom_preferred ) && $below_do_custom_preferred ) ? 'checked="checked"' : '';
|
84 |
+
$custom_services = $below_custom_services;
|
85 |
+
$custom_preferred = $below_custom_preferred;
|
86 |
+
$custom_more = $below_custom_more;
|
87 |
+
$custom_string = $below_custom_string;
|
88 |
+
}
|
89 |
+
?>
|
90 |
+
<tr>
|
91 |
+
<td id="<?php echo $name ?>" colspan="2">
|
92 |
+
<p><?php _e("$name the post", 'addthis_trans_domain') ?> <span class="description"><input type="checkbox" name="addthis_settings[show_<?php echo $name; ?>]" <?php echo ('none' == $option) ? 'checked="checked"' : '';?> /> none</span></p>
|
93 |
+
<?php $imgLocationBase = apply_filters( 'at_files_uri', plugins_url( '' , basename(dirname(__FILE__)))) . '/addthis/img/' ;
|
94 |
+
$imgLocationBase = apply_filters( 'addthis_files_uri', plugins_url( '' , basename(dirname(__FILE__)))) . '/addthis/img/' ;
|
95 |
+
foreach ($addthis_new_styles as $k => $v)
|
96 |
+
{
|
97 |
+
$class = 'hidden';
|
98 |
+
$checked = '';
|
99 |
+
if ($option == $k || ($option == 'none' && $k == $addthis_default_options[$name] ) ){
|
100 |
+
$checked = 'checked="checked"';
|
101 |
+
$class = '';
|
102 |
+
}
|
103 |
+
echo "<p class='$name"."_option select_row $class '><input $checked type='radio' value='".$k."' name='addthis_settings[$name]' /><img alt='".$k."' src='". $imgLocationBase . $v['img'] ."'/></p>";
|
104 |
+
}
|
105 |
+
|
106 |
+
$class = 'hidden';
|
107 |
+
$checked = '';
|
108 |
+
if ($option == 'custom' || ($option == 'none' && 'custom' == $addthis_default_options[$name] ) ){
|
109 |
+
$checked = 'checked="checked"';
|
110 |
+
$class = '';
|
111 |
+
}
|
112 |
+
|
113 |
+
echo "<div class='$name"."_option select_row $class '><input $checked type='radio' value='custom' name='addthis_settings[$name]' id='$name"."_custom_button' /> Build your own</input>";
|
114 |
+
|
115 |
+
echo "<ul class='$name"."_option_custom hidden'>";
|
116 |
+
$custom_16 = ($custom_size == 16) ? 'selected="selected"' : '' ;
|
117 |
+
$custom_32 = ($custom_size == 32) ? 'selected="selected"' : '' ;
|
118 |
+
|
119 |
+
echo "<li class='nocheck'><span class='at_custom_label'>Size:</span><select name='addthis_settings[$name"."_custom_size]'><option value='16' $custom_16 >16x16</option><option value='32' $custom_32 >32x32</option></select><br/><span class='description'>The size of the icons you want to display</span></li>";
|
120 |
+
echo "<li><input $do_custom_services class='at_do_custom' type='checkbox' name='addthis_settings[$name"."_do_custom_services]' value='true' /><span class='at_custom_label'>Services to always show:</span><input class='at_custom_input' name='addthis_settings[$name"."_custom_services]' value='$custom_services'/><br/><span class='description'>Enter a comma-separated list of <a href='//addthis.com/services'>service codes</a> </span></li>";
|
121 |
+
echo "<li><input type='checkbox' $do_custom_preferred class='at_do_custom' name='addthis_settings[$name"."_do_custom_preferred]' value='true' /><span class='at_custom_label'>Auto Personalized:</span>
|
122 |
+
<select name='addthis_settings[$name"."_custom_preferred]' class='at_custom_input'>";
|
123 |
+
for($i=0; $i <= 11; $i++)
|
124 |
+
{
|
125 |
+
$selected = '';
|
126 |
+
if ($custom_preferred == $i)
|
127 |
+
$selected = 'selected="selected"';
|
128 |
+
echo '<option value="'.$i.'" '.$selected.'>'.$i.'</option>';
|
129 |
+
|
130 |
+
}
|
131 |
+
echo "</select><br/><span class='description'>Enter the number of automatticly user personalized items you want displayed</span></li>";
|
132 |
+
$custom_more = ( $custom_more ) ? 'checked="checked"' : '';
|
133 |
+
|
134 |
+
echo "<li><input $custom_more type='checkbox' class='at_do_custom' name='addthis_settings[$name"."_custom_more]' value='true' /><span class='at_custom_label'>More</span><br/><span class='description'>Display our iconic orange plus sign that offers sharing to over 300 destinations</span></li>";
|
135 |
+
echo "</ul></div>";
|
136 |
+
|
137 |
+
$class = 'hidden';
|
138 |
+
if ($option == 'custom_string' || $option == 'none' && 'custom_strin' == $addthis_default_options[$name] )
|
139 |
+
{
|
140 |
+
$checked = 'checked="checked"';
|
141 |
+
$class = '';
|
142 |
+
}
|
143 |
+
|
144 |
+
echo "<div class='$name"."_option select_row $class '> <input $checked type='radio' value='custom_string' name='addthis_settings[$name]' id='$name"."_custom_string' />Custom Button</input>";
|
145 |
+
|
146 |
+
echo "<br />";
|
147 |
+
echo "<textarea rows='5' cols='120' name='addthis_settings[$name"."_custom_string]' value=' $custom_string' id='$name"."_custom_string_input' />".($custom_string)."</textarea>";
|
148 |
+
|
149 |
+
echo '</div>';
|
150 |
+
?>
|
151 |
+
|
152 |
+
|
153 |
+
<a class="<?php echo $name;?>_option" href="#<?php echo $name;?>_more" id="<?php echo $name;?>_more">addtional style options</a>
|
154 |
+
</td>
|
155 |
+
</tr>
|
156 |
+
|
157 |
+
<?php
|
158 |
+
}
|
159 |
+
|
160 |
+
|
161 |
+
?>
|
addthis_sidebar_widget.php
CHANGED
@@ -29,7 +29,7 @@ class AddThisSidebarWidget extends WP_Widget {
|
|
29 |
function widget($args, $instance)
|
30 |
{
|
31 |
extract ( $args );
|
32 |
-
|
33 |
|
34 |
|
35 |
$title = apply_filters('widget_title', $instance['title']);
|
@@ -38,8 +38,8 @@ class AddThisSidebarWidget extends WP_Widget {
|
|
38 |
if ($title)
|
39 |
echo $before_title . $title . $after_title;
|
40 |
|
41 |
-
|
42 |
-
|
43 |
echo $after_widget;
|
44 |
|
45 |
}
|
29 |
function widget($args, $instance)
|
30 |
{
|
31 |
extract ( $args );
|
32 |
+
$addthis_new_styles = _get_style_options();
|
33 |
|
34 |
|
35 |
$title = apply_filters('widget_title', $instance['title']);
|
38 |
if ($title)
|
39 |
echo $before_title . $title . $after_title;
|
40 |
|
41 |
+
printf(apply_filters('addthis_sidebar_style_output', $addthis_new_styles[$instance['style']]['src']), '');
|
42 |
+
|
43 |
echo $after_widget;
|
44 |
|
45 |
}
|
addthis_social_widget.php
CHANGED
@@ -19,7 +19,6 @@
|
|
19 |
* | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
20 |
* +--------------------------------------------------------------------------+
|
21 |
*/
|
22 |
-
|
23 |
if (!defined('ADDTHIS_INIT')) define('ADDTHIS_INIT', 1);
|
24 |
else return;
|
25 |
|
@@ -27,12 +26,15 @@ else return;
|
|
27 |
* Plugin Name: AddThis Social Bookmarking Widget
|
28 |
* Plugin URI: http://www.addthis.com
|
29 |
* Description: Help your visitor promote your site! The AddThis Social Bookmarking Widget allows any visitor to bookmark your site easily with many popular services. Sign up for an AddThis.com account to see how your visitors are sharing your content--which services they're using for sharing, which content is shared the most, and more. It's all free--even the pretty charts and graphs.
|
30 |
-
* Version: 2.
|
31 |
*
|
32 |
* Author: The AddThis Team
|
33 |
* Author URI: http://www.addthis.com/blog
|
34 |
*/
|
35 |
|
|
|
|
|
|
|
36 |
$addthis_settings = array();
|
37 |
$addthis_settings['isdropdown'] = 'true';
|
38 |
$addthis_settings['customization'] = '';
|
@@ -53,126 +55,171 @@ $addthis_styles = array(
|
|
53 |
'share-small' => array('img'=>'sm-share-%lang%.gif', 'w'=>83, 'h'=>16),
|
54 |
'bookmark-small' => array('img'=>'sm-bookmark-en.gif', 'w'=>83, 'h'=>16),
|
55 |
'plus' => array('img'=>'sm-plus.gif', 'w'=>16, 'h'=>16)
|
56 |
-
/* Add your own style here, like this:
|
57 |
-
, 'custom' => array('img'=>'http://example.com/button.gif', 'w'=>16, 'h'=>16) */
|
58 |
);
|
59 |
$addthis_new_styles = array(
|
60 |
|
61 |
'small_toolbox' => array( 'src' => '<div class="addthis_toolbox addthis_default_style addthis_" %s ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>', 'img' => 'toolbox-small.png', 'name' => 'Small Toolbox', 'above' => 'hidden ', 'below' => ''
|
62 |
), // 32x32
|
63 |
-
|
64 |
-
'small_toolbox_with_share' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %s ><a href="
|
65 |
), // Plus sign share | four buttons
|
66 |
'large_toolbox' => array( 'src' => '<div class="addthis_toolbox addthis_default_style addthis_32x32_style" %s ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>', 'img' => 'toolbox-large.png', 'name' => 'Large Toolbox', 'above' => 'hidden ', 'below' => ''
|
67 |
), // 32x32
|
68 |
'fb_tw_sc' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %s ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>' , 'img' => 'fb-tw-sc.jpg' , 'name' => 'Like, Tweet, Counter', 'above' => '', 'below' => 'hidden'
|
69 |
), // facebook tweet share counter
|
70 |
-
'simple_button' => array('src' => '<div class="addthis_toolbox addthis_default_style " %s><a href="
|
71 |
), // Plus sign share
|
72 |
-
'button' => array( 'src' => '<a class="addthis_button" href="
|
73 |
), // classic
|
74 |
'share_counter' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %s ><a class="addthis_counter"></a></div>', 'img' => 'share_counter.png', 'name' => 'Share Counter', 'above' => 'hidden ', 'below' => 'hidden'
|
75 |
),
|
76 |
);
|
77 |
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
-
define( 'addthis_style_default' , 'small_toolbox_with_share');
|
81 |
-
define( 'ADDTHIS_PLUGIN_VERSION', '2.0.0');
|
82 |
/**
|
83 |
* Converts our old many options in to one beautiful array
|
84 |
*
|
85 |
*/
|
86 |
-
|
87 |
{
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
$addthis_new_options
|
|
|
|
|
94 |
|
95 |
-
|
96 |
-
|
97 |
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
else
|
121 |
-
{
|
122 |
-
if ( ($menu_type = get_option('addthis_menu_type')) == 'toolbox' )
|
123 |
-
$addthis_new_options['below'] = 'small_toolbox_with_share';
|
124 |
else
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
|
|
|
|
|
|
|
|
135 |
|
136 |
|
137 |
-
|
138 |
-
|
139 |
|
140 |
-
|
141 |
-
|
142 |
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
|
166 |
-
|
167 |
-
|
168 |
|
169 |
-
|
170 |
|
171 |
-
|
172 |
|
173 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
|
|
|
175 |
|
|
|
|
|
176 |
|
177 |
|
178 |
/**
|
@@ -198,10 +245,112 @@ function addthis_get_wp_version() {
|
|
198 |
/**
|
199 |
* For templates, we need a wrapper for printing out the code on demand.
|
200 |
*/
|
201 |
-
function addthis_print_widget($url=null, $title=null) {
|
202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
}
|
204 |
|
|
|
205 |
/**
|
206 |
* Adds AddThis CSS to page. Only used for admin dashboard in WP 2.7 and higher.
|
207 |
*/
|
@@ -219,29 +368,37 @@ function addthis_print_script() {
|
|
219 |
add_action('admin_notices', 'addthis_admin_notices');
|
220 |
|
221 |
function addthis_admin_notices(){
|
222 |
-
if (! current_user_can('manage_options'))
|
223 |
return;
|
224 |
-
|
|
|
225 |
$user_id = $current_user->ID;
|
226 |
$options = get_option('addthis_settings');
|
227 |
|
228 |
if ($options == false && ! get_user_meta($user_id, 'addthis_ignore_notices'))
|
229 |
{
|
230 |
echo '<div class="updated addthis_setup_nag"><p>';
|
231 |
-
printf(__('Setup the AddThis plugin so you can start having your users share your content around the web<br /> <a href="%1$s">Setup options</a> | <a href="%2$s" id="php_below_min_nag-no">Ignore this notice</a>'),
|
|
|
|
|
232 |
echo "</p></div>";
|
233 |
}
|
234 |
|
235 |
elseif ( ( ! isset($options['username']) || $options['username'] == false) && ! get_user_meta($user_id, 'addthis_nag_username_ignore'))
|
236 |
{
|
237 |
echo '<div class="updated addthis_setup_nag"><p>';
|
238 |
-
printf( __('Sign up for AddThis and add your username/password to recieve analytics about how people are sharing your content.<br /> <a href="%1$s">Enter username and password</a> | <a href="%2$s target="_blank">Sign Up</a> | <a href="%3$s">Ignore this notice</a>'),
|
|
|
|
|
|
|
239 |
echo "</p></div>";
|
240 |
}
|
241 |
elseif ( (get_user_meta($user_id, 'addthis_nag_updated_options') == true ) )
|
242 |
{
|
243 |
echo '<div class="updated addthis_setup_nag"><p>';
|
244 |
-
printf( __('We have updated the options for the AddThis plugin. Check out the <a href="%1$s">AddThis settings page</a> to see the new styles and options.<br /> <a href="%1$s">See New Options</a> | <a href="%2$s">Ignore this notice</a>'),
|
|
|
|
|
245 |
echo "</p></div>";
|
246 |
}
|
247 |
}
|
@@ -338,11 +495,16 @@ function addthis_render_dashboard_widget() {
|
|
338 |
return false;
|
339 |
}
|
340 |
$domain = get_home_url();
|
341 |
-
|
|
|
342 |
$domain = str_replace(array('http://', 'https://'), '', $domain);
|
343 |
|
344 |
-
|
|
|
|
|
|
|
345 |
|
|
|
346 |
$requests = array(
|
347 |
array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'day'),
|
348 |
array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'week'),
|
@@ -352,126 +514,187 @@ function addthis_render_dashboard_widget() {
|
|
352 |
array('metric' => 'clickbacks', 'dimension' => '', 'domain' => $domain, 'period' => 'month'),
|
353 |
array('metric' => 'shares', 'dimension' => 'service' , 'domain' => $domain, 'period' => 'month'),
|
354 |
array('metric' => 'clickbacks', 'dimension' => 'service', 'domain' => $domain, 'period' => 'month'),
|
355 |
-
|
|
|
356 |
);
|
357 |
|
358 |
if (! $stats = get_transient('addthis_dashboard_stats') )
|
359 |
{
|
360 |
add_filter('http_headers_useragent', 'addthis_plugin_useragent');
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
}
|
376 |
if ($stats['sharesday']['response']['code'] == 200 && $stats['sharesmonth']['body'] != '[]' )
|
377 |
{
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
$lastweek['shares']
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
$lastweek['clickbacks']
|
397 |
-
|
398 |
-
|
|
|
|
|
|
|
399 |
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
|
414 |
|
415 |
-
|
416 |
-
|
417 |
-
foreach (array('shares', 'clickbacks') as $type)
|
418 |
-
{
|
419 |
-
$topServiceShare = array_shift($services[$type]);
|
420 |
-
$firstLabel = ( isset($_services[$topServiceShare->service])) ? $_services[$topServiceShare->service] : $topServiceShare->service;
|
421 |
-
$firstAmount = $topServiceShare->{$type};
|
422 |
-
$topServiceShare = array_shift($services[$type]);
|
423 |
-
$secondLabel = ( isset($_services[$topServiceShare->service])) ? $_services[$topServiceShare->service] : $topServiceShare->service;
|
424 |
-
$secondAmount = $topServiceShare->{$type};
|
425 |
-
$thirdLabel = 'Others';
|
426 |
-
$thirdAmount = 0;
|
427 |
-
foreach($services[$type] as $service )
|
428 |
{
|
429 |
-
$
|
430 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
431 |
|
432 |
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
|
438 |
-
|
439 |
-
echo "<
|
440 |
-
echo "<
|
441 |
-
echo "<li class='at_time_period'><a href='#
|
442 |
-
echo "<li class='at_time_period'><a href='#
|
443 |
-
echo "
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
<
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
475 |
elseif($stats['sharesday']['response']['code'] == 200){
|
476 |
|
477 |
echo
|
@@ -479,14 +702,19 @@ elseif($stats['sharesday']['response']['code'] == 200){
|
|
479 |
<p>We haven't recorded any sharing events in the last month for this site. This could be because you just installed addthis. If you would like to increase your sharing,</p>
|
480 |
<p>If you want some ideas for increasing your sharing, check out:</p>
|
481 |
<ul>
|
482 |
-
<li><span class='b'><a href="
|
483 |
-
<li><span class='b'><a href="
|
484 |
-
<li><span class='b'><a href="
|
485 |
<ul>
|
486 |
ENDHTML;
|
487 |
}
|
|
|
|
|
|
|
|
|
|
|
488 |
else{
|
489 |
-
echo "I'm sorry, but we seemed to
|
490 |
}
|
491 |
die();
|
492 |
}
|
@@ -519,14 +747,15 @@ function addthis_save_transient() {
|
|
519 |
if (! wp_verify_nonce($nonce, 'addthis-options') ) die('Security check');
|
520 |
|
521 |
// Parse Post data
|
522 |
-
|
523 |
$option_array = addthis_parse_options($values);
|
|
|
524 |
// Set Transient
|
525 |
if (false !== get_transient('addthis_settings'))
|
526 |
delete_transient('addthis_settings');
|
527 |
$eh = set_transient('addthis_settings', $option_array, 120);
|
528 |
|
529 |
-
|
|
|
530 |
die();
|
531 |
}
|
532 |
|
@@ -546,22 +775,28 @@ function addthis_save_settings($input)
|
|
546 |
*/
|
547 |
function addthis_parse_options($data)
|
548 |
{
|
|
|
549 |
|
550 |
global $addthis_styles, $addthis_new_styles;
|
551 |
|
552 |
$styles = array_merge($addthis_styles, $addthis_new_styles);
|
553 |
|
|
|
554 |
$options = array();
|
555 |
|
556 |
-
// Sanitize username and password
|
557 |
if ( isset($data['addthis_username']) )
|
558 |
$options['username'] = sanitize_text_field($data['addthis_username']);
|
559 |
|
|
|
|
|
|
|
560 |
if ( isset($data['addthis_password']) )
|
561 |
$options['password'] = sanitize_text_field($data['addthis_password']);
|
562 |
|
563 |
-
|
564 |
-
|
|
|
565 |
$options['above'] = 'none';
|
566 |
elseif ( isset($styles[$data['above']]) )
|
567 |
$options['above'] = $data['above'];
|
@@ -569,8 +804,29 @@ elseif ($data['above'] == 'none')
|
|
569 |
{
|
570 |
$options['above'] = 'none';
|
571 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
572 |
|
573 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
574 |
$options['below'] = 'none';
|
575 |
elseif ( isset($styles[$data['below']]) )
|
576 |
$options['below'] = $data['below'];
|
@@ -578,16 +834,45 @@ elseif ($data['below'] == 'none')
|
|
578 |
{
|
579 |
$options['below'] = 'none';
|
580 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
581 |
|
582 |
|
583 |
// All the checkbox fields
|
584 |
-
foreach (array('addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats') as $field)
|
585 |
{
|
586 |
if ( isset($data[$field]) && $data[$field] == true)
|
587 |
$options[$field] = true;
|
|
|
|
|
588 |
|
589 |
}
|
590 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
591 |
|
592 |
//[addthis_brand] =>
|
593 |
|
@@ -595,6 +880,8 @@ if ( isset ($data['addthis_brand']) && strlen($data['addthis_brand']) != 0 )
|
|
595 |
$options['addthis_brand'] = sanitize_text_field($data['addthis_brand']);
|
596 |
|
597 |
//[addthis_options] =>
|
|
|
|
|
598 |
|
599 |
//[addthis_language] =>
|
600 |
if ( isset ($data['addthis_language']))
|
@@ -617,6 +904,17 @@ if ( isset ($data['addthis_header_color']) && strlen($data['addthis_header_color
|
|
617 |
$options['addthis_header_color'] = sanitize_text_field($data['addthis_header_color']);
|
618 |
}
|
619 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
620 |
return $options;
|
621 |
|
622 |
}
|
@@ -629,6 +927,28 @@ function register_addthis_settings() {
|
|
629 |
register_setting('addthis', 'addthis_settings', 'addthis_save_settings');
|
630 |
|
631 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
632 |
|
633 |
/**
|
634 |
* Adds WP filter so we can append the AddThis button to post content.
|
@@ -637,7 +957,9 @@ function addthis_init()
|
|
637 |
{
|
638 |
global $addthis_settings;
|
639 |
|
640 |
-
|
|
|
|
|
641 |
if ( is_admin() ) {
|
642 |
add_action( 'admin_init', 'register_addthis_settings' );
|
643 |
}
|
@@ -645,23 +967,32 @@ function addthis_init()
|
|
645 |
|
646 |
$options = get_option('addthis_settings');
|
647 |
|
648 |
-
if (function_exists('wp_register_style')) {
|
649 |
-
wp_register_style( 'addthis', WP_PLUGIN_URL . '/addthis/css/addthis.css');
|
650 |
-
wp_register_script( 'addthis', WP_PLUGIN_URL . '/addthis/js/addthis.js', array('jquery-ui-tabs') );
|
651 |
|
652 |
-
|
653 |
-
|
654 |
-
|
|
|
|
|
655 |
|
656 |
-
add_filter('admin_menu', 'addthis_admin_menu');
|
657 |
|
658 |
-
|
659 |
-
|
660 |
-
|
|
|
|
|
|
|
|
|
661 |
|
662 |
-
|
|
|
|
|
|
|
663 |
|
664 |
-
|
|
|
|
|
|
|
|
|
665 |
|
666 |
$product = get_option('addthis_product');
|
667 |
|
@@ -698,8 +1029,11 @@ add_action('widgets_init', 'addthis_widget_init');
|
|
698 |
|
699 |
function addthis_widget_init()
|
700 |
{
|
|
|
701 |
require_once('addthis_sidebar_widget.php');
|
|
|
702 |
register_widget('AddThisSidebarWidget');
|
|
|
703 |
}
|
704 |
|
705 |
function addthis_sidebar_widget($args)
|
@@ -713,15 +1047,26 @@ function addthis_sidebar_widget($args)
|
|
713 |
// essentially replace wp_trim_excerpt until we have something better to use here
|
714 |
function addthis_remove_tag($content, $text = '')
|
715 |
{
|
716 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
717 |
$raw_excerpt = $text;
|
718 |
if ( '' == $text ) {
|
719 |
-
$text = get_the_content('');
|
720 |
|
|
|
721 |
$text = strip_shortcodes( $text );
|
|
|
722 |
remove_filter('the_content', 'addthis_display_social_widget', 15);
|
723 |
|
724 |
$text = apply_filters('the_content', $text);
|
|
|
|
|
|
|
725 |
$text = str_replace(']]>', ']]>', $text);
|
726 |
$text = strip_tags($text);
|
727 |
$excerpt_length = apply_filters('excerpt_length', 55);
|
@@ -734,17 +1079,89 @@ function addthis_remove_tag($content, $text = '')
|
|
734 |
} else {
|
735 |
$text = implode(' ', $words);
|
736 |
}
|
737 |
-
|
|
|
|
|
738 |
}
|
739 |
else
|
740 |
{
|
741 |
return $content;
|
742 |
}
|
743 |
}
|
744 |
-
|
|
|
745 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
746 |
global $addthis_styles, $addthis_new_styles;
|
747 |
$styles = array_merge($addthis_styles, $addthis_new_styles);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
748 |
|
749 |
|
750 |
if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
|
@@ -752,6 +1169,7 @@ function addthis_display_social_widget($content, $filtered = true)
|
|
752 |
else
|
753 |
$options = get_option('addthis_settings');
|
754 |
|
|
|
755 |
if ( is_home() || is_front_page() )
|
756 |
$display = (isset($options['addthis_showonhome']) && $options['addthis_showonhome'] == true ) ? true : false;
|
757 |
elseif ( is_archive() && ! is_category() )
|
@@ -767,33 +1185,79 @@ function addthis_display_social_widget($content, $filtered = true)
|
|
767 |
$display = true;
|
768 |
else
|
769 |
$display = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
770 |
|
771 |
-
|
772 |
-
|
773 |
-
$url = get_permalink();
|
774 |
-
$url_above = '';
|
775 |
-
$url_below = '';
|
776 |
// Still here? Well let's add some social goodness
|
777 |
-
if ( $options['above'] != 'none' && $display )
|
778 |
{
|
779 |
if (isset ($styles[$options['above']]))
|
780 |
{
|
781 |
$above = apply_filters('addthis_above_content', $styles[$options['above']]['src']);
|
782 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
783 |
}
|
784 |
}
|
|
|
|
|
785 |
else
|
786 |
$above = '';
|
787 |
-
|
788 |
-
if ($options['below'] != 'none' && $display)
|
789 |
{
|
790 |
if (isset ($styles[$options['below']]))
|
791 |
{
|
792 |
$below = apply_filters('addthis_below_content', $styles[$options['below']]['src']);
|
793 |
-
$url_below = ($styles[$options['below']] != 'button') ? "addthis:url='$url'" : $url;
|
794 |
}
|
795 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
796 |
}
|
|
|
|
|
797 |
else
|
798 |
$below = '';
|
799 |
|
@@ -801,9 +1265,12 @@ $url_below = '';
|
|
801 |
|
802 |
if ($display)
|
803 |
{
|
804 |
-
|
|
|
|
|
|
|
805 |
if ($filtered == true)
|
806 |
-
add_filter('wp_trim_excerpt', 'addthis_remove_tag',
|
807 |
}
|
808 |
|
809 |
return $content;
|
@@ -818,7 +1285,7 @@ add_action('wp_footer', 'addthis_output_script');
|
|
818 |
*
|
819 |
* @return mixed
|
820 |
*/
|
821 |
-
function addthis_output_script()
|
822 |
{
|
823 |
global $addthis_settings;
|
824 |
|
@@ -829,9 +1296,10 @@ function addthis_output_script()
|
|
829 |
|
830 |
$script = "\n<!-- AddThis Button Begin -->\n"
|
831 |
.'<script type="text/javascript">'
|
832 |
-
."var addthis_product = 'wpp-
|
|
|
833 |
|
834 |
-
$pub = (isset($options['
|
835 |
if (!$pub) {
|
836 |
$pub = 'wp-'.cuid();
|
837 |
}
|
@@ -842,7 +1310,16 @@ function addthis_output_script()
|
|
842 |
|
843 |
if ( isset($options['addthis_append_data']) && $options['addthis_append_data'] == true)
|
844 |
$addthis_config["data_track_clickback"] = true;
|
845 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
846 |
if ( isset($options['addthis_language']) && strlen($options['addthis_language']) == 2)
|
847 |
$addthis_config['ui_language'] = $options['addthis_language'];
|
848 |
|
@@ -855,16 +1332,42 @@ function addthis_output_script()
|
|
855 |
if ( isset($options['addthis_brand']) )
|
856 |
$addthis_config['ui_cobrand'] = $options['addthis_brand'];
|
857 |
|
858 |
-
$
|
|
|
859 |
|
|
|
860 |
|
861 |
-
if (
|
|
|
|
|
862 |
$script .= 'var addthis_config = '. json_encode($addthis_config) .';';
|
|
|
|
|
|
|
863 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
864 |
$script .= '</script>';
|
865 |
-
|
866 |
-
|
867 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
868 |
}
|
869 |
|
870 |
|
@@ -915,15 +1418,15 @@ function addthis_social_widget($content, $onSidebar = false, $url = null, $title
|
|
915 |
$content .= <<<EOF
|
916 |
//-->
|
917 |
</script>
|
918 |
-
<div class="addthis_container"><a href="
|
919 |
EOF;
|
920 |
-
$content .= ($addthis_settings['language'] == '' ? '' /* no hardcoded image -- we'll choose the language automatically */ : addthis_get_button_img()) . '</a><script type="text/javascript" src="
|
921 |
}
|
922 |
else if ($addthis_settings['menu_type'] === 'toolbox')
|
923 |
{
|
924 |
$content .= "\n//-->\n</script>\n";
|
925 |
$content .= <<<EOF
|
926 |
-
<div class="addthis_container addthis_toolbox addthis_default_style" addthis:url="$link" addthis:title="$title"><a href="
|
927 |
EOF;
|
928 |
if (!strlen($addthis_options)) $addthis_options = 'email,favorites,print,facebook,twitter';
|
929 |
$addthis_options = split(',', $addthis_options);
|
@@ -933,7 +1436,7 @@ EOF;
|
|
933 |
$content .= '<a class="addthis_button_'.$option.'"></a>';
|
934 |
}
|
935 |
}
|
936 |
-
$content .= '<script type="text/javascript" src="
|
937 |
}
|
938 |
else
|
939 |
{
|
@@ -942,7 +1445,7 @@ EOF;
|
|
942 |
$content .= <<<EOF
|
943 |
//-->
|
944 |
</script>
|
945 |
-
<div class="addthis_container"><a href="
|
946 |
EOF;
|
947 |
$content .= addthis_get_button_img() . '</a></div>';
|
948 |
}
|
@@ -981,7 +1484,7 @@ function addthis_get_button_img( $btnStyle = false )
|
|
981 |
|
982 |
if (!isset($addthis_styles[$btnStyle])) $btnStyle = 'share';
|
983 |
$btnRecord = $addthis_styles[$btnStyle];
|
984 |
-
$btnUrl = (strpos(trim($btnRecord['img']), '
|
985 |
|
986 |
if (strpos($btnUrl, '%lang%') !== false)
|
987 |
{
|
@@ -996,12 +1499,19 @@ EOF;
|
|
996 |
|
997 |
function addthis_options_page_scripts()
|
998 |
{
|
999 |
-
|
|
|
|
|
|
|
|
|
|
|
1000 |
}
|
1001 |
|
1002 |
function addthis_options_page_style()
|
1003 |
{
|
1004 |
-
|
|
|
|
|
1005 |
wp_enqueue_style( 'thickbox' );
|
1006 |
}
|
1007 |
|
@@ -1013,6 +1523,7 @@ function addthis_admin_menu()
|
|
1013 |
}
|
1014 |
|
1015 |
$addthis_default_options = array(
|
|
|
1016 |
'username' => '',
|
1017 |
'password' => '',
|
1018 |
'style' => addthis_style_default ,
|
@@ -1025,14 +1536,35 @@ function addthis_admin_menu()
|
|
1025 |
'addthis_showonpages' => true,
|
1026 |
'addthis_showonarchives' => true,
|
1027 |
'addthis_showoncats' => true,
|
|
|
1028 |
'addthis_brand' => '',
|
1029 |
'toolbox' => '',
|
1030 |
'addthis_language' => '',
|
1031 |
'addthis_header_background' => '',
|
1032 |
-
'addthis_header_color' => ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1033 |
);
|
1034 |
|
1035 |
function addthis_plugin_options_php4() {
|
|
|
|
|
1036 |
global $addthis_styles;
|
1037 |
global $addthis_languages;
|
1038 |
global $addthis_settings;
|
@@ -1040,6 +1572,8 @@ function addthis_plugin_options_php4() {
|
|
1040 |
global $addthis_new_styles;
|
1041 |
global $addthis_default_options;
|
1042 |
|
|
|
|
|
1043 |
global $current_user;
|
1044 |
$user_id = $current_user->ID;
|
1045 |
|
@@ -1051,15 +1585,18 @@ function addthis_plugin_options_php4() {
|
|
1051 |
<form id="addthis_settings" method="post" action="options.php">
|
1052 |
<?php
|
1053 |
// use the old-school settings style in older versions of wordpress
|
1054 |
-
if (addthis_get_wp_version()
|
1055 |
-
wp_nonce_field('update-options');
|
1056 |
-
} else {
|
1057 |
settings_fields('addthis');
|
|
|
|
|
1058 |
}
|
1059 |
|
1060 |
-
|
|
|
|
|
|
|
1061 |
foreach ( array( 'addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats' ) as $option)
|
1062 |
-
{
|
1063 |
if ( $addthis_options && ! isset($addthis_options[$option]) )
|
1064 |
$addthis_options[$option] = false;
|
1065 |
}
|
@@ -1070,7 +1607,7 @@ function addthis_plugin_options_php4() {
|
|
1070 |
?>
|
1071 |
|
1072 |
<div class="page-header" id="tabs">
|
1073 |
-
<img alt='addthis' src="
|
1074 |
<ul class="nav-tab-wrapper">
|
1075 |
<li><h2 class="nav-tab-wrapper"><a href="#tabs-1">Basic</a></h2></li>
|
1076 |
<li><h2 class="nav-tab-wrapper"><a href="#tabs-2">Advanced</a></h2></li>
|
@@ -1079,51 +1616,22 @@ function addthis_plugin_options_php4() {
|
|
1079 |
<div id="tabs-1">
|
1080 |
<table class="form-table">
|
1081 |
<tbody>
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
{
|
1087 |
-
$class = 'hidden';
|
1088 |
-
$checked = '';
|
1089 |
-
if ($above == $k || ($above == 'none' && $k == $addthis_default_options['above'] ) ){
|
1090 |
-
$checked = 'checked="checked"';
|
1091 |
-
$class = '';
|
1092 |
-
}
|
1093 |
-
echo "<p class='above_option select_row $class '><input $checked type='radio' value='".$k."' name='addthis_settings[above]' /><img alt='".$k."' src='".plugins_url( '/addthis/img/' . $v['img'], basename(dirname(__FILE__)) ) ."'/></p>";
|
1094 |
-
}
|
1095 |
-
?>
|
1096 |
-
<a class="above_option" href="#above_more" id="above_more">addtional style options</a>
|
1097 |
-
</td>
|
1098 |
-
</tr>
|
1099 |
-
<tr>
|
1100 |
-
<td id='below' colspan="2">
|
1101 |
-
<p><?php _e("Below the post", 'addthis_trans_domain') ?> <span class="description"><input type="checkbox" name="addthis_settings[show_below]" <?php echo ('none' == $below) ? 'checked="checked"' : '';?> /> none</span></p>
|
1102 |
-
<?php foreach ($addthis_new_styles as $k => $v)
|
1103 |
-
{
|
1104 |
-
$class = 'hidden';
|
1105 |
-
$checked = '';
|
1106 |
-
if ($below == $k || ($below == 'none' && $k == $addthis_default_options['below'] ) )
|
1107 |
-
{
|
1108 |
-
$checked = 'checked="checked"';
|
1109 |
-
$class = '';
|
1110 |
-
}
|
1111 |
-
echo "<p class='below_option select_row $class '><input $checked type='radio' value='".$k."' name='addthis_settings[below]' /><img alt='".$k."' src='".plugins_url( '/addthis/img/' . $v['img'], basename(dirname(__FILE__)) ) ."'/></p>";
|
1112 |
-
}
|
1113 |
-
?>
|
1114 |
-
<a class="below_option" href="#below_more" id="below_more">additional style options</a>
|
1115 |
-
</td>
|
1116 |
</tr>
|
1117 |
<tr valign="top">
|
1118 |
-
<
|
|
|
1119 |
</tr>
|
1120 |
<tr valign="top">
|
1121 |
<th scope="row"><?php _e("AddThis username:", 'addthis_trans_domain' ); ?></th>
|
1122 |
-
<td><input id="addthis_username" type="text" name="addthis_settings[addthis_username]" value="<?php echo $username; ?>" /></td>
|
1123 |
</tr>
|
1124 |
<tr id="password_row" >
|
1125 |
<th scope="row"><?php _e("AddThis password:", 'addthis_trans_domain' ); ?><br/><span style="font-size:10px">(required for displaying stats)</span></th>
|
1126 |
-
<td><input type="password" name="addthis_settings[addthis_password]" value="<?php echo $password; ?>"/></td>
|
1127 |
</tr>
|
1128 |
</tbody>
|
1129 |
</table>
|
@@ -1136,15 +1644,19 @@ function addthis_plugin_options_php4() {
|
|
1136 |
<td><input type="checkbox" name="addthis_settings[addthis_show_stats]" value="true" <?php echo ($addthis_show_stats == true ? 'checked="checked"' : ''); ?>/></td>
|
1137 |
</tr>
|
1138 |
<tr>
|
1139 |
-
<th scope="row"><?php _e("Track <a href=\"
|
1140 |
<td><input type="checkbox" name="addthis_settings[addthis_append_data]" value="true" <?php echo $addthis_append_data == true ? 'checked="checked"' : ''; ?>/></td>
|
1141 |
</tr>
|
|
|
|
|
|
|
|
|
1142 |
<tr>
|
1143 |
<th scope="row"><?php _e("Show on homepage:", 'addthis_trans_domain' ); ?></th>
|
1144 |
<td><input type="checkbox" name="addthis_settings[addthis_showonhome]" value="true" <?php echo ($addthis_showonhome == true ? 'checked="checked"' : ''); ?>/></td>
|
1145 |
</tr>
|
1146 |
<tr>
|
1147 |
-
<th scope="row"><?php _e("Show on <a href=\"
|
1148 |
<td><input type="checkbox" name="addthis_settings[addthis_showonpages]" value="true" <?php echo ( $addthis_showonpages == true ? 'checked="checked"' : ''); ?>/></td>
|
1149 |
</tr>
|
1150 |
<tr>
|
@@ -1155,16 +1667,45 @@ function addthis_plugin_options_php4() {
|
|
1155 |
<th scope="row"><?php _e("Show in categories:", 'addthis_trans_domain' ); ?></th>
|
1156 |
<td><input type="checkbox" name="addthis_settings[addthis_showoncats]" value="true" <?php echo ( $addthis_showoncats == true ? 'checked="checked"' : ''); ?>/></td>
|
1157 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1158 |
<tr valign="top">
|
1159 |
<td colspan="2"></td>
|
1160 |
</tr>
|
1161 |
<tr valign="top">
|
1162 |
-
<td colspan="2">For more details on the following options, see <a href="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1163 |
</tr>
|
1164 |
<tr valign="top">
|
1165 |
<th scope="row"><?php _e("Brand:", 'addthis_trans_domain' ); ?></th>
|
1166 |
<td><input type="text" name="addthis_settings[addthis_brand]" value="<?php echo $addthis_brand; ?>" /></td>
|
1167 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1168 |
<tr valign="top">
|
1169 |
<th scope="row"><?php _e("Language:", 'addthis_trans_domain' ); ?></th>
|
1170 |
<td>
|
@@ -1187,6 +1728,14 @@ function addthis_plugin_options_php4() {
|
|
1187 |
<th scope="row"><?php _e("Header color:", 'addthis_trans_domain' ); ?></th>
|
1188 |
<td><input type="text" name="addthis_settings[addthis_header_color]" value="<?php echo $addthis_header_color; ?>" /></td>
|
1189 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1190 |
</table>
|
1191 |
<div class='clear'> </div>
|
1192 |
</div>
|
@@ -1252,5 +1801,36 @@ if (! function_exists('get_home_url'))
|
|
1252 |
}
|
1253 |
}
|
1254 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1255 |
|
1256 |
?>
|
19 |
* | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
20 |
* +--------------------------------------------------------------------------+
|
21 |
*/
|
|
|
22 |
if (!defined('ADDTHIS_INIT')) define('ADDTHIS_INIT', 1);
|
23 |
else return;
|
24 |
|
26 |
* Plugin Name: AddThis Social Bookmarking Widget
|
27 |
* Plugin URI: http://www.addthis.com
|
28 |
* Description: Help your visitor promote your site! The AddThis Social Bookmarking Widget allows any visitor to bookmark your site easily with many popular services. Sign up for an AddThis.com account to see how your visitors are sharing your content--which services they're using for sharing, which content is shared the most, and more. It's all free--even the pretty charts and graphs.
|
29 |
+
* Version: 2.2.0
|
30 |
*
|
31 |
* Author: The AddThis Team
|
32 |
* Author URI: http://www.addthis.com/blog
|
33 |
*/
|
34 |
|
35 |
+
define( 'addthis_style_default' , 'small_toolbox_with_share');
|
36 |
+
define( 'ADDTHIS_PLUGIN_VERSION', '2.2.0');
|
37 |
+
|
38 |
$addthis_settings = array();
|
39 |
$addthis_settings['isdropdown'] = 'true';
|
40 |
$addthis_settings['customization'] = '';
|
55 |
'share-small' => array('img'=>'sm-share-%lang%.gif', 'w'=>83, 'h'=>16),
|
56 |
'bookmark-small' => array('img'=>'sm-bookmark-en.gif', 'w'=>83, 'h'=>16),
|
57 |
'plus' => array('img'=>'sm-plus.gif', 'w'=>16, 'h'=>16)
|
|
|
|
|
58 |
);
|
59 |
$addthis_new_styles = array(
|
60 |
|
61 |
'small_toolbox' => array( 'src' => '<div class="addthis_toolbox addthis_default_style addthis_" %s ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>', 'img' => 'toolbox-small.png', 'name' => 'Small Toolbox', 'above' => 'hidden ', 'below' => ''
|
62 |
), // 32x32
|
63 |
+
'plus_one_share_counter' => array( 'src' => '<div class="addthis_toolbox addthis_default_style" %s ><a class="addthis_button_google_plusone"></a><a class="addthis_counter addthis_pill_style"></a></div>', 'img' => 'plusone-share.gif', 'name' => 'Plus One and Share Counter', 'above'=> 'hidden', 'below'=>'hidden'), // +1
|
64 |
+
'small_toolbox_with_share' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %s ><a href="//addthis.com/bookmark.php?v=250&username=xa-4d2b47597ad291fb" class="addthis_button_compact">Share</a><span class="addthis_separator">|</span><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a></div>', 'img' => 'small-toolbox.jpg', 'name' => 'Small Toolbox with Share first', 'above' => '', 'below' => 'hidden'
|
65 |
), // Plus sign share | four buttons
|
66 |
'large_toolbox' => array( 'src' => '<div class="addthis_toolbox addthis_default_style addthis_32x32_style" %s ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>', 'img' => 'toolbox-large.png', 'name' => 'Large Toolbox', 'above' => 'hidden ', 'below' => ''
|
67 |
), // 32x32
|
68 |
'fb_tw_sc' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %s ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>' , 'img' => 'fb-tw-sc.jpg' , 'name' => 'Like, Tweet, Counter', 'above' => '', 'below' => 'hidden'
|
69 |
), // facebook tweet share counter
|
70 |
+
'simple_button' => array('src' => '<div class="addthis_toolbox addthis_default_style " %s><a href="//addthis.com/bookmark.php?v=250&username=xa-4d2b47f81ddfbdce" class="addthis_button_compact">Share</a></div>', 'img' => 'share.jpg', 'name' => 'Share Button', 'above' => 'hidden ', 'below' => 'hidden'
|
71 |
), // Plus sign share
|
72 |
+
'button' => array( 'src' => '<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" %s><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>', 'img' => 'button.jpg', 'name' => 'Classic Share Button', 'above' => 'hidden ', 'below' => 'hidden'
|
73 |
), // classic
|
74 |
'share_counter' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %s ><a class="addthis_counter"></a></div>', 'img' => 'share_counter.png', 'name' => 'Share Counter', 'above' => 'hidden ', 'below' => 'hidden'
|
75 |
),
|
76 |
);
|
77 |
|
78 |
|
79 |
+
add_filter('the_title', 'at_title_check');
|
80 |
+
function at_title_check($title)
|
81 |
+
{
|
82 |
+
|
83 |
+
global $addthis_did_filters_added;
|
84 |
+
|
85 |
+
if (!isset ($addthis_did_filters_added) || $addthis_did_filters_added != true)
|
86 |
+
{
|
87 |
+
addthis_add_content_filters();
|
88 |
+
add_filter('the_content', 'addthis_script_to_content');
|
89 |
+
}
|
90 |
+
else
|
91 |
+
{
|
92 |
+
}
|
93 |
+
|
94 |
+
return $title;
|
95 |
+
}
|
96 |
+
|
97 |
+
|
98 |
+
add_filter('language_attributes', 'addthis_language_attributes');
|
99 |
+
function addthis_language_attributes($input)
|
100 |
+
{
|
101 |
+
return $input . ' xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:addthis="http://www.addthis.com/help/api-spec" ';
|
102 |
+
}
|
103 |
+
|
104 |
+
|
105 |
+
|
106 |
+
function addthis_script_to_content($content)
|
107 |
+
{
|
108 |
+
global $addthis_did_script_output;
|
109 |
+
|
110 |
+
if (!isset($addthis_did_script_output) )
|
111 |
+
{
|
112 |
+
$addthis_did_script_output = true;
|
113 |
+
$content .= addthis_output_script(true);
|
114 |
+
}
|
115 |
+
return $content ;
|
116 |
+
}
|
117 |
|
|
|
|
|
118 |
/**
|
119 |
* Converts our old many options in to one beautiful array
|
120 |
*
|
121 |
*/
|
122 |
+
if ( apply_filters( 'at_do_options_upgrades', '__return_true') || apply_filters( 'addthis_do_options_upgrades', '__return_true') )
|
123 |
{
|
124 |
+
function addthis_options_200()
|
125 |
+
{
|
126 |
+
|
127 |
+
global $current_user;
|
128 |
+
$user_id = $current_user->ID;
|
129 |
+
$addthis_new_options = array();
|
130 |
+
if ($username = get_option('addthis_username'))
|
131 |
+
$addthis_new_options['username'] = $username;
|
132 |
|
133 |
+
if ($password = get_option('addthis_password'))
|
134 |
+
$addthis_new_options['password'] = $password;
|
135 |
|
136 |
+
if ($show_stats = get_option('addthis_show_stats'))
|
137 |
+
$addthis_new_options['addthis_show_stats'] = $show_stats;
|
138 |
+
|
139 |
+
if ($append_data = get_option('addthis_append_data'))
|
140 |
+
$addthis_new_options['addthis_append_data'] = $append_data;
|
141 |
+
|
142 |
+
if ($showonhome = get_option('addthis_showonhome'))
|
143 |
+
$addthis_new_options['addthis_showonhome'] = $showonhome;
|
144 |
+
|
145 |
+
if ($showonpages = get_option('addthis_showonpages'))
|
146 |
+
$addthis_new_options['addthis_showonpages'] = $showonpages;
|
147 |
+
|
148 |
+
if ($showoncats = get_option('addthis_showoncats'))
|
149 |
+
$addthis_new_options['addthis_showoncats'] = $showoncats;
|
150 |
+
|
151 |
+
if ($showonarchives = get_option('addthis_showonarchives'))
|
152 |
+
$addthis_new_options['addthis_showonarchives'] = $showonarchives;
|
153 |
|
154 |
+
if (get_option('addthis_showonposts') != true)
|
155 |
+
$addthis_new_options['below'] = 'none';
|
156 |
+
elseif (get_option('addthis_sidebar_only') == true)
|
157 |
+
$addthis_new_options['below'] = 'none';
|
|
|
|
|
|
|
|
|
158 |
else
|
159 |
+
{
|
160 |
+
if ( ($menu_type = get_option('addthis_menu_type')) == 'toolbox' )
|
161 |
+
$addthis_new_options['below'] = 'small_toolbox_with_share';
|
162 |
+
else
|
163 |
+
$addthis_new_options['below'] = 'button';
|
164 |
+
}
|
165 |
+
if ($header_background = get_option('addthis_header_background'))
|
166 |
+
$addthis_new_options['addthis_header_background'] = $header_background;
|
167 |
+
if ($header_color = get_option('addthis_header_color'))
|
168 |
+
$addthis_new_options['addthis_header_color'] = $header_color;
|
169 |
+
if ($brand = get_option('addthis_brand'))
|
170 |
+
$addthis_new_options['addthis_brand'] = $brand;
|
171 |
+
if ($language = get_option('addthis_language'))
|
172 |
+
$addthis_new_options['addthis_language'] = $language;
|
173 |
|
174 |
|
175 |
+
// Above is new, set it to none
|
176 |
+
$addthis_new_options['above'] = 'none';
|
177 |
|
178 |
+
// Save option
|
179 |
+
add_option('addthis_settings', $addthis_new_options);
|
180 |
|
181 |
+
// if the option saved, delete the old options
|
182 |
+
|
183 |
+
delete_option('addthis_show_stats');
|
184 |
+
delete_option('addthis_password');
|
185 |
+
delete_option('addthis_fallback_username');
|
186 |
+
delete_option('addthis_options');
|
187 |
+
delete_option('addthis_product');
|
188 |
+
delete_option('addthis_isdropdown');
|
189 |
+
delete_option('addthis_menu_type');
|
190 |
+
delete_option('addthis_append_data');
|
191 |
+
delete_option('addthis_showonhome');
|
192 |
+
delete_option('addthis_showonposts');
|
193 |
+
delete_option('addthis_showonpages');
|
194 |
+
delete_option('addthis_showoncats');
|
195 |
+
delete_option('addthis_showonarchives');
|
196 |
+
delete_option('addthis_style');
|
197 |
+
delete_option('addthis_header_background');
|
198 |
+
delete_option('addthis_header_color');
|
199 |
+
delete_option('addthis_sidebar_only');
|
200 |
+
delete_option('addthis_brand');
|
201 |
+
delete_option('addthis_language');;
|
202 |
+
|
203 |
|
204 |
+
global $current_user;
|
205 |
+
$user_id = $current_user->ID;
|
206 |
|
207 |
+
add_user_meta($user_id, 'addthis_nag_updated_options', 'true', true);
|
208 |
|
209 |
+
|
210 |
|
211 |
+
}
|
212 |
+
|
213 |
+
function addthis_options_210()
|
214 |
+
{
|
215 |
+
$options = get_option('addthis_settings');
|
216 |
+
if ( isset( $options['username'] ) )
|
217 |
+
$options['profile'] = $options['username'];
|
218 |
|
219 |
+
update_option( 'addthis_settings', $options);
|
220 |
|
221 |
+
}
|
222 |
+
}
|
223 |
|
224 |
|
225 |
/**
|
245 |
/**
|
246 |
* For templates, we need a wrapper for printing out the code on demand.
|
247 |
*/
|
248 |
+
function addthis_print_widget($url=null, $title=null, $style = addthis_style_default ) {
|
249 |
+
|
250 |
+
global $addthis_styles, $addthis_new_styles;
|
251 |
+
$styles = array_merge($addthis_styles, $addthis_new_styles);
|
252 |
+
|
253 |
+
if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
|
254 |
+
$preview = true;
|
255 |
+
else
|
256 |
+
$options = get_option('addthis_settings');
|
257 |
+
|
258 |
+
$identifier = addthis_get_identifier($url, $title);
|
259 |
+
|
260 |
+
echo "\n<!-- AddThis Custom -->\n";
|
261 |
+
|
262 |
+
|
263 |
+
if ( ! is_array($style) && isset($addthis_new_styles[$style]) ){
|
264 |
+
echo sprintf($addthis_new_styles[$style]['src'], $identifier);
|
265 |
+
}
|
266 |
+
elseif ($style == 'above')
|
267 |
+
{
|
268 |
+
if ( isset ($styles[$options['above']]['src'] ))
|
269 |
+
echo sprintf($styles[$options['above']]['src'], $identifier);
|
270 |
+
}
|
271 |
+
elseif ($style == 'below')
|
272 |
+
{
|
273 |
+
if ( isset ($styles[$options['below']]['src'] ))
|
274 |
+
echo sprintf($styles[$options['below']]['src'], $identifier);
|
275 |
+
}
|
276 |
+
elseif (is_array($style))
|
277 |
+
echo addthis_custom_toolbox($style, $url, $title);
|
278 |
+
echo "\n<!-- End AddThis Custom -->\n";
|
279 |
+
}
|
280 |
+
|
281 |
+
/*
|
282 |
+
* Generates the addthis:url and addthis:title attributes
|
283 |
+
*/
|
284 |
+
|
285 |
+
function addthis_get_identifier($url = null, $title = null)
|
286 |
+
{
|
287 |
+
|
288 |
+
if (! is_null($url) )
|
289 |
+
$identifier = "addthis:url='$url' ";
|
290 |
+
if (! is_null($title) )
|
291 |
+
$identifier .= "addthis:title='$title'";
|
292 |
+
|
293 |
+
if (! isset($identifier) )
|
294 |
+
$identifier = '';
|
295 |
+
|
296 |
+
return $identifier;
|
297 |
+
|
298 |
+
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Options is an array that contains
|
302 |
+
* size - either 16 or 32. Defaults to 16
|
303 |
+
* services - comma sepperated list of services
|
304 |
+
* preferred - number of Prefered services to be displayed after listed services
|
305 |
+
* more - bool to show or not show the more icon at the end
|
306 |
+
*
|
307 |
+
* @param $options array
|
308 |
+
*/
|
309 |
+
|
310 |
+
function addthis_custom_toolbox($options, $url, $title)
|
311 |
+
{
|
312 |
+
$identifier = addthis_get_identifier($url, $title);
|
313 |
+
|
314 |
+
$outerClasses = 'addthis_toolbox addthis_default_style';
|
315 |
+
|
316 |
+
if (isset($options['size']) && $options['size'] == '32')
|
317 |
+
$outerClasses .= ' addthis_32x32_style';
|
318 |
+
|
319 |
+
$button = '<div class="'.$outerClasses.'" '.$identifier.' >';
|
320 |
+
|
321 |
+
if (isset($options['services']) )
|
322 |
+
{
|
323 |
+
$services = explode(',', $options['services']);
|
324 |
+
foreach ($services as $service)
|
325 |
+
{
|
326 |
+
$service = trim($service);
|
327 |
+
if ($service == 'more')
|
328 |
+
$button .= '<a class="addthis_button_compact"></a>';
|
329 |
+
else
|
330 |
+
$button .= '<a class="addthis_button_'.strtolower($service).'"></a>';
|
331 |
+
}
|
332 |
+
}
|
333 |
+
|
334 |
+
if (isset($options['preferred']) && is_numeric($options['preferred']))
|
335 |
+
{
|
336 |
+
for ($a = 1; $a <= $options['preferred']; $a++)
|
337 |
+
{
|
338 |
+
$button .= '<a class="addthis_button_preferred_'.$a.'"></a>';
|
339 |
+
}
|
340 |
+
}
|
341 |
+
|
342 |
+
if (isset($options['more']) && $options['more'] == true)
|
343 |
+
{
|
344 |
+
$button .= '<a class="addthis_button_compact"></a>';
|
345 |
+
}
|
346 |
+
|
347 |
+
$button .= '</div>';
|
348 |
+
|
349 |
+
return $button;
|
350 |
+
|
351 |
}
|
352 |
|
353 |
+
|
354 |
/**
|
355 |
* Adds AddThis CSS to page. Only used for admin dashboard in WP 2.7 and higher.
|
356 |
*/
|
368 |
add_action('admin_notices', 'addthis_admin_notices');
|
369 |
|
370 |
function addthis_admin_notices(){
|
371 |
+
if (! current_user_can('manage_options') ||( defined('ADDTHIS_NO_NOTICES') && ADDTHIS_NO_NOTICES == true ) )
|
372 |
return;
|
373 |
+
|
374 |
+
global $current_user ;
|
375 |
$user_id = $current_user->ID;
|
376 |
$options = get_option('addthis_settings');
|
377 |
|
378 |
if ($options == false && ! get_user_meta($user_id, 'addthis_ignore_notices'))
|
379 |
{
|
380 |
echo '<div class="updated addthis_setup_nag"><p>';
|
381 |
+
printf(__('Setup the AddThis plugin so you can start having your users share your content around the web<br /> <a href="%1$s">Setup options</a> | <a href="%2$s" id="php_below_min_nag-no">Ignore this notice</a>'),
|
382 |
+
admin_url('options-general.php?page=' . __FILE__ ),
|
383 |
+
'?addthis_nag_ignore=0');
|
384 |
echo "</p></div>";
|
385 |
}
|
386 |
|
387 |
elseif ( ( ! isset($options['username']) || $options['username'] == false) && ! get_user_meta($user_id, 'addthis_nag_username_ignore'))
|
388 |
{
|
389 |
echo '<div class="updated addthis_setup_nag"><p>';
|
390 |
+
printf( __('Sign up for AddThis and add your username/password to recieve analytics about how people are sharing your content.<br /> <a href="%1$s">Enter username and password</a> | <a href="%2$s" target="_blank">Sign Up</a> | <a href="%3$s">Ignore this notice</a>'),
|
391 |
+
admin_url('options-general.php?page=' . __FILE__ ),
|
392 |
+
'https://www.addthis.com/register?profile=wpp',
|
393 |
+
'?addthis_nag_username_ignore=0');
|
394 |
echo "</p></div>";
|
395 |
}
|
396 |
elseif ( (get_user_meta($user_id, 'addthis_nag_updated_options') == true ) )
|
397 |
{
|
398 |
echo '<div class="updated addthis_setup_nag"><p>';
|
399 |
+
printf( __('We have updated the options for the AddThis plugin. Check out the <a href="%1$s">AddThis settings page</a> to see the new styles and options.<br /> <a href="%1$s">See New Options</a> | <a href="%2$s">Ignore this notice</a>'),
|
400 |
+
admin_url('options-general.php?page=' . __FILE__ ),
|
401 |
+
'?addthis_nag_updated_ignore=0');
|
402 |
echo "</p></div>";
|
403 |
}
|
404 |
}
|
495 |
return false;
|
496 |
}
|
497 |
$domain = get_home_url();
|
498 |
+
|
499 |
+
|
500 |
$domain = str_replace(array('http://', 'https://'), '', $domain);
|
501 |
|
502 |
+
if (isset($options['profile']))
|
503 |
+
$profile = '&pubid='.urlencode($options['profile']);
|
504 |
+
else
|
505 |
+
$profile = '';
|
506 |
|
507 |
+
|
508 |
$requests = array(
|
509 |
array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'day'),
|
510 |
array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'week'),
|
514 |
array('metric' => 'clickbacks', 'dimension' => '', 'domain' => $domain, 'period' => 'month'),
|
515 |
array('metric' => 'shares', 'dimension' => 'service' , 'domain' => $domain, 'period' => 'month'),
|
516 |
array('metric' => 'clickbacks', 'dimension' => 'service', 'domain' => $domain, 'period' => 'month'),
|
517 |
+
array('metric' => 'shares', 'dimension' => 'url' , 'domain' => $domain, 'period' => 'month'),
|
518 |
+
array('metric' => 'clickbacks', 'dimension' => 'url', 'domain' => $domain, 'period' => 'month'),
|
519 |
);
|
520 |
|
521 |
if (! $stats = get_transient('addthis_dashboard_stats') )
|
522 |
{
|
523 |
add_filter('http_headers_useragent', 'addthis_plugin_useragent');
|
524 |
+
foreach ($requests as $request)
|
525 |
+
{
|
526 |
+
$dimension = $metric = $domain = $period = '';
|
527 |
+
extract($request);
|
528 |
+
$dimension = ($dimension != '') ? '/'.$dimension : '';
|
529 |
+
$url = 'https://api.addthis.com/analytics/1.0/pub/' . $metric . $dimension . '.json?'.
|
530 |
+
'domain='.$domain.'&period='.$period.
|
531 |
+
'&username='.$username.
|
532 |
+
'&password='.$password.
|
533 |
+
$profile;
|
534 |
+
$stats[$metric.$dimension.$period] = wp_remote_get($url, array('period' => $period, 'domain' => $domain, 'password' => $password, 'username' => $username) );
|
535 |
+
|
536 |
+
if ( is_wp_error( $stats[$metric.$dimension.$period] ) )
|
537 |
+
{
|
538 |
+
echo "There was an error retrieving your stats from the AddThis servers. Please wait and try again in a few moments\n";
|
539 |
+
if (defined(WP_DEBUG) && WP_DEBUG == TRUE)
|
540 |
+
echo "Error Code:" . $stats[$metric.$dimension.$period]->get_error_code();
|
541 |
+
|
542 |
+
exit;
|
543 |
+
}
|
544 |
+
|
545 |
+
else if ($stats[$metric.$dimension.$period]['response']['code'] == 401 )
|
546 |
+
{
|
547 |
+
echo "The Username / Password / Profile combination you presented is not valid.<br />";
|
548 |
+
echo "Please confirm that you have correctly entered your AddThis username, password and profile id.";
|
549 |
+
exit;
|
550 |
+
}
|
551 |
+
else if ( $stats[$metric.$dimension.$period]['response']['code'] == 500)
|
552 |
+
{
|
553 |
+
echo "Something has gone terribly wrong! This should never happen, but somehow did. We are working to correct it right now. We will get everything up again soon";
|
554 |
+
exit;
|
555 |
+
}
|
556 |
+
|
557 |
+
else if ($stats[$metric.$dimension.$period]['response']['code'] == 501 )
|
558 |
+
{
|
559 |
+
echo "There was an error retrieving your analytics. If you wait a momeent and try again, you should be all set ";
|
560 |
+
exit;
|
561 |
+
}
|
562 |
+
else if ($stats[$metric.$dimension.$period]['response']['code'] != 201 )
|
563 |
+
{
|
564 |
+
}
|
565 |
+
}
|
566 |
+
|
567 |
+
if ( $stats['sharesday']['response']['code'] == 200)
|
568 |
+
set_transient('addthis_dashboard_stats', $stats, '600');
|
569 |
+
|
570 |
}
|
571 |
if ($stats['sharesday']['response']['code'] == 200 && $stats['sharesmonth']['body'] != '[]' )
|
572 |
{
|
573 |
+
$shareurls = json_decode($stats['shares/urlmonth']['body']);
|
574 |
+
$clickbackurls = json_decode($stats['clickbacks/urlmonth']['body']);
|
575 |
+
$yesterday['shares'] = json_decode($stats['sharesday']['body']);
|
576 |
+
$yesterday['shares'] = $yesterday['shares'][0]->shares;
|
577 |
+
$yesterday['clickbacks'] = json_decode($stats['clickbacksday']['body']);
|
578 |
+
$yesterday['clickbacks'] = $yesterday['clickbacks'][0]->clickbacks;
|
579 |
+
$yesterday['viral'] = ($yesterday['shares'] > 0 && $yesterday['clickbacks'] > 0 ) ? $yesterday['clickbacks'] / $yesterday['shares'] * 100 . '%' : 'n/a';
|
580 |
+
|
581 |
+
if (! $yesterday['clickbacks'] ) $yesterday['clickbacks'] = 0;
|
582 |
+
if (! $yesterday['shares'] ) $yesterday['shares'] = 0;
|
583 |
+
|
584 |
+
$decodedLastWeek = json_decode($stats['sharesweek']['body']);
|
585 |
+
$lastweek['shares'] = 0;
|
586 |
+
foreach ($decodedLastWeek as $share)
|
587 |
+
{
|
588 |
+
$lastweek['shares'] += $share->shares;
|
589 |
+
}
|
590 |
+
$decodedLastWeek = json_decode($stats['clickbacksweek']['body']);
|
591 |
+
$lastweek['clickbacks'] = 0;
|
592 |
+
foreach ($decodedLastWeek as $clickback)
|
593 |
+
{
|
594 |
+
$lastweek['clickbacks'] += $clickback->clickbacks;
|
595 |
+
}
|
596 |
+
$lastweek['viral'] = ($lastweek['shares'] > 0 && $lastweek['clickbacks'] > 0 ) ? $lastweek['clickbacks'] / $lastweek['shares'] * 100 . '%' : 'n/a';
|
597 |
|
598 |
+
$decodedLastMonth = json_decode($stats['sharesmonth']['body']);
|
599 |
+
$lastmonth['shares'] = 0;
|
600 |
+
foreach ($decodedLastMonth as $share)
|
601 |
+
{
|
602 |
+
$lastmonth['shares'] += $share->shares;
|
603 |
+
}
|
604 |
+
$decodedLastMonth = json_decode($stats['clickbacksmonth']['body']);
|
605 |
+
$lastmonth['clickbacks'] = 0;
|
606 |
+
foreach ($decodedLastMonth as $clickback)
|
607 |
+
{
|
608 |
+
$lastmonth['clickbacks'] += $clickback->clickbacks;
|
609 |
+
}
|
610 |
+
$lastmonth['viral'] = ($lastmonth['shares'] > 0 && $lastmonth['clickbacks'] ) ? $lastmonth['clickbacks'] / $lastmonth['shares'] * 100 . '%' : 'n/a';
|
611 |
|
612 |
|
613 |
+
$services['shares'] = json_decode($stats['shares/servicemonth']['body']);
|
614 |
+
$services['clickbacks'] = json_decode($stats['clickbacks/servicemonth']['body']);
|
615 |
+
foreach (array('shares', 'clickbacks') as $type)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
616 |
{
|
617 |
+
$topServiceShare = array_shift($services[$type]);
|
618 |
+
$firstLabel = ( isset($_services[$topServiceShare->service])) ? $_services[$topServiceShare->service] : $topServiceShare->service;
|
619 |
+
$firstAmount = $topServiceShare->{$type};
|
620 |
+
$topServiceShare = array_shift($services[$type]);
|
621 |
+
$secondLabel = ( isset($_services[$topServiceShare->service])) ? $_services[$topServiceShare->service] : $topServiceShare->service;
|
622 |
+
$secondAmount = $topServiceShare->{$type};
|
623 |
+
$thirdLabel = 'Others';
|
624 |
+
$thirdAmount = 0;
|
625 |
+
foreach($services[$type] as $service )
|
626 |
+
{
|
627 |
+
$thirdAmount += $service->{$type};
|
628 |
+
}
|
629 |
|
630 |
|
631 |
+
$servicesCharts[$type] = '//chart.apis.google.com/chart?&chdlp=b&chs=118x145&cht=p3&chco=BA3A1C|F75C39|424242&chf=bg,s,00000000&'.
|
632 |
+
'chdl='.$firstLabel.'|'.$secondLabel.'|'.$thirdLabel.'&'.
|
633 |
+
'chd=t:'.$firstAmount.','.$secondAmount.','.$thirdAmount;
|
634 |
+
}
|
635 |
|
636 |
+
|
637 |
+
echo "<div id='at_tabs'>";
|
638 |
+
echo "<ul>";
|
639 |
+
echo "<li class='at_time_period'><a href='#tab1'>Yesterday</a></li>";
|
640 |
+
echo "<li class='at_time_period'><a href='#tab2'>Last Week</a></li>";
|
641 |
+
echo "<li class='at_time_period'><a href='#tab3'>Last Month</a></li>";
|
642 |
+
echo "</ul><div class='clear'> </div>";
|
643 |
+
$tab = 0;
|
644 |
+
foreach (array('yesterday', 'lastweek', 'lastmonth') as $timePeriod )
|
645 |
+
{
|
646 |
+
$stats = $$timePeriod;
|
647 |
+
$tab++;
|
648 |
+
$viral = ( $stats['viral'] != 'n/a' ) ? number_format( $stats['viral'],2) .'%' : $stats['viral'];
|
649 |
+
echo '<div id="tab'.$tab.'">';
|
650 |
+
|
651 |
+
echo
|
652 |
+
'<table class="atw-table">
|
653 |
+
<colgroup><col width="33%"/><col width="33%"/><col width="33%"/></colgroup>
|
654 |
+
<tr>';
|
655 |
+
echo '<td><div class="atw-cell"><h3>'. $stats['shares'].'</h3>Shares</div></td>';
|
656 |
+
echo '<td><div class="atw-cell"><h3>'. $stats['clickbacks'].'</h3>Clicks</div></td>';
|
657 |
+
echo '<td><div class="atw-cell"><h3>'. $viral .'</h3>Viral Lift</div></td>';
|
658 |
+
|
659 |
+
echo '</tr>';
|
660 |
+
echo '</table>';
|
661 |
+
echo '</div>';
|
662 |
+
}
|
663 |
+
echo "</div>";
|
664 |
+
|
665 |
+
echo "<div>";
|
666 |
+
echo "</div>";
|
667 |
+
echo "<div id='tstab1'>";
|
668 |
+
echo "<h5> Most Shared URLs (last month) </h5>";
|
669 |
+
echo "<ul>";
|
670 |
+
$count = count($shareurls);
|
671 |
+
for($i = 0; ( $i < 5 && $i < $count ); $i++)
|
672 |
+
{
|
673 |
+
$url = array_shift($shareurls);
|
674 |
+
$displayUrl = str_replace( array('http://', 'https://', $domain), '',$url->url);
|
675 |
+
echo "<li><span class='urlCount'>" . $url->shares . "</span><span class='urlUrl'>". $displayUrl . "</span></li>";
|
676 |
+
}
|
677 |
+
echo "</ul>";
|
678 |
+
echo "<h5>Top Services for shares(last month)</h5>";
|
679 |
+
echo "<img src='{$servicesCharts['shares']}' width='118' height='145' alt='share stats for the last month' />";
|
680 |
+
echo "</div>";
|
681 |
+
echo '<div id="tstab2">';
|
682 |
+
echo '<h5> Most Clicked URLs (last month) </h5>';
|
683 |
+
echo "<ul>";
|
684 |
+
$count = count($clickbackurls);
|
685 |
+
for($i = 0; ( $i < 5 && $i < $count ); $i++)
|
686 |
+
{
|
687 |
+
$url = array_shift($clickbackurls);
|
688 |
+
$displayUrl = str_replace( array('http://', 'https://', $domain), '',$url->url);
|
689 |
+
echo "<li><span class='urlCount'>" . $url->clickbacks . "</span><span class='urlUrl'>". $displayUrl . "</span></li>";
|
690 |
+
}
|
691 |
+
echo "</ul>";
|
692 |
+
echo "<h5>Top Services for clicks(last month)</h5>";
|
693 |
+
echo "<img src='{$servicesCharts['clickbacks']}' width='118' height='145' alt='share stats for the last month' />";
|
694 |
+
echo "</div>";
|
695 |
+
echo '<div class="clear"> </div>';
|
696 |
+
echo '<p><a class="button rbutton" href="//www.addthis.com/analytics/summary?domain='.$domain.'">View More Analytics</a></p>';
|
697 |
+
}
|
698 |
elseif($stats['sharesday']['response']['code'] == 200){
|
699 |
|
700 |
echo
|
702 |
<p>We haven't recorded any sharing events in the last month for this site. This could be because you just installed addthis. If you would like to increase your sharing,</p>
|
703 |
<p>If you want some ideas for increasing your sharing, check out:</p>
|
704 |
<ul>
|
705 |
+
<li><span class='b'><a href="//www.addthis.com//blog/">The AddThis Blog</a></span></li>
|
706 |
+
<li><span class='b'><a href="//www.addthis.com//blog/2010/11/09/3-tips-for-getting-the-most-shares/">Three tips for getting the most shares</a></span></li>
|
707 |
+
<li><span class='b'><a href="//www.addthis.com/forum/">The AddThis Forum</a></span></li>
|
708 |
<ul>
|
709 |
ENDHTML;
|
710 |
}
|
711 |
+
elseif ($stats['sharesday']['response']['code'] == 401){
|
712 |
+
echo "I'm sorry, but we seemed to encounter an error. Please ensure that your password, username and pubid are correct.";
|
713 |
+
|
714 |
+
}
|
715 |
+
|
716 |
else{
|
717 |
+
echo "I'm sorry, but we seemed to have encountered an error when requesting your analytics. Please wait a few moments and try again.";
|
718 |
}
|
719 |
die();
|
720 |
}
|
747 |
if (! wp_verify_nonce($nonce, 'addthis-options') ) die('Security check');
|
748 |
|
749 |
// Parse Post data
|
|
|
750 |
$option_array = addthis_parse_options($values);
|
751 |
+
|
752 |
// Set Transient
|
753 |
if (false !== get_transient('addthis_settings'))
|
754 |
delete_transient('addthis_settings');
|
755 |
$eh = set_transient('addthis_settings', $option_array, 120);
|
756 |
|
757 |
+
print_r($option_array);
|
758 |
+
|
759 |
die();
|
760 |
}
|
761 |
|
775 |
*/
|
776 |
function addthis_parse_options($data)
|
777 |
{
|
778 |
+
require_once('addthis_settings_functions.php');
|
779 |
|
780 |
global $addthis_styles, $addthis_new_styles;
|
781 |
|
782 |
$styles = array_merge($addthis_styles, $addthis_new_styles);
|
783 |
|
784 |
+
|
785 |
$options = array();
|
786 |
|
787 |
+
// Sanitize profile, username and password
|
788 |
if ( isset($data['addthis_username']) )
|
789 |
$options['username'] = sanitize_text_field($data['addthis_username']);
|
790 |
|
791 |
+
if ( isset($data['addthis_profile']) )
|
792 |
+
$options['profile'] = sanitize_text_field($data['addthis_profile']);
|
793 |
+
|
794 |
if ( isset($data['addthis_password']) )
|
795 |
$options['password'] = sanitize_text_field($data['addthis_password']);
|
796 |
|
797 |
+
if (! isset($data['above']) ){
|
798 |
+
}
|
799 |
+
elseif ( isset ($data['show_above']) )
|
800 |
$options['above'] = 'none';
|
801 |
elseif ( isset($styles[$data['above']]) )
|
802 |
$options['above'] = $data['above'];
|
804 |
{
|
805 |
$options['above'] = 'none';
|
806 |
}
|
807 |
+
elseif ($data['above'] == 'custom')
|
808 |
+
{
|
809 |
+
|
810 |
+
$options['above_do_custom_services'] = isset($data['above_do_custom_services']) ;
|
811 |
+
$options['above_do_custom_preferred'] = isset($data['above_do_custom_preferred']) ;
|
812 |
+
|
813 |
+
$options['above'] = 'custom';
|
814 |
+
$options['above_custom_size'] = ( $data['above_custom_size'] == '16' || $data['above_custom_size'] == 32 ) ? $data['above_custom_size'] : '' ;
|
815 |
+
$options['above_custom_services'] = sanitize_text_field( $data['above_custom_services'] );
|
816 |
+
$options['above_custom_preferred'] = (int) $data['above_custom_preferred'] ;
|
817 |
+
$options['above_custom_more'] = isset($data['above_custom_more']);
|
818 |
+
}
|
819 |
+
elseif ($data['above'] == 'custom_string')
|
820 |
+
{
|
821 |
|
822 |
+
$options['above'] = 'custom_string';
|
823 |
+
$options['above_custom_string'] = addthis_kses($data['above_custom_string']);
|
824 |
+
|
825 |
+
}
|
826 |
+
|
827 |
+
if ( ! isset($data['below'] )){
|
828 |
+
}
|
829 |
+
elseif ( isset ($data['show_below']) )
|
830 |
$options['below'] = 'none';
|
831 |
elseif ( isset($styles[$data['below']]) )
|
832 |
$options['below'] = $data['below'];
|
834 |
{
|
835 |
$options['below'] = 'none';
|
836 |
}
|
837 |
+
elseif ($data['below'] == 'custom')
|
838 |
+
{
|
839 |
+
$options['below_do_custom_services'] = isset($data['below_do_custom_services']) ;
|
840 |
+
$options['below_do_custom_preferred'] = isset($data['below_do_custom_preferred']) ;
|
841 |
+
|
842 |
+
$options['below'] = 'custom';
|
843 |
+
$options['below_custom_size'] = ( $data['below_custom_size'] == '16' || $data['below_custom_size'] == 32 ) ? $data['below_custom_size'] : '' ;
|
844 |
+
$options['below_custom_services'] = sanitize_text_field( $data['below_custom_services'] );
|
845 |
+
$options['below_custom_preferred'] = sanitize_text_field( $data['below_custom_preferred'] );
|
846 |
+
$options['below_custom_more'] = isset($data['below_custom_more']);
|
847 |
+
}
|
848 |
+
elseif ($data['below'] == 'custom_string')
|
849 |
+
{
|
850 |
+
$options['below'] = 'custom_string';
|
851 |
+
$options['below_custom_string'] = addthis_kses($data['below_custom_string']);
|
852 |
+
}
|
853 |
+
|
854 |
|
855 |
|
856 |
// All the checkbox fields
|
857 |
+
foreach (array('addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats', 'addthis_showonexcerpts', 'addthis_addressbar','addthis_508' ) as $field)
|
858 |
{
|
859 |
if ( isset($data[$field]) && $data[$field] == true)
|
860 |
$options[$field] = true;
|
861 |
+
else
|
862 |
+
$options[$field] = false;
|
863 |
|
864 |
}
|
865 |
|
866 |
+
//[addthis_twitter_template]
|
867 |
+
if ( isset ($data['addthis_twitter_template']) && strlen($data['addthis_twitter_template']) != 0 )
|
868 |
+
$options['addthis_twitter_template'] = sanitize_text_field($data['addthis_twitter_template']);
|
869 |
+
|
870 |
+
if (isset ($data['addthis_bitly_login']) && strlen($data['addthis_bitly_login']) != 0 )
|
871 |
+
$options['addthis_bitly_login'] = sanitize_text_field($data['addthis_bitly_login']);
|
872 |
+
|
873 |
+
if (isset ($data['addthis_bitly_key']) && strlen($data['addthis_bitly_key']) != 0 )
|
874 |
+
$options['addthis_bitly_key'] = sanitize_text_field($data['addthis_bitly_key']);
|
875 |
+
|
876 |
|
877 |
//[addthis_brand] =>
|
878 |
|
880 |
$options['addthis_brand'] = sanitize_text_field($data['addthis_brand']);
|
881 |
|
882 |
//[addthis_options] =>
|
883 |
+
if ( isset ($data['addthis_options']) && strlen($data['addthis_options']) != 0 )
|
884 |
+
$options['addthis_options'] = str_replace(' ', '', esc_js( strtolower( $data['addthis_options'] ) ));
|
885 |
|
886 |
//[addthis_language] =>
|
887 |
if ( isset ($data['addthis_language']))
|
904 |
$options['addthis_header_color'] = sanitize_text_field($data['addthis_header_color']);
|
905 |
}
|
906 |
|
907 |
+
if (isset ($data['addthis_config_json']) && strlen($data['addthis_config_json']) != 0 )
|
908 |
+
{
|
909 |
+
$options['addthis_config_json'] = sanitize_text_field($data['addthis_config_json']);
|
910 |
+
}
|
911 |
+
|
912 |
+
if (isset ($data['addthis_share_json']) && strlen($data['addthis_share_json']) != 0 )
|
913 |
+
{
|
914 |
+
$options['addthis_share_json'] = sanitize_text_field($data['addthis_share_json']);
|
915 |
+
}
|
916 |
+
|
917 |
+
|
918 |
return $options;
|
919 |
|
920 |
}
|
927 |
register_setting('addthis', 'addthis_settings', 'addthis_save_settings');
|
928 |
|
929 |
}
|
930 |
+
/*
|
931 |
+
* Used to make sure excerpts above the head aren't displayed wrong
|
932 |
+
*/
|
933 |
+
function addthis_add_content_filters()
|
934 |
+
{
|
935 |
+
|
936 |
+
global $addthis_did_filters_added;
|
937 |
+
$addthis_did_filters_added = true;
|
938 |
+
|
939 |
+
if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
|
940 |
+
$preview = true;
|
941 |
+
else
|
942 |
+
$options = get_option('addthis_settings');
|
943 |
+
|
944 |
+
if ( ! empty( $options) ){
|
945 |
+
if ($options['addthis_showonexcerpts'] == true )
|
946 |
+
add_filter('get_the_excerpt', 'addthis_display_social_widget_excerpt');
|
947 |
+
|
948 |
+
add_filter('the_content', 'addthis_display_social_widget', 15);
|
949 |
+
}
|
950 |
+
}
|
951 |
+
|
952 |
|
953 |
/**
|
954 |
* Adds WP filter so we can append the AddThis button to post content.
|
957 |
{
|
958 |
global $addthis_settings;
|
959 |
|
960 |
+
add_action( 'wp_head', 'addthis_add_content_filters');
|
961 |
+
|
962 |
+
if (addthis_get_wp_version() >= 2.7 || apply_filters('at_assume_latest', __return_false() ) || apply_filters('addthis_assume_latest', __return_false() ) ) {
|
963 |
if ( is_admin() ) {
|
964 |
add_action( 'admin_init', 'register_addthis_settings' );
|
965 |
}
|
967 |
|
968 |
$options = get_option('addthis_settings');
|
969 |
|
|
|
|
|
|
|
970 |
|
971 |
+
$script_location = apply_filters( 'at_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/addthis.js' ;
|
972 |
+
$script_location = apply_filters( 'addthis_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/addthis.js' ;
|
973 |
+
|
974 |
+
$style_location = apply_filters( 'at_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) .'/addthis/css/addthis.css' ;
|
975 |
+
$style_location = apply_filters( 'addthis_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) .'/addthis/css/addthis.css' ;
|
976 |
|
|
|
977 |
|
978 |
+
wp_register_style( 'addthis', $style_location );
|
979 |
+
wp_register_script( 'addthis', $script_location , array('jquery-ui-tabs') );
|
980 |
+
|
981 |
+
add_action('admin_print_styles-index.php', 'addthis_print_style');
|
982 |
+
add_action('admin_print_scripts-index.php', 'addthis_print_script');
|
983 |
+
|
984 |
+
add_filter('admin_menu', 'addthis_admin_menu');
|
985 |
|
986 |
+
if ( apply_filters( 'at_do_options_upgrades', '__return_true') || apply_filters( 'addthis_do_options_upgrades', '__return_true') )
|
987 |
+
{
|
988 |
+
if ( get_option('addthis_product') !== false && ! is_array( $options ) )
|
989 |
+
addthis_options_200();
|
990 |
|
991 |
+
// Upgrade to 210 from 200
|
992 |
+
if ( isset($options['username']) && ! isset($options['profile']) )
|
993 |
+
addthis_options_210();
|
994 |
+
}
|
995 |
+
add_action( 'addthis_widget', 'addthis_print_widget', 10, 3);
|
996 |
|
997 |
$product = get_option('addthis_product');
|
998 |
|
1029 |
|
1030 |
function addthis_widget_init()
|
1031 |
{
|
1032 |
+
require_once('addthis_settings_functions.php');
|
1033 |
require_once('addthis_sidebar_widget.php');
|
1034 |
+
//require_once('addthis_content_feed_widget.php');
|
1035 |
register_widget('AddThisSidebarWidget');
|
1036 |
+
//register_widget('AddThisContentFeedWidget');
|
1037 |
}
|
1038 |
|
1039 |
function addthis_sidebar_widget($args)
|
1047 |
// essentially replace wp_trim_excerpt until we have something better to use here
|
1048 |
function addthis_remove_tag($content, $text = '')
|
1049 |
{
|
1050 |
+
|
1051 |
+
|
1052 |
+
if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
|
1053 |
+
$preview = true;
|
1054 |
+
else
|
1055 |
+
$options = get_option('addthis_settings');
|
1056 |
+
|
1057 |
+
|
1058 |
$raw_excerpt = $text;
|
1059 |
if ( '' == $text ) {
|
|
|
1060 |
|
1061 |
+
$text = get_the_content('');
|
1062 |
$text = strip_shortcodes( $text );
|
1063 |
+
|
1064 |
remove_filter('the_content', 'addthis_display_social_widget', 15);
|
1065 |
|
1066 |
$text = apply_filters('the_content', $text);
|
1067 |
+
|
1068 |
+
add_filter('the_content', 'addthis_display_social_widget', 15);
|
1069 |
+
|
1070 |
$text = str_replace(']]>', ']]>', $text);
|
1071 |
$text = strip_tags($text);
|
1072 |
$excerpt_length = apply_filters('excerpt_length', 55);
|
1079 |
} else {
|
1080 |
$text = implode(' ', $words);
|
1081 |
}
|
1082 |
+
if ($options['addthis_showonexcerpts'] == false)
|
1083 |
+
return $text;
|
1084 |
+
return addthis_display_social_widget($text, false, false);
|
1085 |
}
|
1086 |
else
|
1087 |
{
|
1088 |
return $content;
|
1089 |
}
|
1090 |
}
|
1091 |
+
|
1092 |
+
function addthis_late_widget($link_text)
|
1093 |
{
|
1094 |
+
remove_filter('get_the_excerpt', 'addthis_late_widget');
|
1095 |
+
|
1096 |
+
if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
|
1097 |
+
$preview = true;
|
1098 |
+
else
|
1099 |
+
$options = get_option('addthis_settings');
|
1100 |
+
|
1101 |
+
if ($options['addthis_showonexcerpts'] == false)
|
1102 |
+
return $link_text;
|
1103 |
+
|
1104 |
global $addthis_styles, $addthis_new_styles;
|
1105 |
$styles = array_merge($addthis_styles, $addthis_new_styles);
|
1106 |
+
|
1107 |
+
$url = get_permalink();
|
1108 |
+
$title = get_the_title();
|
1109 |
+
$url_above = '';
|
1110 |
+
$url_below = '';
|
1111 |
+
if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
|
1112 |
+
$preview = true;
|
1113 |
+
else
|
1114 |
+
$options = get_option('addthis_settings');
|
1115 |
+
|
1116 |
+
|
1117 |
+
$url_below = "addthis:url='$url' ";
|
1118 |
+
$url_below .= "addthis:title='$title'";
|
1119 |
+
|
1120 |
+
if (has_excerpt() && ! is_attachment() && isset($options['below']) && $options['below'] == 'custom')
|
1121 |
+
{
|
1122 |
+
$belowOptions['size'] = $options['below_custom_size'];
|
1123 |
+
if ($options['below_do_custom_services'])
|
1124 |
+
$belowOptions['services'] = $options['below_custom_services'];
|
1125 |
+
if ($options['below_do_custom_preferred'])
|
1126 |
+
$belowOptions['preferred'] = $options['below_custom_preferred'];
|
1127 |
+
$belowOptions['more'] = $options['below_custom_more'];
|
1128 |
+
return $link_text . apply_filters('addthis_below_content', addthis_custom_toolbox($belowOptions, $url, $title) );
|
1129 |
+
}
|
1130 |
+
|
1131 |
+
elseif ( isset ($styles[$options['below']]) && has_excerpt() && ! is_attachment() )
|
1132 |
+
{
|
1133 |
+
$below = apply_filters('addthis_below_content', $styles[$options['below']]['src']);
|
1134 |
+
}
|
1135 |
+
else
|
1136 |
+
{
|
1137 |
+
$below = apply_filters('addthis_below_content','' );
|
1138 |
+
}
|
1139 |
+
return $link_text . sprintf($below, $url_below);
|
1140 |
+
|
1141 |
+
|
1142 |
+
}
|
1143 |
+
|
1144 |
+
|
1145 |
+
function addthis_display_social_widget_excerpt($content)
|
1146 |
+
{
|
1147 |
+
if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
|
1148 |
+
$preview = true;
|
1149 |
+
else
|
1150 |
+
$options = get_option('addthis_settings');
|
1151 |
+
|
1152 |
+
|
1153 |
+
if ( has_excerpt() && $options['addthis_showonexcerpts'] == true )
|
1154 |
+
return addthis_display_social_widget($content, true, true);
|
1155 |
+
else
|
1156 |
+
return $content;
|
1157 |
+
}
|
1158 |
+
|
1159 |
+
|
1160 |
+
function addthis_display_social_widget($content, $filtered = true, $below_excerpt = false)
|
1161 |
+
{
|
1162 |
+
|
1163 |
+
global $addthis_styles, $addthis_new_styles, $post;
|
1164 |
+
$styles = array_merge($addthis_styles, $addthis_new_styles);
|
1165 |
|
1166 |
|
1167 |
if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
|
1169 |
else
|
1170 |
$options = get_option('addthis_settings');
|
1171 |
|
1172 |
+
|
1173 |
if ( is_home() || is_front_page() )
|
1174 |
$display = (isset($options['addthis_showonhome']) && $options['addthis_showonhome'] == true ) ? true : false;
|
1175 |
elseif ( is_archive() && ! is_category() )
|
1185 |
$display = true;
|
1186 |
else
|
1187 |
$display = false;
|
1188 |
+
$custom_fields = get_post_custom($post->ID);
|
1189 |
+
if (isset ($custom_fields['addthis_exclude']) && $custom_fields['addthis_exclude'][0] == 'true')
|
1190 |
+
$display = false;
|
1191 |
+
|
1192 |
+
$display = apply_filters('addthis_post_exclude', $display);
|
1193 |
+
|
1194 |
+
remove_filter('wp_trim_excerpt', 'addthis_remove_tag', 9, 2);
|
1195 |
+
remove_filter('get_the_excerpt', 'addthis_late_widget');
|
1196 |
+
$url = get_permalink();
|
1197 |
+
$title = get_the_title();
|
1198 |
+
$url_above = "addthis:url='$url' ";
|
1199 |
+
$url_above .= "addthis:title='$title'";
|
1200 |
+
$url_below = "addthis:url='$url' ";
|
1201 |
+
$url_below .= "addthis:title='$title'";
|
1202 |
+
$above = '';
|
1203 |
+
$below = '';
|
1204 |
|
|
|
|
|
|
|
|
|
|
|
1205 |
// Still here? Well let's add some social goodness
|
1206 |
+
if ( isset( $options['above'] ) && $options['above'] != 'none' && $display )
|
1207 |
{
|
1208 |
if (isset ($styles[$options['above']]))
|
1209 |
{
|
1210 |
$above = apply_filters('addthis_above_content', $styles[$options['above']]['src']);
|
1211 |
+
}
|
1212 |
+
elseif ($options['above'] == 'custom')
|
1213 |
+
{
|
1214 |
+
$aboveOptions['size'] = $options['above_custom_size'];
|
1215 |
+
if ($options['above_do_custom_services'])
|
1216 |
+
$aboveOptions['services'] = $options['above_custom_services'];
|
1217 |
+
if ($options['above_do_custom_preferred'])
|
1218 |
+
$aboveOptions['preferred'] = $options['above_custom_preferred'];
|
1219 |
+
$aboveOptions['more'] = $options['above_custom_more'];
|
1220 |
+
$above = apply_filters('addthis_above_content', addthis_custom_toolbox($aboveOptions, $url, $title) );
|
1221 |
+
}
|
1222 |
+
elseif( $options['above'] == 'custom_string')
|
1223 |
+
{
|
1224 |
+
$custom = preg_replace( '/<\s*div\s*/', '<div %s ', $options['above_custom_string'] );
|
1225 |
+
$above = apply_filters('addthis_above_content', $custom);
|
1226 |
}
|
1227 |
}
|
1228 |
+
elseif ($display)
|
1229 |
+
$above = apply_filters('addthis_above_content','' );
|
1230 |
else
|
1231 |
$above = '';
|
1232 |
+
|
1233 |
+
if ( isset( $options['below'] ) && $options['below'] != 'none' && $display && ! $below_excerpt )
|
1234 |
{
|
1235 |
if (isset ($styles[$options['below']]))
|
1236 |
{
|
1237 |
$below = apply_filters('addthis_below_content', $styles[$options['below']]['src']);
|
|
|
1238 |
}
|
1239 |
+
elseif ($options['below'] == 'custom')
|
1240 |
+
{
|
1241 |
+
$belowOptions['size'] = $options['below_custom_size'];
|
1242 |
+
$belowOptions['services'] = $options['below_custom_services'];
|
1243 |
+
$belowOptions['preferred'] = $options['below_custom_preferred'];
|
1244 |
+
$belowOptions['more'] = $options['below_custom_more'];
|
1245 |
+
$below = apply_filters('addthis_below_content', addthis_custom_toolbox($belowOptions, $url, $title) );
|
1246 |
+
}
|
1247 |
+
elseif( $options['below'] == 'custom_string')
|
1248 |
+
{
|
1249 |
+
$custom = preg_replace( '/<\s*div\s*/', '<div %s ', $options['below_custom_string'] );
|
1250 |
+
$below = apply_filters('addthis_below_content', $custom);
|
1251 |
+
}
|
1252 |
+
}
|
1253 |
+
elseif ($below_excerpt && $display && $options['below'] != 'none' )
|
1254 |
+
{
|
1255 |
+
$below = apply_filters('addthis_below_content','' );
|
1256 |
+
if ($options['addthis_showonexcerpts'] == true )
|
1257 |
+
add_filter('get_the_excerpt', 'addthis_late_widget', 14);
|
1258 |
}
|
1259 |
+
elseif ($display)
|
1260 |
+
$below = apply_filters('addthis_below_content','' );
|
1261 |
else
|
1262 |
$below = '';
|
1263 |
|
1265 |
|
1266 |
if ($display)
|
1267 |
{
|
1268 |
+
if ( isset($above) )
|
1269 |
+
$content = sprintf($above, $url_above) . $content;
|
1270 |
+
if ( isset($below) )
|
1271 |
+
$content = $content . sprintf($below, $url_below);
|
1272 |
if ($filtered == true)
|
1273 |
+
add_filter('wp_trim_excerpt', 'addthis_remove_tag', 11, 2);
|
1274 |
}
|
1275 |
|
1276 |
return $content;
|
1285 |
*
|
1286 |
* @return mixed
|
1287 |
*/
|
1288 |
+
function addthis_output_script($return = false )
|
1289 |
{
|
1290 |
global $addthis_settings;
|
1291 |
|
1296 |
|
1297 |
$script = "\n<!-- AddThis Button Begin -->\n"
|
1298 |
.'<script type="text/javascript">'
|
1299 |
+
."var addthis_product = 'wpp-261';\n";
|
1300 |
+
|
1301 |
|
1302 |
+
$pub = (isset($options['profile'])) ? $options['profile'] : false ;
|
1303 |
if (!$pub) {
|
1304 |
$pub = 'wp-'.cuid();
|
1305 |
}
|
1310 |
|
1311 |
if ( isset($options['addthis_append_data']) && $options['addthis_append_data'] == true)
|
1312 |
$addthis_config["data_track_clickback"] = true;
|
1313 |
+
else
|
1314 |
+
$addthis_config["data_track_clickback"] = false;
|
1315 |
+
|
1316 |
+
/*/
|
1317 |
+
if ( isset($options['addthis_addressbar']) && $options['addthis_addressbar'] == true)
|
1318 |
+
$addthis_config["data_track_addressbar"] = true;
|
1319 |
+
else
|
1320 |
+
$addthis_config["data_track_addressbar"] = false;
|
1321 |
+
//*/
|
1322 |
+
|
1323 |
if ( isset($options['addthis_language']) && strlen($options['addthis_language']) == 2)
|
1324 |
$addthis_config['ui_language'] = $options['addthis_language'];
|
1325 |
|
1332 |
if ( isset($options['addthis_brand']) )
|
1333 |
$addthis_config['ui_cobrand'] = $options['addthis_brand'];
|
1334 |
|
1335 |
+
if (isset($options['addthis_508']) && $options['addthis_508'] == true)
|
1336 |
+
$addthis_config['ui_508_compliant'] = true;
|
1337 |
|
1338 |
+
$addthis_config = apply_filters('addthis_config_js_var', $addthis_config);
|
1339 |
|
1340 |
+
if ( isset( $options['addthis_config_json'] ) && $options['addthis_config_json'] != '')
|
1341 |
+
$script .= 'var addthis_config = '. $options['addthis_config_json'] .';';
|
1342 |
+
elseif (! empty ($addthis_config) )
|
1343 |
$script .= 'var addthis_config = '. json_encode($addthis_config) .';';
|
1344 |
+
|
1345 |
+
if (isset($options['addthis_options']) && strlen($options['addthis_options']) != 0)
|
1346 |
+
$script .= 'var addthis_options = "'.$options['addthis_options'].'";';
|
1347 |
|
1348 |
+
if (isset($options['addthis_twitter_template'])){
|
1349 |
+
$addthis_share['templates']['twitter'] = esc_js($options['addthis_twitter_template']);
|
1350 |
+
|
1351 |
+
}
|
1352 |
+
if (isset($options['addthis_bitly_login']) && isset($options['addthis_bitly_key']) ){
|
1353 |
+
$addthis_share['url_transforms']['shorten']['twitter'] = 'bitly';
|
1354 |
+
$addthis_share['shorteners']['bitly']['login'] = esc_js($options['addthis_bitly_login']);
|
1355 |
+
$addthis_share['shorteners']['bitly']['apiKey'] = esc_js($options['addthis_bitly_key']);
|
1356 |
+
}
|
1357 |
+
if ( isset( $options['addthis_share_json'] ) && $options['addthis_share_json'] != '')
|
1358 |
+
$script .= 'if (typeof(addthis_share) == "undefined"){ addthis_share = ' . $options['addthis_share_json'] . ';}';
|
1359 |
+
elseif (isset($addthis_share))
|
1360 |
+
$script .= 'if (typeof(addthis_share) == "undefined"){ addthis_share = ' . json_encode( apply_filters('addthis_share_js_var', $addthis_share ) ) .';}';
|
1361 |
$script .= '</script>';
|
1362 |
+
|
1363 |
+
|
1364 |
+
$script .= '<script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js#pubid='.$pub.'"></script>';
|
1365 |
+
|
1366 |
+
|
1367 |
+
if ( ! is_admin() && ! is_feed() )
|
1368 |
+
echo $script;
|
1369 |
+
elseif ($return == true && ! is_admin() && ! is_feed() )
|
1370 |
+
return $script;
|
1371 |
}
|
1372 |
|
1373 |
|
1418 |
$content .= <<<EOF
|
1419 |
//-->
|
1420 |
</script>
|
1421 |
+
<div class="addthis_container"><a href="//www.addthis.com/bookmark.php?v=250&username=$pub" class="addthis_button" addthis:url="$link" addthis:title="$title">
|
1422 |
EOF;
|
1423 |
+
$content .= ($addthis_settings['language'] == '' ? '' /* no hardcoded image -- we'll choose the language automatically */ : addthis_get_button_img()) . '</a><script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js#username='.$pub.'"></script></div>';
|
1424 |
}
|
1425 |
else if ($addthis_settings['menu_type'] === 'toolbox')
|
1426 |
{
|
1427 |
$content .= "\n//-->\n</script>\n";
|
1428 |
$content .= <<<EOF
|
1429 |
+
<div class="addthis_container addthis_toolbox addthis_default_style" addthis:url="$link" addthis:title="$title"><a href="//www.addthis.com/bookmark.php?v=250&username=$pub" class="addthis_button_compact">Share</a><span class="addthis_separator">|</span>
|
1430 |
EOF;
|
1431 |
if (!strlen($addthis_options)) $addthis_options = 'email,favorites,print,facebook,twitter';
|
1432 |
$addthis_options = split(',', $addthis_options);
|
1436 |
$content .= '<a class="addthis_button_'.$option.'"></a>';
|
1437 |
}
|
1438 |
}
|
1439 |
+
$content .= '<script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js#username='.$pub.'"></script></div>';
|
1440 |
}
|
1441 |
else
|
1442 |
{
|
1445 |
$content .= <<<EOF
|
1446 |
//-->
|
1447 |
</script>
|
1448 |
+
<div class="addthis_container"><a href="//www.addthis.com/bookmark.php?v=250&username=$pub" onclick="window.open('//www.addthis.com/bookmark.php?v=250&username=$pub&url=$link&title=$title', 'ext_addthis', 'scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Bookmark using any bookmark manager!" target="_blank">
|
1449 |
EOF;
|
1450 |
$content .= addthis_get_button_img() . '</a></div>';
|
1451 |
}
|
1484 |
|
1485 |
if (!isset($addthis_styles[$btnStyle])) $btnStyle = 'share';
|
1486 |
$btnRecord = $addthis_styles[$btnStyle];
|
1487 |
+
$btnUrl = (strpos(trim($btnRecord['img']), '//') !== 0 ? "//s7.addthis.com/static/btn/v2/" : "") . $btnRecord['img'];
|
1488 |
|
1489 |
if (strpos($btnUrl, '%lang%') !== false)
|
1490 |
{
|
1499 |
|
1500 |
function addthis_options_page_scripts()
|
1501 |
{
|
1502 |
+
$script = (addthis_get_wp_version() >= 3.2 || apply_filters('at_assume_latest', __return_false() ) || apply_filters('addthis_assume_latest', __return_false() ) ) ? 'options-page.32.js' : 'options-page.js';
|
1503 |
+
|
1504 |
+
$script_location = apply_filters( 'at_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/'.$script ;
|
1505 |
+
$script_location = apply_filters( 'addthis_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/'.$script ;
|
1506 |
+
wp_enqueue_script( 'addthis_options_page_script', $script_location , array('jquery-ui-tabs', 'thickbox' ));
|
1507 |
+
|
1508 |
}
|
1509 |
|
1510 |
function addthis_options_page_style()
|
1511 |
{
|
1512 |
+
$style_location = apply_filters( 'at_files_uri' , plugins_url('', basename(dirname(__FILE__)) ) ) . '/addthis/css/options-page.css' ;
|
1513 |
+
$style_location = apply_filters( 'addthis_files_uri' , plugins_url('', basename(dirname(__FILE__)) ) ) . '/addthis/css/options-page.css' ;
|
1514 |
+
wp_enqueue_style( 'addthis_options_page_style', $style_location);
|
1515 |
wp_enqueue_style( 'thickbox' );
|
1516 |
}
|
1517 |
|
1523 |
}
|
1524 |
|
1525 |
$addthis_default_options = array(
|
1526 |
+
'profile' => '',
|
1527 |
'username' => '',
|
1528 |
'password' => '',
|
1529 |
'style' => addthis_style_default ,
|
1536 |
'addthis_showonpages' => true,
|
1537 |
'addthis_showonarchives' => true,
|
1538 |
'addthis_showoncats' => true,
|
1539 |
+
'addthis_addressbar' => false,
|
1540 |
'addthis_brand' => '',
|
1541 |
'toolbox' => '',
|
1542 |
'addthis_language' => '',
|
1543 |
'addthis_header_background' => '',
|
1544 |
+
'addthis_header_color' => '',
|
1545 |
+
'addthis_options' => '',
|
1546 |
+
'addthis_showonexcerpts' => true,
|
1547 |
+
'above_custom_size' => '',
|
1548 |
+
'above_custom_services' => '',
|
1549 |
+
'above_custom_preferred' => '',
|
1550 |
+
'above_custom_more' => '',
|
1551 |
+
'above_custom_string' => '',
|
1552 |
+
'below_custom_size' => '',
|
1553 |
+
'below_custom_services' => '',
|
1554 |
+
'below_custom_preferred' => '',
|
1555 |
+
'below_custom_more' => '',
|
1556 |
+
'below_custom_string' => '',
|
1557 |
+
'addthis_twitter_template' => '',
|
1558 |
+
'addthis_508' => '',
|
1559 |
+
'addthis_bitly_login' => '',
|
1560 |
+
'addthis_bitly_key' => '',
|
1561 |
+
'addthis_config_json' => '',
|
1562 |
+
'addthis_share_json' => '',
|
1563 |
);
|
1564 |
|
1565 |
function addthis_plugin_options_php4() {
|
1566 |
+
|
1567 |
+
require_once('addthis_settings_functions.php');
|
1568 |
global $addthis_styles;
|
1569 |
global $addthis_languages;
|
1570 |
global $addthis_settings;
|
1572 |
global $addthis_new_styles;
|
1573 |
global $addthis_default_options;
|
1574 |
|
1575 |
+
|
1576 |
+
|
1577 |
global $current_user;
|
1578 |
$user_id = $current_user->ID;
|
1579 |
|
1585 |
<form id="addthis_settings" method="post" action="options.php">
|
1586 |
<?php
|
1587 |
// use the old-school settings style in older versions of wordpress
|
1588 |
+
if (addthis_get_wp_version() >= 2.7 || apply_filters('at_assume_latest', __return_false() ) || apply_filters('addthis_assume_latest', __return_false() ) ) {
|
|
|
|
|
1589 |
settings_fields('addthis');
|
1590 |
+
} else {
|
1591 |
+
wp_nonce_field('update-options');
|
1592 |
}
|
1593 |
|
1594 |
+
$addthis_options = get_option('addthis_settings');
|
1595 |
+
if ($addthis_options == false)
|
1596 |
+
add_option('addthis_settings', array() );
|
1597 |
+
|
1598 |
foreach ( array( 'addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats' ) as $option)
|
1599 |
+
{
|
1600 |
if ( $addthis_options && ! isset($addthis_options[$option]) )
|
1601 |
$addthis_options[$option] = false;
|
1602 |
}
|
1607 |
?>
|
1608 |
|
1609 |
<div class="page-header" id="tabs">
|
1610 |
+
<img alt='addthis' src="//cache.addthis.com/icons/v1/thumbs/32x32/more.png" class="header-img"/>
|
1611 |
<ul class="nav-tab-wrapper">
|
1612 |
<li><h2 class="nav-tab-wrapper"><a href="#tabs-1">Basic</a></h2></li>
|
1613 |
<li><h2 class="nav-tab-wrapper"><a href="#tabs-2">Advanced</a></h2></li>
|
1616 |
<div id="tabs-1">
|
1617 |
<table class="form-table">
|
1618 |
<tbody>
|
1619 |
+
<?php _addthis_choose_icons('above', $options ); ?>
|
1620 |
+
<?php _addthis_choose_icons('below', $options ); ?>
|
1621 |
+
<tr valign="top">
|
1622 |
+
<td colspan="2"><?php _e('Enter a profile, username and password to discover how your content is being shared, and how your most influential audience members are bringing traffic back to your site. Learn what interests them – and to what degree – and how thoses interests are driving sharing. <a href="//addthis.com/features" target="_blank">Click here for more information on the benefits of register</a>.<a href="//www.addthis.com/help/faq#accounts" target="_blank">Click here for more information on usernames and profiles</a> ', 'addthis_trans_domain');?> </td>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1623 |
</tr>
|
1624 |
<tr valign="top">
|
1625 |
+
<th scope="row"><?php _e("AddThis profile id:", 'addthis_trans_domain' ); ?></th>
|
1626 |
+
<td><input id="addthis_profile" type="text" name="addthis_settings[addthis_profile]" value="<?php echo $profile; ?>" autofill='off' autocomplete='off' /></td>
|
1627 |
</tr>
|
1628 |
<tr valign="top">
|
1629 |
<th scope="row"><?php _e("AddThis username:", 'addthis_trans_domain' ); ?></th>
|
1630 |
+
<td><input id="addthis_username" type="text" name="addthis_settings[addthis_username]" value="<?php echo $username; ?>" autofill='off' autocomplete='off' /></td>
|
1631 |
</tr>
|
1632 |
<tr id="password_row" >
|
1633 |
<th scope="row"><?php _e("AddThis password:", 'addthis_trans_domain' ); ?><br/><span style="font-size:10px">(required for displaying stats)</span></th>
|
1634 |
+
<td><input id="addthis_password" type="password" name="addthis_settings[addthis_password]" value="<?php echo $password; ?>" autocomplete='off' autofill='off' /></td>
|
1635 |
</tr>
|
1636 |
</tbody>
|
1637 |
</table>
|
1644 |
<td><input type="checkbox" name="addthis_settings[addthis_show_stats]" value="true" <?php echo ($addthis_show_stats == true ? 'checked="checked"' : ''); ?>/></td>
|
1645 |
</tr>
|
1646 |
<tr>
|
1647 |
+
<th scope="row"><?php _e("Track <a href=\"//www.addthis.com/blog/2010/03/11/clickback-analytics-measure-traffic-back-to-your-site-from-addthis/\" target=\"_blank\">clickbacks</a>:", 'addthis_trans_domain' ); ?></th>
|
1648 |
<td><input type="checkbox" name="addthis_settings[addthis_append_data]" value="true" <?php echo $addthis_append_data == true ? 'checked="checked"' : ''; ?>/></td>
|
1649 |
</tr>
|
1650 |
+
<tr>
|
1651 |
+
<th scope="row"><?php _e("Track Address Bar Shares", 'addthis_trans_domain' ); ?></th>
|
1652 |
+
<td><input type="checkbox" name="addthis_settings[addthis_addressbar]" value="true" <?php echo ($addthis_addressbar == true ? 'checked="checked"' : ''); ?>/></td>
|
1653 |
+
</tr>
|
1654 |
<tr>
|
1655 |
<th scope="row"><?php _e("Show on homepage:", 'addthis_trans_domain' ); ?></th>
|
1656 |
<td><input type="checkbox" name="addthis_settings[addthis_showonhome]" value="true" <?php echo ($addthis_showonhome == true ? 'checked="checked"' : ''); ?>/></td>
|
1657 |
</tr>
|
1658 |
<tr>
|
1659 |
+
<th scope="row"><?php _e("Show on <a href=\"//codex.wordpress.org/Pages\" target=\"blank\">pages</a>:", 'addthis_trans_domain' ); ?></th>
|
1660 |
<td><input type="checkbox" name="addthis_settings[addthis_showonpages]" value="true" <?php echo ( $addthis_showonpages == true ? 'checked="checked"' : ''); ?>/></td>
|
1661 |
</tr>
|
1662 |
<tr>
|
1667 |
<th scope="row"><?php _e("Show in categories:", 'addthis_trans_domain' ); ?></th>
|
1668 |
<td><input type="checkbox" name="addthis_settings[addthis_showoncats]" value="true" <?php echo ( $addthis_showoncats == true ? 'checked="checked"' : ''); ?>/></td>
|
1669 |
</tr>
|
1670 |
+
<tr>
|
1671 |
+
<th scope="row"><?php _e("Show on excerpts:", 'addthis_trans_domain' ); ?></th>
|
1672 |
+
<td><input type="checkbox" name="addthis_settings[addthis_showonexcerpts]" value="true" <?php echo ( $addthis_showonexcerpts == true ? 'checked="checked"' : ''); ?>/></td>
|
1673 |
+
</tr>
|
1674 |
+
<tr>
|
1675 |
+
<th scope="row"><?php _e("Enable Enhanced Accessibility", 'addthis_trans_domain' ); ?></th>
|
1676 |
+
<td><input type="checkbox" name="addthis_settings[addthis_508]" value="true" <?php echo ( $addthis_508 == true ? 'checked="checked"' : ''); ?>/></td>
|
1677 |
+
</tr>
|
1678 |
<tr valign="top">
|
1679 |
<td colspan="2"></td>
|
1680 |
</tr>
|
1681 |
<tr valign="top">
|
1682 |
+
<td colspan="2">For more details on the following options, see <a href="//addthis.com/customization">our customization docs</a>.</td>
|
1683 |
+
</tr>
|
1684 |
+
<tr valign="top">
|
1685 |
+
<th scope="row"><?php _e("Custom service list:", 'addthis_trans_domain' ); ?><br /><span class='description'><?php _e(
|
1686 |
+
'Important: AddThis optimizes your list of services based on popularity and language, and personalizes the list for each user. You may decrease sharing by over-riding these features.'
|
1687 |
+
, 'addthis_trans_domain') ?>
|
1688 |
+
</span></th>
|
1689 |
+
<td><input size='60' type="text" name="addthis_settings[addthis_options]" value="<?php echo $addthis_options; ?>" /><br />
|
1690 |
+
<span class='description'><?php _e('Enter a comma-separated list of <a href="//addthis.com/services/list">service codes</a>', 'addthis_trans_domain' ); ?></span>
|
1691 |
+
</td>
|
1692 |
</tr>
|
1693 |
<tr valign="top">
|
1694 |
<th scope="row"><?php _e("Brand:", 'addthis_trans_domain' ); ?></th>
|
1695 |
<td><input type="text" name="addthis_settings[addthis_brand]" value="<?php echo $addthis_brand; ?>" /></td>
|
1696 |
</tr>
|
1697 |
+
<tr valign="top">
|
1698 |
+
<th scope="row"><?php _e("<a href='http://www.addthis.com/help/client-api#configuration-sharing-templates'>Twitter Template</a>( not for tweet button) :", 'addthis_trans_domain' ); ?></th>
|
1699 |
+
<td><input type="text" name="addthis_settings[addthis_twitter_template]" value="<?php echo $addthis_twitter_template; ?>" /></td>
|
1700 |
+
</tr>
|
1701 |
+
<tr valign="top">
|
1702 |
+
<th scope="row"><?php _e("Bitly Login", 'addthis_trans_domain' ); ?></th>
|
1703 |
+
<td><input type="text" name="addthis_settings[addthis_bitly_login]" value="<?php echo $addthis_bitly_login; ?>" /></td>
|
1704 |
+
</tr>
|
1705 |
+
<tr valign="top">
|
1706 |
+
<th scope="row"><?php _e("Bitly Key", 'addthis_trans_domain' ); ?></th>
|
1707 |
+
<td><input type="text" name="addthis_settings[addthis_bitly_key]" value="<?php echo $addthis_bitly_key; ?>" /></td>
|
1708 |
+
</tr>
|
1709 |
<tr valign="top">
|
1710 |
<th scope="row"><?php _e("Language:", 'addthis_trans_domain' ); ?></th>
|
1711 |
<td>
|
1728 |
<th scope="row"><?php _e("Header color:", 'addthis_trans_domain' ); ?></th>
|
1729 |
<td><input type="text" name="addthis_settings[addthis_header_color]" value="<?php echo $addthis_header_color; ?>" /></td>
|
1730 |
</tr>
|
1731 |
+
<tr valign="top">
|
1732 |
+
<th scope="row"><?php _e("addthis_config values (json format):", 'addthis_trans_domain' ); ?></th>
|
1733 |
+
<td><textarea rows='3' cols='40' type="text" name="addthis_settings[addthis_config_json]" /><?php echo $addthis_config_json; ?></textarea></td>
|
1734 |
+
</tr>
|
1735 |
+
<tr valign="top">
|
1736 |
+
<th scope="row"><?php _e("addthis_share values (json format):", 'addthis_trans_domain' ); ?></th>
|
1737 |
+
<td><textarea rows='3' cols='40' type="text" name="addthis_settings[addthis_share_json]" /><?php echo $addthis_share_json; ?></textarea></td>
|
1738 |
+
</tr>
|
1739 |
</table>
|
1740 |
<div class='clear'> </div>
|
1741 |
</div>
|
1801 |
}
|
1802 |
}
|
1803 |
|
1804 |
+
if (! function_exists('__return_false'))
|
1805 |
+
{
|
1806 |
+
function __return_false()
|
1807 |
+
{
|
1808 |
+
return false;
|
1809 |
+
}
|
1810 |
+
}
|
1811 |
+
|
1812 |
+
if (! function_exists('__return_true'))
|
1813 |
+
{
|
1814 |
+
function __return_true()
|
1815 |
+
{
|
1816 |
+
return true;
|
1817 |
+
}
|
1818 |
+
}
|
1819 |
+
|
1820 |
+
/**
|
1821 |
+
* Make sure the option gets added on registration
|
1822 |
+
* @since 2.0.6
|
1823 |
+
*/
|
1824 |
+
|
1825 |
+
function addthis_activation_hook(){
|
1826 |
+
if ( get_option('addthis_settings') == false)
|
1827 |
+
add_option('addthis_settings', array() );
|
1828 |
+
|
1829 |
+
}
|
1830 |
+
|
1831 |
+
register_activation_hook( __FILE__, 'addthis_activation_hook' );
|
1832 |
+
|
1833 |
+
|
1834 |
+
require_once('addthis_post_metabox.php');
|
1835 |
|
1836 |
?>
|
css/addthis.css
CHANGED
@@ -125,14 +125,14 @@ float:right;
|
|
125 |
#at_tabs .at_time_period{
|
126 |
float:left;
|
127 |
padding: 0 7px;
|
128 |
-
width:
|
129 |
}
|
130 |
#tstab1{
|
131 |
-
width:
|
132 |
float: left;
|
133 |
}
|
134 |
#tstab2{
|
135 |
-
width:
|
136 |
float:left;
|
137 |
}
|
138 |
#at_tabs .clear{
|
@@ -140,29 +140,3 @@ height: 0;
|
|
140 |
margin: 0;
|
141 |
padding: 0;
|
142 |
}
|
143 |
-
.urlCount {
|
144 |
-
width: 10%;
|
145 |
-
height: 20px;
|
146 |
-
clear:both;
|
147 |
-
display:block;
|
148 |
-
float:left;
|
149 |
-
font-weight: bold;
|
150 |
-
}
|
151 |
-
.urlUrl{
|
152 |
-
float:right;
|
153 |
-
width: 85%;
|
154 |
-
font-color: #777;
|
155 |
-
word-wrap: break-word;
|
156 |
-
font-size: 0.83em;
|
157 |
-
}
|
158 |
-
#tstab1 h5, #tstab2 h5{
|
159 |
-
clear:both;
|
160 |
-
padding-top: 5px;
|
161 |
-
margin-top: 5px;
|
162 |
-
}
|
163 |
-
|
164 |
-
#tstab1{
|
165 |
-
margin-right: 2%;
|
166 |
-
padding-right: 2%;
|
167 |
-
}
|
168 |
-
|
125 |
#at_tabs .at_time_period{
|
126 |
float:left;
|
127 |
padding: 0 7px;
|
128 |
+
width: 65px;
|
129 |
}
|
130 |
#tstab1{
|
131 |
+
width: 50%;
|
132 |
float: left;
|
133 |
}
|
134 |
#tstab2{
|
135 |
+
width: 50%;
|
136 |
float:left;
|
137 |
}
|
138 |
#at_tabs .clear{
|
140 |
margin: 0;
|
141 |
padding: 0;
|
142 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css/options-page.css
CHANGED
@@ -82,39 +82,3 @@ height: 36px;
|
|
82 |
padding: 14px 6px 15px 0;
|
83 |
width: 36px;
|
84 |
}
|
85 |
-
.at_custom_input{
|
86 |
-
float: left;
|
87 |
-
|
88 |
-
}
|
89 |
-
.at_custom_label{
|
90 |
-
width: 200px;
|
91 |
-
padding-left: 4px;
|
92 |
-
float: left;
|
93 |
-
}
|
94 |
-
.above_option_custom li,
|
95 |
-
.below_option_custom li{
|
96 |
-
height: 4.6em;
|
97 |
-
padding-left: 30px;
|
98 |
-
}
|
99 |
-
.above_option_custom li span.description,
|
100 |
-
.below_option_custom li span.description{
|
101 |
-
clear:both;
|
102 |
-
float:left;
|
103 |
-
}
|
104 |
-
|
105 |
-
.at_do_custom{
|
106 |
-
float:left;
|
107 |
-
clear:both;
|
108 |
-
width: 15px;
|
109 |
-
margin-left: 0;
|
110 |
-
margin-right: 0;
|
111 |
-
padding-left: 0;
|
112 |
-
padding-right: 0;
|
113 |
-
}
|
114 |
-
|
115 |
-
.above_option, .below_option{
|
116 |
-
clear:both;
|
117 |
-
}
|
118 |
-
.nocheck .at_custom_label{
|
119 |
-
margin-left:15px;
|
120 |
-
}
|
82 |
padding: 14px 6px 15px 0;
|
83 |
width: 36px;
|
84 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/addthis.js
CHANGED
@@ -3,7 +3,7 @@ jQuery(document).ready(function($) {
|
|
3 |
var data = {action: "at_show_dashboard_widget"};
|
4 |
|
5 |
$.post(ajaxurl, data, function(response){
|
6 |
-
$( "#dashboard_addthis > .inside ").replaceWith(
|
7 |
$( "#at_tabs").tabs();
|
8 |
});
|
9 |
|
3 |
var data = {action: "at_show_dashboard_widget"};
|
4 |
|
5 |
$.post(ajaxurl, data, function(response){
|
6 |
+
$( "#dashboard_addthis > .inside > .widget-loading").replaceWith(response);
|
7 |
$( "#at_tabs").tabs();
|
8 |
});
|
9 |
|
js/options-page.32.js
DELETED
@@ -1,164 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function($) {
|
2 |
-
$( "#tabs" ).tabs();
|
3 |
-
|
4 |
-
var thickDims, tbWidth, tbHeight;
|
5 |
-
thickDims = function() {
|
6 |
-
var tbWindow = $('#TB_window'), H = $(window).height(), W = $(window).width(), w, h;
|
7 |
-
|
8 |
-
w = (tbWidth && tbWidth < W - 90) ? tbWidth : W - 90;
|
9 |
-
h = (tbHeight && tbHeight < H - 60) ? tbHeight : H - 60;
|
10 |
-
if ( tbWindow.size() ) {
|
11 |
-
tbWindow.width(w).height(h);
|
12 |
-
$('#TB_iframeContent').width(w).height(h - 27);
|
13 |
-
tbWindow.css({'margin-left': '-' + parseInt((w / 2),10) + 'px'});
|
14 |
-
if ( typeof document.body.style.maxWidth != 'undefined' )
|
15 |
-
tbWindow.css({'top':'30px','margin-top':'0'});
|
16 |
-
}
|
17 |
-
};
|
18 |
-
|
19 |
-
$('a.thickbox-preview').click( function() {
|
20 |
-
|
21 |
-
var previewLink = this;
|
22 |
-
|
23 |
-
var $inputs = $('#addthis_settings :input');
|
24 |
-
|
25 |
-
var values = {};
|
26 |
-
$.each($('#addthis_settings').serializeArray(), function(i, field) {
|
27 |
-
|
28 |
-
var thisName = field.name
|
29 |
-
if (thisName.indexOf("addthis_settings[") != -1 )
|
30 |
-
{
|
31 |
-
thisName = thisName.replace("addthis_settings[", '');
|
32 |
-
thisName = thisName.replace("]", '');
|
33 |
-
}
|
34 |
-
|
35 |
-
values[thisName] = field.value;
|
36 |
-
});
|
37 |
-
|
38 |
-
var stuff = $.param(values, true);
|
39 |
-
|
40 |
-
var data = {
|
41 |
-
action: 'at_save_transient',
|
42 |
-
value : stuff
|
43 |
-
};
|
44 |
-
|
45 |
-
jQuery.post(ajaxurl, data, function(response) {
|
46 |
-
// Fix for WP 2.9's version of lightbox
|
47 |
-
if ( typeof tb_click != 'undefined' && $.isFunction(tb_click.call))
|
48 |
-
{
|
49 |
-
tb_click.call(previewLink);
|
50 |
-
}
|
51 |
-
var href = $(previewLink).attr('href');
|
52 |
-
var link = '';
|
53 |
-
|
54 |
-
|
55 |
-
if ( tbWidth = href.match(/&tbWidth=[0-9]+/) )
|
56 |
-
tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10);
|
57 |
-
else
|
58 |
-
tbWidth = $(window).width() - 90;
|
59 |
-
|
60 |
-
if ( tbHeight = href.match(/&tbHeight=[0-9]+/) )
|
61 |
-
tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10);
|
62 |
-
else
|
63 |
-
tbHeight = $(window).height() - 60;
|
64 |
-
|
65 |
-
$('#TB_title').css({'background-color':'#222','color':'#dfdfdf'});
|
66 |
-
$('#TB_closeAjaxWindow').css({'float':'left'});
|
67 |
-
$('#TB_ajaxWindowTitle').css({'float':'right'}).html(link);
|
68 |
-
|
69 |
-
$('#TB_iframeContent').width('100%');
|
70 |
-
|
71 |
-
thickDims();
|
72 |
-
|
73 |
-
});
|
74 |
-
return false;
|
75 |
-
});
|
76 |
-
|
77 |
-
$('#above_more').click( function() {
|
78 |
-
$('#above .select_row').removeClass('hidden');
|
79 |
-
$(this).hide();
|
80 |
-
return false;
|
81 |
-
});
|
82 |
-
$('#below_more').click( function() {
|
83 |
-
$('#below .select_row').removeClass('hidden');
|
84 |
-
$(this).hide();
|
85 |
-
return false;
|
86 |
-
});
|
87 |
-
|
88 |
-
var show_above = $('input[name="addthis_settings[show_above]"]');
|
89 |
-
var show_below = $('input[name="addthis_settings[show_below]"]');
|
90 |
-
if ( show_above.prop('checked') != "undefined" && show_above.prop('checked') == true)
|
91 |
-
{
|
92 |
-
$('.above_option').toggleClass('hide');
|
93 |
-
}
|
94 |
-
|
95 |
-
if ( show_below.prop('checked') != "undefined" && show_below.prop('checked') == true)
|
96 |
-
{
|
97 |
-
$('.below_option').toggleClass('hide');
|
98 |
-
}
|
99 |
-
|
100 |
-
$('input[name="addthis_settings[show_above]"]').change( function() {
|
101 |
-
$('.above_option').toggleClass('hide');
|
102 |
-
});
|
103 |
-
|
104 |
-
$('input[name="addthis_settings[show_below]"]').change( function() {
|
105 |
-
$('.below_option').toggleClass('hide');
|
106 |
-
});
|
107 |
-
|
108 |
-
|
109 |
-
var aboveCustom = $('#above_custom_button');
|
110 |
-
var aboveCustomShow = function(){
|
111 |
-
if ( aboveCustom.prop('checked') != 'undefined' && aboveCustom.prop('checked') == true)
|
112 |
-
{
|
113 |
-
$('.above_option_custom').removeClass('hidden');
|
114 |
-
}
|
115 |
-
else
|
116 |
-
{
|
117 |
-
$('.above_option_custom').addClass('hidden');
|
118 |
-
}
|
119 |
-
};
|
120 |
-
var aboveCustomString = $('#above_custom_string');
|
121 |
-
var aboveCustomStringShow = function(){
|
122 |
-
if (aboveCustomString.prop('checked') != 'undefined' && aboveCustomString.prop('checked') == true)
|
123 |
-
{
|
124 |
-
$('#above_custom_string_input').removeClass('hidden');
|
125 |
-
}
|
126 |
-
else
|
127 |
-
{
|
128 |
-
$('#above_custom_string_input').addClass('hidden');
|
129 |
-
}
|
130 |
-
|
131 |
-
};
|
132 |
-
var belowCustom = $('#below_custom_button');
|
133 |
-
var belowCustomShow = function(){
|
134 |
-
if ( belowCustom.prop('checked') != 'undefined' && belowCustom.prop('checked') == true)
|
135 |
-
{
|
136 |
-
$('.below_option_custom').removeClass('hidden');
|
137 |
-
}
|
138 |
-
else
|
139 |
-
{
|
140 |
-
$('.below_option_custom').addClass('hidden');
|
141 |
-
}
|
142 |
-
};
|
143 |
-
var belowCustomString = $('#below_custom_string');
|
144 |
-
var belowCustomStringShow = function(){
|
145 |
-
if (belowCustomString.prop('checked') != 'undefined' && belowCustomString.prop('checked') == true)
|
146 |
-
{
|
147 |
-
$('#below_custom_string_input').removeClass('hidden');
|
148 |
-
}
|
149 |
-
else
|
150 |
-
{
|
151 |
-
$('#below_custom_string_input').addClass('hidden');
|
152 |
-
}
|
153 |
-
|
154 |
-
};
|
155 |
-
|
156 |
-
aboveCustomShow();
|
157 |
-
aboveCustomStringShow();
|
158 |
-
belowCustomShow();
|
159 |
-
belowCustomStringShow();
|
160 |
-
|
161 |
-
$('input[name="addthis_settings[above]"]').change( function(){aboveCustomShow(); aboveCustomStringShow(); } );
|
162 |
-
$('input[name="addthis_settings[below]"]').change( function(){belowCustomShow(); belowCustomStringShow(); } );
|
163 |
-
|
164 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/options-page.js
CHANGED
@@ -41,8 +41,10 @@ jQuery(document).ready(function($) {
|
|
41 |
action: 'at_save_transient',
|
42 |
value : stuff
|
43 |
};
|
|
|
44 |
|
45 |
jQuery.post(ajaxurl, data, function(response) {
|
|
|
46 |
// Fix for WP 2.9's version of lightbox
|
47 |
if ( typeof tb_click != 'undefined' && $.isFunction(tb_click.call))
|
48 |
{
|
@@ -75,12 +77,12 @@ jQuery(document).ready(function($) {
|
|
75 |
});
|
76 |
|
77 |
$('#above_more').click( function() {
|
78 |
-
$('#above .
|
79 |
$(this).hide();
|
80 |
return false;
|
81 |
});
|
82 |
$('#below_more').click( function() {
|
83 |
-
$('#below .
|
84 |
$(this).hide();
|
85 |
return false;
|
86 |
});
|
@@ -106,59 +108,4 @@ jQuery(document).ready(function($) {
|
|
106 |
});
|
107 |
|
108 |
|
109 |
-
var aboveCustom = $('#above_custom_button');
|
110 |
-
var aboveCustomShow = function(){
|
111 |
-
if ( aboveCustom.attr('checked') != 'undefined' && aboveCustom.attr('checked') == true)
|
112 |
-
{
|
113 |
-
$('.above_option_custom').removeClass('hidden');
|
114 |
-
}
|
115 |
-
else
|
116 |
-
{
|
117 |
-
$('.above_option_custom').addClass('hidden');
|
118 |
-
}
|
119 |
-
};
|
120 |
-
var aboveCustomString = $('#above_custom_string');
|
121 |
-
var aboveCustomStringShow = function(){
|
122 |
-
if (aboveCustomString.attr('checked') != 'undefined' && aboveCustomString.attr('checked') == true)
|
123 |
-
{
|
124 |
-
$('#above_custom_string_input').removeClass('hidden');
|
125 |
-
}
|
126 |
-
else
|
127 |
-
{
|
128 |
-
$('#above_custom_string_input').addClass('hidden');
|
129 |
-
}
|
130 |
-
|
131 |
-
};
|
132 |
-
var belowCustom = $('#below_custom_button');
|
133 |
-
var belowCustomShow = function(){
|
134 |
-
if ( belowCustom.attr('checked') != 'undefined' && belowCustom.attr('checked') == true)
|
135 |
-
{
|
136 |
-
$('.below_option_custom').removeClass('hidden');
|
137 |
-
}
|
138 |
-
else
|
139 |
-
{
|
140 |
-
$('.below_option_custom').addClass('hidden');
|
141 |
-
}
|
142 |
-
};
|
143 |
-
var belowCustomString = $('#below_custom_string');
|
144 |
-
var belowCustomStringShow = function(){
|
145 |
-
if (belowCustomString.attr('checked') != 'undefined' && belowCustomString.attr('checked') == true)
|
146 |
-
{
|
147 |
-
$('#below_custom_string_input').removeClass('hidden');
|
148 |
-
}
|
149 |
-
else
|
150 |
-
{
|
151 |
-
$('#below_custom_string_input').addClass('hidden');
|
152 |
-
}
|
153 |
-
|
154 |
-
};
|
155 |
-
|
156 |
-
aboveCustomShow();
|
157 |
-
aboveCustomStringShow();
|
158 |
-
belowCustomShow();
|
159 |
-
belowCustomStringShow();
|
160 |
-
|
161 |
-
$('input[name="addthis_settings[above]"]').change( function(){aboveCustomShow(); aboveCustomStringShow(); } );
|
162 |
-
$('input[name="addthis_settings[below]"]').change( function(){belowCustomShow(); belowCustomStringShow(); } );
|
163 |
-
|
164 |
});
|
41 |
action: 'at_save_transient',
|
42 |
value : stuff
|
43 |
};
|
44 |
+
|
45 |
|
46 |
jQuery.post(ajaxurl, data, function(response) {
|
47 |
+
|
48 |
// Fix for WP 2.9's version of lightbox
|
49 |
if ( typeof tb_click != 'undefined' && $.isFunction(tb_click.call))
|
50 |
{
|
77 |
});
|
78 |
|
79 |
$('#above_more').click( function() {
|
80 |
+
$('#above .hidden').removeClass('hidden');
|
81 |
$(this).hide();
|
82 |
return false;
|
83 |
});
|
84 |
$('#below_more').click( function() {
|
85 |
+
$('#below .hidden').removeClass('hidden');
|
86 |
$(this).hide();
|
87 |
return false;
|
88 |
});
|
108 |
});
|
109 |
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
});
|
readme.txt
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
=== AddThis ===
|
2 |
Contributors: _mjk_, jorbin
|
3 |
-
Tags: share, addthis, social, bookmark, sharing, bookmarking, widget
|
4 |
Requires at least: 2.9
|
5 |
-
Tested up to: 3.1.
|
6 |
-
Stable tag: 2.
|
7 |
|
8 |
The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with many popular services.
|
9 |
|
10 |
== Description ==
|
11 |
-
Get more traffic back to your site by installing the AddThis WordPress plugin. With AddThis, your users can promote your content by sharing to 295 of the most popular social networking and bookmarking sites (like Facebook, Twitter, Digg, StumbleUpon and MySpace). Our button is small, unobtrusive, quick to load and recognized all over the web.
|
12 |
|
13 |
Optionally, sign up for a free AddThis.com account to see how your visitors are sharing your content: which services they're using for sharing, which content is shared the most, and more.
|
14 |
|
@@ -16,7 +16,6 @@ Optionally, sign up for a free AddThis.com account to see how your visitors are
|
|
16 |
|
17 |
== Installation ==
|
18 |
|
19 |
-
|
20 |
For an automatic installation through WordPress:
|
21 |
|
22 |
1. Go to the 'Add New' plugins screen in your WordPress admin area
|
@@ -32,13 +31,12 @@ To upload the plugin through WordPress, instead of FTP:
|
|
32 |
|
33 |
1. Upload the downloaded zip file on the 'Add New' plugins screen (see the 'Upload' tab) in your WordPress admin area and activate.
|
34 |
|
35 |
-
Note: due to confusion, there are no longer separate versions for PHP4 and PHP5.
|
36 |
|
37 |
== Frequently Asked Questions ==
|
38 |
|
39 |
= Is AddThis free? =
|
40 |
|
41 |
-
Yep! The features you see today on AddThis will always be free.
|
42 |
|
43 |
= Do I need to create an account? =
|
44 |
|
@@ -60,7 +58,10 @@ All of the options required through this plugin require javascript. JavaScript
|
|
60 |
Over 1,200,000 sites have installed AddThis. With over a billion unique users, AddThis is helping share content all over the world, in more than sixty languages. You might be surprised who's sharing their website using AddThis--<a href="http://www.addthis.com/features#partners">here are just a few</a>.
|
61 |
|
62 |
= What services does AddThis support? =
|
63 |
-
We currently support over
|
|
|
|
|
|
|
64 |
|
65 |
== Screenshots ==
|
66 |
|
@@ -73,6 +74,52 @@ We currently support over 295 services, from email and blogging platforms to soc
|
|
73 |
PHP 5+ is preferred; PHP 4 is supported.
|
74 |
|
75 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
= 2.0.0 =
|
77 |
* Redesigned Settings page
|
78 |
* Added Share Counter option
|
@@ -116,6 +163,26 @@ Fixed nondeterministic bug with the_title(), causing the title to occasionally a
|
|
116 |
|
117 |
|
118 |
== Upgrade Notice ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
= 2.0.0 =
|
121 |
More and better options for sharing widgets. Redesigned analytics dashboard widget and interface.
|
1 |
+
=== AddThis featuring Sharing Buttons / Facebook Like / Tweet Button ===
|
2 |
Contributors: _mjk_, jorbin
|
3 |
+
Tags: share, addthis, social, bookmark, sharing, bookmarking, widget,AddThis, addtoany, aim, bookmark, buzz, del.icio.us, Digg,e-mail, email, Facebook, google bookmarks, google buzz, myspace,network, NewsVine, Reddit, Share, share this, sharethis, social, socialize, stumbleupon, twitter, windows live, yahoo buzz
|
4 |
Requires at least: 2.9
|
5 |
+
Tested up to: 3.1.3
|
6 |
+
Stable tag: 2.2.0
|
7 |
|
8 |
The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with many popular services.
|
9 |
|
10 |
== Description ==
|
11 |
+
Get more traffic back to your site by installing the AddThis WordPress plugin. With AddThis, your users can promote your content by sharing to 295 of the most popular social networking and bookmarking sites (like Facebook, Twitter, Digg, StumbleUpon and MySpace). Our button is small, unobtrusive, quick to load and recognized all over the web. We also optionaly support address bar sharing in modern browsers.
|
12 |
|
13 |
Optionally, sign up for a free AddThis.com account to see how your visitors are sharing your content: which services they're using for sharing, which content is shared the most, and more.
|
14 |
|
16 |
|
17 |
== Installation ==
|
18 |
|
|
|
19 |
For an automatic installation through WordPress:
|
20 |
|
21 |
1. Go to the 'Add New' plugins screen in your WordPress admin area
|
31 |
|
32 |
1. Upload the downloaded zip file on the 'Add New' plugins screen (see the 'Upload' tab) in your WordPress admin area and activate.
|
33 |
|
|
|
34 |
|
35 |
== Frequently Asked Questions ==
|
36 |
|
37 |
= Is AddThis free? =
|
38 |
|
39 |
+
Yep! The features you see today on AddThis will always be free.
|
40 |
|
41 |
= Do I need to create an account? =
|
42 |
|
58 |
Over 1,200,000 sites have installed AddThis. With over a billion unique users, AddThis is helping share content all over the world, in more than sixty languages. You might be surprised who's sharing their website using AddThis--<a href="http://www.addthis.com/features#partners">here are just a few</a>.
|
59 |
|
60 |
= What services does AddThis support? =
|
61 |
+
We currently support over 300 services, from email and blogging platforms to social networks and news aggregators, and we add new services every month. Want to know if your favorite service is supported? This list is accurate up to the minute: <a href="http://www.addthis.com/services">http://www.addthis.com/services</a>.
|
62 |
+
|
63 |
+
= How do I remove AddThis from a page =
|
64 |
+
In the screen options you can enable the AddThis meta box. Check the box and save if you've already published that page or post to disable AddThis on that page or post.
|
65 |
|
66 |
== Screenshots ==
|
67 |
|
74 |
PHP 5+ is preferred; PHP 4 is supported.
|
75 |
|
76 |
== Changelog ==
|
77 |
+
= 2.2.0 =
|
78 |
+
* More Customization Option
|
79 |
+
* optionally shorten urls with one bit.ly account
|
80 |
+
|
81 |
+
= 2.1.1 =
|
82 |
+
* Add +1
|
83 |
+
|
84 |
+
= 2.1.0 =
|
85 |
+
* Add Twitter Template Option
|
86 |
+
* Add Post Meta Box
|
87 |
+
* Add top shared/clicked URLS to dashboard
|
88 |
+
* More Filters
|
89 |
+
|
90 |
+
= 2.0.6 =
|
91 |
+
* define ADDTHIS_NO_NOTICES to prevent admin notices from displaying
|
92 |
+
|
93 |
+
= 2.0.5 =
|
94 |
+
* force service codes to be lowercase
|
95 |
+
* If opting out of clickback tracking, set config to force opting out
|
96 |
+
|
97 |
+
= 2.0.4 =
|
98 |
+
* Fix conflict with other plugins
|
99 |
+
* Prevent button js from appearing in feeds
|
100 |
+
|
101 |
+
= 2.0.3 =
|
102 |
+
* plugin should still work if theme doesn't have wp_head and wp_footer
|
103 |
+
|
104 |
+
= 2.0.2 =
|
105 |
+
* Bug Fixes
|
106 |
+
* set addthis_exclude custom field to 'true' to not display addthis on that post / page
|
107 |
+
* Added additional paramater to
|
108 |
+
* Ability to specify custom toolboxes for both above and below
|
109 |
+
* Added additional paramater to do_action('addthis_widget'). Paramaters are now:
|
110 |
+
* * url (use get_permalink() if you are calling it inside the loop)
|
111 |
+
* * title (use the_title() if calling inside the loop)
|
112 |
+
* * Style (specify the style to display) See $addthis_new_styles for the styles. may also pass an arra (see addthis_custom_toolbox for array values to pass)
|
113 |
+
|
114 |
+
|
115 |
+
|
116 |
+
= 2.0.1 =
|
117 |
+
* Fix theme compatablity issues
|
118 |
+
* Fix excerpts bug
|
119 |
+
* Add option to not display on excerpts
|
120 |
+
* Restore option to customize services
|
121 |
+
* Add more filters
|
122 |
+
|
123 |
= 2.0.0 =
|
124 |
* Redesigned Settings page
|
125 |
* Added Share Counter option
|
163 |
|
164 |
|
165 |
== Upgrade Notice ==
|
166 |
+
= 2.2.0 =
|
167 |
+
More Customization options
|
168 |
+
|
169 |
+
= 2.1.0 =
|
170 |
+
More Features, More Filters, More Social Goodness
|
171 |
+
|
172 |
+
= 2.0.5 =
|
173 |
+
Force service codes to be lowercase and If opting out of clickback tracking, set config to force opting out
|
174 |
+
|
175 |
+
= 2.0.4 =
|
176 |
+
Fix conflict with other plugins and other bug fixes
|
177 |
+
|
178 |
+
= 2.0.3 =
|
179 |
+
Still work in themes that don't have wp_head and wp_footer
|
180 |
+
|
181 |
+
= 2.0.2 =
|
182 |
+
Bug Fixes, enhanced customization
|
183 |
+
|
184 |
+
= 2.0.1 =
|
185 |
+
Bug Fixes, more filters, small tweak to options
|
186 |
|
187 |
= 2.0.0 =
|
188 |
More and better options for sharing widgets. Redesigned analytics dashboard widget and interface.
|