I Recommend This - Version 3.8.0

Version Description

Download this release

Release Info

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

Code changes from version 3.7.7 to 3.8.0

admin/class-i-recommend-this-admin.php ADDED
@@ -0,0 +1,365 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Themeist_IRecommendThis_Admin {
4
+
5
+ /**
6
+ * @param string $plugin_file
7
+ */
8
+ public function __construct( $plugin_file ) {
9
+ $this->plugin_file = $plugin_file;
10
+ }
11
+
12
+ public function add_admin_hooks() {
13
+ global $pagenow;
14
+
15
+ add_filter( 'admin_footer_text', array( $this, 'footer_text' ) );
16
+
17
+ // Hooks for Plugins overview page
18
+ if( $pagenow === 'plugins.php' ) {
19
+ add_filter( 'plugin_action_links', array( $this, 'add_plugin_settings_link' ), 10, 2 );
20
+ add_filter( 'plugin_row_meta', array( $this, 'add_plugin_meta_links'), 10, 2 );
21
+ }
22
+
23
+ add_action('admin_menu', array($this, 'dot_irecommendthis_menu'));
24
+ add_action('admin_init', array($this, 'dot_irecommendthis_settings'));
25
+ add_action('publish_post', array($this, 'dot_setup_recommends'));
26
+
27
+ /*
28
+ Enable with better control in 3.8.2
29
+ add_filter('request', 'dot_column_orderby');
30
+ add_filter('manage_edit-post_sortable_columns', 'dot_column_register_sortable');
31
+ add_filter('manage_posts_columns', 'dot_columns_head');
32
+ add_action('manage_posts_custom_column', 'dot_column_content', 10, 2);
33
+ */
34
+ }
35
+
36
+ public function dot_irecommendthis_menu() {
37
+ $page_title = __('I Recommend This', 'i-recommend-this');
38
+ $menu_title = __('I Recommend This', 'i-recommend-this');
39
+ $capability = 'manage_options';
40
+ $menu_slug = 'dot-irecommendthis';
41
+ $function = array(&$this, 'dot_settings_page');
42
+ add_options_page($page_title, $menu_title, $capability, $menu_slug, $function);
43
+
44
+ }
45
+
46
+ /**
47
+ * Ask for a plugin review in the WP Admin footer, if this is one of the plugin pages.
48
+ *
49
+ * @param $text
50
+ *
51
+ * @return string
52
+ */
53
+ public function footer_text( $text ) {
54
+
55
+ if(! empty( $_GET['page'] ) && strpos( $_GET['page'], 'dot-irecommendthis' ) === 0 ) {
56
+ $text = sprintf( 'If you enjoy using <strong>I Recommend this</strong>, please <a href="%s" target="_blank">leave us a ★★★★★ rating</a>. A <strong style="text-decoration: underline;">huge</strong> thank you in advance!', 'https://wordpress.org/support/view/plugin-reviews/i-recommend-this?rate=5#postform' );
57
+ }
58
+
59
+ return $text;
60
+ }
61
+
62
+ /**
63
+ * Add the settings link to the Plugins overview
64
+ *
65
+ * @param array $links
66
+ * @param $file
67
+ *
68
+ * @return array
69
+ */
70
+ public function add_plugin_settings_link( $links, $file ) {
71
+ if ( $file == plugin_basename($this->plugin_file) ) {
72
+
73
+ $settings_link = '<a href="' . admin_url( 'options-general.php?page=dot-irecommendthis' ) . '">'. __( 'Settings', 'dot-irecommendthis' ) . '</a>';
74
+ array_unshift( $links, $settings_link );
75
+ }
76
+ return $links;
77
+ }
78
+
79
+
80
+ public function add_plugin_meta_links( $links, $file ) {
81
+ if ( strpos( $file, 'i-recommend-this.php' ) !== false ) {
82
+ $new_links = array(
83
+ 'donate' => '<a href="https://www.paypal.me/harishchouhan" target="_blank">Donate</a>',
84
+ 'Documentation' => '<a href="https://themeist.com/docs/#utm_source=wp-plugin&utm_medium=i-recommend-this&utm_campaign=plugins-page" target="_blank">Documentation</a>'
85
+ );
86
+
87
+ $links = array_merge( $links, $new_links );
88
+ }
89
+ return $links;
90
+ }
91
+
92
+
93
+ /**
94
+ * Adds meta links to the plugin in the WP Admin > Plugins screen
95
+ *
96
+ * @param array $links
97
+ * @param string $file
98
+ *
99
+ * @return array
100
+ */
101
+ public function add_plugin_meta_links2( $links, $file ) {
102
+ if( $file !== $this->plugin_file ) {
103
+ //if( 'i-recommend-this.php' !== $this->plugin_file ) {
104
+ return $links;
105
+
106
+ //$links[] = '<a href="https://themeist.com/docs/#utm_source=wp-plugin&utm_medium=i-recommend-this&utm_campaign=plugins-page">'. __( 'Documentation', 'i-recommend-this' ) . '</a>';
107
+ }
108
+
109
+ $links[] = '<a href="https://themeist.com/docs/#utm_source=wp-plugin&utm_medium=i-recommend-this&utm_campaign=plugins-page">'. __( '2Documentation', 'i-recommend-this' ) . '</a>';
110
+
111
+ /**
112
+ * Filters meta links shown on the Plugins overview page
113
+ *
114
+ * This takes an array of strings
115
+ *
116
+ * @since 3.8
117
+ * @param array $links
118
+ * @ignore
119
+ */
120
+ //$links = (array) apply_filters( 'themeist_irt_admin_plugin_meta_links', $links );
121
+
122
+ return $links;
123
+ }
124
+
125
+ /* public function dot_irecommendthis_plugin_links($links)
126
+ {
127
+ return array_merge(
128
+ array(
129
+ 'settings' => '<a href="' . get_bloginfo('wpurl') . '/wp-admin/options-general.php?page=dot-irecommendthis">' . __('Settings', 'dot-irecommendthis') . '</a>'
130
+ ),
131
+ $links
132
+ );
133
+ }*/
134
+
135
+ function dot_setup_recommends($post_id)
136
+ {
137
+ if (!is_numeric($post_id)) return;
138
+
139
+ add_post_meta($post_id, '_recommended', '0', true);
140
+
141
+ }
142
+
143
+ public function dot_irecommendthis_settings() {
144
+ register_setting('dot-irecommendthis', 'dot_irecommendthis_settings', array(&$this, 'settings_validate'));
145
+
146
+ add_settings_section('dot-irecommendthis', '', array(&$this, 'section_intro'), 'dot-irecommendthis');
147
+
148
+ add_settings_field('show_on', __('Automatically display on', 'i-recommend-this'), array(&$this, 'setting_show_on'), 'dot-irecommendthis', 'dot-irecommendthis');
149
+
150
+ add_settings_field('text_zero_suffix', __('Text after 0 Count', 'i-recommend-this'), array(&$this, 'setting_text_zero_suffix'), 'dot-irecommendthis', 'dot-irecommendthis');
151
+
152
+ add_settings_field('text_one_suffix', __('Text after 1 Count', 'i-recommend-this'), array(&$this, 'setting_text_one_suffix'), 'dot-irecommendthis', 'dot-irecommendthis');
153
+
154
+ add_settings_field('text_more_suffix', __('Text after more than 1 Count', 'i-recommend-this'), array(&$this, 'setting_text_more_suffix'), 'dot-irecommendthis', 'dot-irecommendthis');
155
+
156
+ add_settings_field('link_title_new', __('Title for New posts', 'i-recommend-this'), array(&$this, 'setting_link_title_new'), 'dot-irecommendthis', 'dot-irecommendthis');
157
+
158
+ add_settings_field('link_title_active', __('Title for already voted posts', 'i-recommend-this'), array(&$this, 'setting_link_title_active'), 'dot-irecommendthis', 'dot-irecommendthis');
159
+
160
+ add_settings_field('disable_css', __('Disable CSS', 'i-recommend-this'), array(&$this, 'setting_disable_css'), 'dot-irecommendthis', 'dot-irecommendthis');
161
+
162
+ add_settings_field('hide_zero', __('Hide Zero Count', 'i-recommend-this'), array(&$this, 'setting_hide_zero'), 'dot-irecommendthis', 'dot-irecommendthis');
163
+
164
+ add_settings_field('disable_unique_ip', __('Enable IP saving', 'i-recommend-this'), array(&$this, 'setting_enable_unique_ip'), 'dot-irecommendthis', 'dot-irecommendthis');
165
+
166
+ add_settings_field('recommend_style', __('Choose a style', 'i-recommend-this'), array(&$this, 'setting_recommend_style'), 'dot-irecommendthis', 'dot-irecommendthis');
167
+
168
+
169
+ }
170
+
171
+ public function dot_settings_page() {
172
+ ?>
173
+ <div id="irecommendthis-settings" class="wrap irecommendthis-settings">
174
+ <h1>I Recommend This: Settings</h1>
175
+ <form action="options.php" method="post">
176
+ <?php settings_fields('dot-irecommendthis'); ?>
177
+ <?php do_settings_sections('dot-irecommendthis'); ?>
178
+ <p class="submit"><input type="submit" class="button-primary" value="<?php _e('Save Changes', 'i-recommend-this'); ?>"/></p>
179
+ </form>
180
+ </div>
181
+ <?php
182
+ }
183
+
184
+ public function section_intro() {
185
+ ?>
186
+
187
+ <p><?php _e('This plugin allows your visitors to simply recommend or like your posts instead of commment it.', 'i-recommend-this'); ?></p>
188
+ <?php
189
+ }
190
+
191
+ public function setting_show_on()
192
+ {
193
+ $options = get_option('dot_irecommendthis_settings');
194
+ if (!isset($options['add_to_posts'])) $options['add_to_posts'] = '0';
195
+ if (!isset($options['add_to_other'])) $options['add_to_other'] = '0';
196
+
197
+ echo '<input type="hidden" name="dot_irecommendthis_settings[add_to_posts]" value="0" />
198
+ <label><input type="checkbox" name="dot_irecommendthis_settings[add_to_posts]" value="1"' . (($options['add_to_posts']) ? ' checked="checked"' : '') . ' />
199
+ ' . __('Posts', 'i-recommend-this') . '</label><br />
200
+ <input type="hidden" name="dot_irecommendthis_settings[add_to_other]" value="0" />
201
+ <label><input type="checkbox" name="dot_irecommendthis_settings[add_to_other]" value="1"' . (($options['add_to_other']) ? ' checked="checked"' : '') . ' />
202
+ ' . __('All other pages like Index, Archive, etc.', 'i-recommend-this') . '</label><br />';
203
+ }
204
+
205
+ public function setting_hide_zero()
206
+ {
207
+ $options = get_option('dot_irecommendthis_settings');
208
+ if (!isset($options['hide_zero'])) $options['hide_zero'] = '0';
209
+
210
+ echo '<input type="hidden" name="dot_irecommendthis_settings[hide_zero]" value="0" />
211
+ <label><input type="checkbox" name="dot_irecommendthis_settings[hide_zero]" value="1"' . (($options['hide_zero']) ? ' checked="checked"' : '') . ' />' .
212
+ __('Hide count if count is zero', 'i-recommend-this') . '</label>';
213
+ }
214
+
215
+ public function setting_enable_unique_ip()
216
+ {
217
+ $options = get_option('dot_irecommendthis_settings');
218
+ if (!isset($options['enable_unique_ip'])) $options['enable_unique_ip'] = '0';
219
+
220
+ echo '<input type="hidden" name="dot_irecommendthis_settings[enable_unique_ip]" value="0" />
221
+ <label><input type="checkbox" name="dot_irecommendthis_settings[enable_unique_ip]" value="1"' . (($options['enable_unique_ip']) ? ' checked="checked"' : '') . ' />' .
222
+ __('Enable saving of IP Address (will affect GDPR). Cookies are saved by default but enabling this option will save IP & cookies to track user votes and a user be blocked from saving same post multiple times.', 'i-recommend-this') . '</label>';
223
+ }
224
+
225
+ public function setting_disable_css()
226
+ {
227
+ $options = get_option('dot_irecommendthis_settings');
228
+ if (!isset($options['disable_css'])) $options['disable_css'] = '0';
229
+
230
+ echo '<input type="hidden" name="dot_irecommendthis_settings[disable_css]" value="0" />
231
+ <label><input type="checkbox" name="dot_irecommendthis_settings[disable_css]" value="1"' . (($options['disable_css']) ? ' checked="checked"' : '') . ' />' .
232
+ __('I want to use my own CSS styles', 'i-recommend-this') . '</label>';
233
+ }
234
+
235
+ public function setting_text_zero_suffix()
236
+ {
237
+ $options = get_option('dot_irecommendthis_settings');
238
+ if (!isset($options['text_zero_suffix'])) $options['text_zero_suffix'] = '';
239
+
240
+ echo '<input type="text" name="dot_irecommendthis_settings[text_zero_suffix]" class="regular-text" value="' . $options['text_zero_suffix'] . '" /><br />
241
+ <span class="description">' . __('Text to display after zero count. Leave blank for no text after the count.', 'i-recommend-this') . '</span>';
242
+ }
243
+
244
+ public function setting_text_one_suffix()
245
+ {
246
+ $options = get_option('dot_irecommendthis_settings');
247
+ if (!isset($options['text_one_suffix'])) $options['text_one_suffix'] = '';
248
+
249
+ echo '<input type="text" name="dot_irecommendthis_settings[text_one_suffix]" class="regular-text" value="' . $options['text_one_suffix'] . '" /><br />
250
+ <span class="description">' . __('Text to display after 1 person has recommended. Leave blank for no text after the count.', 'i-recommend-this') . '</span>';
251
+ }
252
+
253
+ public function setting_text_more_suffix()
254
+ {
255
+ $options = get_option('dot_irecommendthis_settings');
256
+ if (!isset($options['text_more_suffix'])) $options['text_more_suffix'] = '';
257
+
258
+ echo '<input type="text" name="dot_irecommendthis_settings[text_more_suffix]" class="regular-text" value="' . $options['text_more_suffix'] . '" /><br />
259
+ <span class="description">' . __('Text to display after more than 1 person have recommended. Leave blank for no text after the count.', 'i-recommend-this') . '</span>';
260
+ }
261
+
262
+ public function setting_link_title_new()
263
+ {
264
+ $options = get_option('dot_irecommendthis_settings');
265
+ if (!isset($options['link_title_new'])) $options['link_title_new'] = '';
266
+
267
+ echo '<input type="text" name="dot_irecommendthis_settings[link_title_new]" class="regular-text" value="' . $options['link_title_new'] . '" /><br />
268
+ <span class="description">' . __('Link Title element for posts not yet voted by a user.', 'i-recommend-this') . '</span>';
269
+ }
270
+
271
+ public function setting_link_title_active()
272
+ {
273
+ $options = get_option('dot_irecommendthis_settings');
274
+ if (!isset($options['link_title_active'])) $options['link_title_active'] = '';
275
+
276
+ echo '<input type="text" name="dot_irecommendthis_settings[link_title_active]" class="regular-text" value="' . $options['link_title_active'] . '" /><br />
277
+ <span class="description">' . __('Link Title element for posts already voted by a user.', 'i-recommend-this') . '</span>';
278
+ }
279
+
280
+ public function setting_recommend_style()
281
+ {
282
+ $options = get_option('dot_irecommendthis_settings');
283
+ if (!isset($options['recommend_style'])) $options['recommend_style'] = '0';
284
+
285
+ echo '<label><input type="radio" name="dot_irecommendthis_settings[recommend_style]" value="0"' . (($options['recommend_style']) == "0" ? 'checked' : '') . ' />
286
+ ' . __('Default style - Thumb', 'i-recommend-this') . '</label><br />
287
+
288
+ <label><input type="radio" name="dot_irecommendthis_settings[recommend_style]" value="1"' . (($options['recommend_style']) == "1" ? 'checked' : '') . ' />
289
+ ' . __('Heart', 'i-recommend-this') . '</label><br />';
290
+ }
291
+
292
+ public function settings_validate($input) {
293
+ $new_input = array();
294
+
295
+ if( isset( $input['add_to_posts'] ) )
296
+ $new_input['add_to_posts'] = absint( $input['add_to_posts'] );
297
+
298
+ if( isset( $input['add_to_other'] ) )
299
+ $new_input['add_to_other'] = absint( $input['add_to_other'] );
300
+
301
+ if( isset( $input['text_zero_suffix'] ) )
302
+ $new_input['text_zero_suffix'] = sanitize_text_field( $input['text_zero_suffix'] );
303
+
304
+ if( isset( $input['text_one_suffix'] ) )
305
+ $new_input['text_one_suffix'] = sanitize_text_field( $input['text_one_suffix'] );
306
+
307
+ if( isset( $input['text_more_suffix'] ) )
308
+ $new_input['text_more_suffix'] = sanitize_text_field( $input['text_more_suffix'] );
309
+
310
+ if( isset( $input['link_title_new'] ) )
311
+ $new_input['link_title_new'] = sanitize_text_field( $input['link_title_new'] );
312
+
313
+ if( isset( $input['link_title_active'] ) )
314
+ $new_input['link_title_active'] = sanitize_text_field( $input['link_title_active'] );
315
+
316
+ if( isset( $input['disable_css'] ) )
317
+ $new_input['disable_css'] = absint( $input['disable_css'] );
318
+
319
+ if( isset( $input['hide_zero'] ) )
320
+ $new_input['hide_zero'] = absint( $input['hide_zero'] );
321
+
322
+ if( isset( $input['enable_unique_ip'] ) )
323
+ $new_input['enable_unique_ip'] = absint( $input['enable_unique_ip'] );
324
+
325
+ if( isset( $input['recommend_style'] ) )
326
+ $new_input['recommend_style'] = absint( $input['recommend_style'] );
327
+
328
+ return $new_input;
329
+ }
330
+
331
+ /*--------------------------------------------*
332
+ * Add Likes Column In Post Manage Page
333
+ *--------------------------------------------*/
334
+
335
+ function dot_columns_head($defaults)
336
+ {
337
+ $defaults['likes'] = __('Likes', 'i-recommend-this');
338
+ return $defaults;
339
+ }
340
+
341
+ function dot_column_content($column_name, $post_ID)
342
+ {
343
+ if ($column_name == 'likes')
344
+ echo get_post_meta($post_ID, '_recommended', true) . ' ' . __('like', 'i-recommend-this');
345
+ }
346
+
347
+ function dot_column_register_sortable($columns)
348
+ {
349
+ $columns['likes'] = 'likes';
350
+ return $columns;
351
+ }
352
+
353
+ function dot_column_orderby($vars)
354
+ {
355
+ if (isset($vars['orderby']) && 'likes' == $vars['orderby']) {
356
+ $vars = array_merge($vars, array(
357
+ 'meta_key' => '_recommended',
358
+ 'orderby' => 'meta_value'
359
+ ));
360
+ }
361
+
362
+ return $vars;
363
+ }
364
+
365
+ }
css/dot-irecommendthis-heart.css CHANGED
@@ -1,17 +1,21 @@
1
-
2
- .dot-irecommendthis {
3
- background:url(../images/heart.png) 0 3px no-repeat;
4
  padding-left: 18px;
5
  border: 0 !important;
6
  margin-bottom: 10px;
7
  display: inline-block;
8
  text-decoration: none;
9
  min-height: 14px;
10
-
 
11
  }
