WordPress Share Buttons Plugin – AddThis - Version 2.0.1

Version Description

  • Fix theme compatablity issues
  • Fix excerpts bug
  • Add option to not display on excerpts
  • Restore option to customize services
  • Add more filters
Download this release

Release Info

Developer jorbin
Plugin Icon 128x128 WordPress Share Buttons Plugin – AddThis
Version 2.0.1
Comparing to
See all releases

Code changes from version 1.6.8 to 2.0.1

addthis_sidebar_widget.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Add this Widget that allows you to pick your poison, add a widget title, and share your content
4
+ */
5
+
6
+
7
+ class AddThisSidebarWidget extends WP_Widget {
8
+
9
+
10
+ /**
11
+ * Constructor
12
+ */
13
+ function AddThisSidebarWidget()
14
+ {
15
+
16
+ $widget_ops = array( 'classname' => 'atwidget', 'description' => 'Make it wasy for your users to share content to over 300 destinations' );
17
+
18
+ /* Widget control settings. */
19
+ $control_ops = array( 'width' => 325);
20
+
21
+ /* Create the widget. */
22
+ $this->WP_Widget( 'addthis-widget', 'AddThis Widget', $widget_ops, $control_ops );
23
+
24
+ }
25
+
26
+ /**
27
+ * Echo's out the content of our widget
28
+ */
29
+ function widget($args, $instance)
30
+ {
31
+ extract ( $args );
32
+ global $addthis_new_styles;
33
+
34
+
35
+ $title = apply_filters('widget_title', $instance['title']);
36
+
37
+ echo $before_widget;
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
+ }
46
+
47
+ /**
48
+ * Update this instance
49
+ */
50
+ function update($new_instance, $old_instance)
51
+ {
52
+ global $addthis_new_styles;
53
+
54
+ $instance = $old_instance;
55
+ $instance['title'] = strip_tags($new_instance['title']);
56
+
57
+ if (isset($addthis_new_styles[ $new_instance['style'] ] ) )
58
+ $instance['style'] = strip_tags($new_instance['style']);
59
+
60
+
61
+
62
+
63
+ return $instance;
64
+
65
+ }
66
+
67
+ /**
68
+ * The form with the widget options
69
+ */
70
+ function form($instance)
71
+ {
72
+ if (empty($instance))
73
+ {
74
+ $instance = array('style'=> '' , 'title' => '');
75
+ }
76
+
77
+ $style = (empty( $instance['style'] ) ) ? addthis_style_default : esc_attr($instance['style']);
78
+ $title = (empty( $instance['title'] ) ) ? '' : esc_attr($instance['title']);
79
+
80
+
81
+ global $addthis_new_styles;
82
+
83
+ ?>
84
+ <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
85
+
86
+ <p><label for="<?php echo $this->get_field_id('style');?>"><?php _e('Style:', 'addthis'); ?><br /></label></p>
87
+ <?php foreach ($addthis_new_styles as $k => $v)
88
+ {
89
+
90
+ $checked = '';
91
+ if ($k === $style)
92
+ $checked = 'checked="checked"';
93
+
94
+ echo '<input '.$checked.' style="margin:-15px 2px 0;" type="radio" name="' . $this->get_field_name('style') . '" value="'.$k.'"><img src="'. plugins_url( '/addthis/img/' . $v['img'], basename(dirname(__FILE__)) ) .'" /><br />';
95
+ }
96
+ ?>
97
+ <?php
98
+ }
99
+
100
+ }
101
+
102
+
103
+
104
+
addthis_social_widget.php CHANGED
@@ -27,10 +27,10 @@ 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: 1.6.8
31
  *
32
  * Author: The AddThis Team
33
- * Author URI: http://www.addthis.com
34
  */
35
 
36
  $addthis_settings = array();
@@ -56,16 +56,124 @@ $addthis_styles = array(
56
  /* Add your own style here, like this:
57
  , 'custom' => array('img'=>'http://example.com/button.gif', 'w'=>16, 'h'=>16) */
58
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
- // Pre-2.6 compatibility
61
- if ( ! defined( 'WP_CONTENT_URL' ) )
62
- define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' );
63
- if ( ! defined( 'WP_CONTENT_DIR' ) )
64
- define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
65
- if ( ! defined( 'WP_PLUGIN_URL' ) )
66
- define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' );
67
- if ( ! defined( 'WP_PLUGIN_DIR' ) )
68
- define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
69
 
70
  /**
71
  * Generates unique IDs
@@ -78,6 +186,8 @@ function cuid()
78
  return $cuid;
79
  }
80
 
 
 
81
  /**
82
  * Returns major.minor WordPress version.
83
  */
@@ -106,6 +216,61 @@ function addthis_print_script() {
106
  wp_enqueue_script( 'addthis' );
107
  }
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  /**
110
  * Our admin dashboard widget shows yesterday's top shared content and top shared-to services.
111
  * Data is fetched via AJAX. We assume jQuery is available on any WP install supporting
@@ -115,79 +280,380 @@ function addthis_print_script() {
115
  * @see js/addthis.css
116
  */
117
  function addthis_render_dashboard_widget() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  global $addthis_settings;
119
- $username = urlencode($addthis_settings['username']);
120
- $password = urlencode($addthis_settings['password']);
121
-
122
- echo <<<ENDHTML
123
- <p id="addthis_header" class="sub">Loading...</p>
124
- <div id="addthis_data_container">
125
- <div class="sub">
126
- <table id="addthis_tab_table" style="display:none">
127
- <colgroup><col width="25%"/><col width="25%"/><col width="50%"/></colgroup>
128
- <tr>
129
- <td><a id="addthis_posts_tab" class="addthis-tab atb-active" href="#" onclick="return addthis_toggle_tabs(false)">Top Content</a></td>
130
- <td><a id="addthis_services_tab" class="addthis-tab" href="#" onclick="return addthis_toggle_tabs(true)">Top Services</a></td>
131
- <td style="text-align:right;"><a href="http://addthis.com/myaccount">View all stats &raquo;</a></td>
132
- </tr>
133
- </table>
134
- </div>
135
-
136
- <div class="table">
137
- <table id="addthis_data_posts_table" style="display:none">
138
- <colgroup><col width="90%"/><col width="10%"/></colgroup>
139
- <tbody id="addthis_data_posts">
140
- </tbody>
141
- </table>
142
- <table id="addthis_data_services_table" style="display:none">
143
- <colgroup><col width="40%"/><col width="10%"/><col width="40%"/><col width="10%"/></colgroup>
144
- <tbody id="addthis_data_services">
145
- </tbody>
146
- </table>
147
- </div>
148
- </div>
149
-
150
- <script type="text/javascript">
151
- jQuery(document).ready(function(jQuery) {
152
- addthis_populate_posts_table("{$username}","{$password}", 5 /* max rows to show in table */, '#addthis_data_posts', '#addthis_header');
153
- addthis_populate_services_table("{$username}","{$password}", 10 /* max rows to show in table */, '#addthis_data_services', '#addthis_header');
154
- });
155
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  ENDHTML;
 
 
 
 
 
157
  }
158
 
159
  /**
160
  * Initialize the dashboard widget.
161
  */
162
  function addthis_dashboard_init() {
163
- wp_add_dashboard_widget('dashboard_addthis', 'AddThis', 'addthis_render_dashboard_widget');
 
 
164
  }
165
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  /**
167
  * Formally registers AddThis settings. Only called in WP 2.7+.
168
  */
169
  function register_addthis_settings() {
170
- register_setting('addthis', 'addthis_username');
171
- register_setting('addthis', 'addthis_fallback_username');
172
- register_setting('addthis', 'addthis_password');
173
- register_setting('addthis', 'addthis_append_data');
174
- register_setting('addthis', 'addthis_show_stats');
175
- register_setting('addthis', 'addthis_style');
176
- register_setting('addthis', 'addthis_sidebar_only');
177
- register_setting('addthis', 'addthis_isdropdown');
178
- register_setting('addthis', 'addthis_menu_type');
179
- register_setting('addthis', 'addthis_showonpages');
180
- register_setting('addthis', 'addthis_showoncats');
181
- register_setting('addthis', 'addthis_showonhome');
182
- register_setting('addthis', 'addthis_showonposts');
183
- register_setting('addthis', 'addthis_showonarchives');
184
- register_setting('addthis', 'addthis_language');
185
- register_setting('addthis', 'addthis_brand');
186
- register_setting('addthis', 'addthis_options');
187
- register_setting('addthis', 'addthis_header_background');
188
- register_setting('addthis', 'addthis_header_color');
189
  }
190
 
 
191
  /**
192
  * Adds WP filter so we can append the AddThis button to post content.
193
  */
@@ -195,52 +661,31 @@ function addthis_init()
195
  {
196
  global $addthis_settings;
197
 
 
 
198
  if (addthis_get_wp_version() >= 2.7) {
199
  if ( is_admin() ) {
200
  add_action( 'admin_init', 'register_addthis_settings' );
201
  }
202
  }
203
 
 
 
204
  if (function_exists('wp_register_style')) {
205
  wp_register_style( 'addthis', WP_PLUGIN_URL . '/addthis/css/addthis.css');
206
- wp_register_script( 'addthis', WP_PLUGIN_URL . '/addthis/js/addthis.js');
207
 
208
- add_action('admin_print_styles', 'addthis_print_style');
209
- add_action('admin_print_scripts', 'addthis_print_script');
210
  }
211
 
212
  add_filter('admin_menu', 'addthis_admin_menu');
213
 
214
- add_option('addthis_username');
215
- add_option('addthis_show_stats', 'false');
216
- add_option('addthis_password');
217
- add_option('addthis_fallback_username', 'wp-'.cuid());
218
- add_option('addthis_options'); // no default value, so that we can update as times change
219
- add_option('addthis_product', 'menu');
220
- add_option('addthis_isdropdown', 'true');
221
- add_option('addthis_menu_type', (get_option('addthis_isdropdown') !== 'true' ? 'static' : 'dropdown'));
222
- add_option('addthis_append_data', 'false');
223
- add_option('addthis_showonhome', 'true');
224
- add_option('addthis_showonposts', 'true');
225
- add_option('addthis_showonpages', 'false');
226
- add_option('addthis_showoncats', 'false');
227
- add_option('addthis_showonarchives', 'false');
228
- add_option('addthis_style');
229
- add_option('addthis_header_background');
230
- add_option('addthis_header_color');
231
- add_option('addthis_sidebar_only', 'false');
232
- add_option('addthis_brand');
233
- add_option('addthis_language', '');
234
-
235
- $addthis_settings['sidebar_only'] = get_option('addthis_sidebar_only') === 'true';
236
- $addthis_settings['showstats'] = get_option('addthis_show_stats') === 'true';
237
- $addthis_settings['showonhome'] = !(get_option('addthis_showonhome') !== 'true');
238
- $addthis_settings['showonposts'] = !(get_option('addthis_showonposts') !== 'true');
239
- $addthis_settings['showonpages'] = get_option('addthis_showonpages') === 'true';
240
- $addthis_settings['showonarchives'] = get_option('addthis_showonarchives') === 'true';
241
- $addthis_settings['showoncats'] = get_option('addthis_showoncats') === 'true';
242
-
243
- if ($addthis_settings['showonposts']) add_filter('the_content', 'addthis_social_widget'); // true by default
244
  add_action( 'addthis_widget', 'addthis_print_widget', 10, 2);
245
 
246
  $product = get_option('addthis_product');
@@ -270,20 +715,16 @@ function addthis_init()
270
  }
