I Recommend This - Version 2.1.5

Version Description

Download this release

Release Info

Developer hchouhan
Plugin Icon 128x128 I Recommend This
Version 2.1.5
Comparing to
See all releases

Code changes from version 2.1.4 to 2.1.5

Files changed (2) hide show
  1. dot-irecommendthis.php +171 -171
  2. readme.txt +9 -6
dot-irecommendthis.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
- /**
3
  * Plugin Name: I Recommend This
4
  * Plugin URI: http://www.harishchouhan.com/personal-projects/i-recommend-this/
5
  * Description: This plugin allows your visitors to simply recommend or like your posts instead of commment it.
6
- * Version: 2.1.4
7
  * Author: Harish Chouhan
8
  * Author URI: http://www.harishchouhan.com
9
  * Author Email: me@harishchouhan.com
@@ -18,7 +18,7 @@
18
  Copyright 2013 "I Recommend This WordPress Plugin" (me@harishchouhan.coms)
19
 
20
  This program is free software; you can redistribute it and/or modify
21
- it under the terms of the GNU General Public License, version 2, as
22
  published by the Free Software Foundation.
23
 
24
  This program is distributed in the hope that it will be useful,
@@ -29,31 +29,31 @@
29
  You should have received a copy of the GNU General Public License
30
  along with this program; if not, write to the Free Software
31
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32
-
33
  */