12
 
13
-
14
- .dot-irecommendthis:hover, .dot-irecommendthis.active { background-position:0 -23px; color: #F56559 !important; border: 0 !important;
 
 
 
15
  margin: 0 0 10px 0 !important;
16
  padding-left: 18px !important;
17
- text-decoration: none;}
 
1
+ .dot-irecommendthis {
2
+ background:url(../images/heart.png) 0 3px no-repeat;
 
3
  padding-left: 18px;
4
  border: 0 !important;
5
  margin-bottom: 10px;
6
  display: inline-block;
7
  text-decoration: none;
8
  min-height: 14px;
9
+ -webkit-box-shadow: none;
10
+ box-shadow: none !important;
11
  }
12
 
13
+ .dot-irecommendthis:hover,
14
+ .dot-irecommendthis.active {
15
+ background-position:0 -23px;
16
+ color: #F56559 !important;
17
+ border: 0 !important;
18
  margin: 0 0 10px 0 !important;
19
  padding-left: 18px !important;
20
+ text-decoration: none;
21
+ }
css/dot-irecommendthis.css CHANGED
@@ -1,10 +1,15 @@
1
-
2
- .dot-irecommendthis {
3
- background:url(../images/default.png) 0 0px no-repeat;
4
  padding:0 0 0 20px;
5
  border: 0 !important;
6
  margin-bottom: 10px;
7
  display: inline-block;
8
  text-decoration: none;
9
- }
10
- .dot-irecommendthis:hover, .dot-irecommendthis.active { background-position:0 -24px; color: #F56559 !important; }
 
 
 
 
 
 
1
+ .dot-irecommendthis {
2
+ background:url(../images/default.png) 0 0px no-repeat;
 
3
  padding:0 0 0 20px;
4
  border: 0 !important;
5
  margin-bottom: 10px;
6
  display: inline-block;
7
  text-decoration: none;
8
+ -webkit-box-shadow: none;
9
+ box-shadow: none !important;
10
+ }
11
+ .dot-irecommendthis:hover,
12
+ .dot-irecommendthis.active {
13
+ background-position:0 -24px;
14
+ color: #F56559 !important;
15
+ }
dot-irecommendthis.php DELETED
@@ -1,913 +0,0 @@
1
- <?php
2
- /*
3
- Plugin Name: I Recommend This
4
- Plugin URI: https://themeist.com/plugins/wordpress/i-recommend-this/#utm_source=wp-plugin&utm_medium=i-recommend-this&utm_campaign=plugins-page
5
- Description: This plugin allows your visitors to simply recommend or like your posts instead of commment it.
6
- Version: 3.7.7
7
- Author: themeist
8
- Author URI: https://themeist.com/
9
- Text Domain: i-recommend-this
10
- Domain Path: /languages
11
- License: GPL v3
12
-
13
- I Recommend This WordPress Plugin
14
- Copyright (C) 2012-2016, Harish Chouhan, me@harishchouhan.com
15
-
16
- This program is free software: you can redistribute it and/or modify
17
- it under the terms of the GNU General Public License as published by
18
- the Free Software Foundation, either version 3 of the License, or
19
- (at your option) any later version.
20
-
21
- This program is distributed in the hope that it will be useful,
22
- but WITHOUT ANY WARRANTY; without even the implied warranty of
23
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
- GNU General Public License for more details.
25
-
26
- You should have received a copy of the GNU General Public License
27
- along with this program. If not, see <http://www.gnu.org/licenses/>.
28
- */
29
-
30
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
31
- if ( ! class_exists( 'DOT_IRecommendThis' ) )
32
- {
33
-
34
-
35
- class DOT_IRecommendThis {
36
-
37
- public $version = '2.6.2';
38
- public $db_version = '2.6.2';
39
-
40
- /*--------------------------------------------*
41
- * Constructor
42
- *--------------------------------------------*/
43
-
44
- function __construct( $file )
45
- {
46
- $this->file = $file;
47
-
48
- // Run this on activation / deactivation
49
- register_activation_hook( $file, array( $this, 'activate' ) );
50
-
51
- // Load text domain
52
- add_action( 'init', array( &$this, 'load_localisation' ), 0 );
53
-
54
- //add_action( 'plugins_loaded', 'i_recommend_this_load_plugin_textdomain' );
55
- //add_action( 'plugins_loaded', array( &$this, 'i_recommend_this_load_plugin_textdomain' ), 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' ) );
60
- add_action( 'wp_enqueue_scripts', array( &$this, 'dot_enqueue_scripts' ) );
61
- add_filter( 'the_content', array( &$this, 'dot_content' ) );
62
- add_action( 'publish_post', array( &$this, 'dot_setup_recommends' ) );
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
- add_shortcode( 'dot_recommended_posts', array( &$this, 'dot_recommended_top_posts' ) );
67
-
68
-
69
- } // end constructor
70
-
71
-
72
- /*--------------------------------------------*
73
- * Activate
74
- *--------------------------------------------*/
75
-
76
- public function activate( $network_wide ) {
77
- if (!isset($wpdb)) $wpdb = $GLOBALS['wpdb'];
78
- global $wpdb;
79
-
80
- $table_name = $wpdb->prefix . "irecommendthis_votes";
81
- if($wpdb->get_var("show tables like '$table_name'") != $table_name)
82
- {
83
- $sql = "CREATE TABLE " . $table_name . " (
84
- id MEDIUMINT(9) NOT NULL AUTO_INCREMENT,
85
- time TIMESTAMP NOT NULL,
86
- post_id BIGINT(20) NOT NULL,
87
- ip VARCHAR(45) NOT NULL,
88
- UNIQUE KEY id (id)
89
- );";
90
-
91
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
92
-
93
- dbDelta($sql);
94
-
95
- $this->register_plugin_version();
96
-
97
- if ( $this->db_version != '' ) {
98
- update_option( 'dot_irecommendthis_db_version', $this->db_version );
99
- }
100
-
101
- //add_option("dot_irecommendthis_db_version", $dot_irecommendthis_db_version);
102
- }
103
-
104
- } // end activate
105
-
106
- private function register_plugin_version () {
107
- if ( $this->version != '' ) {
108
- update_option( 'dot-irecommendthis' . '-version', $this->version );
109
- }
110
- } // End register_plugin_version()
111
-
112
- /**
113
- * Load the plugin text domain for translation.
114
- *
115
- * @since 1.4.6
116
- */
117
- public function load_localisation () {
118
-
119
- //load_plugin_textdomain( 'i-recommend-this', false, dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' );
120
- load_plugin_textdomain( 'i-recommend-this', false, dirname( plugin_basename( $this->file ) ) . '/languages/' );
121
- //load_plugin_textdomain( 'i-recommend-this', false, dirname( plugin_basename( $this->file ) ) . '/languages/' );
122
-
123
-
124
- } // End load_localisation()
125
-
126
-
127
- function i_recommend_this_load_plugin_textdomain() {
128
- load_plugin_textdomain( 'i-recommend-this', FALSE, dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' );
129
- //load_plugin_textdomain( 'i-recommend-this', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
130
- }
131
-
132
-
133
-
134
- /*--------------------------------------------*
135
- * Enqueue Scripts
136
- *--------------------------------------------*/
137
-
138
- function dot_enqueue_scripts()
139
- {
140
- $options = get_option( 'dot_irecommendthis_settings' );
141
- if( !isset($options['disable_css']) ) $options['disable_css'] = '0';
142
- if( !isset($options['recommend_style']) ) $options['recommend_style'] = '0';
143
-
144
- if ($options['disable_css'] == '0') {
145
-
146
- if ($options['recommend_style'] == '0') {
147
- wp_enqueue_style( 'dot-irecommendthis', plugins_url( '/css/dot-irecommendthis.css', __FILE__ ) );
148
- }
149
- else {
150
- wp_enqueue_style( 'dot-irecommendthis', plugins_url( '/css/dot-irecommendthis-heart.css', __FILE__ ) );
151
- }
152
- }
153
- wp_register_script('dot-irecommendthis', plugins_url( '/js/dot_irecommendthis.js', __FILE__ ), 'jquery', '2.6.0', 'in_footer');
154
-
155
- wp_enqueue_script( 'jquery' );
156
- wp_enqueue_script( 'dot-irecommendthis' );
157
-
158
- wp_localize_script( 'dot-irecommendthis', 'dot_irecommendthis', array( 'ajaxurl' => admin_url('admin-ajax.php')) );
159
-
160
- } //dot_enqueue_scripts
161
-
162
-
163
- /*--------------------------------------------*
164
- * Admin Menu
165
- *--------------------------------------------*/
166
-
167
- function dot_irecommendthis_menu()
168
- {
169
- $page_title = __('I Recommend This', 'i-recommend-this');
170
- $menu_title = __('I Recommend This', 'i-recommend-this');
171
- $capability = 'manage_options';
172
- $menu_slug = 'dot-irecommendthis';
173
- $function = array( &$this, 'dot_settings_page');
174
- add_options_page($page_title, $menu_title, $capability, $menu_slug, $function);
175
-
176
- } //dot_irecommendthis_menu
177
-
178
-
179
- /*--------------------------------------------*
180
- * Settings & Settings Page
181
- *--------------------------------------------*/
182
-
183
- public function dot_irecommendthis_settings() // whitelist options
184
- {
185
- register_setting( 'dot-irecommendthis', 'dot_irecommendthis_settings', array(&$this, 'settings_validate') );
186
-
187
- add_settings_section( 'dot-irecommendthis', '', array(&$this, 'section_intro'), 'dot-irecommendthis' );
188
-
189
- add_settings_field( 'show_on', __( 'Automatically display on', 'i-recommend-this' ), array(&$this, 'setting_show_on'), 'dot-irecommendthis', 'dot-irecommendthis' );
190
-
191
- add_settings_field( 'text_zero_suffix', __( 'Text after 0 Count', 'i-recommend-this' ), array(&$this, 'setting_text_zero_suffix'), 'dot-irecommendthis', 'dot-irecommendthis' );
192
-
193
- add_settings_field( 'text_one_suffix', __( 'Text after 1 Count', 'i-recommend-this' ), array(&$this, 'setting_text_one_suffix'), 'dot-irecommendthis', 'dot-irecommendthis' );
194
-
195
- add_settings_field( 'text_more_suffix', __( 'Text after more than 1 Count', 'i-recommend-this' ), array(&$this, 'setting_text_more_suffix'), 'dot-irecommendthis', 'dot-irecommendthis' );
196
-
197
- add_settings_field( 'link_title_new', __( 'Title for New posts', 'i-recommend-this' ), array(&$this, 'setting_link_title_new'), 'dot-irecommendthis', 'dot-irecommendthis' );
198
-
199
- add_settings_field( 'link_title_active', __( 'Title for already voted posts', 'i-recommend-this' ), array(&$this, 'setting_link_title_active'), 'dot-irecommendthis', 'dot-irecommendthis' );
200
-
201
- add_settings_field( 'disable_css', __( 'Disable CSS', 'i-recommend-this' ), array(&$this, 'setting_disable_css'), 'dot-irecommendthis', 'dot-irecommendthis' );
202
-
203
- add_settings_field( 'hide_zero', __( 'Hide Zero Count', 'i-recommend-this' ), array(&$this, 'setting_hide_zero'), 'dot-irecommendthis', 'dot-irecommendthis' );
204
-
205
- add_settings_field( 'disable_unique_ip', __( 'Disable IP saving', 'i-recommend-this' ), array(&$this, 'setting_disable_unique_ip'), 'dot-irecommendthis', 'dot-irecommendthis' );
206
-
207
- add_settings_field( 'recommend_style', __( 'Choose a style', 'i-recommend-this' ), array(&$this, 'setting_recommend_style'), 'dot-irecommendthis', 'dot-irecommendthis' );
208
-
209
- add_settings_field( 'instructions', __( 'Shortcode and Template Tag', 'i-recommend-this' ), array(&$this, 'setting_instructions'), 'dot-irecommendthis', 'dot-irecommendthis' );
210
-
211
- } //dot_irecommendthis_settings
212
-
213
-
214
- public function dot_settings_page()
215
- {
216
- ?>
217
- <div class="wrap">
218
- <?php screen_icon(); ?>
219
- <h2>"I Recommend This" Options</h2>
220
- <div class="metabox-holder has-right-sidebar">
221
- <!-- SIDEBAR -->
222
- <div class="inner-sidebar">
223
- <!--<div class="postbox">
224
- <h3><span>Metabox 1</span></h3>
225
- <div class="inside">
226
- <p>Hi, I'm metabox 1!</p>
227
- </div>
228
- </div>-->
229
- </div> <!-- //inner-sidebar -->
230
-
231
- <!-- MAIN CONTENT -->
232
- <div id="post-body">
233
- <div id="post-body-content">
234
- <form action="options.php" method="post">
235
- <?php settings_fields( 'dot-irecommendthis' ); ?>
236
- <?php do_settings_sections( 'dot-irecommendthis' ); ?>
237
- <p class="submit"><input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'i-recommend-this' ); ?>" /></p>
238
- </form>
239
- </div>
240
- </div> <!-- //main content -->
241
- </div> <!-- //metabox-holder -->
242
- </div>
243
- <?php
244
-
245
- } //dot_settings_page
246
-
247
- function section_intro()
248
- {
249
- ?>
250
-
251
- <p><?php _e('<a href="https://twitter.com/harishchouhan" class="twitter-follow-button" data-show-count="false">Follow @harishchouhan</a>
252
- <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>', 'i-recommend-this'); ?><br />
253
- <?php _e('or Check out our other themes & plugins at <a href="https://themeist.com">Themeist</a>.', 'i-recommend-this'); ?></p>
254
- <p><?php _e('This plugin allows your visitors to simply recommend or like your posts instead of commment it.', 'i-recommend-this'); ?></p>
255
- <?php
256
- }
257
-
258
- function setting_show_on()
259
- {
260
- $options = get_option( 'dot_irecommendthis_settings' );
261
- if( !isset($options['add_to_posts']) ) $options['add_to_posts'] = '0';
262
- if( !isset($options['add_to_other']) ) $options['add_to_other'] = '0';
263
-
264
- echo '<input type="hidden" name="dot_irecommendthis_settings[add_to_posts]" value="0" />
265
- <label><input type="checkbox" name="dot_irecommendthis_settings[add_to_posts]" value="1"'. (($options['add_to_posts']) ? ' checked="checked"' : '') .' />
266
- '. __('Posts', 'i-recommend-this') .'</label><br />
267
- <input type="hidden" name="dot_irecommendthis_settings[add_to_other]" value="0" />
268
- <label><input type="checkbox" name="dot_irecommendthis_settings[add_to_other]" value="1"'. (($options['add_to_other']) ? ' checked="checked"' : '') .' />
269
- '. __('All other pages like Index, Archive, etc.', 'i-recommend-this') .'</label><br />';
270
- }
271
-
272
- function setting_hide_zero()
273
- {
274
- $options = get_option( 'dot_irecommendthis_settings' );
275
- if( !isset($options['hide_zero']) ) $options['hide_zero'] = '0';
276
-
277
- echo '<input type="hidden" name="dot_irecommendthis_settings[hide_zero]" value="0" />
278
- <label><input type="checkbox" name="dot_irecommendthis_settings[hide_zero]" value="1"'. (($options['hide_zero']) ? ' checked="checked"' : '') .' />' .
279
- __('Hide count if count is zero', 'i-recommend-this') . '</label>';
280
- }
281
-
282
- function setting_disable_unique_ip()
283
- {
284
- $options = get_option( 'dot_irecommendthis_settings' );
285
- if( !isset($options['disable_unique_ip']) ) $options['disable_unique_ip'] = '0';
286
-
287
- echo '<input type="hidden" name="dot_irecommendthis_settings[disable_unique_ip]" value="0" />
288
- <label><input type="checkbox" name="dot_irecommendthis_settings[disable_unique_ip]" value="1"'. (($options['disable_unique_ip']) ? ' checked="checked"' : '') .' />' .
289
- __('Disable saving of IP Address. Will only save cookies to track user votes.', 'i-recommend-this') . '</label>';
290
- }
291
-
292
- function setting_disable_css()
293
- {
294
- $options = get_option( 'dot_irecommendthis_settings' );
295
- if( !isset($options['disable_css']) ) $options['disable_css'] = '0';
296
-
297
- echo '<input type="hidden" name="dot_irecommendthis_settings[disable_css]" value="0" />
298
- <label><input type="checkbox" name="dot_irecommendthis_settings[disable_css]" value="1"'. (($options['disable_css']) ? ' checked="checked"' : '') .' />' .
299
- __('I want to use my own CSS styles', 'i-recommend-this') . '</label>';
300
- }
301
-
302
- function setting_text_zero_suffix()
303
- {
304
- $options = get_option( 'dot_irecommendthis_settings' );
305
- if( !isset($options['text_zero_suffix']) ) $options['text_zero_suffix'] = '';
306
-
307
- echo '<input type="text" name="dot_irecommendthis_settings[text_zero_suffix]" class="regular-text" value="'. $options['text_zero_suffix'] .'" /><br />
308
- <span class="description">'. __('Text to display after zero count. Leave blank for no text after the count.', 'i-recommend-this') .'</span>';
309
- }
310
-
311
- function setting_text_one_suffix() {
312
- $options = get_option( 'dot_irecommendthis_settings' );
313
- if( !isset($options['text_one_suffix']) ) $options['text_one_suffix'] = '';
314
-
315
- echo '<input type="text" name="dot_irecommendthis_settings[text_one_suffix]" class="regular-text" value="'. $options['text_one_suffix'] .'" /><br />
316
- <span class="description">'. __('Text to display after 1 person has recommended. Leave blank for no text after the count.', 'i-recommend-this') .'</span>';
317
- }
318
-
319
- function setting_text_more_suffix()
320
- {
321
- $options = get_option( 'dot_irecommendthis_settings' );
322
- if( !isset($options['text_more_suffix']) ) $options['text_more_suffix'] = '';
323
-
324
- echo '<input type="text" name="dot_irecommendthis_settings[text_more_suffix]" class="regular-text" value="'. $options['text_more_suffix'] .'" /><br />
325
- <span class="description">'. __('Text to display after more than 1 person have recommended. Leave blank for no text after the count.', 'i-recommend-this') .'</span>';
326
- }
327
-
328
- function setting_link_title_new()
329
- {
330
- $options = get_option( 'dot_irecommendthis_settings' );
331
- if( !isset($options['link_title_new']) ) $options['link_title_new'] = '';
332
-
333
- echo '<input type="text" name="dot_irecommendthis_settings[link_title_new]" class="regular-text" value="'. $options['link_title_new'] .'" /><br />
334
- <span class="description">'. __('Link Title element for posts not yet voted by a user.', 'i-recommend-this') .'</span>';
335
- }
336
-
337
- function setting_link_title_active()
338
- {
339
- $options = get_option( 'dot_irecommendthis_settings' );
340
- if( !isset($options['link_title_active']) ) $options['link_title_active'] = '';
341
-
342
- echo '<input type="text" name="dot_irecommendthis_settings[link_title_active]" class="regular-text" value="'. $options['link_title_active'] .'" /><br />
343
- <span class="description">'. __('Link Title element for posts already voted by a user.', 'i-recommend-this') .'</span>';
344
- }
345
-
346
- function setting_recommend_style()
347
- {
348
- $options = get_option( 'dot_irecommendthis_settings' );
349
- if( !isset($options['recommend_style']) ) $options['recommend_style'] = '0';
350
-
351
- echo '<label><input type="radio" name="dot_irecommendthis_settings[recommend_style]" value="0"'. (($options['recommend_style']) == "0" ? 'checked' : '') .' />
352
- '. __('Default style - Thumb', 'i-recommend-this') .'</label><br />
353
-
354
- <label><input type="radio" name="dot_irecommendthis_settings[recommend_style]" value="1"'. (($options['recommend_style']) == "1" ? 'checked' : '') .' />
355
- '. __('Heart', 'i-recommend-this') .'</label><br />';
356
- }
357
-
358
- function setting_instructions()
359
- {
360
- echo '<p>'. __('To use I Recomment This in your posts and pages you can use the shortcode:', 'i-recommend-this') .'</p>
361
- <p><code>[dot_recommends]</code></p>
362
- <p>'. __('To use I Recomment This manually in your theme template use the following PHP code:', 'i-recommend-this') .'</p>
363
- <p><code>&lt;?php if( function_exists(\'dot_irecommendthis\') ) dot_irecommendthis(); ?&gt;</code></p>
364
- <p>'. __('To show top recommended post from a particular date use below shortcode', 'i-recommend-this') .'</p>
365
- <p><code>[dot_recommended_posts container=\'div\' post_type=\'showcase\' number=\'10\' year=\'2013\' monthnum=\'7\']</code></p>';
366
- }
367
-
368
- function settings_validate($input)
369
- {
370
- return $input;
371
- }
372
-
373
-
374
-
375
- /*--------------------------------------------*
376
- * Content / Front-end view
377
- *--------------------------------------------*/
378
-
379
- function dot_content( $content )
380
- {
381
- // Don't show on custom page templates or pages
382
- if(is_page_template() || is_page() || is_front_page()) return $content;
383
-
384
- // Don't show after excerpts
385
- global $wp_current_filter;
386
- if ( in_array( 'get_the_excerpt', (array) $wp_current_filter ) ) {
387
- return $content;
388
- }
389
-
390
- $options = get_option( 'dot_irecommendthis_settings' );
391
- if( !isset($options['add_to_posts']) ) $options['add_to_posts'] = '0';
392
- if( !isset($options['add_to_other']) ) $options['add_to_other'] = '0';
393
-
394
- if(is_singular('post') && $options['add_to_posts']) $content .= $this->dot_recommend();
395
- if((is_home() || is_category() || is_tag() || is_author() || is_date() || is_search()) && $options['add_to_other'] ) $content .= $this->dot_recommend();
396
-
397
- return $content;
398
-
399
- } //dot_content
400
-
401
-
402
- /*--------------------------------------------*
403
- * Setup recommends
404
- *--------------------------------------------*/
405
-
406
- function dot_setup_recommends( $post_id )
407
- {
408
- if(!is_numeric($post_id)) return;
409
-
410
- add_post_meta($post_id, '_recommended', '0', true);
411
-
412
- } //setup_recommends
413
-
414
-
415
- /*--------------------------------------------*
416
- * AJAX Callback
417
- *--------------------------------------------*/
418
-
419
- function ajax_callback($post_id)
420
- {
421
- $options = get_option( 'dot_irecommendthis_settings' );
422
- if( !isset($options['add_to_posts']) ) $options['add_to_posts'] = '1';
423
- if( !isset($options['add_to_other']) ) $options['add_to_other'] = '1';
424
- if( !isset($options['text_zero_suffix']) ) $options['text_zero_suffix'] = '';
425
- if( !isset($options['text_one_suffix']) ) $options['text_one_suffix'] = '';
426
- if( !isset($options['text_more_suffix']) ) $options['text_more_suffix'] = '';
427
-
428
- if( isset($_POST['recommend_id']) ) {
429
- // Click event. Get and Update Count
430
- $post_id = str_replace('dot-irecommendthis-', '', $_POST['recommend_id']);
431
- echo $this->dot_recommend_this($post_id, $options['text_zero_suffix'], $options['text_one_suffix'], $options['text_more_suffix'], 'update');
432
- } else {
433
- // AJAXing data in. Get Count
434
- $post_id = str_replace('dot-irecommendthis-', '', $_POST['post_id']);
435
- echo $this->dot_recommend_this($post_id, $options['text_zero_suffix'], $options['text_one_suffix'], $options['text_more_suffix'], 'get');
436
- }
437
-
438
- exit;
439
-
440
- } //ajax_callback
441
-
442
-
443
- /*--------------------------------------------*
444
- * Main Process
445
- *--------------------------------------------*/
446
-
447
-
448
- function dot_recommend_this($post_id, $text_zero_suffix = false, $text_one_suffix = false, $text_more_suffix = false, $action = 'get')
449
- {
450
- if(!is_numeric($post_id)) return;
451
- $text_zero_suffix = strip_tags($text_zero_suffix);
452
- $text_one_suffix = strip_tags($text_one_suffix);
453
- $text_more_suffix = strip_tags($text_more_suffix);
454
-
455
-
456
- switch($action) {
457
-
458
- case 'get':
459
- $recommended = get_post_meta($post_id, '_recommended', true);
460
- if( !$recommended ){
461
- $recommended = 0;
462
- add_post_meta($post_id, '_recommended', $recommended, true);
463
- }
464
-
465
- if( $recommended == 0 ) { $suffix = $text_zero_suffix; }
466
- elseif( $recommended == 1 ) { $suffix = $text_one_suffix; }
467
- else { $suffix = $text_more_suffix; }
468
-
469
-
470
- /*
471
-
472
- Hides the count is the count is zero.
473
-
474
- */
475
- $options = get_option( 'dot_irecommendthis_settings' );
476
- if( !isset($options['hide_zero']) ) $options['hide_zero'] = '0';
477
-
478
-
479
- if( ($recommended == 0) && $options['hide_zero'] == 1 ) {
480
-
481
- $output = '<span class="dot-irecommendthis-count">&nbsp;</span> <span class="dot-irecommendthis-suffix">'. $suffix .'</span>';
482
-
483
- return $output;
484
-
485
- } else {
486
-
487
- $output = '<span class="dot-irecommendthis-count">'. $recommended .'</span> <span class="dot-irecommendthis-suffix">'. $suffix .'</span>';
488
-
489
- return $output;
490
-
491
- }
492
-
493
- break;
494
-
495
-
496
- case 'update':
497
-
498
- $recommended = get_post_meta($post_id, '_recommended', true);
499
-
500
- $options = get_option( 'dot_irecommendthis_settings' );
501
- if( !isset($options['disable_unique_ip']) ) $options['disable_unique_ip'] = '0';
502
-
503
- /*
504
-
505
- Check if Unique IP saving is required or disabled
506
-
507
- */
508
- if( $options['disable_unique_ip'] != 0 ) {
509
-
510
- if ( isset($_COOKIE['dot_irecommendthis_'. $post_id]) ) {
511
- return $recommended;
512
- }
513
-
514
- $recommended++;
515
- update_post_meta($post_id, '_recommended', $recommended);
516
- setcookie('dot_irecommendthis_'. $post_id, time(), time()+3600*24*365, '/');
517
-
518
-
519
- } else {
520
-
521
- global $wpdb;
522
- $ip = $_SERVER['REMOTE_ADDR'];
523
- $voteStatusByIp = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."irecommendthis_votes WHERE post_id = '$post_id' AND ip = '$ip'");
524
-
525
- if ( isset($_COOKIE['dot_irecommendthis_'. $post_id]) || $voteStatusByIp != 0 ) {
526
- return $recommended;
527
- }
528
-
529
- $recommended++;
530
- update_post_meta($post_id, '_recommended', $recommended);
531
- setcookie('dot_irecommendthis_'. $post_id, time(), time()+3600*24*365, '/');
532
- $wpdb->query("INSERT INTO ".$wpdb->prefix."irecommendthis_votes VALUES ('', NOW(), '$post_id', '$ip')");
533
-
534
- }
535
-
536
-
537
-
538
-
539
- if( $recommended == 0 ) { $suffix = $text_zero_suffix; }
540
- elseif( $recommended == 1 ) { $suffix = $text_one_suffix; }
541
- else { $suffix = $text_more_suffix; }
542
-
543
- $output = '<span class="dot-irecommendthis-count">'. $recommended .'</span> <span class="dot-irecommendthis-suffix">'. $suffix .'</span>';
544
-
545
- $dot_irt_html = apply_filters( 'dot_irt_before_count', $output );
546
-
547
- return $dot_irt_html;
548
-
549
- break;
550
-
551
- }
552
- } //dot_recommend_this
553
-
554
-
555
- /*--------------------------------------------*
556
- * Shortcode
557
- *--------------------------------------------*/
558
-
559
- function shortcode( $atts )
560
- {
561
- extract( shortcode_atts( array('id' => null), $atts ) );
562
- return $this->dot_recommend($id);
563
-
564
- } //shortcode
565
-
566
-
567
- function dot_recommend($id=null)
568
- {
569
-
570
-
571
- global $wpdb;
572
- $ip = $_SERVER['REMOTE_ADDR'];
573
- $post_ID = $id ? $id : get_the_ID();
574
- global $post;
575
-
576
-
577
- $options = get_option( 'dot_irecommendthis_settings' );
578
- if( !isset($options['text_zero_suffix']) ) $options['text_zero_suffix'] = '';
579
- if( !isset($options['text_one_suffix']) ) $options['text_one_suffix'] = '';
580
- if( !isset($options['text_more_suffix']) ) $options['text_more_suffix'] = '';
581
- if( !isset($options['link_title_new']) ) $options['link_title_new'] = '';
582
- if( !isset($options['link_title_active']) ) $options['link_title_active'] = '';
583
- if( !isset($options['disable_unique_ip']) ) $options['disable_unique_ip'] = '0'; //Check if Unique IP saving is required or disabled
584
-
585
-
586
-
587
- if( $options['disable_unique_ip'] != '1' ) {
588
-
589
- $voteStatusByIp = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."irecommendthis_votes WHERE post_id = '$post_ID' AND ip = '$ip'");
590
- }
591
-
592
-
593
- $output = $this->dot_recommend_this($post_ID, $options['text_zero_suffix'], $options['text_one_suffix'], $options['text_more_suffix']);
594
-
595
-
596
-
597
- //if ( isset($_COOKIE['dot_irecommendthis_'. $post_id]) && $voteStatusByIp != 0 ) {
598
-
599
- if( $options['disable_unique_ip'] != '0' ) {
600
-
601
- if (!isset($_COOKIE['dot_irecommendthis_'.$post_ID])) {
602
- $class = 'dot-irecommendthis';
603
-
604
-
605
- if( $options['link_title_new'] == '' ) {
606
-
607
- $title = __('Recommend this', 'i-recommend-this');
608
-
609
- } else {
610
-
611
- $title = $options['link_title_new'];
612
-
613
- }
614
-
615
- }
616
- else {
617
-
618
- $class = 'dot-irecommendthis active';
619
-
620
- if( $options['link_title_active'] == '' ) {
621
-
622
- $title = __('You already recommended this', 'i-recommend-this');
623
-
624
- } else {
625
-
626
- $title = $options['link_title_active'];
627
-
628
- }
629
- }
630
-
631
- } else {
632
-
633
-
634
- if (!isset($_COOKIE['dot_irecommendthis_'.$post_ID]) && $voteStatusByIp == 0) {
635
- $class = 'dot-irecommendthis';
636
-
637
-
638
- if( $options['link_title_new'] == '' ) {
639
-
640
- $title = __('Recommend this', 'i-recommend-this');
641
-
642
- } else {
643
-
644
- $title = $options['link_title_new'];
645
-
646
- }
647
-
648
- }
649
- else {
650
-
651
- $class = 'dot-irecommendthis active';
652
-
653
- if( $options['link_title_active'] == '' ) {
654
-
655
- $title = __('You already recommended this', 'i-recommend-this');
656
-
657
- } else {
658
-
659
- $title = $options['link_title_active'];
660
-
661
- }
662
- }
663
-
664
- }
665
-
666
- $dot_irt_html = '<a href="#" class="'. $class .'" id="dot-irecommendthis-'. $post_ID .'" title="'. $title .'">';
667
-
668
- $dot_irt_html .= apply_filters( 'dot_irt_before_count', $output );
669
- $dot_irt_html .= '</a>';
670
-
671
- return $dot_irt_html;
672
-
673
- //return '<a href="#" class="'. $class .'" id="dot-irecommendthis-'. $post_ID .'" title="'. $title .'"><i class="icon-heart"></i> '. $output .'</a>';
674
- }
675
-
676
- /*--------------------------------------------*
677
- * Shortcode //dot_recommended_top_posts
678
- *--------------------------------------------*/
679
-
680
- function dot_recommended_top_posts( $atts, $content = null )
681
- {
682
-
683
- // define attributes and their defaults
684
- // get our variable from $atts
685
- $atts = shortcode_atts( array(
686
- 'container' => 'li',
687
- 'number' => '10',
688
- 'post_type' => 'post',
689
- 'year' => '',
690
- 'monthnum' => '',
691
- 'show_count' => '1',
692
- ), $atts );
693
-
694
- global $wpdb;
695
-
696
- // empty params array to hold params for prepared statement
697
- $params = array();
698
-
699
- // build query string
700
- $sql = "SELECT * FROM $wpdb->posts, $wpdb->postmeta WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id";
701
-
702
- // add year
703
- if( '' !== $atts['year'] ) {
704
- $sql .= ' AND YEAR(post_date) = %d';
705
- $params[] = $atts['year'];
706
- }
707
-
708
- // add monthnum
709
- if( '' !== $atts['monthnum'] ) {
710
- $sql .= ' AND MONTH(post_date) = %d';
711
- $params[] = $atts['monthnum'];
712
- }
713
-
714
- // add post WHERE
715
- $sql .= " AND post_status = 'publish' AND post_type = %s AND meta_key = '_recommended'";
716
- $params[] = $atts['post_type'];
717
-
718
- // add order by and limit
719
- $sql .= " ORDER BY {$wpdb->postmeta}.meta_value+0 DESC LIMIT %d";
720
- $params[] = $atts['number'];
721
-
722
- // prepare sql statement
723
- $query = $wpdb->prepare( $sql, $params );
724
-
725
- // execute query
726
- $posts = $wpdb->get_results( $query );
727
-
728
- $return = '';
729
-
730
- foreach ($posts as $item) {
731
- $post_title = stripslashes( $item->post_title );
732
- $permalink = get_permalink( $item->ID );
733
- $post_count = $item->meta_value;
734
-
735
- $return .= '<' . esc_html( $atts['container'] ) . '>';
736
- $return .= '<a href="' . esc_url( $permalink ) . '" title="' . esc_attr( $post_title ) .'" rel="nofollow">' . esc_html( $post_title ) . '</a> ';
737
-
738
- if ( $atts['show_count'] == '1') {
739
- $return .= '<span class="votes">' . esc_html( $post_count ) . '</span> ';
740
- }
741
-
742
- $return .= '</' . esc_html( $atts['container'] ) . '>';
743
-
744
- }
745
- return $return;
746
-
747
- } //dot_recommended_top_posts
748
-
749
-
750
- /*--------------------------------------------*
751
- * Widget
752
- *--------------------------------------------*/
753
-
754
- function add_widget_most_recommended_posts()
755
- {
756
-
757
- function most_recommended_posts($numberOf, $before, $after, $show_count, $post_type="post", $raw=false) {
758
- global $wpdb;
759
-
760
- $request = "SELECT * FROM $wpdb->posts, $wpdb->postmeta";
761
- $request .= " WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id";
762
- $request .= " AND post_status='publish' AND post_type='$post_type' AND meta_key='_recommended'";
763
- $request .= " ORDER BY $wpdb->postmeta.meta_value+0 DESC LIMIT $numberOf";
764
- $posts = $wpdb->get_results($request);
765
-
766
- if ($raw):
767
- return $posts;
768
- else:
769
- foreach ($posts as $item) {
770
- $post_title = stripslashes($item->post_title);
771
- $permalink = get_permalink($item->ID);
772
- $post_count = $item->meta_value;
773
- echo $before.'<a href="' . $permalink . '" title="' . $post_title.'" rel="nofollow">' . $post_title . '</a>';
774
- echo $show_count == '1' ? ' ('.$post_count.')' : '';
775
- echo $after;
776
- }
777
- endif;
778
- }
779
-
780
- function widget_most_recommended_posts($args)
781
- {
782
- extract($args);
783
- $options = get_option("most_recommended_posts");
784
- if (!is_array( $options ))
785
- {
786
- $options = array(
787
- 'title' => __('Most recommended posts', 'i-recommend-this'),
788
- 'number' => __('5', 'i-recommend-this'),
789
- 'show_count' => '0'
790
- );
791
- }
792
- $title = $options['title'];
793
- $numberOf = $options['number'];
794
- $show_count = $options['show_count'];
795
-
796
- echo $before_widget;
797
- echo $before_title . $title . $after_title;
798
- echo '<ul class="mostrecommendedposts">';
799
-
800
- most_recommended_posts($numberOf, '<li>', '</li>', $show_count);
801
-
802
- echo '</ul>';
803
- echo $after_widget;
804
- }
805
-
806
- wp_register_sidebar_widget('most_recommended_posts', __('Most recommended posts', 'i-recommend-this'), 'widget_most_recommended_posts');
807
-
808
- function options_widget_most_recommended_posts() {
809
- $options = get_option("most_recommended_posts");
810
-
811
- if (!is_array( $options )) {
812
- $options = array(
813
- 'title' => __('Most recommended posts', 'i-recommend-this'),
814
- 'number' => __('5', 'dot'),
815
- 'show_count' => '0'
816
- );
817
- }
818
-
819
-
820
- if ( isset($_POST['mrp-submit']) ) {
821
- $options['title'] = htmlspecialchars($_POST['mrp-title']);
822
- $options['number'] = htmlspecialchars($_POST['mrp-number']);
823
- $options['show_count'] = $_POST['mrp-show-count'];
824
- if ( $options['number'] > 15) { $options['number'] = 15; }
825
-
826
- update_option("most_recommended_posts", $options);
827
- }
828
- ?>
829
- <p><label for="mrp-title"><?php _e('Title:', 'i-recommend-this'); ?><br />
830
- <input class="widefat" type="text" id="mrp-title" name="mrp-title" value="<?php echo $options['title'];?>" /></label></p>
831
-
832
- <p><label for="mrp-number"><?php _e('Number of posts to show:', 'i-recommend-this'); ?><br />
833
- <input type="text" id="mrp-number" name="mrp-number" style="width: 25px;" value="<?php echo $options['number'];?>" /> <small>(max. 15)</small></label></p>
834
-
835
- <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>
836
-
837
- <input type="hidden" id="mrp-submit" name="mrp-submit" value="1" />
838
- <?php
839
- }
840
- wp_register_widget_control('most_recommended_posts', __('Most recommended posts', 'i-recommend-this'), 'options_widget_most_recommended_posts');
841
- }
842
-
843
-
844
- } // End Class
845
-
846
- global $dot_irecommendthis;
847
-
848
- // Initiation call of plugin
849
- $dot_irecommendthis = new DOT_IRecommendThis(__FILE__);
850
-
851
- }
852
-
853
- /*--------------------------------------------*
854
- * Template Tag
855
- *--------------------------------------------*/
856
-
857
- function dot_irecommendthis( $id = null )
858
- {
859
- global $dot_irecommendthis;
860
- echo $dot_irecommendthis->dot_recommend( $id );
861
-
862
- }
863
-
864
- /*--------------------------------------------*
865
- * Settings Menu
866
- *--------------------------------------------*/
867
-
868
- add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'dot_irecommendthis_plugin_links' );
869
-
870
- function dot_irecommendthis_plugin_links($links) {
871
- return array_merge(
872
- array(
873
- 'settings' => '<a href="' . get_bloginfo('wpurl') . '/wp-admin/options-general.php?page=dot-irecommendthis">' . __('Settings', 'dot-irecommendthis') . '</a>'
874
- ),
875
- $links
876
- );
877
- }
878
-
879
- /*--------------------------------------------*
880
- * Add Likes Column In Post Manage Page
881
- *--------------------------------------------*/
882
-
883
- function dot_columns_head($defaults) {
884
- $defaults['likes'] = __('Likes', 'i-recommend-this');
885
- return $defaults;
886
- }
887
-
888
- function dot_column_content($column_name, $post_ID) {
889
- if ($column_name == 'likes')
890
- echo get_post_meta($post_ID, '_recommended', true) . ' ' . __('like', 'i-recommend-this');
891
- }
892
-
893
- function dot_column_register_sortable( $columns ) {
894
- $columns['likes'] = 'likes';
895
- return $columns;
896
- }
897
-
898
- function dot_column_orderby( $vars ) {
899
- if ( isset( $vars['orderby'] ) && 'likes' == $vars['orderby'] ) {
900
- $vars = array_merge( $vars, array(
901
- 'meta_key' => '_recommended',
902
- 'orderby' => 'meta_value'
903
- ) );
904
- }
905
-
906
- return $vars;
907
- }
908
- add_filter('request', 'dot_column_orderby');
909
- add_filter('manage_edit-post_sortable_columns', 'dot_column_register_sortable');
910
- add_filter('manage_posts_columns', 'dot_columns_head');
911
- add_action('manage_posts_custom_column', 'dot_column_content', 10, 2);
912
-
913
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
i-recommend-this.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Plugin Name: I Recommend This
4
+ * Plugin URI: https://themeist.com/plugins/wordpress/i-recommend-this/#utm_source=wp-plugin&utm_medium=i-recommend-this&utm_campaign=plugins-page
5
+ * Description: This plugin allows your visitors to simply recommend or like your posts instead of commment it.
6
+ * Version: 3.8.0
7
+ * Author: Harish Chouhan, Themeist
8
+ * Author URI: https://themeist.com/
9
+ * Author Email: support@themeist.com
10
+ * Text Domain: i-recommend-this
11
+ * License: GPL-3.0
12
+ * License URI: http://www.gnu.org/licenses/gpl-3.0.txt
13
+ * Domain Path: /languages
14
+ */
15
+
16
+ if ( ! defined( 'WPINC' ) ) {
17
+ die;
18
+ }
19
+
20
+ // do nothing if class is already defined
21
+ if( class_exists( 'Themeist_IRecommendThis' ) ) {
22
+ return;
23
+ }
24
+
25
+ define( 'THEMEIST_IRT_VERSION', '3.8.0' );
26
+ define( 'THEMEIST_IRT_DB_VERSION', '2.6.2' );
27
+
28
+ // require includes
29
+ require_once dirname( __FILE__ ) . '/includes/class-i-recommend-this.php';
30
+ require_once dirname( __FILE__ ) . '/admin/class-i-recommend-this-admin.php';
31
+ require_once dirname( __FILE__ ) . '/public/class-i-recommend-this-public.php';
32
+ require_once dirname( __FILE__ ) . '/includes/functions.php';
33
+
34
+ // create instance of plugin class
35
+ global $themeist_i_recommend_this;
36
+ $themeist_i_recommend_this = new Themeist_IRecommendThis( __FILE__ );
37
+ $themeist_i_recommend_this->add_hooks();
38
+
39
+ // create instance of plugin class
40
+ global $themeist_i_recommend_this_admin;
41
+ $themeist_i_recommend_this_admin = new Themeist_IRecommendThis_Admin( __FILE__ );
42
+ $themeist_i_recommend_this_admin->add_admin_hooks();
43
+
44
+ // create instance of plugin class
45
+ global $themeist_i_recommend_this_public;
46
+ $themeist_i_recommend_this_public = new Themeist_IRecommendThis_Public( __FILE__ );
47
+ $themeist_i_recommend_this_public->add_public_hooks();
includes/class-i-recommend-this.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Themeist_IRecommendThis {
4
+
5
+ protected $plugin_slug;
6
+
7
+ protected $version;
8
+
9
+ protected $db_version;
10
+
11
+ public $plugin_file;
12
+
13
+ public function __construct( $plugin_file ) {
14
+
15
+ $this->plugin_file = $plugin_file;
16
+
17
+ if ( defined( 'THEMEIST_IRT_VERSION' ) ) {
18
+ $this->version = THEMEIST_IRT_VERSION;
19
+ } else {
20
+ $this->version = '3.8.0';
21
+ }
22
+
23
+ if ( defined( 'THEMEIST_IRT_DB_VERSION' ) ) {
24
+ $this->db_version = THEMEIST_IRT_DB_VERSION;
25
+ } else {
26
+ $this->db_version = '2.6.2';
27
+ }
28
+
29
+ $this->plugin_slug = 'i-recommend-this';
30
+
31
+
32
+ }
33
+
34
+ public function add_hooks() {
35
+ // Run this on activation / deactivation
36
+ register_activation_hook($this->plugin_file, array($this, 'activate'));
37
+
38
+ add_action('init', array($this, 'load_localisation'), 0);
39
+ //add_action( 'plugins_loaded', 'i_recommend_this_load_plugin_textdomain' );
40
+ //add_action( 'plugins_loaded', array( $this, 'i_recommend_this_load_plugin_textdomain' ), 0 );
41
+ }
42
+
43
+ /*--------------------------------------------*
44
+ * Activate
45
+ *--------------------------------------------*/
46
+
47
+ public function activate($network_wide) {
48
+ if (!isset($wpdb)) $wpdb = $GLOBALS['wpdb'];
49
+ global $wpdb;
50
+
51
+ $table_name = $wpdb->prefix . "irecommendthis_votes";
52
+ if ($wpdb->get_var("show tables like '$table_name'") != $table_name) {
53
+ $sql = "CREATE TABLE " . $table_name . " (
54
+ id MEDIUMINT(9) NOT NULL AUTO_INCREMENT,
55
+ time TIMESTAMP NOT NULL,
56
+ post_id BIGINT(20) NOT NULL,
57
+ ip VARCHAR(45) NOT NULL,
58
+ UNIQUE KEY id (id)
59
+ );";
60
+
61
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
62
+
63
+ dbDelta($sql);
64
+
65
+ $this->register_plugin_version();
66
+
67
+ if ($this->db_version != '') {
68
+ update_option('dot_irecommendthis_db_version', $this->db_version);
69
+ }
70
+ }
71
+ }
72
+
73
+ public function register_plugin_version() {
74
+ if ($this->version != '') {
75
+ update_option('dot-irecommendthis' . '-version', $this->version);
76
+ }
77
+ }
78
+
79
+ /**
80
+ * Load the plugin text domain for translation.
81
+ *
82
+ * @since 1.4.6
83
+ */
84
+ public function load_localisation() {
85
+ load_plugin_textdomain('i-recommend-this', false, dirname(plugin_basename($this->plugin_file)) . '/languages/');
86
+ }
87
+
88
+ public function get_version() {
89
+ return $this->version;
90
+ }
91
+
92
+ }
includes/functions.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+ /*--------------------------------------------*
6
+ * Template Tag
7
+ *--------------------------------------------*/
8
+
9
+ function dot_irecommendthis($id = null)
10
+ {
11
+ global $dot_irecommendthis;
12
+ echo $dot_irecommendthis->dot_recommend($id);
13
+
14
+ }
includes/index.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ // Silence is golden.
3
+
4
+ ?>
public/class-i-recommend-this-public.php ADDED
@@ -0,0 +1,519 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Themeist_IRecommendThis_Public {
4
+
5
+ /**
6
+ * @param string $plugin_file
7
+ */
8
+ public function __construct( $plugin_file ) {
9
+ $this->plugin_file = $plugin_file;
10
+ }
11
+
12
+ public function add_public_hooks() {
13
+ add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
14
+ add_action('init', array($this, 'add_widget_most_recommended_posts'));
15
+ add_action('wp_ajax_dot-irecommendthis', array($this, 'ajax_callback'));
16
+ add_action('wp_ajax_nopriv_dot-irecommendthis', array($this, 'ajax_callback'));
17
+ add_filter('the_content', array($this, 'dot_content'));
18
+ add_shortcode('dot_recommends', array($this, 'shortcode'));
19
+ add_shortcode('dot_recommended_posts', array($this, 'dot_recommended_top_posts'));
20
+ }
21
+
22
+ /*--------------------------------------------*
23
+ * Enqueue Scripts
24
+ *--------------------------------------------*/
25
+
26
+ function enqueue_scripts()
27
+ {
28
+ $options = get_option('dot_irecommendthis_settings');
29
+ if (!isset($options['disable_css'])) $options['disable_css'] = '0';
30
+ if (!isset($options['recommend_style'])) $options['recommend_style'] = '0';
31
+
32
+ if ($options['disable_css'] == '0') {
33
+
34
+ if ($options['recommend_style'] == '0') {
35
+ wp_enqueue_style( 'dot-irecommendthis', plugins_url('/css/dot-irecommendthis.css', $this->plugin_file ) );
36
+ } else {
37
+ wp_enqueue_style( 'dot-irecommendthis', plugins_url('/css/dot-irecommendthis-heart.css', $this->plugin_file ) );
38
+ }
39
+ }
40
+ wp_register_script('dot-irecommendthis', plugins_url('/js/dot_irecommendthis.js', $this->plugin_file ), 'jquery', '2.6.0', 'in_footer');
41
+
42
+ wp_enqueue_script('jquery');
43
+ wp_enqueue_script('dot-irecommendthis');
44
+
45
+ wp_localize_script('dot-irecommendthis', 'dot_irecommendthis', array('ajaxurl' => admin_url('admin-ajax.php')));
46
+
47
+ } //dot_enqueue_scripts
48
+
49
+
50
+
51
+ /*--------------------------------------------*
52
+ * Content / Front-end view
53
+ *--------------------------------------------*/
54
+
55
+ function dot_content($content)
56
+ {
57
+ // Don't show on custom page templates or pages
58
+ if (is_page_template() || is_page() || is_front_page()) return $content;
59
+
60
+ // Don't show after excerpts
61
+ global $wp_current_filter;
62
+ if (in_array('get_the_excerpt', (array)$wp_current_filter)) {
63
+ return $content;
64
+ }
65
+
66
+ $options = get_option('dot_irecommendthis_settings');
67
+ if (!isset($options['add_to_posts'])) $options['add_to_posts'] = '0';
68
+ if (!isset($options['add_to_other'])) $options['add_to_other'] = '0';
69
+
70
+ if (is_singular('post') && $options['add_to_posts']) $content .= $this->dot_recommend();
71
+ if ((is_home() || is_category() || is_tag() || is_author() || is_date() || is_search()) && $options['add_to_other']) $content .= $this->dot_recommend();
72
+
73
+ return $content;
74
+
75
+ } //dot_content
76
+
77
+ /*--------------------------------------------*
78
+ * AJAX Callback
79
+ *--------------------------------------------*/
80
+
81
+ function ajax_callback($post_id)
82
+ {
83
+ $options = get_option('dot_irecommendthis_settings');
84
+ if (!isset($options['add_to_posts'])) $options['add_to_posts'] = '1';
85
+ if (!isset($options['add_to_other'])) $options['add_to_other'] = '1';
86
+ if (!isset($options['text_zero_suffix'])) $options['text_zero_suffix'] = '';
87
+ if (!isset($options['text_one_suffix'])) $options['text_one_suffix'] = '';
88
+ if (!isset($options['text_more_suffix'])) $options['text_more_suffix'] = '';
89
+
90
+ if (isset($_POST['recommend_id'])) {
91
+ // Click event. Get and Update Count
92
+ $post_id = str_replace('dot-irecommendthis-', '', $_POST['recommend_id']);
93
+ echo $this->dot_recommend_this($post_id, $options['text_zero_suffix'], $options['text_one_suffix'], $options['text_more_suffix'], 'update');
94
+ } else {
95
+ // AJAXing data in. Get Count
96
+ $post_id = str_replace('dot-irecommendthis-', '', $_POST['post_id']);
97
+ echo $this->dot_recommend_this($post_id, $options['text_zero_suffix'], $options['text_one_suffix'], $options['text_more_suffix'], 'get');
98
+ }
99
+
100
+ exit;
101
+
102
+ } //ajax_callback
103
+
104
+
105
+ /*--------------------------------------------*
106
+ * Main Process
107
+ *--------------------------------------------*/
108
+
109
+
110
+ function dot_recommend_this($post_id, $text_zero_suffix = false, $text_one_suffix = false, $text_more_suffix = false, $action = 'get')
111
+ {
112
+ global $wpdb;
113
+ if (!is_numeric($post_id)) return;
114
+ $text_zero_suffix = strip_tags($text_zero_suffix);
115
+ $text_one_suffix = strip_tags($text_one_suffix);
116
+ $text_more_suffix = strip_tags($text_more_suffix);
117
+
118
+
119
+ switch ($action) {
120
+
121
+ case 'get':
122
+ $recommended = get_post_meta($post_id, '_recommended', true);
123
+ if (!$recommended) {
124
+ $recommended = 0;
125
+ add_post_meta($post_id, '_recommended', $recommended, true);
126
+ }
127
+
128
+ if ($recommended == 0) {
129
+ $suffix = $text_zero_suffix;
130
+ } elseif ($recommended == 1) {
131
+ $suffix = $text_one_suffix;
132
+ } else {
133
+ $suffix = $text_more_suffix;
134
+ }
135
+
136
+
137
+ /*
138
+
139
+ Hides the count is the count is zero.
140
+
141
+ */
142
+ $options = get_option('dot_irecommendthis_settings');
143
+ if (!isset($options['hide_zero'])) $options['hide_zero'] = '0';
144
+
145
+
146
+ if (($recommended == 0) && $options['hide_zero'] == 1) {
147
+
148
+ $output = '<span class="dot-irecommendthis-count">&nbsp;</span> <span class="dot-irecommendthis-suffix">' . $suffix . '</span>';
149
+
150
+ return $output;
151
+
152
+ } else {
153
+
154
+ $output = '<span class="dot-irecommendthis-count">' . $recommended . '</span> <span class="dot-irecommendthis-suffix">' . $suffix . '</span>';
155
+
156
+ return $output;
157
+
158
+ }
159
+
160
+ break;
161
+
162
+
163
+ case 'update':
164
+
165
+ $recommended = get_post_meta($post_id, '_recommended', true);
166
+
167
+ $options = get_option('dot_irecommendthis_settings');
168
+ if (!isset($options['enable_unique_ip'])) $options['enable_unique_ip'] = '0';
169
+
170
+ /*
171
+
172
+ Check if Unique IP saving is required or disabled
173
+
174
+ */
175
+ if ($options['enable_unique_ip'] != 0) {
176
+
177
+ $ip = $_SERVER['REMOTE_ADDR'];
178
+ $sql = $wpdb->prepare("SELECT COUNT(*) FROM " . $wpdb->prefix . "irecommendthis_votes WHERE post_id = %d AND ip = %s", $post_id, $ip);
179
+ $voteStatusByIp = $wpdb->get_var($sql);
180
+
181
+ if (isset($_COOKIE['dot_irecommendthis_' . $post_id]) || $voteStatusByIp != 0) {
182
+ return $recommended;
183
+ }
184
+
185
+ $recommended++;
186
+ update_post_meta($post_id, '_recommended', $recommended);
187
+ setcookie('dot_irecommendthis_' . $post_id, time(), time() + 3600 * 24 * 365, '/');
188
+ $sql = $wpdb->prepare("INSERT INTO " . $wpdb->prefix . "irecommendthis_votes VALUES ('', NOW(), %d, %s )", $post_id, $ip);
189
+ $wpdb->query($sql);
190
+
191
+ } else {
192
+
193
+ if (isset($_COOKIE['dot_irecommendthis_' . $post_id])) {
194
+ return $recommended;
195
+ }
196
+
197
+ $recommended++;
198
+ update_post_meta($post_id, '_recommended', $recommended);
199
+ setcookie('dot_irecommendthis_' . $post_id, time(), time() + 3600 * 24 * 365, '/');
200
+
201
+ }
202
+
203
+
204
+ if ($recommended == 0) {
205
+ $suffix = $text_zero_suffix;
206
+ } elseif ($recommended == 1) {
207
+ $suffix = $text_one_suffix;
208
+ } else {
209
+ $suffix = $text_more_suffix;
210
+ }
211
+
212
+ $output = '<span class="dot-irecommendthis-count">' . $recommended . '</span> <span class="dot-irecommendthis-suffix">' . $suffix . '</span>';
213
+
214
+ $dot_irt_html = apply_filters('dot_irt_before_count', $output);
215
+
216
+ return $dot_irt_html;
217
+
218
+ break;
219
+
220
+ }
221
+ } //dot_recommend_this
222
+
223
+
224
+ /*--------------------------------------------*
225
+ * Shortcode
226
+ *--------------------------------------------*/
227
+
228
+ function shortcode($atts)
229
+ {
230
+ extract(shortcode_atts(array('id' => null), $atts));
231
+ return $this->dot_recommend($id);
232
+
233
+ } //shortcode
234
+
235
+
236
+ function dot_recommend($id = null)
237
+ {
238
+
239
+
240
+ global $wpdb, $post;
241
+ $ip = $_SERVER['REMOTE_ADDR'];
242
+ $post_id = $id ? $id : get_the_ID();
243
+
244
+ $options = get_option('dot_irecommendthis_settings');
245
+ if (!isset($options['text_zero_suffix'])) $options['text_zero_suffix'] = '';
246
+ if (!isset($options['text_one_suffix'])) $options['text_one_suffix'] = '';
247
+ if (!isset($options['text_more_suffix'])) $options['text_more_suffix'] = '';
248
+ if (!isset($options['link_title_new'])) $options['link_title_new'] = '';
249
+ if (!isset($options['link_title_active'])) $options['link_title_active'] = '';
250
+ if (!isset($options['enable_unique_ip'])) $options['enable_unique_ip'] = '0'; //Check if Unique IP saving is required or disabled
251
+
252
+
253
+ $output = $this->dot_recommend_this($post_id, $options['text_zero_suffix'], $options['text_one_suffix'], $options['text_more_suffix']);
254
+
255
+
256
+ //if ( isset($_COOKIE['dot_irecommendthis_'. $post_id]) && $voteStatusByIp != 0 ) {
257
+
258
+ if ($options['enable_unique_ip'] != '0') {
259
+
260
+ $sql = $wpdb->prepare("SELECT COUNT(*) FROM " . $wpdb->prefix . "irecommendthis_votes WHERE post_id = %d AND ip = %s", $post_id, $ip);
261
+ $voteStatusByIp = $wpdb->get_var($sql);
262
+
263
+
264
+ if (!isset($_COOKIE['dot_irecommendthis_' . $post_id]) && $voteStatusByIp == 0) {
265
+ $class = 'dot-irecommendthis';
266
+
267
+
268
+ if ($options['link_title_new'] == '') {
269
+
270
+ $title = __('Recommend this', 'i-recommend-this');
271
+
272
+ } else {
273
+
274
+ $title = $options['link_title_new'];
275
+
276
+ }
277
+
278
+ } else {
279
+
280
+ $class = 'dot-irecommendthis active';
281
+
282
+ if ($options['link_title_active'] == '') {
283
+
284
+ $title = __('You already recommended this', 'i-recommend-this');
285
+
286
+ } else {
287
+
288
+ $title = $options['link_title_active'];
289
+
290
+ }
291
+ }
292
+
293
+
294
+ } else {
295
+
296
+ if (!isset($_COOKIE['dot_irecommendthis_' . $post_id])) {
297
+ $class = 'dot-irecommendthis';
298
+
299
+
300
+ if ($options['link_title_new'] == '') {
301
+
302
+ $title = __('Recommend this', 'i-recommend-this');
303
+
304
+ } else {
305
+
306
+ $title = $options['link_title_new'];
307
+
308
+ }
309
+
310
+ } else {
311
+
312
+ $class = 'dot-irecommendthis active';
313
+
314
+ if ($options['link_title_active'] == '') {
315
+
316
+ $title = __('You already recommended this', 'i-recommend-this');
317
+
318
+ } else {
319
+
320
+ $title = $options['link_title_active'];
321
+
322
+ }
323
+ }
324
+
325
+ }
326
+
327
+ $dot_irt_html = '<a href="#" class="' . $class . '" id="dot-irecommendthis-' . $post_id . '" title="' . $title . '">';
328
+
329
+ $dot_irt_html .= apply_filters('dot_irt_before_count', $output);
330
+ $dot_irt_html .= '</a>';
331
+
332
+ return $dot_irt_html;
333
+
334
+ //return '<a href="#" class="'. $class .'" id="dot-irecommendthis-'. $post_ID .'" title="'. $title .'"><i class="icon-heart"></i> '. $output .'</a>';
335
+ }
336
+
337
+
338
+
339
+ /*--------------------------------------------*
340
+ * Shortcode //dot_recommended_top_posts
341
+ *--------------------------------------------*/
342
+
343
+ function dot_recommended_top_posts($atts, $content = null)
344
+ {
345
+
346
+ // define attributes and their defaults
347
+ // get our variable from $atts
348
+ $atts = shortcode_atts(array(
349
+ 'container' => 'li',
350
+ 'number' => '10',
351
+ 'post_type' => 'post',
352
+ 'year' => '',
353
+ 'monthnum' => '',
354
+ 'show_count' => '1',
355
+ ), $atts);
356
+
357
+ global $wpdb;
358
+
359
+ // empty params array to hold params for prepared statement
360
+ $params = array();
361
+
362
+ // build query string
363
+ $sql = "SELECT * FROM $wpdb->posts, $wpdb->postmeta WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id";
364
+
365
+ // add year
366
+ if ('' !== $atts['year']) {
367
+ $sql .= ' AND YEAR(post_date) = %d';
368
+ $params[] = $atts['year'];
369
+ }
370
+
371
+ // add monthnum
372
+ if ('' !== $atts['monthnum']) {
373
+ $sql .= ' AND MONTH(post_date) = %d';
374
+ $params[] = $atts['monthnum'];
375
+ }
376
+
377
+ // add post WHERE
378
+ $sql .= " AND post_status = 'publish' AND post_type = %s AND meta_key = '_recommended'";
379
+ $params[] = $atts['post_type'];
380
+
381
+ // add order by and limit
382
+ $sql .= " ORDER BY {$wpdb->postmeta}.meta_value+0 DESC LIMIT %d";
383
+ $params[] = $atts['number'];
384
+
385
+ // prepare sql statement
386
+ $query = $wpdb->prepare($sql, $params);
387
+
388
+ // execute query
389
+ $posts = $wpdb->get_results($query);
390
+
391
+ $return = '';
392
+
393
+ foreach ($posts as $item) {
394
+ $post_title = stripslashes($item->post_title);
395
+ $permalink = get_permalink($item->ID);
396
+ $post_count = $item->meta_value;
397
+
398
+ $return .= '<' . esc_html($atts['container']) . '>';
399
+ $return .= '<a href="' . esc_url($permalink) . '" title="' . esc_attr($post_title) . '" rel="nofollow">' . esc_html($post_title) . '</a> ';
400
+
401
+ if ($atts['show_count'] == '1') {
402
+ $return .= '<span class="votes">' . esc_html($post_count) . '</span> ';
403
+ }
404
+
405
+ $return .= '</' . esc_html($atts['container']) . '>';
406
+
407
+ }
408
+ return $return;
409
+
410
+ } //dot_recommended_top_posts
411
+
412
+
413
+
414
+
415
+ /*--------------------------------------------*
416
+ * Widget
417
+ *--------------------------------------------*/
418
+
419
+ function add_widget_most_recommended_posts()
420
+ {
421
+
422
+ function most_recommended_posts($numberOf, $before, $after, $show_count, $post_type = "post", $raw = false)
423
+ {
424
+ global $wpdb;
425
+
426
+ $request = "SELECT * FROM $wpdb->posts, $wpdb->postmeta";
427
+ $request .= " WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id";
428
+ $request .= " AND post_status='publish' AND post_type='$post_type' AND meta_key='_recommended'";
429
+ $request .= " ORDER BY $wpdb->postmeta.meta_value+0 DESC LIMIT $numberOf";
430
+ $posts = $wpdb->get_results($request);
431
+
432
+ if ($raw):
433
+ return $posts;
434
+ else:
435
+ foreach ($posts as $item) {
436
+ $post_title = stripslashes($item->post_title);
437
+ $permalink = get_permalink($item->ID);
438
+ $post_count = $item->meta_value;
439
+ echo $before . '<a href="' . $permalink . '" title="' . $post_title . '" rel="nofollow">' . $post_title . '</a>';
440
+ echo $show_count == '1' ? ' (' . $post_count . ')' : '';
441
+ echo $after;
442
+ }
443
+ endif;
444
+ }
445
+
446
+ function widget_most_recommended_posts($args)
447
+ {
448
+ extract($args);
449
+ $options = get_option("most_recommended_posts");
450
+ if (!is_array($options)) {
451
+ $options = array(
452
+ 'title' => __('Most recommended posts', 'i-recommend-this'),
453
+ 'number' => __('5', 'i-recommend-this'),
454
+ 'show_count' => '0'
455
+ );
456
+ }
457
+ $title = $options['title'];
458
+ $numberOf = absint( $options['number'] );
459
+ $show_count = $options['show_count'];
460
+
461
+ echo $before_widget;
462
+ echo $before_title . $title . $after_title;
463
+ echo '<ul class="mostrecommendedposts">';
464
+
465
+ most_recommended_posts($numberOf, '<li>', '</li>', $show_count);
466
+
467
+ echo '</ul>';
468
+ echo $after_widget;
469
+ }
470
+
471
+ wp_register_sidebar_widget('most_recommended_posts', __('Most recommended posts', 'i-recommend-this'), 'widget_most_recommended_posts');
472
+
473
+ function options_widget_most_recommended_posts()
474
+ {
475
+ $options = get_option("most_recommended_posts");
476
+
477
+ if (!is_array($options)) {
478
+ $options = array(
479
+ 'title' => __('Most recommended posts', 'i-recommend-this'),
480
+ 'number' => __('5', 'dot'),
481
+ 'show_count' => '0'
482
+ );
483
+ }
484
+
485
+
486
+ if (isset($_POST['mrp-submit'])) {
487
+ $options['title'] = htmlspecialchars($_POST['mrp-title']);
488
+ $options['number'] = htmlspecialchars($_POST['mrp-number']);
489
+ $options['show_count'] = $_POST['mrp-show-count'];
490
+ if ($options['number'] > 15) {
491
+ $options['number'] = 15;
492
+ }
493
+
494
+ update_option("most_recommended_posts", $options);
495
+ }
496
+ ?>
497
+ <p><label for="mrp-title"><?php _e('Title:', 'i-recommend-this'); ?><br/>
498
+ <input class="widefat" type="text" id="mrp-title" name="mrp-title"
499
+ value="<?php echo $options['title']; ?>"/></label></p>
500
+
501
+ <p><label for="mrp-number"><?php _e('Number of posts to show:', 'i-recommend-this'); ?><br/>
502
+ <input type="text" id="mrp-number" name="mrp-number" style="width: 25px;"
503
+ value="<?php echo $options['number']; ?>"/>
504
+ <small>(max. 15)</small>
505
+ </label></p>
506
+
507
+ <p><label for="mrp-show-count"><input type="checkbox" id="mrp-show-count" name="mrp-show-count"
508
+ value="1"<?php if ($options['show_count'] == '1') echo 'checked="checked"'; ?> /> <?php _e('Show post count', 'i-recommend-this'); ?>
509
+ </label></p>
510
+
511
+ <input type="hidden" id="mrp-submit" name="mrp-submit" value="1"/>
512
+ <?php
513
+ }
514
+
515
+ wp_register_widget_control('most_recommended_posts', __('Most recommended posts', 'i-recommend-this'), 'options_widget_most_recommended_posts');
516
+ }
517
+
518
+
519
+ }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: themeist, hchouhan
3
  Donate link: http://themeist.com
4
  Tags: recommend, like, love, post, rate, rating, post rating, heart, dribbble like, tumblr like
5
  Requires at least: 4.0
6
- Tested up to: 4.5.2
7
- Stable tag: 3.7.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -99,6 +99,14 @@ You can also visit the [support center](http://www.dreamsonline.net/wordpress-pl
99
 
100
  == Changelog ==
101
 
 
 
 
 
 
 
 
 
102
  = 3.7.7
103
  * Dutch Translation added by Tim de Hoog
104
  * Added support for IPv6
3
  Donate link: http://themeist.com
4
  Tags: recommend, like, love, post, rate, rating, post rating, heart, dribbble like, tumblr like
5
  Requires at least: 4.0
6
+ Tested up to: 4.9.8
7
+ Stable tag: 3.8.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
99
 
100
  == Changelog ==
101
 
102
+ = 3.8.0
103
+ * Added data sanitization
104
+ * Made IP saing options
105
+ * Restructured plugin code
106
+
107
+ = 3.7.8
108
+ * Vulnerabilities fixed by DannyvanKooten
109
+
110
  = 3.7.7
111
  * Dutch Translation added by Tim de Hoog
112
  * Added support for IPv6