271
  $addthis_settings['options'] = get_option('addthis_options');
272
 
273
- add_action('widgets_init', 'addthis_widget_init');
274
-
275
- if (addthis_get_wp_version() >= 2.7 && $addthis_settings['showstats']) {
276
- add_action('wp_dashboard_setup', 'addthis_dashboard_init' );
277
- }
278
  }
279
 
 
 
 
 
280
  function addthis_widget_init()
281
  {
282
- if ( function_exists('wp_register_sidebar_widget') ) {
283
- wp_register_sidebar_widget('addthis-widget', 'AddThis Widget', 'addthis_sidebar_widget');
284
- } else if ( function_exists('register_sidebar_widget') ) {
285
- register_sidebar_widget('AddThis Widget', 'addthis_sidebar_widget');
286
- }
287
  }
288
 
289
  function addthis_sidebar_widget($args)
@@ -294,6 +735,248 @@ function addthis_sidebar_widget($args)
294
  echo $after_widget;
295
  }
296
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297
  /**
298
  * Appends AddThis button to post content.
299
  */
@@ -315,7 +998,7 @@ function addthis_social_widget($content, $onSidebar = false, $url = null, $title
315
 
316
  $pub = ($addthis_settings['username']);
317
  if (!$pub) {
318
- $pub = ($addthis_settings['fallback_username']);
319
  }
320
  $pub = urlencode($pub);
321
 
@@ -328,6 +1011,7 @@ function addthis_social_widget($content, $onSidebar = false, $url = null, $title
328
  ."\n//<!--\n"
329
  ."var addthis_product = 'wpp-250';\n";
330
 
 
331
  if (strlen($addthis_settings['customization']))
332
  {
333
  $content .= ($addthis_settings['customization']) . "\n";
@@ -378,13 +1062,19 @@ EOF;
378
  /**
379
  * Generates img tag for share/bookmark button.
380
  */
381
- function addthis_get_button_img()
382
  {
383
  global $addthis_settings;
384
  global $addthis_styles;
385
- $language = $addthis_settings['language'];
 
 
 
 
 
386
 
387
- $btnStyle = $addthis_settings['style'];
 
388
  if ($addthis_settings['language'] != 'en')
389
  {
390
  // We use a translation of the word 'share' for all verbal buttons
@@ -412,22 +1102,63 @@ function addthis_get_button_img()
412
  EOF;
413
  }
414
 
 
 
 
 
 
 
 
 
 
 
 
415
  function addthis_admin_menu()
416
  {
417
- add_options_page('AddThis Plugin Options', 'AddThis', 8, __FILE__, 'addthis_plugin_options_php4');
 
 
418
  }
419
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
420
  function addthis_plugin_options_php4() {
421
  global $addthis_styles;
422
  global $addthis_languages;
423
  global $addthis_settings;
424
  global $addthis_menu_types;
 
 
425
 
 
 
 
 
 
426
  ?>
427
  <div class="wrap">
428
- <h2>AddThis</h2>
429
-
430
- <form method="post" action="options.php">
431
  <?php
432
  // use the old-school settings style in older versions of wordpress
433
  if (addthis_get_wp_version() < 2.7) {
@@ -435,91 +1166,108 @@ function addthis_plugin_options_php4() {
435
  } else {
436
  settings_fields('addthis');
437
  }
 
 
 
 
 
 
 
 
 
 
 
438
  ?>
439
 
440
- <h3>Required</h3>
 
 
 
 
 
 
 
441
  <table class="form-table">
442
- <tr valign="top">
443
- <th scope="row"><?php _e("AddThis username:", 'addthis_trans_domain' ); ?></th>
444
- <td><input type="text" name="addthis_username" value="<?php echo get_option('addthis_username'); ?>" /></td>
445
- </tr>
446
  <tr>
447
- <th scope="row"><?php _e("Menu type:", 'addthis_trans_domain' ); ?></th>
448
- <td>
449
- <select name="addthis_menu_type" onchange="document.getElementById('at_buttonstyle').style.display = (this.value !== 'toolbox');">
450
- <?php
451
- $curmenutype = get_option('addthis_menu_type');
452
- foreach ($addthis_menu_types as $type)
453
- {
454
- echo "<option value=\"$type\"". ($type == $curmenutype ? " selected":""). ">$type</option>";
 
455
  }
 
 
456
  ?>
457
- </select>
458
- </tr>
459
- <tr valign="top" id="at_buttonstyle" style="display:<?php echo ($curmenutype != 'toolbox') ? 'block' : 'none'; ?> ?>">
460
- <th scope="row"><?php _e("Button style:", 'addthis_trans_domain' ); ?></th>
461
- <td>
462
- <select name="addthis_style">
463
- <?php
464
- $curstyle = get_option('addthis_style');
465
- foreach ($addthis_styles as $style => $info)
466
- {
467
- echo "<option value=\"$style\"". ($style == $curstyle ? " selected":""). ">$style</option>";
468
- }
469
- ?>
470
- </select>
471
  </td>
472
  </tr>
473
  <tr>
474
- <th scope="row"><?php _e("Show in sidebar only:", 'addthis_trans_domain' ); ?><br/><span style="font-size:10px">(sidebar widget must be enabled)</span></th>
475
- <td><input type="checkbox" name="addthis_sidebar_only" value="true" <?php echo (get_option('addthis_sidebar_only') == 'true' ? 'checked' : ''); ?>/></td>
476
- </tr>
477
- </table>
478
-
479
- <br />
480
- <br />
481
- <br />
482
-
483
- <h3>Advanced</h3>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
484
  <table class="form-table">
485
- <?php
486
- // We can only support the dashboard widget for WordPress 2.7+
487
- if (addthis_get_wp_version() >= 2.7) {
488
- ?>
489
  <tr>
490
  <th scope="row"><?php _e("Show stats in admin dashboard:", 'addthis_trans_domain' ); ?></th>
491
- <td><input type="checkbox" name="addthis_show_stats" value="true" onchange="document.getElementById('password_row').style.display = (this.checked ? '' : 'none');" <?php echo (get_option('addthis_show_stats') !== '' ? 'checked' : ''); ?>/></td>
492
- </tr>
493
- <tr id="password_row" style="<?php echo (get_option('addthis_show_stats') !== '' ? '' : 'display:none'); ?>">
494
- <th scope="row"><?php _e("AddThis password:", 'addthis_trans_domain' ); ?><br/><span style="font-size:10px">(required for displaying stats)</span></th>
495
- <td><input type="password" name="addthis_password" value="<?php echo get_option('addthis_password'); ?>"/></td>
496
  </tr>
497
- <?php
498
- }
499
- ?>
500
  <tr>
501
  <th scope="row"><?php _e("Track <a href=\"http://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>
502
- <td><input type="checkbox" name="addthis_append_data" value="true" <?php echo (get_option('addthis_append_data') == 'true' ? 'checked' : ''); ?>/></td>
503
  </tr>
504
  <tr>
505
  <th scope="row"><?php _e("Show on homepage:", 'addthis_trans_domain' ); ?></th>
506
- <td><input type="checkbox" name="addthis_showonhome" value="true" <?php echo (get_option('addthis_showonhome') == 'true' ? 'checked' : ''); ?>/></td>
507
  </tr>
508
  <tr>
509
  <th scope="row"><?php _e("Show on <a href=\"http://codex.wordpress.org/Pages\" target=\"blank\">pages</a>:", 'addthis_trans_domain' ); ?></th>
510
- <td><input type="checkbox" name="addthis_showonpages" value="true" <?php echo (get_option('addthis_showonpages') !== '' ? 'checked' : ''); ?>/></td>
511
  </tr>
512
  <tr>
513
  <th scope="row"><?php _e("Show in archives:", 'addthis_trans_domain' ); ?></th>
514
- <td><input type="checkbox" name="addthis_showonarchives" value="true" <?php echo (get_option('addthis_showonarchives') == 'true' ? 'checked' : ''); ?>/></td>
515
  </tr>
516
  <tr>
517
  <th scope="row"><?php _e("Show in categories:", 'addthis_trans_domain' ); ?></th>
518
- <td><input type="checkbox" name="addthis_showoncats" value="true" <?php echo (get_option('addthis_showoncats') == 'true' ? 'checked' : ''); ?>/></td>
519
  </tr>
520
  <tr>
521
- <th scope="row"><?php _e("Show at end of posts:", 'addthis_trans_domain' ); ?><br/><span style="font-size:10px">(insert <code>&lt;?php do_action( 'addthis_widget' ); ?&gt;</code> into your template to place it dynamically)</th>
522
- <td><input type="checkbox" name="addthis_showonposts" value="true" <?php echo (get_option('addthis_showonposts') == 'true' ? 'checked' : ''); ?>/></td>
523
  </tr>
524
  <tr valign="top">
525
  <td colspan="2"></td>
@@ -528,22 +1276,28 @@ function addthis_plugin_options_php4() {
528
  <td colspan="2">For more details on the following options, see <a href="http://addthis.com/customization">our customization docs</a>.</td>
529
  </tr>
530
  <tr valign="top">
531
- <th scope="row"><?php _e("Brand:", 'addthis_trans_domain' ); ?></th>
532
- <td><input type="text" name="addthis_brand" value="<?php echo get_option('addthis_brand'); ?>" /></td>
 
 
 
 
 
 
533
  </tr>
534
  <tr valign="top">
535
- <th scope="row"><?php _e("Dropdown/Toolbox Services:", 'addthis_trans_domain'); ?> <br/> <span style="font-size:10px">(comma-separated <a href="http://addthis.com/services">service codes</a>)</span></th>
536
- <td><input type="text" name="addthis_options" value="<?php echo get_option('addthis_options'); ?>" size="80"/></td>
537
  </tr>
538
  <tr valign="top">
539
  <th scope="row"><?php _e("Language:", 'addthis_trans_domain' ); ?></th>
540
  <td>
541
- <select name="addthis_language">
542
  <?php
543
- $curlng = get_option('addthis_language');
544
  foreach ($addthis_languages as $lng=>$name)
545
  {
546
- echo "<option value=\"$lng\"". ($lng == $curlng ? " selected":""). ">$name</option>";
547
  }
548
  ?>
549
  </select>
@@ -551,24 +1305,30 @@ function addthis_plugin_options_php4() {
551
  </tr>
552
  <tr valign="top">
553
  <th scope="row"><?php _e("Header background:", 'addthis_trans_domain' ); ?></th>
554
- <td><input type="text" name="addthis_header_background" value="<?php echo get_option('addthis_header_background'); ?>" /></td>
555
  </tr>
556
  <tr valign="top">
557
  <th scope="row"><?php _e("Header color:", 'addthis_trans_domain' ); ?></th>
558
- <td><input type="text" name="addthis_header_color" value="<?php echo get_option('addthis_header_color'); ?>" /></td>
559
  </tr>
560
  </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
561
 
562
- <?php
563
- // use the old-school settings style in older versions of wordpress
564
- if (addthis_get_wp_version() < 2.7) {
565
- ?>
566
- <input type="hidden" name="action" value="update" />
567
- <input type="hidden" name="page_options" value="addthis_username,addthis_password,addthis_show_stats,addthis_style,addthis_sidebar_only,addthis_menu_type,addthis_showonpages,addthis_showoncats,addthis_showonhome,addthis_append_data,addthis_showonposts,addthis_showonarchives,addthis_language,addthis_brand,addthis_options,addthis_header_background,addthis_header_color"/>
568
- <?php
569
- }
570
  ?>
571
- <p class="submit">
572
  <input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" />
573
  </p>
574
 
@@ -576,6 +1336,45 @@ function addthis_plugin_options_php4() {
576
  </div>
577
  <?php
578
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
579
 
580
- addthis_init();
581
  ?>
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.0.1
31
  *
32
  * Author: The AddThis Team
33
+ * Author URI: http://www.addthis.com/blog
34
  */
35
 
36
  $addthis_settings = array();
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="http://addthis.com/bookmark.php?v=250&amp;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="http://addthis.com/bookmark.php?v=250&amp;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' => '<a class="addthis_button" href="http://addthis.com/bookmark.php?v=250&amp;username=xa-4d2b4cee71601c7c" %s><img src="http://cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a>', '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
+
80
+ define( 'addthis_style_default' , 'small_toolbox_with_share');
81
+ define( 'ADDTHIS_PLUGIN_VERSION', '2.0.1');
82
+ /**
83
+ * Converts our old many options in to one beautiful array
84
+ *
85
+ */
86
+ function addthis_options_200()
87
+ {
88
+
89
+ global $current_user;
90
+ $user_id = $current_user->ID;
91
+ $addthis_new_options = array();
92
+ if ($username = get_option('addthis_username'))
93
+ $addthis_new_options['username'] = $username;
94
+
95
+ if ($password = get_option('addthis_password'))
96
+ $addthis_new_options['password'] = $password;
97
+
98
+ if ($show_stats = get_option('addthis_show_stats'))
99
+ $addthis_new_options['addthis_show_stats'] = $show_stats;
100
+
101
+ if ($append_data = get_option('addthis_append_data'))
102
+ $addthis_new_options['addthis_append_data'] = $append_data;
103
+
104
+ if ($showonhome = get_option('addthis_showonhome'))
105
+ $addthis_new_options['addthis_showonhome'] = $showonhome;
106
+
107
+ if ($showonpages = get_option('addthis_showonpages'))
108
+ $addthis_new_options['addthis_showonpages'] = $showonpages;
109
+
110
+ if ($showoncats = get_option('addthis_showoncats'))
111
+ $addthis_new_options['addthis_showoncats'] = $showoncats;
112
+
113
+ if ($showonarchives = get_option('addthis_showonarchives'))
114
+ $addthis_new_options['addthis_showonarchives'] = $showonarchives;
115
+
116
+ if (get_option('addthis_showonposts') != true)
117
+ $addthis_new_options['below'] = 'none';
118
+ elseif (get_option('addthis_sidebar_only') == true)
119
+ $addthis_new_options['below'] = 'none';
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
+ $addthis_new_options['below'] = 'button';
126
+ }
127
+ if ($header_background = get_option('addthis_header_background'))
128
+ $addthis_new_options['addthis_header_background'] = $header_background;
129
+ if ($header_color = get_option('addthis_header_color'))
130
+ $addthis_new_options['addthis_header_color'] = $header_color;
131
+ if ($brand = get_option('addthis_brand'))
132
+ $addthis_new_options['addthis_brand'] = $brand;
133
+ if ($language = get_option('addthis_language'))
134
+ $addthis_new_options['addthis_language'] = $language;
135
+
136
+
137
+ // Above is new, set it to none
138
+ $addthis_new_options['above'] = 'none';
139
+
140
+ // Save option
141
+ add_option('addthis_settings', $addthis_new_options);
142
+
143
+ // if the option saved, delete the old options
144
+
145
+ delete_option('addthis_show_stats');
146
+ delete_option('addthis_password');
147
+ delete_option('addthis_fallback_username');
148
+ delete_option('addthis_options');
149
+ delete_option('addthis_product');
150
+ delete_option('addthis_isdropdown');
151
+ delete_option('addthis_menu_type');
152
+ delete_option('addthis_append_data');
153
+ delete_option('addthis_showonhome');
154
+ delete_option('addthis_showonposts');
155
+ delete_option('addthis_showonpages');
156
+ delete_option('addthis_showoncats');
157
+ delete_option('addthis_showonarchives');
158
+ delete_option('addthis_style');
159
+ delete_option('addthis_header_background');
160
+ delete_option('addthis_header_color');
161
+ delete_option('addthis_sidebar_only');
162
+ delete_option('addthis_brand');
163
+ delete_option('addthis_language');;
164
+
165
+
166
+ global $current_user;
167
+ $user_id = $current_user->ID;
168
+
169
+ add_user_meta($user_id, 'addthis_nag_updated_options', 'true', true);
170
+
171
+
172
+
173
+ }
174
+
175
+
176
 
 
 
 
 
 
 
 
 
 
177
 
178
  /**
179
  * Generates unique IDs
186
  return $cuid;
187
  }
188
 
189
+ define('ADDTHIS_FALLBACK_USERNAME', 'wp-'.cuid() );
190
+
191
  /**
192
  * Returns major.minor WordPress version.
193
  */
216
  wp_enqueue_script( 'addthis' );
217
  }
218
 
219
+ add_action('admin_notices', 'addthis_admin_notices');
220
+
221
+ function addthis_admin_notices(){
222
+ if (! current_user_can('manage_options'))
223
+ return;
224
+ global $current_user;
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>'), admin_url('options-general.php?page=addthis/addthis_social_widget.php'), '?addthis_nag_ignore=0');
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>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="%2$s target="_blank">Sign Up</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="%3$s">Ignore this notice</a>'), admin_url('options-general.php?page=addthis/addthis_social_widget.php'), 'https://www.addthis.com/register', '?addthis_nag_username_ignore=0');
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>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="%2$s">Ignore this notice</a>'), admin_url('options-general.php?page=addthis/addthis_social_widget.php'), '?addthis_nag_updated_ignore=0');
245
+ echo "</p></div>";
246
+ }
247
+ }
248
+ add_action('admin_init', 'addthis_nag_ignore');
249
+
250
+ function addthis_nag_ignore()
251
+ {
252
+ global $current_user;
253
+ $user_id = $current_user->ID;
254
+
255
+ $options = get_option('addthis_settings');
256
+
257
+ if (isset($_GET['addthis_nag_ignore']) && '0' == $_GET['addthis_nag_ignore'])
258
+ add_user_meta($user_id, 'addthis_ignore_notices', 'true', true);
259
+ if (isset($_GET['addthis_nag_username_ignore']) && '0' == $_GET['addthis_nag_username_ignore'])
260
+ add_user_meta($user_id, 'addthis_nag_username_ignore', 'true', true);
261
+ if (isset($_GET['addthis_nag_updated_ignore']) && '0' == $_GET['addthis_nag_updated_ignore'])
262
+ delete_user_meta($user_id, 'addthis_nag_updated_options', 'true');
263
+
264
+
265
+ }
266
+
267
+ function addthis_plugin_useragent($userAgent)
268
+ {
269
+ return $userAgent . 'ATV/' . ADDTHIS_PLUGIN_VERSION;
270
+ }
271
+
272
+
273
+ add_action('wp_ajax_at_show_dashboard_widget', 'addthis_render_dashboard_widget');
274
  /**
275
  * Our admin dashboard widget shows yesterday's top shared content and top shared-to services.
276
  * Data is fetched via AJAX. We assume jQuery is available on any WP install supporting
280
  * @see js/addthis.css
281
  */
282
  function addthis_render_dashboard_widget() {
283
+ if (! current_user_can('manage_options'))
284
+ {
285
+ _e( 'Cheatin&#8217; uh?' );
286
+ exit;
287
+ }
288
+ $_services = array(
289
+ 'netvibes' => 'Netvibes',
290
+ 'google' => 'Google Reader',
291
+ 'yahoo' => 'Yahoo',
292
+ 'rojo' => 'Rojo',
293
+ 'aol' => 'AOL',
294
+ 'newsgator-on' => 'Newsgator Online',
295
+ 'pluck-on' => 'Pluck Online',
296
+ 'bloglines' => 'Bloglines',
297
+ 'feedlounge' => 'Feedlounge',
298
+ 'newsburst' => 'Newsburst',
299
+ 'msn' => 'MSN',
300
+ 'winlive' => 'Windows Live',
301
+ 'technorati' => 'Technorati',
302
+ 'pageflakes' => 'Pageflakes',
303
+ 'newsalloy' => 'News Alloy',
304
+ 'feedreader' => 'FeedReader',
305
+ 'mymsn' => 'My MSN',
306
+ 'newsisfree' => 'Newsisfree',
307
+ 'feeddemon' => 'FeedDemon',
308
+ 'netnewswire' => 'NetNewWire',
309
+ 'pluck' => 'Pluck',
310
+ 'newsgator' => 'NewsGator',
311
+ 'sharpreader' => 'SharpReader',
312
+ 'awasu' => 'Awasu',
313
+ 'myearthlink' => 'myEarthLink',
314
+ 'rss' => 'Direct Feed Link',
315
+ 'googlebuzz' => 'Google Buzz',
316
+ 'youtube' => 'YouTube',
317
+ 'facebook' => 'Facebook',
318
+ 'flickr' => 'Flickr',
319
+ 'twitter' => 'Twitter',
320
+ 'linkedin' => 'LinkedIn'
321
+ );
322
+
323
+
324
  global $addthis_settings;
325
+ $options = get_option('addthis_settings');
326
+ if (isset($options['username']))
327
+ $username = urlencode($options['username']);
328
+ else
329
+ {
330
+ echo 'No Username entered';
331
+ return false;
332
+ }
333
+ if (isset($options['password']))
334
+ $password = urlencode($options['password']);
335
+ else
336
+ {
337
+ echo 'No Passwrod entered';
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'),
349
+ array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'month'),
350
+ array('metric' => 'clickbacks', 'dimension' => '', 'domain' => $domain, 'period' => 'day'),
351
+ array('metric' => 'clickbacks', 'dimension' => '', 'domain' => $domain, 'period' => 'week'),
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
+ foreach ($requests as $request)
362
+ {
363
+ $dimension = $metric = $domain = $period = '';
364
+ extract($request);
365
+ $dimension = ($dimension != '') ? '/'.$dimension : '';
366
+ $url = 'http://api.addthis.com/analytics/1.0/pub/' . $metric . $dimension . '.json?'.
367
+ 'domain='.$domain.'&period='.$period.
368
+ '&username='.$username.
369
+ '&password='.$password;
370
+ $stats[$metric.$dimension.$period] = wp_remote_get($url, array('period' => $period, 'domain' => $domain, 'password' => $password, 'username' => $username) );
371
+ }
372
+ if ($stats['sharesday']['response']['code'] == 200)
373
+ set_transient('addthis_dashboard_stats', $stats, '600');
374
+
375
+ }
376
+ if ($stats['sharesday']['response']['code'] == 200 && $stats['sharesmonth']['body'] != '[]' )
377
+ {
378
+ $yesterday['shares'] = json_decode($stats['sharesday']['body']);
379
+ $yesterday['shares'] = $yesterday['shares'][0]->shares;
380
+ $yesterday['clickbacks'] = json_decode($stats['clickbacksday']['body']);
381
+ $yesterday['clickbacks'] = $yesterday['clickbacks'][0]->clickbacks;
382
+ $yesterday['viral'] = ($yesterday['shares'] > 0 && $yesterday['clickbacks'] > 0 ) ? $yesterday['clickbacks'] / $yesterday['shares'] * 100 . '%' : 'n/a';
383
+
384
+ if (! $yesterday['clickbacks'] ) $yesterday['clickbacks'] = 0;
385
+ if (! $yesterday['shares'] ) $yesterday['shares'] = 0;
386
+
387
+ $decodedLastWeek = json_decode($stats['sharesweek']['body']);
388
+ $lastweek['shares'] = 0;
389
+ foreach ($decodedLastWeek as $share)
390
+ {
391
+ $lastweek['shares'] += $share->shares;
392
+ }
393
+ $decodedLastWeek = json_decode($stats['clickbacksweek']['body']);
394
+ $lastweek['clickbacks'] = 0;
395
+ foreach ($decodedLastWeek as $clickback)
396
+ {
397
+ $lastweek['clickbacks'] += $clickback->clickbacks;
398
+ }
399
+ $lastweek['viral'] = ($lastweek['shares'] > 0 && $lastweek['clickbacks'] > 0 ) ? $lastweek['clickbacks'] / $lastweek['shares'] * 100 . '%' : 'n/a';
400
+
401
+ $decodedLastMonth = json_decode($stats['sharesmonth']['body']);
402
+ $lastmonth['shares'] = 0;
403
+ foreach ($decodedLastMonth as $share)
404
+ {
405
+ $lastmonth['shares'] += $share->shares;
406
+ }
407
+ $decodedLastMonth = json_decode($stats['clickbacksmonth']['body']);
408
+ $lastmonth['clickbacks'] = 0;
409
+ foreach ($decodedLastMonth as $clickback)
410
+ {
411
+ $lastmonth['clickbacks'] += $clickback->clickbacks;
412
+ }
413
+ $lastmonth['viral'] = ($lastmonth['shares'] > 0 && $lastmonth['clickbacks'] ) ? $lastmonth['clickbacks'] / $lastmonth['shares'] * 100 . '%' : 'n/a';
414
+
415
+
416
+ $services['shares'] = json_decode($stats['shares/servicemonth']['body']);
417
+ $services['clickbacks'] = json_decode($stats['clickbacks/servicemonth']['body']);
418
+ foreach (array('shares', 'clickbacks') as $type)
419
+ {
420
+ $topServiceShare = array_shift($services[$type]);
421
+ $firstLabel = ( isset($_services[$topServiceShare->service])) ? $_services[$topServiceShare->service] : $topServiceShare->service;
422
+ $firstAmount = $topServiceShare->{$type};
423
+ $topServiceShare = array_shift($services[$type]);
424
+ $secondLabel = ( isset($_services[$topServiceShare->service])) ? $_services[$topServiceShare->service] : $topServiceShare->service;
425
+ $secondAmount = $topServiceShare->{$type};
426
+ $thirdLabel = 'Others';
427
+ $thirdAmount = 0;
428
+ foreach($services[$type] as $service )
429
+ {
430
+ $thirdAmount += $service->{$type};
431
+ }
432
+
433
+
434
+ $servicesCharts[$type] = 'http://chart.apis.google.com/chart?&chdlp=b&chs=118x145&cht=p3&chco=BA3A1C|F75C39|424242&'.
435
+ 'chdl='.$firstLabel.'|'.$secondLabel.'|'.$thirdLabel.'&'.
436
+ 'chd=t:'.$firstAmount.','.$secondAmount.','.$thirdAmount;
437
+ }
438
+
439
+ echo "<div id='at_tabs'>";
440
+ echo "<ul>";
441
+ echo "<li class='at_time_period'><a href='#tab1'>Yesterday</a></li>";
442
+ echo "<li class='at_time_period'><a href='#tab2'>Last Week</a></li>";
443
+ echo "<li class='at_time_period'><a href='#tab3'>Last Month</a></li>";
444
+ echo "</ul><div class='clear'>&nbsp;</div>";
445
+ $tab = 0;
446
+ foreach (array('yesterday', 'lastweek', 'lastmonth') as $timePeriod )
447
+ {
448
+ $stats = $$timePeriod;
449
+ $tab++;
450
+ $viral = ( $stats['viral'] != 'n/a' ) ? number_format( $stats['viral'],2) .'%' : $stats['viral'];
451
+ echo '<div id="tab'.$tab.'">';
452
+
453
+ echo
454
+ '<table class="atw-table">
455
+ <colgroup><col width="33%"/><col width="33%"/><col width="33%"/></colgroup>
456
+ <tr>';
457
+ echo '<td><div class="atw-cell"><h3>'. $stats['shares'].'</h3>Shares</div></td>';
458
+ echo '<td><div class="atw-cell"><h3>'. $stats['clickbacks'].'</h3>Clicks</div></td>';
459
+ echo '<td><div class="atw-cell"><h3>'. $viral .'</h3>Viral Lift</div></td>';
460
+
461
+ echo '</tr>';
462
+ echo '</table>';
463
+ echo '</div>';
464
+ }
465
+ echo "</div>";
466
+ echo "<hr />";
467
+ echo "<h5>Top Services for shares(last month)</h5>";
468
+ echo "<img src='{$servicesCharts['shares']}' width='118' height='145' alt='share stats for the last month' />";
469
+ echo "</div>";
470
+ echo '<div id="tstab2"';
471
+ echo "<h5>Top Services for clicks(last month)</h5>";
472
+ echo "<img src='{$servicesCharts['clickbacks']}' width='118' height='145' alt='share stats for the last month' />";
473
+ echo "</div>";
474
+ echo "</div>";
475
+ echo '<div class="clear">&nbsp;</div>';
476
+ echo '<p><a class="button rbutton" href="http://www.addthis.com/analytics/summary?domain='.$domain.'">View More Analytics</a></p>';
477
+ }
478
+ elseif($stats['sharesday']['response']['code'] == 200){
479
+
480
+ echo
481
+ <<<ENDHTML
482
+ <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>
483
+ <p>If you want some ideas for increasing your sharing, check out:</p>
484
+ <ul>
485
+ <li><span class='b'><a href="http://www.addthis.com//blog/">The AddThis Blog</a></span></li>
486
+ <li><span class='b'><a href="http://www.addthis.com//blog/2010/11/09/3-tips-for-getting-the-most-shares/">Three tips for getting the most shares</a></span></li>
487
+ <li><span class='b'><a href="http://www.addthis.com/forum/">The AddThis Forum</a></span></li>
488
+ <ul>
489
  ENDHTML;
490
+ }
491
+ else{
492
+ echo "I'm sorry, but we seemed to encounter an error. This could be because your password is not accurate. Please check and update it.";
493
+ }
494
+ die();
495
  }
496
 
497
  /**
498
  * Initialize the dashboard widget.
499
  */
500
  function addthis_dashboard_init() {
501
+ $options = get_option('addthis_settings');
502
+ if (isset($options['addthis_show_stats']) && $options['addthis_show_stats'] == true && isset($options['username']) && isset($options['password']) && ! empty($options['username']) && ! empty($options['password']) )
503
+ wp_add_dashboard_widget('dashboard_addthis', 'AddThis', 'addthis_render_dashboard_widget_holder');
504
  }
505
 
506
+ function addthis_render_dashboard_widget_holder()
507
+ {
508
+ echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
509
+ }
510
+
511
+
512
+ add_action('wp_ajax_at_save_transient', 'addthis_save_transient');
513
+
514
+ function addthis_save_transient() {
515
+ global $wpdb; // this is how you get access to the database
516
+
517
+
518
+ parse_str($_POST['value'], $values);
519
+
520
+ // verify nonce (or die).
521
+ $nonce = $values['_wpnonce'];
522
+ if (! wp_verify_nonce($nonce, 'addthis-options') ) die('Security check');
523
+
524
+ // Parse Post data
525
+
526
+ $option_array = addthis_parse_options($values);
527
+ // Set Transient
528
+ if (false !== get_transient('addthis_settings'))
529
+ delete_transient('addthis_settings');
530
+ $eh = set_transient('addthis_settings', $option_array, 120);
531
+
532
+
533
+ die();
534
+ }
535
+
536
+ function addthis_save_settings($input)
537
+ {
538
+ $options_array = addthis_parse_options($input);
539
+
540
+ return $options_array;
541
+
542
+
543
+ }
544
+
545
+
546
+
547
+ /**
548
+ * goes through all the options, sanitizing, verifying and returning for storage what needs to be there
549
+ */
550
+ function addthis_parse_options($data)
551
+ {
552
+
553
+ global $addthis_styles, $addthis_new_styles;
554
+
555
+ $styles = array_merge($addthis_styles, $addthis_new_styles);
556
+
557
+
558
+ $options = array();
559
+
560
+ // Sanitize username and password
561
+ if ( isset($data['addthis_username']) )
562
+ $options['username'] = sanitize_text_field($data['addthis_username']);
563
+
564
+ if ( isset($data['addthis_password']) )
565
+ $options['password'] = sanitize_text_field($data['addthis_password']);
566
+
567
+
568
+ if ( isset ($data['show_above']) )
569
+ $options['above'] = 'none';
570
+ elseif ( isset($styles[$data['above']]) )
571
+ $options['above'] = $data['above'];
572
+ elseif ($data['above'] == 'none')
573
+ {
574
+ $options['above'] = 'none';
575
+ }
576
+
577
+ if ( isset ($data['show_below']) )
578
+ $options['below'] = 'none';
579
+ elseif ( isset($styles[$data['below']]) )
580
+ $options['below'] = $data['below'];
581
+ elseif ($data['below'] == 'none')
582
+ {
583
+ $options['below'] = 'none';
584
+ }
585
+
586
+
587
+ // All the checkbox fields
588
+ foreach (array('addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats', 'addthis_showonexcerpts') as $field)
589
+ {
590
+ if ( isset($data[$field]) && $data[$field] == true)
591
+ $options[$field] = true;
592
+ else
593
+ $options[$field] = false;
594
+
595
+ }
596
+
597
+
598
+ //[addthis_brand] =>
599
+
600
+ if ( isset ($data['addthis_brand']) && strlen($data['addthis_brand']) != 0 )
601
+ $options['addthis_brand'] = sanitize_text_field($data['addthis_brand']);
602
+
603
+ //[addthis_options] =>
604
+ if ( isset ($data['addthis_options']) && strlen($data['addthis_options']) != 0 )
605
+ $options['addthis_options'] = str_replace(' ', '', esc_js($data['addthis_options']));
606
+
607
+ //[addthis_language] =>
608
+ if ( isset ($data['addthis_language']))
609
+ $options['addthis_language'] = sanitize_text_field($data['addthis_language']);
610
+
611
+
612
+ if ( isset ($data['addthis_header_background']) && strlen($data['addthis_header_background']) != 0 )
613
+ {
614
+ if (! strpos($data['addthis_header_background'], '#') === 0)
615
+ $options['addthis_header_background'] = '#' . sanitize_text_field($data['addthis_header_background']);
616
+ else
617
+ $options['addthis_header_background'] = sanitize_text_field($data['addthis_header_background']);
618
+ }
619
+
620
+ if ( isset ($data['addthis_header_color']) && strlen($data['addthis_header_color']) != 0 )
621
+ {
622
+ if (! strpos($data['addthis_header_color'], '#') === 0)
623
+ $options['addthis_header_color'] = '#' . sanitize_text_field($data['addthis_header_color']);
624
+ else
625
+ $options['addthis_header_color'] = sanitize_text_field($data['addthis_header_color']);
626
+ }
627
+
628
+ return $options;
629
+
630
+ }
631
+
632
+
633
  /**
634
  * Formally registers AddThis settings. Only called in WP 2.7+.
635
  */
636
  function register_addthis_settings() {
637
+ register_setting('addthis', 'addthis_settings', 'addthis_save_settings');
638
+
639
+ }
640
+ /*
641
+ * Used to make sure excerpts above the head aren't displayed wrong
642
+ */
643
+ function addthis_add_content_filters()
644
+ {
645
+ if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
646
+ $preview = true;
647
+ else
648
+ $options = get_option('addthis_settings');
649
+
650
+ if ($options['addthis_showonexcerpts'] == true )
651
+ add_filter('get_the_excerpt', 'addthis_display_social_widget_excerpt');
652
+
653
+ add_filter('the_content', 'addthis_display_social_widget', 15);
 
 
654
  }
655
 
656
+
657
  /**
658
  * Adds WP filter so we can append the AddThis button to post content.
659
  */
661
  {
662
  global $addthis_settings;
663
 
664
+ add_action( 'wp_head', 'addthis_add_content_filters');
665
+
666
  if (addthis_get_wp_version() >= 2.7) {
667
  if ( is_admin() ) {
668
  add_action( 'admin_init', 'register_addthis_settings' );
669
  }
670
  }
671
 
672
+ $options = get_option('addthis_settings');
673
+
674
  if (function_exists('wp_register_style')) {
675
  wp_register_style( 'addthis', WP_PLUGIN_URL . '/addthis/css/addthis.css');
676
+ wp_register_script( 'addthis', WP_PLUGIN_URL . '/addthis/js/addthis.js', array('jquery-ui-tabs') );
677
 
678
+ add_action('admin_print_styles-index.php', 'addthis_print_style');
679
+ add_action('admin_print_scripts-index.php', 'addthis_print_script');
680
  }
681
 
682
  add_filter('admin_menu', 'addthis_admin_menu');
683
 
684
+ if ( get_option('addthis_product') !== false &&
685
+ ! is_array( $options ) )
686
+ addthis_options_200();
687
+
688
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689
  add_action( 'addthis_widget', 'addthis_print_widget', 10, 2);
690
 
691
  $product = get_option('addthis_product');
715
  }
716
  $addthis_settings['options'] = get_option('addthis_options');
717
 
 
 
 
 
 
718
  }
719
 
720
+ add_action('wp_dashboard_setup', 'addthis_dashboard_init' );
721
+
722
+ add_action('widgets_init', 'addthis_widget_init');
723
+
724
  function addthis_widget_init()
725
  {
726
+ require_once('addthis_sidebar_widget.php');
727
+ register_widget('AddThisSidebarWidget');
 
 
 
728
  }
729
 
730
  function addthis_sidebar_widget($args)
735
  echo $after_widget;
736
  }
737
 
738
+ // essentially replace wp_trim_excerpt until we have something better to use here
739
+ function addthis_remove_tag($content, $text = '')
740
+ {
741
+
742
+
743
+ if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
744
+ $preview = true;
745
+ else
746
+ $options = get_option('addthis_settings');
747
+
748
+
749
+ $raw_excerpt = $text;
750
+ if ( '' == $text ) {
751
+
752
+ $text = get_the_content('');
753
+ $text = strip_shortcodes( $text );
754
+ remove_filter('the_content', 'addthis_display_social_widget', 15);
755
+
756
+ $text = apply_filters('the_content', $text);
757
+ $text = str_replace(']]>', ']]&gt;', $text);
758
+ $text = strip_tags($text);
759
+ $excerpt_length = apply_filters('excerpt_length', 55);
760
+ $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
761
+ $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
762
+ if ( count($words) > $excerpt_length ) {
763
+ array_pop($words);
764
+ $text = implode(' ', $words);
765
+ $text = $text . $excerpt_more;
766
+ } else {
767
+ $text = implode(' ', $words);
768
+ }
769
+ if ($options['addthis_showonexcerpts'] == false)
770
+ return $text;
771
+ return addthis_display_social_widget($text, false, false);
772
+ }
773
+ else
774
+ {
775
+ return $content;
776
+ }
777
+ }
778
+
779
+ function addthis_late_widget($link_text)
780
+ {
781
+ remove_filter('get_the_excerpt', 'addthis_late_widget');
782
+
783
+ if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
784
+ $preview = true;
785
+ else
786
+ $options = get_option('addthis_settings');
787
+
788
+ if ($options['addthis_showonexcerpts'] == false)
789
+ return $link_text;
790
+
791
+ global $addthis_styles, $addthis_new_styles;
792
+ $styles = array_merge($addthis_styles, $addthis_new_styles);
793
+
794
+ $url = get_permalink();
795
+ $title = get_the_title();
796
+ $url_above = '';
797
+ $url_below = '';
798
+ if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
799
+ $preview = true;
800
+ else
801
+ $options = get_option('addthis_settings');
802
+
803
+
804
+ $url_below = "addthis:url='$url' ";
805
+ $url_below .= "addthis:title='$title'";
806
+
807
+ if ( isset ($styles[$options['below']]) && has_excerpt() && ! is_attachment() )
808
+ {
809
+ $below = apply_filters('addthis_below_content', $styles[$options['below']]['src']);
810
+ }
811
+ else
812
+ {
813
+ $below = apply_filters('addthis_below_content','' );
814
+ }
815
+ return $link_text .' <br />' . sprintf($below, $url_below);
816
+
817
+
818
+ }
819
+
820
+
821
+ function addthis_display_social_widget_excerpt($content)
822
+ {
823
+ if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
824
+ $preview = true;
825
+ else
826
+ $options = get_option('addthis_settings');
827
+
828
+
829
+ if ( has_excerpt() && $options['addthis_showonexcerpts'] == true )
830
+ return addthis_display_social_widget($content, true, true);
831
+ else
832
+ return $content;
833
+ }
834
+
835
+
836
+ function addthis_display_social_widget($content, $filtered = true, $below_excerpt = false)
837
+ {
838
+
839
+ global $addthis_styles, $addthis_new_styles;
840
+ $styles = array_merge($addthis_styles, $addthis_new_styles);
841
+
842
+
843
+ if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
844
+ $preview = true;
845
+ else
846
+ $options = get_option('addthis_settings');
847
+
848
+ if ( is_home() || is_front_page() )
849
+ $display = (isset($options['addthis_showonhome']) && $options['addthis_showonhome'] == true ) ? true : false;
850
+ elseif ( is_archive() && ! is_category() )
851
+ $display = (isset($options['addthis_showonarchives']) && $options['addthis_showonarchives'] == true ) ? true : false;
852
+ // Cat
853
+ elseif ( is_category() )
854
+ $display = (isset($options['addthis_showoncats']) && $options['addthis_showoncats'] == true ) ? true : false;
855
+ // Pages
856
+ elseif ( is_page() )
857
+ $display = (isset($options['addthis_showonpages']) && $options['addthis_showonpages'] == true) ? true: false;
858
+ // Single pages (true by default and design)
859
+ elseif ( is_single() )
860
+ $display = true;
861
+ else
862
+ $display = false;
863
+
864
+ remove_filter('wp_trim_excerpt', 'addthis_remove_tag', 9, 2);
865
+ remove_filter('get_the_excerpt', 'addthis_late_widget');
866
+ $url = get_permalink();
867
+ $title = get_the_title();
868
+ $url_above = "addthis:url='$url' ";
869
+ $url_above .= "addthis:title='$title'";
870
+ $url_below = "addthis:url='$url' ";
871
+ $url_below .= "addthis:title='$title'";
872
+
873
+ // Still here? Well let's add some social goodness
874
+ if ( $options['above'] != 'none' && $display )
875
+ {
876
+ if (isset ($styles[$options['above']]))
877
+ {
878
+ $above = apply_filters('addthis_above_content', $styles[$options['above']]['src']). '<br />';
879
+ }
880
+ }
881
+ else
882
+ $above = apply_filters('addthis_above_content','' );
883
+
884
+ if ($options['below'] != 'none' && $display && ! $below_excerpt )
885
+ {
886
+ if (isset ($styles[$options['below']]))
887
+ {
888
+ $below = apply_filters('addthis_below_content', $styles[$options['below']]['src']). '<br />';
889
+ }
890
+
891
+ }
892
+ elseif ($below_excerpt && $display && $options['below'] != 'none' )
893
+ {
894
+ $below = apply_filters('addthis_below_content','' );
895
+ if ($options['addthis_showonexcerpts'] == true )
896
+ add_filter('get_the_excerpt', 'addthis_late_widget', 14);
897
+ }
898
+
899
+ else
900
+ $below = '';
901
+
902
+
903
+
904
+ if ($display)
905
+ {
906
+ $content = sprintf($above, $url_above) . $content . sprintf($below, $url_below);
907
+ if ($filtered == true)
908
+ add_filter('wp_trim_excerpt', 'addthis_remove_tag', 11, 2);
909
+ }
910
+
911
+ return $content;
912
+
913
+ }
914
+
915
+
916
+ add_action('wp_footer', 'addthis_output_script');
917
+
918
+ /**
919
+ * Check to see if our Javascript has been outputted yet. If it hasn't, return it. Else, return false.
920
+ *
921
+ * @return mixed
922
+ */
923
+ function addthis_output_script()
924
+ {
925
+ global $addthis_settings;
926
+
927
+ if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
928
+ $preview = true;
929
+ else
930
+ $options = get_option('addthis_settings');
931
+
932
+ $script = "\n<!-- AddThis Button Begin -->\n"
933
+ .'<script type="text/javascript">'
934
+ ."var addthis_product = 'wpp-251';\n";
935
+
936
+ $pub = (isset($options['username'])) ? $options['username'] : false ;
937
+ if (!$pub) {
938
+ $pub = 'wp-'.cuid();
939
+ }
940
+ $pub = urlencode($pub);
941
+
942
+
943
+ $addthis_config = array();
944
+
945
+ if ( isset($options['addthis_append_data']) && $options['addthis_append_data'] == true)
946
+ $addthis_config["data_track_clickback"] = true;
947
+
948
+ if ( isset($options['addthis_language']) && strlen($options['addthis_language']) == 2)
949
+ $addthis_config['ui_language'] = $options['addthis_language'];
950
+
951
+ if ( isset($options['addthis_header_background']) )
952
+ $addthis_config['ui_header_background'] = $options['addthis_header_background'];
953
+
954
+ if ( isset($options['addthis_header_color']) )
955
+ $addthis_config['ui_header_color'] = $options['addthis_header_color'];
956
+
957
+ if ( isset($options['addthis_brand']) )
958
+ $addthis_config['ui_cobrand'] = $options['addthis_brand'];
959
+
960
+
961
+ $addthis_config = apply_filters('addthis_config_js_var', $addthis_config);
962
+
963
+
964
+ if (! empty ($addthis_config) )
965
+ $script .= 'var addthis_config = '. json_encode($addthis_config) .';';
966
+
967
+ if (isset($options['addthis_options']) && strlen($options['addthis_options']) != 0)
968
+ $script .= 'var addthis_options = "'.$options['addthis_options'].'"';
969
+
970
+ $script .= '</script>';
971
+
972
+
973
+ $script .= '<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username='.$pub.'"></script>';
974
+
975
+ echo $script;
976
+ }
977
+
978
+
979
+
980
  /**
981
  * Appends AddThis button to post content.
982
  */
998
 
999
  $pub = ($addthis_settings['username']);
1000
  if (!$pub) {
1001
+ $pub = 'wp-'.cuid();
1002
  }
1003
  $pub = urlencode($pub);
1004
 
1011
  ."\n//<!--\n"
1012
  ."var addthis_product = 'wpp-250';\n";
1013
 
1014
+
1015
  if (strlen($addthis_settings['customization']))
1016
  {
1017
  $content .= ($addthis_settings['customization']) . "\n";
1062
  /**
1063
  * Generates img tag for share/bookmark button.
1064
  */
1065
+ function addthis_get_button_img( $btnStyle = false )
1066
  {
1067
  global $addthis_settings;
1068
  global $addthis_styles;
1069
+ global $addthis_default_options;
1070
+
1071
+ $addthis_options = get_option('addthis_settings');
1072
+ $options = wp_parse_args($addthis_options, $addthis_default_options);
1073
+
1074
+ $language = $options['language'];
1075
 
1076
+ if ($btnStyle == false)
1077
+ $btnStyle = $addthis_settings['style'];
1078
  if ($addthis_settings['language'] != 'en')
1079
  {
1080
  // We use a translation of the word 'share' for all verbal buttons
1102
  EOF;
1103
  }
1104
 
1105
+ function addthis_options_page_scripts()
1106
+ {
1107
+ wp_enqueue_script( 'addthis_options_page_script', plugins_url( '/addthis/js/options-page.js', basename(dirname(__FILE__)) ), array('jquery-ui-tabs', 'thickbox' ));
1108
+ }
1109
+
1110
+ function addthis_options_page_style()
1111
+ {
1112
+ wp_enqueue_style( 'addthis_options_page_style', plugins_url('/addthis/css/options-page.css', basename(dirname(__FILE__)) ) );
1113
+ wp_enqueue_style( 'thickbox' );
1114
+ }
1115
+
1116
  function addthis_admin_menu()
1117
  {
1118
+ $addthis = add_options_page('AddThis Plugin Options', 'AddThis', 'manage_options', __FILE__, 'addthis_plugin_options_php4');
1119
+ add_action('admin_print_scripts-' . $addthis, 'addthis_options_page_scripts');
1120
+ add_action('admin_print_styles-' . $addthis, 'addthis_options_page_style');
1121
  }
1122
 
1123
+ $addthis_default_options = array(
1124
+ 'username' => '',
1125
+ 'password' => '',
1126
+ 'style' => addthis_style_default ,
1127
+ 'location' => 'below',
1128
+ 'below' => 'large_toolbox',
1129
+ 'above' => 'fb_tw_sc',
1130
+ 'addthis_show_stats' => true,
1131
+ 'addthis_append_data'=> true,
1132
+ 'addthis_showonhome' => true,
1133
+ 'addthis_showonpages' => true,
1134
+ 'addthis_showonarchives' => true,
1135
+ 'addthis_showoncats' => true,
1136
+ 'addthis_brand' => '',
1137
+ 'toolbox' => '',
1138
+ 'addthis_language' => '',
1139
+ 'addthis_header_background' => '',
1140
+ 'addthis_header_color' => '',
1141
+ 'addthis_options' => '',
1142
+ 'addthis_showonexcerpts' => true
1143
+ );
1144
+
1145
  function addthis_plugin_options_php4() {
1146
  global $addthis_styles;
1147
  global $addthis_languages;
1148
  global $addthis_settings;
1149
  global $addthis_menu_types;
1150
+ global $addthis_new_styles;
1151
+ global $addthis_default_options;
1152
 
1153
+ global $current_user;
1154
+ $user_id = $current_user->ID;
1155
+
1156
+ if (get_user_meta($user_id, 'addthis_nag_updated_options') )
1157
+ delete_user_meta($user_id, 'addthis_nag_updated_options', 'true');
1158
  ?>
1159
  <div class="wrap">
1160
+ <h2 class='placeholder'>&nbsp;</h2>
1161
+ <form id="addthis_settings" method="post" action="options.php">
 
1162
  <?php
1163
  // use the old-school settings style in older versions of wordpress
1164
  if (addthis_get_wp_version() < 2.7) {
1166
  } else {
1167
  settings_fields('addthis');
1168
  }
1169
+
1170
+ $addthis_options = get_option('addthis_settings');
1171
+ foreach ( array( 'addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats' ) as $option)
1172
+ {
1173
+ if ( $addthis_options && ! isset($addthis_options[$option]) )
1174
+ $addthis_options[$option] = false;
1175
+ }
1176
+
1177
+
1178
+ $options = wp_parse_args($addthis_options, $addthis_default_options);
1179
+ extract($options);
1180
  ?>
1181
 
1182
+ <div class="page-header" id="tabs">
1183
+ <img alt='addthis' src="http://cache.addthis.com/icons/v1/thumbs/32x32/more.png" class="header-img"/>
1184
+ <ul class="nav-tab-wrapper">
1185
+ <li><h2 class="nav-tab-wrapper"><a href="#tabs-1">Basic</a></h2></li>
1186
+ <li><h2 class="nav-tab-wrapper"><a href="#tabs-2">Advanced</a></h2></li>
1187
+ </ul>
1188
+ <div class='clear'>&nbsp;</div>
1189
+ <div id="tabs-1">
1190
  <table class="form-table">
1191
+ <tbody>
 
 
 
1192
  <tr>
1193
+ <td id="above" colspan="2">
1194
+ <p><?php _e("Above the post", 'addthis_trans_domain') ?>&nbsp;&nbsp;<span class="description"><input type="checkbox" name="addthis_settings[show_above]" <?php echo ('none' == $above) ? 'checked="checked"' : '';?> />&nbsp;none</span></p>
1195
+ <?php foreach ($addthis_new_styles as $k => $v)
1196
+ {
1197
+ $class = 'hidden';
1198
+ $checked = '';
1199
+ if ($above == $k || ($above == 'none' && $k == $addthis_default_options['above'] ) ){
1200
+ $checked = 'checked="checked"';
1201
+ $class = '';
1202
  }
1203
+ 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>";
1204
+ }
1205
  ?>
1206
+ <a class="above_option" href="#above_more" id="above_more">addtional style options</a>
 
 
 
 
 
 
 
 
 
 
 
 
 
1207
  </td>
1208
  </tr>
1209
  <tr>
1210
+ <td id='below' colspan="2">
1211
+ <p><?php _e("Below the post", 'addthis_trans_domain') ?>&nbsp;&nbsp;<span class="description"><input type="checkbox" name="addthis_settings[show_below]" <?php echo ('none' == $below) ? 'checked="checked"' : '';?> />&nbsp;none</span></p>
1212
+ <?php foreach ($addthis_new_styles as $k => $v)
1213
+ {
1214
+ $class = 'hidden';
1215
+ $checked = '';
1216
+ if ($below == $k || ($below == 'none' && $k == $addthis_default_options['below'] ) )
1217
+ {
1218
+ $checked = 'checked="checked"';
1219
+ $class = '';
1220
+ }
1221
+ 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>";
1222
+ }
1223
+ ?>
1224
+ <a class="below_option" href="#below_more" id="below_more">additional style options</a>
1225
+ </td>
1226
+ </tr>
1227
+ <tr valign="top">
1228
+ <td colspan="2"><?php _e('Enter a 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="http://addthis.com/features" target="_blank">Click here for more information</a>. ', 'addthis_trans_domain');?> </td>
1229
+ </tr>
1230
+ <tr valign="top">
1231
+ <th scope="row"><?php _e("AddThis username:", 'addthis_trans_domain' ); ?></th>
1232
+ <td><input id="addthis_username" type="text" name="addthis_settings[addthis_username]" value="<?php echo $username; ?>" autofill='off' autocomplete='off' /></td>
1233
+ </tr>
1234
+ <tr id="password_row" >
1235
+ <th scope="row"><?php _e("AddThis password:", 'addthis_trans_domain' ); ?><br/><span style="font-size:10px">(required for displaying stats)</span></th>
1236
+ <td><input id="addthis_password" type="password" name="addthis_settings[addthis_password]" value="<?php echo $password; ?>" autocomplete='off' autofill='off' /></td>
1237
+ </tr>
1238
+ </tbody>
1239
+ </table>
1240
+ <div class='clear'>&nbsp;</div>
1241
+ </div>
1242
+ <div id="tabs-2">
1243
  <table class="form-table">
 
 
 
 
1244
  <tr>
1245
  <th scope="row"><?php _e("Show stats in admin dashboard:", 'addthis_trans_domain' ); ?></th>
1246
+ <td><input type="checkbox" name="addthis_settings[addthis_show_stats]" value="true" <?php echo ($addthis_show_stats == true ? 'checked="checked"' : ''); ?>/></td>
 
 
 
 
1247
  </tr>
 
 
 
1248
  <tr>
1249
  <th scope="row"><?php _e("Track <a href=\"http://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>
1250
+ <td><input type="checkbox" name="addthis_settings[addthis_append_data]" value="true" <?php echo $addthis_append_data == true ? 'checked="checked"' : ''; ?>/></td>
1251
  </tr>
1252
  <tr>
1253
  <th scope="row"><?php _e("Show on homepage:", 'addthis_trans_domain' ); ?></th>
1254
+ <td><input type="checkbox" name="addthis_settings[addthis_showonhome]" value="true" <?php echo ($addthis_showonhome == true ? 'checked="checked"' : ''); ?>/></td>
1255
  </tr>
1256
  <tr>
1257
  <th scope="row"><?php _e("Show on <a href=\"http://codex.wordpress.org/Pages\" target=\"blank\">pages</a>:", 'addthis_trans_domain' ); ?></th>
1258
+ <td><input type="checkbox" name="addthis_settings[addthis_showonpages]" value="true" <?php echo ( $addthis_showonpages == true ? 'checked="checked"' : ''); ?>/></td>
1259
  </tr>
1260
  <tr>
1261
  <th scope="row"><?php _e("Show in archives:", 'addthis_trans_domain' ); ?></th>
1262
+ <td><input type="checkbox" name="addthis_settings[addthis_showonarchives]" value="true" <?php echo ($addthis_showonarchives == true ? 'checked="checked"' : ''); ?>/></td>
1263
  </tr>
1264
  <tr>
1265
  <th scope="row"><?php _e("Show in categories:", 'addthis_trans_domain' ); ?></th>
1266
+ <td><input type="checkbox" name="addthis_settings[addthis_showoncats]" value="true" <?php echo ( $addthis_showoncats == true ? 'checked="checked"' : ''); ?>/></td>
1267
  </tr>
1268
  <tr>
1269
+ <th scope="row"><?php _e("Show on excerpts:", 'addthis_trans_domain' ); ?></th>
1270
+ <td><input type="checkbox" name="addthis_settings[addthis_showonexcerpts]" value="true" <?php echo ( $addthis_showonexcerpts == true ? 'checked="checked"' : ''); ?>/></td>
1271
  </tr>
1272
  <tr valign="top">
1273
  <td colspan="2"></td>
1276
  <td colspan="2">For more details on the following options, see <a href="http://addthis.com/customization">our customization docs</a>.</td>
1277
  </tr>
1278
  <tr valign="top">
1279
+ <th scope="row"><?php _e("Custom service list:", 'addthis_trans_domain' ); ?><br /><span class='description'><?php _e(
1280
+ '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.'
1281
+ , 'addthis_trans_domain') ?>
1282
+ </span></th>
1283
+ <td><input size='60' type="text" name="addthis_settings[addthis_options]" value="<?php echo $addthis_options; ?>" /><br />
1284
+ <span class='description'><?php _e('Enter a comma-separated list of <a href="http://addthis.com/services">service codes</a>', 'addthis_trans_domain' ); ?></span>
1285
+ </td>
1286
+
1287
  </tr>
1288
  <tr valign="top">
1289
+ <th scope="row"><?php _e("Brand:", 'addthis_trans_domain' ); ?></th>
1290
+ <td><input type="text" name="addthis_settings[addthis_brand]" value="<?php echo $addthis_brand; ?>" /></td>
1291
  </tr>
1292
  <tr valign="top">
1293
  <th scope="row"><?php _e("Language:", 'addthis_trans_domain' ); ?></th>
1294
  <td>
1295
+ <select name="addthis_settings[addthis_language]">
1296
  <?php
1297
+ $curlng = $addthis_language;
1298
  foreach ($addthis_languages as $lng=>$name)
1299
  {
1300
+ echo "<option value=\"$lng\"". ($lng == $curlng ? " selected='selected'":""). ">$name</option>";
1301
  }
1302
  ?>
1303
  </select>
1305
  </tr>
1306
  <tr valign="top">
1307
  <th scope="row"><?php _e("Header background:", 'addthis_trans_domain' ); ?></th>
1308
+ <td><input type="text" name="addthis_settings[addthis_header_background]" value="<?php echo $addthis_header_background; ?>" /></td>
1309
  </tr>
1310
  <tr valign="top">
1311
  <th scope="row"><?php _e("Header color:", 'addthis_trans_domain' ); ?></th>
1312
+ <td><input type="text" name="addthis_settings[addthis_header_color]" value="<?php echo $addthis_header_color; ?>" /></td>
1313
  </tr>
1314
  </table>
1315
+ <div class='clear'>&nbsp;</div>
1316
+ </div>
1317
+ </div>
1318
+ <div class="clear">&nbsp;</div>
1319
+ <p class="submit">
1320
+ <?php
1321
+ // Build Preview Link
1322
+ $preview_link = esc_url( get_option( 'home' ) . '/' );
1323
+ if ( is_ssl() )
1324
+ $preview_link = str_replace( 'http://', 'https://', $preview_link );
1325
+ $stylesheet = get_option('stylesheet');
1326
+ $template = get_option('template');
1327
+ $preview_link = htmlspecialchars( add_query_arg( array( 'preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'preview_iframe' => true, 'TB_iframe' => 'true' ), $preview_link ) );
1328
+
1329
 
 
 
 
 
 
 
 
 
1330
  ?>
1331
+ <a href="<?php echo $preview_link; ?>" class="thickbox thickbox-preview" id="preview" ><?php _e('Preview'); ?></a>
1332
  <input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" />
1333
  </p>
1334
 
1336
  </div>
1337
  <?php
1338
  }
1339
+ add_action('init', 'addthis_init');
1340
+
1341
+ /* 2.9 compatability functions
1342
+ */
1343
+
1344
+ if (! function_exists('get_user_meta'))
1345
+ {
1346
+ function get_user_meta($userid, $metakey, $ignored='')
1347
+ {
1348
+ $userdata = get_userdata($userid);
1349
+ if (isset($userdata->{$metakey}) )
1350
+ return $userdata->{$metakey};
1351
+ else
1352
+ return false;
1353
+ }
1354
+
1355
+ }
1356
+ if (! function_exists('delete_user_meta'))
1357
+ {
1358
+ function delete_user_meta($userid, $metakey, $ignored = '')
1359
+ {
1360
+ return delete_usermeta($userid, $metakey);
1361
+ }
1362
+ }
1363
+
1364
+ if (! function_exists('add_user_meta'))
1365
+ {
1366
+ function add_user_meta($userid, $metakey, $metavalue)
1367
+ {
1368
+ return update_usermeta($userid, $metakey, $metavalue);
1369
+ }
1370
+ }
1371
+ if (! function_exists('get_home_url'))
1372
+ {
1373
+ function get_home_url()
1374
+ {
1375
+ return get_option( 'home' );
1376
+ }
1377
+ }
1378
+
1379
 
 
1380
  ?>
css/addthis.css CHANGED
@@ -59,6 +59,7 @@ border-top:medium none;
59
  }
60
  #dashboard_addthis table tr {
61
  padding:0;
 
62
  }
63
  #dashboard_addthis .atb {
64
  font-weight:bold;
@@ -84,3 +85,58 @@ width:1px;
84
  #dashboard_addthis .analytics {
85
  padding:6px 0px;
86
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
60
  #dashboard_addthis table tr {
61
  padding:0;
62
+ line-height: 1.25;
63
  }
64
  #dashboard_addthis .atb {
65
  font-weight:bold;
85
  #dashboard_addthis .analytics {
86
  padding:6px 0px;
87
  }
88
+ #dashboard_addthis .inside ul li span.b{
89
+ font-weight: bold;
90
+ }
91
+ .addthis_analytics thead tr th{
92
+ text-align:left;
93
+ }
94
+ .addthis_linkout{
95
+ float:right;
96
+ }
97
+
98
+ .atw-switch {
99
+ margin-bottom: 8px;
100
+ }
101
+ .atw-table {
102
+ margin-top: 5px;
103
+ border-collapse: collapse;
104
+ width: 100%;
105
+ }
106
+ .atw-table td {
107
+ background: #f5f5f5;
108
+ border: 1px solid #eee;
109
+ padding: 10px;
110
+ text-align: center;
111
+ color: #555;
112
+ border-radius: 4px;
113
+ -moz-border-radius: 4px;
114
+ -webkit-border-radius: 4px;
115
+ }
116
+ .atw-table h3 {
117
+ margin: 0 0 8px;
118
+ font-size: 20px;
119
+ font-weight: bold;
120
+ color: #000;
121
+ }
122
+ #at_tabs .ui-state-active, #at_services_tabs .ui-state-active {
123
+ font-weight: bold;
124
+ }
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{
139
+ height: 0;
140
+ margin: 0;
141
+ padding: 0;
142
+ }
css/options-page.css ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ h3.page-title {
2
+ float: left;
3
+ }
4
+ .page-header{
5
+ border-bottom: 1px solid #CCCCCC;
6
+ padding-bottom: 0;
7
+ width: 100%;
8
+ height:63px;
9
+ }
10
+ .nav-tab-wrapper li{
11
+ float: left;
12
+ border-bottom:none;
13
+ padding: 8px 24px;
14
+ border-bottom: 1px solid #CCCCCC;
15
+ }
16
+ h2.nav-tab-wrapper{
17
+ border:none;
18
+ }
19
+ .nav-tab-wrapper li.ui-tabs-selected{
20
+ -moz-border-radius: 5px 5px 0 0;
21
+ border-top:1px solid #ccc;
22
+ border-left:1px solid #ccc;
23
+ border-right: 1px solid #ccc;
24
+ border-bottom: none;
25
+ }
26
+
27
+ h2.nav-tab-wrapper{
28
+ padding-left: 5px;
29
+ }
30
+ .nav-tab-wrapper li a{
31
+ color:#464646;
32
+ text-decoration:none;
33
+ }
34
+ .form-table{
35
+ width: 600px;
36
+ float: left;
37
+ display: block;
38
+ }
39
+ .more-info{
40
+ float: left;
41
+ width: 200px;
42
+ };
43
+ p.submit {
44
+ clear: both;
45
+ }
46
+ #tabs{
47
+ display:block;
48
+ height: 100%;
49
+ }
50
+ .ui-tabs-panel{
51
+ }
52
+ .wrap{
53
+ width: 800px;
54
+ }
55
+ span.code_name{
56
+ width: 140px;
57
+ margin: 15px;
58
+ }
59
+ .get_the_code{
60
+ clear:both;
61
+ padding-bottom: 10px;
62
+ height: 40px;
63
+ }
64
+ .get_the_code img{
65
+ float: right;
66
+ }
67
+ .form-table .hidden{
68
+ display: none;
69
+ }
70
+ .form-table .hide{
71
+ display: none;
72
+ }
73
+ h2.placeholder{
74
+ font-size: 1px;
75
+ padding: 1px;
76
+ margin: 0px;
77
+ height: 2px;
78
+ }
79
+ .page-header img.header-img{
80
+ float: left;
81
+ height: 36px;
82
+ padding: 14px 6px 15px 0;
83
+ width: 36px;
84
+ }
img/button.jpg ADDED
Binary file
img/fb-tw-sc.jpg ADDED
Binary file
img/share.jpg ADDED
Binary file
img/share_counter.png ADDED
Binary file
img/small-toolbox.jpg ADDED
Binary file
img/toolbox-large.jpg ADDED
Binary file
img/toolbox-large.png ADDED
Binary file
img/toolbox-small.png ADDED
Binary file
js/addthis.js CHANGED
@@ -1,99 +1,11 @@
1
- var at_total_shares = 0,
2
- at_populated_svcs = 0,
3
- at_populated_content = 0;
4
 
5
- function addthis_toggle_tabs(servicesOn) {
6
- var on = 'services',
7
- off = 'posts';
 
8
 
9
- if (!servicesOn) {
10
- var tmp = off;
11
- off = on;
12
- on = tmp;
13
- }
14
 
15
- jQuery('#addthis_data_'+off+'_table').hide();
16
- jQuery('#addthis_data_'+on+'_table').show();
17
-
18
- jQuery('#addthis_'+on+'_tab').attr("class","addthis_tab atb-active");
19
- jQuery('#addthis_'+off+'_tab').attr("class","addthis_tab");
20
- return false;
21
- }
22
-
23
- function addthis_populate_services_table(username, password, max, table_id, header_id) {
24
- if (!at_populated_svcs) {
25
- // load service json
26
- jQuery.getJSON("//api.addthis.com/analytics/1.0/pub/shares/service.json?suppress_response_codes=true&username="+encodeURIComponent(username)+"&password="+encodeURIComponent(password)+"&callback=?",
27
- function(data){
28
- if (!data || data.length == 0) {
29
- jQuery(header_id).text("No shares yesterday.");
30
- jQuery('#addthis_data_container').hide();
31
- return;
32
- }
33
- if (data.error) {
34
- jQuery('#addthis_data_container').hide();
35
- jQuery(header_id).text("Error connecting to AddThis: " + data.error.message);
36
- return;
37
- }
38
- jQuery(header_id).text("Yesterday At a Glance");
39
- jQuery.each(data, function(i,item){
40
- at_total_shares += item.shares;
41
- if ( i < max ) {
42
- (i % 2 == 0 ? jQuery("<tr>").attr("id", "at_data_"+i).attr("class", i == 0 ? "first" : "") : jQuery("#at_data_"+(i-1)))
43
- .append(jQuery("<td>").attr("class", "b").text(item.service))
44
- .append(jQuery("<td>").attr("class", "t").text(item.shares))
45
- .appendTo(table_id);
46
- }
47
- });
48
-
49
- if (jQuery('#at_data_total_services').length) {
50
- jQuery('#at_data_total_services').text(at_total_shares);
51
- } else {
52
- jQuery("<tr>").attr("class", "last")
53
- .append(jQuery("<td>").attr("class", "b atb").text("Total Shares:"))
54
- .append(jQuery("<td>"))
55
- .append(jQuery("<td>"))
56
- .append(jQuery("<td>").attr("id","at_data_total_services").attr("class", "t atb").text(at_total_shares))
57
- .appendTo(table_id);
58
- }
59
-
60
- jQuery("#at_post_total").text(at_total_shares);
61
- jQuery('#addthis_tab_table').show();
62
- });
63
- at_populated_svcs = 1;
64
- }
65
- }
66
-
67
- function addthis_populate_posts_table(username, password, max, table_id, header_id) {
68
- if (!at_populated_content) {
69
- // get the top content data
70
- jQuery.getJSON("//api.addthis.com/analytics/1.0/pub/shares/content.json?suppress_response_codes=true&username="+encodeURIComponent(username)+"&password="+encodeURIComponent(password)+"&callback=?",
71
- function(data){
72
- var other = 0;
73
- jQuery.each(data, function(i,item){
74
- var title = item.title;
75
- try { title = decodeURIComponent(title); } catch (e) { title = unescape(title); }
76
- if (title.length > 53) title = title.substr(0, 50) + '...';
77
- if ( i < max) {
78
- jQuery("<tr>").attr("id", "at_post_data_"+i).attr("class", i == 0 ? "first" : "")
79
- .append(jQuery("<td>").attr("class", "b").text(title))
80
- .append(jQuery("<td>").attr("class", "t").text(item.shares))
81
- .appendTo(table_id);
82
- }
83
- });
84
-
85
- if (jQuery('#at_post_total').length) {
86
- jQuery('#at_post_total').text(at_total_shares);
87
- } else {
88
- jQuery("<tr>").attr("class", "last").attr("id","at_data_total")
89
- .append(jQuery("<td>").attr("class", "b atb").text("Total Shares:"))
90
- .append(jQuery("<td id='at_post_total'>").attr("class", "t atb").text(at_total_shares))
91
- .appendTo(table_id);
92
- }
93
-
94
- jQuery('#addthis_tab_table').show();
95
- jQuery(table_id+"_table").show();
96
- });
97
- at_populated_content = 1;
98
- }
99
- }
1
+ jQuery(document).ready(function($) {
2
+
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
 
 
 
 
 
 
10
 
11
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/options-page.js ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
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
+ {
51
+ tb_click.call(previewLink);
52
+ }
53
+ var href = $(previewLink).attr('href');
54
+ var link = '';
55
+
56
+
57
+ if ( tbWidth = href.match(/&tbWidth=[0-9]+/) )
58
+ tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10);
59
+ else
60
+ tbWidth = $(window).width() - 90;
61
+
62
+ if ( tbHeight = href.match(/&tbHeight=[0-9]+/) )
63
+ tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10);
64
+ else
65
+ tbHeight = $(window).height() - 60;
66
+
67
+ $('#TB_title').css({'background-color':'#222','color':'#dfdfdf'});
68
+ $('#TB_closeAjaxWindow').css({'float':'left'});
69
+ $('#TB_ajaxWindowTitle').css({'float':'right'}).html(link);
70
+
71
+ $('#TB_iframeContent').width('100%');
72
+
73
+ thickDims();
74
+
75
+ });
76
+ return false;
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
+ });
89
+
90
+ var show_above = $('input[name="addthis_settings[show_above]"]');
91
+ var show_below = $('input[name="addthis_settings[show_below]"]');
92
+ if ( show_above.attr('checked') != "undefined" && show_above.attr('checked') == true)
93
+ {
94
+ $('.above_option').toggleClass('hide');
95
+ }
96
+
97
+ if ( show_below.attr('checked') != "undefined" && show_below.attr('checked') == true)
98
+ {
99
+ $('.below_option').toggleClass('hide');
100
+ }
101
+
102
+ $('input[name="addthis_settings[show_above]"]').change( function() {
103
+ $('.above_option').toggleClass('hide');
104
+ });
105
+
106
+ $('input[name="addthis_settings[show_below]"]').change( function() {
107
+ $('.below_option').toggleClass('hide');
108
+ });
109
+
110
+
111
+ });
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === AddThis ===
2
- Contributors: _mjk_
3
  Tags: share, addthis, social, bookmark, sharing, bookmarking, widget