34
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
35
- if ( ! class_exists( 'DOT_IRecommendThis' ) )
36
  {
37
-
38
-
39
  class DOT_IRecommendThis {
40
-
41
- public $version = '2.1.3';
42
-
43
  /*--------------------------------------------*
44
  * Constructor
45
  *--------------------------------------------*/
46
-
47
- function __construct( $file )
48
- {
49
  $this->file = $file;
50
-
51
  // Run this on activation / deactivation
52
  register_activation_hook( $file, array( $this, 'activate' ) );
53
-
54
  // Load text domain
55
  add_action( 'init', array( &$this, 'load_localisation' ), 0 );
56
-
57
  add_action( 'admin_menu', array( &$this, 'dot_irecommendthis_menu' ) );
58
  add_action( 'admin_init', array( &$this, 'dot_irecommendthis_settings' ) );
59
  add_action( 'init', array( &$this, 'add_widget_most_recommended_posts' ) );
@@ -63,20 +63,20 @@ if ( ! class_exists( 'DOT_IRecommendThis' ) )
63
  add_action( 'wp_ajax_dot-irecommendthis', array( &$this, 'ajax_callback' ) );
64
  add_action( 'wp_ajax_nopriv_dot-irecommendthis', array( &$this, 'ajax_callback' ) );
65
  add_shortcode( 'dot_recommends', array( &$this, 'shortcode' ) );
66
-
67
- } // end constructor
68
-
69
 
70
  /*--------------------------------------------*
71
  * Activate
72
  *--------------------------------------------*/
73
-
74
  public function activate( $network_wide ) {
75
  if (!isset($wpdb)) $wpdb = $GLOBALS['wpdb'];
76
  global $wpdb;
77
-
78
  $table_name = $wpdb->prefix . "irecommendthis_votes";
79
- if($wpdb->get_var("show tables like '$table_name'") != $table_name)
80
  {
81
  $sql = "CREATE TABLE " . $table_name . " (
82
  id MEDIUMINT(9) NOT NULL AUTO_INCREMENT,
@@ -85,40 +85,40 @@ if ( ! class_exists( 'DOT_IRecommendThis' ) )
85
  ip VARCHAR(15) NOT NULL,
86
  UNIQUE KEY id (id)
87
  );";
88
-
89
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
90
-
91
  dbDelta($sql);
92
-
93
  $this->register_plugin_version();
94
-
95
  add_option("dot_irecommendthis_db_version", $dot_irecommendthis_db_version);
96
  }
97
-
98
  } // end activate
99
-
100
  private function register_plugin_version () {
101
  if ( $this->version != '' ) {
102
  update_option( 'dot-irecommendthis' . '-version', $this->version );
103
  }
104
  } // End register_plugin_version()
105
-
106
  /*--------------------------------------------*
107
  * Localisation | Public | 1.4.6 | Return : void
108
  *--------------------------------------------*/
109
-
110
- public function load_localisation ()
111
  {
112
  load_plugin_textdomain( 'dot', false, dirname( plugin_basename( $this->file ) ) . '/languages/' );
113
-
114
  } // End load_localisation()
115
-
116
-
117
  /*--------------------------------------------*
118
  * Admin Menu
119
  *--------------------------------------------*/
120
-
121
- function dot_irecommendthis_menu()
122
  {
123
  $page_title = __('I Recommend This', 'dot');
124
  $menu_title = __('I Recommend This', 'dot');
@@ -126,18 +126,18 @@ if ( ! class_exists( 'DOT_IRecommendThis' ) )
126
  $menu_slug = 'dot-irecommendthis';
127
  $function = array( &$this, 'dot_settings_page');
128
  add_options_page($page_title, $menu_title, $capability, $menu_slug, $function);
129
-
130
  } //dot_irecommendthis_menu
131
-
132
-
133
  /*--------------------------------------------*
134
  * Settings & Settings Page
135
  *--------------------------------------------*/
136
-
137
  public function dot_irecommendthis_settings() // whitelist options
138
- {
139
  register_setting( 'dot-irecommendthis', 'dot_irecommendthis_settings', array(&$this, 'settings_validate') );
140
- add_settings_section( 'dot-irecommendthis', '', array(&$this, 'section_intro'), 'dot-irecommendthis' );
141
  add_settings_field( 'show_on', __( 'Automatically display on', 'dot' ), array(&$this, 'setting_show_on'), 'dot-irecommendthis', 'dot-irecommendthis' );
142
  add_settings_field( 'text_zero_suffix', __( 'Text after 0 Count', 'dot' ), array(&$this, 'setting_text_zero_suffix'), 'dot-irecommendthis', 'dot-irecommendthis' );
143
  add_settings_field( 'text_one_suffix', __( 'Text after 1 Count', 'dot' ), array(&$this, 'setting_text_one_suffix'), 'dot-irecommendthis', 'dot-irecommendthis' );
@@ -145,11 +145,11 @@ if ( ! class_exists( 'DOT_IRecommendThis' ) )
145
  add_settings_field( 'disable_css', __( 'Disable CSS', 'dot' ), array(&$this, 'setting_disable_css'), 'dot-irecommendthis', 'dot-irecommendthis' );
146
  add_settings_field( 'recommend_style', __( 'Choose a style', 'dot' ), array(&$this, 'setting_recommend_style'), 'dot-irecommendthis', 'dot-irecommendthis' );
147
  add_settings_field( 'instructions', __( 'Shortcode and Template Tag', 'dot' ), array(&$this, 'setting_instructions'), 'dot-irecommendthis', 'dot-irecommendthis' );
148
-
149
  } //dot_irecommendthis_settings
150
-
151
-
152
- public function dot_settings_page()
153
  {
154
  ?>
155
  <div class="wrap">
@@ -165,7 +165,7 @@ if ( ! class_exists( 'DOT_IRecommendThis' ) )
165
  </div>
166
  </div>-->
167
  </div> <!-- //inner-sidebar -->
168
-
169
  <!-- MAIN CONTENT -->
170
  <div id="post-body">
171
  <div id="post-body-content">
@@ -179,25 +179,25 @@ if ( ! class_exists( 'DOT_IRecommendThis' ) )
179
  </div> <!-- //metabox-holder -->
180
  </div>
181
  <?php
182
-
183
  } //dot_settings_page
184
-
185
- function section_intro()
186
  {
187
  ?>
188
 
189
  <p><?php _e('<a href="https://twitter.com/harishchouhan" class="twitter-follow-button" data-show-count="false">Follow @harishchouhan</a>
190
  <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> or Check out our other themes & plugins at <a href="http://www.dreamsonline.net">Dreams Online Themes</a>.', 'dot'); ?></p>
191
  <p><?php _e('This plugin allows your visitors to simply recommend or like your posts instead of commment it.', 'dot'); ?></p>
192
- <?php
193
- }
194
-
195
- function setting_show_on()
196
  {
197
  $options = get_option( 'dot_irecommendthis_settings' );
198
  if( !isset($options['add_to_posts']) ) $options['add_to_posts'] = '0';
199
  if( !isset($options['add_to_other']) ) $options['add_to_other'] = '0';
200
-
201
  echo '<input type="hidden" name="dot_irecommendthis_settings[add_to_posts]" value="0" />
202
  <label><input type="checkbox" name="dot_irecommendthis_settings[add_to_posts]" value="1"'. (($options['add_to_posts']) ? ' checked="checked"' : '') .' />
203
  '. __('Posts', 'dot') .'</label><br />
@@ -205,81 +205,81 @@ if ( ! class_exists( 'DOT_IRecommendThis' ) )
205
  <label><input type="checkbox" name="dot_irecommendthis_settings[add_to_other]" value="1"'. (($options['add_to_other']) ? ' checked="checked"' : '') .' />
206
  '. __('All other pages like Index, Archive, etc.', 'dot') .'</label><br />';
207
  }
208
-
209
- function setting_disable_css()
210
  {
211
  $options = get_option( 'dot_irecommendthis_settings' );
212
  if( !isset($options['disable_css']) ) $options['disable_css'] = '0';
213
-
214
  echo '<input type="hidden" name="dot_irecommendthis_settings[disable_css]" value="0" />
215
  <label><input type="checkbox" name="dot_irecommendthis_settings[disable_css]" value="1"'. (($options['disable_css']) ? ' checked="checked"' : '') .' />
216
  I want to use my own CSS styles</label>';
217
  }
218
-
219
- function setting_text_zero_suffix()
220
  {
221
  $options = get_option( 'dot_irecommendthis_settings' );
222
  if( !isset($options['text_zero_suffix']) ) $options['text_zero_suffix'] = '';
223
-
224
  echo '<input type="text" name="dot_irecommendthis_settings[text_zero_suffix]" class="regular-text" value="'. $options['text_zero_suffix'] .'" /><br />
225
  <span class="description">'. __('Text to display after zero count. Leave blank for no text after the count.', 'dot') .'</span>';
226
  }
227
-
228
  function setting_text_one_suffix() {
229
  $options = get_option( 'dot_irecommendthis_settings' );
230
  if( !isset($options['text_one_suffix']) ) $options['text_one_suffix'] = '';
231
-
232
  echo '<input type="text" name="dot_irecommendthis_settings[text_one_suffix]" class="regular-text" value="'. $options['text_one_suffix'] .'" /><br />
233
  <span class="description">'. __('Text to display after 1 person has recommended. Leave blank for no text after the count.', 'dot') .'</span>';
234
  }
235
-
236
- function setting_text_more_suffix()
237
  {
238
  $options = get_option( 'dot_irecommendthis_settings' );
239
  if( !isset($options['text_more_suffix']) ) $options['text_more_suffix'] = '';
240
-
241
  echo '<input type="text" name="dot_irecommendthis_settings[text_more_suffix]" class="regular-text" value="'. $options['text_more_suffix'] .'" /><br />
242
  <span class="description">'. __('Text to display after more than 1 person have recommended. Leave blank for no text after the count.', 'dot') .'</span>';
243
  }
244
-
245
- function setting_recommend_style()
246
  {
247
  $options = get_option( 'dot_irecommendthis_settings' );
248
  if( !isset($options['recommend_style']) ) $options['recommend_style'] = '0';
249
-
250
  echo '<label><input type="radio" name="dot_irecommendthis_settings[recommend_style]" value="0"'. (($options['recommend_style']) == "0" ? 'checked' : '') .' />
251
  '. __('Default style - Thumb', 'dot') .'</label><br />
252
-
253
  <label><input type="radio" name="dot_irecommendthis_settings[recommend_style]" value="1"'. (($options['recommend_style']) == "1" ? 'checked' : '') .' />
254
  '. __('Heart', 'dot') .'</label><br />';
255
  }
256
-
257
- function setting_instructions()
258
  {
259
  echo '<p>'. __('To use I Recomment This in your posts and pages you can use the shortcode:', 'dot') .'</p>
260
  <p><code>[dot_recommends]</code></p>
261
  <p>'. __('To use I Recomment This manually in your theme template use the following PHP code:', 'dot') .'</p>
262
  <p><code>&lt;?php if( function_exists(\'dot_irecommendthis\') ) dot_irecommendthis(); ?&gt;</code></p>';
263
- }
264
-
265
- function settings_validate($input)
266
  {
267
  return $input;
268
  }
269
-
270
-
271
  /*--------------------------------------------*
272
  * Enqueue Scripts
273
  *--------------------------------------------*/
274
-
275
- function dot_enqueue_scripts()
276
  {
277
  $options = get_option( 'dot_irecommendthis_settings' );
278
  if( !isset($options['disable_css']) ) $options['disable_css'] = '0';
279
  if( !isset($options['recommend_style']) ) $options['recommend_style'] = '0';
280
-
281
  if ($options['disable_css'] == '0') {
282
-
283
  if ($options['recommend_style'] == '0') {
284
  wp_enqueue_style( 'dot-irecommendthis', plugins_url( '/css/dot-irecommendthis.css', __FILE__ ) );
285
  }
@@ -287,64 +287,64 @@ if ( ! class_exists( 'DOT_IRecommendThis' ) )
287
  wp_enqueue_style( 'dot-irecommendthis', plugins_url( '/css/dot-irecommendthis-heart.css', __FILE__ ) );
288
  }
289
  }
290
-
291
  wp_enqueue_script( 'dot-irecommendthis', plugins_url( '/js/dot_irecommendthis.js', __FILE__ ), array('jquery') );
292
  wp_enqueue_script( 'jquery' );
293
-
294
  wp_localize_script('dot-irecommendthis', 'dot', array(
295
  'ajaxurl' => admin_url('admin-ajax.php'),
296
  ));
297
-
298
  wp_localize_script( 'dot-irecommendthis', 'dot_irecommendthis', array('ajaxurl' => admin_url('admin-ajax.php')) );
299
-
300
  } //dot_enqueue_scripts
301
-
302
-
303
  /*--------------------------------------------*
304
  * Content / Front-end view
305
  *--------------------------------------------*/
306
-
307
- function dot_content( $content )
308
  {
309
  // Don't show on custom page templates or pages
310
  if(is_page_template() || is_page() || is_front_page()) return $content;
311
-
312
- // Don't show after excerpts
313
  global $wp_current_filter;
314
  if ( in_array( 'get_the_excerpt', (array) $wp_current_filter ) ) {
315
  return $content;
316
  }
317
-
318
  $options = get_option( 'dot_irecommendthis_settings' );
319
  if( !isset($options['add_to_posts']) ) $options['add_to_posts'] = '0';
320
  if( !isset($options['add_to_other']) ) $options['add_to_other'] = '0';
321
-
322
  if(is_singular('post') && $options['add_to_posts']) $content .= $this->dot_recommend();
323
  if((is_home() || is_category() || is_tag() || is_author() || is_date() || is_search()) && $options['add_to_other'] ) $content .= $this->dot_recommend();
324
-
325
  return $content;
326
-
327
  } //dot_content
328
-
329
-
330
  /*--------------------------------------------*
331
  * Setup recommends
332
  *--------------------------------------------*/
333
-
334
- function dot_setup_recommends( $post_id )
335
  {
336
  if(!is_numeric($post_id)) return;
337
-
338
  add_post_meta($post_id, '_recommended', '0', true);
339
-
340
  } //setup_recommends
341
-
342
-
343
  /*--------------------------------------------*
344
  * AJAX Callback
345
- *--------------------------------------------*/
346
-
347
- function ajax_callback($post_id)
348
  {
349
  $options = get_option( 'dot_irecommendthis_settings' );
350
  if( !isset($options['add_to_posts']) ) $options['add_to_posts'] = '1';
@@ -352,7 +352,7 @@ if ( ! class_exists( 'DOT_IRecommendThis' ) )
352
  if( !isset($options['text_zero_suffix']) ) $options['text_zero_suffix'] = '';
353
  if( !isset($options['text_one_suffix']) ) $options['text_one_suffix'] = '';
354
  if( !isset($options['text_more_suffix']) ) $options['text_more_suffix'] = '';
355
-
356
  if( isset($_POST['recommend_id']) ) {
357
  // Click event. Get and Update Count
358
  $post_id = str_replace('dot-irecommendthis-', '', $_POST['recommend_id']);
@@ -362,77 +362,77 @@ if ( ! class_exists( 'DOT_IRecommendThis' ) )
362
  $post_id = str_replace('dot-irecommendthis-', '', $_POST['post_id']);
363
  echo $this->dot_recommend_this($post_id, $options['text_zero_suffix'], $options['text_one_suffix'], $options['text_more_suffix'], 'get');
364
  }
365
-
366
  exit;
367
-
368
  } //ajax_callback
369
-
370
-
371
  /*--------------------------------------------*
372
  * Main Process
373
- *--------------------------------------------*/
374
-
375
-
376
- function dot_recommend_this($post_id, $text_zero_suffix = false, $text_one_suffix = false, $text_more_suffix = false, $action = 'get')
377
  {
378
  if(!is_numeric($post_id)) return;
379
  $text_zero_suffix = strip_tags($text_zero_suffix);
380
  $text_one_suffix = strip_tags($text_one_suffix);
381
- $text_more_suffix = strip_tags($text_more_suffix);
382
-
383
  switch($action) {
384
-
385
  case 'get':
386
  $recommended = get_post_meta($post_id, '_recommended', true);
387
  if( !$recommended ){
388
  $recommended = 0;
389
  add_post_meta($post_id, '_recommended', $recommended, true);
390
  }
391
-
392
  if( $recommended == 0 ) { $suffix = $text_zero_suffix; }
393
  elseif( $recommended == 1 ) { $suffix = $text_one_suffix; }
394
  else { $suffix = $text_more_suffix; }
395
-
396
  return '<span class="dot-irecommendthis-count">'. $recommended .'</span> <span class="dot-irecommendthis-suffix">'. $suffix .'</span>';
397
  break;
398
-
399
- case 'update':
400
-
401
  $recommended = get_post_meta($post_id, '_recommended', true);
402
-
403
  global $wpdb;
404
  $ip = $_SERVER['REMOTE_ADDR'];
405
  $voteStatusByIp = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."irecommendthis_votes WHERE post_id = '$post_id' AND ip = '$ip'");
406
-
407
  if ( isset($_COOKIE['dot_irecommendthis_'. $post_id]) && $voteStatusByIp != 0 ) {
408
  return $recommended;
409
  }
410
-
411
  $recommended++;
412
  update_post_meta($post_id, '_recommended', $recommended);
413
  setcookie('dot_irecommendthis_'. $post_id, time(), time()+3600*24*365, '/');
414
  $wpdb->query("INSERT INTO ".$wpdb->prefix."irecommendthis_votes VALUES ('', NOW(), '$post_id', '$ip')");
415
-
416
  if( $recommended == 0 ) { $suffix = $text_zero_suffix; }
417
  elseif( $recommended == 1 ) { $suffix = $text_one_suffix; }
418
  else { $suffix = $text_more_suffix; }
419
-
420
  return '<span class="dot-irecommendthis-count">'. $recommended .'</span> <span class="dot-irecommendthis-suffix">'. $suffix .'</span>';
421
  break;
422
-
423
  }
424
  } //dot_recommend_this
425
-
426
-
427
  /*--------------------------------------------*
428
  * Shortcode
429
- *--------------------------------------------*/
430
-
431
  function shortcode( $atts )
432
  {
433
  extract( shortcode_atts( array('id' => null), $atts ) );
434
  return $this->dot_recommend($id);
435
-
436
  } //shortcode
437
 
438
 
@@ -443,50 +443,50 @@ if ( ! class_exists( 'DOT_IRecommendThis' ) )
443
  $post_ID = $id ? $id : get_the_ID();
444
  $voteStatusByIp = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."irecommendthis_votes WHERE post_id = '$post_ID' AND ip = '$ip'");
445
  global $post;
446
-
447
 
448
-
 
449
  $options = get_option( 'dot_irecommendthis_settings' );
450
  if( !isset($options['text_zero_suffix']) ) $options['text_zero_suffix'] = '';
451
  if( !isset($options['text_one_suffix']) ) $options['text_one_suffix'] = '';
452
  if( !isset($options['text_more_suffix']) ) $options['text_more_suffix'] = '';
453
-
454
  $output = $this->dot_recommend_this($post_ID, $options['text_zero_suffix'], $options['text_one_suffix'], $options['text_more_suffix']);
455
-
456
 
457
-
 
458
  //if ( isset($_COOKIE['dot_irecommendthis_'. $post_id]) && $voteStatusByIp != 0 ) {
459
-
460
  if (!isset($_COOKIE['dot_irecommendthis_'.$post_ID]) && $voteStatusByIp == 0) {
461
  $class = 'dot-irecommendthis';
462
  $title = __('Recommend this', 'dot');
463
- }
464
- else {
465
 
466
  $class = 'dot-irecommendthis active';
467
  $title = __('You already recommended this', 'dot');
468
  }
469
-
470
  return '<a href="#" class="'. $class .'" id="dot-irecommendthis-'. $post_ID .'" title="'. $title .'">'. $output .'</a>';
471
  }
