Clicky by Yoast - Version 1.4

Version Description

  • Interface cleanup, interface no longer breaks on smaller resolutions.
  • No more unneeded JavaScript being loaded on the admin pages.
  • Made the Goal Tracking box work for all post types and made it smaller.
  • Removed some code that was no longer used.
  • Removed dashboard widget, added Yoast news widget to settings page.
  • Added a small stats indicator of visitors in the last 48 to the WordPress toolbar.
Download this release

Release Info

Developer joostdevalk
Plugin Icon 128x128 Clicky by Yoast
Version 1.4
Comparing to
See all releases

Code changes from version 1.3 to 1.4

clicky.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Clicky for WordPress
4
- Version: 1.3
5
  Plugin URI: http://getclicky.com/goodies/#wordpress
6
  Description: Integrates Clicky on your blog!
7
  Author: Joost de Valk
@@ -10,7 +10,7 @@ Author URI: http://yoast.com/
10
 
11
  load_plugin_textdomain('clicky','','/clicky/lang/');
12
 
13
- if ( is_admin() && ! class_exists( 'Clicky_Admin' ) ) {
14
 
15
  require_once('yst_plugin_tools.php');
16
 
@@ -19,14 +19,13 @@ if ( is_admin() && ! class_exists( 'Clicky_Admin' ) ) {
19
  var $hook = 'clicky';
20
  var $longname = 'Clicky Configuration';
21
  var $shortname = 'Clicky';
22
- var $shorturl_service = 'Clicky.me';
23
- var $filename = 'clicky/clicky.php';
24
- var $homepage = 'http://getclicky.com/goodies/';
25
  var $feed = 'http://getclicky.com/blog/rss';
26
 
27
  function meta_box() {
28
- add_meta_box('clicky',$this->shortname,array('Clicky_Admin','clicky_meta_box'),'post','side');
29
- add_meta_box('clicky',$this->shortname,array('Clicky_Admin','clicky_meta_box'),'page','side');
 
30
  }
31
 
32
  function clicky_admin_warnings() {
@@ -50,9 +49,8 @@ if ( is_admin() && ! class_exists( 'Clicky_Admin' ) ) {
50
  $options = clicky_get_options();
51
  $clicky_goal = get_post_meta($post->ID,'_clicky_goal',true);
52
 
53
- echo '<p><strong>'.__('Goal Tracking', 'clicky').'</strong></p>';
54
  echo '<p>';
55
- printf(__('Clicky can track Goals for you too, %1$sread the documentation here%2$s. To be able to track a goal on this post, you need to specify the goal ID here. Optionally, you can also provide the goal revenue.'),'<a href="http://getclicky.com/stats/goals-setup">','</a>');
56
  echo '</p>';
57
  echo '<table>';
58
  echo '<tr><th style="text-align:left;"><label for="clicky_goal_id">'.__('Goal ID', 'clicky').':</label></th><td><input type="text" name="clicky_goal_id" id="clicky_goal_id" value="'.$clicky_goal['id'].'"/></td></tr>';
@@ -73,6 +71,9 @@ if ( is_admin() && ! class_exists( 'Clicky_Admin' ) ) {
73
  add_action('admin_menu', array(&$this,'meta_box'));
74
  add_action('publish_post', array(&$this,'clicky_insert_post'));
75
 
 
 
 
76
  $this->clicky_admin_warnings();
77
  }
78
 
@@ -176,7 +177,7 @@ if ( is_admin() && ! class_exists( 'Clicky_Admin' ) ) {
176
  $rows[] = array(
177
  'id' => 'ignore_admin',
178
  'label' => __('Ignore Admin users', 'clicky'),
179
- 'desc' => __('If you are using a caching plugin, such as WP-Supercache, please ensure that you have it configured to NOT use the cache for logged in users. Otherwise, admin users <em>will still</em> be tracked.', 'clicky'),
180
  'content' => '<input type="checkbox" '.checked($options['ignore_admin'],true,false).' name="ignore_admin" id="ignore_admin"/>',
181
  );
182
 
@@ -208,11 +209,10 @@ if ( is_admin() && ! class_exists( 'Clicky_Admin' ) ) {
208
  <div class="metabox-holder">
209
  <div class="meta-box-sortables">
210
  <?php
211
- $this->plugin_like('clicky');
212
  $this->donate();
213
- $this->plugin_support('clicky');
 
214
  $this->news();
215
-
216
  ?>
217
  </div>
218
  <br/><br/><br/>
@@ -221,6 +221,125 @@ if ( is_admin() && ! class_exists( 'Clicky_Admin' ) ) {
221
  </div>
222
  <?php
223
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  }
225
  $clicky_admin = new Clicky_Admin();
226
  }
1
  <?php
2
  /*
3
  Plugin Name: Clicky for WordPress
4
+ Version: 1.4
5
  Plugin URI: http://getclicky.com/goodies/#wordpress
6
  Description: Integrates Clicky on your blog!
7
  Author: Joost de Valk
10
 
11
  load_plugin_textdomain('clicky','','/clicky/lang/');
12
 
13
+ if ( ! class_exists( 'Clicky_Admin' ) ) {
14
 
15
  require_once('yst_plugin_tools.php');
16
 
19
  var $hook = 'clicky';
20
  var $longname = 'Clicky Configuration';
21
  var $shortname = 'Clicky';
22
+ var $homepage = 'http://yoast.com/wordpress/clicky/';
 
 
23
  var $feed = 'http://getclicky.com/blog/rss';
24
 
25
  function meta_box() {
26
+ foreach ( get_post_types() as $pt ) {
27
+ add_meta_box('clicky',__('Clicky Goal Tracking', 'clicky'),array('Clicky_Admin','clicky_meta_box'), $pt,'side');
28
+ }
29
  }
30
 
31
  function clicky_admin_warnings() {
49
  $options = clicky_get_options();
50
  $clicky_goal = get_post_meta($post->ID,'_clicky_goal',true);
51
 
 
52
  echo '<p>';
53
+ printf(__('Clicky can track Goals for you too, %1$sread the documentation here%2$s. To be able to track a goal on this post, you need to specify the goal ID here. Optionally, you can also provide the goal revenue.', 'clicky'),'<a href="http://getclicky.com/stats/goals-setup">','</a>');
54
  echo '</p>';
55
  echo '<table>';
56
  echo '<tr><th style="text-align:left;"><label for="clicky_goal_id">'.__('Goal ID', 'clicky').':</label></th><td><input type="text" name="clicky_goal_id" id="clicky_goal_id" value="'.$clicky_goal['id'].'"/></td></tr>';
71
  add_action('admin_menu', array(&$this,'meta_box'));
72
  add_action('publish_post', array(&$this,'clicky_insert_post'));
73
 
74
+
75
+ add_action( 'wp_head', array(&$this,'stats_admin_bar_head') );
76
+
77
  $this->clicky_admin_warnings();
78
  }
79
 
177
  $rows[] = array(
178
  'id' => 'ignore_admin',
179
  'label' => __('Ignore Admin users', 'clicky'),
180
+ 'desc' => __('If you are using a caching plugin, such as W3 Total Cache or WP-Supercache, please ensure that you have it configured to NOT use the cache for logged in users. Otherwise, admin users <em>will still</em> be tracked.', 'clicky'),
181
  'content' => '<input type="checkbox" '.checked($options['ignore_admin'],true,false).' name="ignore_admin" id="ignore_admin"/>',
182
  );
183
 
209
  <div class="metabox-holder">
210
  <div class="meta-box-sortables">
211
  <?php
 
212
  $this->donate();
213
+ $this->plugin_support();
214
+ $this->yoast_news();
215
  $this->news();
 
216
  ?>
217
  </div>
218
  <br/><br/><br/>
221
  </div>
222
  <?php
223
  }
224
+
225
+ function stats_admin_bar_head() {
226
+ // if ( function_exists( 'is_admin_bar_showing' ) && !is_admin_bar_showing() ) {
227
+ // return;
228
+ // }
229
+
230
+ add_action( 'admin_bar_menu', array(&$this, 'stats_admin_bar_menu'), 1200 );
231
+ ?>
232
+
233
+ <style type='text/css'>
234
+ #wpadminbar .quicklinks li#wp-admin-bar-stats {height:28px}
235
+ #wpadminbar .quicklinks li#wp-admin-bar-stats a {height:28px;padding:0}
236
+ #wpadminbar .quicklinks li#wp-admin-bar-stats a img {padding:4px 5px; height: 20px; width: 99px;
237
+ }
238
+ </style>
239
+ <?php
240
+ }
241
+
242
+ function stats_admin_bar_menu( &$wp_admin_bar ) {
243
+ $options = clicky_get_options();
244
+
245
+ $img_src = $this->create_graph();
246
+
247
+ $url = 'https://secure.getclicky.com/stats/?site_id='.$options['site_id'];
248
+
249
+ $title = __( 'Visitors over 48 hours. Click for more Clicky Site Stats.', 'clicky' );
250
+
251
+ $menu = array( 'id' => 'stats', 'title' => "<img width='99' height='20' src='$img_src' alt='$title' title='$title' />", 'href' => $url );
252
+
253
+ $wp_admin_bar->add_menu( $menu );
254
+ }
255
+
256
+ function create_graph() {
257
+ $options = clicky_get_options();
258
+
259
+ $resp = wp_remote_get("http://api.getclicky.com/api/stats/4?site_id=".$options['site_id']."&sitekey=".$options['site_key']."&type=visitors&hourly=1&date=last-3-days");
260
+
261
+ if ( !isset($resp['response']['code']) || $resp['response']['code'] != 200 )
262
+ return;
263
+
264
+ $xml = simplexml_load_string( $resp['body'] );
265
+
266
+ $i=0;
267
+ $j=0;
268
+ $k=0;
269
+ $values=array();
270
+ foreach($xml->type->date as $value)
271
+ {
272
+ foreach($xml->type->date[$i]->item->value as $art)//nested loop for multiple values in tag
273
+ {
274
+
275
+ $data=(int)($xml->type->date[$i]->item->value[$j]);//$i and $j is used to iterate multiples of both tags respectively
276
+ array_push($values,$data);
277
+ $j=$j+1;
278
+ $k++;
279
+ if ($k == 48)
280
+ break 2;
281
+ }
282
+ $j=0; //so that in next item it starts from 0(zero)
283
+ $i++;
284
+ }
285
+ if ( count($values) == 0 ) {
286
+ return;
287
+ }
288
+ $values = array_reverse($values);
289
+ //-----------------------------------------------------------------------------------------------------------------------------
290
+ //for graph
291
+ $img_width=99;
292
+ $img_height=20;
293
+ $margins=0;
294
+
295
+
296
+ # ---- Find the size of graph by substracting the size of borders
297
+ $graph_width=$img_width - $margins * 2;
298
+ $graph_height=$img_height - $margins * 2;
299
+ $img=imagecreate($img_width,$img_height);
300
+
301
+
302
+ $bar_width=0.01;
303
+ $total_bars=count($values);
304
+ $gap= ($graph_width- $total_bars * $bar_width ) / ($total_bars +1);
305
+
306
+ # ------- Define Colors ----------------
307
+ $bar_color=imagecolorallocate($img,220,220,220);
308
+
309
+ $black = imagecolorallocate($img, 0, 0, 0);
310
+ $background_color=imagecolortransparent($img, $black);
311
+ $border_color=imagecolorallocate($img,50,50,50);
312
+
313
+ # ------ Create the border around the graph ------
314
+
315
+ imagefilledrectangle($img,1,1,$img_width-2,$img_height-2,$border_color);
316
+ imagefilledrectangle($img,$margins,$margins,$img_width-1-$margins,$img_height-1-$margins,$background_color);
317
+
318
+ # ------- Max value is required to adjust the scale -------
319
+ $max_value=max($values);
320
+ $ratio= $graph_height/$max_value;
321
+
322
+
323
+ # ----------- Draw the bars here ------
324
+ for($i=0;$i< $total_bars; $i++)
325
+ {
326
+ # ------ Extract key and value pair from the current pointer position
327
+ list($key,$value)=each($values);
328
+ $x1= $margins + $gap + $i * ($gap+$bar_width) ;
329
+ $x2= $x1 + $bar_width;
330
+ $y1=$margins +$graph_height- intval($value * $ratio) ;
331
+ $y2=$img_height-$margins;
332
+ imagefilledrectangle($img,$x1,$y1,$x2,$y2,$bar_color);
333
+ }
334
+
335
+ ob_start();
336
+ imagepng($img);
337
+ $image = ob_get_contents();
338
+ ob_end_clean();
339
+
340
+ return 'data:image/png;base64,'.base64_encode($image);
341
+ }
342
+
343
  }
344
  $clicky_admin = new Clicky_Admin();
345
  }
images/facebook-icon.png ADDED
Binary file
images/google-plus-icon.png ADDED
Binary file
images/twitter-icon.png ADDED
Binary file
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Clicky by Yoast ===
2
  Contributors: joostdevalk
3
  Donate link: http://yoast.com/donate/
4
- Tags: analytics, statistics, clicky, getclicky
5
  Requires at least: 2.8
6
  Tested up to: 3.3
7
- Stable tag: 1.3
8
 
9
  Integrates the Clicky (from getClicky.com) web analytics service into your blog.
10
 
@@ -18,6 +18,8 @@ Integrates the [Clicky web analytics](http://getclicky.com/145844) service into
18
  * Stores comments as an action using the getClicky [internal data logging API](https://secure.getclicky.com/help/customization/manual#internal). This requires a [pro account](http://getclicky.com/145844) to work.
19
  * Option to track posts &amp; pages as goals and assign a revenue to that page or post.
20
  * An overview of your site's statistics on your dashboard.
 
 
21
 
22
  Read the authors [review of Clicky Analytics](http://yoast.com/clicky-analytics-review/) if you want to see a bit more of the cool integration this plugin provides.
23
 
@@ -32,9 +34,19 @@ Read the authors [review of Clicky Analytics](http://yoast.com/clicky-analytics-
32
 
33
  1. The Clicky WordPress plugin settings panel.
34
  2. The Clicky metabox on posts and pages.
 
35
 
36
  == Changelog ==
37
 
 
 
 
 
 
 
 
 
 
38
  = 1.3 =
39
 
40
  * Added support for the new [outbound link pattern matching](http://getclicky.com/blog/287/custom-outbound-link-pattern-matching-and-iframe-tracking).
1
  === Clicky by Yoast ===
2
  Contributors: joostdevalk
3
  Donate link: http://yoast.com/donate/
4
+ Tags: analytics, statistics, clicky, getclicky, affiliate, outbound links, analysis, Joost de Valk, Yoast
5
  Requires at least: 2.8
6
  Tested up to: 3.3
7
+ Stable tag: 1.4
8
 
9
  Integrates the Clicky (from getClicky.com) web analytics service into your blog.
10
 
18
  * Stores comments as an action using the getClicky [internal data logging API](https://secure.getclicky.com/help/customization/manual#internal). This requires a [pro account](http://getclicky.com/145844) to work.
19
  * Option to track posts &amp; pages as goals and assign a revenue to that page or post.
20
  * An overview of your site's statistics on your dashboard.
21
+ * Easily add outbound link pattern matching for affiliate links etc.
22
+ * Adds a small stats indicator of visitors in the last 48 to the WordPress toolbar.
23
 
24
  Read the authors [review of Clicky Analytics](http://yoast.com/clicky-analytics-review/) if you want to see a bit more of the cool integration this plugin provides.
25
 
34
 
35
  1. The Clicky WordPress plugin settings panel.
36
  2. The Clicky metabox on posts and pages.
37
+ 3. The stats indicator on the WordPress Toolbar.
38
 
39
  == Changelog ==
40
 
41
+ = 1.4 =
42
+
43
+ * Interface cleanup, interface no longer breaks on smaller resolutions.
44
+ * No more unneeded JavaScript being loaded on the admin pages.
45
+ * Made the Goal Tracking box work for all post types and made it smaller.
46
+ * Removed some code that was no longer used.
47
+ * Removed dashboard widget, added Yoast news widget to settings page.
48
+ * Added a small stats indicator of visitors in the last 48 to the WordPress toolbar.
49
+
50
  = 1.3 =
51
 
52
  * Added support for the new [outbound link pattern matching](http://getclicky.com/blog/287/custom-outbound-link-pattern-matching-and-iframe-tracking).
screenshot-1.jpg CHANGED
Binary file
screenshot-3.jpg ADDED
Binary file
yst_plugin_tools.css CHANGED
@@ -1,82 +1,99 @@
1
- td.yst_desc {
2
- font-weight: normal;
3
- font-size: 12px;
4
- line-height: 12px;
5
- color:#777;
6
- }
7
-
8
- tr.yst_row {
9
- padding: 5px 0 0 0;
10
- margin: 5px 0 0 0;
11
- }
12
- tr.yst_row.even {
13
- background-color: #f6f6f6;
14
- }
15
-
16
- div.inside ul {
17
- margin-left: 20px;
18
- }
19
-
20
- div.inside ul li {
21
- list-style: square;
22
- line-height:16px;
23
- }
24
-
25
- div.inside a, div.inside a.rsswidget {
26
- font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif;
27
- text-decoration: none;
28
- }
29
- div.inside a:hover, div.inside a.rsswidget:hover {
30
- text-decoration: underline;
31
- }
32
- div.inside ul li.rss {
33
- list-style-image: url(images/rss.png);
34
- }
35
-
36
- div.inside ul li.email {
37
- list-style-image: url(images/email_sub.png);
38
- }
39
-
40
- div.inside ul li.yoast {
41
- list-style-image: url(images/yoast-16x16.png);
42
- }
43
-
44
- .text {
45
- width: 250px;
46
- }
47
-
48
- .postbox p {
49
- text-align:left;
50
- margin: 0 10px 10px 10px;
51
- font-size: 13px;
52
- line-height: 150%;
53
- }
54
-
55
- .postbox pre {
56
- margin: 5px 10px;
57
- padding:4px;
58
- background: lightyellow;
59
- }
60
-
61
- .side .postbox p, .side .postbox a, .side .postbox a.rsswidget {
62
- font-size: 11px;
63
- }
64
 
65
- div.inside .button:hover, div.inside .button-primary:hover {
66
- text-decoration: none;
67
  }
68
 
69
- .button, .button-primary {
70
- margin-top: 10px;
71
  }
72
 
73
- .postbox#donate {
74
- border-color: green;
75
- border-width: 2px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  }
77
 
78
- strong.red {
79
- color: green;
80
- font-weight: bold;
81
- font-size: 105%;
82
  }
1
+ td.yst_desc {
2
+ font-weight: normal;
3
+ font-size: 12px;
4
+ line-height: 130%;
5
+ color:#777;
6
+ }
7
+
8
+ tr.yst_row {
9
+ padding: 5px 0 0 0;
10
+ margin: 5px 0 0 0;
11
+ }
12
+ tr.yst_row.even {
13
+ background-color: #f6f6f6;
14
+ }
15
+
16
+ div.inside ul {
17
+ margin-left: 20px;
18
+ }
19
+
20
+ div.inside ul li {
21
+ list-style: square;
22
+ line-height:16px;
23
+ }
24
+
25
+ div.inside a, div.inside a.rsswidget {
26
+ text-decoration: none;
27
+ }
28
+ div.inside a:hover, div.inside a.rsswidget:hover {
29
+ text-decoration: underline;
30
+ }
31
+ div.inside ul li.rss {
32
+ list-style-image: url(images/rss.png);
33
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
+ div.inside ul li.twitter {
36
+ list-style-image: url(images/twitter-icon.png);
37
  }
38
 
39
+ div.inside ul li.facebook {
40
+ list-style-image: url(images/facebook-icon.png);
41
  }
42
 
43
+ div.inside ul li.googleplus {
44
+ list-style-image: url(images/google-plus-icon.png);
45
+ }
46
+
47
+ div.inside ul li.email {
48
+ list-style-image: url(images/email_sub.png);
49
+ }
50
+
51
+ div.inside ul li.yoast {
52
+ list-style-image: url(images/yoast-16x16.png);
53
+ }
54
+
55
+ .text, .select {
56
+ width: 250px;
57
+ }
58
+
59
+ .postbox p {
60
+ text-align:left;
61
+ margin: 0 10px 10px 10px;
62
+ font-size: 13px;
63
+ line-height: 150%;
64
+ }
65
+
66
+ .postbox pre {
67
+ margin: 5px 10px;
68
+ padding:4px;
69
+ background: lightyellow;
70
+ }
71
+
72
+ .side .postbox p, .side .postbox a, .side .postbox a.rsswidget {
73
+ font-size: 13px;
74
+ }
75
+
76
+ div.inside .button:hover, div.inside .button-primary:hover {
77
+ text-decoration: none;
78
+ }
79
+
80
+ .button, .button-primary {
81
+ margin-top: 10px;
82
+ }
83
+
84
+ .postbox#donate {
85
+ border-color: green;
86
+ border-width: 2px;
87
+ }
88
+ strong.red {
89
+ color: green;
90
+ font-weight: bold;
91
+ font-size: 105%;
92
+ }
93
+ .postbox {
94
+ margin: 0 10px 10px 0;
95
  }
96
 
97
+ .postbox .hndle {
98
+ cursor: default;
 
 
99
  }
yst_plugin_tools.php CHANGED
@@ -9,39 +9,26 @@ if (!class_exists('Clicky_Base_Plugin_Admin')) {
9
  class Clicky_Base_Plugin_Admin {
10
 
11
  var $hook = '';
12
- var $filename = '';
13
  var $longname = '';
14
  var $shortname = '';
15
  var $ozhicon = '';
16
  var $optionname = '';
17
  var $homepage = '';
18
- var $feed = 'http://getclicky.com/blog/rss';
19
  var $accesslvl = 'manage_options';
20
 
21
  function Yoast_Plugin_Admin() {
22
  add_action( 'admin_menu', array(&$this, 'register_settings_page') );
23
  add_filter( 'plugin_action_links', array(&$this, 'add_action_link'), 10, 2 );
24
- add_filter( 'ozh_adminmenu_icon', array(&$this, 'add_ozh_adminmenu_icon' ) );
25
 
26
  add_action('admin_print_scripts', array(&$this,'config_page_scripts'));
27
- add_action('admin_print_styles', array(&$this,'config_page_styles'));
28
 
29
  add_action('wp_dashboard_setup', array(&$this,'widget_setup'));
30
  }
31
 
32
- function add_ozh_adminmenu_icon( $hook ) {
33
- if ($hook == $this->hook)
34
- return WP_CONTENT_URL . '/plugins/' . plugin_basename(dirname($filename)). '/'.$this->ozhicon;
35
- return $hook;
36
- }
37
-
38
  function config_page_styles() {
39
  if (isset($_GET['page']) && $_GET['page'] == $this->hook) {
40
- wp_enqueue_style('dashboard');
41
- wp_enqueue_style('thickbox');
42
- wp_enqueue_style('global');
43
- wp_enqueue_style('wp-admin');
44
- wp_enqueue_style('blogicons-admin-css', WP_CONTENT_URL . '/plugins/' . plugin_basename(dirname(__FILE__)). '/yst_plugin_tools.css');
45
  }
46
  }
47
 
@@ -70,15 +57,6 @@ if (!class_exists('Clicky_Base_Plugin_Admin')) {
70
 
71
  }
72
 
73
- function config_page_scripts() {
74
- if (isset($_GET['page']) && $_GET['page'] == $this->hook) {
75
- wp_enqueue_script('postbox');
76
- wp_enqueue_script('dashboard');
77
- wp_enqueue_script('thickbox');
78
- wp_enqueue_script('media-upload');
79
- }
80
- }
81
-
82
  /**
83
  * Create a Checkbox input field
84
  */
@@ -101,7 +79,6 @@ if (!class_exists('Clicky_Base_Plugin_Admin')) {
101
  function postbox($id, $title, $content) {
102
  ?>
103
  <div id="<?php echo $id; ?>" class="postbox">
104
- <div class="handlediv" title="Click to toggle"><br /></div>
105
  <h3 class="hndle"><span><?php echo $title; ?></span></h3>
106
  <div class="inside">
107
  <?php echo $content; ?>
@@ -135,7 +112,7 @@ if (!class_exists('Clicky_Base_Plugin_Admin')) {
135
  $content .= $row['content'];
136
  $content .= '</td></tr>';
137
  if ( isset($row['desc']) && !empty($row['desc']) ) {
138
- $content .= '<tr class="'.$row['id'].'_row '.$class.'"><td colspan="2" class="yst_desc"><small>'.$row['desc'].'</small></td></tr>';
139
  }
140
 
141
  $i++;
@@ -151,13 +128,13 @@ if (!class_exists('Clicky_Base_Plugin_Admin')) {
151
  if (empty($hook)) {
152
  $hook = $this->hook;
153
  }
154
- $content = '<p>'.__('Why not do any or all of the following:','ystplugin').'</p>';
155
  $content .= '<ul>';
156
- $content .= '<li><a href="'.$this->homepage.'">'.__('Link to it so other folks can find out about it.','ystplugin').'</a></li>';
157
- $content .= '<li><a href="http://wordpress.org/extend/plugins/'.$hook.'/">'.__('Give it a good rating on WordPress.org.','ystplugin').'</a></li>';
158
- $content .= '<li><a href="http://wordpress.org/extend/plugins/'.$hook.'/">'.__('Let other people know that it works with your WordPress setup.','ystplugin').'</a></li>';
159
  $content .= '</ul>';
160
- $this->postbox($hook.'like', 'Like this plugin?', $content);
161
  }
162
 
163
  /**
@@ -167,8 +144,8 @@ if (!class_exists('Clicky_Base_Plugin_Admin')) {
167
  if (empty($hook)) {
168
  $hook = $this->hook;
169
  }
170
- $content = '<p>If you\'ve found a bug in this plugin, please submit it in the <a href="http://yoast.com/bugs/clicky/">Yoast Bug Tracker</a> with a clear description.</p>';
171
- $this->postbox($this->hook.'support', __('Found a bug?','ystplugin'), $content);
172
  }
173
 
174
  /**
@@ -177,36 +154,68 @@ if (!class_exists('Clicky_Base_Plugin_Admin')) {
177
  function news( ) {
178
  include_once(ABSPATH . WPINC . '/feed.php');
179
  $rss = fetch_feed( $this->feed );
180
- $rss_items = $rss->get_items( 0, $rss->get_item_quantity(5) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  $content = '<ul>';
182
  if ( !$rss_items ) {
183
- $content .= '<li class="yoast">no news items, feed might be broken...</li>';
184
  } else {
185
  foreach ( $rss_items as $item ) {
 
186
  $content .= '<li class="yoast">';
187
- $content .= '<a class="rsswidget" href="'.esc_url( $item->get_permalink(), $protocolls=null, 'display' ).'">'. htmlentities($item->get_title()) .'</a> ';
188
  $content .= '</li>';
189
  }
190
  }
191
- $content .= '<li class="rss"><a href="http://yoast.com/feed/">Subscribe with RSS</a></li>';
192
- $content .= '<li class="email"><a href="http://yoast.com/email-blog-updates/">Subscribe by email</a></li>';
 
 
 
193
  $content .= '</ul>';
194
- $this->postbox('yoastlatest', 'Latest news from Clicky', $content);
195
  }
196
 
197
  /**
198
  * Donation box
199
  */
200
  function donate() {
201
- $this->postbox('donate','<strong class="red">Donate $10, $20 or $50!</strong>','<p>This plugin has cost me countless hours of work, if you use it, please donate a token of your appreciation!</p><br/>
202
- <form style="margin-left:50px;" action="https://www.paypal.com/cgi-bin/webscr" method="post">
203
  <input type="hidden" name="cmd" value="_s-xclick">
204
  <input type="hidden" name="hosted_button_id" value="KWQT234DEG7KY">
205
- <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
206
- <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
207
- </form>');
 
 
 
 
 
208
  }
209
 
 
210
  function text_limit( $text, $limit, $finish = ' [&hellip;]') {
211
  if( strlen( $text ) > $limit ) {
212
  $text = substr( $text, 0, $limit );
@@ -216,45 +225,6 @@ if (!class_exists('Clicky_Base_Plugin_Admin')) {
216
  return $text;
217
  }
218
 
219
- function db_widget() {
220
- $options = get_option('yoastdbwidget');
221
- if (isset($_POST['yoast_removedbwidget'])) {
222
- $options['removedbwidget'] = true;
223
- update_option('yoastdbwidget',$options);
224
- }
225
- if ($options['removedbwidget']) {
226
- echo "If you reload, this widget will be gone and never appear again, unless you decide to delete the database option 'yoastdbwidget'.";
227
- return;
228
- }
229
- require_once(ABSPATH.WPINC.'/rss.php');
230
- if ( $rss = fetch_rss( 'http://yoast.com/feed/' ) ) {
231
- echo '<div class="rss-widget">';
232
- echo '<a href="http://yoast.com/" title="Go to Yoast.com"><img src="http://netdna.yoast.com/yoast-logo-rss.png" class="alignright" alt="Yoast"/></a>';
233
- echo '<ul>';
234
- $rss->items = array_slice( $rss->items, 0, 3 );
235
- foreach ( (array) $rss->items as $item ) {
236
- echo '<li>';
237
- echo '<a class="rsswidget" href="'.clean_url( $item['link'], $protocolls=null, 'display' ).'">'. htmlentities($item['title']) .'</a> ';
238
- echo '<span class="rss-date">'. date('F j, Y', strtotime($item['pubdate'])) .'</span>';
239
- echo '<div class="rssSummary">'. $this->text_limit($item['summary'],250) .'</div>';
240
- echo '</li>';
241
- }
242
- echo '</ul>';
243
- echo '<div style="border-top: 1px solid #ddd; padding-top: 10px; text-align:center;">';
244
- echo '<a href="http://feeds2.feedburner.com/joostdevalk"><img src="'.get_bloginfo('wpurl').'/wp-includes/images/rss.png" alt=""/> Subscribe with RSS</a>';
245
- echo ' &nbsp; &nbsp; &nbsp; ';
246
- echo '<a href="http://yoast.com/email-blog-updates/"><img src="http://netdna.yoast.com/email_sub.png" alt=""/> Subscribe by email</a>';
247
- echo '<form class="alignright" method="post"><input type="hidden" name="yoast_removedbwidget" value="true"/><input title="Remove this widget from all users dashboards" type="submit" value="X"/></form>';
248
- echo '</div>';
249
- echo '</div>';
250
- }
251
- }
252
-
253
- function widget_setup() {
254
- $options = get_option('yoastdbwidget');
255
- if (!$options['removedbwidget'])
256
- wp_add_dashboard_widget( 'yoast_db_widget' , 'The Latest news from Yoast' , array(&$this, 'db_widget'));
257
- }
258
  }
259
  }
260
 
9
  class Clicky_Base_Plugin_Admin {
10
 
11
  var $hook = '';
 
12
  var $longname = '';
13
  var $shortname = '';
14
  var $ozhicon = '';
15
  var $optionname = '';
16
  var $homepage = '';
 
17
  var $accesslvl = 'manage_options';
18
 
19
  function Yoast_Plugin_Admin() {
20
  add_action( 'admin_menu', array(&$this, 'register_settings_page') );
21
  add_filter( 'plugin_action_links', array(&$this, 'add_action_link'), 10, 2 );
 
22
 
23
  add_action('admin_print_scripts', array(&$this,'config_page_scripts'));
24
+ add_action('admin_print_scripts', array(&$this,'config_page_styles'));
25
 
26
  add_action('wp_dashboard_setup', array(&$this,'widget_setup'));
27
  }
28
 
 
 
 
 
 
 
29
  function config_page_styles() {
30
  if (isset($_GET['page']) && $_GET['page'] == $this->hook) {
31
+ wp_enqueue_style('clicky-admin-css', WP_CONTENT_URL . '/plugins/' . plugin_basename(dirname(__FILE__)). '/yst_plugin_tools.css');
 
 
 
 
32
  }
33
  }
34
 
57
 
58
  }
59
 
 
 
 
 
 
 
 
 
 
60
  /**
61
  * Create a Checkbox input field
62
  */
79
  function postbox($id, $title, $content) {
80
  ?>
81
  <div id="<?php echo $id; ?>" class="postbox">
 
82
  <h3 class="hndle"><span><?php echo $title; ?></span></h3>
83
  <div class="inside">
84
  <?php echo $content; ?>
112
  $content .= $row['content'];
113
  $content .= '</td></tr>';
114
  if ( isset($row['desc']) && !empty($row['desc']) ) {
115
+ $content .= '<tr class="'.$row['id'].'_row '.$class.'"><td colspan="2" class="yst_desc">'.$row['desc'].'</td></tr>';
116
  }
117
 
118
  $i++;
128
  if (empty($hook)) {
129
  $hook = $this->hook;
130
  }
131
+ $content = '<p>'.__('Why not do any or all of the following:', 'clicky' ).'</p>';
132
  $content .= '<ul>';
133
+ $content .= '<li><a href="'.$this->homepage.'">'.__('Link to it so other folks can find out about it.', 'clicky' ).'</a></li>';
134
+ $content .= '<li><a href="http://wordpress.org/extend/plugins/'.$hook.'/">'.__('Give it a 5 star rating on WordPress.org.', 'clicky' ).'</a></li>';
135
+ $content .= '<li><a href="http://wordpress.org/extend/plugins/'.$hook.'/">'.__('Let other people know that it works with your WordPress setup.', 'clicky' ).'</a></li>';
136
  $content .= '</ul>';
137
+ $this->postbox($hook.'like', __( 'Like this plugin?', 'clicky' ), $content);
138
  }
139
 
140
  /**
144
  if (empty($hook)) {
145
  $hook = $this->hook;
146
  }
147
+ $content = '<p>'.__("If you're in need of support with Clicky and / or this plugin, please visit the <a href='https://secure.getclicky.com/forums/'>Clicky forums</a>.", 'clicky').'</p>';
148
+ $this->postbox($this->hook.'support', __('Need Support?','clicky'), $content);
149
  }
150
 
151
  /**
154
  function news( ) {
155
  include_once(ABSPATH . WPINC . '/feed.php');
156
  $rss = fetch_feed( $this->feed );
157
+ $rss_items = $rss->get_items( 0, $rss->get_item_quantity(3) );
158
+ $content = '<ul>';
159
+ if ( !$rss_items ) {
160
+ $content .= '<li class="yoast">'.__( 'No news items, feed might be broken...', 'clicky' ).'</li>';
161
+ } else {
162
+ foreach ( $rss_items as $item ) {
163
+ $url = preg_replace( '/#.*/', '', esc_url( $item->get_permalink(), $protocolls=null, 'display' ) );
164
+ $content .= '<li class="yoast">';
165
+ $content .= '<a class="rsswidget" href="'.$url.'#utm_source=wpadmin&utm_medium=sidebarwidget&utm_term=newsitem&utm_campaign=clickywpplugin">'. esc_html( $item->get_title() ) .'</a> ';
166
+ $content .= '</li>';
167
+ }
168
+ }
169
+ $content .= '<li class="rss"><a href="'.$this->feed.'">'.__( 'Subscribe with RSS', 'clicky' ).'</a></li>';
170
+ $content .= '</ul>';
171
+ $this->postbox('clickylatest', __( 'Latest news from Clicky' , 'clicky' ), $content);
172
+ }
173
+
174
+ /**
175
+ * Box with latest news from Yoast.com for sidebar
176
+ */
177
+ function yoast_news() {
178
+ $rss = fetch_feed('http://feeds.feedburner.com/joostdevalk');
179
+ $rss_items = $rss->get_items( 0, $rss->get_item_quantity(3) );
180
+
181
  $content = '<ul>';
182
  if ( !$rss_items ) {
183
+ $content .= '<li class="yoast">'.__( 'No news items, feed might be broken...', 'clicky' ).'</li>';
184
  } else {
185
  foreach ( $rss_items as $item ) {
186
+ $url = preg_replace( '/#.*/', '', esc_url( $item->get_permalink(), $protocolls=null, 'display' ) );
187
  $content .= '<li class="yoast">';
188
+ $content .= '<a class="rsswidget" href="'.$url.'#utm_source=wpadmin&utm_medium=sidebarwidget&utm_term=newsitem&utm_campaign=clickywpplugin">'. esc_html( $item->get_title() ) .'</a> ';
189
  $content .= '</li>';
190
  }
191
  }
192
+ $content .= '<li class="facebook"><a href="https://www.facebook.com/yoastcom">'.__( 'Like Yoast on Facebook', 'clicky' ).'</a></li>';
193
+ $content .= '<li class="twitter"><a href="http://twitter.com/yoast">'.__( 'Follow Yoast on Twitter', 'clicky' ).'</a></li>';
194
+ $content .= '<li class="googleplus"><a href="https://plus.google.com/115369062315673853712/posts">'.__( 'Circle Yoast on Google+', 'clicky' ).'</a></li>';
195
+ $content .= '<li class="rss"><a href="'.$this->feed.'">'.__( 'Subscribe with RSS', 'clicky' ).'</a></li>';
196
+ $content .= '<li class="email"><a href="http://yoast.com/wordpress-newsletter/">'.__( 'Subscribe by email', 'clicky' ).'</a></li>';
197
  $content .= '</ul>';
198
+ $this->postbox('yoastlatest', __( 'Latest news from Yoast', 'clicky' ), $content);
199
  }
200
 
201
  /**
202
  * Donation box
203
  */
204
  function donate() {
205
+ $this->postbox('donate','<strong class="red">'.__( 'Like this plugin?', 'clicky' ).'</strong>','<p><strong>'.__( 'Want to help make it better? All donations are used to improve this plugin, so donate $10, $20 or $50 now!', 'clicky' ).'</strong></p><form style="width:160px;margin:0 auto;" action="https://www.paypal.com/cgi-bin/webscr" method="post">
 
206
  <input type="hidden" name="cmd" value="_s-xclick">
207
  <input type="hidden" name="hosted_button_id" value="KWQT234DEG7KY">
208
+ <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit">
209
+ <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
210
+ </form>'
211
+ .'<p>'.__('Or you could:', 'clicky').'</p>'
212
+ .'<ul>'
213
+ .'<li><a href="http://wordpress.org/extend/plugins/clicky/">'.__('Rate the plugin 5★ on WordPress.org', 'clicky').'</a></li>'
214
+ .'<li><a href="http://yoast.com/wordpress/clicky/#utm_source=wpadmin&utm_medium=sidebanner&utm_term=link&utm_campaign=clickywpplugin">'.__('Blog about it & link to the plugin page', 'clicky').'</a></li>'
215
+ .'</ul>');
216
  }
217
 
218
+
219
  function text_limit( $text, $limit, $finish = ' [&hellip;]') {
220
  if( strlen( $text ) > $limit ) {
221
  $text = substr( $text, 0, $limit );
225
  return $text;
226
  }
227
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  }
229
  }
230