4
- Requires at least: 2.3
5
- Tested up to: 3.0.1
6
- Stable tag: 1.6.8
7
 
8
  The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with many popular services.
9
 
@@ -16,9 +16,21 @@ Optionally, sign up for a free AddThis.com account to see how your visitors are
16
 
17
  == Installation ==
18
 
19
- 1. Upload `addthis_social_widget.php` to the `/wp-content/plugins/` directory
20
- 1. Activate the plugin through the 'Plugins' menu in WordPress
21
- 1. (Optional) Customize the plugin in the Settings > AddThis menu
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  Note: due to confusion, there are no longer separate versions for PHP4 and PHP5.
24
 
@@ -34,7 +46,7 @@ No. You only need to create an account if you want to see how your users are sha
34
 
35
  = Is JavaScript required? =
36
 
37
- If you've turned on the drop-down menu (which is recommended, as it's been shown to increase sharing/bookmarking rates), JavaScript must be enabled. We load the actual interface via JavaScript at run-time, which allows us to upgrade the core functionality of the menu itself automatically everywhere.
38
 
39
  = Why use AddThis? =
40
  1. Ease of use. AddThis is easy to install, customize and localize. We've worked hard to make it the simplest, most recognized sharing tool on the internet.
@@ -52,20 +64,29 @@ We currently support over 295 services, from email and blogging platforms to soc
52
 