472
-
473
 
474
  /*--------------------------------------------*
475
  * Widget
476
  *--------------------------------------------*/
477
 
478
- function add_widget_most_recommended_posts()
479
  {
480
-
481
  function most_recommended_posts($numberOf, $before, $after, $show_count, $post_type="post", $raw=false) {
482
  global $wpdb;
483
-
484
  $request = "SELECT * FROM $wpdb->posts, $wpdb->postmeta";
485
  $request .= " WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id";
486
  $request .= " AND post_status='publish' AND post_type='$post_type' AND meta_key='_recommended'";
487
  $request .= " ORDER BY $wpdb->postmeta.meta_value+0 DESC LIMIT $numberOf";
488
  $posts = $wpdb->get_results($request);
489
-
490
  if ($raw):
491
  return $posts;
492
  else:
@@ -500,12 +500,12 @@ if ( ! class_exists( 'DOT_IRecommendThis' ) )
500
  }
501
  endif;
502
  }
503
-
504
- function widget_most_recommended_posts($args)
505
  {
506
  extract($args);
507
  $options = get_option("most_recommended_posts");
508
- if (!is_array( $options ))
509
  {
510
  $options = array(
511
  'title' => 'Most recommended posts',
@@ -516,21 +516,21 @@ if ( ! class_exists( 'DOT_IRecommendThis' ) )
516
  $title = $options['title'];
517
  $numberOf = $options['number'];
518
  $show_count = $options['show_count'];
519
-
520
  echo $before_widget;
521
  echo $before_title . $title . $after_title;
522
  echo '<ul class="mostrecommendedposts">';
523
-
524
  most_recommended_posts($numberOf, '<li>', '</li>', $show_count);
525
-
526
  echo '</ul>';
527
  echo $after_widget;
528
- }
529
  wp_register_sidebar_widget('most_recommended_posts', 'Most recommended posts', 'widget_most_recommended_posts');
530
-
531
  function options_widget_most_recommended_posts() {
532
  $options = get_option("most_recommended_posts");
533
-
534
  if (!is_array( $options )) {
535
  $options = array(
536
  'title' => 'Most recommended posts',
@@ -538,35 +538,35 @@ if ( ! class_exists( 'DOT_IRecommendThis' ) )
538
  'show_count' => '0'
539
  );
540
  }
541
-
542
  if ($_POST['mrp-submit']) {
543
  $options['title'] = htmlspecialchars($_POST['mrp-title']);
544
  $options['number'] = htmlspecialchars($_POST['mrp-number']);
545
  $options['show_count'] = $_POST['mrp-show-count'];
546
  if ( $options['number'] > 15) { $options['number'] = 15; }
547
-
548
  update_option("most_recommended_posts", $options);
549
  }
550
  ?>
551
  <p><label for="mrp-title"><?php _e('Title:', 'i-recommend-this'); ?><br />
552
  <input class="widefat" type="text" id="mrp-title" name="mrp-title" value="<?php echo $options['title'];?>" /></label></p>
553
-
554
  <p><label for="mrp-number"><?php _e('Number of posts to show:', 'i-recommend-this'); ?><br />
555
  <input type="text" id="mrp-number" name="mrp-number" style="width: 25px;" value="<?php echo $options['number'];?>" /> <small>(max. 15)</small></label></p>
556
-
557
  <p><label for="mrp-show-count"><input type="checkbox" id="mrp-show-count" name="mrp-show-count" value="1"<?php if($options['show_count'] == '1') echo 'checked="checked"'; ?> /> <?php _e('Show post count', 'i-recommend-this'); ?></label></p>
558
-
559
  <input type="hidden" id="mrp-submit" name="mrp-submit" value="1" />
560
  <?php
561
  }
562
  wp_register_widget_control('most_recommended_posts', 'Most recommended posts', 'options_widget_most_recommended_posts');
563
- }
 
564
 
565
-
566
  } // End Class