53
  == Screenshots ==
54
 
55
- 1. The button on a sample post.
56
- 2. The open menu on a sample post.
57
- 3. The settings interface on WordPress 2.7.
58
- 4. A sample sharing trend report.
59
- 5. A sample service usage report.
60
 
61
  == PHP Version ==
62
 
63
  PHP 5+ is preferred; PHP 4 is supported.
64
 
65
  == Changelog ==
66
- = 1.6.8 =
67
- * Ensured all ampersands are properly encoded
68
- * Added SSL support to admin dashboard
 
 
 
 
 
 
 
 
 
 
 
69
 
70
  = 1.6.7 =
71
  * Using wp_register_sidebar_widget() in WordPress installs that support it
@@ -75,7 +96,7 @@ PHP 5+ is preferred; PHP 4 is supported.
75
 
76
  = 1.6.5 =
77
  * Added support for arbitrary URL and title in template tag as optional parameters
78
- * i.e., &lt;?php do_action( 'addthis_widget', $url, $title); ?&gt;
79
  * Can be called, for example, with get_permalink() and the_title() within a post loop, or some other URL if necessary
80
 
81
  = 1.6.4 =
@@ -101,3 +122,12 @@ Fixed nondeterministic bug with the_title(), causing the title to occasionally a
101
  * Added support for displaying basic sharing metrics in the WordPress dashboard
102
  * Updated settings management to use nonces
103
 
 
 
 
 
 
 
 
 
 
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.0
6
+ Stable tag: 2.0.1
7
 
8
  The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with many popular services.
9
 
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
23
+ 1. Search for 'AddThis'
24
+ 1. Click 'Install Now' and activate the plugin
25
+
26
+ For a manual installation via FTP:
27
+
28
+ 1. Upload the addthis folder to the `/wp-content/plugins/` directory
29
+ 1. Activate the plugin through the 'Plugins' screen in your WordPress admin area
30
+
31
+ 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
 
46
 
47
  = Is JavaScript required? =
48
 
49
+ All of the options required through this plugin require javascript. JavaScript must be enabled. We load the actual interface via JavaScript at run-time, which allows us to upgrade the core functionality of the menu itself automatically everywhere.
50
 
51
  = Why use AddThis? =
52
  1. Ease of use. AddThis is easy to install, customize and localize. We've worked hard to make it the simplest, most recognized sharing tool on the internet.
64
 
65
  == Screenshots ==
66
 
67
+ 1. The admin dashboard widget
68
+ 2. Previewing how your options look
69
+ 3. The settings interface.
 
 
70
 
71
  == PHP Version ==
72
 
73
  PHP 5+ is preferred; PHP 4 is supported.