567
-
568
  global $dot_irecommendthis;
569
-
570
  // Initiation call of plugin
571
  $dot_irecommendthis = new DOT_IRecommendThis(__FILE__);
572
 
@@ -575,21 +575,21 @@ if ( ! class_exists( 'DOT_IRecommendThis' ) )
575
  /*--------------------------------------------*
576
  * Template Tag
577
  *--------------------------------------------*/
578
-
579
  function dot_irecommendthis()
580
  {
581
  global $dot_irecommendthis;
582
- echo $dot_irecommendthis->dot_recommend();
583
-
584
  }
585
 
586
  /*--------------------------------------------*
587
  * Settings Menu
588
  *--------------------------------------------*/
589
-
590
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'dot_irecommendthis_plugin_links' );
591
 
592
- function dot_irecommendthis_plugin_links($links) {
593
  return array_merge(
594
  array(
595
  'settings' => '<a href="' . get_bloginfo('wpurl') . '/wp-admin/options-general.php?page=dot-irecommendthis">' . __('Settings', 'dot-irecommendthis') . '</a>'
1
  <?php
2
+ /*
3
  * Plugin Name: I Recommend This
4
  * Plugin URI: http://www.harishchouhan.com/personal-projects/i-recommend-this/
5
  * Description: This plugin allows your visitors to simply recommend or like your posts instead of commment it.
6
+ * Version: 2.1.5
7
  * Author: Harish Chouhan
8
  * Author URI: http://www.harishchouhan.com
9
  * Author Email: me@harishchouhan.com
18
  Copyright 2013 "I Recommend This WordPress Plugin" (me@harishchouhan.coms)
19
 
20
  This program is free software; you can redistribute it and/or modify
21
+ it under the terms of the GNU General Public License, version 2, as
22
  published by the Free Software Foundation.
23
 
24
  This program is distributed in the hope that it will be useful,
29
  You should have received a copy of the GNU General Public License
30
  along with this program; if not, write to the Free Software
31
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32
+
33
  */
34
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
35
+ if ( ! class_exists( 'DOT_IRecommendThis' ) )
36
  {
37
+
38
+
39
  class DOT_IRecommendThis {
40
+
41
+ public $version = '2.1.5';
42
+
43
  /*--------------------------------------------*
44
  * Constructor
45
  *--------------------------------------------*/
46
+
47
+ function __construct( $file )
48
+ {
49
  $this->file = $file;
50
+
51
  // Run this on activation / deactivation
52
  register_activation_hook( $file, array( $this, 'activate' ) );
53
+
54
  // Load text domain
55
  add_action( 'init', array( &$this, 'load_localisation' ), 0 );
56
+
57
  add_action( 'admin_menu', array( &$this, 'dot_irecommendthis_menu' ) );
58
  add_action( 'admin_init', array( &$this, 'dot_irecommendthis_settings' ) );
59
  add_action( 'init', array( &$this, 'add_widget_most_recommended_posts' ) );
63
  add_action( 'wp_ajax_dot-irecommendthis', array( &$this, 'ajax_callback' ) );
64
  add_action( 'wp_ajax_nopriv_dot-irecommendthis', array( &$this, 'ajax_callback' ) );
65
  add_shortcode( 'dot_recommends', array( &$this, 'shortcode' ) );
66
+
67
+ } // end constructor
68
+
69
 
70
  /*--------------------------------------------*
71
  * Activate
72
  *--------------------------------------------*/
73
+
74
  public function activate( $network_wide ) {
75
  if (!isset($wpdb)) $wpdb = $GLOBALS['wpdb'];
76
  global $wpdb;
77
+
78
  $table_name = $wpdb->prefix . "irecommendthis_votes";
79
+ if($wpdb->get_var("show tables like '$table_name'") != $table_name)
80
  {
81
  $sql = "CREATE TABLE " . $table_name . " (
82
  id MEDIUMINT(9) NOT NULL AUTO_INCREMENT,
85
  ip VARCHAR(15) NOT NULL,
86
  UNIQUE KEY id (id)
87
  );";
88
+
89
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
90
+
91
  dbDelta($sql);
92
+
93
  $this->register_plugin_version();
94
+
95
  add_option("dot_irecommendthis_db_version", $dot_irecommendthis_db_version);
96
  }
97
+
98
  } // end activate
99
+
100
  private function register_plugin_version () {
101
  if ( $this->version != '' ) {
102
  update_option( 'dot-irecommendthis' . '-version', $this->version );
103
  }
104
  } // End register_plugin_version()
105
+
106
  /*--------------------------------------------*
107
  * Localisation | Public | 1.4.6 | Return : void
108
  *--------------------------------------------*/
109
+
110
+ public function load_localisation ()
111
  {
112
  load_plugin_textdomain( 'dot', false, dirname( plugin_basename( $this->file ) ) . '/languages/' );
113
+
114
  } // End load_localisation()
115
+
116
+
117
  /*--------------------------------------------*
118
  * Admin Menu
119
  *--------------------------------------------*/
120
+
121
+ function dot_irecommendthis_menu()
122
  {
123
  $page_title = __('I Recommend This', 'dot');
124
  $menu_title = __('I Recommend This', 'dot');
126
  $menu_slug = 'dot-irecommendthis';
127
  $function = array( &$this, 'dot_settings_page');
128
  add_options_page($page_title, $menu_title, $capability, $menu_slug, $function);
129
+
130
  } //dot_irecommendthis_menu
131
+
132
+
133
  /*--------------------------------------------*
134
  * Settings & Settings Page
135
  *--------------------------------------------*/
136
+
137
  public function dot_irecommendthis_settings() // whitelist options
138
+ {
139
  register_setting( 'dot-irecommendthis', 'dot_irecommendthis_settings', array(&$this, 'settings_validate') );
140
+ add_settings_section( 'dot-irecommendthis', '', array(&$this, 'section_intro'), 'dot-irecommendthis' );
141
  add_settings_field( 'show_on', __( 'Automatically display on', 'dot' ), array(&$this, 'setting_show_on'), 'dot-irecommendthis', 'dot-irecommendthis' );
142
  add_settings_field( 'text_zero_suffix', __( 'Text after 0 Count', 'dot' ), array(&$this, 'setting_text_zero_suffix'), 'dot-irecommendthis', 'dot-irecommendthis' );
143
  add_settings_field( 'text_one_suffix', __( 'Text after 1 Count', 'dot' ), array(&$this, 'setting_text_one_suffix'), 'dot-irecommendthis', 'dot-irecommendthis' );
145
  add_settings_field( 'disable_css', __( 'Disable CSS', 'dot' ), array(&$this, 'setting_disable_css'), 'dot-irecommendthis', 'dot-irecommendthis' );
146
  add_settings_field( 'recommend_style', __( 'Choose a style', 'dot' ), array(&$this, 'setting_recommend_style'), 'dot-irecommendthis', 'dot-irecommendthis' );
147
  add_settings_field( 'instructions', __( 'Shortcode and Template Tag', 'dot' ), array(&$this, 'setting_instructions'), 'dot-irecommendthis', 'dot-irecommendthis' );
148
+
149
  } //dot_irecommendthis_settings
150
+
151
+
152
+ public function dot_settings_page()
153
  {
154
  ?>
155
  <div class="wrap">
165
  </div>
166
  </div>-->
167
  </div> <!-- //inner-sidebar -->
168
+
169
  <!-- MAIN CONTENT -->
170
  <div id="post-body">
171
  <div id="post-body-content">
179
  </div> <!-- //metabox-holder -->
180
  </div>
181
  <?php
182
+
183
  } //dot_settings_page
184
+
185
+ function section_intro()
186
  {
187
  ?>
188
 
189
  <p><?php _e('<a href="https://twitter.com/harishchouhan" class="twitter-follow-button" data-show-count="false">Follow @harishchouhan</a>
190
  <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> or Check out our other themes & plugins at <a href="http://www.dreamsonline.net">Dreams Online Themes</a>.', 'dot'); ?></p>
191
  <p><?php _e('This plugin allows your visitors to simply recommend or like your posts instead of commment it.', 'dot'); ?></p>
192
+ <?php
193
+ }
194
+
195
+ function setting_show_on()
196
  {
197
  $options = get_option( 'dot_irecommendthis_settings' );
198
  if( !isset($options['add_to_posts']) ) $options['add_to_posts'] = '0';
199
  if( !isset($options['add_to_other']) ) $options['add_to_other'] = '0';
200
+
201
  echo '<input type="hidden" name="dot_irecommendthis_settings[add_to_posts]" value="0" />
202
  <label><input type="checkbox" name="dot_irecommendthis_settings[add_to_posts]" value="1"'. (($options['add_to_posts']) ? ' checked="checked"' : '') .' />
203
  '. __('Posts', 'dot') .'</label><br />
205
  <label><input type="checkbox" name="dot_irecommendthis_settings[add_to_other]" value="1"'. (($options['add_to_other']) ? ' checked="checked"' : '') .' />
206
  '. __('All other pages like Index, Archive, etc.', 'dot') .'</label><br />';
207
  }
208
+
209
+ function setting_disable_css()
210
  {
211
  $options = get_option( 'dot_irecommendthis_settings' );
212
  if( !isset($options['disable_css']) ) $options['disable_css'] = '0';
213
+
214
  echo '<input type="hidden" name="dot_irecommendthis_settings[disable_css]" value="0" />
215
  <label><input type="checkbox" name="dot_irecommendthis_settings[disable_css]" value="1"'. (($options['disable_css']) ? ' checked="checked"' : '') .' />
216
  I want to use my own CSS styles</label>';
217
  }
218
+
219
+ function setting_text_zero_suffix()
220
  {
221
  $options = get_option( 'dot_irecommendthis_settings' );
222
  if( !isset($options['text_zero_suffix']) ) $options['text_zero_suffix'] = '';
223
+
224
  echo '<input type="text" name="dot_irecommendthis_settings[text_zero_suffix]" class="regular-text" value="'. $options['text_zero_suffix'] .'" /><br />
225
  <span class="description">'. __('Text to display after zero count. Leave blank for no text after the count.', 'dot') .'</span>';
226
  }
227
+
228
  function setting_text_one_suffix() {
229
  $options = get_option( 'dot_irecommendthis_settings' );
230
  if( !isset($options['text_one_suffix']) ) $options['text_one_suffix'] = '';
231
+
232
  echo '<input type="text" name="dot_irecommendthis_settings[text_one_suffix]" class="regular-text" value="'. $options['text_one_suffix'] .'" /><br />
233
  <span class="description">'. __('Text to display after 1 person has recommended. Leave blank for no text after the count.', 'dot') .'</span>';
234
  }
235
+
236
+ function setting_text_more_suffix()
237
  {
238
  $options = get_option( 'dot_irecommendthis_settings' );
239
  if( !isset($options['text_more_suffix']) ) $options['text_more_suffix'] = '';
240
+
241
  echo '<input type="text" name="dot_irecommendthis_settings[text_more_suffix]" class="regular-text" value="'. $options['text_more_suffix'] .'" /><br />
242
  <span class="description">'. __('Text to display after more than 1 person have recommended. Leave blank for no text after the count.', 'dot') .'</span>';
243
  }
244
+
245
+ function setting_recommend_style()
246
  {
247
  $options = get_option( 'dot_irecommendthis_settings' );
248
  if( !isset($options['recommend_style']) ) $options['recommend_style'] = '0';
249
+
250
  echo '<label><input type="radio" name="dot_irecommendthis_settings[recommend_style]" value="0"'. (($options['recommend_style']) == "0" ? 'checked' : '') .' />
251
  '. __('Default style - Thumb', 'dot') .'</label><br />
252
+
253
  <label><input type="radio" name="dot_irecommendthis_settings[recommend_style]" value="1"'. (($options['recommend_style']) == "1" ? 'checked' : '') .' />
254
  '. __('Heart', 'dot') .'</label><br />';
255
  }
256
+
257
+ function setting_instructions()
258
  {
259
  echo '<p>'. __('To use I Recomment This in your posts and pages you can use the shortcode:', 'dot') .'</p>
260
  <p><code>[dot_recommends]</code></p>
261
  <p>'. __('To use I Recomment This manually in your theme template use the following PHP code:', 'dot') .'</p>
262
  <p><code>&lt;?php if( function_exists(\'dot_irecommendthis\') ) dot_irecommendthis(); ?&gt;</code></p>';
263
+ }
264
+
265
+ function settings_validate($input)
266
  {
267
  return $input;
268
  }
269
+
270
+
271
  /*--------------------------------------------*
272
  * Enqueue Scripts
273
  *--------------------------------------------*/
274
+
275
+ function dot_enqueue_scripts()
276
  {
277
  $options = get_option( 'dot_irecommendthis_settings' );
278
  if( !isset($options['disable_css']) ) $options['disable_css'] = '0';
279
  if( !isset($options['recommend_style']) ) $options['recommend_style'] = '0';
280
+
281
  if ($options['disable_css'] == '0') {
282
+
283
  if ($options['recommend_style'] == '0') {
284
  wp_enqueue_style( 'dot-irecommendthis', plugins_url( '/css/dot-irecommendthis.css', __FILE__ ) );
285
  }
287
  wp_enqueue_style( 'dot-irecommendthis', plugins_url( '/css/dot-irecommendthis-heart.css', __FILE__ ) );
288
  }
289
  }
290
+
291
  wp_enqueue_script( 'dot-irecommendthis', plugins_url( '/js/dot_irecommendthis.js', __FILE__ ), array('jquery') );
292
  wp_enqueue_script( 'jquery' );
293
+
294
  wp_localize_script('dot-irecommendthis', 'dot', array(
295
  'ajaxurl' => admin_url('admin-ajax.php'),
296
  ));
297
+
298
  wp_localize_script( 'dot-irecommendthis', 'dot_irecommendthis', array('ajaxurl' => admin_url('admin-ajax.php')) );
299
+
300
  } //dot_enqueue_scripts
301
+
302
+
303
  /*--------------------------------------------*
304
  * Content / Front-end view
305
  *--------------------------------------------*/
306
+
307
+ function dot_content( $content )
308
  {
309
  // Don't show on custom page templates or pages
310
  if(is_page_template() || is_page() || is_front_page()) return $content;
311
+
312
+ // Don't show after excerpts
313
  global $wp_current_filter;
314
  if ( in_array( 'get_the_excerpt', (array) $wp_current_filter ) ) {
315
  return $content;
316
  }
317
+
318
  $options = get_option( 'dot_irecommendthis_settings' );
319
  if( !isset($options['add_to_posts']) ) $options['add_to_posts'] = '0';
320
  if( !isset($options['add_to_other']) ) $options['add_to_other'] = '0';
321
+
322
  if(is_singular('post') && $options['add_to_posts']) $content .= $this->dot_recommend();
323
  if((is_home() || is_category() || is_tag() || is_author() || is_date() || is_search()) && $options['add_to_other'] ) $content .= $this->dot_recommend();
324
+
325
  return $content;
326
+
327
  } //dot_content
328
+
329
+
330
  /*--------------------------------------------*
331
  * Setup recommends
332
  *--------------------------------------------*/
333
+
334
+ function dot_setup_recommends( $post_id )
335
  {
336
  if(!is_numeric($post_id)) return;
337
+
338
  add_post_meta($post_id, '_recommended', '0', true);
339
+
340
  } //setup_recommends
341
+
342
+
343
  /*--------------------------------------------*
344
  * AJAX Callback
345
+ *--------------------------------------------*/
346
+
347
+ function ajax_callback($post_id)
348
  {
349
  $options = get_option( 'dot_irecommendthis_settings' );
350
  if( !isset($options['add_to_posts']) ) $options['add_to_posts'] = '1';
352
  if( !isset($options['text_zero_suffix']) ) $options['text_zero_suffix'] = '';
353
  if( !isset($options['text_one_suffix']) ) $options['text_one_suffix'] = '';
354
  if( !isset($options['text_more_suffix']) ) $options['text_more_suffix'] = '';
355
+
356
  if( isset($_POST['recommend_id']) ) {
357
  // Click event. Get and Update Count
358
  $post_id = str_replace('dot-irecommendthis-', '', $_POST['recommend_id']);
362
  $post_id = str_replace('dot-irecommendthis-', '', $_POST['post_id']);
363
  echo $this->dot_recommend_this($post_id, $options['text_zero_suffix'], $options['text_one_suffix'], $options['text_more_suffix'], 'get');
364
  }
365
+
366
  exit;
367
+
368
  } //ajax_callback
369
+
370
+
371
  /*--------------------------------------------*
372
  * Main Process
373
+ *--------------------------------------------*/
374
+
375
+
376
+ function dot_recommend_this($post_id, $text_zero_suffix = false, $text_one_suffix = false, $text_more_suffix = false, $action = 'get')
377
  {
378
  if(!is_numeric($post_id)) return;
379
  $text_zero_suffix = strip_tags($text_zero_suffix);
380
  $text_one_suffix = strip_tags($text_one_suffix);
381
+ $text_more_suffix = strip_tags($text_more_suffix);
382
+
383
  switch($action) {
384
+
385
  case 'get':
386
  $recommended = get_post_meta($post_id, '_recommended', true);
387
  if( !$recommended ){
388
  $recommended = 0;
389
  add_post_meta($post_id, '_recommended', $recommended, true);
390
  }
391
+
392
  if( $recommended == 0 ) { $suffix = $text_zero_suffix; }
393
  elseif( $recommended == 1 ) { $suffix = $text_one_suffix; }
394
  else { $suffix = $text_more_suffix; }
395
+
396
  return '<span class="dot-irecommendthis-count">'. $recommended .'</span> <span class="dot-irecommendthis-suffix">'. $suffix .'</span>';
397
  break;
398
+
399
+ case 'update':
400
+
401
  $recommended = get_post_meta($post_id, '_recommended', true);
402
+
403
  global $wpdb;
404
  $ip = $_SERVER['REMOTE_ADDR'];
405
  $voteStatusByIp = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."irecommendthis_votes WHERE post_id = '$post_id' AND ip = '$ip'");
406
+
407
  if ( isset($_COOKIE['dot_irecommendthis_'. $post_id]) && $voteStatusByIp != 0 ) {
408
  return $recommended;
409
  }
410
+
411
  $recommended++;
412
  update_post_meta($post_id, '_recommended', $recommended);
413
  setcookie('dot_irecommendthis_'. $post_id, time(), time()+3600*24*365, '/');
414
  $wpdb->query("INSERT INTO ".$wpdb->prefix."irecommendthis_votes VALUES ('', NOW(), '$post_id', '$ip')");
415
+
416
  if( $recommended == 0 ) { $suffix = $text_zero_suffix; }
417
  elseif( $recommended == 1 ) { $suffix = $text_one_suffix; }
418
  else { $suffix = $text_more_suffix; }
419
+
420
  return '<span class="dot-irecommendthis-count">'. $recommended .'</span> <span class="dot-irecommendthis-suffix">'. $suffix .'</span>';
421
  break;
422
+
423
  }
424
  } //dot_recommend_this
425
+
426
+
427
  /*--------------------------------------------*
428
  * Shortcode
429
+ *--------------------------------------------*/
430
+
431
  function shortcode( $atts )
432
  {
433
  extract( shortcode_atts( array('id' => null), $atts ) );
434
  return $this->dot_recommend($id);
435
+
436
  } //shortcode
437
 
438
 
443
  $post_ID = $id ? $id : get_the_ID();
444
  $voteStatusByIp = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."irecommendthis_votes WHERE post_id = '$post_ID' AND ip = '$ip'");
445
  global $post;
 
446
 
447
+
448
+
449
  $options = get_option( 'dot_irecommendthis_settings' );
450
  if( !isset($options['text_zero_suffix']) ) $options['text_zero_suffix'] = '';
451
  if( !isset($options['text_one_suffix']) ) $options['text_one_suffix'] = '';
452
  if( !isset($options['text_more_suffix']) ) $options['text_more_suffix'] = '';
453
+
454
  $output = $this->dot_recommend_this($post_ID, $options['text_zero_suffix'], $options['text_one_suffix'], $options['text_more_suffix']);
 
455
 
456
+
457
+
458
  //if ( isset($_COOKIE['dot_irecommendthis_'. $post_id]) && $voteStatusByIp != 0 ) {
459
+
460
  if (!isset($_COOKIE['dot_irecommendthis_'.$post_ID]) && $voteStatusByIp == 0) {
461
  $class = 'dot-irecommendthis';
462
  $title = __('Recommend this', 'dot');
463
+ }
464
+ else {
465
 
466
  $class = 'dot-irecommendthis active';
467
  $title = __('You already recommended this', 'dot');
468
  }
469
+
470
  return '<a href="#" class="'. $class .'" id="dot-irecommendthis-'. $post_ID .'" title="'. $title .'">'. $output .'</a>';
471
  }
472
+
473
 
474
  /*--------------------------------------------*
475
  * Widget
476
  *--------------------------------------------*/
477
 
478
+ function add_widget_most_recommended_posts()
479
  {
480
+
481
  function most_recommended_posts($numberOf, $before, $after, $show_count, $post_type="post", $raw=false) {
482
  global $wpdb;
483
+
484
  $request = "SELECT * FROM $wpdb->posts, $wpdb->postmeta";
485
  $request .= " WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id";
486
  $request .= " AND post_status='publish' AND post_type='$post_type' AND meta_key='_recommended'";
487
  $request .= " ORDER BY $wpdb->postmeta.meta_value+0 DESC LIMIT $numberOf";
488
  $posts = $wpdb->get_results($request);
489
+
490
  if ($raw):
491
  return $posts;
492
  else:
500
  }
501
  endif;
502
  }
503
+
504
+ function widget_most_recommended_posts($args)
505
  {
506
  extract($args);
507
  $options = get_option("most_recommended_posts");
508
+ if (!is_array( $options ))
509
  {
510
  $options = array(
511
  'title' => 'Most recommended posts',
516
  $title = $options['title'];
517
  $numberOf = $options['number'];
518
  $show_count = $options['show_count'];
519
+
520
  echo $before_widget;
521
  echo $before_title . $title . $after_title;
522
  echo '<ul class="mostrecommendedposts">';
523
+
524
  most_recommended_posts($numberOf, '<li>', '</li>', $show_count);
525
+
526
  echo '</ul>';
527
  echo $after_widget;
528
+ }
529
  wp_register_sidebar_widget('most_recommended_posts', 'Most recommended posts', 'widget_most_recommended_posts');
530
+
531
  function options_widget_most_recommended_posts() {
532
  $options = get_option("most_recommended_posts");
533
+
534
  if (!is_array( $options )) {
535
  $options = array(
536
  'title' => 'Most recommended posts',
538
  'show_count' => '0'
539
  );
540
  }
541
+
542
  if ($_POST['mrp-submit']) {
543
  $options['title'] = htmlspecialchars($_POST['mrp-title']);
544
  $options['number'] = htmlspecialchars($_POST['mrp-number']);
545
  $options['show_count'] = $_POST['mrp-show-count'];
546
  if ( $options['number'] > 15) { $options['number'] = 15; }
547
+
548
  update_option("most_recommended_posts", $options);
549
  }
550
  ?>
551
  <p><label for="mrp-title"><?php _e('Title:', 'i-recommend-this'); ?><br />
552
  <input class="widefat" type="text" id="mrp-title" name="mrp-title" value="<?php echo $options['title'];?>" /></label></p>
553
+
554
  <p><label for="mrp-number"><?php _e('Number of posts to show:', 'i-recommend-this'); ?><br />
555
  <input type="text" id="mrp-number" name="mrp-number" style="width: 25px;" value="<?php echo $options['number'];?>" /> <small>(max. 15)</small></label></p>
556
+
557
  <p><label for="mrp-show-count"><input type="checkbox" id="mrp-show-count" name="mrp-show-count" value="1"<?php if($options['show_count'] == '1') echo 'checked="checked"'; ?> /> <?php _e('Show post count', 'i-recommend-this'); ?></label></p>
558
+
559
  <input type="hidden" id="mrp-submit" name="mrp-submit" value="1" />
560
  <?php
561
  }
562
  wp_register_widget_control('most_recommended_posts', 'Most recommended posts', 'options_widget_most_recommended_posts');
563
+ }
564
+
565
 
 
566
  } // End Class
567
+
568
  global $dot_irecommendthis;
569
+
570
  // Initiation call of plugin
571
  $dot_irecommendthis = new DOT_IRecommendThis(__FILE__);
572
 
575
  /*--------------------------------------------*
576
  * Template Tag
577
  *--------------------------------------------*/
578
+
579
  function dot_irecommendthis()
580
  {
581
  global $dot_irecommendthis;
582
+ echo $dot_irecommendthis->dot_recommend();
583
+
584
  }
585
 
586
  /*--------------------------------------------*
587
  * Settings Menu
588
  *--------------------------------------------*/
589
+
590
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'dot_irecommendthis_plugin_links' );
591
 
592
+ function dot_irecommendthis_plugin_links($links) {
593
  return array_merge(
594
  array(
595
  'settings' => '<a href="' . get_bloginfo('wpurl') . '/wp-admin/options-general.php?page=dot-irecommendthis">' . __('Settings', 'dot-irecommendthis') . '</a>'
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Plugin Name ===
2
  Contributors: hchouhan, dreamsonline, dreamsmedia, Benoit "LeBen" Burgener
3
- Donate link: http://www.designerskiosk.com
4
  Tags: recommend, like, love, post, rate, rating, heart, dribbble like, tumblr like
5
  Requires at least: 3.3
6
  Tested up to: 3.5.2
7
- Stable tag: 2.1.4
8
  Last Updated: 2013-March-18
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -25,14 +25,14 @@ This plugin allows your visitors to simply like/recommend your posts instead of
25
 
26
  This plugin is based exactly on Benoit "LeBen" Burgener's "I Like This" Plugin and has been modified after getting requests for the changes I had made on my website.
27
 
28
- Please report any bugs you find via http://www.harishchouhan.com/personal-projects/i-recommend-this/
29
 
30
  = Examples of how the plugin has been used =
31
 
32
  * [Harish's blog](http://www.harishchouhan.com/blog/) - Please leave your suggestions here.
33
 
34
 
35
- = My Links =
36
 
37
  * Twitter @[harishchouhan](https://twitter.com/harishchouhan)
38
  * Google+ [Harish Chouhan](https://plus.google.com/u/0/103138475844539274387/)
@@ -56,14 +56,17 @@ Shortcode
56
 
57
  == Frequently Asked Questions ==
58
 
59
- Take a look at the [official "I Recommend This" FAQ](http://www.harishchouhan.com/personal-projects/i-recommend-this/).
60
 
61
- You can also visit the [support center](http://www.harishchouhan.com/personal-projects/i-recommend-this/) and start a discussion if needed.
62
 
63
 
64
 
65
  == Changelog ==
66
 
 
 
 
67
  = 2.1.4
68
  * Removed 2 instances of double quotes. Thanks to [boyevul](http://profiles.wordpress.org/boyevul/)
69
 
1
  === Plugin Name ===
2
  Contributors: hchouhan, dreamsonline, dreamsmedia, Benoit "LeBen" Burgener
3
+ Donate link: http://www.dreamsonline.net
4
  Tags: recommend, like, love, post, rate, rating, heart, dribbble like, tumblr like
5
  Requires at least: 3.3
6
  Tested up to: 3.5.2
7
+ Stable tag: 2.1.5
8
  Last Updated: 2013-March-18
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
25
 
26
  This plugin is based exactly on Benoit "LeBen" Burgener's "I Like This" Plugin and has been modified after getting requests for the changes I had made on my website.
27
 
28
+ Please report any bugs you find via http://www.dreamsonline.net/wordpress-plugins/i-recommend-this/
29
 
30
  = Examples of how the plugin has been used =
31
 
32
  * [Harish's blog](http://www.harishchouhan.com/blog/) - Please leave your suggestions here.
33
 
34
 
35
+ = My Links =
36
 
37
  * Twitter @[harishchouhan](https://twitter.com/harishchouhan)
38
  * Google+ [Harish Chouhan](https://plus.google.com/u/0/103138475844539274387/)
56
 
57
  == Frequently Asked Questions ==
58
 
59
+ Take a look at the [official "I Recommend This" FAQ](http://www.dreamsonline.net/wordpress-plugins/i-recommend-this/).
60
 
61
+ You can also visit the [support center](http://www.dreamsonline.net/wordpress-plugins/i-recommend-this/) and start a discussion if needed.
62
 
63
 
64
 
65
  == Changelog ==
66
 
67
+ = 2.1.5
68
+ * Support URL update for new plugin details page.
69
+
70
  = 2.1.4
71
  * Removed 2 instances of double quotes. Thanks to [boyevul](http://profiles.wordpress.org/boyevul/)
72