74
 
75
  == Changelog ==
76
+
77
+ = 2.0.1 =
78
+ * Fix theme compatablity issues
79
+ * Fix excerpts bug
80
+ * Add option to not display on excerpts
81
+ * Restore option to customize services
82
+ * Add more filters
83
+
84
+ = 2.0.0 =
85
+ * Redesigned Settings page
86
+ * Added Share Counter option
87
+ * Redesigned Admin Dashboard widget
88
+ * Updated sharing widget options
89
+ * Updated sidebar widget to extend WP_Widget
90
 
91
  = 1.6.7 =
92
  * Using wp_register_sidebar_widget() in WordPress installs that support it
96
 
97
  = 1.6.5 =
98
  * Added support for arbitrary URL and title in template tag as optional parameters
99
+ * i.e., <?php do_action( 'addthis_widget', $url, $title); ?>
100
  * Can be called, for example, with get_permalink() and the_title() within a post loop, or some other URL if necessary
101
 
102
  = 1.6.4 =
122
  * Added support for displaying basic sharing metrics in the WordPress dashboard
123
  * Updated settings management to use nonces
124
 
125
+
126
+ == Upgrade Notice ==
127
+
128
+ = 2.0.1 =
129
+ Bug Fixes, more filters, small tweak to options
130
+
131
+ = 2.0.0 =
132
+ More and better options for sharing widgets. Redesigned analytics dashboard widget and interface.
133
+
screenshot-1.gif DELETED
Binary file
screenshot-1.png ADDED
Binary file
screenshot-2.gif DELETED
Binary file
screenshot-2.png ADDED
Binary file
screenshot-3.gif DELETED
Binary file
screenshot-3.png ADDED
Binary file
screenshot-4.gif DELETED
Binary file
screenshot-5.gif DELETED
Binary file