WP Review - Version 4.0.2

Version Description

  • Added back missing Widget Title field
Download this release

Release Info

Developer MyThemeShop
Plugin Icon 128x128 WP Review
Version 4.0.2
Comparing to
See all releases

Code changes from version 3.3.5 to 4.0.2

admin/activation.php CHANGED
@@ -1,26 +1 @@
1
- <?php
2
- function mts_create_review_tables(){
3
-
4
- global $wpdb;
5
- $table_name = $wpdb->prefix . MTS_WP_REVIEW_DB_TABLE;
6
- if (function_exists('is_multisite') && is_multisite()) $table_name = $wpdb->base_prefix . MTS_WP_REVIEW_DB_TABLE;
7
-
8
- /*$sql = "DROP TABLE IF_EXISTS $table_name;";
9
- $e = $wpdb->query($sql);
10
- die(var_dump($e));*/
11
- $my_stat_sql = "CREATE TABLE IF NOT EXISTS $table_name (
12
- id int(11) NOT NULL auto_increment,
13
- blog_id int(11) NOT NULL,
14
- post_id int(11) NOT NULL,
15
- user_id int(11) NOT NULL,
16
- user_ip varchar(55) NOT NULL,
17
- rate int(11) NOT NULL,
18
- date datetime NOT NULL,
19
- UNIQUE KEY id (id)
20
- );";
21
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
22
- dbDelta( $my_stat_sql );
23
- }
24
- mts_create_review_tables();
25
-
26
- ?>
1
+ <?php // SILENCE IS GOLDEN.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/admin.php CHANGED
@@ -1,34 +1,42 @@
1
- <?php
2
- /**
3
- * Admin functions for this plugin.
4
- *
5
- * @since 1.0
6
- * @copyright Copyright (c) 2013, MyThemesShop
7
- * @author MyThemesShop
8
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9
- */
10
-
11
- /* Register admin.css file. */
12
- add_action( 'admin_enqueue_scripts', 'wp_review_admin_style' );
13
-
14
- /**
15
- * Register custom style for the meta box.
16
- *
17
- * @since 1.0
18
- */
19
- function wp_review_admin_style( $hook_suffix ) {
20
- wp_enqueue_style( 'wp-review-admin-style', WP_REVIEW_ASSETS . 'css/admin.css', array(), WP_REVIEW_PLUGIN_VERSION );
21
- wp_enqueue_script( 'wp-review-admin-script', WP_REVIEW_ASSETS . 'js/admin.js', array( 'wp-color-picker', 'jquery' ), WP_REVIEW_PLUGIN_VERSION, true );
22
-
23
- /* Load the color picker dependencies style. */
24
- wp_enqueue_style( 'wp-color-picker' );
25
-
26
- wp_enqueue_style('plugin_name-admin-ui-css',
27
- 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/smoothness/jquery-ui.css',
28
- false,
29
- null,
30
- false);
31
-
32
- }
33
-
 
 
 
 
 
 
 
 
34
  ?>
1
+ <?php
2
+ /**
3
+ * Admin functions for this plugin.
4
+ *
5
+ * @since 1.0
6
+ * @copyright Copyright (c) 2013, MyThemesShop
7
+ * @author MyThemesShop
8
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9
+ */
10
+
11
+ /* Register admin.css file. */
12
+ add_action( 'admin_enqueue_scripts', 'wp_review_admin_style' );
13
+
14
+ /**
15
+ * Register custom style for the meta box.
16
+ *
17
+ * @since 1.0
18
+ */
19
+ function wp_review_admin_style( $hook_suffix ) {
20
+ wp_enqueue_style( 'wp-review-admin-style', WP_REVIEW_ASSETS . 'css/admin.css', array( 'wp-color-picker' ) );
21
+ wp_enqueue_script(
22
+ 'wp-review-admin-script',
23
+ WP_REVIEW_ASSETS . 'js/admin.js',
24
+ array( 'wp-color-picker', 'jquery', 'jquery-ui-core', 'jquery-ui-slider', 'jquery-ui-sortable' ),
25
+ false,
26
+ true
27
+ );
28
+
29
+ wp_enqueue_style(
30
+ 'wp-review-admin-ui-css',
31
+ '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/smoothness/jquery-ui.css',
32
+ false,
33
+ null,
34
+ false
35
+ );
36
+
37
+ // Load frontend css but not on the post editor screen
38
+ if ( stripos('post.php', $hook_suffix) === false ) {
39
+ wp_enqueue_style( 'wp_review-style', trailingslashit( WP_REVIEW_ASSETS ) . 'css/wp-review.css', array(), WP_REVIEW_PLUGIN_VERSION, 'all' );
40
+ }
41
+ }
42
  ?>
admin/metaboxes.php CHANGED
@@ -1,478 +1,495 @@
1
- <?php
2
- /**
3
- * File for registering meta box.
4
- *
5
- * @since 2.0
6
- * @copyright Copyright (c) 2013, MyThemesShop
7
- * @author MyThemesShop
8
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9
- */
10
-
11
- /* Adds a box to the Posts edit screens. */
12
- add_action( 'add_meta_boxes', 'wp_review_add_meta_boxes' );
13
-
14
- /* Saves the meta box custom data. */
15
- add_action( 'save_post', 'wp_review_save_postdata', 10, 2 );
16
-
17
- /**
18
- * Adds a box to the Post edit screens.
19
- *
20
- * @since 1.0
21
- */
22
- function wp_review_add_meta_boxes() {
23
- $post_types = get_post_types( array('public' => true), 'names' );
24
- $excluded_post_types = apply_filters('wp_review_excluded_post_types', array('attachment'));
25
-
26
- foreach ($post_types as $post_type) {
27
- if (!in_array($post_type, $excluded_post_types)) {
28
- add_meta_box(
29
- 'wp-review-metabox-review',
30
- __( 'Review', 'wp-review' ),
31
- 'wp_review_render_meta_box_review_options',
32
- $post_type,
33
- 'normal',
34
- 'high'
35
- );
36
-
37
- add_meta_box(
38
- 'wp-review-metabox-item',
39
- __( 'Review Item', 'wp-review' ),
40
- 'wp_review_render_meta_box_item',
41
- $post_type,
42
- 'normal',
43
- 'high'
44
- );
45
-
46
- add_meta_box(
47
- 'wp-review-metabox-heading',
48
- __( 'Review Heading', 'wp-review' ),
49
- 'wp_review_render_meta_box_heading',
50
- $post_type,
51
- 'normal',
52
- 'high'
53
- );
54
-
55
- add_meta_box(
56
- 'wp-review-metabox-desc',
57
- __( 'Review Description', 'wp-review' ),
58
- 'wp_review_render_meta_box_desc',
59
- $post_type,
60
- 'normal',
61
- 'high'
62
- );
63
-
64
- add_meta_box(
65
- 'wp-review-metabox-userReview',
66
- __( 'User Reviews', 'wp-review' ),
67
- 'wp_review_render_meta_box_userReview',
68
- $post_type,
69
- 'normal',
70
- 'high'
71
- );
72
- }
73
- }
74
- }
75
-
76
- /**
77
- * Render the meta box.
78
- *
79
- * @since 1.0
80
- */
81
- function wp_review_render_meta_box_review_options( $post ) {
82
- global $post;
83
-
84
- /* Add an nonce field so we can check for it later. */
85
- wp_nonce_field( basename( __FILE__ ), 'wp-review-review-options-nonce' );
86
-
87
- /* Retrieve an existing value from the database. */
88
- $type = get_post_meta( $post->ID, 'wp_review_type', true );
89
-
90
- $available_types = apply_filters('wp_review_metabox_types', array('star' => __('Star', 'wp-review'), 'point' => __('Point', 'wp-review'), 'percentage' => __('Percentage', 'wp-review')));
91
- ?>
92
-
93
- <p class="wp-review-field">
94
- <label for="wp_review_type"><?php _e( 'Review Type', 'wp-review' ); ?></label>
95
- <select name="wp_review_type" id="wp_review_type">
96
- <option value=""><?php _e( 'No Review', 'wp-review' ) ?></option>
97
- <?php foreach ($available_types as $available_type => $label) { ?>
98
- <option value="<?php echo $available_type; ?>" <?php selected( $type, $available_type ); ?>><?php echo $label; ?></option>
99
- <?php } ?>
100
- </select>
101
- <span id="wp_review_id_hint">Review ID: <strong><?php echo $post->ID; ?></strong></span>
102
- </p>
103
-
104
- <?php
105
- }
106
-
107
- /**
108
- * Render the meta box.
109
- *
110
- * @since 1.0
111
- */
112
- function wp_review_render_meta_box_item( $post ) {
113
- $options = get_option('wp_review_options');
114
- $defaultColors = apply_filters('wp_review_default_colors', array(
115
- 'color' => '#1e73be',
116
- 'fontcolor' => '#555555',
117
- 'bgcolor1' => '#e7e7e7',
118
- 'bgcolor2' => '#ffffff',
119
- 'bordercolor' => '#e7e7e7'
120
- ));
121
- $defaultLocation = apply_filters('wp_review_default_location', 'bottom');
122
-
123
- $defaultCriteria = apply_filters('wp_review_default_criteria', array());
124
- $defaultItems = array();
125
- if (empty($defaultCriteria) && ! empty($options['default_features'])) $defaultCriteria = $options['default_features'];
126
- foreach ($defaultCriteria as $item) {
127
- $defaultItems[] = array( 'wp_review_item_title' => $item, 'wp_review_item_star' => '');
128
- }
129
-
130
- /* Add an nonce field so we can check for it later. */
131
- wp_nonce_field( basename( __FILE__ ), 'wp-review-item-nonce' );
132
-
133
- /* Retrieve an existing value from the database. */
134
- $custom_colors = get_post_meta( $post->ID, 'wp_review_custom_colors', true );
135
- $custom_location = get_post_meta( $post->ID, 'wp_review_custom_location', true );
136
-
137
- $items = get_post_meta( $post->ID, 'wp_review_item', true );
138
- $color = get_post_meta( $post->ID, 'wp_review_color', true );
139
- $location = get_post_meta( $post->ID, 'wp_review_location', true );
140
- $fontcolor = get_post_meta( $post->ID, 'wp_review_fontcolor', true );
141
- $bgcolor1 = get_post_meta( $post->ID, 'wp_review_bgcolor1', true );
142
- $bgcolor2 = get_post_meta( $post->ID, 'wp_review_bgcolor2', true );
143
- $bordercolor = get_post_meta( $post->ID, 'wp_review_bordercolor', true );
144
- if ( $items == '' ) $items = $defaultItems;
145
- if( $color == '' ) $color = ( ! empty($options['colors']['color'] ) ? $options['colors']['color'] : $defaultColors['color']);
146
- if( $location == '' ) $location = ( ! empty($options['location'] ) ? $options['location'] : $defaultLocation);
147
- if( $fontcolor == '' ) $fontcolor = ( ! empty($options['colors']['fontcolor'] ) ? $options['colors']['fontcolor'] : $defaultColors['fontcolor']);
148
- if( $bgcolor1 == '' ) $bgcolor1 = ( ! empty($options['colors']['bgcolor1'] ) ? $options['colors']['bgcolor1'] : $defaultColors['bgcolor1']);
149
- if( $bgcolor2 == '' ) $bgcolor2 = ( ! empty($options['colors']['bgcolor2'] ) ? $options['colors']['bgcolor2'] : $defaultColors['bgcolor2']);
150
- if( $bordercolor == '' ) $bordercolor = ( ! empty($options['colors']['bordercolor'] ) ? $options['colors']['bordercolor'] : $defaultColors['bordercolor']);
151
-
152
- $fields = array(
153
- 'location' => true,
154
- 'color' => true,
155
- 'fontcolor' => true,
156
- 'bgcolor1' => true,
157
- 'bgcolor2' => true,
158
- 'bordercolor' => true,
159
- 'custom_colors' => true,
160
- 'custom_location' => true,
161
- );
162
- $displayed_fields = apply_filters('wp_review_metabox_item_fields', $fields);
163
- ?>
164
-
165
- <!-- Start repeater field -->
166
- <table id="wp-review-item" class="wp-review-item" width="100%">
167
-
168
- <thead>
169
- <tr>
170
- <th width="80%"><?php _e( 'Feature Name', 'wp-review' ); ?></th>
171
- <th width="10%" class="dynamic-text"><?php _e( 'Star (1-5)', 'wp-review' ); ?></th>
172
- <th width="10%"></th>
173
- </tr>
174
- </thead>
175
-
176
- <tbody>
177
- <?php if ( !empty($items) ) : ?>
178
-
179
- <?php foreach ( $items as $item ) { ?>
180
-
181
- <tr>
182
- <td>
183
- <input type="text" class="widefat" name="wp_review_item_title[]" value="<?php if( !empty( $item['wp_review_item_title'] ) ) echo esc_attr( $item['wp_review_item_title'] ); ?>" />
184
- </td>
185
- <td>
186
- <input type="text" min="1" step="1" autocomplete="off" class="widefat review-star" name="wp_review_item_star[]" value="<?php if ( !empty ($item['wp_review_item_star'] ) ) echo $item['wp_review_item_star']; ?>" />
187
- </td>
188
- <td><a class="button remove-row" href="#"><?php _e( 'Delete', 'wp-review' ); ?></a></td>
189
- </tr>
190
-
191
- <?php } ?>
192
-
193
- <?php else : ?>
194
-
195
- <tr>
196
- <td><input type="text" class="widefat" name="wp_review_item_title[]" /></td>
197
- <td><input type="text" min="1" step="1" autocomplete="off" class="widefat review-star" name="wp_review_item_star[]" /></td>
198
- <td><a class="button remove-row" href="#"><?php _e( 'Delete', 'wp-review' ); ?></a></td>
199
- </tr>
200
-
201
- <?php endif; ?>
202
-
203
- <!-- empty hidden one for jQuery -->
204
- <tr class="empty-row screen-reader-text">
205
- <td><input type="text" class="widefat" name="wp_review_item_title[]" /></td>
206
- <td><input type="text" min="1" step="1" autocomplete="off" class="widefat" name="wp_review_item_star[]" /></td>
207
- <td><a class="button remove-row" href="#"><?php _e( 'Delete', 'wp-review' ); ?></a></td>
208
- </tr>
209
-
210
- </tbody>
211
-
212
- </table>
213
-
214
- <table width="100%">
215
- <tr>
216
- <td width="80%"><a id="add-row" class="button" href="#"><?php _e( 'Add another', 'wp-review' ) ?></a></td>
217
- <td width="10%">
218
- <input type="text" class="widefat wp-review-total" name="wp_review_total" value="<?php echo get_post_meta( $post->ID, 'wp_review_total', true ); ?>" />
219
- </td>
220
- <td width="10%"><?php _e( 'Total', 'wp-review' ); ?></td>
221
- </tr>
222
- </table>
223
-
224
- <p class="wp-review-field">
225
- <label for="wp_review_custom_location"><?php _e( 'Custom Location', 'wp-review' ); ?></label>
226
- <input type="hidden" name="wp_review_custom_location" id="wp_review_custom_location_unchecked" value="" />
227
- <input name="wp_review_custom_location" id="wp_review_custom_location" type="checkbox" value="1" <?php echo (! empty($custom_location) ? 'checked ' : ''); ?> />
228
- </p>
229
- <div class="wp-review-location-options"<?php if (empty($custom_location)) echo ' style="display: none;"'; ?>>
230
- <p class="wp-review-field">
231
- <label for="wp_review_location"><?php _e( 'Review Location', 'wp-review' ); ?></label>
232
- <select name="wp_review_location" id="wp_review_location">
233
- <option value="bottom" <?php selected( $location, 'bottom' ); ?>><?php _e( 'After Content', 'wp-review' ) ?></option>
234
- <option value="top" <?php selected( $location, 'top' ); ?>><?php _e( 'Before Content', 'wp-review' ) ?></option>
235
- <option value="custom" <?php selected( $location, 'custom' ); ?>><?php _e( 'Custom (use shortcode)', 'wp-review' ) ?></option>
236
- </select>
237
- </p>
238
- <p class="wp-review-field" id="wp_review_shortcode_hint_field">
239
- <label for="wp_review_shortcode_hint"></label>
240
- <input id="wp_review_shortcode_hint" type="text" value="[wp-review]" readonly="readonly" />
241
- <span><?php _e('Copy &amp; paste this shortcode in the content.', 'wp-review') ?></span>
242
- </p>
243
- </div>
244
- <p class="wp-review-field">
245
- <label for="wp_review_custom_colors"><?php _e( 'Custom Colors', 'wp-review' ); ?></label>
246
- <input type="hidden" name="wp_review_custom_colors" id="wp_review_custom_colors_unchecked" value="" />
247
- <input name="wp_review_custom_colors" id="wp_review_custom_colors" type="checkbox" value="1" <?php echo (! empty($custom_colors) ? 'checked ' : ''); ?>/>
248
- </p>
249
- <div class="wp-review-color-options"<?php if (empty($custom_colors)) echo ' style="display: none;"'; ?>>
250
-
251
- <p class="wp-review-field"<?php if (empty($displayed_fields['color'])) echo ' style="display: none;"'; ?>>
252
- <label for="wp_review_color"><?php _e( 'Review Color', 'wp-review' ); ?></label>
253
- <input type="text" class="wp-review-color" name="wp_review_color" value="<?php echo $color; ?>" />
254
- </p>
255
-
256
- <p class="wp-review-field"<?php if (empty($displayed_fields['fontcolor'])) echo ' style="display: none;"'; ?>>
257
- <label for="wp_review_fontcolor"><?php _e( 'Font Color', 'wp-review' ); ?></label>
258
- <input type="text" class="wp-review-color" name="wp_review_fontcolor" id ="wp_review_fontcolor" value="<?php echo $fontcolor; ?>" />
259
- </p>
260
-
261
- <p class="wp-review-field"<?php if (empty($displayed_fields['bgcolor1'])) echo ' style="display: none;"'; ?>>
262
- <label for="wp_review_bgcolor1"><?php _e( 'Heading Background Color', 'wp-review' ); ?></label>
263
- <input type="text" class="wp-review-color" name="wp_review_bgcolor1" id ="wp_review_bgcolor1" value="<?php echo $bgcolor1; ?>" />
264
- </p>
265
-
266
- <p class="wp-review-field"<?php if (empty($displayed_fields['bgcolor2'])) echo ' style="display: none;"'; ?>>
267
- <label for="wp_review_bgcolor2"><?php _e( 'Background Color', 'wp-review' ); ?></label>
268
- <input type="text" class="wp-review-color" name="wp_review_bgcolor2" id="wp_review_bgcolor2" value="<?php echo $bgcolor2; ?>" />
269
- </p>
270
-
271
- <p class="wp-review-field"<?php if (empty($displayed_fields['bordercolor'])) echo ' style="display: none;"'; ?>>
272
- <label for="wp_review_bordercolor"><?php _e( 'Border Color', 'wp-review' ); ?></label>
273
- <input type="text" class="wp-review-color" name="wp_review_bordercolor" id="wp_review_bordercolor" value="<?php echo $bordercolor; ?>" />
274
- </p>
275
- </div>
276
-
277
- <?php
278
- }
279
-
280
- /**
281
- * Render the meta box.
282
- *
283
- * @since 1.0
284
- */
285
- function wp_review_render_meta_box_heading( $post ) {
286
- /* Add an nonce field so we can check for it later. */
287
- wp_nonce_field( basename( __FILE__ ), 'wp-review-heading-nonce' );
288
-
289
- /* Retrieve an existing value from the database. */
290
- $heading = get_post_meta( $post->ID, 'wp_review_heading', true );
291
- ?>
292
- <p class="wp-review-field">
293
- <label><?php _e( 'Review Heading', 'wp-review' ); ?></label>
294
- <input type="text" name="wp_review_heading" id="wp_review_heading" value="<?php _e( $heading ); ?>" />
295
- </p>
296
- <?php
297
- }
298
-
299
- function wp_review_render_meta_box_desc( $post ) {
300
-
301
- /* Add an nonce field so we can check for it later. */
302
- wp_nonce_field( basename( __FILE__ ), 'wp-review-desc-nonce' );
303
-
304
- /* Retrieve existing values from the database. */
305
- $hide_desc = get_post_meta( $post->ID, 'wp_review_hide_desc', true );
306
- $desc = get_post_meta( $post->ID, 'wp_review_desc', true );
307
- $desc_title = get_post_meta( $post->ID, 'wp_review_desc_title', true );
308
- if (!$desc_title) $desc_title = __('Summary', 'wp-review');
309
- ?>
310
- <p id="wp-review-desc-title" class="wp-review-field">
311
- <input type="text" name="wp_review_desc_title" id="wp_review_desc_title" value="<?php esc_attr_e( $desc_title ); ?>" />
312
- </p>
313
- <?php
314
-
315
- /* Display wp editor field. */
316
- wp_editor(
317
- $desc,
318
- 'wp_review_desc',
319
- array(
320
- 'tinymce' => false,
321
- 'quicktags' => true,
322
- 'media_buttons' => false,
323
- 'textarea_rows' => 10
324
- )
325
- );
326
- ?>
327
- <p class="wp-review-field">
328
- <label style="width: 100%;">
329
- <input type="hidden" name="wp_review_hide_desc" id="wp_review_hide_desc_unchecked" value="" />
330
- <input type="checkbox" name="wp_review_hide_desc" id="wp_review_hide_desc" value="1" <?php checked( $hide_desc ); ?> />
331
- <?php _e( 'Hide Description &amp; Total Rating', 'wp-review' ); ?>
332
- </label>
333
- </p>
334
- <?php
335
- }
336
-
337
- function wp_review_render_meta_box_userReview( $post ) {
338
- /* Add an nonce field so we can check for it later. */
339
- wp_nonce_field( basename( __FILE__ ), 'wp-review-userReview-nonce' );
340
-
341
- /* Retrieve an existing value from the database. */
342
- $userReviews = get_post_meta( $post->ID, 'wp_review_userReview', true );
343
- $enabled = false;
344
- if( is_array( $userReviews ) && $userReviews[0] == 1 ) $enabled = true;
345
-
346
- ?>
347
-
348
- <p class="wp-review-field">
349
- <label for="wp-review-userReview-disable"> <?php _e( 'Disabled', 'wp-review' ); ?>
350
- <input type="radio" name="wp_review_userReview[]" id="wp-review-userReview-disable" class="wp-review-userReview-options" value="0" <?php echo !$enabled ? 'checked' : ''; ?> />
351
- </label>
352
-
353
- <label for="wp-review-userReview-enable"> <?php _e( 'Enabled', 'wp-review' ); ?>
354
- <input type="radio" name="wp_review_userReview[]" id="wp-review-userReview-enable" class="wp-review-userReview-options" value="1" <?php echo $enabled ? 'checked' : ''; ?> />
355
- </label>
356
- </p>
357
-
358
- <?php
359
- }
360
-
361
- /**
362
- * Saves the meta box.
363
- *
364
- * @since 1.0
365
- */
366
- function wp_review_save_postdata( $post_id, $post ) {
367
-
368
- if ( !isset( $_POST['wp-review-review-options-nonce'] ) || !wp_verify_nonce( $_POST['wp-review-review-options-nonce'], basename( __FILE__ ) ) )
369
- return;
370
-
371
- if ( !isset( $_POST['wp-review-item-nonce'] ) || !wp_verify_nonce( $_POST['wp-review-item-nonce'], basename( __FILE__ ) ) )
372
- return;
373
-
374
- if ( !isset( $_POST['wp-review-heading-nonce'] ) || !wp_verify_nonce( $_POST['wp-review-heading-nonce'], basename( __FILE__ ) ) )
375
- return;
376
-
377
- if ( !isset( $_POST['wp-review-desc-nonce'] ) || !wp_verify_nonce( $_POST['wp-review-desc-nonce'], basename( __FILE__ ) ) )
378
- return;
379
-
380
- if ( !isset( $_POST['wp-review-userReview-nonce'] ) || !wp_verify_nonce( $_POST['wp-review-userReview-nonce'], basename( __FILE__ ) ) )
381
- return;
382
-
383
- /* If this is an autosave, our form has not been submitted, so we don't want to do anything. */
384
- if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
385
- return $post_id;
386
-
387
- /* Check the user's permissions. */
388
- if ( 'page' == $_POST['post_type'] ) {
389
- if ( ! current_user_can( 'edit_page', $post_id ) )
390
- return $post_id;
391
- } else {
392
- if ( ! current_user_can( 'edit_post', $post_id ) )
393
- return $post_id;
394
- }
395
-
396
- $meta = array(
397
- 'wp_review_custom_location' => $_POST['wp_review_custom_location'],
398
- 'wp_review_custom_colors' => $_POST['wp_review_custom_colors'],
399
- 'wp_review_custom_width' => $_POST['wp_review_custom_width'],
400
- 'wp_review_location' => $_POST['wp_review_location'],
401
- 'wp_review_type' => $_POST['wp_review_type'],
402
- 'wp_review_heading' => $_POST['wp_review_heading'],
403
- 'wp_review_desc_title' => $_POST['wp_review_desc_title'],
404
- 'wp_review_desc' => $_POST['wp_review_desc'],
405
- 'wp_review_hide_desc' => $_POST['wp_review_hide_desc'],
406
- 'wp_review_userReview' => $_POST['wp_review_userReview'],
407
- 'wp_review_total' => $_POST['wp_review_total'],
408
- 'wp_review_color' => $_POST['wp_review_color'],
409
- 'wp_review_fontcolor' => $_POST['wp_review_fontcolor'],
410
- 'wp_review_bgcolor1' => $_POST['wp_review_bgcolor1'],
411
- 'wp_review_bgcolor2' => $_POST['wp_review_bgcolor2'],
412
- 'wp_review_bordercolor' => $_POST['wp_review_bordercolor'],
413
- );
414
-
415
- foreach ( $meta as $meta_key => $new_meta_value ) {
416
-
417
- /* Get the meta value of the custom field key. */
418
- $meta_value = get_post_meta( $post_id, $meta_key, true );
419
-
420
- /* If there is no new meta value but an old value exists, delete it. */
421
- if ( current_user_can( 'delete_post_meta', $post_id, $meta_key ) && '' === $new_meta_value && $meta_value )
422
- delete_post_meta( $post_id, $meta_key, $meta_value );
423
-
424
- /* If a new meta value was added and there was no previous value, add it. */
425
- elseif ( current_user_can( 'add_post_meta', $post_id, $meta_key ) && ($new_meta_value || $new_meta_value === '0') && '' == $meta_value )
426
- add_post_meta( $post_id, $meta_key, $new_meta_value, true );
427
-
428
- /* If the new meta value does not match the old value, update it. */
429
- elseif ( current_user_can( 'edit_post_meta', $post_id, $meta_key ) && ($new_meta_value || $new_meta_value === '0') && $new_meta_value != $meta_value )
430
- update_post_meta( $post_id, $meta_key, $new_meta_value );
431
- }
432
-
433
- /* Repeatable update and delete meta fields method. */
434
- $title = $_POST['wp_review_item_title'];
435
- $star = $_POST['wp_review_item_star'];
436
-
437
- $old = get_post_meta( $post_id, 'wp_review_item', true );
438
- $new = array();
439
-
440
- $count = count( $title );
441
-
442
- for ( $i = 0; $i < $count; $i++ ) {
443
- if ( $title[$i] != '' )
444
- $new[$i]['wp_review_item_title'] = sanitize_text_field( $title[$i] );
445
- if ( $star[$i] != '' )
446
- $new[$i]['wp_review_item_star'] = sanitize_text_field( $star[$i] );
447
- }
448
-
449
- if ( !empty( $new ) && $new != $old )
450
- update_post_meta( $post_id, 'wp_review_item', $new );
451
- elseif ( empty($new) && $old )
452
- delete_post_meta( $post_id, 'wp_review_item', $old );
453
-
454
- /**
455
- * Delete all data when switched to 'No Review' type.
456
- */
457
- $type = $meta['wp_review_type'];//get_post_meta( $post_id, 'wp_review_type', true );
458
- if ( $type == '' ) {
459
- delete_post_meta( $post_id, 'wp_review_desc', $_POST['wp_review_desc'] );
460
- delete_post_meta( $post_id, 'wp_review_heading', $_POST['wp_review_heading'] );
461
- delete_post_meta( $post_id, 'wp_review_userReview', $_POST['wp_review_userReview'] );
462
- delete_post_meta( $post_id, 'wp_review_item', $old );
463
- }
464
-
465
- }
466
-
467
- // Fix for post previews
468
- // with this code, the review meta data will actually get saved on Preview
469
- add_filter('_wp_post_revision_fields', 'add_field_debug_preview');
470
- function add_field_debug_preview($fields){
471
- $fields["debug_preview"] = "debug_preview";
472
- return $fields;
473
- }
474
- add_action( 'edit_form_after_title', 'add_input_debug_preview' );
475
- function add_input_debug_preview() {
476
- echo '<input type="hidden" name="debug_preview" value="debug_preview">';
477
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
478
  ?>
1
+ <?php
2
+ /**
3
+ * File for registering meta box.
4
+ *
5
+ * @since 2.0
6
+ * @copyright Copyright (c) 2013, MyThemesShop
7
+ * @author MyThemesShop
8
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9
+ */
10
+
11
+ /* Adds a box to the Posts edit screens. */
12
+ add_action( 'add_meta_boxes', 'wp_review_add_meta_boxes' );
13
+
14
+ /* Saves the meta box custom data. */
15
+ add_action( 'save_post', 'wp_review_save_postdata', 10, 2 );
16
+
17
+ /**
18
+ * Adds a box to the Post edit screens.
19
+ *
20
+ * @since 1.0
21
+ */
22
+ function wp_review_add_meta_boxes() {
23
+ $post_types = get_post_types( array('public' => true), 'names' );
24
+ $excluded_post_types = apply_filters('wp_review_excluded_post_types', array('attachment'));
25
+
26
+ foreach ($post_types as $post_type) {
27
+ if (!in_array($post_type, $excluded_post_types)) {
28
+ add_meta_box(
29
+ 'wp-review-metabox-review',
30
+ __( 'Review', 'wp-review' ),
31
+ 'wp_review_render_meta_box_review_options',
32
+ $post_type,
33
+ 'normal',
34
+ 'high'
35
+ );
36
+
37
+ add_meta_box(
38
+ 'wp-review-metabox-item',
39
+ __( 'Review Item', 'wp-review' ),
40
+ 'wp_review_render_meta_box_item',
41
+ $post_type,
42
+ 'normal',
43
+ 'high'
44
+ );
45
+
46
+ add_meta_box(
47
+ 'wp-review-metabox-desc',
48
+ __( 'Review Description', 'wp-review' ),
49
+ 'wp_review_render_meta_box_desc',
50
+ $post_type,
51
+ 'normal',
52
+ 'high'
53
+ );
54
+
55
+ add_meta_box(
56
+ 'wp-review-metabox-userReview',
57
+ __( 'User Reviews', 'wp-review' ),
58
+ 'wp_review_render_meta_box_userReview',
59
+ $post_type,
60
+ 'normal',
61
+ 'high'
62
+ );
63
+ }
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Render the meta box.
69
+ *
70
+ * @since 1.0
71
+ */
72
+ function wp_review_render_meta_box_review_options( $post ) {
73
+ global $post, $wp_review_rating_types;
74
+
75
+ /* Add an nonce field so we can check for it later. */
76
+ wp_nonce_field( basename( __FILE__ ), 'wp-review-review-options-nonce' );
77
+
78
+ /* Retrieve an existing value from the database. */
79
+ $type = get_post_meta( $post->ID, 'wp_review_type', true );
80
+ $schema = wp_review_get_review_schema( $post->ID );
81
+ $heading = get_post_meta( $post->ID, 'wp_review_heading', true );
82
+ //$available_types = apply_filters('wp_review_metabox_types', wp_review_get_review_types() );
83
+ $available_types = wp_review_get_rating_types();
84
+ $schemas = apply_filters( 'wp_review_schema_types', array() );
85
+ ?>
86
+
87
+ <p class="wp-review-field">
88
+ <label for="wp_review_type"><?php _e( 'Review Type', 'wp-review' ); ?></label>
89
+ <select name="wp_review_type" id="wp_review_type">
90
+ <option value=""><?php _e( 'No Review', 'wp-review' ) ?></option>
91
+ <?php foreach ($available_types as $available_type_name => $available_type) { ?>
92
+ <option value="<?php echo $available_type_name; ?>" data-max="<?php echo $available_type['max']; ?>" data-decimals="<?php echo $available_type['decimals']; ?>" <?php selected( $type, $available_type_name ); ?>><?php echo $available_type['label']; ?></option>
93
+ <?php } ?>
94
+ </select>
95
+ <span id="wp_review_id_hint">Review ID: <strong><?php echo $post->ID; ?></strong></span>
96
+ </p>
97
+
98
+ <p class="wp-review-field" id="wp_review_heading_group">
99
+ <label><?php _e( 'Review Heading', 'wp-review' ); ?></label>
100
+ <input type="text" name="wp_review_heading" id="wp_review_heading" value="<?php _e( $heading ); ?>" />
101
+ </p>
102
+
103
+ <?php
104
+ }
105
+
106
+ /**
107
+ * Render the meta box.
108
+ *
109
+ * @since 1.0
110
+ */
111
+ function wp_review_render_meta_box_item( $post ) {
112
+ $options = get_option('wp_review_options');
113
+ $defaultColors = apply_filters('wp_review_default_colors', array(
114
+ 'color' => '#1e73be',
115
+ 'fontcolor' => '#555555',
116
+ 'bgcolor1' => '#e7e7e7',
117
+ 'bgcolor2' => '#ffffff',
118
+ 'bordercolor' => '#e7e7e7'
119
+ ));
120
+ $defaultLocation = apply_filters('wp_review_default_location', 'bottom');
121
+
122
+ $defaultCriteria = apply_filters('wp_review_default_criteria', array());
123
+ $defaultItems = array();
124
+ if (empty($defaultCriteria) && ! empty($options['default_features'])) $defaultCriteria = $options['default_features'];
125
+ foreach ($defaultCriteria as $item) {
126
+ $defaultItems[] = array( 'wp_review_item_title' => $item, 'wp_review_item_star' => '');
127
+ }
128
+
129
+ /* Add an nonce field so we can check for it later. */
130
+ wp_nonce_field( basename( __FILE__ ), 'wp-review-item-nonce' );
131
+
132
+ /* Retrieve an existing value from the database. */
133
+ $custom_colors = get_post_meta( $post->ID, 'wp_review_custom_colors', true );
134
+ $custom_location = get_post_meta( $post->ID, 'wp_review_custom_location', true );
135
+ $custom_width = get_post_meta( $post->ID, 'wp_review_custom_width', true );
136
+ $custom_author = get_post_meta( $post->ID, 'wp_review_custom_author', true );
137
+
138
+
139
+ $items = get_post_meta( $post->ID, 'wp_review_item', true );
140
+ $color = get_post_meta( $post->ID, 'wp_review_color', true );
141
+ $location = get_post_meta( $post->ID, 'wp_review_location', true );
142
+ $fontcolor = get_post_meta( $post->ID, 'wp_review_fontcolor', true );
143
+ $bgcolor1 = get_post_meta( $post->ID, 'wp_review_bgcolor1', true );
144
+ $bgcolor2 = get_post_meta( $post->ID, 'wp_review_bgcolor2', true );
145
+ $bordercolor = get_post_meta( $post->ID, 'wp_review_bordercolor', true );
146
+ $align = get_post_meta( $post->ID, 'wp_review_align', true );
147
+ $width = get_post_meta( $post->ID, 'wp_review_width', true );
148
+ $author = get_post_meta( $post->ID, 'wp_review_author', true );
149
+ if ( $items == '' ) $items = $defaultItems;
150
+ if( $color == '' ) $color = ( ! empty($options['colors']['color'] ) ? $options['colors']['color'] : $defaultColors['color']);
151
+ if( $location == '' ) $location = ( ! empty($options['location'] ) ? $options['location'] : $defaultLocation);
152
+ if( $fontcolor == '' ) $fontcolor = ( ! empty($options['colors']['fontcolor'] ) ? $options['colors']['fontcolor'] : $defaultColors['fontcolor']);
153
+ if( $bgcolor1 == '' ) $bgcolor1 = ( ! empty($options['colors']['bgcolor1'] ) ? $options['colors']['bgcolor1'] : $defaultColors['bgcolor1']);
154
+ if( $bgcolor2 == '' ) $bgcolor2 = ( ! empty($options['colors']['bgcolor2'] ) ? $options['colors']['bgcolor2'] : $defaultColors['bgcolor2']);
155
+ if( $bordercolor == '' ) $bordercolor = ( ! empty($options['colors']['bordercolor'] ) ? $options['colors']['bordercolor'] : $defaultColors['bordercolor']);
156
+ if ( empty( $width )) $width = 100;
157
+ if ( empty( $align )) $align = 'left';
158
+ if ( !$author ) $author = '';
159
+
160
+ $fields = array(
161
+ 'location' => true,
162
+ 'color' => true,
163
+ 'fontcolor' => true,
164
+ 'bgcolor1' => true,
165
+ 'bgcolor2' => true,
166
+ 'bordercolor' => true,
167
+ 'custom_colors' => true,
168
+ 'custom_location' => true,
169
+ 'width' => true,
170
+ 'align' => true
171
+ );
172
+ $displayed_fields = apply_filters('wp_review_metabox_item_fields', $fields);
173
+ ?>
174
+
175
+ <!-- Start repeater field -->
176
+ <table id="wp-review-item" class="wp-review-item" width="100%">
177
+
178
+ <thead>
179
+ <tr>
180
+ <th width="3%"></th>
181
+ <th width="70%"><?php _e( 'Feature Name', 'wp-review' ); ?></th>
182
+ <th width="17%" class="dynamic-text"><?php _e( 'Star (1-5)', 'wp-review' ); ?></th>
183
+ <th width="10%"></th>
184
+ </tr>
185
+ </thead>
186
+
187
+ <tbody>
188
+ <?php if ( !empty($items) ) : ?>
189
+
190
+ <?php foreach ( $items as $item ) { ?>
191
+
192
+ <tr>
193
+ <td class="handle">
194
+ <span class="dashicons dashicons-menu"></span>
195
+ </td>
196
+ <td>
197
+ <input type="text" class="widefat" name="wp_review_item_title[]" value="<?php if( !empty( $item['wp_review_item_title'] ) ) echo esc_attr( $item['wp_review_item_title'] ); ?>" />
198
+ </td>
199
+ <td>
200
+ <input type="text" min="1" step="1" autocomplete="off" class="widefat review-star" name="wp_review_item_star[]" value="<?php if ( !empty ($item['wp_review_item_star'] ) ) echo $item['wp_review_item_star']; ?>" />
201
+ </td>
202
+ <td><a class="button remove-row" href="#"><?php _e( 'Delete', 'wp-review' ); ?></a></td>
203
+ </tr>
204
+
205
+ <?php } ?>
206
+
207
+ <?php else : ?>
208
+
209
+ <tr>
210
+ <td class="handle"><span class="dashicons dashicons-menu"></span></td>
211
+ <td><input type="text" class="widefat" name="wp_review_item_title[]" /></td>
212
+ <td><input type="text" min="1" step="1" autocomplete="off" class="widefat review-star" name="wp_review_item_star[]" /></td>
213
+ <td><a class="button remove-row" href="#"><?php _e( 'Delete', 'wp-review' ); ?></a></td>
214
+ </tr>
215
+
216
+ <?php endif; ?>
217
+
218
+ <!-- empty hidden one for jQuery -->
219
+ <tr class="empty-row screen-reader-text">
220
+ <td class="handle"><span class="dashicons dashicons-menu"></span></td>
221
+ <td><input type="text" class="widefat focus-on-add" name="wp_review_item_title[]" /></td>
222
+ <td><input type="text" min="1" step="1" autocomplete="off" class="widefat" name="wp_review_item_star[]" /></td>
223
+ <td><a class="button remove-row" href="#"><?php _e( 'Delete', 'wp-review' ); ?></a></td>
224
+ </tr>
225
+
226
+ </tbody>
227
+
228
+ </table>
229
+
230
+ <table width="100%">
231
+ <tr>
232
+ <td width="73%"><a class="add-row button" data-target="#wp-review-item" href="#"><?php _e( 'Add another', 'wp-review' ) ?></a></td>
233
+ <td width="17%">
234
+ <input type="text" class="widefat wp-review-total" name="wp_review_total" value="<?php echo get_post_meta( $post->ID, 'wp_review_total', true ); ?>" />
235
+ </td>
236
+ <td width="10%"><?php _e( 'Total', 'wp-review' ); ?></td>
237
+ </tr>
238
+ </table>
239
+
240
+ <p class="wp-review-field">
241
+ <input name="wp_review_custom_location" id="wp_review_custom_location" type="checkbox" value="1" <?php echo (! empty($custom_location) ? 'checked ' : ''); ?> />
242
+ <label for="wp_review_custom_location"><?php _e( 'Custom Location', 'wp-review' ); ?></label>
243
+ </p>
244
+ <div class="wp-review-location-options"<?php if (empty($custom_location)) echo ' style="display: none;"'; ?>>
245
+ <p class="wp-review-field">
246
+ <label for="wp_review_location"><?php _e( 'Review Location', 'wp-review' ); ?></label>
247
+ <select name="wp_review_location" id="wp_review_location">
248
+ <option value="bottom" <?php selected( $location, 'bottom' ); ?>><?php _e( 'After Content', 'wp-review' ) ?></option>
249
+ <option value="top" <?php selected( $location, 'top' ); ?>><?php _e( 'Before Content', 'wp-review' ) ?></option>
250
+ <option value="custom" <?php selected( $location, 'custom' ); ?>><?php _e( 'Custom (use shortcode)', 'wp-review' ) ?></option>
251
+ </select>
252
+ </p>
253
+ <p class="wp-review-field" id="wp_review_shortcode_hint_field">
254
+ <label for="wp_review_shortcode_hint"></label>
255
+ <input id="wp_review_shortcode_hint" type="text" value='[wp-review id="<?php echo trim( $_GET['post'] ); ?>"]' readonly="readonly" />
256
+ <span><?php _e('Copy &amp; paste this shortcode in the content.', 'wp-review') ?></span>
257
+ </p>
258
+ </div>
259
+ <p class="wp-review-field">
260
+ <input name="wp_review_custom_colors" id="wp_review_custom_colors" type="checkbox" value="1" <?php echo (! empty($custom_colors) ? 'checked ' : ''); ?>/>
261
+ <label for="wp_review_custom_colors"><?php _e( 'Custom Colors', 'wp-review' ); ?></label>
262
+ </p>
263
+ <div class="wp-review-color-options"<?php if (empty($custom_colors)) echo ' style="display: none;"'; ?>>
264
+
265
+ <p class="wp-review-field"<?php if (empty($displayed_fields['color'])) echo ' style="display: none;"'; ?>>
266
+ <label for="wp_review_color"><?php _e( 'Review Color', 'wp-review' ); ?></label>
267
+ <input type="text" class="wp-review-color" name="wp_review_color" value="<?php echo $color; ?>" />
268
+ </p>
269
+
270
+ <p class="wp-review-field"<?php if (empty($displayed_fields['fontcolor'])) echo ' style="display: none;"'; ?>>
271
+ <label for="wp_review_fontcolor"><?php _e( 'Font Color', 'wp-review' ); ?></label>
272
+ <input type="text" class="wp-review-color" name="wp_review_fontcolor" id ="wp_review_fontcolor" value="<?php echo $fontcolor; ?>" />
273
+ </p>
274
+
275
+ <p class="wp-review-field"<?php if (empty($displayed_fields['bgcolor1'])) echo ' style="display: none;"'; ?>>
276
+ <label for="wp_review_bgcolor1"><?php _e( 'Heading Background Color', 'wp-review' ); ?></label>
277
+ <input type="text" class="wp-review-color" name="wp_review_bgcolor1" id ="wp_review_bgcolor1" value="<?php echo $bgcolor1; ?>" />
278
+ </p>
279
+
280
+ <p class="wp-review-field"<?php if (empty($displayed_fields['bgcolor2'])) echo ' style="display: none;"'; ?>>
281
+ <label for="wp_review_bgcolor2"><?php _e( 'Background Color', 'wp-review' ); ?></label>
282
+ <input type="text" class="wp-review-color" name="wp_review_bgcolor2" id="wp_review_bgcolor2" value="<?php echo $bgcolor2; ?>" />
283
+ </p>
284
+
285
+ <p class="wp-review-field"<?php if (empty($displayed_fields['bordercolor'])) echo ' style="display: none;"'; ?>>
286
+ <label for="wp_review_bordercolor"><?php _e( 'Border Color', 'wp-review' ); ?></label>
287
+ <input type="text" class="wp-review-color" name="wp_review_bordercolor" id="wp_review_bordercolor" value="<?php echo $bordercolor; ?>" />
288
+ </p>
289
+ </div>
290
+ <?php
291
+ }
292
+
293
+ function wp_review_render_meta_box_desc( $post ) {
294
+
295
+ /* Add an nonce field so we can check for it later. */
296
+ wp_nonce_field( basename( __FILE__ ), 'wp-review-desc-nonce' );
297
+
298
+ /* Retrieve existing values from the database. */
299
+ $hide_desc = get_post_meta( $post->ID, 'wp_review_hide_desc', true );
300
+ $desc = get_post_meta( $post->ID, 'wp_review_desc', true );
301
+ $desc_title = get_post_meta( $post->ID, 'wp_review_desc_title', true );
302
+ if (!$desc_title) $desc_title = __('Summary', 'wp-review');
303
+ ?>
304
+ <p id="wp-review-desc-title" class="wp-review-field">
305
+ <input type="text" name="wp_review_desc_title" id="wp_review_desc_title" value="<?php esc_attr_e( $desc_title ); ?>" />
306
+ </p>
307
+ <?php
308
+
309
+ /* Display wp editor field. */
310
+ wp_editor(
311
+ $desc,
312
+ 'wp_review_desc',
313
+ array(
314
+ 'tinymce' => false,
315
+ 'quicktags' => true,
316
+ 'media_buttons' => false,
317
+ 'textarea_rows' => 10
318
+ )
319
+ );
320
+ ?>
321
+ <p class="wp-review-field">
322
+ <label style="width: 100%;">
323
+ <input type="hidden" name="wp_review_hide_desc" id="wp_review_hide_desc_unchecked" value="" />
324
+ <input type="checkbox" name="wp_review_hide_desc" id="wp_review_hide_desc" value="1" <?php checked( $hide_desc ); ?> />
325
+ <?php _e( 'Hide Description &amp; Total Rating', 'wp-review' ); ?>
326
+ </label>
327
+ </p>
328
+ <?php
329
+ }
330
+
331
+ function wp_review_render_meta_box_userReview( $post ) {
332
+ /* Add an nonce field so we can check for it later. */
333
+ wp_nonce_field( basename( __FILE__ ), 'wp-review-userReview-nonce' );
334
+ $enabled = wp_review_get_user_rating_setup( $post->ID );
335
+
336
+ $type = get_post_meta( $post->ID, 'wp_review_user_review_type', true );
337
+ if (! $type ) {
338
+ $type = 'star';
339
+ }
340
+ //$available_types = apply_filters('wp_review_metabox_user_rating_types', wp_review_get_review_types( 'user' ) );
341
+ $available_types = wp_review_get_rating_types();
342
+ ?>
343
+
344
+ <p class="wp-review-field">
345
+ <input type="radio" name="wp_review_userReview" id="wp-review-userReview-disable" value="<?php echo WP_REVIEW_REVIEW_DISABLED; ?>" <?php checked( WP_REVIEW_REVIEW_DISABLED, $enabled ); ?> />
346
+ <label for="wp-review-userReview-disable"> <?php _e( 'Disabled', 'wp-review' ); ?></label>
347
+ </p>
348
+ <p class="wp-review-field">
349
+ <input type="radio" name="wp_review_userReview" id="wp-review-userReview-visitor" value="<?php echo WP_REVIEW_REVIEW_VISITOR_ONLY; ?>" <?php checked( WP_REVIEW_REVIEW_VISITOR_ONLY, $enabled ); ?> />
350
+ <label for="wp-review-userReview-visitor"> <?php _e( 'Enabled', 'wp-review' ); ?>
351
+ </p>
352
+ <p class="wp-review-field" id="wp_review_rating_type">
353
+ <label for="rating_type"><?php _e( 'User Rating Type', 'wp-review' ); ?></label>
354
+ <select name="wp_review_user_review_type" id="rating_type">
355
+ <?php foreach ($available_types as $available_type_name => $available_type) {
356
+ // skip ones that only have output template
357
+ if ( ! $available_type['user_rating'] ) continue; ?>
358
+ <option value="<?php echo $available_type_name; ?>" <?php selected( $type, $available_type_name ); ?>><?php echo $available_type['label']; ?></option>
359
+ <?php } ?>
360
+ </select>
361
+ <span class="edit-ratings-notice"><?php _e( 'Note: If you are changing user rating type and post already has user ratings, please edit or remove existing ratings if needed.', 'wp-review' ); ?></span>
362
+ </p>
363
+ <?php
364
+ }
365
+
366
+ /**
367
+ * Saves the meta box.
368
+ *
369
+ * @since 1.0
370
+ */
371
+ function wp_review_save_postdata( $post_id, $post ) {
372
+
373
+ if ( !isset( $_POST['wp-review-review-options-nonce'] ) || !wp_verify_nonce( $_POST['wp-review-review-options-nonce'], basename( __FILE__ ) ) )
374
+ return;
375
+
376
+ if ( !isset( $_POST['wp-review-item-nonce'] ) || !wp_verify_nonce( $_POST['wp-review-item-nonce'], basename( __FILE__ ) ) )
377
+ return;
378
+
379
+ if ( !isset( $_POST['wp-review-desc-nonce'] ) || !wp_verify_nonce( $_POST['wp-review-desc-nonce'], basename( __FILE__ ) ) )
380
+ return;
381
+
382
+ if ( !isset( $_POST['wp-review-userReview-nonce'] ) || !wp_verify_nonce( $_POST['wp-review-userReview-nonce'], basename( __FILE__ ) ) )
383
+ return;
384
+
385
+ /* If this is an autosave, our form has not been submitted, so we don't want to do anything. */
386
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
387
+ return $post_id;
388
+
389
+ /* Check the user's permissions. */
390
+ if ( 'page' == $_POST['post_type'] ) {
391
+ if ( ! current_user_can( 'edit_page', $post_id ) )
392
+ return $post_id;
393
+ } else {
394
+ if ( ! current_user_can( 'edit_post', $post_id ) )
395
+ return $post_id;
396
+ }
397
+
398
+ $meta = array(
399
+ 'wp_review_custom_location' => filter_input( INPUT_POST, 'wp_review_custom_location', FILTER_SANITIZE_STRING ),
400
+ 'wp_review_custom_colors' => filter_input( INPUT_POST, 'wp_review_custom_colors', FILTER_SANITIZE_STRING ),
401
+ 'wp_review_custom_width' => filter_input( INPUT_POST, 'wp_review_custom_width', FILTER_SANITIZE_STRING ),
402
+ 'wp_review_custom_author' => filter_input( INPUT_POST, 'wp_review_custom_author', FILTER_SANITIZE_STRING ),
403
+ 'wp_review_location' => filter_input( INPUT_POST, 'wp_review_location', FILTER_SANITIZE_STRING ),
404
+ 'wp_review_type' => filter_input( INPUT_POST, 'wp_review_type', FILTER_SANITIZE_STRING ),
405
+ 'wp_review_heading' => filter_input( INPUT_POST, 'wp_review_heading', FILTER_SANITIZE_STRING ),
406
+ 'wp_review_desc_title' => filter_input( INPUT_POST, 'wp_review_desc_title', FILTER_SANITIZE_STRING ),
407
+ 'wp_review_desc' => wp_kses_post( $_POST['wp_review_desc'] ),
408
+ 'wp_review_hide_desc' => filter_input( INPUT_POST, 'wp_review_hide_desc', FILTER_SANITIZE_STRING ),
409
+ 'wp_review_userReview' => filter_input( INPUT_POST, 'wp_review_userReview', FILTER_SANITIZE_STRING ),
410
+ 'wp_review_total' => filter_input( INPUT_POST, 'wp_review_total', FILTER_SANITIZE_STRING ),
411
+ 'wp_review_color' => filter_input( INPUT_POST, 'wp_review_color', FILTER_SANITIZE_STRING ),
412
+ 'wp_review_fontcolor' => filter_input( INPUT_POST, 'wp_review_fontcolor', FILTER_SANITIZE_STRING ),
413
+ 'wp_review_bgcolor1' => filter_input( INPUT_POST, 'wp_review_bgcolor1', FILTER_SANITIZE_STRING ),
414
+ 'wp_review_bgcolor2' => filter_input( INPUT_POST, 'wp_review_bgcolor2', FILTER_SANITIZE_STRING ),
415
+ 'wp_review_bordercolor' => filter_input( INPUT_POST, 'wp_review_bordercolor', FILTER_SANITIZE_STRING ),
416
+ 'wp_review_width' => filter_input( INPUT_POST, 'wp_review_width', FILTER_SANITIZE_STRING ),
417
+ 'wp_review_align' => filter_input( INPUT_POST, 'wp_review_align', FILTER_SANITIZE_STRING ),
418
+ 'wp_review_author' => filter_input( INPUT_POST, 'wp_review_author', FILTER_SANITIZE_STRING ),
419
+ 'wp_review_schema' => filter_input( INPUT_POST, 'wp_review_schema', FILTER_SANITIZE_STRING ),
420
+ 'wp_review_user_review_type' => filter_input( INPUT_POST, 'wp_review_user_review_type', FILTER_SANITIZE_STRING ),
421
+ );
422
+
423
+ foreach ( $meta as $meta_key => $new_meta_value ) {
424
+
425
+ /* Get the meta value of the custom field key. */
426
+ $meta_value = get_post_meta( $post_id, $meta_key, true );
427
+
428
+ /* If there is no new meta value but an old value exists, delete it. */
429
+ if ( current_user_can( 'delete_post_meta', $post_id, $meta_key ) && empty( $new_meta_value ) && $meta_value )
430
+ delete_post_meta( $post_id, $meta_key, $meta_value );
431
+
432
+ /* If a new meta value was added and there was no previous value, add it. */
433
+ elseif ( current_user_can( 'add_post_meta', $post_id, $meta_key ) && ($new_meta_value || $new_meta_value === '0') && '' == $meta_value )
434
+ add_post_meta( $post_id, $meta_key, $new_meta_value, true );
435
+
436
+ /* If the new meta value does not match the old value, update it. */
437
+ elseif ( current_user_can( 'edit_post_meta', $post_id, $meta_key ) && ($new_meta_value || $new_meta_value === '0') && $new_meta_value != $meta_value )
438
+ update_post_meta( $post_id, $meta_key, $new_meta_value );
439
+ }
440
+
441
+ /* Repeatable update and delete meta fields method. */
442
+ $title = $_POST['wp_review_item_title'];
443
+ $star = $_POST['wp_review_item_star'];
444
+
445
+ $old = get_post_meta( $post_id, 'wp_review_item', true );
446
+ $new = array();
447
+
448
+ $count = count( $title );
449
+
450
+ for ( $i = 0; $i < $count; $i++ ) {
451
+ if ( $title[$i] != '' )
452
+ $new[$i]['wp_review_item_title'] = sanitize_text_field( $title[$i] );
453
+ if ( $star[$i] != '' )
454
+ $new[$i]['wp_review_item_star'] = sanitize_text_field( $star[$i] );
455
+ }
456
+
457
+ if ( !empty( $new ) && $new != $old )
458
+ update_post_meta( $post_id, 'wp_review_item', $new );
459
+ elseif ( empty($new) && $old )
460
+ delete_post_meta( $post_id, 'wp_review_item', $old );
461
+
462
+ /**
463
+ * Delete all data when switched to 'No Review' type.
464
+ */
465
+ $type = $meta['wp_review_type'];//get_post_meta( $post_id, 'wp_review_type', true );
466
+ if ( $type == '' ) {
467
+ delete_post_meta( $post_id, 'wp_review_desc', $_POST['wp_review_desc'] );
468
+ delete_post_meta( $post_id, 'wp_review_heading', $_POST['wp_review_heading'] );
469
+ delete_post_meta( $post_id, 'wp_review_userReview', $_POST['wp_review_userReview'] );
470
+ delete_post_meta( $post_id, 'wp_review_item', $old );
471
+ }
472
+
473
+ }
474
+
475
+ // Fix for post previews
476
+ // with this code, the review meta data will actually get saved on Preview
477
+ add_filter('_wp_post_revision_fields', 'add_field_debug_preview');
478
+ function add_field_debug_preview($fields){
479
+ $fields["debug_preview"] = "debug_preview";
480
+ return $fields;
481
+ }
482
+ add_action( 'edit_form_after_title', 'add_input_debug_preview' );
483
+ function add_input_debug_preview() {
484
+ echo '<input type="hidden" name="debug_preview" value="debug_preview">';
485
+ }
486
+
487
+ function wp_review_default_schema_types( $types ) {
488
+ $default = array(
489
+ 'Thing' => __( 'Thing (Default)', 'wp-review' ),
490
+ );
491
+
492
+ return array_merge( $types, $default );
493
+ }
494
+ add_filter( 'wp_review_schema_types', 'wp_review_default_schema_types' );
495
  ?>
admin/options.php CHANGED
@@ -1,255 +1,303 @@
1
- <?php
2
-
3
- // create custom plugin settings menu
4
- add_action('admin_menu', 'wpreview_create_menu');
5
-
6
- function wpreview_create_menu() {
7
-
8
- //create new top-level menu
9
- $hook = add_options_page('WP Review', 'WP Review', 'administrator', __FILE__, 'wpreview_settings_page');
10
-
11
- //call register settings function
12
- add_action( 'admin_init', 'wpreview_register_settings' );
13
-
14
- // body class
15
- // create_function() requires PHP 5.2+
16
- add_action( "load-$hook", create_function('', 'add_filter( "admin_body_class", "wpreview_admin_body_class" );') );
17
- }
18
- // body class
19
- function wpreview_admin_body_class( $classes ) {
20
- $classes .= 'wp-review-admin-options';
21
- return $classes;
22
- }
23
- function wpreview_register_settings() {
24
- //register our settings
25
- register_setting( 'wpreview-settings-group', 'wp_review_options' );
26
- }
27
-
28
- function wpreview_settings_page() {
29
- $options = get_option('wp_review_options');
30
-
31
- $available_types = apply_filters('wp_review_metabox_types', array('star' => __('Star', 'wp-review'), 'point' => __('Point', 'wp-review'), 'percentage' => __('Percentage', 'wp-review')));
32
- $default_options = array(
33
- 'colors' => array(
34
- 'color' => '',
35
- 'fontcolor' => '',
36
- 'bgcolor1' => '',
37
- 'bgcolor2' => '',
38
- 'bordercolor' => ''),
39
- 'default_features' => array(),
40
- 'image_sizes' => array()
41
- );
42
- // set defaults
43
- if (empty($options)) {
44
- update_option( 'wp_review_options', $options = $default_options );
45
- }
46
- if (empty($options['image_sizes'])) $options['image_sizes'] = array();
47
-
48
- $opt_name = 'wp_review_options_'.wp_get_theme();
49
- $options_updated = get_option( $opt_name );
50
- $suggest_theme_defaults = true;
51
- if (!empty($_GET['wp-review-theme-defaults']) && empty($_GET['settings-updated'])) {
52
- wp_review_theme_defaults($options_updated, true);
53
- $options = get_option('wp_review_options');
54
- $suggest_theme_defaults = false;
55
- }
56
- // test to see if we need to sugges setting theme defaults
57
- if (empty($options_updated)) $options_updated = array();
58
- $opts_tmp = array_merge($options, $options_updated);
59
- if ($opts_tmp == $options) $suggest_theme_defaults = false;
60
- ?>
61
- <div id="poststuff" class="wrap wp-review">
62
- <div id="post-body">
63
- <div id="col-right" style="float: left; padding-right: 3%; box-sizing: border-box;">
64
- <h2 style="margin-top: 0;"><?php _e('WP Review Settings', 'wp-review'); ?></h2>
65
-
66
- <form method="post" action="options.php">
67
- <?php settings_fields( 'wpreview-settings-group' ); ?>
68
-
69
- <?php
70
- $defaultColors = apply_filters('wp_review_default_colors', array(
71
- 'color' => '#1e73be',
72
- 'fontcolor' => '#555555',
73
- 'bgcolor1' => '#e7e7e7',
74
- 'bgcolor2' => '#ffffff',
75
- 'bordercolor' => '#e7e7e7'
76
- ));
77
- $defaultLocation = apply_filters('wp_review_default_location', 'bottom');
78
-
79
- $defaultCriteria = apply_filters('wp_review_default_criteria', array());
80
- $defaultItems = array();
81
- foreach ($defaultCriteria as $item) {
82
- $defaultItems[] = array( 'wp_review_item_title' => $item, 'wp_review_item_star' => '');
83
- }
84
- $options['colors'] = apply_filters( 'wp_review_colors', $options['colors'], 0 );
85
- if (!isset($options['deafults'])) $options['deafults'] = array();
86
- /* Retrieve an existing value from the database. */
87
- $items = ! empty($options['default_features']) ? $options['default_features'] : '';
88
- $color = ! empty($options['colors']['color']) ? $options['colors']['color'] : '';
89
- $location = ! empty($options['review_location']) ? $options['review_location'] : '';
90
- $fontcolor = ! empty($options['colors']['fontcolor']) ? $options['colors']['fontcolor'] : '';
91
- $bgcolor1 = ! empty($options['colors']['bgcolor1']) ? $options['colors']['bgcolor1'] : '';
92
- $bgcolor2 = ! empty($options['colors']['bgcolor2']) ? $options['colors']['bgcolor2'] : '';
93
- $bordercolor = ! empty($options['colors']['bordercolor']) ? $options['colors']['bordercolor'] : '';
94
-
95
- if ( $items == '' ) $items = $defaultItems;
96
- if( $color == '' ) $color = $defaultColors['color'];
97
- if( $location == '' ) $location = $defaultLocation;
98
- if( $fontcolor == '' ) $fontcolor = $defaultColors['fontcolor'];
99
- if( $bgcolor1 == '' ) $bgcolor1 = $defaultColors['bgcolor1'];
100
- if( $bgcolor2 == '' ) $bgcolor2 = $defaultColors['bgcolor2'];
101
- if( $bordercolor == '' ) $bordercolor = $defaultColors['bordercolor'];
102
-
103
- $fields = array(
104
- 'location' => true,
105
- 'color' => true,
106
- 'fontcolor' => true,
107
- 'bgcolor1' => true,
108
- 'bgcolor2' => true,
109
- 'bordercolor' => true,
110
- 'custom_colors' => true,
111
- 'custom_location' => true,
112
- 'width' => true,
113
- 'align' => true
114
- );
115
- $displayed_fields = apply_filters('wp_review_metabox_item_fields', $fields);
116
-
117
- $location = apply_filters( 'wp_review_location', $location, 0 );
118
- if (has_filter('wp_review_location')) echo '<p class="wp-review-filter-msg"><div class="dashicons dashicons-info"></div>'.__('There is a filter set for the review location that may modify the options below.', 'wp-review').'</p>';
119
-
120
- if ($suggest_theme_defaults) { ?>
121
- <div class="wp-review-theme-defaults-msg updated settings-error">
122
- <p class="wp-review-field">
123
- <?php _e('The current theme provides default settings for the plugin.', 'wp-review'); ?><br />
124
- </p>
125
- <a href="<?php echo admin_url('options-general.php?page=wp-review/admin/options.php&wp-review-theme-defaults=1'); ?>" class="button button-primary"><?php _e('Set to theme defaults', 'wp-review'); ?></a>
126
- <a href="#" class="dashicons dashicons-no-alt close-notice"></a>
127
- </div>
128
- <?php } ?>
129
-
130
- <p class="wp-review-field">
131
- <label for="wp_review_location"><?php _e( 'Review Location', 'wp-review' ); ?></label>
132
- <select name="wp_review_options[review_location]" id="wp_review_location">
133
- <option value="bottom" <?php selected( $location, 'bottom' ); ?>><?php _e( 'After Content', 'wp-review' ) ?></option>
134
- <option value="top" <?php selected( $location, 'top' ); ?>><?php _e( 'Before Content', 'wp-review' ) ?></option>
135
- <option value="custom" <?php selected( $location, 'custom' ); ?>><?php _e( 'Custom (use shortcode)', 'wp-review' ) ?></option>
136
- </select>
137
- </p>
138
-
139
- <p class="wp-review-field" id="wp_review_shortcode_hint_field">
140
-
141
- <input id="wp_review_shortcode_hint" type="text" value="[wp-review]" readonly="readonly" />
142
- <span><?php _e('Copy &amp; paste this shortcode in the post content.', 'wp-review') ?></span>
143
- </p>
144
-
145
- <?php if (has_filter('wp_review_colors')) echo '<p class="wp-review-filter-msg"><div class="dashicons dashicons-info"></div>'.__('There is a filter set for the review colors that may modify the options below.', 'wp-review').'</p>'; ?>
146
-
147
- <div class="wp-review-color-options">
148
- <p class="wp-review-field"<?php if (empty($displayed_fields['color'])) echo ' style="display: none;"'; ?>>
149
- <label for="wp_review_color"><?php _e( 'Review Color', 'wp-review' ); ?></label>
150
- <input type="text" class="wp-review-color" name="wp_review_options[colors][color]" value="<?php echo $color; ?>" />
151
- </p>
152
-
153
- <p class="wp-review-field"<?php if (empty($displayed_fields['fontcolor'])) echo ' style="display: none;"'; ?>>
154
- <label for="wp_review_fontcolor"><?php _e( 'Font Color', 'wp-review' ); ?></label>
155
- <input type="text" class="wp-review-color" name="wp_review_options[colors][fontcolor]" id ="wp_review_fontcolor" value="<?php echo $fontcolor; ?>" />
156
- </p>
157
-
158
- <p class="wp-review-field"<?php if (empty($displayed_fields['bgcolor1'])) echo ' style="display: none;"'; ?>>
159
- <label for="wp_review_bgcolor1"><?php _e( 'Heading Background Color', 'wp-review' ); ?></label>
160
- <input type="text" class="wp-review-color" name="wp_review_options[colors][bgcolor1]" id ="wp_review_bgcolor1" value="<?php echo $bgcolor1; ?>" />
161
- </p>
162
-
163
- <p class="wp-review-field"<?php if (empty($displayed_fields['bgcolor2'])) echo ' style="display: none;"'; ?>>
164
- <label for="wp_review_bgcolor2"><?php _e( 'Background Color', 'wp-review' ); ?></label>
165
- <input type="text" class="wp-review-color" name="wp_review_options[colors][bgcolor2]" id="wp_review_bgcolor2" value="<?php echo $bgcolor2; ?>" />
166
- </p>
167
-
168
- <p class="wp-review-field"<?php if (empty($displayed_fields['bordercolor'])) echo ' style="display: none;"'; ?>>
169
- <label for="wp_review_bordercolor"><?php _e( 'Border Color', 'wp-review' ); ?></label>
170
- <input type="text" class="wp-review-color" name="wp_review_options[colors][bordercolor]" id="wp_review_bordercolor" value="<?php echo $bordercolor; ?>" />
171
- </p>
172
- </div>
173
-
174
- <div class="wp-review-default-features" style="display: block;">
175
- <!-- Start repeater field -->
176
- <table id="wp-review-item" class="wp-review-item" width="100%">
177
-
178
- <thead>
179
- <tr>
180
- <th width="90%">
181
- <?php if (has_filter('wp_review_default_criteria')) echo '<p class="wp-review-filter-msg"><div class="dashicons dashicons-info"></div>'.__('Default features are set by a filter function. Remove it to change.', 'wp-review').'</p>'; else _e( 'Default features', 'wp-review' ); ?>
182
- </th>
183
- <th width="10%"></th>
184
- </tr>
185
- </thead>
186
-
187
- <tbody>
188
- <?php if (has_filter('wp_review_default_criteria')) { ?>
189
- <?php foreach ( $defaultCriteria as $item ) { ?>
190
- <tr>
191
- <td>
192
- <input type="text" class="widefat" name="wp_review_options[default_features][]" value="<?php if( !empty( $item ) ) echo esc_attr( $item ); ?>" disabled="disabled" readonly="readonly" />
193
- </td>
194
- <td></td>
195
- </tr>
196
- <?php } ?>
197
- <?php } else { ?>
198
- <?php if ( !empty($items) ) : ?>
199
- <?php foreach ( $items as $item ) { ?>
200
-
201
- <tr>
202
- <td>
203
- <input type="text" class="widefat" name="wp_review_options[default_features][]" value="<?php if( !empty( $item ) ) echo esc_attr( $item ); ?>" />
204
- </td>
205
- <td><a class="button remove-row" href="#"><?php _e( 'Delete', 'wp-review' ); ?></a></td>
206
- </tr>
207
- <?php } ?>
208
- <?php endif; ?>
209
- <?php } ?>
210
- <!-- empty hidden one for jQuery -->
211
- <tr class="empty-row screen-reader-text">
212
- <td><input type="text" class="widefat" data-name="wp_review_options[default_features][]" /></td>
213
- <td><a class="button remove-row" href="#"><?php _e( 'Delete', 'wp-review' ); ?></a></td>
214
- </tr>
215
-
216
- </tbody>
217
-
218
- </table>
219
- <?php if ( ! has_filter('wp_review_default_criteria') ) { ?>
220
- <table width="100%">
221
- <tr>
222
- <td width="100%"><a id="add-row" class="button" href="#"><?php _e( 'Add default feature', 'wp-review' ) ?></a></td>
223
- </tr>
224
- </table>
225
- <?php } ?>
226
- </div>
227
-
228
- <p class="submit">
229
- <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
230
- </p>
231
-
232
- </form>
233
- </div>
234
- <?php if (!apply_filters( 'wp_review_remove_branding', false )) : ?>
235
- <div id="col-left" style="float: right; margin-top: 47px;">
236
- <a href="https://mythemeshop.com/plugins/wp-review-pro/?utm_source=WP+Review&utm_medium=Link+CPC&utm_content=WP+Review+Pro+LP&utm_campaign=WordPressOrg" target="_blank">
237
- <img src="<?php echo trailingslashit( WP_REVIEW_ASSETS ); ?>/images/wp-review-pro.jpg">
238
- </a>
239
- </div>
240
- <?php endif; ?>
241
- </div>
242
- </div>
243
- <?php }
244
-
245
- // Add settings link on plugin page
246
- function wpreview_plugin_settings_link($links) {
247
- $dir = explode('/', WP_REVIEW_PLUGIN_BASE);
248
- $dir = $dir[0];
249
- $settings_link = '<a href="options-general.php?page='.$dir.'/admin/options.php">'.__('Settings', 'wp-review').'</a>';
250
- array_unshift($links, $settings_link);
251
- return $links;
252
- }
253
- add_filter('plugin_action_links_'.WP_REVIEW_PLUGIN_BASE, 'wpreview_plugin_settings_link' );
254
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
  ?>
1
+ <?php
2
+
3
+ // create custom plugin settings menu
4
+ add_action('admin_menu', 'wpreview_create_menu');
5
+
6
+ function wpreview_create_menu() {
7
+
8
+ //create new top-level menu
9
+ $hook = add_options_page('WP Review', 'WP Review', 'administrator', __FILE__, 'wpreview_settings_page');
10
+
11
+ //call register settings function
12
+ add_action( 'admin_init', 'wpreview_register_settings' );
13
+
14
+ // body class
15
+ add_action( "load-$hook", 'wpreview_admin_body_class_filter' );
16
+ }
17
+ function wpreview_admin_body_class_filter() {
18
+ add_filter( "admin_body_class", "wpreview_admin_body_class" );
19
+ }
20
+ // body class
21
+ function wpreview_admin_body_class( $classes ) {
22
+ $classes .= 'wp-review-admin-options';
23
+ return $classes;
24
+ }
25
+ function wpreview_register_settings() {
26
+ //register our settings
27
+ register_setting( 'wpreview-settings-group', 'wp_review_options' );
28
+ }
29
+
30
+ function wpreview_settings_page() {
31
+ $options = get_option('wp_review_options');
32
+
33
+ $available_types = apply_filters('wp_review_metabox_types', array('star' => __('Star', 'wp-review'), 'point' => __('Point', 'wp-review'), 'percentage' => __('Percentage', 'wp-review'), 'circle' => __('Circle', 'wp-review')));
34
+ $default_options = array(
35
+ 'colors' => array(
36
+ 'color' => '',
37
+ 'fontcolor' => '',
38
+ 'bgcolor1' => '',
39
+ 'bgcolor2' => '',
40
+ 'bordercolor' => ''),
41
+ 'default_features' => array(),
42
+ 'default_link_texts' => array(),
43
+ 'default_link_urls' => array(),
44
+ 'default_schema_type' => 'Thing',
45
+ 'default_user_review_type' => WP_REVIEW_REVIEW_DISABLED,
46
+ 'image_sizes' => array(),
47
+ );
48
+ // set defaults
49
+ if (empty($options)) {
50
+ update_option( 'wp_review_options', $options = $default_options );
51
+ }
52
+ if (empty($options['image_sizes'])) $options['image_sizes'] = array();
53
+
54
+ $opt_name = 'wp_review_options_'.wp_get_theme();
55
+ $options_updated = get_option( $opt_name );
56
+ $suggest_theme_defaults = true;
57
+ if (!empty($_GET['wp-review-theme-defaults']) && empty($_GET['settings-updated'])) {
58
+ wp_review_theme_defaults($options_updated, true);
59
+ $options = get_option('wp_review_options');
60
+ $suggest_theme_defaults = false;
61
+ }
62
+ // test to see if we need to sugges setting theme defaults
63
+ if (empty($options_updated)) $options_updated = array();
64
+ $opts_tmp = array_merge($options, $options_updated);
65
+ if ($opts_tmp == $options) $suggest_theme_defaults = false;
66
+
67
+ // Migrate
68
+ global $wpdb;
69
+ $current_blog_id = get_current_blog_id();
70
+ $total_rows = 0;
71
+ $rows_left = 0;
72
+ $migrated_rows = get_option( 'wp_review_migrated_rows', 0 );
73
+ $has_migrated = get_option( 'wp_review_has_migrated', false );
74
+ if ( ! $has_migrated && $wpdb->get_var("SHOW TABLES LIKE '{$wpdb->base_prefix}mts_wp_reviews'") == "{$wpdb->base_prefix}mts_wp_reviews") {
75
+ // Table exists and not migrated (fully) yet
76
+ $total_rows = $wpdb->get_var( 'SELECT COUNT(*) FROM '.$wpdb->base_prefix.'mts_wp_reviews WHERE blog_id = '.$current_blog_id );
77
+ $rows_left = $total_rows - $migrated_rows;
78
+ }
79
+
80
+ ?>
81
+ <div id="col-right" class="wrap wp-review" style="float: left; padding-right: 3%; box-sizing: border-box;">
82
+ <h2><?php _e('WP Review Settings', 'wp-review'); ?></h2>
83
+
84
+ <form method="post" action="options.php">
85
+ <?php settings_fields( 'wpreview-settings-group' ); ?>
86
+
87
+ <?php
88
+
89
+ $defaultColors = apply_filters('wp_review_default_colors', array(
90
+ 'color' => '#1e73be',
91
+ 'fontcolor' => '#555555',
92
+ 'bgcolor1' => '#e7e7e7',
93
+ 'bgcolor2' => '#ffffff',
94
+ 'bordercolor' => '#e7e7e7'
95
+ ));
96
+ $defaultLocation = apply_filters('wp_review_default_location', 'bottom');
97
+
98
+ $defaultCriteria = apply_filters('wp_review_default_criteria', array());
99
+ $defaultItems = array();
100
+ foreach ($defaultCriteria as $item) {
101
+ $defaultItems[] = array( 'wp_review_item_title' => $item, 'wp_review_item_star' => '');
102
+ }
103
+ $default_schema = empty( $options['default_schema_type'] ) ? $default_options['default_schema_type'] : $options['default_schema_type'];
104
+ $default_user_review_type = empty( $options['default_user_review_type'] ) ? WP_REVIEW_REVIEW_DISABLED : $options['default_user_review_type'];
105
+ $options['colors'] = apply_filters( 'wp_review_colors', $options['colors'], 0 );
106
+ if (!isset($options['deafults'])) $options['deafults'] = array();
107
+ /* Retrieve an existing value from the database. */
108
+ $items = ! empty($options['default_features']) ? $options['default_features'] : '';
109
+ $link_texts = ! empty( $options['default_link_text'] ) ? $options['default_link_text'] : array();
110
+ $link_urls = ! empty( $options['default_link_url'] ) ? $options['default_link_url'] : array();
111
+ $color = ! empty($options['colors']['color']) ? $options['colors']['color'] : '';
112
+ $location = ! empty($options['review_location']) ? $options['review_location'] : '';
113
+ $fontcolor = ! empty($options['colors']['fontcolor']) ? $options['colors']['fontcolor'] : '';
114
+ $bgcolor1 = ! empty($options['colors']['bgcolor1']) ? $options['colors']['bgcolor1'] : '';
115
+ $bgcolor2 = ! empty($options['colors']['bgcolor2']) ? $options['colors']['bgcolor2'] : '';
116
+ $bordercolor = ! empty($options['colors']['bordercolor']) ? $options['colors']['bordercolor'] : '';
117
+ $registered_only = ! empty( $options['registered_only'] ) ? $options['registered_only'] : '';
118
+ $add_backlink = isset( $options['add_backlink'] ) && $options['add_backlink'] == '0' ? false : true;
119
+ if ( $items == '' ) $items = $defaultItems;
120
+ if( $color == '' ) $color = $defaultColors['color'];
121
+ if( $location == '' ) $location = $defaultLocation;
122
+ if( $fontcolor == '' ) $fontcolor = $defaultColors['fontcolor'];
123
+ if( $bgcolor1 == '' ) $bgcolor1 = $defaultColors['bgcolor1'];
124
+ if( $bgcolor2 == '' ) $bgcolor2 = $defaultColors['bgcolor2'];
125
+ if( $bordercolor == '' ) $bordercolor = $defaultColors['bordercolor'];
126
+
127
+ $fields = array(
128
+ 'location' => true,
129
+ 'color' => true,
130
+ 'fontcolor' => true,
131
+ 'bgcolor1' => true,
132
+ 'bgcolor2' => true,
133
+ 'bordercolor' => true,
134
+ 'custom_colors' => true,
135
+ 'custom_location' => true,
136
+ );
137
+ $displayed_fields = apply_filters('wp_review_metabox_item_fields', $fields);
138
+
139
+ ?>
140
+
141
+ <div class="nav-tab-wrapper">
142
+ <a href="#styling" class="nav-tab nav-tab-active" data-tab="styling"><?php _e('Styling', 'wp-review'); ?></a>
143
+ <a href="#defaults" class="nav-tab" data-tab="defaults"><?php _e('Defaults', 'wp-review'); ?></a>
144
+ <a href="#pro" class="nav-tab" data-tab="pro"><?php _e('Pro', 'wp-review'); ?></a>
145
+ <?php if ( $rows_left ) : ?>
146
+ <a href="#migrate" class="nav-tab" data-tab="migrate"><?php _e('Migrate Ratings', 'wp-review'); ?></a>
147
+ <?php endif; ?>
148
+ </div>
149
+ <div id="wp-review-settings-tab-contents">
150
+
151
+ <div class="settings-tab-styling">
152
+
153
+ <h3><?php _e( 'Styling', 'wp-review' ); ?></h3>
154
+
155
+ <?php if (has_filter('wp_review_colors')) echo '<p class="wp-review-filter-msg"><div class="dashicons dashicons-info"></div>'.__('There is a filter set for the review colors that may modify the options below.', 'wp-review').'</p>'; ?>
156
+
157
+ <div class="wp-review-color-options">
158
+ <p class="wp-review-field"<?php if (empty($displayed_fields['color'])) echo ' style="display: none;"'; ?>>
159
+ <label for="wp_review_color"><?php _e( 'Review Color', 'wp-review' ); ?></label>
160
+ <input type="text" class="wp-review-color" name="wp_review_options[colors][color]" value="<?php echo $color; ?>" />
161
+ </p>
162
+
163
+ <p class="wp-review-field"<?php if (empty($displayed_fields['fontcolor'])) echo ' style="display: none;"'; ?>>
164
+ <label for="wp_review_fontcolor"><?php _e( 'Font Color', 'wp-review' ); ?></label>
165
+ <input type="text" class="wp-review-color" name="wp_review_options[colors][fontcolor]" id ="wp_review_fontcolor" value="<?php echo $fontcolor; ?>" />
166
+ </p>
167
+
168
+ <p class="wp-review-field"<?php if (empty($displayed_fields['bgcolor1'])) echo ' style="display: none;"'; ?>>
169
+ <label for="wp_review_bgcolor1"><?php _e( 'Heading Background Color', 'wp-review' ); ?></label>
170
+ <input type="text" class="wp-review-color" name="wp_review_options[colors][bgcolor1]" id ="wp_review_bgcolor1" value="<?php echo $bgcolor1; ?>" />
171
+ </p>
172
+
173
+ <p class="wp-review-field"<?php if (empty($displayed_fields['bgcolor2'])) echo ' style="display: none;"'; ?>>
174
+ <label for="wp_review_bgcolor2"><?php _e( 'Background Color', 'wp-review' ); ?></label>
175
+ <input type="text" class="wp-review-color" name="wp_review_options[colors][bgcolor2]" id="wp_review_bgcolor2" value="<?php echo $bgcolor2; ?>" />
176
+ </p>
177
+
178
+ <p class="wp-review-field"<?php if (empty($displayed_fields['bordercolor'])) echo ' style="display: none;"'; ?>>
179
+ <label for="wp_review_bordercolor"><?php _e( 'Border Color', 'wp-review' ); ?></label>
180
+ <input type="text" class="wp-review-color" name="wp_review_options[colors][bordercolor]" id="wp_review_bordercolor" value="<?php echo $bordercolor; ?>" />
181
+ </p>
182
+ </div>
183
+
184
+ </div>
185
+ <div class="settings-tab-defaults">
186
+ <h3><?php _e( 'Defaults', 'wp-review' ); ?></h3>
187
+
188
+ <?php $has_criteria_filter = has_filter( 'wp_review_default_criteria' ); ?>
189
+ <?php $schemas = apply_filters( 'wp_review_schema_types', array() ); ?>
190
+
191
+ <table class="form-table">
192
+ <tr>
193
+ <th scope="row"><?php _e( 'Review Location', 'wp-review' ); ?></th>
194
+ <td>
195
+ <select name="wp_review_options[review_location]" id="wp_review_location">
196
+ <option value="bottom" <?php selected( $location, 'bottom' ); ?>><?php _e( 'After Content', 'wp-review' ) ?></option>
197
+ <option value="top" <?php selected( $location, 'top' ); ?>><?php _e( 'Before Content', 'wp-review' ) ?></option>
198
+ <option value="custom" <?php selected( $location, 'custom' ); ?>><?php _e( 'Custom (use shortcode)', 'wp-review' ) ?></option>
199
+ </select>
200
+ <p class="wp-review-field" id="wp_review_shortcode_hint_field">
201
+ <input id="wp_review_shortcode_hint" type="text" value="[wp-review]" readonly="readonly" />
202
+ <span><?php _e('Copy &amp; paste this shortcode in the post content.', 'wp-review') ?></span>
203
+ </p>
204
+ </td>
205
+ </tr>
206
+ <tr>
207
+ <th scope="row"><?php _e( 'Features', 'wp-review' ); ?></th>
208
+ <td>
209
+ <table id="wp-review-item">
210
+ <?php if ( $has_criteria_filter ) : ?>
211
+ <?php foreach ( $defaultCriteria as $item ) : ?>
212
+ <?php if ( ! empty( $item ) ) : ?>
213
+ <tr>
214
+ <td style="padding:0">
215
+ <input type="text" name="wp_review_options[default_features][]" value="<?php if( !empty( $item ) ) echo esc_attr( $item ); ?>" <?php echo $has_criteria_filter ? 'disabled="disabled" readonly="readonly"' : ''; ?> />
216
+ <?php if ( ! $has_criteria_filter ) : ?>
217
+ <a class="button remove-row" href="#"><?php _e( 'Delete', 'wp-review' ); ?></a>
218
+ <?php endif; ?>
219
+ </td>
220
+ </tr>
221
+ <?php endif; ?>
222
+ <?php endforeach; ?>
223
+ <?php else : ?>
224
+ <?php foreach ( $items as $item ) : ?>
225
+ <?php if ( ! empty( $item ) ) : ?>
226
+ <tr>
227
+ <td style="padding:0">
228
+ <input type="text" name="wp_review_options[default_features][]" value="<?php if( !empty( $item ) ) echo esc_attr( $item ); ?>" <?php echo $has_criteria_filter ? 'disabled="disabled" readonly="readonly"' : ''; ?> />
229
+ <?php if ( ! $has_criteria_filter ) : ?>
230
+ <a class="button remove-row" href="#"><?php _e( 'Delete', 'wp-review' ); ?></a>
231
+ <?php endif; ?>
232
+ </td>
233
+ </tr>
234
+ <?php endif; ?>
235
+ <?php endforeach; ?>
236
+ <?php endif; ?>
237
+ <tr class="empty-row screen-reader-text">
238
+ <td style="padding:0">
239
+ <input class="focus-on-add" type="text" name="wp_review_options[default_features][]" />
240
+ <a class="button remove-row" href="#"><?php _e( 'Delete', 'wp-review' ); ?></a>
241
+ </td>
242
+ </tr>
243
+ </table>
244
+ <?php if ( $has_criteria_filter ) : ?>
245
+ <p class="description"><?php _e('Default features are set by a filter function. Remove it to change.', 'wp-review'); ?></p>
246
+ <?php else : ?>
247
+ <a class="add-row button" data-target="#wp-review-item" href="#"><?php _e( 'Add default feature', 'wp-review' ) ?></a>
248
+ <?php endif; ?>
249
+ </td>
250
+ </tr>
251
+ </table>
252
+ </div>
253
+ <div class="settings-tab-pro">
254
+ <p class="wp-review-field">
255
+ <?php
256
+ $backlink_text = wp_review_get_backlink();
257
+ ?>
258
+ <input name="wp_review_options[add_backlink]" type="hidden" value="0" />
259
+ <input name="wp_review_options[add_backlink]" id="wp_review_add_backlink" type="checkbox" value="1" <?php checked( $add_backlink, '1' ); ?> />
260
+ <label for="wp_review_add_backlink" style="width: 300px;"><?php printf(__( 'Add Backlink (%s)', 'wp-review' ), $backlink_text); ?></label>
261
+ </p>
262
+ </div>
263
+ <?php if ( $rows_left ) : ?>
264
+ <div class="settings-tab-migrate">
265
+ <div id="settings-allow-migrate">
266
+ <p><?php _e('Here you can import your existing user ratings from WP Review &lt; 4.0', 'wp-review'); ?></p>
267
+ <p class="migrate-items"><?php printf( __( '%s ratings left to import.', 'wp-review'), '<span id="migrate-items-num">'.$rows_left.'</span>' ); ?></p>
268
+ <a href="#" class="button button-secondary" id="start-migrate" data-start="<?php echo $migrated_rows; ?>"><?php _e('Start import', 'wp-review'); ?></a>
269
+ <textarea id="wp-review-migrate-log"></textarea>
270
+ </div>
271
+ <p class="already-migrated-msg"><?php _e('Ratings have already been migrated.', 'wp-review'); ?></p>
272
+ </div>
273
+ <?php endif; ?>
274
+
275
+ </div>
276
+
277
+
278
+ <p class="submit">
279
+ <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
280
+ </p>
281
+
282
+ </form>
283
+ </div>
284
+ <?php if (!apply_filters( 'wp_review_remove_branding', false )) : ?>
285
+ <div id="col-left" style="float: right; margin-top: 47px;">
286
+ <a href="https://mythemeshop.com/plugins/wp-review-pro/?utm_source=WP+Review&utm_medium=Link+CPC&utm_content=WP+Review+Pro+LP&utm_campaign=WordPressOrg" target="_blank">
287
+ <img src="<?php echo trailingslashit( WP_REVIEW_ASSETS ); ?>/images/wp-review-pro.jpg">
288
+ </a>
289
+ </div>
290
+ <?php endif; ?>
291
+ <?php }
292
+
293
+ // Add settings link on plugin page
294
+ function wpreview_plugin_settings_link($links) {
295
+ $dir = explode('/', WP_REVIEW_PLUGIN_BASE);
296
+ $dir = $dir[0];
297
+ $settings_link = '<a href="options-general.php?page='.$dir.'/admin/options.php">'.__('Settings', 'wp-review').'</a>';
298
+ array_unshift($links, $settings_link);
299
+ return $links;
300
+ }
301
+ add_filter('plugin_action_links_'.WP_REVIEW_PLUGIN_BASE, 'wpreview_plugin_settings_link' );
302
+
303
  ?>
assets/css/admin.css CHANGED
@@ -1,24 +1,181 @@
1
- /*
2
- * Plugin Name: WP Review
3
- * Plugin URI: http://mythemeshop.com/plugins/wp-review/
4
- */
5
- .wp-review-field label { width: 15%; display: inline-block; *display: inline; *zoom: 1; }
6
- .wp-review-field select { width: 15em }
7
- .wp-review-field .wp-color-result { margin: 0 }
8
- .wp-review-item th { text-align: left }
9
- .has-border-bottom { border-bottom: 1px solid #ddd; margin-bottom: 20px; padding-bottom: 20px; }
10
- .review-total { text-align: right }
11
- .wp-picker-holder { position: absolute; z-index: 9; }
12
- #wp-review-item .review-value-incorrect { border-color: #F00 }
13
- #wp_review_shortcode_hint_field span { color: #777; font-style: italic; display: block; margin-left: 116px; margin-top: 2px; }
14
- #wp_review_shortcode_hint { width: 94px }
15
- #wp_review_id_hint { margin-left: 8px }
16
- .wp-review-admin-options .form-table td { padding: 20px 10px; vertical-align: top; }
17
- .wp-review-admin-options p.description { font-weight: normal }
18
- .wp-review-admin-options .wp-review-field label { width: 20% }
19
- .wp-review-admin-options #wp_review_shortcode_hint_field span { display: inline; margin-left: 6px; }
20
- .wp-review-theme-defaults-msg { position: relative }
21
- .wp-review-theme-defaults-msg a.button { display: inline-block; margin-bottom: 8px; }
22
- .wp-review-theme-defaults-msg a.close-notice { position: absolute; top: 0; right: 0; }
23
- #wp-review-width-slider { width: 68%; float: right; margin-top: 8px; margin-right: 10px; }
24
- #wp_review_width { width: 50px }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Plugin Name: WP Review
3
+ * Plugin URI: https://wordpress.org/plugins/wp-review/
4
+ * Description: Create reviews! Choose from Stars, Percentages, Circles or Points for review scores. Supports Retina Display, WPMU & Unlimited Color Schemes.
5
+ * Author: MyThemesShop
6
+ * Author URI: http://mythemeshop.com/
7
+ */
8
+ .wp-review-field label {
9
+ width: 15%;
10
+ display: inline-block;
11
+ *display: inline;
12
+ *zoom: 1;
13
+ }
14
+ #wp-review-metabox-userReview .wp-review-field label { width: 18%; }
15
+ .wp-review-field select { width: 15em }
16
+ .wp-review-field .wp-color-result { margin: 0 }
17
+ .wp-review-item th { text-align: left }
18
+ .wp-review-item td:first-child, .wp-review-links td:first-child { text-align: center }
19
+ .wp-review-item .handle, .wp-review-links .handle { cursor: move }
20
+ .has-border-bottom {
21
+ border-bottom: 1px solid #ddd;
22
+ margin-bottom: 20px;
23
+ padding-bottom: 20px;
24
+ }
25
+ .review-total { text-align: right }
26
+ .wp-picker-holder {
27
+ position: absolute;
28
+ z-index: 9;
29
+ }
30
+ #wp-review-item .review-value-incorrect { border-color: #F00 }
31
+ #wp_review_shortcode_hint_field span {
32
+ color: #777;
33
+ font-style: italic;
34
+ display: block;
35
+ margin-left: 15%;
36
+ margin-top: 2px;
37
+ }
38
+ /*#wp_review_shortcode_hint { width: 94px }*/
39
+ #wp_review_id_hint { margin-left: 8px }
40
+ .wp-review-admin-options .form-table td {
41
+ padding: 20px 10px;
42
+ vertical-align: top;
43
+ }
44
+ .wp-review-admin-options p.description { font-weight: normal }
45
+ .wp-review-admin-options .wp-review-field label { width: 20% }
46
+ .wp-review-admin-options #wp_review_shortcode_hint_field span {
47
+ display: inline;
48
+ margin-left: 6px;
49
+ }
50
+ .wp-review-theme-defaults-msg { position: relative }
51
+ .wp-review-theme-defaults-msg a.button {
52
+ display: inline-block;
53
+ margin-bottom: 8px;
54
+ }
55
+ .wp-review-theme-defaults-msg a.close-notice {
56
+ position: absolute;
57
+ top: 0;
58
+ right: 0;
59
+ }
60
+ #wp-review-width-slider {
61
+ width: 68%;
62
+ float: right;
63
+ margin-top: 12px;
64
+ margin-right: 10px;
65
+ border-radius: 0;
66
+ max-width: 600px;
67
+ border: 0;
68
+ background: #d8d8d8;
69
+ height: 8px;
70
+ }
71
+ #wp-review-width-slider.ui-slider-horizontal .ui-slider-handle {
72
+ margin-left: -21px;
73
+ background: #fff;
74
+ box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
75
+ -moz-box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
76
+ -webkit-box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
77
+ height: 24px;
78
+ min-width: 30px;
79
+ padding-left: 5px;
80
+ padding-right: 5px;
81
+ top: 0;
82
+ margin-top: -9px;
83
+ border: 0;
84
+ }
85
+ #wp-review-width-slider.ui-slider-horizontal .ui-slider-range-min {
86
+ border: 0;
87
+ border-radius: 0;
88
+ background: #27c470;
89
+ }
90
+ #wp_review_width { width: 50px }
91
+ .wrap.wp-review .nav-tab-wrapper { border-bottom: 1px solid #ccc }
92
+ .nav-tab-hidden { display: none }
93
+ .nav-tab-hidden.nav-tab-active { display: block }
94
+ textarea#wp-review-migrate-log {
95
+ width: 600px;
96
+ max-width: 100%;
97
+ height: 200px;
98
+ display: none;
99
+ }
100
+ .already-migrated-msg { display: none }
101
+ #start-migrate { margin-bottom: 12px }
102
+ #wp-review-settings-tab-contents > div { display: none;max-width: 900px;}
103
+ #wp-review-settings-tab-contents .settings-tab-general { display: block }
104
+
105
+ .column-wp_review_rating,
106
+ .column-wp_review_comment_rating {
107
+ text-align: center;
108
+ position: relative;
109
+ width: 110px;
110
+ }
111
+ .column-wp_review_rating .review-star,
112
+ .column-wp_review_comment_rating .review-star {
113
+ position: relative;
114
+ }
115
+ .column-wp_review_rating .no-rating,
116
+ .column-wp_review_comment_rating .no-rating {
117
+ color: #aaa;
118
+ font-style: italic;
119
+ }
120
+ #editwpreview {
121
+ overflow: hidden;
122
+ }
123
+ #editwpreview .inside {
124
+ float: left;
125
+ padding: 3px 0 2px 5px;
126
+ margin: 0;
127
+ text-align: center;
128
+ }
129
+ #editwpreview .inside input {
130
+ width: 180px
131
+ }
132
+ #editwpreview label {
133
+ padding: 2px 0
134
+ }
135
+ h4.wp-review-comment-title {
136
+ margin-top: 0;
137
+ margin-bottom: 1em;
138
+ }
139
+
140
+ @font-face {
141
+ font-family: 'font-icons';
142
+ src: url('../fonts/font-icons.eot');
143
+ src: url('../fonts/font-icons.eot') format('embedded-opentype'), url('../fonts/font-icons.woff') format('woff'), url('../fonts/font-icons.ttf') format('truetype'), url('../fonts/font-icons.svg') format('svg');
144
+ font-weight: normal;
145
+ font-style: normal;
146
+ }
147
+ .mts-icon-star:before { content: '\e800' }
148
+ [class^="mts-icon-"]:before, [class*=" mts-icon-"]:before {
149
+ font-family: "font-icons";
150
+ font-style: normal;
151
+ font-weight: normal;
152
+ speak: none;
153
+ display: inline-block;
154
+ text-decoration: inherit;
155
+ width: 1em;
156
+ margin-right: 0;
157
+ text-align: center;
158
+ font-variant: normal;
159
+ text-transform: none;
160
+ line-height: 1em;
161
+ margin-left: 2px;
162
+ font-size: 13px;
163
+ }
164
+ .review-result-wrapper {
165
+ position: relative;
166
+ display: inline-block;
167
+ font-size: 0;
168
+ }
169
+ .postbox .review-result-wrapper a, .postbox .review-result i { cursor: pointer }
170
+ .review-result {
171
+ position: absolute;
172
+ top: 0;
173
+ left: 0;
174
+ height: 22px;
175
+ overflow: hidden;
176
+ white-space: nowrap;
177
+ }
178
+ .wp-review-rating-feature { display: inline-block }
179
+ .wp-review-notice {
180
+ position: relative;
181
+ }
assets/css/wp-review-ie7.css CHANGED
@@ -1,6 +1,9 @@
1
- /*
2
  * Plugin Name: WP Review
3
- * Plugin URI: http://mythemeshop.com/plugins/wp-review/
 
 
 
4
  */
5
  [class^="icon-"], [class*=" icon-"] {
6
  font-family: 'font-icons';
@@ -8,5 +11,4 @@
8
  font-weight: normal;
9
  line-height: 1em;
10
  }
11
-
12
  .icon-star { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe800;&nbsp;'); }
1
+ /*
2
  * Plugin Name: WP Review
3
+ * Plugin URI: https://wordpress.org/plugins/wp-review/
4
+ * Description: Create reviews! Choose from Stars, Percentages, Circles or Points for review scores. Supports Retina Display, WPMU & Unlimited Color Schemes.
5
+ * Author: MyThemesShop
6
+ * Author URI: http://mythemeshop.com/
7
  */
8
  [class^="icon-"], [class*=" icon-"] {
9
  font-family: 'font-icons';
11
  font-weight: normal;
12
  line-height: 1em;
13
  }
 
14
  .icon-star { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe800;&nbsp;'); }
assets/css/wp-review-tab-widget.css CHANGED
@@ -1,35 +1,118 @@
1
- /*
2
  * Plugin Name: WP Review
3
- * Plugin URI: http://mythemeshop.com/plugins/wp-review/
 
 
 
4
  */
5
- .wp_review_tab_widget_content { position: relative; border: 1px solid #E4E4E4; }
6
- .wp_review_tab_widget_content img { max-width: 100%; height: auto; }
 
 
 
 
 
 
7
  .wp_review_tab_widget_content a { color: #444 }
8
- .wp_review_tab_widget_content ul.wp-review-tabs li { list-style: none; display: block; width: 50%; float: left; text-align: center; margin: 0; padding: 0 !important; }
9
- .wp_review_tab_widget_content ul.has-1-tabs li { width: 100%; float: none; margin: 0 auto; }
10
- .wp_review_tab_widget_content ul.has-2-tabs li { }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  .wp_review_tab_widget_content ul.has-3-tabs li { width: 33.33% }
12
  .wp_review_tab_widget_content ul.has-4-tabs li { width: 50% }
13
- .wp_review_tab_widget_content .tab_title a { display: block; background: #f0f0f0; border-left: 1px solid #E4E4E4; border-bottom: 1px solid #E4E4E4; padding: 2px 0 4px; line-height: 2.4; text-decoration: none; position: relative; font-weight: bold; }
14
- .wp_review_tab_widget_content .tab_title:first-child a { margin-left: 0; border-left: 0; }
15
- .wp_review_tab_widget_content .tab_title.selected a { background: #fff; border-bottom: 1px solid #fff; }
16
- .wp_review_tab_widget_content .inside { background: #fff; padding-top: 10px; }
17
- .wp_review_tab_widget_content .tab-content li { list-style-type: none; float: left; width: 100%; -moz-box-sizing: border-box; box-sizing: border-box; margin: 0 0 15px 0; padding: 0px 15px 10px 15px; border-bottom: 1px solid #E4E4E4; text-align: left; color: #444; background: none; position: relative; }
18
- .wp_review_tab_widget_content .tab-content li:last-child { border: none; margin-bottom: 0; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  .wp_review_tab_widget_content .tab-content li:first-child { padding-top: 5px }
20
- .wp_review_tab_thumb_small { float: left; margin-right: 12px; padding-top: 4px; width: 65px; height: 65px; overflow: hidden; }
21
- .wp_review_tab_thumb_large { float: none; max-width: 100%; display: inline-block; margin-bottom: 4px; position: relative; }
22
- .wp_review_tab_widget_content .entry-title { font-weight: bold; margin: 0; padding: 0; }
23
- .wp_review_tab_widget_content .wp-review-tab-postmeta { color: #999; font-size: 13px; float: right; margin-top: 5px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  .wp_review_tab_widget_content .wp-post-image { margin: 0 !important }
25
  /* Pagination */
26
- .wp_review_tab_widget_content .wp-review-tab-pagination { margin: 0; width: 100%; padding-top: 0; padding-bottom: 15px; float: left; }
 
 
 
 
 
 
27
  .wp_review_tab_widget_content .wp-review-tab-pagination a { margin: 0 15px }
28
  .wp-review-tab-pagination a.next { float: right }
29
  /* Loading... */
30
- .wp-review-tab-loading {
31
- min-height: 120px;
32
- }
33
  .wp-review-tab-loading:before {
34
  content: "";
35
  display: block;
@@ -41,10 +124,7 @@
41
  background-color: rgba(255,255,255,0.8);
42
  z-index: 11;
43
  }
44
- .clear {
45
- clear: both;
46
- }
47
-
48
  .wp-review-tab-loading:after {
49
  content: "";
50
  margin: 0 auto 3em auto;
@@ -85,10 +165,27 @@
85
  }
86
  }
87
  /* Rating... */
88
- .review-total-only.small-thumb { font-size: 15px; font-weight: bold; padding: 0 4px; margin-top: 4px; float: left; }
89
- .review-total-only.small-thumb.review-type-star { background: none; padding: 0; }
90
- .review-total-only.large-thumb { position: absolute; top: 0; right: 15px; }
91
- li:first-child .review-total-only.large-thumb { top: 5px; right: 15px; display: block; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  .wp_review_tab_widget_content .has-4-tabs .tab_title.selected a { border-bottom: 1px solid #E4E4E4 }
93
  .wp_review_tab_widget_content .has-4-tabs .tab_title:nth-child(3) a { border-left: 0 }
94
  .title-right { overflow: hidden }
1
+ /*
2
  * Plugin Name: WP Review
3
+ * Plugin URI: https://wordpress.org/plugins/wp-review/
4
+ * Description: Create reviews! Choose from Stars, Percentages, Circles or Points for review scores. Supports Retina Display, WPMU & Unlimited Color Schemes.
5
+ * Author: MyThemesShop
6
+ * Author URI: http://mythemeshop.com/
7
  */
8
+ .wp_review_tab_widget_content {
9
+ position: relative;
10
+ border: 1px solid #E4E4E4;
11
+ }
12
+ .wp_review_tab_widget_content img {
13
+ max-width: 100%;
14
+ height: auto;
15
+ }
16
  .wp_review_tab_widget_content a { color: #444 }
17
+ .wp_review_tab_widget_content ul.wp-review-tabs li {
18
+ list-style: none;
19
+ display: block;
20
+ width: 50%;
21
+ float: left;
22
+ text-align: center;
23
+ margin: 0;
24
+ padding: 0 !important;
25
+ }
26
+ .wp_review_tab_widget_content ul.has-1-tabs li {
27
+ width: 100%;
28
+ float: none;
29
+ margin: 0 auto;
30
+ }
31
+ .wp_review_tab_widget_content ul.has-2-tabs li {
32
+
33
+ }
34
  .wp_review_tab_widget_content ul.has-3-tabs li { width: 33.33% }
35
  .wp_review_tab_widget_content ul.has-4-tabs li { width: 50% }
36
+ .wp_review_tab_widget_content .tab_title a {
37
+ display: block;
38
+ background: #f0f0f0;
39
+ border-left: 1px solid #E4E4E4;
40
+ border-bottom: 1px solid #E4E4E4;
41
+ padding: 2px 0 4px;
42
+ line-height: 2.4;
43
+ text-decoration: none;
44
+ position: relative;
45
+ font-weight: bold;
46
+ }
47
+ .wp_review_tab_widget_content .tab_title:first-child a {
48
+ margin-left: 0;
49
+ border-left: 0;
50
+ }
51
+ .wp_review_tab_widget_content .tab_title.selected a {
52
+ background: #fff;
53
+ border-bottom: 1px solid #fff;
54
+ }
55
+ .wp_review_tab_widget_content .inside {
56
+ background: #fff;
57
+ padding-top: 10px;
58
+ }
59
+ .wp_review_tab_widget_content .tab-content li {
60
+ list-style-type: none;
61
+ float: left;
62
+ width: 100%;
63
+ box-sizing: border-box;
64
+ margin: 0 0 15px 0;
65
+ padding: 0px 15px 10px 15px;
66
+ border-bottom: 1px solid #E4E4E4;
67
+ text-align: left;
68
+ color: #444;
69
+ background: none;
70
+ position: relative;
71
+ }
72
+ .wp_review_tab_widget_content .tab-content li:last-child {
73
+ border: none;
74
+ margin-bottom: 0;
75
+ }
76
  .wp_review_tab_widget_content .tab-content li:first-child { padding-top: 5px }
77
+ .wp_review_tab_thumb_small {
78
+ float: left;
79
+ margin-right: 12px;
80
+ padding-top: 4px;
81
+ width: 65px;
82
+ height: 65px;
83
+ overflow: hidden;
84
+ }
85
+ .wp_review_tab_thumb_large {
86
+ float: none;
87
+ max-width: 100%;
88
+ display: inline-block;
89
+ margin-bottom: 4px;
90
+ position: relative;
91
+ }
92
+ .wp_review_tab_widget_content .entry-title {
93
+ font-weight: bold;
94
+ margin: 0;
95
+ padding: 0;
96
+ }
97
+ .wp_review_tab_widget_content .wp-review-tab-postmeta {
98
+ color: #999;
99
+ font-size: 13px;
100
+ float: right;
101
+ margin-top: 5px;
102
+ }
103
  .wp_review_tab_widget_content .wp-post-image { margin: 0 !important }
104
  /* Pagination */
105
+ .wp_review_tab_widget_content .wp-review-tab-pagination {
106
+ margin: 0;
107
+ width: 100%;
108
+ padding-top: 0;
109
+ padding-bottom: 15px;
110
+ float: left;
111
+ }
112
  .wp_review_tab_widget_content .wp-review-tab-pagination a { margin: 0 15px }
113
  .wp-review-tab-pagination a.next { float: right }
114
  /* Loading... */
115
+ .wp-review-tab-loading { min-height: 120px }
 
 
116
  .wp-review-tab-loading:before {
117
  content: "";
118
  display: block;
124
  background-color: rgba(255,255,255,0.8);
125
  z-index: 11;
126
  }
127
+ .clear { clear: both }
 
 
 
128
  .wp-review-tab-loading:after {
129
  content: "";
130
  margin: 0 auto 3em auto;
165
  }
166
  }
167
  /* Rating... */
168
+ .review-total-only.small-thumb {
169
+ font-size: 15px;
170
+ font-weight: bold;
171
+ padding: 0 4px;
172
+ margin-top: 4px;
173
+ float: left;
174
+ }
175
+ .review-total-only.small-thumb.review-type-star {
176
+ background: none;
177
+ padding: 0;
178
+ }
179
+ .review-total-only.large-thumb {
180
+ position: absolute;
181
+ top: 0;
182
+ right: 15px;
183
+ }
184
+ li:first-child .review-total-only.large-thumb {
185
+ top: 5px;
186
+ right: 15px;
187
+ display: block;
188
+ }
189
  .wp_review_tab_widget_content .has-4-tabs .tab_title.selected a { border-bottom: 1px solid #E4E4E4 }
190
  .wp_review_tab_widget_content .has-4-tabs .tab_title:nth-child(3) a { border-left: 0 }
191
  .title-right { overflow: hidden }
assets/css/wp-review.css CHANGED
@@ -1,38 +1,255 @@
1
- /*
2
  * Plugin Name: WP Review
3
- * Plugin URI: http://mythemeshop.com/plugins/wp-review/
 
 
 
4
  */
5
- .review-wrapper { border: 1px solid #e7e7e7; margin-bottom: 1.5em; overflow: hidden; clear: both; }
6
- .review-title { background-color: #f6f6f6; border-bottom: 1px solid #e7e7e7; margin: 0; padding: 10px 15px; }
7
- .review-wrapper .review-list { margin: 0; list-style: none; padding: 0; }
8
- .review-list li { border-bottom: 1px solid #e7e7e7; padding: 10px 15px; position: relative; list-style: none; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  .review-list li:nth-child(even) { background-color: #fafafa }
10
  .review-list li:last-child { border-bottom: 1px solid #e7e7e7 }
11
  .review-summary-title { margin-bottom: 5px }
12
- .review-desc { float: left; width: 75%; padding: 10px 15px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }
 
 
 
 
 
 
13
  .review-desc p:last-child { margin-bottom: 0 }
14
- .review-result-wrapper i { font-style: normal; font-size: 16px; }
15
- .review-result { position: absolute; top: 0; left: 0; height: 22px; overflow: hidden; white-space: nowrap; }
16
- .review-total-wrapper { float: right; margin: 0; margin-right: 0; padding-right: 0; position: relative; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; margin-right: 15px; }
17
- .review-total-wrapper span.review-total-box { border-top: 0; border-bottom: 0; border-left: 0; border-right: 0; display: block; font-size: 40px; font-weight: 700; text-align: right; margin: 0; padding: 35px 0 20px; width: 100%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }
18
- .review-total-wrapper span.review-total-box small { font-size: 12px; display: block; }
19
- .percentage-icon { font-size: 22px; position: relative; top: -14px; }
20
- .review-total-star { position: relative; margin-top: 5px; margin: 5px auto 15px auto; float: right; }
21
- .review-total-star.allowed-to-rate { margin-top: -10px }
22
- .review-total-star.allowed-to-rate.has-not-rated-yet a { cursor: pointer }
23
- .review-total-star.allowed-to-rate.has-not-rated-yet:hover .review-result { opacity: 0; filter: alpha(opacity=0); display: none; }
24
- .review-total-star.allowed-to-rate.has-not-rated-yet a:hover > i { opacity: 1; filter: alpha(opacity=1); }
25
- .review-total-star.allowed-to-rate a.hovered i { opacity: 1!important; filter: alpha(opacity=1)!important; }
26
- .mts-review-wait-msg { display: none }
27
- .review-total { position: absolute; top: 0px; left: 0px; height: 16px; z-index: 99; text-indent: -9999px; }
28
- .review-star { position: absolute; right: 15px; top: 10px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  /**
30
  * Bar & Percentage Point
31
  */
32
- .bar-point .review-star, .percentage-point .review-star { position: relative; margin: 6px 0; top: 0; right: 0; }
33
- .bar-point .review-result-wrapper, .percentage-point .review-result-wrapper { background: rgba(0,0,0,0.1) 0 -24px repeat-x; width: 100%; height: 22px; }
34
- .bar-point .review-result, .percentage-point .review-result { position: absolute; top: 0px; left: 0px; height: 22px; z-index: 99; text-indent: -9999px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  .review-total-star.allowed-to-rate .review-result-wrapper { background: none }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  /**
37
  * Twenty series themes compatibilty
38
  */
@@ -44,41 +261,212 @@
44
  /**
45
  * Basic styling for wp_review_display_total
46
  */
47
- .review-total-only { padding: 3px 8px; background: #fff; display: inline-block; }
48
- .review-total-only .percentage-icon { font-size: inherit; top: 0; }
49
- .review-total-only .review-type-star { font-size: 12px; padding: 3px 6px; }
50
- .review-total-only .review-total-star { font-size: 12px; margin: 0; }
51
- .review-result-wrapper i { opacity: 0.50; filter: alpha(opacity=50); }
52
- .review-result-wrapper .review-result i { opacity: 1; filter: alpha(opacity=100); }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  /**
54
  * Users review area
55
  */
56
- .user-review-area { border-top: 1px solid #e7e7e7; overflow: hidden; padding: 10px 15px; position: relative; clear: both; }
57
- .user-total-wrapper { float: left; margin: 0; }
58
- .review-total-star.allowed-to-rate { float: right; margin: 0; }
59
- .user-total-wrapper .user-review-title { font-weight: bold;margin:0; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  /**
61
  * Review in comments
62
  */
63
  .wp-review-comment-field { margin-bottom: 10px }
64
  .review-comment-field-msg { margin-right: 12px }
65
- .review-total-star-comments { position: relative; display: inline-block; }
 
 
 
66
  .comment-text-inner { clear: both }
67
- .wp-review-comment-field a { opacity: 0.5; filter: alpha(opacity=50); }
68
- .wp-review-comment-field.allowed-to-rate a { cursor: pointer }
69
- .wp-review-comment-field.allowed-to-rate.has-not-rated-yet a { }
70
- .wp-review-comment-field.allowed-to-rate .review-result-wrapper:hover a { opacity: 0.5; filter: alpha(opacity=50); }
71
- .wp-review-comment-field.allowed-to-rate .review-result-wrapper:hover .review-result { display: none }
72
- .wp-review-comment-field.allowed-to-rate .review-result-wrapper a:hover { opacity: 1; filter: alpha(opacity=100); }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  /**
74
  * Show on thumbnails
75
  */
76
  .wp-review-thumbnail-wrapper { position: relative }
77
- .wp-review-on-thumbnail { position: absolute; top: 0; right: 0; background: #fff; padding: 2px 4px; }
 
 
 
 
 
 
78
  .wp-review-on-thumbnail.review-type-star .review-total-star { margin: 0 }
79
- .review-type-circle.latestPost-review-wrapper, .review-type-circle.wp-review-on-thumbnail { height: 35px ; background: #fff;}
80
- .latestPost-review-wrapper .wp-review-circle-rating, .wp-review-on-thumbnail .wp-review-circle-rating { font-size: 11px !important; }
81
- .review-type-circle.review-total-only, .review-type-circle.wp-review-show-total { padding-top: 6px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  /**
83
  * Font icon
84
  */
@@ -124,39 +512,51 @@
124
  line-height: 1em;
125
  margin-left: .2em;
126
  }
127
-
128
  .mts-icon-star:before { content: '\e800'; }
129
  .mts-icon-loader:before { content: '\e801'; }
130
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  /*
132
  Spin Animation For Loader
133
  */
134
  .animate-spin {
135
- -moz-animation: spin 1s infinite linear;
136
- -o-animation: spin 1s infinite linear;
137
  -webkit-animation: spin 1s infinite linear;
138
  animation: spin 1s infinite linear;
139
  display: inline-block;
140
  }
141
- @-moz-keyframes spin {
142
- 0% { -moz-transform: rotate(0deg); -o-transform: rotate(0deg); -webkit-transform: rotate(0deg); transform: rotate(0deg); }
143
- 100% { -moz-transform: rotate(359deg); -o-transform: rotate(359deg); -webkit-transform: rotate(359deg); transform: rotate(359deg); }
144
- }
145
  @-webkit-keyframes spin {
146
- 0% { -moz-transform: rotate(0deg); -o-transform: rotate(0deg); -webkit-transform: rotate(0deg); transform: rotate(0deg); }
147
- 100% { -moz-transform: rotate(359deg); -o-transform: rotate(359deg); -webkit-transform: rotate(359deg); transform: rotate(359deg); }
148
- }
149
- @-o-keyframes spin {
150
- 0% { -moz-transform: rotate(0deg); -o-transform: rotate(0deg); -webkit-transform: rotate(0deg); transform: rotate(0deg); }
151
- 100% { -moz-transform: rotate(359deg); -o-transform: rotate(359deg); -webkit-transform: rotate(359deg); transform: rotate(359deg); }
152
- }
153
- @-ms-keyframes spin {
154
- 0% { -moz-transform: rotate(0deg); -o-transform: rotate(0deg); -webkit-transform: rotate(0deg); transform: rotate(0deg); }
155
- 100% { -moz-transform: rotate(359deg); -o-transform: rotate(359deg); -webkit-transform: rotate(359deg); transform: rotate(359deg); }
156
  }
157
  @keyframes spin {
158
- 0% { -moz-transform: rotate(0deg); -o-transform: rotate(0deg); -webkit-transform: rotate(0deg); transform: rotate(0deg); }
159
- 100% { -moz-transform: rotate(359deg); -o-transform: rotate(359deg); -webkit-transform: rotate(359deg); transform: rotate(359deg); }
 
 
 
 
 
 
160
  }
161
  /*-----------------------------------------------------*/
162
  /* Responsvie
@@ -168,9 +568,44 @@
168
  .review-desc { width: 66% }
169
  }
170
  @media screen and (max-width:470px) {
171
- .review-desc { padding: 4%; width: 100%; }
172
- .review-total-wrapper { width: 100%; margin-right: 0; }
173
- .review-total-wrapper span.review-total-box { padding: 10px 0 20px; text-align: left; padding-left: 10px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  .user-total-wrapper { width: 96% }
175
- .review-total-star.allowed-to-rate { position: relative; right: auto; left: 0; float: left; }
 
 
 
 
 
 
 
 
 
 
176
  }
1
+ /*
2
  * Plugin Name: WP Review
3
+ * Plugin URI: https://wordpress.org/plugins/wp-review/
4
+ * Description: Create reviews! Choose from Stars, Percentages, Circles or Points for review scores. Supports Retina Display, WPMU & Unlimited Color Schemes.
5
+ * Author: MyThemesShop
6
+ * Author URI: http://mythemeshop.com/
7
  */
8
+ .review-wrapper {
9
+ border: 1px solid #e7e7e7;
10
+ margin-bottom: 1.5em;
11
+ clear: both;
12
+ box-sizing: border-box;
13
+ }
14
+ .review-title {
15
+ background-color: #f6f6f6;
16
+ border-bottom: 1px solid #e7e7e7;
17
+ margin: 0;
18
+ padding: 10px 15px;
19
+ }
20
+ .review-wrapper .review-list {
21
+ margin: 0;
22
+ list-style: none;
23
+ padding: 0;
24
+ }
25
+ .review-links {
26
+ list-style: none;
27
+ padding: 10px 15px 15px;
28
+ margin: 0;
29
+ overflow: hidden;
30
+ }
31
+ .review-links li { display: inline-block; }
32
+ .review-links:not(:last-child) a { margin-right: 10px }
33
+ .review-links li a {
34
+ display: block;
35
+ padding: 4px 10px;
36
+ margin: 0 10px 0 0;
37
+ border: 1px solid currentColor;
38
+ border-radius: 5px;
39
+ }
40
+
41
+
42
+ .entry-content .review-wrapper li:last-child a {
43
+ margin-right: 0;
44
+ }
45
+ .review-list li {
46
+ border-bottom: 1px solid #e7e7e7;
47
+ padding: 10px 15px;
48
+ position: relative;
49
+ list-style: none;
50
+ }
51
  .review-list li:nth-child(even) { background-color: #fafafa }
52
  .review-list li:last-child { border-bottom: 1px solid #e7e7e7 }
53
  .review-summary-title { margin-bottom: 5px }
54
+ .review-desc {
55
+ float: left;
56
+ width: 75%;
57
+ padding: 10px 15px;
58
+ box-sizing: border-box;
59
+ }
60
+ .rtl .review-desc { float: right }
61
  .review-desc p:last-child { margin-bottom: 0 }
62
+ .review-result-wrapper i {
63
+ font-style: normal;
64
+ font-size: 16px;
65
+ }
66
+ .review-result {
67
+ position: absolute;
68
+ top: 0;
69
+ left: 0;
70
+ height: 22px;
71
+ overflow: hidden;
72
+ white-space: nowrap;
73
+ }
74
+ .rtl .review-result {
75
+ left: auto;
76
+ right: 0;
77
+ }
78
+ .review-total-wrapper {
79
+ float: right;
80
+ margin: 0;
81
+ margin-right: 0;
82
+ padding-right: 0;
83
+ position: relative;
84
+ box-sizing: border-box;
85
+ margin: 10px 15px;
86
+ }
87
+ .review-total-wrapper span.review-total-box {
88
+ border-top: 0;
89
+ border-bottom: 0;
90
+ border-left: 0;
91
+ border-right: 0;
92
+ display: block;
93
+ font-size: 40px;
94
+ font-weight: 700;
95
+ text-align: right;
96
+ margin: 0;
97
+ padding: 35px 0 20px;
98
+ width: 100%;
99
+ box-sizing: border-box;
100
+ }
101
+ .circle-point span.review-total-box { height: 180px }
102
+ .review-total-wrapper span.review-total-box small {
103
+ font-size: 12px;
104
+ display: block;
105
+ }
106
+ .percentage-icon {
107
+ font-size: 22px;
108
+ position: relative;
109
+ top: -14px;
110
+ }
111
+ .review-total-star {
112
+ position: relative;
113
+ margin-top: 5px;
114
+ margin: 0 auto;
115
+ float: right;
116
+ }
117
+ .review-star.review-total { position: relative }
118
+ .wp-review-loading-msg { display: none }
119
+ .wp-review-loading .wp-review-loading-msg { display: block }
120
+ .review-total {
121
+ position: absolute;
122
+ top: 0px;
123
+ left: 0px;
124
+ height: 16px;
125
+ z-index: 99;
126
+ }
127
+ .rtl .review-total {
128
+ left: auto;
129
+ right: 0;
130
+ }
131
+ .review-star {
132
+ position: relative;
133
+ margin-top: 5px;
134
+ margin: 3px auto;
135
+ display: inline-block;
136
+ }
137
+ .postbox .review-star {
138
+ position: relative;
139
+ right: auto;
140
+ top: auto;
141
+ }
142
+ .review-list .review-star, .user-review-area .review-star, .review-total-circle .review-star, .wp-review-point-type .review-total-circle .review-star, .wp-review-percentage-type .review-total-circle .review-star {
143
+ position: absolute;
144
+ right: 15px;
145
+ top: 10px;
146
+ }
147
+ .rtl .review-list .review-star, .rtl .user-review-area .review-star, .rtl .review-total-circle .review-star, .rtl .wp-review-point-type .review-total-circle .review-star, .rtl .wp-review-percentage-type .review-total-circle .review-star {
148
+ right: auto;
149
+ left: 15px;
150
+ }
151
+ .review-total-star .review-result { background: none !important }
152
+ .review-total-circle .review-result-wrapper { background: none !important }
153
  /**
154
  * Bar & Percentage Point
155
  */
156
+ .circle-point .review-list li { padding: 14px 15px }
157
+ .review-point .review-result-wrapper, .review-percentage .review-result-wrapper {
158
+ background: rgba(0,0,0,0.1);
159
+ width: 100%;
160
+ height: 22px;
161
+ }
162
+ .review-point .review-result-wrapper { background-color: rgba(0,0,0,0.1) }
163
+ .wp-review-point-type .review-result, .wp-review-percentage-type .review-result, .review-total-point .review-result {
164
+ position: absolute;
165
+ top: 0px;
166
+ left: 0px;
167
+ height: 22px;
168
+ z-index: 99;
169
+ }
170
+ .rtl .wp-review-point-type .review-result, .rtl .wp-review-percentage-type .review-result, .rtl .review-total-point .review-result {
171
+ left: auto;
172
+ right: 0px;
173
+ }
174
  .review-total-star.allowed-to-rate .review-result-wrapper { background: none }
175
+ .wp-review-point-type .review-total-point .review-result-wrapper { background: none }
176
+ .review-total-percentage.allowed-to-rate.has-not-rated-yet, .review-total-point.allowed-to-rate.has-not-rated-yet {
177
+ float: none;
178
+ cursor: pointer;
179
+ }
180
+ .review-percentage .review-result-wrapper, .review-point .review-result-wrapper {
181
+ position: relative;
182
+ width: 100%;
183
+ }
184
+ .review-percentage .review-result, .review-point .review-result { background: currentColor }
185
+ .wp-review-comment-rating.wp-review-comment-rating-point .review-result-wrapper, .wp-review-user-rating.wp-review-user-rating-point .review-result-wrapper, .wp-review-comment-rating.wp-review-comment-rating-percentage .review-result-wrapper, .wp-review-user-rating.wp-review-user-rating-percentage .review-result-wrapper { cursor: pointer }
186
+ .wp-review-user-rating.wp-review-user-rating-point.has-rated .review-result-wrapper, .wp-review-user-rating.wp-review-user-rating-percentage.has-rated .review-result-wrapper { cursor: default }
187
+ .wp-review-comment-rating.wp-review-comment-rating-point .review-result-wrapper:hover .review-result, .wp-review-user-rating.wp-review-user-rating-point .review-result-wrapper:hover .review-result, .wp-review-comment-rating.wp-review-comment-rating-percentage .review-result-wrapper:hover .review-result, .wp-review-user-rating.wp-review-user-rating-percentage .review-result-wrapper:hover .review-result {
188
+ display: block;
189
+ transition: none;
190
+ }
191
+ .review-point, .review-percentage {
192
+ position: relative;
193
+ clear: both;
194
+ }
195
+ .wp-review-your-rating {
196
+ position: absolute;
197
+ top: 102%;
198
+ left: 45%;
199
+ font-size: 12px;
200
+ line-height: 18px;
201
+ background: #f0f0f0;
202
+ color: #444;
203
+ pointer-events: none;
204
+ z-index: 999;
205
+ display: none;
206
+ white-space: nowrap;
207
+ padding: 2px 4px;
208
+ border-radius: 0 5px 5px 5px;
209
+ }
210
+ .rtl .wp-review-your-rating {
211
+ left: auto;
212
+ right: 45%;
213
+ }
214
+ .review-point:hover .wp-review-your-rating, .wp-review-input-set .review-point .wp-review-your-rating, .review-percentage:hover .wp-review-your-rating, .wp-review-input-set .review-percentage .wp-review-your-rating { display: block }
215
+ .review-result-text {
216
+ position: absolute;
217
+ left: 4px;
218
+ top: 0px;
219
+ font-size: 16px;
220
+ line-height: 22px;
221
+ display: none;
222
+ }
223
+ .rtl .review-result-text {
224
+ left: auto;
225
+ right: 4px;
226
+ }
227
+ .wp-review-usercomment-rating .review-result-text, .wp-admin .review-result-text { display: block }
228
+ /**
229
+ * Circle
230
+ */
231
+ .review-total-circle.allowed-to-rate.has-not-rated-yet .review-result-wrapper { cursor: pointer }
232
+ .user-review-area .wp-review-user-rating-circle { float: right }
233
+ .wp-review-user-rating-circle .review-result-wrapper { text-align: right }
234
+ .wp-review-circle-rating-send-button { display: none }
235
+ .wp-review-circle-rating-send { text-decoration: underline }
236
+ .wp-review-circle-rating-send:hover { color: #444 }
237
+ .wp-review-input-set .wp-review-circle-rating-send-button {
238
+ display: block;
239
+ text-align: center;
240
+ }
241
+ .user-review-area .review-circle { float: right }
242
+ .wp-review-comment-rating-circle .wp-review-circle-rating-send-button { display: none !important }
243
+ .review-list .review-circle {
244
+ float: right;
245
+ margin-top: -4px;
246
+ }
247
+ .wp-review-circle-type .review-total-wrapper > .review-total-box { display: none }
248
+ .review-circle.review-total {
249
+ height: 100px;
250
+ width: 100px;
251
+ position: static;
252
+ }
253
  /**
254
  * Twenty series themes compatibilty
255
  */
261
  /**
262
  * Basic styling for wp_review_display_total
263
  */
264
+ .review-total-only {
265
+ padding: 3px 8px;
266
+ background: #fff;
267
+ display: inline-block;
268
+ }
269
+ .review-total-only .percentage-icon {
270
+ font-size: inherit;
271
+ top: 0;
272
+ }
273
+ .review-total-only .review-type-star {
274
+ font-size: 12px;
275
+ padding: 3px 6px;
276
+ }
277
+ .review-total-only .review-total-star {
278
+ font-size: 12px;
279
+ margin: 0;
280
+ }
281
+ .review-total-only canvas {
282
+ width: 21px!important;
283
+ height: auto!important;
284
+ }
285
+ .review-result-wrapper i {
286
+ opacity: 0.50;
287
+ filter: alpha(opacity=50);
288
+ }
289
+ .review-result-wrapper .review-result i {
290
+ opacity: 1;
291
+ filter: alpha(opacity=100);
292
+ }
293
+ .wp-review-box-float-left { margin-right: 20px }
294
+ .wp-review-box-float-right { margin-left: 20px }
295
  /**
296
  * Users review area
297
  */
298
+ .user-review-area {
299
+ border-top: 1px solid #e7e7e7;
300
+ padding: 10px 15px;
301
+ position: relative;
302
+ clear: both;
303
+ overflow: hidden;
304
+ }
305
+ .user-total-wrapper {
306
+ float: left;
307
+ margin: 0;
308
+ }
309
+ .rtl .user-total-wrapper { float: right }
310
+ .review-total-star.allowed-to-rate {
311
+ float: right;
312
+ margin: 0;
313
+ }
314
+ .rtl .review-total-star.allowed-to-rate { float: left }
315
+ .user-total-wrapper .user-review-title {
316
+ font-weight: bold;
317
+ margin: 0;
318
+ }
319
+ .wp-review-user-rating .review-result-wrapper span { cursor: pointer }
320
+ .wp-review-user-rating .review-result-wrapper span i { opacity: 0.2 }
321
+ .wp-review-user-rating .review-result-wrapper:hover span i { opacity: 1 }
322
+ .wp-review-user-rating .review-result-wrapper span:hover ~ span i { opacity: 0.2 }
323
+ .wp-review-user-rating .review-result-wrapper:hover .review-result { display: none }
324
+ .wp-review-user-rating.has-rated .review-result-wrapper:hover .review-result { display: block }
325
+ .wp-review-user-rating.wp-review-loading .review-result-wrapper, .wp-review-user-rating.wp-review-loading .wp-review-your-rating { display: none }
326
  /**
327
  * Review in comments
328
  */
329
  .wp-review-comment-field { margin-bottom: 10px }
330
  .review-comment-field-msg { margin-right: 12px }
331
+ .review-total-star-comments {
332
+ position: relative;
333
+ display: inline-block;
334
+ }
335
  .comment-text-inner { clear: both }
336
+ .wp-review-comment-rating .review-result-wrapper span { cursor: pointer }
337
+ .wp-review-comment-rating .review-result-wrapper span i { opacity: 0.2 }
338
+ .wp-review-comment-rating .review-result-wrapper:hover span i {
339
+ opacity: 1;
340
+ color: #FFB300;
341
+ }
342
+ .wp-review-comment-rating .review-result-wrapper span:hover ~ span i {
343
+ opacity: 0.2;
344
+ color: currentColor;
345
+ }
346
+ .wp-review-comment-rating .review-result-wrapper:hover .review-result { display: none }
347
+ .wp-review-feedback .review-btn {
348
+ text-decoration: none;
349
+ border: 1px solid rgba(0, 0, 0, 0.1);
350
+ background: #eee;
351
+ padding: 3px 9px;
352
+ color: #333;
353
+ border-radius: 4px;
354
+ }
355
+ .wp-review-feedback .review-btn.voted {
356
+ background: #4CAF50;
357
+ color: #fff;
358
+ }
359
+ .wp-review-feedback .review-btn.voted, .wp-review-feedback .review-btn.voted ~ a { cursor: default }
360
+ .wp-review-feedback .review-btn:hover {
361
+ text-decoration: none;
362
+ background: #4CAF50;
363
+ color: #fff;
364
+ }
365
+ .wp-review-feedback .review-btn:nth-child(2) { margin-left: 5px }
366
+ .rtl .wp-review-feedback .review-btn:nth-child(2) { margin-left: auto; margin-right: 5px; }
367
+ .wp-review-feedback .review-btn:nth-child(2):hover, .wp-review-feedback .review-btn.voted:nth-child(2) {
368
+ background-color: #F44336;
369
+ color: #fff;
370
+ }
371
+ .wp-review-comment-title-field {
372
+
373
+ }
374
+ .wp-review-comment-title-field-input { /* margin-left: 20px; _NO__DOTCOMMA__AFTER__*/ }
375
+ .wp-review-comment-rating-circle-wrapper .review-comment-field-msg {
376
+ vertical-align: middle;
377
+ margin-right: 0;
378
+ }
379
+ .wp-review-comment-rating-circle-wrapper .wp-review-comment-field-inner {
380
+ display: inline-block;
381
+ vertical-align: middle;
382
+ }
383
+ .wp-review-comment-rating .review-result-wrapper a {
384
+ text-decoration: none;
385
+ border: none;
386
+ }
387
+ .wp-review-comment-rating-star .review-total-star { float: none }
388
+ .wp-review-comment-rating-circle-wrapper .wp-review-comment-field-inner { display: inline-block }
389
+ .wp-review-comment-rating-star-wrapper .wp-review-comment-field-inner { display: inline-block }
390
+ .wp-review-usercomment-rating .review-star {
391
+ position: relative;
392
+ top: 0;
393
+ right: 0;
394
+ display: inline-block;
395
+ }
396
+ .wp-review-usercomment-rating { margin-bottom: 10px }
397
+ .wp-review-comment-rating-star { display: inline-block }
398
+ form.wp-review-comment-form input, #commentform.wp-review-comment-form input {
399
+ width: 100%;
400
+ background: rgba(0, 0, 0, 0.035);
401
+ border: 1px solid rgba(0, 0, 0, 0.05);
402
+ color: rgba(0, 0, 0, 0.31);
403
+ max-width: 100%;
404
+ height: 48px;
405
+ font-size: 16px;
406
+ padding-left: 2.5%;
407
+ box-sizing: border-box;
408
+ }
409
+ .rtl form.wp-review-comment-form input, .rtl #commentform.wp-review-comment-form input {
410
+ padding-left: auto;
411
+ padding-right: 2.5%;
412
+ }
413
+ form.wp-review-comment-form textarea, #commentform.wp-review-comment-form textarea {
414
+ width: 100%;
415
+ background: rgba(0, 0, 0, 0.035);
416
+ border: 1px solid rgba(0, 0, 0, 0.05);
417
+ color: rgba(0, 0, 0, 0.31);
418
+ max-width: 100%;
419
+ font-size: 16px;
420
+ padding-left: 2.5%;
421
+ box-sizing: border-box;
422
+ }
423
+ .rtl form.wp-review-comment-form textarea, .rtl #commentform.wp-review-comment-form textarea {
424
+ padding-left: auto;
425
+ padding-right: 2.5%;
426
+ }
427
+ form.wp-review-comment-form > div, #commentform.wp-review-comment-form > div {
428
+ width: 100%;
429
+ margin-bottom: 10px;
430
+ float: left;
431
+ }
432
+ .rtl form.wp-review-comment-form > div, .rtl #commentform.wp-review-comment-form > div { float: right }
433
  /**
434
  * Show on thumbnails
435
  */
436
  .wp-review-thumbnail-wrapper { position: relative }
437
+ .wp-review-on-thumbnail {
438
+ position: absolute;
439
+ top: 0;
440
+ right: 0;
441
+ background: #fff;
442
+ padding: 2px 4px;
443
+ }
444
  .wp-review-on-thumbnail.review-type-star .review-total-star { margin: 0 }
445
+ .review-type-circle.latestPost-review-wrapper, .review-type-circle.wp-review-on-thumbnail {
446
+ height: 35px;
447
+ background: #fff;
448
+ }
449
+ .latestPost-review-wrapper .wp-review-circle-rating, .wp-review-on-thumbnail .wp-review-circle-rating { font-size: 11px !important }
450
+ .review-type-circle.review-total-only, .review-type-circle.wp-review-show-total {
451
+ padding-top: 6px;
452
+ height: 34px;
453
+ }
454
+ .review-type-star.latestPost-review-wrapper {
455
+ padding: 2px 8px;
456
+ }
457
+ .widget .wp-review-show-total .review-star, .widget .wp-review-user-rating .review-star {
458
+ position: relative;
459
+ top: 0;
460
+ right: 0;
461
+ }
462
+ /**
463
+ * Animation
464
+ */
465
+ .review-wrapper .review-result { transition: width 2s ease }
466
+ .review-wrapper.delay-animation .review-result {
467
+ width: 0% !important;
468
+ transition: none;
469
+ }
470
  /**
471
  * Font icon
472
  */
512
  line-height: 1em;
513
  margin-left: .2em;
514
  }
 
515
  .mts-icon-star:before { content: '\e800'; }
516
  .mts-icon-loader:before { content: '\e801'; }
517
 
518
+ .wp-review-plugin-backlink {
519
+ display: block;
520
+ font-size: 11px;
521
+ margin-bottom: 1.5em;
522
+ }
523
+
524
+ .settings-tab-pro .wp-review-plugin-backlink {
525
+ display: inline;
526
+ margin-bottom: 0;
527
+ }
528
+
529
+ #review.wp-review-box-with-backlink {
530
+ margin-bottom: 0;
531
+ }
532
+
533
  /*
534
  Spin Animation For Loader
535
  */
536
  .animate-spin {
 
 
537
  -webkit-animation: spin 1s infinite linear;
538
  animation: spin 1s infinite linear;
539
  display: inline-block;
540
  }
 
 
 
 
541
  @-webkit-keyframes spin {
542
+ 0% {
543
+ -webkit-transform: rotate(0deg);
544
+ transform: rotate(0deg);
545
+ }
546
+ 100% {
547
+ -webkit-transform: rotate(359deg);
548
+ transform: rotate(359deg);
549
+ }
 
 
550
  }
551
  @keyframes spin {
552
+ 0% {
553
+ -webkit-transform: rotate(0deg);
554
+ transform: rotate(0deg);
555
+ }
556
+ 100% {
557
+ -webkit-transform: rotate(359deg);
558
+ transform: rotate(359deg);
559
+ }
560
  }
561
  /*-----------------------------------------------------*/
562
  /* Responsvie
568
  .review-desc { width: 66% }
569
  }
570
  @media screen and (max-width:470px) {
571
+ .review-desc {
572
+ padding: 4%;
573
+ width: 100%;
574
+ }
575
+ .review-total-wrapper {
576
+ width: 100%;
577
+ margin-right: 0;
578
+ }
579
+ .review-total-wrapper span.review-total-box {
580
+ padding: 10px 0 20px;
581
+ text-align: left;
582
+ padding-left: 10px;
583
+ }
584
+ .rtl .review-total-wrapper span.review-total-box {
585
+ padding: 10px 0 20px;
586
+ text-align: right;
587
+ padding-left: 0;
588
+ padding-right: 10px;
589
+ }
590
+ .review-total-star {
591
+ position: absolute;
592
+ right: 20px;
593
+ top: 5px;
594
+ }
595
+ .rtl .review-total-star {
596
+ right: auto;
597
+ left: 20px;
598
+ }
599
  .user-total-wrapper { width: 96% }
600
+ .review-total-star.allowed-to-rate {
601
+ position: relative;
602
+ right: auto;
603
+ left: 0;
604
+ float: left;
605
+ }
606
+ .rtl .review-total-star.allowed-to-rat e{
607
+ right: 0;
608
+ left: auto;
609
+ float: right;
610
+ }
611
  }
assets/images/largethumb.png CHANGED
Binary file
assets/images/smallthumb.png CHANGED
Binary file
assets/images/wp-review-pro.jpg CHANGED
File without changes
assets/js/admin.js CHANGED
@@ -1,30 +1,82 @@
1
- /*
2
  * Plugin Name: WP Review
3
- * Plugin URI: http://mythemeshop.com/plugins/wp-review/
 
 
 
4
  */
5
-
6
  jQuery(document).ready(function($) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  /**
9
  * Repeatable field
10
  */
11
- $('#add-row').on('click', function(e) {
12
  e.preventDefault();
13
- var row = $('.empty-row.screen-reader-text').clone(true);
 
14
  var input = row.find('input');
15
  if (typeof input.data('name') !== 'undefined' && input.data('name')) input.prop('name', input.data('name'));
 
16
  row.removeClass('empty-row screen-reader-text');
17
- row.insertBefore('#wp-review-item tbody>tr:last');
18
- row.find("[name='wp_review_item_star[]']").addClass('review-star');
19
  $.review_total();
20
  });
21
 
22
  $('.remove-row').on('click', function(e) {
23
  e.preventDefault();
24
- $(this).parents('tr').remove();
 
 
 
25
  $.review_total();
26
  });
27
 
 
 
 
28
  /**
29
  * Toggle meta box
30
  */
@@ -34,30 +86,34 @@ jQuery(document).ready(function($) {
34
  $('#wp-review-metabox-userReview').hide();
35
  $('#wp_review_shortcode_hint_field').hide();
36
  $('#wp_review_id_hint').hide();
37
-
38
- $('#wp_review_type').on( 'change', function() {
 
39
 
40
- $('#wp-review-metabox-item').toggle( $(this).val() != '' );
41
- $('#wp-review-metabox-heading').toggle( $(this).val() != '' );
42
- $('#wp-review-metabox-desc').toggle( $(this).val() != '' );
43
- $('#wp-review-metabox-userReview').toggle( $(this).val() != '' );
44
- $('#wp_review_id_hint').toggle( $(this).val() != '' );
45
-
46
- if ( $(this).val() == 'point' ) {
47
- $('.dynamic-text').text('Points (1-10)');
48
- }
 
 
49
 
50
- else if ( $(this).val() == 'star' ) {
51
- $('.dynamic-text').text('Star (1-5)');
52
- }
 
 
53
 
54
- else if ( $(this).val() == 'percentage' ) {
55
- $('.dynamic-text').text('Percentage (1-100)');
56
- }
57
-
58
- $.validate_review_value();
59
 
60
- });
61
 
62
  $('#wp_review_custom_colors').change(function(e) {
63
  if ( $(this).is(':checked') ) {
@@ -80,39 +136,26 @@ jQuery(document).ready(function($) {
80
  $('.wp-review-width-options').hide();
81
  }
82
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
  $('#wp-wp_review_desc-wrap').toggle(! $('#wp_review_hide_desc').is(':checked'));
85
  $('#wp_review_hide_desc').change(function() {
86
  $('#wp-wp_review_desc-wrap, #wp-review-desc-title').toggle(!$(this).is(':checked'));
87
  });
88
 
89
- if ( $('#wp_review_type option:selected').val() === 'star' ) {
90
- $('#wp-review-metabox-item').show();
91
- $('#wp-review-metabox-heading').show();
92
- $('#wp-review-metabox-desc').show();
93
- $('#wp-review-metabox-userReview').show();
94
- }
95
-
96
- if ( $('#wp_review_type option:selected').val() === 'point' ) {
97
- $('.dynamic-text').text('Points (1-10)');
98
- $('#wp-review-metabox-item').show();
99
- $('#wp-review-metabox-heading').show();
100
- $('#wp-review-metabox-desc').show();
101
- $('#wp-review-metabox-userReview').show();
102
- }
103
-
104
- if ( $('#wp_review_type option:selected').val() === 'percentage' ) {
105
- $('.dynamic-text').text('Percentage (1-100)');
106
- $('#wp-review-metabox-item').show();
107
- $('#wp-review-metabox-heading').show();
108
- $('#wp-review-metabox-desc').show();
109
- $('#wp-review-metabox-userReview').show();
110
- }
111
-
112
- if ( $('#wp_review_type option:selected').val() != '' ) {
113
- $('#wp_review_id_hint').show();
114
- }
115
-
116
  $('#wp_review_location').on('change', function() {
117
  $('#wp_review_shortcode_hint_field').toggle($(this).val() == 'custom');
118
  });
@@ -122,61 +165,31 @@ jQuery(document).ready(function($) {
122
  if ($('#wp_review_location').val() == 'custom') {
123
  $('#wp_review_shortcode_hint_field').show();
124
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
 
126
- /**
127
- * Review total
128
- */
129
- $.extend({
130
-
131
- review_total: function(){
132
- $('.review-star').on( 'change', function () {
133
-
134
- var sum = 0,
135
- value = 0,
136
- input = $('.review-star').length;
137
-
138
- $('.review-star').each(function () {
139
- value = Number($(this).val());
140
- if (!isNaN(value)) sum += value / input;
141
- });
142
-
143
- $('.wp-review-total').val( Math.round(sum * 10) / 10 );
144
-
145
- $.validate_review_value();
146
-
147
- });
148
-
149
- },
150
-
151
- validate_review_value: function(){
152
-
153
- var type = $('#wp_review_type'),
154
- fields = $('input.review-star'),
155
- minval = 0,
156
- maxval = 999;
157
-
158
- if ( type.val() == 'point' ) {
159
- minval = 1;
160
- maxval = 10;
161
- } else if ( type.val() == 'star' ) {
162
- minval = 1;
163
- maxval = 5;
164
- } else if ( type.val() == 'percentage' ) {
165
- minval = 1;
166
- maxval = 100;
167
- }
168
-
169
- fields.each(function () {
170
- var value = Number($(this).val());
171
- if ( (value) && (value<minval || value>maxval) )
172
- $(this).addClass('review-value-incorrect');
173
- else
174
- $(this).removeClass('review-value-incorrect');
175
- });
176
-
177
- },
178
-
179
  });
 
 
180
 
181
  $.review_total();
182
  //$.validate_review_value();
@@ -193,5 +206,102 @@ jQuery(document).ready(function($) {
193
  $('.wp-review-theme-defaults-msg a.button').click(function() {
194
  return confirm('Are you sure? This may override the current settings.');
195
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
 
197
  });
1
+ /*
2
  * Plugin Name: WP Review
3
+ * Plugin URI: https://wordpress.org/plugins/wp-review/
4
+ * Description: Create reviews! Choose from Stars, Percentages, Circles or Points for review scores. Supports Retina Display, WPMU & Unlimited Color Schemes.
5
+ * Author: MyThemesShop
6
+ * Author URI: http://mythemeshop.com/
7
  */
 
8
  jQuery(document).ready(function($) {
9
+ /**
10
+ * Review total
11
+ */
12
+ var current_rating_max = 100;
13
+ var current_rating_decimals = 0;
14
+ $.extend({
15
+
16
+ review_total: function(){
17
+ var sum = 0,
18
+ value = 0,
19
+ input = $('.review-star').length;
20
+
21
+ $('.review-star').each(function () {
22
+ value = Number($(this).val());
23
+ if (!isNaN(value)) sum += value / input;
24
+ });
25
+
26
+ $('.wp-review-total').val( sum.toFixed( current_rating_decimals ) );
27
+
28
+ $.validate_review_value( current_rating_max );
29
+ },
30
+
31
+ validate_review_value: function( max ){
32
+
33
+ var type = $('#wp_review_type'),
34
+ fields = $('input.review-star'),
35
+ minval = 0,
36
+ maxval = 999;
37
+
38
+ maxval = max;
39
+
40
+ fields.each(function () {
41
+ var value = Number($(this).val());
42
+ if ( (value) && (value<minval || value>maxval) )
43
+ $(this).addClass('review-value-incorrect');
44
+ else
45
+ $(this).removeClass('review-value-incorrect');
46
+ });
47
+
48
+ },
49
+
50
+ });
51
 
52
  /**
53
  * Repeatable field
54
  */
55
+ $('.add-row').on('click', function(e) {
56
  e.preventDefault();
57
+ var $target = $($(this).data('target'));
58
+ var row = $target.find('.empty-row').clone(true);
59
  var input = row.find('input');
60
  if (typeof input.data('name') !== 'undefined' && input.data('name')) input.prop('name', input.data('name'));
61
+ input.filter('[name="wp_review_item_star[]"]').addClass('review-star');
62
  row.removeClass('empty-row screen-reader-text');
63
+ row.insertBefore($target.find('tbody>tr:last'));
64
+ row.find(".focus-on-add").focus();
65
  $.review_total();
66
  });
67
 
68
  $('.remove-row').on('click', function(e) {
69
  e.preventDefault();
70
+ $(this).closest('tr').remove();
71
+ $.review_total();
72
+ });
73
+ $('#wp-review-item').on('change', '.review-star', function(event) {
74
  $.review_total();
75
  });
76
 
77
+ $('#wp-review-metabox-item tbody').sortable({ handle: '.handle', revert: 100, containment: '#wp-review-metabox-item' });
78
+ $('#wp-review-metabox-reviewLinks tbody').sortable({ handle: '.handle', revert: 100, containment: '#wp-review-metabox-reviewLinks' });
79
+
80
  /**
81
  * Toggle meta box
82
  */
86
  $('#wp-review-metabox-userReview').hide();
87
  $('#wp_review_shortcode_hint_field').hide();
88
  $('#wp_review_id_hint').hide();
89
+ $('#wp_review_schema_group').hide();
90
+ $('#wp_review_heading_group').hide();
91
+ $('#wp-review-metabox-reviewLinks').hide();
92
 
93
+ $('#wp_review_type').on( 'change', function() {
94
+ var selected_val = $(this).val();
95
+ var $selected_option = $(this).find('option:selected');
96
+ $('#wp-review-metabox-item').toggle( selected_val != '' );
97
+ $('#wp-review-metabox-heading').toggle( selected_val != '' );
98
+ $('#wp-review-metabox-desc').toggle( selected_val != '' );
99
+ $('#wp-review-metabox-userReview').toggle( selected_val != '' );
100
+ $('#wp_review_id_hint').toggle( selected_val != '' );
101
+ $('#wp_review_schema_group').toggle( selected_val != '' );
102
+ $('#wp-review-metabox-reviewLinks').toggle( selected_val != '' );
103
+ $('#wp_review_heading_group').toggle( selected_val != '' );
104
 
105
+ // Build dynamic text
106
+ var max = $selected_option.data('max');
107
+ var decimals = $selected_option.data('decimals');
108
+ var val_text = $selected_option.text() + ' (1 - ' + max + ')';
109
+ $('.dynamic-text').text(val_text);
110
 
111
+ current_rating_max = max;
112
+ current_rating_decimals = decimals;
113
+ $.validate_review_value( max );
114
+ $.review_total();
 
115
 
116
+ }).change();
117
 
118
  $('#wp_review_custom_colors').change(function(e) {
119
  if ( $(this).is(':checked') ) {
136
  $('.wp-review-width-options').hide();
137
  }
138
  });
139
+ $('#wp_review_custom_author').change(function(e) {
140
+ if ( $(this).is(':checked') ) {
141
+ $('.wp-review-author-options').show();
142
+ } else {
143
+ $('.wp-review-author-options').hide();
144
+ }
145
+ });
146
+ $('#wp_review_show_on_thumbnails').change(function(e) {
147
+ if ( $(this).is(':checked') ) {
148
+ $('.wp-review-thumbnail-options').show();
149
+ } else {
150
+ $('.wp-review-thumbnail-options').hide();
151
+ }
152
+ });
153
 
154
  $('#wp-wp_review_desc-wrap').toggle(! $('#wp_review_hide_desc').is(':checked'));
155
  $('#wp_review_hide_desc').change(function() {
156
  $('#wp-wp_review_desc-wrap, #wp-review-desc-title').toggle(!$(this).is(':checked'));
157
  });
158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  $('#wp_review_location').on('change', function() {
160
  $('#wp_review_shortcode_hint_field').toggle($(this).val() == 'custom');
161
  });
165
  if ($('#wp_review_location').val() == 'custom') {
166
  $('#wp_review_shortcode_hint_field').show();
167
  }
168
+ $('#wp_review_width').on('change', function() {
169
+ var value = parseInt($(this).val());
170
+ if (value < 100) {
171
+ $('.wp-review-align-options').show();
172
+ } else {
173
+ $('.wp-review-align-options').hide();
174
+ }
175
+ $("#wp-review-width-slider").slider("value", parseInt(value));
176
+ });
177
+ $("#wp-review-width-slider").slider({
178
+ range: "min",
179
+ value: $('#wp_review_width').val(),
180
+ step: 1,
181
+ min: 1,
182
+ max: 100,
183
+ slide: function(event, ui) {
184
+ $("#wp_review_width").val(ui.value).trigger('change');
185
+ }
186
+ });
187
 
188
+ $('.wp-review-userReview-options').change(function(event) {
189
+ $('#wp-review-through-comment-option').toggle(!!parseInt($(this).val()));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  });
191
+
192
+
193
 
194
  $.review_total();
195
  //$.validate_review_value();
206
  $('.wp-review-theme-defaults-msg a.button').click(function() {
207
  return confirm('Are you sure? This may override the current settings.');
208
  });
209
+ /*
210
+ var $wrapper = $('.review-result-wrapper');
211
+ $wrapper.on('mouseenter', 'a, i', function(e){
212
+ var $this = $(this);
213
+ $this.closest('.review-result-wrapper').find('.review-result').width(parseInt($this.data('value'))*20 + '%');
214
+ });
215
+ $wrapper.on('click', 'a, i', function(e){
216
+ var $this = $(this);
217
+ var $wrapper = $this.closest('.review-result-wrapper');
218
+ var val = $this.data('value');
219
+ $wrapper.find('.review-result').data('value', val);
220
+ $wrapper.prev().val(val);
221
+ });
222
+ $wrapper.on('mouseleave', function(e){
223
+ var $result = $(this).find('.review-result');
224
+ $result.width(parseInt($result.data('value'))*20 + '%');
225
+ });
226
+ */
227
+ $('[name=wp_review_userReview]').change(function(e){
228
+ var val = $(this).val();
229
+ var $type = $('#wp_review_comment_rating_type');
230
+ if(ratingPermissions.commentOnly === val || ratingPermissions.both === val){
231
+ $type.show();
232
+ } else {
233
+ $type.hide();
234
+ }
235
+ });
236
+
237
+
238
+ $('td.wp_review_comment_rating, #wp-review-comment-rating').each(function(){
239
+ var $features = $(this).find('.wp-review-rating-feature');
240
+ var maxWidth = 0;
241
+ $features.each(function(){
242
+ var width = $(this).outerWidth();
243
+ if ( width > maxWidth ) maxWidth = width;
244
+ });
245
+ $features.width( maxWidth + 10 );
246
+ });
247
+
248
+ /*$('.wrap.wp-review .nav-tab-wrapper .nav-tab').click(function(event) {
249
+ event.preventDefault();
250
+ var $this = $(this);
251
+ window.location.hash = $this.data('tab');
252
+ $this.addClass('nav-tab-active').siblings().removeClass('nav-tab-active');
253
+ $('#wp-review-settings-tab-contents').find('.settings-tab-'+$this.data('tab')).show().siblings().hide();
254
+ });*/
255
+ var hash = window.location.hash.substr(1);
256
+ if (hash == '') hash = 'styling';
257
+ if ($('#wp-review-settings-tab-contents').find('.settings-tab-'+hash).length) {
258
+ $('.wrap.wp-review .nav-tab-wrapper .nav-tab').filter('[data-tab='+hash+']').addClass('nav-tab-active').siblings().removeClass('nav-tab-active');
259
+ $('#wp-review-settings-tab-contents').find('.settings-tab-'+hash).show().siblings().hide();
260
+ }
261
+ $(window).on('hashchange', function() {
262
+ var hash = window.location.hash.substr(1);
263
+ if ($('#wp-review-settings-tab-contents').find('.settings-tab-'+hash).length) {
264
+ $('.wrap.wp-review .nav-tab-wrapper .nav-tab').filter('[data-tab='+hash+']').addClass('nav-tab-active').siblings().removeClass('nav-tab-active');
265
+ $('#wp-review-settings-tab-contents').find('.settings-tab-'+hash).show().siblings().hide();
266
+ }
267
+ });
268
+ if ($('#wp-review-migrate-log').length) {
269
+ var $migrate_log = $('#wp-review-migrate-log');
270
+ var migrate_started = false;
271
+ var rows_left = parseInt($('#migrate-items-num').text());
272
+ var migrated_rows = $('#start-migrate').data('start');
273
+ var migrate_finished = false;
274
+ var updatelog = function( text ) {
275
+ $migrate_log.css('display', 'block').val(function(index, old) { return text + "\n" + old });
276
+ }
277
+ var ajax_migrate = function( startindex ) {
278
+ $.ajax({
279
+ url: ajaxurl,
280
+ type: 'POST',
281
+ dataType: 'json',
282
+ data: { action: 'wp_review_migrate_ratings', start: startindex },
283
+ })
284
+ .done(function( data ) {
285
+ $('#migrate-items-num').text(data.rowsleft);
286
+ updatelog( 'Imported ratings: ' + (startindex + 1) + ' - ' + data.lastrow + '...' );
287
+ if ( ! data.finished )
288
+ ajax_migrate( data.lastrow );
289
+ else
290
+ updatelog('Import complete.');
291
+ });
292
+
293
+ }
294
+ $('#start-migrate').click(function(event) {
295
+ event.preventDefault();
296
+ if (migrate_started)
297
+ return false;
298
+
299
+ migrate_started = true;
300
+ updatelog('Import started, please wait...');
301
+
302
+ ajax_migrate(migrated_rows);
303
+ });
304
+
305
+ }
306
 
307
  });
assets/js/main.js CHANGED
@@ -1,49 +1,101 @@
1
- /*
2
  * Plugin Name: WP Review
3
- * Plugin URI: http://mythemeshop.com/plugins/wp-review/
 
 
 
4
  */
5
-
6
- jQuery(document).ready(function($){
7
- $('.review-total-star.allowed-to-rate.has-not-rated-yet a').hover(function(){
8
- $(this).addClass( "hovered" ).prevAll().addClass( "hovered" );
9
- $('#mts-review-user-rate').val($(this).attr('data-input-value'));
10
- },
11
- function(){
12
- $(this).removeClass( "hovered" ).prevAll().removeClass( "hovered" );
13
- $('#mts-review-user-rate').val('');
 
14
  });
15
 
16
- $('.review-total-star.allowed-to-rate.has-not-rated-yet a').on('click', function(){
17
- $('.review-total-star.allowed-to-rate .review-result-wrapper').hide();
18
- $('.mts-review-wait-msg').show();
19
- var blogID = $('#blog_id').val();
20
- var token = $('#token').val();
21
- var post_id = $('#post_id').val();
22
- var user_id = $('#user_id').val();
23
- var review = $(this).attr('data-input-value');
24
- $.ajax ({
25
- data: {action: 'mts_review_get_review', post_id: post_id, user_id: user_id, nonce: token, review: review},
26
- type: 'post',
27
- url: ajaxurl,
28
- success: function( response ){
29
- if( response != 'MTS_REVIEW_DB_ERROR' ){
30
- response = response.split('|');
31
- $('#mts-user-reviews-total').html(response[0]);
32
- $('#mts-user-reviews-counter').html(response[1]);
33
- $('.mts-review-wait-msg').hide();
34
- $('.review-total-star.allowed-to-rate .review-result-wrapper').show();
35
- $('.review-total-star.allowed-to-rate').removeClass('has-not-rated-yet');
36
- $('.review-total-star.allowed-to-rate a, .review-total-star.allowed-to-rate a').off();
37
- $('.review-total-wrapper span.review-total-box.hidden').removeClass('hidden').show();
38
- var starsWidth = response[0] *20;
39
- $('.user-review-area .review-result').css('width', starsWidth+'%');
40
-
41
- $('.wp-review-comment-field.allowed-to-rate').removeClass('allowed-to-rate').find('.review-result').css('width', starsWidth+'%');
42
- }
43
  }
44
  });
45
-
46
  });
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
- });
1
+ /*
2
  * Plugin Name: WP Review
3
+ * Plugin URI: https://wordpress.org/plugins/wp-review/
4
+ * Description: Create reviews! Choose from Stars, Percentages, Circles or Points for review scores. Supports Retina Display, WPMU & Unlimited Color Schemes.
5
+ * Author: MyThemesShop
6
+ * Author URI: http://mythemeshop.com/
7
  */
8
+ jQuery(document).ready(function($) {
9
+
10
+ $('.wp-review-comment-field.allowed-to-rate a').on('click', function() {
11
+ var $this = $(this),
12
+ $elem = $this.closest('.wp-review-comment-field');
13
+ if ($elem.hasClass('allowed-to-rate')) {
14
+ $elem.removeClass('has-not-rated-yet');
15
+ $elem.find('.review-result').css('width', parseInt($this.data('input-value'))*20+'%');
16
+ $elem.find('.wp_review_comment_rating').val($this.data('input-value'));
17
+ }
18
  });
19
 
20
+ var $commentFeedback = $('.wp-review-feedback');
21
+ $commentFeedback.on('click', 'a', function(e){
22
+ var $this = $(this);
23
+
24
+ e.preventDefault();
25
+
26
+ if ( $this.hasClass('voted') || $this.siblings().hasClass('voted') || $commentFeedback.hasClass('processing') ) return;
27
+
28
+ $.ajax({
29
+ type: 'POST',
30
+ url: wpreview.ajaxurl,
31
+ beforeSend: function(){
32
+ $commentFeedback.addClass('processing');
33
+ },
34
+ data: { action: 'mts_review_feedback', isHelpful: $this.data('value'), commentId: $this.data('comment-id') },
35
+ success: function(data){
36
+ $this.closest('.wp-review-feedback').find('a').removeClass('voted');
37
+ $this.addClass('voted').find('.feedback-count').text('('+data+')');
38
+ },
39
+ error: function(jqXHR){
40
+ alert(jqXHR.responseText);
41
+ },
42
+ complete: function() {
43
+ $commentFeedback.removeClass('processing');
 
 
 
44
  }
45
  });
 
46
  });
47
 
48
+
49
+ /*
50
+ Add class to comment form
51
+ */
52
+ if ($('#wp-review-comment-title-field').length) {
53
+ $('#wp-review-comment-title-field').closest('form').addClass('wp-review-comment-form');
54
+ }
55
+
56
+ });
57
+
58
+ function wp_review_rate( $elem ) {// rating, postid, nonce ) {
59
+ var is_comment_rating = ($elem.is('.wp-review-comment-rating-star') || !!$elem.closest('.wp-review-comment-rating-star').length);
60
+ if ( is_comment_rating ) {
61
+ return ''; // don't do anything if it's a comment rating element
62
+ }
63
+ var rating = $elem.find('.wp-review-user-rating-val').val();
64
+ var postid = $elem.find('.wp-review-user-rating-postid').val();
65
+ var token = $elem.find('.wp-review-user-rating-nonce').val();
66
+ var $target = $elem;
67
+
68
+ if ( ! $target.is('.wp-review-user-rating') )
69
+ $target = $elem.closest('.wp-review-user-rating');
70
+
71
+ if (rating == 0) {
72
+ return '';
73
+ }
74
+
75
+ jQuery.ajax ({
76
+ beforeSend: function() {
77
+ $target.addClass('wp-review-loading');
78
+ },
79
+ data: { action: 'wp_review_rate', post_id: postid, nonce: token, review: rating },
80
+ type: 'post',
81
+ dataType: 'json',
82
+ url: wpreview.ajaxurl,
83
+ success: function( response ){
84
+ $target.removeClass('wp-review-loading');
85
+ if (typeof response.html !== 'undefined' && response.html != '') {
86
+ $target.empty().append(response.html).addClass('has-rated');
87
+ }
88
+
89
+ // update text total
90
+ if (typeof response.rating_total !== 'undefined' && response.rating_total != '') {
91
+ $target.parent().find('.wp-review-user-rating-total').text(response.rating_total);
92
+ }
93
+ // update rating count
94
+ if (typeof response.rating_count !== 'undefined' && response.rating_count != '') {
95
+ $target.parent().find('.wp-review-user-rating-counter').text(response.rating_count);
96
+ }
97
+ }
98
+ });
99
+
100
 
101
+ }
assets/js/wp-review-tab-widget-admin.js CHANGED
@@ -1,31 +1,34 @@
1
- /*
2
- * Plugin Name: WP Review
3
- * Plugin URI: http://mythemeshop.com/plugins/wp-review/
4
- */
5
- jQuery(document).on('click', function(e) {
6
- var $this = jQuery(e.target);
7
- var $form = $this.closest('.wp_review_tab_options_form');
8
-
9
- if ($this.is('.wp_review_tab_enable_toprated')) {
10
- $form.find('.wp_review_tab_toprated_order').slideToggle($this.is(':checked'));
11
- $form.find('.wp_review_tab_toprated_title').slideToggle($this.is(':checked'));
12
- } else if ($this.is('.wp_review_tab_enable_recent')) {
13
- $form.find('.wp_review_tab_recent_order').slideToggle($this.is(':checked'));
14
- $form.find('.wp_review_tab_recent_title').slideToggle($this.is(':checked'));
15
- } else if ($this.is('.wp_review_tab_enable_mostvoted')) {
16
- $form.find('.wp_review_tab_mostvoted_order').slideToggle($this.is(':checked'));
17
- $form.find('.wp_review_tab_mostvoted_title').slideToggle($this.is(':checked'));
18
- } else if ($this.is('.wp_review_tab_enable_custom')) {
19
- $form.find('.wp_review_tab_custom_order').slideToggle($this.is(':checked'));
20
- $form.find('.wp_review_tab_custom_title').slideToggle($this.is(':checked'));
21
- $form.find('.wp_review_tab_custom_reviews').slideToggle($this.is(':checked'));
22
- } else if ($this.is('.wp_review_tab_order_header')) {
23
- e.preventDefault();
24
- $form.find('.wp_review_tab_order').slideToggle();
25
- $form.find('.wp_review_tab_titles').slideUp();
26
- } else if ($this.is('.wp_review_tab_titles_header')) {
27
- e.preventDefault();
28
- $form.find('.wp_review_tab_titles').slideToggle();
29
- $form.find('.wp_review_tab_order').slideUp();
30
- }
 
 
 
31
  });
1
+ /*
2
+ * Plugin Name: WP Review
3
+ * Plugin URI: https://wordpress.org/plugins/wp-review/
4
+ * Description: Create reviews! Choose from Stars, Percentages, Circles or Points for review scores. Supports Retina Display, WPMU & Unlimited Color Schemes.
5
+ * Author: MyThemesShop
6
+ * Author URI: http://mythemeshop.com/
7
+ */
8
+ jQuery(document).on('click', function(e) {
9
+ var $this = jQuery(e.target);
10
+ var $form = $this.closest('.wp_review_tab_options_form');
11
+
12
+ if ($this.is('.wp_review_tab_enable_toprated')) {
13
+ $form.find('.wp_review_tab_toprated_order').slideToggle($this.is(':checked'));
14
+ $form.find('.wp_review_tab_toprated_title').slideToggle($this.is(':checked'));
15
+ } else if ($this.is('.wp_review_tab_enable_recent')) {
16
+ $form.find('.wp_review_tab_recent_order').slideToggle($this.is(':checked'));
17
+ $form.find('.wp_review_tab_recent_title').slideToggle($this.is(':checked'));
18
+ } else if ($this.is('.wp_review_tab_enable_mostvoted')) {
19
+ $form.find('.wp_review_tab_mostvoted_order').slideToggle($this.is(':checked'));
20
+ $form.find('.wp_review_tab_mostvoted_title').slideToggle($this.is(':checked'));
21
+ } else if ($this.is('.wp_review_tab_enable_custom')) {
22
+ $form.find('.wp_review_tab_custom_order').slideToggle($this.is(':checked'));
23
+ $form.find('.wp_review_tab_custom_title').slideToggle($this.is(':checked'));
24
+ $form.find('.wp_review_tab_custom_reviews').slideToggle($this.is(':checked'));
25
+ } else if ($this.is('.wp_review_tab_order_header')) {
26
+ e.preventDefault();
27
+ $form.find('.wp_review_tab_order').slideToggle();
28
+ $form.find('.wp_review_tab_titles').slideUp();
29
+ } else if ($this.is('.wp_review_tab_titles_header')) {
30
+ e.preventDefault();
31
+ $form.find('.wp_review_tab_titles').slideToggle();
32
+ $form.find('.wp_review_tab_order').slideUp();
33
+ }
34
  });
assets/js/wp-review-tab-widget.js CHANGED
@@ -1,8 +1,10 @@
1
- /*
2
  * Plugin Name: WP Review
3
- * Plugin URI: http://mythemeshop.com/plugins/wp-review/
 
 
 
4
  */
5
-
6
  function wp_review_tab_loadTabContent(tab_name, page_num, container, args_obj) {
7
 
8
  var container = jQuery(container);
1
+ /*
2
  * Plugin Name: WP Review
3
+ * Plugin URI: https://wordpress.org/plugins/wp-review/
4
+ * Description: Create reviews! Choose from Stars, Percentages, Circles or Points for review scores. Supports Retina Display, WPMU & Unlimited Color Schemes.
5
+ * Author: MyThemesShop
6
+ * Author URI: http://mythemeshop.com/
7
  */
 
8
  function wp_review_tab_loadTabContent(tab_name, page_num, container, args_obj) {
9
 
10
  var container = jQuery(container);
box-templates/default.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WP Review: Default
4
+ * Description: Default Review Box template for WP Review
5
+ * Version: 1.0.1
6
+ * Author: MyThemesShop
7
+ * Author URI: http://mythemeshop.com/
8
+ *
9
+ * @since 2.0
10
+ * @copyright Copyright (c) 2013, MyThemesShop
11
+ * @author MyThemesShop
12
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
13
+ */
14
+
15
+ /*
16
+ * Available items in $review array:
17
+ *
18
+ * 'post_id',
19
+ 'type',
20
+ 'heading',
21
+ 'author',
22
+ 'items',
23
+ 'hide_desc',
24
+ 'desc',
25
+ 'desc_title',
26
+ 'total',
27
+ 'colors',
28
+ 'schema',
29
+ 'links',
30
+ 'user_review',
31
+ 'user_review_type',
32
+ 'user_review_total',
33
+ 'user_review_count',
34
+ 'user_has_reviewed',
35
+ 'add_backlink'
36
+ *
37
+ */
38
+
39
+ // Exit if accessed directly
40
+ if ( ! defined( 'ABSPATH' ) ) exit;
41
+
42
+ global $wp_review_rating_types;
43
+
44
+ $classes = array();
45
+ if ( isset( $review['width'] ) && $review['width'] < 100 ) {
46
+ $classes[] = 'wp-review-box-floating';
47
+ if ( isset( $review['align'] ) && $review['align'] == 'right' ) {
48
+ $classes[] = 'wp-review-box-float-right';
49
+ } else {
50
+ $classes[] = 'wp-review-box-float-left';
51
+ }
52
+ } else {
53
+ $classes[] = 'wp-review-box-full-width';
54
+ }
55
+ if ($review['add_backlink']) {
56
+ $classes[] = 'wp-review-box-with-backlink';
57
+ } else {
58
+ $classes[] = 'wp-review-box-no-backlink';
59
+ }
60
+ ?>
61
+ <div itemscope itemtype="http://schema.org/Review" id="review" class="review-wrapper wp-review-<?php echo $review['post_id']; ?> wp-review-<?php echo $review['type']; ?>-type <?php echo join(' ', $classes); ?>" >
62
+ <?php if ( empty( $review['heading'] ) ) : ?>
63
+ <span itemprop="itemReviewed" itemscope itemtype="http://schema.org/<?php echo urlencode( $review['schema'] ); ?>">
64
+ <meta itemprop="name" content="<?php echo esc_attr( get_the_title( $review['post_id'] ) ); ?>">
65
+ </span>
66
+ <?php else: ?>
67
+ <h5 itemprop="itemReviewed" itemscope itemtype="http://schema.org/<?php echo urlencode( $review['schema'] ); ?>" class="review-title"><span itemprop="name"><?php echo esc_html( $review['heading'] ); ?></span></h5>
68
+ <?php endif; ?>
69
+ <span itemprop="author" itemscope itemtype="http://schema.org/Person"><meta itemprop="name" content="<?php echo esc_attr( $review['author'] ); ?>"></span>
70
+ <?php if ( $review['items'] ) : ?>
71
+ <ul class="review-list">
72
+ <?php foreach ( $review['items'] as $item ) :
73
+ $value_text = '';//' - <span>'.$item['wp_review_item_star'].'</span>';
74
+ if ($review['type'] != 'star') {
75
+ $value_text = ' - <span>'.sprintf($wp_review_rating_types[$review['type']]['value_text'], $item['wp_review_item_star']).'</span>';
76
+ }
77
+ ?>
78
+ <li>
79
+ <span><?php echo wp_kses_post( $item['wp_review_item_title'] ); ?><?php echo $value_text; ?></span>
80
+ <?php echo wp_review_rating( $item['wp_review_item_star'] ); ?>
81
+ </li>
82
+ <?php endforeach; ?>
83
+ </ul>
84
+ <?php endif; ?>
85
+ <?php if ( ! $review['hide_desc'] ) : ?>
86
+ <?php if ( $review['desc'] ) : ?>
87
+ <div class="review-desc" itemprop="description">
88
+ <p class="review-summary-title"><strong><?php echo $review['desc_title']; ?></strong></p>
89
+ <?php echo do_shortcode( shortcode_unautop( wp_kses_post( wpautop( $review['desc'] ) ) ) ); ?>
90
+ </div>
91
+ <?php endif; ?>
92
+ <?php if ( ! empty( $review['total'] ) ) :
93
+ $total_text = $review['total'];
94
+ if ( $review['type'] != 'star' ) {
95
+ $total_text = sprintf( $wp_review_rating_types[$review['type']]['value_text'], $total_text );
96
+ }
97
+ ?>
98
+ <div class="review-total-wrapper">
99
+ <span class="review-total-box"><?php echo $total_text; ?></span>
100
+ <?php if ($review['type'] != 'point' && $review['type'] != 'percentage') : ?>
101
+ <?php echo wp_review_rating( $review['total'], $review['post_id'], array('class' => 'review-total') ); ?>
102
+ <?php endif; ?>
103
+ </div>
104
+ <span itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
105
+ <meta itemprop="ratingValue" content="<?php echo esc_attr( $review['total'] ); ?>">
106
+ <meta itemprop="bestRating" content="<?php echo $wp_review_rating_types[$review['type']]['max']; ?>">
107
+ </span>
108
+ <?php endif; ?>
109
+ <?php endif; ?>
110
+ <?php if ( $review['user_review'] ) : ?>
111
+ <div class="user-review-area visitors-review-area">
112
+ <div class="user-total-wrapper">
113
+ <span class="user-review-title"><?php _e( 'User Rating', 'wp-review' ); ?></span>
114
+ <span class="review-total-box">
115
+ <?php
116
+ $usertotal_text = $review['user_review_total'];
117
+ if ($review['user_review_type'] != 'star') {
118
+ $usertotal_text = sprintf( $wp_review_rating_types[$review['user_review_type']]['value_text'], $review['user_review_total'] );
119
+ }
120
+ ?>
121
+ <span class="wp-review-user-rating-total"><?php echo esc_html( $usertotal_text ); ?></span>
122
+ <small>(<span class="wp-review-user-rating-counter"><?php echo esc_html( $review['user_review_count'] ); ?></span> <?php echo _n( 'vote', 'votes', $review['user_review_count'], 'wp-review' ); ?>)</small>
123
+ </span>
124
+ </div>
125
+ <?php echo wp_review_user_rating( $review['post_id'] ); ?>
126
+ </div>
127
+ <?php endif; // $review['user_review'] ?>
128
+ </div>
129
+ <?php if ($review['add_backlink']) : ?>
130
+ <?php echo wp_review_get_backlink(); ?>
131
+ <?php endif; ?>
132
+ <?php
133
+ $colors = $review['colors'];
134
+ $color_output = <<<EOD
135
+
136
+ <style type="text/css">
137
+ .wp-review-{$review['post_id']}.review-wrapper { width: {$review['width']}%; float: {$review['align']} }
138
+ .wp-review-{$review['post_id']}.review-wrapper, .wp-review-{$review['post_id']} .review-title, .wp-review-{$review['post_id']} .review-desc p { color: {$colors['fontcolor']};}
139
+ .wp-review-{$review['post_id']} .review-links a { color: {$colors['color']};}
140
+ .wp-review-{$review['post_id']} .review-links a:hover { color: {$colors['fontcolor']};}
141
+ .wp-review-{$review['post_id']} .review-list li, .wp-review-{$review['post_id']}.review-wrapper{ background: {$colors['bgcolor2']};}
142
+ .wp-review-{$review['post_id']} .review-title, .wp-review-{$review['post_id']} .review-list li:nth-child(2n){background: {$colors['bgcolor1']};}
143
+ .wp-review-{$review['post_id']}.review-wrapper, .wp-review-{$review['post_id']} .review-title, .wp-review-{$review['post_id']} .review-list li, .wp-review-{$review['post_id']} .review-list li:last-child, .wp-review-{$review['post_id']} .user-review-area{border-color: {$colors['bordercolor']};}
144
+ </style>
145
+
146
+ EOD;
147
+
148
+ // Apply legacy filter
149
+ echo apply_filters( 'wp_review_color_output', $color_output, $review['post_id'], $review['colors'] );
filter-list.php CHANGED
@@ -1,80 +1,132 @@
1
- <?php
2
- /*
3
- List of available filters in WP Review plugin.
4
- You can use these filterns in your theme in funtions.php file
5
- and set different default settings.
6
- */
7
-
8
- // Set colors for selected or all reviews
9
- function mts_new_review_colors($colors, $id) {
10
- $colors['bgcolor1'] = '#ff0000';
11
- return $colors;
12
- }
13
- add_filter( 'wp_review_colors', 'mts_new_review_colors', 10, 2 );
14
-
15
- // Set location for selected or all reviews
16
- function mts_new_review_location($position, $id) {
17
- $position = 'bottom';
18
- return $position;
19
- }
20
- add_filter( 'wp_review_location', 'mts_new_review_location', 10, 2 );
21
-
22
- // Hide fields in "item" meta box
23
- function mts_hide_item_metabox_fields($fields) {
24
- unset($fields['location'], $fields['fontcolor'], $fields['bordercolor']);
25
- // Or remove all (except features which can't be removed) with:
26
- // $fields = array();
27
- return $fields;
28
- }
29
- add_filter( 'wp_review_metabox_item_fields', 'mts_hide_item_metabox_fields' );
30
-
31
- // Hide selected review types in metabox dropdown
32
- function mts_hide_review_types($types) {
33
- unset($types['point'], $types['percentage']); // remove types
34
- $types['star'] = __('Enable Reviews'); // Change label
35
- return $types;
36
- }
37
- add_filter( 'wp_review_metabox_types', 'mts_hide_review_types' );
38
-
39
- // Add default criteria
40
- function mts_add_default_criteria($items) {
41
- $items = array(__('Audio'), __('Visual'), __('UX'), __('Price'));
42
- return $items;
43
- }
44
- add_filter( 'wp_review_default_criteria', 'mts_add_default_criteria' );
45
-
46
- // Customize wp_review_show_total() output
47
- function mts_custom_review_total($content, $id, $type, $total) {
48
- if (get_the_title($id) == 'Special Post With Blue Rating') {
49
- $color = '#0000FF';
50
- $content = preg_replace('/"review-type-[^"]+"/', '$0 style="background-color: '.$color.';"', $content);
51
- }
52
- return $content;
53
- }
54
- add_filter('wp_review_show_total', 'mts_custom_review_total', 10, 4);
55
-
56
- // Exclude post types
57
- function mts_wp_review_exclude_post_types($excluded) {
58
- // default: $excluded = array('attachment');
59
- $excluded[] = 'page'; // Don't allow reviews on pages
60
- return $excluded;
61
- }
62
- add_filter( 'wp_review_excluded_post_types', 'mts_wp_review_exclude_post_types' );
63
-
64
- // Set the review options in your theme
65
- // These will be set as the global options for the plugin upon theme activation
66
- $new_options = array(
67
- 'colors' => array(
68
- 'color' => '#dd3333',
69
- 'fontcolor' => '#555555',
70
- 'bgcolor1' => '#e7e7e7',
71
- 'bgcolor2' => '#ffffff',
72
- 'bordercolor' => '#e7e7e7'
73
- )
74
- );
75
- if ( function_exists( 'wp_review_theme_defaults' )) wp_review_theme_defaults( $new_options );
76
-
77
- // Remove banner from options page
78
- add_filter( 'wp_review_remove_branding', '__return_true' );
79
-
80
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ List of available filters in WP Review plugin.
4
+ You can use these filterns in your theme in funtions.php file
5
+ and set different default settings.
6
+ */
7
+
8
+ // Set colors for selected or all reviews
9
+ function mts_new_review_colors($colors, $id) {
10
+ $colors['bgcolor1'] = '#ff0000';
11
+ return $colors;
12
+ }
13
+ add_filter( 'wp_review_colors', 'mts_new_review_colors', 10, 2 );
14
+
15
+ // Set location for selected or all reviews
16
+ function mts_new_review_location($position, $id) {
17
+ $position = 'bottom';
18
+ return $position;
19
+ }
20
+ add_filter( 'wp_review_location', 'mts_new_review_location', 10, 2 );
21
+
22
+ // Hide fields in "item" meta box
23
+ function mts_hide_item_metabox_fields($fields) {
24
+ unset($fields['location'], $fields['fontcolor'], $fields['bordercolor']);
25
+ // Or remove all (except features which can't be removed) with:
26
+ // $fields = array();
27
+ return $fields;
28
+ }
29
+ add_filter( 'wp_review_metabox_item_fields', 'mts_hide_item_metabox_fields' );
30
+
31
+ // Hide selected review types in metabox dropdown
32
+ function mts_hide_review_types($types) {
33
+ unset($types['point'], $types['percentage']); // remove types
34
+ $types['star'] = __('Enable Reviews'); // Change label
35
+ return $types;
36
+ }
37
+ add_filter( 'wp_review_metabox_types', 'mts_hide_review_types' );
38
+
39
+ // Add default criteria
40
+ function mts_add_default_criteria($items) {
41
+ $items = array(__('Audio'), __('Visual'), __('UX'), __('Price'));
42
+ return $items;
43
+ }
44
+ add_filter( 'wp_review_default_criteria', 'mts_add_default_criteria' );
45
+
46
+ // Customize wp_review_show_total() output
47
+ function mts_custom_review_total($content, $id, $type, $total) {
48
+ if (get_the_title($id) == 'Special Post With Blue Rating') {
49
+ $color = '#0000FF';
50
+ $content = preg_replace('/"review-type-[^"]+"/', '$0 style="background-color: '.$color.';"', $content);
51
+ }
52
+ return $content;
53
+ }
54
+ add_filter('wp_review_show_total', 'mts_custom_review_total', 10, 4);
55
+
56
+ // Exclude post types
57
+ function mts_wp_review_exclude_post_types($excluded) {
58
+ // default: $excluded = array('attachment');
59
+ $excluded[] = 'page'; // Don't allow reviews on pages
60
+ return $excluded;
61
+ }
62
+ add_filter( 'wp_review_excluded_post_types', 'mts_wp_review_exclude_post_types' );
63
+
64
+ // Set the review options in your theme
65
+ // These will be set as the global options for the plugin upon theme activation
66
+ $new_options = array(
67
+ 'colors' => array(
68
+ 'color' => '#dd3333',
69
+ 'fontcolor' => '#555555',
70
+ 'bgcolor1' => '#e7e7e7',
71
+ 'bgcolor2' => '#ffffff',
72
+ 'bordercolor' => '#e7e7e7'
73
+ )
74
+ );
75
+ if ( function_exists( 'wp_review_theme_defaults' )) wp_review_theme_defaults( $new_options );
76
+
77
+ /**
78
+ * Editing/overriding the review box template
79
+ *
80
+ * Create a 'wp-review' directory in your (child) theme folder,
81
+ * and make a copy there of /wp-review/box-templates/default.php
82
+ * to override it.
83
+ *
84
+ * Use different file name to add new template, which can be applied using filter:
85
+ *
86
+ */
87
+ add_filter( 'wp_review_get_box_template', 'mts_wp_review_select_box_template', 10, 2 );
88
+ function mts_wp_review_select_box_template( $template, $post_id ) {
89
+ // Change box template for specific post
90
+ if ( $post_id == '128' ) {
91
+ $template = 'new-box.php';
92
+ // "new-box.php" must be present in one of the template path folders (see below)
93
+ }
94
+ return $template;
95
+ }
96
+
97
+ /**
98
+ * Template Path Directories
99
+ *
100
+ * By default the plugin looks for box templates in:
101
+ * 1. wp-review/box-templates
102
+ * 2. theme_dir/wp-review
103
+ * 3. childtheme_dir/wp-review
104
+ * 4... Use filter to add more
105
+ *
106
+ */
107
+ add_filter( 'wp_review_box_template_paths', 'mts_wp_review_add_template_path', 10, 1 );
108
+ function mts_wp_review_add_template_path( $paths ) {
109
+ // Add a new path where we look for review box template files
110
+ // The $paths holds default paths in reversed
111
+ $paths[] = '/absolute/path/to/additional/templates/dir';
112
+ return $paths;
113
+ }
114
+
115
+ /**
116
+ * Add new rating types with wp_review_register_rating_type()
117
+ *
118
+ * Refer to existing rating template files, e.g.
119
+ * point-output.php, point-input.php
120
+ */
121
+ add_action( 'init', 'wp_review_register_additional_rating_types' );
122
+ function wp_review_register_additional_rating_types() {
123
+ wp_review_register_rating_type( 'star10', array(
124
+ 'label' => __('10 Stars', 'wp-review'),
125
+ 'max' => 10,
126
+ 'decimals' => 1,
127
+ 'value_text' => __('%s Stars', 'wp-review'),
128
+ 'value_text_singular' => __('%s Star', 'wp-review'),
129
+ 'input_template' => WP_REVIEW_DIR . 'rating-types/star10-input.php', // Replace with path to input template
130
+ 'output_template' => WP_REVIEW_DIR . 'rating-types/star10-output.php', // Replace with path to output template
131
+ ) );
132
+ }
includes/enqueue.php CHANGED
@@ -1,50 +1,48 @@
1
- <?php
2
- /**
3
- * Custom style for the plugin.
4
- *
5
- * @since 1.0
6
- * @copyright Copyright (c) 2013, MyThemesShop
7
- * @author MyThemesShop
8
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9
- */
10
-
11
- /* Enqueue style for this plugin. */
12
- add_action( 'wp_enqueue_scripts', 'wp_review_enqueue' );
13
-
14
- /* IE7 style for the font icon. */
15
- add_action( 'wp_head', 'wp_review_ie7' );
16
-
17
- /**
18
- * Enqueue style
19
- *
20
- * @since 1.0
21
- */
22
- function wp_review_enqueue() {
23
- global $post;
24
- if(is_singular()) {
25
- /* Retrieve the meta box data. */
26
- $type = get_post_meta( $post->ID, 'wp_review_type', true );
27
-
28
- if ( $type != '' ){
29
- wp_enqueue_style( 'wp_review-style', trailingslashit( WP_REVIEW_ASSETS ) . 'css/wp-review.css', array(), WP_REVIEW_PLUGIN_VERSION, 'all' );
30
- wp_enqueue_script( 'wp_review-js', trailingslashit( WP_REVIEW_ASSETS ) . 'js/main.js', array('jquery'), WP_REVIEW_PLUGIN_VERSION, true );
31
- ?>
32
- <script type="text/javascript">
33
- var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
34
- </script>
35
- <?php
36
- }
37
- }
38
- }
39
-
40
- /**
41
- * IE7 style for the font icon.
42
- *
43
- * @since 1.0
44
- */
45
- function wp_review_ie7() { ?>
46
- <!--[if IE 7]>
47
- <link rel="stylesheet" href="<?php echo trailingslashit( WP_REVIEW_ASSETS ) . 'css/wp-review-ie7.css'; ?>">
48
- <![endif]-->
49
- <?php }
50
  ?>
1
+ <?php
2
+ /**
3
+ * Custom style for the plugin.
4
+ *
5
+ * @since 1.0
6
+ * @copyright Copyright (c) 2013, MyThemesShop
7
+ * @author MyThemesShop
8
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9
+ */
10
+
11
+ /* Enqueue style for this plugin. */
12
+ add_action( 'wp_enqueue_scripts', 'wp_review_enqueue' );
13
+
14
+ /* IE7 style for the font icon. */
15
+ add_action( 'wp_head', 'wp_review_ie7' );
16
+
17
+ /**
18
+ * Enqueue style
19
+ *
20
+ * @since 1.0
21
+ */
22
+ function wp_review_enqueue() {
23
+
24
+ wp_register_style( 'wp_review-style', trailingslashit( WP_REVIEW_ASSETS ) . 'css/wp-review.css', array(), WP_REVIEW_PLUGIN_VERSION, 'all' );
25
+
26
+ wp_register_script( 'wp_review-js', trailingslashit( WP_REVIEW_ASSETS ) . 'js/main.js', array( 'jquery' ), WP_REVIEW_PLUGIN_VERSION, true );
27
+ wp_localize_script( 'wp_review-js', 'wpreview', array(
28
+ 'ajaxurl' => admin_url('admin-ajax.php')
29
+ ) );
30
+
31
+
32
+ if ( is_singular() ) {
33
+ wp_enqueue_style( 'wp_review-style' );
34
+ wp_enqueue_script( 'wp_review-js' );
35
+ }
36
+ }
37
+
38
+ /**
39
+ * IE7 style for the font icon.
40
+ *
41
+ * @since 1.0
42
+ */
43
+ function wp_review_ie7() { ?>
44
+ <!--[if IE 7]>
45
+ <link rel="stylesheet" href="<?php echo trailingslashit( WP_REVIEW_ASSETS ) . 'css/wp-review-ie7.css'; ?>">
46
+ <![endif]-->
47
+ <?php }
 
 
48
  ?>
includes/functions.php CHANGED
@@ -15,291 +15,52 @@ $options = get_option('wp_review_options');
15
  add_filter( 'the_content', 'wp_review_inject_data' );
16
 
17
  /* Get review with Ajax */
18
- add_action('wp_ajax_mts_review_get_review', 'mts_review_get_review');
19
- add_action('wp_ajax_nopriv_mts_review_get_review', 'mts_review_get_review');
 
 
 
 
 
20
 
21
  /* Show with shortcode */
22
- add_shortcode('wp-review', 'wp_review_shortcode');
23
- add_shortcode('wp-review-total', 'wp_review_total_shortcode');
 
24
  // aliases
25
- add_shortcode('wp_review', 'wp_review_shortcode');
26
- add_shortcode('wp_review_total', 'wp_review_total_shortcode');
 
27
 
28
  // image sizes for the widgets
29
  add_image_size( 'wp_review_large', 320, 200, true );
30
- add_image_size( 'wp_review_small', 65, 65, true );
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  /**
33
  * Get the meta box data.
 
34
  *
35
  * @since 1.0
36
  *
37
  */
38
- function wp_review_get_data( $post_id = null ) {
39
- global $post;
40
- global $blog_id;
41
- $options = get_option('wp_review_options');
42
-
43
- if (empty($post_id))
44
- $post_id = $post->ID;
45
-
46
- /* Retrieve the meta box data. */
47
- $heading = get_post_meta( $post_id, 'wp_review_heading', true );
48
- $desc_title = get_post_meta( $post_id, 'wp_review_desc_title', true );
49
- if ( ! $desc_title ) $desc_title = __('Summary', 'wp-review');
50
- $desc = get_post_meta( $post_id, 'wp_review_desc', true );
51
- $items = get_post_meta( $post_id, 'wp_review_item', true );
52
- $type = get_post_meta( $post_id, 'wp_review_type', true );
53
- $total = get_post_meta( $post_id, 'wp_review_total', true );
54
- $hide_desc = get_post_meta( $post_id, 'wp_review_hide_desc', true );
55
- $allowUsers = get_post_meta( $post_id, 'wp_review_userReview', true );
56
-
57
- $colors = array();
58
- $colors['custom_colors'] = get_post_meta( $post_id, 'wp_review_custom_colors', true );
59
- $colors['color'] = get_post_meta( $post_id, 'wp_review_color', true );
60
- $colors['type'] = get_post_meta( $post_id, 'wp_review_type', true );
61
- $colors['fontcolor'] = get_post_meta( $post_id, 'wp_review_fontcolor', true );
62
- $colors['bgcolor1'] = get_post_meta( $post_id, 'wp_review_bgcolor1', true );
63
- $colors['bgcolor2'] = get_post_meta( $post_id, 'wp_review_bgcolor2', true );
64
- $colors['bordercolor'] = get_post_meta( $post_id, 'wp_review_bordercolor', true );
65
- $colors['total'] = get_post_meta( $post_id, 'wp_review_total', true );
66
-
67
- if (!$colors['custom_colors'] && !empty($options['colors']) && is_array($options['colors'])) {
68
- $colors = array_merge($colors, $options['colors']);
69
- }
70
- $colors = apply_filters('wp_review_colors', $colors, $post_id);
71
- $color = $colors['color'];
72
-
73
- /* Define a custom class for bar type. */
74
- $class = '';
75
- if ( 'point' == $type ) {
76
- $class = 'bar-point';
77
- } elseif ( 'percentage' == $type ) {
78
- $class = 'percentage-point';
79
- }
80
- $post_types = get_post_types( array('public' => true), 'names' );
81
- $excluded_post_types = apply_filters('wp_review_excluded_post_types', array('attachment'));
82
- $allowed_post_types = array();
83
- foreach ($post_types as $i => $post_type) {
84
- if (!in_array($post_type, $excluded_post_types)) {
85
- $allowed_post_types[] = $post_type; // allow it if it's not excluded
86
- }
87
- }
88
-
89
- /**
90
- * Add the custom data from the meta box to the main query an
91
- * make sure the hook only apply on allowed post types
92
- */
93
- if ( $type != '' && is_singular($allowed_post_types) && is_main_query() ) {
94
- //if ( $type != '' && is_main_query() && in_array(get_post_type($post_id), $allowed_post_types)) {
95
- // using this second if() instead of the first will allow reviews to be displayed on archive pages, but it may mess up excerpts
96
- $review = '<div itemscope itemtype="http://schema.org/Review" id="review" class="review-wrapper wp-review-'.$post_id.' ' . $class . ' delay-animation" >';
97
-
98
- //$review .= '<meta itemprop="datePublished" content="">';
99
-
100
- /* Review title. */
101
- if ( $heading != '' ) {
102
- $review .= '<h5 itemprop="itemReviewed" itemscope itemtype="http://schema.org/Thing" class="review-title"><span itemprop="name">' . esc_html( $heading ) . '</span></h5>';
103
- }
104
-
105
- /* Review item. */
106
- if ( 'star' == $type ) {
107
- //$bestresult = '<meta itemprop="bestRating" content="5"/>';
108
- $best = '5';
109
- } elseif( 'point' == $type ) {
110
- //$bestresult = '<meta itemprop="bestRating" content="10"/>';
111
- $best = '10';
112
- } else { // percentage
113
- //$bestresult = '<meta itemprop="bestRating" content="100"/>';
114
- $best = '100';
115
- }
116
-
117
- $review .= '<span itemprop="author" itemscope itemtype="http://schema.org/Person">';
118
- $review .= '<meta itemprop="name" content="'. esc_attr( get_the_author() ) .'">';
119
- $review .= '</span>';
120
-
121
- if ( $items ) {
122
- $review .= '<ul class="review-list">';
123
- foreach( $items as $item ) {
124
-
125
- $item['wp_review_item_title'] = ( !empty( $item['wp_review_item_title'] ) ) ? $item['wp_review_item_title'] : '';
126
- $item['wp_review_item_star'] = ( !empty( $item['wp_review_item_star'] ) ) ? $item['wp_review_item_star'] : '';
127
-
128
- if ( 'star' == $type ) {
129
- $result = $item['wp_review_item_star'] * 20;
130
- } elseif( 'point' == $type ) {
131
- $result = $item['wp_review_item_star'] * 10;
132
- } else { // percentage
133
- $result = $item['wp_review_item_star'] * 100 / 100;
134
- }
135
-
136
- $review .= '<li>';
137
-
138
- if ( 'point' == $type ) {
139
- $review .= '<span>' . wp_kses_post( $item['wp_review_item_title'] ) . ' - <span>' . $item['wp_review_item_star'] . '/10</span></span>';
140
- } elseif( 'percentage' == $type ) {
141
- $review .= '<span>' . wp_kses_post( $item['wp_review_item_title'] ) . ' - <span>' . $item['wp_review_item_star'] . '%' . '</span></span>';
142
- } elseif ( 'star' == $type ) {
143
- $review .= '<span>' . wp_kses_post( $item['wp_review_item_title'] ) . '</span>';
144
- }
145
-
146
- $review .= '<div class="review-star">';
147
- $review .= '<div class="review-result-wrapper">';
148
-
149
- if ( 'star' == $type ) {
150
- $review .= '<i class="mts-icon-star"></i>';
151
- $review .= '<i class="mts-icon-star"></i>';
152
- $review .= '<i class="mts-icon-star"></i>';
153
- $review .= '<i class="mts-icon-star"></i>';
154
- $review .= '<i class="mts-icon-star"></i>';
155
- $review .= '<div class="review-result" style="width:' . $result . '%;">';
156
- $review .= '<i class="mts-icon-star"></i>';
157
- $review .= '<i class="mts-icon-star"></i>';
158
- $review .= '<i class="mts-icon-star"></i>';
159
- $review .= '<i class="mts-icon-star"></i>';
160
- $review .= '<i class="mts-icon-star"></i>';
161
- $review .= '</div><!-- .review-result -->';
162
- } elseif ( 'point' == $type ) {
163
- $review .= '<div class="review-result" style="width:' . $result . '%;">' . $item['wp_review_item_star'] . '/10</div>';
164
- } elseif ( 'percentage' == $type ) {
165
- $review .= '<div class="review-result" style="width:' . $result . '%;">' . $item['wp_review_item_star'] . '</div>';
166
- }
167
-
168
- $review .= '</div><!-- .review-result-wrapper -->';
169
- $review .= '</div><!-- .review-star -->';
170
- $review .= '</li>';
171
-
172
- }
173
- $review .= '</ul>';
174
- }
175
-
176
- /* Review description. */
177
- if ( ! $hide_desc ) {
178
- if ( $desc ) {
179
- $review .= '<div class="review-desc" itemprop="description">';
180
- $review .= '<p class="review-summary-title"><strong>' . $desc_title . '</strong></p>';
181
- $review .= do_shortcode ( shortcode_unautop( wp_kses_post( wpautop( $desc ) ) ) );
182
- $review .= '</div><!-- .review-desc -->';
183
-
184
- }//**END IF HAS DESCRIPTION**
185
- if( $total != '' ){
186
- $review .= '<div class="review-total-wrapper"> ';
187
-
188
- if ( 'percentage' == $type ) {
189
- $review .= '<span class="review-total-box">' . $total . ' <i class="percentage-icon">%</i>' . '</span>';
190
- } elseif ( 'point' == $type ) {
191
- $review .= '<span class="review-total-box">' . $total . '/10</span>';
192
- } elseif ( 'star' == $type ) {
193
- $review .= '<span class="review-total-box">' . $total . '</span>';
194
-
195
- $review .= '<div class="review-total-star">';
196
- $review .= '<div class="review-result-wrapper">';
197
- $review .= '<i class="mts-icon-star"></i>';
198
- $review .= '<i class="mts-icon-star"></i>';
199
- $review .= '<i class="mts-icon-star"></i>';
200
- $review .= '<i class="mts-icon-star"></i>';
201
- $review .= '<i class="mts-icon-star"></i>';
202
- $review .= '<div class="review-result" style="width:' . $total*20 . '%;">';
203
- $review .= '<i class="mts-icon-star"></i>';
204
- $review .= '<i class="mts-icon-star"></i>';
205
- $review .= '<i class="mts-icon-star"></i>';
206
- $review .= '<i class="mts-icon-star"></i>';
207
- $review .= '<i class="mts-icon-star"></i>';
208
- $review .= '</div><!-- .review-result -->';
209
- $review .= '</div><!-- .review-result-wrapper -->';
210
- $review .= '</div><!-- .review-star -->';
211
- }
212
-
213
- $review .= '</div>';
214
-
215
- $review .= '<span itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
216
- <meta itemprop="ratingValue" content="'.$total.'">
217
- <meta itemprop="bestRating" content="'.$best.'">
218
- </span>';
219
- }
220
- }
221
-
222
- /**
223
- * USERS REVIEW AREA
224
- */
225
-
226
- if( is_array( $allowUsers ) && $allowUsers[0] == 1 && $post_id == $post->ID ){
227
- $allowedClass = 'allowed-to-rate';
228
- $hasNotRatedClass = 'has-not-rated-yet';
229
- $postReviews = mts_get_post_reviews( $post_id );
230
- $userTotal = $postReviews[0]->reviewsAvg;
231
- $usersReviewsCount = $postReviews[0]->reviewsNum;
232
-
233
- $review .= '<div style="clear: both;"></div>';
234
-
235
- $review .= '<div class="user-review-area" title="'.__('Click on the stars to rate!', 'wp-review').'">';
236
- //$ip = $_SERVER['REMOTE_ADDR'];
237
- if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
238
- $ip = $_SERVER['HTTP_CLIENT_IP'];
239
- } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
240
- $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
241
- } else {
242
- $ip = $_SERVER['REMOTE_ADDR'];
243
- }
244
-
245
- $user_id = '';
246
- if ( is_user_logged_in() ) { $user_id = get_current_user_id(); }
247
- //echo $blog_id;
248
- $review .= '<input type="hidden" id="blog_id" value="'.$blog_id.'">';
249
- $review .= '<input type="hidden" id="post_id" value="'.$post_id.'">';
250
- $review .= '<input type="hidden" id="user_id" value="'.$user_id.'">';
251
- $review .= '<input type="hidden" id="token" value="'.wp_create_nonce( "wp-review-security" ).'">';
252
-
253
-
254
- if( $userTotal == '' ) $userTotal = '0.0';
255
- $review .= '<div class="user-total-wrapper"><span class="user-review-title">'.__('User Rating','wp-review').': </span><span class="review-total-box"><span id="mts-user-reviews-total">' . $userTotal . '</span> ';
256
- $review.= '<small>(<span id="mts-user-reviews-counter" >'.$usersReviewsCount.'</span> '.__('votes', 'wp-review').')</small></span></div>';
257
-
258
- if( hasPreviousReview( $post_id, $user_id, $ip )) {
259
- $hasNotRatedClass = '';
260
- }
261
-
262
- $review .= '<div class="review-total-star '.$allowedClass.' '.$hasNotRatedClass.'" >';
263
- $review .='<div class="mts-review-wait-msg"><span class="animate-spin mts-icon-loader"></span>'.__('Sending','wp-review').'</div>';
264
- $review .= '<div class="review-result-wrapper">';
265
- $review .= '<a data-input-value="1" title="1/5"><i class="mts-icon-star"></i></a>';
266
- $review .= '<a data-input-value="2" title="2/5"><i class="mts-icon-star"></i></a>';
267
- $review .= '<a data-input-value="3" title="3/5"><i class="mts-icon-star"></i></a>';
268
- $review .= '<a data-input-value="4" title="4/5"><i class="mts-icon-star"></i></a>';
269
- $review .= '<a data-input-value="5" title="5/5"><i class="mts-icon-star"></i></a>';
270
- $review .= '<div class="review-result" style="width:' . $userTotal*20 . '%;">';
271
- $review .= '<i class="mts-icon-star"></i>';
272
- $review .= '<i class="mts-icon-star"></i>';
273
- $review .= '<i class="mts-icon-star"></i>';
274
- $review .= '<i class="mts-icon-star" style=""></i>';
275
- $review .= '<i class="mts-icon-star"></i>';
276
- $review .= '</div><!-- .review-result -->';
277
- $review .= '</div><!-- .review-result-wrapper -->';
278
- $review .= '</div><!-- .review-star -->';
279
- $review .= '<input type="hidden" id="mts-review-user-rate" value="" />';
280
-
281
- $review .= '</div>';
282
-
283
- if ( $userTotal !== '0.0' && $total === '' ) {// dont'show if no user ratings and there is review
284
- $review .= '<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
285
- <meta itemprop="ratingValue" content="'.$userTotal.'" />
286
- <meta itemprop="reviewCount" content="'.$usersReviewsCount.'" />
287
- </div>';
288
- }
289
-
290
- }//**END IF USERS ALLOWED TO RATE**
291
-
292
-
293
- $review .= '</div><!-- #review -->';
294
-
295
- $review = apply_filters('wp_review_get_data', $review, $post_id, $type, $total, $items);
296
 
297
- return $review . wp_review_color_output($post_id); // add color CSS to output
298
- } else {
299
- return '';
300
- }
301
  }
302
 
 
303
  function wp_review_inject_data( $content ) {
304
  global $post;
305
  $options = get_option('wp_review_options');
@@ -311,10 +72,10 @@ function wp_review_inject_data( $content ) {
311
 
312
  $location = apply_filters('wp_review_location', $location, $post->ID);
313
 
314
- if (empty($location) || $location == 'custom' || ! is_main_query() || ! in_the_loop()) {
315
  return $content;
316
  }
317
- $review = wp_review_get_data();
318
  if ( 'bottom' == $location ) {
319
  global $multipage, $numpages, $page;
320
  if( $multipage ) {
@@ -340,73 +101,61 @@ function wp_review_inject_data( $content ) {
340
  * @since 1.0
341
  *
342
  */
343
- function wp_review_show_total($echo = true, $class = 'review-total-only', $post_id = null) {
344
- global $post;
 
345
  if (empty($post_id))
346
  $post_id = $post->ID;
 
 
 
 
 
347
 
348
- $type = get_post_meta( $post_id, 'wp_review_type', true );
349
- $total = get_post_meta( $post_id, 'wp_review_total', true );
350
- $review = '';
351
-
352
- $options = get_option('wp_review_options');
353
- $colors = array();
354
- $colors['custom_location'] = get_post_meta( $post_id, 'wp_review_custom_location', true );
355
- $colors['custom_colors'] = get_post_meta( $post_id, 'wp_review_custom_colors', true );
356
- $colors['custom_width'] = get_post_meta( $post_id, 'wp_review_custom_width', true );
357
-
358
- $colors['color'] = get_post_meta( $post_id, 'wp_review_color', true );
359
- $colors['type'] = get_post_meta( $post_id, 'wp_review_type', true );
360
- $colors['fontcolor'] = get_post_meta( $post_id, 'wp_review_fontcolor', true );
361
- $colors['bgcolor1'] = get_post_meta( $post_id, 'wp_review_bgcolor1', true );
362
- $colors['bgcolor2'] = get_post_meta( $post_id, 'wp_review_bgcolor2', true );
363
- $colors['bordercolor'] = get_post_meta( $post_id, 'wp_review_bordercolor', true );
364
- $colors['total'] = get_post_meta( $post_id, 'wp_review_total', true );
365
-
366
- if (!$colors['custom_colors'] && !empty($options['colors']) && is_array($options['colors'])) {
367
- $colors = array_merge($colors, $options['colors']);
368
- }
369
- $colors = apply_filters('wp_review_colors', $colors, $post_id);
370
 
371
- if (!empty($type) && (!empty($total) || $total === '0')) {
372
- wp_enqueue_style( 'wp_review-style', trailingslashit( WP_REVIEW_ASSETS ) . 'css/wp-review.css', array(), WP_REVIEW_PLUGIN_VERSION, 'all' );
373
-
374
- $review = '<div class="review-type-'.$type.' '.esc_attr($class).' wp-review-show-total wp-review-total-'.$post_id.'"> ';
375
-
376
- if ( 'percentage' == $type ) {
377
- $review .= '<span class="review-total-box"><span>' . $total . '</span> <i class="percentage-icon">%</i>' . '</span>';
378
- } elseif ( 'point' == $type ) {
379
- $review .= '<span class="review-total-box">' . $total . '/'.__('10','wp-review').'</span>';
380
- } elseif ( 'star' == $type ) {
381
- // star
382
- $review .= '<div class="review-total-star">';
383
- $review .= '<div class="review-result-wrapper">';
384
- $review .= '<i class="mts-icon-star"></i>';
385
- $review .= '<i class="mts-icon-star"></i>';
386
- $review .= '<i class="mts-icon-star"></i>';
387
- $review .= '<i class="mts-icon-star"></i>';
388
- $review .= '<i class="mts-icon-star"></i>';
389
- $review .= '<div class="review-result" style="width:' . $total*20 . '%;">';
390
- $review .= '<i class="mts-icon-star"></i>';
391
- $review .= '<i class="mts-icon-star"></i>';
392
- $review .= '<i class="mts-icon-star"></i>';
393
- $review .= '<i class="mts-icon-star"></i>';
394
- $review .= '<i class="mts-icon-star"></i>';
395
- $review .= '</div><!-- .review-result -->';
396
- $review .= '</div><!-- .review-result-wrapper -->';
397
- $review .= '</div><!-- .review-star -->';
398
- }
399
-
400
- $review .= '</div>';
401
  }
 
 
 
 
 
 
 
402
 
403
- $review = apply_filters('wp_review_show_total', $review, $post_id, $type, $total);
 
404
 
405
  if ($echo)
406
  echo $review;
407
  else
408
  return $review;
409
  }
 
410
  function wp_review_total_shortcode($atts, $content) {
411
  if (empty($atts['class']))
412
  $atts['class'] = 'review-total-only review-total-shortcode';
@@ -414,214 +163,1189 @@ function wp_review_total_shortcode($atts, $content) {
414
  if (empty($atts['id']))
415
  $atts['id'] = null;
416
 
417
- return wp_review_show_total(false, $atts['class'], $atts['id']);
 
 
418
  }
 
419
  function wp_review_shortcode( $atts, $content = "") {
420
  if (empty($atts['id']))
421
  $atts['id'] = null;
422
 
423
- return wp_review_get_data($atts['id']);
 
 
424
  }
425
 
426
- function mts_get_post_reviews( $post_id ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
427
  if( is_numeric( $post_id ) && $post_id > 0 ){
428
- global $wpdb;
429
- global $blog_id;
430
- $table_name = $wpdb->prefix . MTS_WP_REVIEW_DB_TABLE;
431
- if (function_exists('is_multisite') && is_multisite()) {$table_name = $wpdb->base_prefix . MTS_WP_REVIEW_DB_TABLE;}
432
- $reviews = $wpdb->get_results( $wpdb->prepare("SELECT ROUND( AVG(rate) ,1 ) as reviewsAvg, COUNT(id) as reviewsNum FROM $table_name WHERE blog_id = '%d' AND post_id = '%d'", $blog_id, $post_id) );
433
- return $reviews;
 
 
 
 
 
 
 
 
 
 
 
 
434
  }
435
  }
436
 
 
 
 
 
 
437
 
438
  /**
439
- * Star review color
440
  *
441
- * @since 1.0
 
 
 
 
 
442
  */
443
- function wp_review_color_output($post_id) {
444
- global $post;
445
- if (empty($post_id))
446
- $post_id = $post->ID;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
447
 
448
- $style = '';
449
  $options = get_option('wp_review_options');
450
- if (empty($options['colors'])) $options['colors'] = array();
451
- /* Retrieve the meta box data. */
452
- if(is_singular()) {
453
- $colors = array();
454
- $colors['custom_location'] = get_post_meta( $post_id, 'wp_review_custom_location', true );
455
- $colors['custom_colors'] = get_post_meta( $post_id, 'wp_review_custom_colors', true );
456
- $colors['custom_width'] = get_post_meta( $post_id, 'wp_review_custom_width', true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
458
  $colors['color'] = get_post_meta( $post_id, 'wp_review_color', true );
 
459
  $colors['type'] = get_post_meta( $post_id, 'wp_review_type', true );
460
  $colors['fontcolor'] = get_post_meta( $post_id, 'wp_review_fontcolor', true );
461
  $colors['bgcolor1'] = get_post_meta( $post_id, 'wp_review_bgcolor1', true );
462
  $colors['bgcolor2'] = get_post_meta( $post_id, 'wp_review_bgcolor2', true );
463
  $colors['bordercolor'] = get_post_meta( $post_id, 'wp_review_bordercolor', true );
464
- $colors['total'] = get_post_meta( $post_id, 'wp_review_total', true );
465
-
466
- if (!$colors['custom_colors']) {
467
  $colors = array_merge($colors, $options['colors']);
468
  }
469
- $colors = apply_filters('wp_review_colors', $colors, $post_id);
 
470
 
471
- extract($colors, EXTR_SKIP);
 
 
 
472
 
473
- if( !$color ) $color = '#333333';
474
 
475
- $style = '<style type="text/css">';
 
 
 
476
 
477
- if ( 'star' == $type ) {
 
 
478
 
479
- $style .= '.wp-review-'.$post_id.' .review-result-wrapper .review-result i { color: '.$color.'; opacity: 1; filter: alpha(opacity=100); }
480
- .wp-review-'.$post_id.' .review-result-wrapper i{ color: '.$color.'; opacity: 0.50; filter: alpha(opacity=50); }';
481
-
482
- } elseif ( 'point' == $type ) {
483
 
484
- $style .= '.wp-review-'.$post_id.'.bar-point .review-result { background-color: '.$color.'; }';
 
 
 
 
 
485
 
486
- } elseif ( 'percentage' == $type ) {
487
 
488
- $style .= '.wp-review-'.$post_id.'.percentage-point .review-result { background-color: '.$color.'; }';
489
 
 
 
 
 
 
490
  }
 
491
 
492
- $style .= '.wp-review-'.$post_id.'.review-wrapper, .wp-review-'.$post_id.' .review-title, .wp-review-'.$post_id.' .review-desc p{ color: '.$fontcolor.';}
493
- .wp-review-'.$post_id.' .review-list li, .wp-review-'.$post_id.'.review-wrapper{ background: '.$bgcolor2.';}
494
- .wp-review-'.$post_id.' .review-title, .wp-review-'.$post_id.' .review-list li:nth-child(2n){background: '.$bgcolor1.';}
495
 
496
- .wp-review-'.$post_id.'.bar-point .allowed-to-rate .review-result, .wp-review-'.$post_id.'.percentage-point .allowed-to-rate .review-result{background: none;}
497
- .wp-review-'.$post_id.' .review-total-star.allowed-to-rate a i, .wp-review-comment-field a i, .wp-review-comment-rating a i { color: '.$color.'; opacity: 0.50; filter: alpha(opacity=50); }
498
- .wp-review-'.$post_id.'.bar-point .allowed-to-rate .review-result, .wp-review-'.$post_id.'.percentage-point .allowed-to-rate .review-result{text-indent:0;}
499
- .wp-review-'.$post_id.'.bar-point .allowed-to-rate .review-result i, .wp-review-'.$post_id.'.percentage-point .allowed-to-rate .review-result i, .wp-review-'.$post_id.' .mts-user-review-star-container .selected i, .wp-review-'.$post_id.' .user-review-area .review-result i, .wp-review-comment-field .review-result i, .wp-review-comment-rating .review-result i { color: '.$color.'; opacity: 1; filter: alpha(opacity=100); }
500
- .wp-review-'.$post_id.'.review-wrapper, .wp-review-'.$post_id.' .review-title, .wp-review-'.$post_id.' .review-list li, .wp-review-'.$post_id.' .review-list li:last-child, .wp-review-'.$post_id.' .user-review-area{border-color: '.$bordercolor.';}';
501
-
502
- if( $total == '' ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
503
 
504
- $style .= '.wp-review-'.$post_id.' .user-review-area{border: 1px solid '.$bordercolor.'; margin-top: 0px;}
505
- .wp-review-'.$post_id.' .review-desc{width: 100%;}
506
- .wp-review-'.$post_id.'.review-wrapper{border: none; overflow: visible;}';
 
 
 
 
 
507
  }
508
- $style .= '</style>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
509
 
510
- $style = apply_filters('wp_review_color_output', $style, $post_id, $colors);
 
 
 
511
 
512
- return $style;
 
 
513
  }
 
 
514
  }
515
 
516
- /**
517
- *Check if user has reviewed this post previously
518
- */
519
- function hasPreviousReview( $post_id, $user_id, $ip ){
520
- if( is_numeric( $post_id ) && $post_id > 0 ){
521
- global $wpdb;
522
- global $blog_id;
523
- $table_name = $wpdb->prefix . MTS_WP_REVIEW_DB_TABLE;
524
- if (function_exists('is_multisite') && is_multisite()) {$table_name = $wpdb->base_prefix . MTS_WP_REVIEW_DB_TABLE;}
525
- if( is_numeric( $user_id ) && $user_id > 0 ){
526
- $prevRates = $wpdb->get_row( $wpdb->prepare("SELECT COUNT(id) as reviewsNum FROM $table_name WHERE blog_id = '%d' AND post_id = '%d' AND user_id = '%d'", $blog_id, $post_id, $user_id) );
527
- if( $prevRates->reviewsNum > 0 ) return true; else return false;
528
- }
529
- elseif( $ip != '' ){
530
- $prevRates = $wpdb->get_row( $wpdb->prepare("SELECT COUNT(id) as reviewsNum FROM $table_name WHERE blog_id = '%d' AND post_id = '%d' AND user_ip = '%s' AND user_id = '0'", $blog_id, $post_id, $ip) );
531
- if( $prevRates->reviewsNum > 0 ) return true; else return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
532
  }
533
- else return false;
534
  }
535
- return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
536
  }
537
 
538
- function getPreviousReview( $post_id, $user_id, $ip ) {
539
- if( is_numeric( $post_id ) && $post_id > 0 ){
540
- global $wpdb;
541
- global $blog_id;
542
- $table_name = $wpdb->prefix . MTS_WP_REVIEW_DB_TABLE;
543
- if (function_exists('is_multisite') && is_multisite()) {$table_name = $wpdb->base_prefix . MTS_WP_REVIEW_DB_TABLE;}
544
- if( is_numeric( $user_id ) && $user_id > 0 ){
545
- $prevRates = $wpdb->get_row( $wpdb->prepare("SELECT rate FROM $table_name WHERE blog_id = '%d' AND post_id = '%d' AND user_id = '%d'", $blog_id, $post_id, $user_id) );
546
- if( $prevRates->rate ) return $prevRates->rate; else return 0;
547
- }
548
- elseif( $ip != '' ){
549
- $prevRates = $wpdb->get_row( $wpdb->prepare("SELECT rate FROM $table_name WHERE blog_id = '%d' AND post_id = '%d' AND user_ip = '%s' AND user_id = '0'", $blog_id, $post_id, $ip) );
550
- if( $prevRates->rate ) return $prevRates->rate; else return 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
551
  }
552
- else return false;
553
  }
554
- return false;
555
  }
556
 
557
  /**
558
- *Get review with Ajax
559
- */
560
- function mts_review_get_review(){
561
- // security
562
- check_ajax_referer( 'wp-review-security', 'nonce' );
563
-
564
- global $wpdb;
 
 
 
 
 
 
 
565
 
566
- $table_name = $wpdb->prefix . MTS_WP_REVIEW_DB_TABLE;
567
- if (function_exists('is_multisite') && is_multisite()) {$table_name = $wpdb->base_prefix . MTS_WP_REVIEW_DB_TABLE;}
568
 
569
- global $blog_id;
570
- $post_id = intval($_POST['post_id']);
571
- $user_id = intval($_POST['user_id']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
572
 
573
- //$ip = $_SERVER['REMOTE_ADDR'];
574
- if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
575
- $uip = $_SERVER['HTTP_CLIENT_IP'];
576
- } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
577
- $uip = $_SERVER['HTTP_X_FORWARDED_FOR'];
578
- } else {
579
- $uip = $_SERVER['REMOTE_ADDR'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
580
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
581
 
582
- if (!hasPreviousReview($post_id, $user_id, $uip)) {
583
- $data = intval($_POST['review']);
584
-
585
- if( $rows_affected = $wpdb->insert( $table_name, array('blog_id' => $blog_id, 'post_id' => $post_id, 'user_id' => $user_id, 'user_ip' => $uip, 'rate' => $data, 'date' => current_time('mysql')) ) ){
586
- $reviews = $wpdb->get_row( $wpdb->prepare("SELECT ROUND( AVG(rate) ,1 ) as reviewsAvg, COUNT(id) as reviewsNum FROM $table_name WHERE blog_id = '%d' AND post_id = '%d'", $blog_id, $post_id) );
587
- echo $reviews->reviewsAvg.'|'.$reviews->reviewsNum;
588
- } else {
589
- echo 'MTS_REVIEW_DB_ERROR';
590
- }
591
- } else {
592
- echo 'MTS_REVIEW_DB_ERROR';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
593
  }
594
- exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
595
  }
596
 
597
- function wp_review_theme_defaults($new_options, $force_change = false) {
598
- global $pagenow;
599
- $opt_name = 'wp_review_options_'.wp_get_theme();
600
- $options = get_option('wp_review_options');
601
- if (empty($options)) $options = array();
602
- $options_updated = get_option( $opt_name );
603
- // if the theme was just activated OR options weren't updated yet
604
- if ( empty( $options_updated ) || $options_updated != $new_options || $force_change || ( isset( $_GET['activated'] ) && $pagenow == 'themes.php' )) {
605
- update_option( 'wp_review_options', array_merge($options, $new_options) );
606
- update_option( $opt_name, $new_options );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
607
  }
 
 
 
 
 
 
 
 
608
  }
609
 
610
- function wp_review_get_all_image_sizes() {
611
- global $_wp_additional_image_sizes;
612
-
613
- $default_image_sizes = array( 'thumbnail', 'medium', 'large' );
614
-
615
- foreach ( $default_image_sizes as $size ) {
616
- $image_sizes[$size]['width'] = intval( get_option( "{$size}_size_w") );
617
- $image_sizes[$size]['height'] = intval( get_option( "{$size}_size_h") );
618
- $image_sizes[$size]['crop'] = get_option( "{$size}_crop" ) ? get_option( "{$size}_crop" ) : false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
619
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
620
 
621
- if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) )
622
- $image_sizes = array_merge( $image_sizes, $_wp_additional_image_sizes );
623
-
624
- return $image_sizes;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
625
  }
626
 
627
  /* Display a notice*/
@@ -648,6 +1372,4 @@ function wp_review_admin_notice_ignore() {
648
  if ( isset($_GET['wp_review_admin_notice_ignore']) && '0' == $_GET['wp_review_admin_notice_ignore'] ) {
649
  add_user_meta($user_id, 'wp_review_ignore_notice', 'true', true);
650
  }
651
- }
652
-
653
- ?>
15
  add_filter( 'the_content', 'wp_review_inject_data' );
16
 
17
  /* Get review with Ajax */
18
+ //add_action('wp_ajax_mts_review_get_review', 'mts_review_get_review');
19
+ //add_action('wp_ajax_nopriv_mts_review_get_review', 'mts_review_get_review');
20
+ add_action( 'wp_ajax_wp_review_rate', 'wp_review_ajax_rate' );
21
+ add_action( 'wp_ajax_nopriv_wp_review_rate', 'wp_review_ajax_rate' );
22
+ add_action( 'wp_ajax_mts_review_feedback', 'mts_review_feedback' );
23
+ add_action( 'wp_ajax_nopriv_mts_review_feedback', 'mts_review_feedback' );
24
+ add_action( 'wp_ajax_wp_review_migrate_ratings', 'wp_review_ajax_migrate_ratings' );
25
 
26
  /* Show with shortcode */
27
+ add_shortcode( 'wp-review', 'wp_review_shortcode' );
28
+ add_shortcode( 'wp-review-total', 'wp_review_total_shortcode' );
29
+ add_shortcode( 'wp-review-visitor-rating', 'wp_review_visitor_rating_shortcode' );
30
  // aliases
31
+ add_shortcode( 'wp_review', 'wp_review_shortcode');
32
+ add_shortcode( 'wp_review_total', 'wp_review_total_shortcode');
33
+ add_shortcode( 'wp_review_visitor_rating', 'wp_review_visitor_rating_shortcode' );
34
 
35
  // image sizes for the widgets
36
  add_image_size( 'wp_review_large', 320, 200, true );
37
+ add_image_size( 'wp_review_small', 65, 65, true );
38
+
39
+ if (!empty($options['show_on_thumbnails'])) {
40
+ add_filter( 'post_thumbnail_html', 'wp_review_image_html', 10, 5 );
41
+
42
+ function wp_review_image_html( $html, $post_id, $post_image_id, $size, $attr ) {
43
+ $options = get_option('wp_review_options');
44
+ if (!empty($options['image_sizes']) && is_array($options['image_sizes']) && in_array($size, $options['image_sizes'])) {
45
+ $html = '<div class="wp-review-thumbnail-wrapper">' . $html . wp_review_show_total(false, 'wp-review-on-thumbnail') . '</div>';
46
+ }
47
+ return $html;
48
+ }
49
+ }
50
 
51
  /**
52
  * Get the meta box data.
53
+ * Replaced by wp_review_get_review_box() in v2.0
54
  *
55
  * @since 1.0
56
  *
57
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
+ function wp_review_get_data( $post_id = null ) {
60
+ return wp_review_get_review_box( $post_id );
 
 
61
  }
62
 
63
+
64
  function wp_review_inject_data( $content ) {
65
  global $post;
66
  $options = get_option('wp_review_options');
72
 
73
  $location = apply_filters('wp_review_location', $location, $post->ID);
74
 
75
+ if ( empty($location) || $location == 'custom' || ! is_main_query() || ! in_the_loop() || ! is_single() ) {
76
  return $content;
77
  }
78
+ $review = wp_review_get_review_box();
79
  if ( 'bottom' == $location ) {
80
  global $multipage, $numpages, $page;
81
  if( $multipage ) {
101
  * @since 1.0
102
  *
103
  */
104
+ function wp_review_show_total($echo = true, $class = 'review-total-only', $post_id = null, $args = array()) {
105
+ global $post, $wp_review_rating_types;
106
+
107
  if (empty($post_id))
108
  $post_id = $post->ID;
109
+
110
+ $type = wp_review_get_post_review_type( $post_id );
111
+ $user_type = wp_review_get_post_user_review_type( $post_id );
112
+ if ( ! $type && ! $user_type )
113
+ return '';
114
 
115
+ wp_enqueue_style( 'wp_review-style' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
+ $options = get_option('wp_review_options');
118
+ $show_on_thumbnails_type = isset( $options['show_on_thumbnails_type'] ) ? $options['show_on_thumbnails_type'] : 'author';
119
+ $show_on_thumbnails_type = apply_filters( 'wp_review_thumbnails_total', $show_on_thumbnails_type, $post_id, $args );// will override option
120
+
121
+ $rating = $total = '';
122
+ switch ( $show_on_thumbnails_type ) {
123
+ case 'author':
124
+ $total = get_post_meta( $post_id, 'wp_review_total', true );
125
+
126
+ if ( $type == 'point' || $type == 'percentage' ) {
127
+ $rating = sprintf( $wp_review_rating_types[$type]['value_text'], $total );
128
+ } else {
129
+ $rating = wp_review_rating( $total, $post_id );
130
+ }
131
+ break;
132
+ case 'visitors':
133
+ $total = get_post_meta( $post_id, 'wp_review_user_reviews', true );
134
+
135
+ if ( $user_type == 'point' || $user_type == 'percentage' ) {
136
+ $rating = sprintf( $wp_review_rating_types[$user_type]['value_text'], $total );
137
+ } else {
138
+ $rating = wp_review_user_rating( $post_id );
139
+ }
140
+ break;
 
 
 
 
 
 
141
  }
142
+
143
+ $review = '';
144
+ if ( !empty( $rating ) && !empty( $total ) ) {
145
+ $review .= '<div class="review-type-'.$type.' '.esc_attr($class).' wp-review-show-total wp-review-total-'.$post_id.' wp-review-total-'.$type.'"> ';
146
+ $review .= $rating;
147
+ $review .= '</div>';
148
+ }
149
 
150
+ $review = apply_filters( 'wp_review_show_total', $review, $post_id, $type, $total );
151
+ $review = apply_filters( 'wp_review_total_output', $review, $post_id, $type, $total, $class, $args );
152
 
153
  if ($echo)
154
  echo $review;
155
  else
156
  return $review;
157
  }
158
+
159
  function wp_review_total_shortcode($atts, $content) {
160
  if (empty($atts['class']))
161
  $atts['class'] = 'review-total-only review-total-shortcode';
163
  if (empty($atts['id']))
164
  $atts['id'] = null;
165
 
166
+ $output = wp_review_show_total( false, $atts['class'], $atts['id'], array( 'shortcode' => true ) );
167
+
168
+ return apply_filters( 'wp_review_total_shortcode', $output, $atts );
169
  }
170
+
171
  function wp_review_shortcode( $atts, $content = "") {
172
  if (empty($atts['id']))
173
  $atts['id'] = null;
174
 
175
+ $output = wp_review_get_data($atts['id']);
176
+
177
+ return apply_filters( 'wp_review_shortcode', $output, $atts );
178
  }
179
 
180
+ function wp_review_visitor_rating_shortcode( $atts, $content = "" ) {
181
+ wp_enqueue_style( 'wp_review-style' );
182
+ wp_enqueue_script( 'wp_review-js' );
183
+
184
+ $id = empty( $atts['id'] ) ? get_the_ID() : absint( $atts['id'] );
185
+
186
+ $text = '<div class="wp-review-' . $id . ' review-wrapper visitor-rating-shortcode">';
187
+ $text .= wp_review_user_rating( $id );
188
+ $text .= '</div>';
189
+
190
+ return apply_filters( 'wp_review_visitor_rating_shortcode', $text, $atts );
191
+ }
192
+
193
+ function mts_get_post_reviews( $post_id, $force = false ){
194
+ if ( ! $force && ( $post_reviews = get_post_meta( $post_id, 'wp_review_user_reviews', true ) ) && ( $review_count = get_post_meta( $post_id, 'wp_review_review_count', true ) ) ) {
195
+ return array( 'rating' => $post_reviews, 'count' => $review_count );
196
+ }
197
+
198
  if( is_numeric( $post_id ) && $post_id > 0 ){
199
+ $comments = get_comments( array(
200
+ 'post_id' => $post_id,
201
+ 'type' => WP_REVIEW_COMMENT_TYPE_VISITOR,
202
+ 'status' => 'approve'
203
+ ) );
204
+ $rating = array_reduce( $comments, 'wpreview_comments_count_callback', 0 );
205
+
206
+ $count = count( $comments );
207
+
208
+ $post_reviews = array(
209
+ 'rating' => $count > 0 ? round( $rating / $count, 2 ) : 0,
210
+ 'count' => $count,
211
+ );
212
+
213
+ update_post_meta( $post_id, 'wp_review_user_reviews', $post_reviews['rating'] );
214
+ update_post_meta( $post_id, 'wp_review_review_count', $post_reviews['count'] );
215
+
216
+ return $post_reviews;
217
  }
218
  }
219
 
220
+ function wpreview_comments_count_callback( $carry, $comment ) {
221
+ $rating = get_comment_meta( $comment->comment_ID, WP_REVIEW_VISITOR_RATING_METAKEY, true );
222
+ $carry += (int) $rating;
223
+ return $carry;
224
+ }
225
 
226
  /**
227
+ *Check if user has reviewed this post previously
228
  *
229
+ * @param $post_id
230
+ * @param $user_id
231
+ * @param $ip
232
+ * @param string $type
233
+ *
234
+ * @return bool
235
  */
236
+ function hasPreviousReview( $post_id, $user_id, $ip, $type = 'any' ){
237
+ if( is_numeric( $post_id ) && $post_id > 0 ){
238
+ $args = array( 'post_id' => $post_id, 'count' => true, 'user_id' => 0 );
239
+ set_query_var( 'wp_review_commenttype', $type );
240
+ add_filter( 'pre_get_comments', 'wp_review_add_comment_type_to_query' );
241
+ if ( $user_id ) {
242
+ $args['user_id'] = $user_id;
243
+ } else {
244
+ set_query_var( 'wp_review_ip', $ip );
245
+ add_filter( 'comments_clauses', 'wp_review_filter_comment_by_ip' );
246
+ }
247
+ $count = intval( get_comments( $args ) );
248
+ remove_filter( 'pre_get_comments', 'wp_review_add_comment_type_to_query' );
249
+ remove_filter( 'comments_clauses', 'wp_review_filter_comment_by_ip' );
250
+ return $count > 0;
251
+ }
252
+ return false;
253
+ }
254
+
255
+ /**
256
+ * Add the comment type to comment query.
257
+ *
258
+ * @param WP_Comment_Query $query
259
+ *
260
+ * @return WP_Comment_Query
261
+ */
262
+ function wp_review_add_comment_type_to_query( \WP_Comment_Query $query ) {
263
+ $commenttype = get_query_var( 'wp_review_commenttype' );
264
+ if ( 'any' === $commenttype ) {
265
+ $query->query_vars['type__in'] = array( WP_REVIEW_COMMENT_TYPE_VISITOR );
266
+ } else {
267
+ $query->query_vars['type'] = $commenttype;
268
+ }
269
+ return $query;
270
+ }
271
+
272
+ /**
273
+ * Add a conditional to filter the comment query by IP.
274
+ *
275
+ * @param array $clauses
276
+ *
277
+ * @return array
278
+ */
279
+ function wp_review_filter_comment_by_ip( array $clauses ) {
280
+ global $wpdb;
281
+ $clauses['where'] .= $wpdb->prepare( ' AND comment_author_IP = %s', get_query_var( 'wp_review_ip' ) );
282
+ return $clauses;
283
+ }
284
+
285
+ function getPreviousReview( $post_id, $user_id, $ip, $type = 'any' ) {
286
+ if( is_numeric( $post_id ) && $post_id > 0 ){
287
+ $args = array( 'post_id' => $post_id, 'user_id' => 0 );
288
+ set_query_var( 'wp_review_commenttype', $type );
289
+ add_filter( 'pre_get_comments', 'wp_review_add_comment_type_to_query' );
290
+ if ( $user_id ) {
291
+ $args['user_id'] = array( $user_id );
292
+ } else {
293
+ set_query_var( 'wp_review_ip', $ip );
294
+ add_filter( 'comments_clauses', 'wp_review_filter_comment_by_ip' );
295
+ }
296
+
297
+ $comment = get_comments( $args );
298
+ remove_filter( 'pre_get_comments', 'wp_review_add_comment_type_to_query' );
299
+ remove_filter( 'comments_clauses', 'wp_review_filter_comment_by_ip' );
300
+
301
+ if ( ! empty( $comment ) ) {
302
+ return get_comment_meta( $comment[0]->comment_ID, WP_REVIEW_COMMENT_RATING_METAKEY, true );
303
+ }
304
+ }
305
+ return false;
306
+ }
307
+
308
+ /**
309
+ * AJAX User review rating
310
+ * Replaces mts_review_get_review()
311
+ * @return null
312
+ */
313
+ function wp_review_ajax_rate() {
314
+ global $wp_review_rating_types;
315
+ check_ajax_referer( 'wp-review-security', 'nonce' );
316
+ $options = get_option('wp_review_options');
317
+ $post_id = intval($_POST['post_id']);
318
+ $user_id = is_user_logged_in() ? get_current_user_id() : 0;
319
+ $review = round( abs( filter_input( INPUT_POST, 'review' ) ), 2 );
320
+ $type = wp_review_get_post_user_review_type( $post_id );
321
+ $uip = wp_review_get_user_ip();
322
+
323
+ $output = array('status' => '', 'html' => '', 'rating_total' => '', 'rating_count' => '');
324
+
325
+ if ( empty( $type ) ) {
326
+ // No user reviews allowed
327
+ echo wp_json_encode( $output );
328
+ exit;
329
+ }
330
+
331
+ add_action( 'comment_duplicate_trigger', function ( $commentdata ) {
332
+ $post_reviews = mts_get_post_reviews( $commentdata['comment_post_ID'] );
333
+ $output['status'] = 'fail';
334
+ $output['error'] = 'duplicate';
335
+ $output['rating_total'] = $post_reviews['rating'];
336
+ $output['rating_count'] = $post_reviews['count'];
337
+ $output['html'] = wp_review_rating( $post_reviews['rating'], $commentdata['comment_post_ID'], array( 'user_rating' => true ) );
338
+ echo wp_json_encode( $output );
339
+ exit;
340
+ } );
341
+
342
+ // don't allow higher rating than max
343
+ if ($review > $wp_review_rating_types[$type]['max']) {
344
+ $review = $wp_review_rating_types[$type]['max'];
345
+ }
346
+
347
+ if ( $review > 0 &&
348
+ ! hasPreviousReview( $post_id, $user_id, $uip, WP_REVIEW_COMMENT_TYPE_VISITOR ) &&
349
+ (
350
+ ( is_user_logged_in() && ! empty( $options['registered_only'] ) ) ||
351
+ ( is_user_logged_in() && empty( $options['registered_only'] ) ) ||
352
+ ( ! is_user_logged_in() && empty( $options['registered_only'] ) )
353
+ )
354
+ ) {
355
+ if ( $insert = wp_insert_comment( array(
356
+ 'user_id' => $user_id,
357
+ 'comment_type' => WP_REVIEW_COMMENT_TYPE_VISITOR,
358
+ 'comment_post_ID' => $post_id,
359
+ 'comment_parent' => 0,
360
+ 'comment_author_IP' => $uip,
361
+ 'comment_content' => sprintf( __('Visitor Rating: %s', 'wp-review'), sprintf( $wp_review_rating_types[$type]['value_text'], $review ) ),
362
+ 'comment_agent' => isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT']: '',
363
+ 'comment_date' => current_time('mysql'),
364
+ 'comment_date_gmt' => current_time( 'mysql', 1 ),
365
+ 'comment_approved' => 1
366
+ ) ) ) {
367
+ if ( update_comment_meta( $insert, WP_REVIEW_VISITOR_RATING_METAKEY, $review ) ) {
368
+ $post_reviews = mts_get_post_reviews( $post_id, true );
369
+
370
+ // "lock" user review type when the first rating comes in
371
+ // to prevent issues with changing types
372
+ // update_post_meta( $post_id, 'wp_review_user_review_type_locked', 1 );
373
+
374
+ //echo $post_reviews['rating'] . '|' . $post_reviews['count'];
375
+ $output['status'] = 'ok';
376
+ $output['html'] = wp_review_rating( $post_reviews['rating'], $post_id, array( 'user_rating' => true ) );
377
+ $output['rating_total'] = $post_reviews['rating'];
378
+ $output['rating_count'] = $post_reviews['count'];
379
+ echo wp_json_encode( $output );
380
+ exit;
381
+ } else {
382
+ wp_delete_comment( $insert );
383
+ }
384
+ }
385
+ }
386
+ $post_reviews = mts_get_post_reviews( $post_id );
387
+ $output['status'] = 'fail';
388
+ $output['error'] = 'db_error';
389
+ $output['rating_total'] = $post_reviews['rating'];
390
+ $output['rating_count'] = $post_reviews['count'];
391
+ $output['html'] = wp_review_rating( $post_reviews['rating'], $post_id, array( 'user_rating' => true ) );
392
+ echo wp_json_encode( $output );
393
+ exit;
394
+ }
395
+
396
+ /*
397
+ * Get review with Ajax
398
+ */
399
+ function mts_review_get_review() {
400
+ // security
401
+ check_ajax_referer( 'wp-review-security', 'nonce' );
402
 
 
403
  $options = get_option('wp_review_options');
404
+ $post_id = intval($_POST['post_id']);
405
+ $user_id = is_user_logged_in() ? get_current_user_id() : 0;
406
+ $review = round( abs( filter_input( INPUT_POST, 'review' ) ), 2 );
407
+
408
+ $review_text = $review;
409
+
410
+ $uip = wp_review_get_user_ip();
411
+
412
+ add_action( 'comment_duplicate_trigger', function () {
413
+ echo 'MTS_REVIEW_DUP_ERROR';
414
+ exit;
415
+ } );
416
+
417
+ if ( $review > 0 &&
418
+ ! hasPreviousReview( $post_id, $user_id, $uip, WP_REVIEW_COMMENT_TYPE_VISITOR ) &&
419
+ (
420
+ ( is_user_logged_in() && ! empty( $options['registered_only'] ) ) ||
421
+ ( is_user_logged_in() && empty( $options['registered_only'] ) ) ||
422
+ ( ! is_user_logged_in() && empty( $options['registered_only'] ) )
423
+ )
424
+ ) {
425
+ if ( $insert = wp_insert_comment( array(
426
+ 'user_id' => $user_id,
427
+ 'comment_type' => WP_REVIEW_COMMENT_TYPE_VISITOR,
428
+ 'comment_post_ID' => $post_id,
429
+ 'comment_parent' => 0,
430
+ 'comment_author_IP' => $uip,
431
+ 'comment_content' => sprintf(__('Visitor Rating: %s', 'wp-review'), $review_text),
432
+ 'comment_agent' => isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT']: '',
433
+ 'comment_date' => current_time('mysql'),
434
+ 'comment_date_gmt' => current_time( 'mysql', 1 ),
435
+ 'comment_approved' => 1
436
+ ) ) ) {
437
+ if ( update_comment_meta( $insert, WP_REVIEW_VISITOR_RATING_METAKEY, $review ) ) {
438
+ $post_reviews = mts_get_post_reviews( $post_id, true );
439
+
440
+ echo $post_reviews['rating'] . '|' . $post_reviews['count'];
441
+ exit;
442
+ } else {
443
+ wp_delete_comment( $insert );
444
+ }
445
+ }
446
+ }
447
+
448
+ echo 'MTS_REVIEW_DB_ERROR';
449
+ exit;
450
+ }
451
+
452
+
453
+ function wp_review_theme_defaults($new_options, $force_change = false) {
454
+ global $pagenow;
455
+ $opt_name = 'wp_review_options_'.wp_get_theme();
456
+ $options = get_option('wp_review_options');
457
+ if (empty($options)) $options = array();
458
+ $options_updated = get_option( $opt_name );
459
+ // if the theme was just activated OR options weren't updated yet
460
+ if ( empty( $options_updated ) || $options_updated != $new_options || $force_change || ( isset( $_GET['activated'] ) && $pagenow == 'themes.php' )) {
461
+ update_option( 'wp_review_options', array_merge($options, $new_options) );
462
+ update_option( $opt_name, $new_options );
463
+ }
464
+ }
465
 
466
+ /**
467
+ * Exclude review-type comments from being included in the comment query.
468
+ *
469
+ * @param WP_Comment_Query $query
470
+ */
471
+ function wp_review_exclude_review_comments(\WP_Comment_Query $query) {
472
+ if ( ! is_admin() && ( WP_REVIEW_COMMENT_TYPE_VISITOR !== $query->query_vars['type'] && ! in_array( WP_REVIEW_COMMENT_TYPE_VISITOR, (array) $query->query_vars['type__in'] )) ) {
473
+ $query->query_vars['type__not_in'] = array_merge(
474
+ is_array( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array(),
475
+ array( WP_REVIEW_COMMENT_TYPE_VISITOR )
476
+ );
477
+ }
478
+ }
479
+ add_action( 'pre_get_comments', 'wp_review_exclude_review_comments', 15 );
480
+
481
+ /**
482
+ * Add "Reviews" to comments table view.
483
+ *
484
+ * @param array $comment_types
485
+ *
486
+ * @return mixed
487
+ */
488
+ function wp_review_add_to_comment_table_dropdown( $comment_types ) {
489
+ $comment_types[ WP_REVIEW_COMMENT_TYPE_VISITOR ] = __( 'Visitor Reviews', 'wp-review' );
490
+
491
+ return $comment_types;
492
+ }
493
+ add_filter( 'admin_comment_types_dropdown', 'wp_review_add_to_comment_table_dropdown' );
494
+
495
+ /**
496
+ * @param int $post_id
497
+ *
498
+ * @return string
499
+ *
500
+ * 0 - Disabled
501
+ * 2 - Visitor Rating Only
502
+ */
503
+ function wp_review_get_user_rating_setup( $post_id ) {
504
+ /* Retrieve an existing value from the database. */
505
+ $options = get_option( 'wp_review_options' );
506
+ //$default = empty( $options['default_user_review_type'] ) ? WP_REVIEW_REVIEW_DISABLED : $options['default_user_review_type'];
507
+ $default = WP_REVIEW_REVIEW_DISABLED;
508
+ $userReviews = get_post_meta( $post_id, 'wp_review_userReview', true );
509
+ $enabled = empty( $userReviews ) ? $default : $userReviews;
510
+ if ( is_array( $userReviews ) ) {
511
+ $enabled = $userReviews[0];
512
+ }
513
+
514
+ // Compatibility with the old option.
515
+ if ( '1' === $enabled ) {
516
+ $enabled = WP_REVIEW_REVIEW_VISITOR_ONLY;
517
+ }
518
+
519
+ return $enabled;
520
+ }
521
+
522
+ /**
523
+ * Exclude visitor ratings when updating a post's comment count.
524
+ * @param $post_id
525
+ * @param $new
526
+ * @param $old
527
+ *
528
+ * @internal param $comment_id
529
+ * @internal param $comment
530
+ */
531
+ function wp_review_exclude_visitor_review_count( $post_id, $new, $old ) {
532
+ global $wpdb;
533
+ $count = get_comments( array(
534
+ 'type__not_in' => array( WP_REVIEW_COMMENT_TYPE_VISITOR ),
535
+ 'post_id' => $post_id,
536
+ 'count' => true
537
+ ) );
538
+ $wpdb->update( $wpdb->posts, array( 'comment_count' => $count ), array( 'ID' => $post_id ) );
539
+
540
+ // Update user review count.
541
+ mts_get_post_reviews( $post_id, true );
542
+
543
+ clean_post_cache( $post_id );
544
+ }
545
+ add_action( 'wp_update_comment_count', 'wp_review_exclude_visitor_review_count', 10, 3 );
546
+
547
+ /**
548
+ * Get the schema type of a review.
549
+ * @param int $post_id
550
+ *
551
+ * @return mixed|string
552
+ */
553
+ function wp_review_get_review_schema( $post_id ) {
554
+ return 'Thing';
555
+ }
556
+
557
+ /**
558
+ * Get the IP of the current user.
559
+ *
560
+ * @return string
561
+ */
562
+ function wp_review_get_user_ip() {
563
+ if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
564
+ $ip = $_SERVER['HTTP_CLIENT_IP'];
565
+ } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
566
+ $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
567
+ } else {
568
+ $ip = $_SERVER['REMOTE_ADDR'];
569
+ }
570
+
571
+ return $ip;
572
+ }
573
+
574
+ /**
575
+ * Get the HTML for user reviews in review box.
576
+ *
577
+ * @param $post_id
578
+ * @param bool $votable
579
+ * @param bool $force_display
580
+ *
581
+ * @return string
582
+ */
583
+ function wp_review_user_review( $post_id, $votable = true, $force_display = false ) {
584
+ $review = '';
585
+
586
+ if ( $force_display || in_array( wp_review_get_user_rating_setup( $post_id ), array( WP_REVIEW_REVIEW_VISITOR_ONLY ) ) ) {
587
+ $allowedClass = 'allowed-to-rate';
588
+ $hasNotRatedClass = ' has-not-rated-yet';
589
+ $postReviews = mts_get_post_reviews( $post_id );
590
+ $userTotal = $postReviews['rating'];
591
+ $usersReviewsCount = $postReviews['count'];
592
+ $total = get_post_meta( $post_id, 'wp_review_total', true );
593
+ $type = get_post_meta( $post_id, 'wp_review_user_review_type', true );
594
+
595
+ $options = get_option('wp_review_options');
596
+ $custom_colors = get_post_meta( $post_id, 'wp_review_custom_colors', true );
597
+
598
  $colors['color'] = get_post_meta( $post_id, 'wp_review_color', true );
599
+ if( empty($colors['color']) ) $colors['color'] = '#333333';
600
  $colors['type'] = get_post_meta( $post_id, 'wp_review_type', true );
601
  $colors['fontcolor'] = get_post_meta( $post_id, 'wp_review_fontcolor', true );
602
  $colors['bgcolor1'] = get_post_meta( $post_id, 'wp_review_bgcolor1', true );
603
  $colors['bgcolor2'] = get_post_meta( $post_id, 'wp_review_bgcolor2', true );
604
  $colors['bordercolor'] = get_post_meta( $post_id, 'wp_review_bordercolor', true );
605
+ if ( ! $custom_colors && ! empty($options['colors'] ) && is_array($options['colors'] ) ) {
 
 
606
  $colors = array_merge($colors, $options['colors']);
607
  }
608
+ $colors = apply_filters('wp_review_colors', $colors, $post_id);
609
+ $color = $colors['color'];
610
 
611
+ $user_id = '';
612
+ if ( is_user_logged_in() ) {
613
+ $user_id = get_current_user_id();
614
+ }
615
 
 
616
 
617
+ if ( $userTotal == '' ) {
618
+ $userTotal = '0.0';
619
+ }
620
+ $value = $userTotal;
621
 
622
+ if ( ! $votable || hasPreviousReview( $post_id, $user_id, wp_review_get_user_ip(), WP_REVIEW_COMMENT_TYPE_VISITOR ) || ( ! is_user_logged_in() && ! empty( $options['registered_only'] ) ) ) {
623
+ $hasNotRatedClass = '';
624
+ }
625
 
626
+ $class = $allowedClass . $hasNotRatedClass;
 
 
 
627
 
628
+ $template = mts_get_template_path( $type, 'star-output' );
629
+ set_query_var( 'rating', compact( 'value', 'usersReviewsCount', 'user_id', 'class', 'post_id', 'color', 'colors' ) );
630
+ ob_start();
631
+ load_template( $template, false );
632
+ $review = ob_get_contents();
633
+ ob_end_clean();
634
 
 
635
 
 
636
 
637
+ if ( $userTotal !== '0.0' && $total === '' ) {// dont'show if no user ratings and there is review
638
+ $review .= '<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
639
+ <meta itemprop="ratingValue" content="' . $userTotal . '" />
640
+ <meta itemprop="reviewCount" content="' . $usersReviewsCount . '" />
641
+ </div>';
642
  }
643
+ }
644
 
645
+ return $review;
646
+ }
 
647
 
648
+ /**
649
+ * Get available review types/templates.
650
+ *
651
+ * @param string $type
652
+ *
653
+ * @return array
654
+ */
655
+ /*
656
+ function wp_review_get_review_types( $type = '' ) {
657
+ $dirs = array(
658
+ WP_REVIEW_DIR . 'templates/',
659
+ get_stylesheet_directory() . '/wp-review/',
660
+ );
661
+ $types = array();
662
+
663
+ foreach ( $dirs as $dir ) {
664
+ if ( is_dir( $dir ) ) {
665
+ $handle = opendir( $dir );
666
+ while ( $file = readdir( $handle ) ) {
667
+ if ( '..' === $file || '.' === $file ) {
668
+ continue;
669
+ }
670
+ $key = basename( $file, '.php' );
671
+
672
+ if ( ! empty( $type ) && substr( $key, -strlen( $type ) ) !== $type ) {
673
+ continue;
674
+ }
675
+ if ( empty( $type ) and strpos( $key, '-' ) !== false ) {
676
+ continue;
677
+ }
678
 
679
+ $template_data = implode( '', file( $dir . $file ) );
680
+ if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) ) {
681
+ $types[ $key ] = $name[1];
682
+ } else {
683
+ $keys_arr = explode( '-', $key );
684
+ $types[ $key ] = ucfirst( reset( $keys_arr ) );
685
+ }
686
+ }
687
  }
688
+ }
689
+
690
+ return $types;
691
+ }
692
+ */
693
+
694
+ /**
695
+ * Get the path to a template prioritizing theme directory first.
696
+ *
697
+ * @param $type
698
+ * @param string $default
699
+ *
700
+ * @return string
701
+ */
702
+ function mts_get_template_path( $type, $default = 'star' ) {
703
+ $template = get_stylesheet_directory() . '/wp-review/' . $type . '.php';
704
 
705
+ // Template does not exist on theme dir, use plugin dir.
706
+ if ( ! file_exists( $template ) ) {
707
+ $template = WP_REVIEW_DIR . 'rating-types/' . $type . '.php';
708
+ }
709
 
710
+ // Template does not exist, fallback to star.
711
+ if ( ! file_exists( $template ) ) {
712
+ $template = WP_REVIEW_DIR . 'rating-types/' . $default . '.php';
713
  }
714
+
715
+ return $template;
716
  }
717
 
718
+ function wp_review_ajax_migrate_ratings() {
719
+ $start = isset( $_POST['start'] ) ? intval( $_POST['start'] ) : 0;
720
+ $limit = 100;
721
+
722
+ if ( get_option( 'wp_review_has_migrated', false ) ) {
723
+ return;
724
+ }
725
+
726
+ global $wpdb;
727
+
728
+ $current_blog_id = get_current_blog_id();
729
+
730
+ $query = $wpdb->get_results( 'SELECT * from '.$wpdb->base_prefix.'mts_wp_reviews WHERE blog_id = '.$current_blog_id.' LIMIT '.$limit.' OFFSET '.$start );
731
+
732
+ foreach ( $query as $review ) {
733
+
734
+ if ($review->rate == 0)
735
+ continue; // skip 0-star ratings
736
+
737
+ if ( $insert = wp_insert_comment( array(
738
+ 'user_id' => $review->user_id,
739
+ 'comment_type' => WP_REVIEW_COMMENT_TYPE_VISITOR,
740
+ 'comment_post_ID' => $review->post_id,
741
+ 'comment_parent' => 0,
742
+ 'comment_content' => sprintf(__('Visitor Rating: %s', 'wp-review'), sprintf( __( '%s Stars' , 'wp-review' ), $review->rate ) ),
743
+ 'comment_author_IP' => $review->user_ip,
744
+ 'comment_date' => gmdate( 'Y-m-d H:i:s', ( strtotime( $review->date ) + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) ),
745
+ 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', strtotime( $review->date ) ),
746
+ 'comment_approved' => 1
747
+ ) ) ) {
748
+ if ( update_comment_meta( $insert, WP_REVIEW_VISITOR_RATING_METAKEY, $review->rate ) ) {
749
+ // Purge cache.
750
+ mts_get_post_reviews( $review->post_id, true );
751
+ } else {
752
+ wp_delete_comment( $insert );
753
+ }
754
  }
755
+
756
  }
757
+
758
+ $end = $start + count($query);//$wpdb->num_rows;
759
+ //$migrated_rows = get_option( 'wp_review_migrated_rows', 0 );
760
+ update_option( 'wp_review_migrated_rows', $end );
761
+
762
+ $total_rows = $wpdb->get_var( 'SELECT COUNT(*) FROM '.$wpdb->base_prefix.'mts_wp_reviews WHERE blog_id = '.$current_blog_id );
763
+ $migration_finished = 0;
764
+ if ( $total_rows == $end ) {
765
+ update_option( 'wp_review_has_migrated', 1 );
766
+ $migration_finished = 1;
767
+ }
768
+
769
+ echo wp_json_encode( array( 'start' => $start, 'lastrow' => $end, 'rowsleft' => $total_rows - $end, 'finished' => $migration_finished ) );
770
+
771
+
772
+ die();
773
  }
774
 
775
+ /*
776
+ * Custom Rating Types
777
+ *
778
+ */
779
+ $wp_review_rating_types = array();
780
+
781
+ function wp_review_register_rating_type( $rating_type, $args ) {
782
+ global $wp_review_rating_types;
783
+
784
+
785
+ if (empty($args['output_template']) && empty($args['template']))
786
+ return false;
787
+
788
+ // If it has combined 'template'
789
+ // or 'input_template' (for user rating)
790
+ if (!empty($args['template']) || !empty($args['input_template']))
791
+ $args['user_rating'] = true;
792
+ else
793
+ $args['user_rating'] = false;
794
+
795
+ $wp_review_rating_types[$rating_type] = $args;
796
+
797
+ return true;
798
+ }
799
+ add_action( 'init', 'wp_review_register_default_rating_types' );
800
+
801
+ function wp_review_register_default_rating_types() {
802
+ wp_review_register_rating_type( 'star', array(
803
+ 'label' => __('Star', 'wp-review'),
804
+ 'max' => 5,
805
+ 'decimals' => 1,
806
+ 'value_text' => __('%s Stars', 'wp-review'),
807
+ 'value_text_singular' => __('%s Star', 'wp-review'),
808
+ 'input_template' => WP_REVIEW_DIR . 'rating-types/star-input.php',
809
+ 'output_template' => WP_REVIEW_DIR . 'rating-types/star-output.php',
810
+ ) );
811
+
812
+ wp_review_register_rating_type( 'point', array(
813
+ 'label' => __('Point', 'wp-review'),
814
+ 'max' => 10,
815
+ 'decimals' => 0,
816
+ 'value_text' => __('%s/10', 'wp-review'),
817
+ 'value_text_singular' => __('%s/10', 'wp-review'),
818
+ 'input_template' => WP_REVIEW_DIR . 'rating-types/point-input.php',
819
+ 'output_template' => WP_REVIEW_DIR . 'rating-types/point-output.php',
820
+ ) );
821
+
822
+ wp_review_register_rating_type( 'percentage', array(
823
+ 'label' => __('Percentage', 'wp-review'),
824
+ 'max' => 100,
825
+ 'decimals' => 0,
826
+ 'value_text' => __('%s%%', 'wp-review'),
827
+ 'value_text_singular' => __('%s%%', 'wp-review'),
828
+ 'input_template' => WP_REVIEW_DIR . 'rating-types/percentage-input.php',
829
+ 'output_template' => WP_REVIEW_DIR . 'rating-types/percentage-output.php',
830
+ ) );
831
+ }
832
+
833
+ function wp_review_get_post_review_type( $post_id = null ) {
834
+ global $post, $wp_review_rating_types;
835
+
836
+ if ( empty( $post_id ) ) {
837
+ if ( is_a( $post, 'WP_Post') )
838
+ $post_id = $post->ID;
839
+ else
840
+ return '';
841
+ }
842
+
843
+ $type = get_post_meta( $post_id, 'wp_review_type', true );
844
+ if ( empty( $type ) )
845
+ return ''; // not a review
846
+
847
+ $output = '';
848
+ if ( isset( $wp_review_rating_types[$type] ) )
849
+ $output = $type;
850
+ else
851
+ $output = 'star'; // fallback if specific $type is not available anymore
852
+
853
+ return apply_filters( 'wp_review_get_review_type', $output, $post_id );
854
+ }
855
+
856
+ function wp_review_get_post_user_review_type( $post_id = null ) {
857
+ global $post, $wp_review_rating_types;
858
+
859
+ if ( empty( $post_id ) )
860
+ $post_id = $post->ID;
861
+
862
+ $type = wp_review_get_post_review_type( $post_id );
863
+ if ( empty( $type ) )
864
+ return ''; // not a review
865
+
866
+ $userreview_type = get_post_meta( $post_id, 'wp_review_user_review_type', true );
867
+ if ( empty( $userreview_type ) )
868
+ $userreview_type = 'star';
869
+
870
+ $userreviews = in_array( wp_review_get_user_rating_setup( $post_id ), array( WP_REVIEW_REVIEW_VISITOR_ONLY ) );
871
+ if ( ! $userreviews )
872
+ return ''; // user ratings not enabled
873
+
874
+ $output = '';
875
+ if ( isset( $wp_review_rating_types[$userreview_type] ) && $wp_review_rating_types[$userreview_type]['user_rating'] )
876
+ $output = $userreview_type;
877
+ else
878
+ $output = 'star'; // fallback if specific $type is not available
879
+
880
+ return apply_filters( 'wp_review_get_user_review_type', $output, $post_id );
881
+ }
882
+
883
+ /*
884
+ * Custom Box Templates
885
+ *
886
+ */
887
+ function wp_review_get_post_box_template( $post_id ) {
888
+ global $post, $wp_review_rating_types;
889
+
890
+ if ( empty( $post_id ) )
891
+ $post_id = $post->ID;
892
+
893
+ $type = wp_review_get_post_review_type( $post_id );
894
+ if ( empty( $type ) )
895
+ return ''; // not a review
896
+
897
+ $template = get_post_meta( $post_id, 'wp_review_box_template', true );
898
+ if ( empty( $template ) || ! wp_review_locate_box_template( $template ) )
899
+ $template = 'default.php'; // fallback to default.php
900
+
901
+ return apply_filters( 'wp_review_get_box_template', $template, $post_id );
902
+ }
903
+
904
+ function wp_review_locate_box_template( $template_name, $return_full_path = true ) {
905
+ // We look for box templates in:
906
+ // 1. plugins_dir/box-templates
907
+ // 2. theme_dir/wp-review
908
+ // 3. childtheme_dir/wp-review
909
+ // 4... Use filter to add more
910
+ $default_paths = array(
911
+ WP_REVIEW_DIR.'box-templates',
912
+ get_template_directory().'/wp-review',
913
+ get_stylesheet_directory().'/wp-review',
914
+ );
915
+ $template_paths = apply_filters( 'wp_review_box_template_paths', $default_paths );
916
+
917
+
918
+ $paths = array_reverse($template_paths);
919
+ $located = '';
920
+ $path_partial = '';
921
+ foreach ($paths as $path) {
922
+ if (file_exists($full_path = trailingslashit($path).$template_name)) {
923
+ $located = $full_path;
924
+ $path_partial = $path;
925
+ break;
926
  }
 
927
  }
928
+ return ($return_full_path ? $located : $path_partial);
929
  }
930
 
931
  /**
932
+ * Shows rating using output template
933
+ *
934
+ * @param mixed $value rating value
935
+ * @param mixed $post_id optional post ID
936
+ * @return [type] [description]
937
+ */
938
+ function wp_review_rating( $value, $post_id = null, $args = array() ) {
939
+ global $wp_review_rating_types, $post;
940
+
941
+ if ( ! empty( $args['user_rating'] ) ) {
942
+ $type = wp_review_get_post_user_review_type( $post_id );
943
+ } else {
944
+ $type = wp_review_get_post_review_type( $post_id );
945
+ }
946
 
947
+ if ( empty( $type ) )
948
+ return '';
949
 
950
+ if (empty($post_id))
951
+ $post_id = $post->ID;
952
+
953
+ $options = get_option('wp_review_options');
954
+ $custom_colors = get_post_meta( $post_id, 'wp_review_custom_colors', true );
955
+ $colors['color'] = get_post_meta( $post_id, 'wp_review_color', true );
956
+ if( empty($colors['color']) ) $colors['color'] = '#333333';
957
+ $colors['type'] = get_post_meta( $post_id, 'wp_review_type', true );
958
+ $colors['fontcolor'] = get_post_meta( $post_id, 'wp_review_fontcolor', true );
959
+ $colors['bgcolor1'] = get_post_meta( $post_id, 'wp_review_bgcolor1', true );
960
+ $colors['bgcolor2'] = get_post_meta( $post_id, 'wp_review_bgcolor2', true );
961
+ $colors['bordercolor'] = get_post_meta( $post_id, 'wp_review_bordercolor', true );
962
+ if ( ! $custom_colors && ! empty($options['colors'] ) && is_array($options['colors'] ) ) {
963
+ $colors = array_merge($colors, $options['colors']);
964
+ }
965
+ $colors = apply_filters('wp_review_colors', $colors, $post_id);
966
+
967
+ // Override colors if is_admin()
968
+ if (is_admin() && !defined('DOING_AJAX')) {
969
+ $admin_colors = array(
970
+ 'color' => '#444444',
971
+ 'bgcolor1' => '#ffffff',
972
+ );
973
+ $colors = array_merge($colors, $admin_colors);
974
+ }
975
+ $color = $colors['color'];
976
+
977
+ // don't allow higher rating than max
978
+ if ($value > $wp_review_rating_types[$type]['max']) {
979
+ $value = $wp_review_rating_types[$type]['max'];
980
+ }
981
 
982
+ $template = $wp_review_rating_types[$type]['output_template'];
983
+ $comment_rating = false;
984
+ set_query_var( 'rating', compact( 'value', 'post_id', 'type', 'args', 'comment_rating', 'color', 'colors' ) );
985
+ ob_start();
986
+ load_template( $template, false );
987
+ $review = ob_get_contents();
988
+ ob_end_clean();
989
+ return $review;
990
+ }
991
+
992
+ function wp_review_user_rating( $post_id = null, $args = array() ) {
993
+ global $wp_review_rating_types;
994
+ $type = wp_review_get_post_user_review_type( $post_id );
995
+
996
+ if ( empty( $type ) )
997
+ return '';
998
+
999
+ $review = '';
1000
+
1001
+ $postReviews = mts_get_post_reviews( $post_id );
1002
+ $value = $postReviews['rating'];
1003
+ $count = $postReviews['count'];
1004
+ $total = get_post_meta( $post_id, 'wp_review_total', true );
1005
+
1006
+ $user_id = '';
1007
+ if ( is_user_logged_in() ) {
1008
+ $user_id = get_current_user_id();
1009
+ }
1010
+
1011
+ if ( $value == '' ) {
1012
+ $value = '0.0';
1013
  }
1014
+
1015
+ if ( hasPreviousReview( $post_id, $user_id, wp_review_get_user_ip(), WP_REVIEW_COMMENT_TYPE_VISITOR ) || ( ! is_user_logged_in() && ! empty( $options['registered_only'] ) ) ) {
1016
+ return wp_review_rating( $value, $post_id, array( 'user_rating' => true ) ); // return just output template
1017
+ }
1018
+
1019
+ $options = get_option('wp_review_options');
1020
+ $custom_colors = get_post_meta( $post_id, 'wp_review_custom_colors', true );
1021
+ $colors['color'] = get_post_meta( $post_id, 'wp_review_color', true );
1022
+ if( empty($colors['color']) ) $colors['color'] = '#333333';
1023
+ $colors['type'] = get_post_meta( $post_id, 'wp_review_type', true );
1024
+ $colors['fontcolor'] = get_post_meta( $post_id, 'wp_review_fontcolor', true );
1025
+ $colors['bgcolor1'] = get_post_meta( $post_id, 'wp_review_bgcolor1', true );
1026
+ $colors['bgcolor2'] = get_post_meta( $post_id, 'wp_review_bgcolor2', true );
1027
+ $colors['bordercolor'] = get_post_meta( $post_id, 'wp_review_bordercolor', true );
1028
+ if ( ! $custom_colors && ! empty($options['colors'] ) && is_array($options['colors'] ) ) {
1029
+ $colors = array_merge($colors, $options['colors']);
1030
+ }
1031
+ $colors = apply_filters('wp_review_colors', $colors, $post_id);
1032
+ $color = $colors['color'];
1033
+
1034
+ $rating_type_template = $wp_review_rating_types[$type]['input_template'];
1035
+ $comment_rating = false;
1036
+ set_query_var( 'rating', compact( 'value', 'post_id', 'comment_rating', 'args', 'color', 'colors' ) );
1037
+ ob_start();
1038
+ load_template( $rating_type_template, false );
1039
+ $review = '<div class="wp-review-user-rating wp-review-user-rating-'.$type.'">'.ob_get_contents().'</div>';
1040
+ ob_end_clean();
1041
+
1042
+ if ( $value !== '0.0' && $total === '' ) {// dont'show if no user ratings and there is review
1043
+ $review .= '<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
1044
+ <meta itemprop="ratingValue" content="' . $userTotal . '" />
1045
+ <meta itemprop="reviewCount" content="' . $usersReviewsCount . '" />
1046
+ </div>';
1047
+ }
1048
+ return $review;
1049
+ }
1050
+
1051
+ /**
1052
+ * Returns WP Review box html using the box template chosen for the review
1053
+ * Replaces wp_review_get_data()
1054
+ *
1055
+ * @param [type] $post_id [description]
1056
+ * @return [type] [description]
1057
+ */
1058
+ function wp_review_get_review_box( $post_id = null ) {
1059
+ global $post;
1060
+ if (empty($post_id))
1061
+ $post_id = $post->ID;
1062
+ $type = wp_review_get_post_review_type( $post_id );
1063
+ if ( ! $type )
1064
+ return '';
1065
+
1066
+ // Load variables
1067
+ $options = get_option('wp_review_options');
1068
+
1069
+ /* Retrieve the meta box data. */
1070
+ $heading = get_post_meta( $post_id, 'wp_review_heading', true );
1071
+ $desc_title = get_post_meta( $post_id, 'wp_review_desc_title', true );
1072
+ if ( ! $desc_title ) $desc_title = __('Summary', 'wp-review');
1073
+ $desc = get_post_meta( $post_id, 'wp_review_desc', true );
1074
+ $items = get_post_meta( $post_id, 'wp_review_item', true );
1075
+ $type = get_post_meta( $post_id, 'wp_review_type', true );
1076
+ $total = get_post_meta( $post_id, 'wp_review_total', true );
1077
+ $hide_desc = get_post_meta( $post_id, 'wp_review_hide_desc', true );
1078
+ $schema = wp_review_get_review_schema( $post_id );
1079
+ $links = get_post_meta( $post_id, 'wp_review_links', true );
1080
+
1081
+ $custom_author = get_post_meta( $post_id, 'wp_review_custom_author', true );
1082
+ $author_field = get_post_meta( $post_id, 'wp_review_author', true );
1083
+
1084
+ $author = ( !$author_field || empty( $author_field ) || !$custom_author ) ? get_the_author() : $author_field;
1085
+ $add_backlink = isset( $options['add_backlink'] ) && $options['add_backlink'] == '0' ? false : true;
1086
+
1087
+ $colors = array();
1088
+ $colors['custom_colors'] = get_post_meta( $post_id, 'wp_review_custom_colors', true );
1089
+ $colors['custom_location'] = get_post_meta( $post_id, 'wp_review_custom_location', true );
1090
+ $colors['custom_width'] = get_post_meta( $post_id, 'wp_review_custom_width', true );
1091
+
1092
+ $colors['color'] = get_post_meta( $post_id, 'wp_review_color', true );
1093
+ if( empty($colors['color']) ) $colors['color'] = '#333333';
1094
+ $colors['type'] = get_post_meta( $post_id, 'wp_review_type', true );
1095
+ $colors['fontcolor'] = get_post_meta( $post_id, 'wp_review_fontcolor', true );
1096
+ $colors['bgcolor1'] = get_post_meta( $post_id, 'wp_review_bgcolor1', true );
1097
+ $colors['bgcolor2'] = get_post_meta( $post_id, 'wp_review_bgcolor2', true );
1098
+ $colors['bordercolor'] = get_post_meta( $post_id, 'wp_review_bordercolor', true );
1099
+ $colors['total'] = get_post_meta( $post_id, 'wp_review_total', true );
1100
 
1101
+ if ( ! $colors['custom_colors'] && ! empty($options['colors'] ) && is_array($options['colors'] ) ) {
1102
+ $colors = array_merge($colors, $options['colors']);
1103
+ }
1104
+ $colors = apply_filters('wp_review_colors', $colors, $post_id);
1105
+
1106
+ $width = get_post_meta( $post_id, 'wp_review_width', true );
1107
+ if (empty($width)) $width = 100;
1108
+ $align = get_post_meta( $post_id, 'wp_review_align', true );
1109
+ if (empty($align)) $align = 'left';
1110
+
1111
+ if (!$colors['custom_width']) {
1112
+ $width = ! empty($options['width']) ? $options['width'] : 100;
1113
+ $align = ! empty($options['align']) ? $options['align'] : 'left';
1114
+ }
1115
+
1116
+ $post_types = get_post_types( array('public' => true), 'names' );
1117
+ $excluded_post_types = apply_filters('wp_review_excluded_post_types', array('attachment'));
1118
+ $allowed_post_types = array_diff($post_types, $excluded_post_types);
1119
+
1120
+ $user_review = in_array( wp_review_get_user_rating_setup( $post_id ), array( WP_REVIEW_REVIEW_VISITOR_ONLY ) );
1121
+ $user_review_type = '';
1122
+ $user_review_total = '';
1123
+ $user_review_count = 0;
1124
+ $user_has_reviewed = false;
1125
+ if ( $user_review ) {
1126
+ $user_review_type = wp_review_get_post_user_review_type( $post_id );
1127
  }
1128
+ if ( $user_review ) {
1129
+ $postReviews = mts_get_post_reviews( $post_id );
1130
+ $user_review_total = $postReviews['rating'];
1131
+ $user_review_count = $postReviews['count'];
1132
+ $user_id = is_user_logged_in() ? get_current_user_id() : 0;
1133
+ $uip = wp_review_get_user_ip();
1134
+ if ( hasPreviousReview( $post_id, $user_id, $uip, WP_REVIEW_COMMENT_TYPE_VISITOR ) )
1135
+ $user_has_reviewed = true;
1136
+ }
1137
+
1138
+
1139
+
1140
+ $template = wp_review_get_post_box_template( $post_id );
1141
+ $box_template_path = wp_review_locate_box_template( $template );
1142
+ // pass variables to template
1143
+ set_query_var( 'review', compact(
1144
+ 'post_id',
1145
+ 'type',
1146
+ 'heading',
1147
+ 'author',
1148
+ 'items',
1149
+ 'hide_desc',
1150
+ 'desc',
1151
+ 'desc_title',
1152
+ 'total',
1153
+ 'colors',
1154
+ 'width',
1155
+ 'align',
1156
+ 'schema',
1157
+ 'links',
1158
+ 'user_review',
1159
+ 'user_review_type',
1160
+ 'user_review_total',
1161
+ 'user_review_count',
1162
+ 'user_has_reviewed',
1163
+ 'add_backlink'
1164
+ ) );
1165
+ ob_start();
1166
+ load_template( $box_template_path, false );
1167
+ $review = ob_get_contents();
1168
+ ob_end_clean();
1169
+ $review = apply_filters('wp_review_get_data', $review, $post_id, $type, $total, $items);
1170
+ return $review;// . wp_review_color_output( $post_id ); // add color CSS to output
1171
  }
1172
 
1173
+
1174
+ function wp_review_get_box_template_info( $template = false ) {
1175
+ $default_template_headers = array(
1176
+ 'Name' => 'WP Review',
1177
+ 'TemplateURI' => 'Template URI',
1178
+ 'Version' => 'Version',
1179
+ 'Description' => 'Description',
1180
+ 'Author' => 'Author',
1181
+ 'AuthorURI' => 'Author URI'
1182
+ );
1183
+
1184
+ if ( ! $template )
1185
+ $template = wp_review_get_post_box_template();
1186
+
1187
+ $path = wp_review_locate_box_template( $template );
1188
+
1189
+ if ( $path )
1190
+ return get_file_data( $path, $default_template_headers );
1191
+ else
1192
+ return array( $default_template_headers );
1193
+ }
1194
+
1195
+ /**
1196
+ * Returns absolute path to template directory.
1197
+ * @return string path
1198
+ */
1199
+ function wp_review_get_box_template_directory() {
1200
+ $template = wp_review_get_post_box_template();
1201
+ if ( ! $template )
1202
+ return '';
1203
+
1204
+ $current_template_directory = wp_review_locate_box_template( $template );
1205
+
1206
+ return dirname($current_template_directory);
1207
  }
1208
+
1209
+ /**
1210
+ * Returns template directory URI. To be used in template file.
1211
+ * @return string path
1212
+ */
1213
+ function wp_review_get_box_template_directory_uri() {
1214
+ // let's hope this will work in most cases
1215
+ return get_bloginfo( 'url' ).'/'.str_replace(ABSPATH, '', wp_review_get_box_template_directory());
1216
  }
1217
 
1218
+
1219
+ function wp_review_get_box_templates_list() {
1220
+
1221
+ $default_paths = array(
1222
+ WP_REVIEW_DIR.'box-templates',
1223
+ get_template_directory().'/wp-review',
1224
+ get_stylesheet_directory().'/wp-review',
1225
+ );
1226
+ $paths = apply_filters( 'wp_review_box_template_paths', $default_paths );
1227
+
1228
+ $templates = array();
1229
+
1230
+ foreach ($paths as $path) {
1231
+ $path = trailingslashit( $path );
1232
+ // Look for files containing our header 'Launcher template'
1233
+ $files = (array) wp_review_scandir( $path, 'php', 2 );
1234
+ foreach ( $files as $file => $full_path ) {//echo ' <br> '.$file.' - '.$full_path;
1235
+ if ( ! $full_path || ! preg_match( '|WP Review:(.*)$|mi', file_get_contents( $full_path ), $header ) )
1236
+ continue;
1237
+
1238
+ $templates[ $file ] = wp_review_get_box_template_info( $file );
1239
+ $templates[ $file ]['path'] = $path;
1240
+ }
1241
+ }
1242
+ return $templates;
1243
+ }
1244
+
1245
+ function wp_review_get_rating_types() {
1246
+ global $wp_review_rating_types;
1247
+ return $wp_review_rating_types;
1248
+ }
1249
+
1250
+ function wp_review_scandir( $path, $extensions = null, $depth = 0, $relative_path = '' ) {
1251
+ if ( ! is_dir( $path ) )
1252
+ return false;
1253
+ if ( $extensions ) {
1254
+ $extensions = (array) $extensions;
1255
+ $_extensions = implode( '|', $extensions );
1256
+ }
1257
+ $relative_path = trailingslashit( $relative_path );
1258
+ if ( '/' == $relative_path )
1259
+ $relative_path = '';
1260
+ $results = scandir( $path );
1261
+ $files = array();
1262
+ foreach ( $results as $result ) {
1263
+ if ( '.' == $result[0] )
1264
+ continue;
1265
+ if ( is_dir( $path . '/' . $result ) ) {
1266
+ if ( ! $depth || 'CVS' == $result )
1267
+ continue;
1268
+ $found = wp_review_scandir( $path . '/' . $result, $extensions, $depth - 1 , $relative_path . $result );
1269
+ $files = array_merge_recursive( $files, $found );
1270
+ } elseif ( ! $extensions || preg_match( '~\.(' . $_extensions . ')$~', $result ) ) {
1271
+ $files[ $relative_path . $result ] = $path . '/' . $result;
1272
+ }
1273
  }
1274
+ return $files;
1275
+ }
1276
+
1277
+
1278
+ add_action( 'init', 'wp_review_add_admin_columns' );
1279
+ function wp_review_add_admin_columns() {
1280
+ $post_types = get_post_types( array('public' => true), 'names' );
1281
+ $excluded_post_types = apply_filters('wp_review_excluded_post_types', array('attachment'));
1282
+ $allowed_post_types = array_diff($post_types, $excluded_post_types);
1283
+ foreach ($allowed_post_types as $key => $value) {
1284
+ // Add post list table column
1285
+ add_filter('manage_'.$value.'_posts_columns', 'wp_review_post_list_column');
1286
+ // Post list table column content
1287
+ add_action('manage_'.$value.'_posts_custom_column', 'wp_review_post_list_column_content', 10, 2);
1288
+ }
1289
+ }
1290
+ function wp_review_post_list_column($defaults) {
1291
+ $defaults['wp_review_rating'] = __('Rating', 'wp-review');
1292
+ return $defaults;
1293
+ }
1294
+ function wp_review_post_list_column_content($column_name, $post_ID) {
1295
+ if ($column_name == 'wp_review_rating') {
1296
+ $total = get_post_meta( $post_ID, 'wp_review_total', true );
1297
+ if ( $total )
1298
+ echo wp_review_rating($total, $post_ID);
1299
+ else
1300
+ echo '<span class="no-rating">'.__( 'No Rating', 'wp-review' ).'</span>';
1301
+ }
1302
+ }
1303
+
1304
+ function wp_review_get_backlink() {
1305
+ $backlink_text = '<span class="wp-review-plugin-backlink">'.sprintf(__('Powered by %s', 'wp-review'), '<a href="https://mythemeshop.com/plugins/wp-review-pro/?utm_source=WP+Review&utm_medium=Link+CPC&utm_content=WP+Review+Pro+LP&utm_campaign=WordPressOrg" target="_blank">'.__('WP Review', 'wp-review').'</a>').'</span>';
1306
+ return $backlink_text;
1307
+ }
1308
+
1309
+ // Notice about migrating ratings
1310
+ add_action( 'admin_notices', 'wp_review_migrate_notice' );
1311
+ add_action('admin_init', 'wp_review_migrate_notice_ignore');
1312
+
1313
+ function wp_review_migrate_notice_ignore() {
1314
+ global $current_user;
1315
+ $user_id = $current_user->ID;
1316
+ /* If user clicks to ignore the notice, add that to their user meta */
1317
+ if ( isset($_GET['wp_review_migrate_notice_ignore']) && '1' == $_GET['wp_review_migrate_notice_ignore'] ) {
1318
+ add_user_meta($user_id, 'wp_review_migrate_notice_ignore', 'true', true);
1319
+ }
1320
+ }
1321
+ function wp_review_migrate_notice() {
1322
+ // Migrate
1323
+ global $wpdb, $current_user;
1324
+ $user_id = $current_user->ID;
1325
+ if ( get_user_meta($user_id, 'wp_review_migrate_notice_ignore') )
1326
+ return;
1327
 
1328
+ $has_migrated = get_option( 'wp_review_has_migrated', false );
1329
+ if ($has_migrated)
1330
+ return;
1331
+
1332
+ $current_blog_id = get_current_blog_id();
1333
+ $total_rows = 0;
1334
+ $rows_left = 0;
1335
+ $migrated_rows = get_option( 'wp_review_migrated_rows', 0 );
1336
+ if ( ! $has_migrated && $wpdb->get_var("SHOW TABLES LIKE '{$wpdb->base_prefix}mts_wp_reviews'") == "{$wpdb->base_prefix}mts_wp_reviews") {
1337
+ // Table exists and not migrated (fully) yet
1338
+ $total_rows = $wpdb->get_var( 'SELECT COUNT(*) FROM '.$wpdb->base_prefix.'mts_wp_reviews WHERE blog_id = '.$current_blog_id );
1339
+ $rows_left = $total_rows - $migrated_rows;
1340
+ }
1341
+
1342
+ if (!$rows_left)
1343
+ return;
1344
+ ?>
1345
+ <div class="updated notice-info wp-review-notice">
1346
+ <p><?php printf(__( 'Thank you for updating WP Review. Your existing user ratings will show up after importing them in %s.', 'wp-review' ), '<a href="'.admin_url( 'options-general.php?page=wp-review%2Fadmin%2Foptions.php#migrate' ).'">'.__('Settings &gt; WP Review &gt; Migrate Ratings', 'wp-review').'</a>'); ?></p><a class="notice-dismiss" href="<?php echo esc_url(add_query_arg('wp_review_migrate_notice_ignore', '1')); ?>"></a>
1347
+ </div>
1348
+ <?php
1349
  }
1350
 
1351
  /* Display a notice*/
1372
  if ( isset($_GET['wp_review_admin_notice_ignore']) && '0' == $_GET['wp_review_admin_notice_ignore'] ) {
1373
  add_user_meta($user_id, 'wp_review_ignore_notice', 'true', true);
1374
  }
1375
+ }
 
 
includes/widget.php CHANGED
@@ -15,20 +15,18 @@ class wp_review_tab_widget extends WP_Widget {
15
  parent::__construct('wp_review_tab_widget', __('WP Review Widget', 'wp-review'), $widget_ops, $control_ops);
16
  }
17
  function wp_review_tab_admin_scripts($hook) {
18
- wp_register_script('wp_review_tab_widget_admin', trailingslashit( WP_REVIEW_ASSETS ).'js/wp-review-tab-widget-admin.js', array('jquery'), WP_REVIEW_PLUGIN_VERSION);
19
  wp_enqueue_script('wp_review_tab_widget_admin');
20
  }
21
  function wp_review_tab_register_scripts() {
22
  // JS
23
- wp_enqueue_script('jquery');
24
- wp_register_script('wp_review_tab_widget', trailingslashit( WP_REVIEW_ASSETS ).'js/wp-review-tab-widget.js', array('jquery'), WP_REVIEW_PLUGIN_VERSION);
25
  wp_localize_script( 'wp_review_tab_widget', 'wp_review_tab',
26
  array( 'ajax_url' => admin_url( 'admin-ajax.php' ))
27
- );
28
  // CSS
29
- wp_register_style('wp_review_tab_widget', trailingslashit( WP_REVIEW_ASSETS ).'css/wp-review-tab-widget.css', array(), WP_REVIEW_PLUGIN_VERSION);
30
- wp_register_style( 'wp_review-style', trailingslashit( WP_REVIEW_ASSETS ) . 'css/wp-review.css', array(), WP_REVIEW_PLUGIN_VERSION, 'all' );
31
- wp_register_script( 'wp_review-js', trailingslashit( WP_REVIEW_ASSETS ) . 'js/main.js', array('jquery'), WP_REVIEW_PLUGIN_VERSION, true );
32
  }
33
 
34
  function form( $instance ) {
@@ -49,6 +47,7 @@ class wp_review_tab_widget extends WP_Widget {
49
  extract($instance);
50
  ?>
51
  <div class="wp_review_tab_options_form">
 
52
  <p>
53
  <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:','mythemeshop' ); ?></label>
54
  <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
@@ -101,14 +100,16 @@ class wp_review_tab_widget extends WP_Widget {
101
  <input id="<?php echo $this->get_field_id('post_num'); ?>" name="<?php echo $this->get_field_name('post_num'); ?>" type="number" min="1" step="1" value="<?php echo $post_num; ?>" />
102
  </label>
103
  </p>
104
-
105
  <p>
106
  <label for="<?php echo $this->get_field_id('title_length'); ?>"><?php _e('Title length (words):', 'mts_wpt'); ?>
107
  <br />
 
 
108
  <input id="<?php echo $this->get_field_id('title_length'); ?>" name="<?php echo $this->get_field_name('title_length'); ?>" type="number" min="1" step="1" value="<?php echo $title_length; ?>" />
109
  </label>
110
  </p>
111
-
112
  <p class="wp_review_tab_thumbnail_size">
113
  <label for="<?php echo $this->get_field_id('thumb_size'); ?>"><?php _e('Thumbnail size:', 'wp-review'); ?></label>
114
  <select id="<?php echo $this->get_field_id('thumb_size'); ?>" name="<?php echo $this->get_field_name('thumb_size'); ?>" style="margin-left: 12px;">
@@ -185,28 +186,32 @@ class wp_review_tab_widget extends WP_Widget {
185
  }
186
 
187
  function update( $new_instance, $old_instance ) {
188
- $instance = $old_instance;
189
  $instance['title'] = strip_tags( $new_instance['title'] );
190
- $instance['tabs'] = $new_instance['tabs'];
191
  $instance['tab_order'] = $new_instance['tab_order'];
192
  $instance['tab_titles'] = wp_kses_post($new_instance['tab_titles']);
193
- $instance['review_type'] = $new_instance['review_type'];
194
- $instance['allow_pagination'] = $new_instance['allow_pagination'];
195
  $instance['post_num'] = $new_instance['post_num'];
196
- $instance['title_length'] = $new_instance['title_length'];
197
  $instance['thumb_size'] = $new_instance['thumb_size'];
198
  $instance['show_date'] = $new_instance['show_date'];
199
- $instance['custom_reviews'] = $new_instance['custom_reviews'];
200
  return $instance;
201
  }
202
  function widget( $args, $instance ) {
203
- extract($args, EXTR_SKIP);
204
- extract($instance, EXTR_SKIP);
205
  $title = apply_filters( 'widget_title', $title );
206
- wp_enqueue_script('wp_review-js');
207
- wp_enqueue_style('wp_review-style');
208
- wp_enqueue_script('wp_review_tab_widget');
209
- wp_enqueue_style('wp_review_tab_widget');
 
 
 
 
210
  if (empty($tabs)) $tabs = array('recent' => 1, 'toprated' => 1);
211
  $tabs_count = count($tabs);
212
  if ($tabs_count <= 1) {
@@ -225,9 +230,8 @@ class wp_review_tab_widget extends WP_Widget {
225
  array_multisort($tab_order, $available_tabs);
226
 
227
  ?>
228
- <?php echo $before_widget;
229
- if ( ! empty( $title ) ) echo $before_title . $title . $after_title; ?>
230
-
231
  <div class="wp_review_tab_widget_content" id="<?php echo $widget_id; ?>_content">
232
  <ul class="wp-review-tabs <?php echo "has-$tabs_count-"; ?>tabs">
233
  <?php foreach ($available_tabs as $tab => $label) : ?>
@@ -270,7 +274,7 @@ class wp_review_tab_widget extends WP_Widget {
270
  ?>
271
  <script type="text/javascript">
272
  jQuery(function($) {
273
- $('#<?php echo $widget_id; ?>_content').data('args', <?php echo json_encode($instance); ?>);
274
  });
275
  </script>
276
  <?php echo $after_widget; ?>
@@ -278,26 +282,24 @@ class wp_review_tab_widget extends WP_Widget {
278
  }
279
 
280
  function get_most_voted($limit = 20){
281
- global $wpdb;
282
- $limit = intval($limit);
283
- $table_name = $wpdb->prefix . MTS_WP_REVIEW_DB_TABLE;
284
- if (function_exists('is_multisite') && is_multisite()) {$table_name = $wpdb->base_prefix . MTS_WP_REVIEW_DB_TABLE;}
285
-
286
- global $blog_id;
287
-
288
- $ids = array();
289
- $reviews = $wpdb->get_results("
290
- SELECT post_id, COUNT(*) AS magnitude
291
- FROM $table_name
292
- WHERE blog_id = $blog_id
293
- GROUP BY post_id
294
- ORDER BY magnitude DESC
295
- LIMIT $limit
296
- ");
297
- foreach ($reviews as $review) {
298
- $ids[] = $review->post_id;
299
- }
300
- return $ids;
301
  }
302
 
303
  function ajax_wp_review_tab_widget_content() {
@@ -333,9 +335,10 @@ class wp_review_tab_widget extends WP_Widget {
333
  if (in_array($args['review_type'], array('star', 'point', 'percentage'))) {
334
  $review_type = $args['review_type'];
335
  }
336
-
337
  $title_length = ! empty($args['title_length']) ? $args['title_length'] : apply_filters( 'wpt_title_length_default', '15' );
338
 
 
339
  switch ($tab) {
340
  case "toprated":
341
  $custom_query = array(
@@ -452,7 +455,7 @@ class wp_review_tab_widget extends WP_Widget {
452
  </a>
453
  <div class="title-right">
454
  <div class="entry-title"><a title="<?php the_title(); ?>" href="<?php the_permalink() ?>"><?php echo $this->post_title( $title_length ); ?></div></a>
455
- <?php wp_review_show_total(true, 'review-total-only '.$thumb_size.'-thumb'); ?>
456
  <?php if ( $show_date ) : ?>
457
  <div class="wp-review-tab-postmeta">
458
  <?php the_time('M j, Y'); ?>
@@ -503,5 +506,10 @@ class wp_review_tab_widget extends WP_Widget {
503
  }
504
  }
505
  }
506
- add_action( 'widgets_init', create_function( '', 'register_widget( "wp_review_tab_widget" );' ) );
 
 
 
 
 
507
  ?>
15
  parent::__construct('wp_review_tab_widget', __('WP Review Widget', 'wp-review'), $widget_ops, $control_ops);
16
  }
17
  function wp_review_tab_admin_scripts($hook) {
18
+ wp_register_script('wp_review_tab_widget_admin', trailingslashit( WP_REVIEW_ASSETS ).'js/wp-review-tab-widget-admin.js', array('jquery'));
19
  wp_enqueue_script('wp_review_tab_widget_admin');
20
  }
21
  function wp_review_tab_register_scripts() {
22
  // JS
23
+ //wp_enqueue_script('jquery');
24
+ wp_register_script( 'wp_review_tab_widget', trailingslashit( WP_REVIEW_ASSETS ).'js/wp-review-tab-widget.js', array('jquery'));
25
  wp_localize_script( 'wp_review_tab_widget', 'wp_review_tab',
26
  array( 'ajax_url' => admin_url( 'admin-ajax.php' ))
27
+ );
28
  // CSS
29
+ wp_register_style('wp_review_tab_widget', trailingslashit( WP_REVIEW_ASSETS ).'css/wp-review-tab-widget.css', true);
 
 
30
  }
31
 
32
  function form( $instance ) {
47
  extract($instance);
48
  ?>
49
  <div class="wp_review_tab_options_form">
50
+
51
  <p>
52
  <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:','mythemeshop' ); ?></label>
53
  <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
100
  <input id="<?php echo $this->get_field_id('post_num'); ?>" name="<?php echo $this->get_field_name('post_num'); ?>" type="number" min="1" step="1" value="<?php echo $post_num; ?>" />
101
  </label>
102
  </p>
103
+
104
  <p>
105
  <label for="<?php echo $this->get_field_id('title_length'); ?>"><?php _e('Title length (words):', 'mts_wpt'); ?>
106
  <br />
107
+ <!-- dummy input so that WP doesn't pick up title_length as title -->
108
+ <input id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="" style="display: none;" />
109
  <input id="<?php echo $this->get_field_id('title_length'); ?>" name="<?php echo $this->get_field_name('title_length'); ?>" type="number" min="1" step="1" value="<?php echo $title_length; ?>" />
110
  </label>
111
  </p>
112
+
113
  <p class="wp_review_tab_thumbnail_size">
114
  <label for="<?php echo $this->get_field_id('thumb_size'); ?>"><?php _e('Thumbnail size:', 'wp-review'); ?></label>
115
  <select id="<?php echo $this->get_field_id('thumb_size'); ?>" name="<?php echo $this->get_field_name('thumb_size'); ?>" style="margin-left: 12px;">
186
  }
187
 
188
  function update( $new_instance, $old_instance ) {
189
+ $instance = $old_instance;
190
  $instance['title'] = strip_tags( $new_instance['title'] );
191
+ $instance['tabs'] = $new_instance['tabs'];
192
  $instance['tab_order'] = $new_instance['tab_order'];
193
  $instance['tab_titles'] = wp_kses_post($new_instance['tab_titles']);
194
+ $instance['review_type'] = $new_instance['review_type'];
195
+ $instance['allow_pagination'] = $new_instance['allow_pagination'];
196
  $instance['post_num'] = $new_instance['post_num'];
197
+ $instance['title_length'] = $new_instance['title_length'];
198
  $instance['thumb_size'] = $new_instance['thumb_size'];
199
  $instance['show_date'] = $new_instance['show_date'];
200
+ $instance['custom_reviews'] = $new_instance['custom_reviews'];
201
  return $instance;
202
  }
203
  function widget( $args, $instance ) {
204
+ extract($args, EXTR_SKIP);
205
+ extract($instance, EXTR_SKIP);
206
  $title = apply_filters( 'widget_title', $title );
207
+ wp_enqueue_script( 'wp_review_tab_widget' );
208
+ wp_enqueue_script( 'wp_review-js' );
209
+ wp_enqueue_style( 'wp_review-style' );
210
+ wp_enqueue_script( 'wp-review-circle-output', trailingslashit( WP_REVIEW_URI ) . 'rating-types/circle-output.js', array( 'jquery' ) );
211
+ wp_enqueue_style( 'wp_review_tab_widget' );
212
+ wp_localize_script( 'wp_review-js', 'wpreview', array(
213
+ 'ajaxurl' => admin_url('admin-ajax.php')
214
+ ) );
215
  if (empty($tabs)) $tabs = array('recent' => 1, 'toprated' => 1);
216
  $tabs_count = count($tabs);
217
  if ($tabs_count <= 1) {
230
  array_multisort($tab_order, $available_tabs);
231
 
232
  ?>
233
+ <?php echo $before_widget;
234
+ if ( ! empty( $title ) ) echo $before_title . $title . $after_title; ?>
 
235
  <div class="wp_review_tab_widget_content" id="<?php echo $widget_id; ?>_content">
236
  <ul class="wp-review-tabs <?php echo "has-$tabs_count-"; ?>tabs">
237
  <?php foreach ($available_tabs as $tab => $label) : ?>
274
  ?>
275
  <script type="text/javascript">
276
  jQuery(function($) {
277
+ $('#<?php echo $widget_id; ?>_content').data('args', <?php echo wp_json_encode($instance); ?>);
278
  });
279
  </script>
280
  <?php echo $after_widget; ?>
282
  }
283
 
284
  function get_most_voted($limit = 20){
285
+ $comments = get_comments( array(
286
+ 'type__in' => array( WP_REVIEW_COMMENT_TYPE_VISITOR ),
287
+
288
+ ) );
289
+
290
+ $args = array(
291
+ 'orderby' => 'meta_value_num',
292
+ 'meta_key' => 'wp_review_review_count',
293
+ 'fields' => 'ids',
294
+ 'posts_per_page' => $limit,
295
+ );
296
+
297
+ $posts = new WP_Query( $args );
298
+ if ( $posts->have_posts() ) {
299
+ return $posts->posts;
300
+ }
301
+
302
+ return array();
 
 
303
  }
304
 
305
  function ajax_wp_review_tab_widget_content() {
335
  if (in_array($args['review_type'], array('star', 'point', 'percentage'))) {
336
  $review_type = $args['review_type'];
337
  }
338
+
339
  $title_length = ! empty($args['title_length']) ? $args['title_length'] : apply_filters( 'wpt_title_length_default', '15' );
340
 
341
+
342
  switch ($tab) {
343
  case "toprated":
344
  $custom_query = array(
455
  </a>
456
  <div class="title-right">
457
  <div class="entry-title"><a title="<?php the_title(); ?>" href="<?php the_permalink() ?>"><?php echo $this->post_title( $title_length ); ?></div></a>
458
+ <?php wp_review_show_total(true, 'review-total-only '.$thumb_size.'-thumb', null, array('in_widget' => true)); ?>
459
  <?php if ( $show_date ) : ?>
460
  <div class="wp-review-tab-postmeta">
461
  <?php the_time('M j, Y'); ?>
506
  }
507
  }
508
  }
509
+
510
+ function wpreview_register_widget() {
511
+ register_widget( "wp_review_tab_widget" );
512
+ }
513
+ add_action( 'widgets_init', 'wpreview_register_widget' );
514
+
515
  ?>
languages/default.mo CHANGED
Binary file
languages/default.po CHANGED
@@ -1,9 +1,9 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: WP Review Plugin\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2014-10-20 00:21+0530\n"
6
- "PO-Revision-Date: 2014-10-20 00:21+0530\n"
7
  "Last-Translator: MyThemeShop <support-team@mythemeshop.com>\n"
8
  "Language-Team: MyThemeShop\n"
9
  "Language: en_US\n"
@@ -13,30 +13,10 @@ msgstr ""
13
  "X-Poedit-KeywordsList: __;_e\n"
14
  "X-Poedit-Basepath: .\n"
15
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
16
- "X-Generator: Poedit 1.6.2\n"
17
  "X-Poedit-SearchPath-0: ..\n"
18
 
19
- #: ../filter-list.php:34
20
- msgid "Enable Reviews"
21
- msgstr ""
22
-
23
- #: ../filter-list.php:41
24
- msgid "Audio"
25
- msgstr ""
26
-
27
- #: ../filter-list.php:41
28
- msgid "Visual"
29
- msgstr ""
30
-
31
- #: ../filter-list.php:41
32
- msgid "UX"
33
- msgstr ""
34
-
35
- #: ../filter-list.php:41
36
- msgid "Price"
37
- msgstr ""
38
-
39
- #: ../admin/metaboxes.php:30
40
  msgid "Review"
41
  msgstr ""
42
 
@@ -44,8 +24,8 @@ msgstr ""
44
  msgid "Review Item"
45
  msgstr ""
46
 
47
- #: ../admin/metaboxes.php:48 ../admin/metaboxes.php:293
48
- msgid "Review Heading"
49
  msgstr ""
50
 
51
  #: ../admin/metaboxes.php:57
@@ -56,178 +36,572 @@ msgstr ""
56
  msgid "User Reviews"
57
  msgstr ""
58
 
59
- #: ../admin/metaboxes.php:90 ../admin/options.php:31 ../includes/widget.php:79
60
- msgid "Star"
61
- msgstr ""
62
-
63
- #: ../admin/metaboxes.php:90 ../admin/options.php:31 ../includes/widget.php:80
64
- msgid "Point"
65
  msgstr ""
66
 
67
- #: ../admin/metaboxes.php:90 ../admin/options.php:31 ../includes/widget.php:81
68
- msgid "Percentage"
69
  msgstr ""
70
 
71
- #: ../admin/metaboxes.php:94
72
- msgid "Review Type"
73
  msgstr ""
74
 
75
- #: ../admin/metaboxes.php:96
76
- msgid "No Review"
77
  msgstr ""
78
 
79
- #: ../admin/metaboxes.php:170
80
  msgid "Feature Name"
81
  msgstr ""
82
 
83
- #: ../admin/metaboxes.php:171
84
  msgid "Star (1-5)"
85
  msgstr ""
86
 
87
- #: ../admin/metaboxes.php:188 ../admin/metaboxes.php:198
88
- #: ../admin/metaboxes.php:207 ../admin/options.php:205
89
- #: ../admin/options.php:213
 
 
 
90
  msgid "Delete"
91
  msgstr ""
92
 
93
- #: ../admin/metaboxes.php:216
94
  msgid "Add another"
95
  msgstr ""
96
 
97
- #: ../admin/metaboxes.php:220
98
  msgid "Total"
99
  msgstr ""
100
 
101
- #: ../admin/metaboxes.php:225
102
  msgid "Custom Location"
103
  msgstr ""
104
 
105
- #: ../admin/metaboxes.php:231 ../admin/options.php:131
106
  msgid "Review Location"
107
  msgstr ""
108
 
109
- #: ../admin/metaboxes.php:233 ../admin/options.php:133
110
  msgid "After Content"
111
  msgstr ""
112
 
113
- #: ../admin/metaboxes.php:234 ../admin/options.php:134
114
  msgid "Before Content"
115
  msgstr ""
116
 
117
- #: ../admin/metaboxes.php:235 ../admin/options.php:135
118
  msgid "Custom (use shortcode)"
119
  msgstr ""
120
 
121
- #: ../admin/metaboxes.php:241
122
  msgid "Copy &amp; paste this shortcode in the content."
123
  msgstr ""
124
 
125
- #: ../admin/metaboxes.php:245
126
  msgid "Custom Colors"
127
  msgstr ""
128
 
129
- #: ../admin/metaboxes.php:252 ../admin/options.php:149
130
  msgid "Review Color"
131
  msgstr ""
132
 
133
- #: ../admin/metaboxes.php:257 ../admin/options.php:154
134
  msgid "Font Color"
135
  msgstr ""
136
 
137
- #: ../admin/metaboxes.php:262 ../admin/options.php:159
138
  msgid "Heading Background Color"
139
  msgstr ""
140
 
141
- #: ../admin/metaboxes.php:267 ../admin/options.php:164
142
  msgid "Background Color"
143
  msgstr ""
144
 
145
- #: ../admin/metaboxes.php:272 ../admin/options.php:169
146
  msgid "Border Color"
147
  msgstr ""
148
 
149
- #: ../admin/metaboxes.php:308 ../includes/functions.php:49
150
- msgid "Summary"
 
 
 
 
 
 
 
 
 
 
 
 
151
  msgstr ""
152
 
153
  #: ../admin/metaboxes.php:331
 
 
 
 
 
 
 
 
 
 
 
 
154
  msgid "Hide Description &amp; Total Rating"
155
  msgstr ""
156
 
157
- #: ../admin/metaboxes.php:349
 
 
 
 
 
 
 
 
158
  msgid "Disabled"
159
  msgstr ""
160
 
161
- #: ../admin/metaboxes.php:353
162
- msgid "Enabled"
163
  msgstr ""
164
 
165
- #: ../admin/options.php:64
166
- msgid "WP Review Settings"
167
  msgstr ""
168
 
169
- #: ../admin/options.php:118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  msgid ""
171
  "There is a filter set for the review location that may modify the options "
172
  "below."
173
  msgstr ""
174
 
175
- #: ../admin/options.php:123
176
  msgid "The current theme provides default settings for the plugin."
177
  msgstr ""
178
 
179
- #: ../admin/options.php:125
180
  msgid "Set to theme defaults"
181
  msgstr ""
182
 
183
- #: ../admin/options.php:142
184
- msgid "Copy &amp; paste this shortcode in the post content."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  msgstr ""
186
 
187
- #: ../admin/options.php:145
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  msgid ""
189
  "There is a filter set for the review colors that may modify the options "
190
  "below."
191
  msgstr ""
192
 
193
- #: ../admin/options.php:181
194
- msgid "Default features are set by a filter function. Remove it to change."
 
 
 
 
195
  msgstr ""
196
 
197
- #: ../admin/options.php:181
198
- msgid "Default features"
199
  msgstr ""
200
 
201
- #: ../admin/options.php:222
202
  msgid "Add default feature"
203
  msgstr ""
204
 
205
- #: ../admin/options.php:229
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
  msgid "Save Changes"
207
  msgstr ""
208
 
209
- #: ../admin/options.php:249
210
  msgid "Settings"
211
  msgstr ""
212
 
213
- #: ../includes/functions.php:237
214
- msgid "Click on the stars to rate!"
215
  msgstr ""
216
 
217
- #: ../includes/functions.php:257
218
- msgid "User Rating"
 
 
 
 
219
  msgstr ""
220
 
221
- #: ../includes/functions.php:258
222
- msgid "votes"
223
  msgstr ""
224
 
225
- #: ../includes/functions.php:265
226
- msgid "Sending"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
  msgstr ""
228
 
229
- #: ../includes/functions.php:382
230
- msgid "10"
231
  msgstr ""
232
 
233
  #: ../includes/widget.php:13
@@ -238,86 +612,105 @@ msgstr ""
238
  msgid "WP Review Widget"
239
  msgstr ""
240
 
241
- #: ../includes/widget.php:38 ../includes/widget.php:56
242
- #: ../includes/widget.php:140 ../includes/widget.php:160
243
  msgid "Top Rated"
244
  msgstr ""
245
 
246
- #: ../includes/widget.php:38 ../includes/widget.php:60
247
- #: ../includes/widget.php:144 ../includes/widget.php:164
248
  msgid "Recent"
249
  msgstr ""
250
 
251
- #: ../includes/widget.php:38 ../includes/widget.php:64
252
- #: ../includes/widget.php:148 ../includes/widget.php:168
253
  msgid "Most Voted"
254
  msgstr ""
255
 
256
- #: ../includes/widget.php:38
257
  msgid "Editor's choice"
258
  msgstr ""
259
 
260
- #: ../includes/widget.php:51
261
  msgid "Select Tabs"
262
  msgstr ""
263
 
264
- #: ../includes/widget.php:68 ../includes/widget.php:152
265
- #: ../includes/widget.php:172
266
  msgid "Custom"
267
  msgstr ""
268
 
269
- #: ../includes/widget.php:76
270
  msgid "Review type:"
271
  msgstr ""
272
 
273
- #: ../includes/widget.php:78
274
  msgid "Any"
275
  msgstr ""
276
 
277
- #: ../includes/widget.php:88
278
  msgid "Allow pagination"
279
  msgstr ""
280
 
281
- #: ../includes/widget.php:93
282
  msgid "Number of reviews to show:"
283
  msgstr ""
284
 
285
- #: ../includes/widget.php:100
286
  msgid "Title length (words):"
287
  msgstr ""
288
 
289
- #: ../includes/widget.php:109
290
  msgid "Thumbnail size:"
291
  msgstr ""
292
 
293
- #: ../includes/widget.php:111
294
  msgid "Small"
295
  msgstr ""
296
 
297
- #: ../includes/widget.php:112
298
  msgid "Large"
299
  msgstr ""
300
 
301
- #: ../includes/widget.php:119
302
  msgid "Show date"
303
  msgstr ""
304
 
305
- #: ../includes/widget.php:124
306
  msgid "Reviews on Custom tab:"
307
  msgstr ""
308
 
309
- #: ../includes/widget.php:134
310
  msgid "Tab Titles"
311
  msgstr ""
312
 
313
- #: ../includes/widget.php:134
314
  msgid "Tab Order"
315
  msgstr ""
316
 
317
- #: ../includes/widget.php:469
318
  msgid "&laquo; Previous"
319
  msgstr ""
320
 
321
- #: ../includes/widget.php:472
322
  msgid "Next &raquo;"
323
  msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  msgid ""
2
  msgstr ""
3
+ "Project-Id-Version: WP Review Pro Plugin\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2016-02-27 18:01+0100\n"
6
+ "PO-Revision-Date: 2016-02-27 18:01+0100\n"
7
  "Last-Translator: MyThemeShop <support-team@mythemeshop.com>\n"
8
  "Language-Team: MyThemeShop\n"
9
  "Language: en_US\n"
13
  "X-Poedit-KeywordsList: __;_e\n"
14
  "X-Poedit-Basepath: .\n"
15
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
16
+ "X-Generator: Poedit 1.8.1\n"
17
  "X-Poedit-SearchPath-0: ..\n"
18
 
19
+ #: ../admin/metaboxes.php:30 ../includes/comments.php:486
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  msgid "Review"
21
  msgstr ""
22
 
24
  msgid "Review Item"
25
  msgstr ""
26
 
27
+ #: ../admin/metaboxes.php:48
28
+ msgid "Review Links"
29
  msgstr ""
30
 
31
  #: ../admin/metaboxes.php:57
36
  msgid "User Reviews"
37
  msgstr ""
38
 
39
+ #: ../admin/metaboxes.php:97
40
+ msgid "Review Type"
 
 
 
 
41
  msgstr ""
42
 
43
+ #: ../admin/metaboxes.php:99
44
+ msgid "No Review"
45
  msgstr ""
46
 
47
+ #: ../admin/metaboxes.php:108 ../admin/options.php:303
48
+ msgid "Review Schema"
49
  msgstr ""
50
 
51
+ #: ../admin/metaboxes.php:117
52
+ msgid "Review Heading"
53
  msgstr ""
54
 
55
+ #: ../admin/metaboxes.php:199
56
  msgid "Feature Name"
57
  msgstr ""
58
 
59
+ #: ../admin/metaboxes.php:200
60
  msgid "Star (1-5)"
61
  msgstr ""
62
 
63
+ #: ../admin/metaboxes.php:220 ../admin/metaboxes.php:231
64
+ #: ../admin/metaboxes.php:241 ../admin/metaboxes.php:429
65
+ #: ../admin/metaboxes.php:441 ../admin/metaboxes.php:451
66
+ #: ../admin/options.php:323 ../admin/options.php:336
67
+ #: ../admin/options.php:346 ../admin/options.php:368
68
+ #: ../admin/options.php:378
69
  msgid "Delete"
70
  msgstr ""
71
 
72
+ #: ../admin/metaboxes.php:250 ../admin/metaboxes.php:458
73
  msgid "Add another"
74
  msgstr ""
75
 
76
+ #: ../admin/metaboxes.php:254
77
  msgid "Total"
78
  msgstr ""
79
 
80
+ #: ../admin/metaboxes.php:260
81
  msgid "Custom Location"
82
  msgstr ""
83
 
84
+ #: ../admin/metaboxes.php:264 ../admin/options.php:289
85
  msgid "Review Location"
86
  msgstr ""
87
 
88
+ #: ../admin/metaboxes.php:266 ../admin/options.php:292
89
  msgid "After Content"
90
  msgstr ""
91
 
92
+ #: ../admin/metaboxes.php:267 ../admin/options.php:293
93
  msgid "Before Content"
94
  msgstr ""
95
 
96
+ #: ../admin/metaboxes.php:268 ../admin/options.php:294
97
  msgid "Custom (use shortcode)"
98
  msgstr ""
99
 
100
+ #: ../admin/metaboxes.php:274
101
  msgid "Copy &amp; paste this shortcode in the content."
102
  msgstr ""
103
 
104
+ #: ../admin/metaboxes.php:279
105
  msgid "Custom Colors"
106
  msgstr ""
107
 
108
+ #: ../admin/metaboxes.php:284 ../admin/options.php:241
109
  msgid "Review Color"
110
  msgstr ""
111
 
112
+ #: ../admin/metaboxes.php:289 ../admin/options.php:246
113
  msgid "Font Color"
114
  msgstr ""
115
 
116
+ #: ../admin/metaboxes.php:294 ../admin/options.php:251
117
  msgid "Heading Background Color"
118
  msgstr ""
119
 
120
+ #: ../admin/metaboxes.php:299 ../admin/options.php:256
121
  msgid "Background Color"
122
  msgstr ""
123
 
124
+ #: ../admin/metaboxes.php:304 ../admin/options.php:261
125
  msgid "Border Color"
126
  msgstr ""
127
 
128
+ #: ../admin/metaboxes.php:310
129
+ msgid "Custom Width"
130
+ msgstr ""
131
+
132
+ #: ../admin/metaboxes.php:315 ../admin/options.php:268
133
+ msgid "Review Box Width"
134
+ msgstr ""
135
+
136
+ #: ../admin/metaboxes.php:319 ../admin/options.php:272
137
+ msgid "Align Left"
138
+ msgstr ""
139
+
140
+ #: ../admin/metaboxes.php:323 ../admin/options.php:276
141
+ msgid "Align Right"
142
  msgstr ""
143
 
144
  #: ../admin/metaboxes.php:331
145
+ msgid "Custom Author"
146
+ msgstr ""
147
+
148
+ #: ../admin/metaboxes.php:335
149
+ msgid "Review Author"
150
+ msgstr ""
151
+
152
+ #: ../admin/metaboxes.php:351 ../includes/functions.php:1354
153
+ msgid "Summary"
154
+ msgstr ""
155
+
156
+ #: ../admin/metaboxes.php:374
157
  msgid "Hide Description &amp; Total Rating"
158
  msgstr ""
159
 
160
+ #: ../admin/metaboxes.php:407
161
+ msgid "Text"
162
+ msgstr ""
163
+
164
+ #: ../admin/metaboxes.php:408 ../includes/comments.php:369
165
+ msgid "URL"
166
+ msgstr ""
167
+
168
+ #: ../admin/metaboxes.php:481 ../admin/options.php:389
169
  msgid "Disabled"
170
  msgstr ""
171
 
172
+ #: ../admin/metaboxes.php:485 ../admin/options.php:392
173
+ msgid "Visitor Rating Only"
174
  msgstr ""
175
 
176
+ #: ../admin/metaboxes.php:489 ../admin/options.php:395
177
+ msgid "Comment Rating Only"
178
  msgstr ""
179
 
180
+ #: ../admin/metaboxes.php:493 ../admin/options.php:398
181
+ msgid "Both"
182
+ msgstr ""
183
+
184
+ #: ../admin/metaboxes.php:496
185
+ msgid "User Rating Type"
186
+ msgstr ""
187
+
188
+ #: ../admin/metaboxes.php:504
189
+ msgid ""
190
+ "Note: If you are changing user rating type and post already have user "
191
+ "ratings, please edit or remove existing ratings if needed."
192
+ msgstr ""
193
+
194
+ #: ../admin/metaboxes.php:510
195
+ msgid ""
196
+ "Hide Comments Total Rating ( if \"Comment Rating Only\" or \"Both\" is "
197
+ "checked )"
198
+ msgstr ""
199
+
200
+ #: ../admin/metaboxes.php:514
201
+ msgid "Comment Rating Type"
202
+ msgstr ""
203
+
204
+ #: ../admin/metaboxes.php:670
205
+ msgid "Book"
206
+ msgstr ""
207
+
208
+ #: ../admin/metaboxes.php:671
209
+ msgid "Game"
210
+ msgstr ""
211
+
212
+ #: ../admin/metaboxes.php:672
213
+ msgid "Movie"
214
+ msgstr ""
215
+
216
+ #: ../admin/metaboxes.php:673
217
+ msgid "Music Recording"
218
+ msgstr ""
219
+
220
+ #: ../admin/metaboxes.php:674
221
+ msgid "Painting"
222
+ msgstr ""
223
+
224
+ #: ../admin/metaboxes.php:675
225
+ msgid "Place"
226
+ msgstr ""
227
+
228
+ #: ../admin/metaboxes.php:676
229
+ msgid "Product"
230
+ msgstr ""
231
+
232
+ #: ../admin/metaboxes.php:677
233
+ msgid "Recipe"
234
+ msgstr ""
235
+
236
+ #: ../admin/metaboxes.php:678
237
+ msgid "Restaurant"
238
+ msgstr ""
239
+
240
+ #: ../admin/metaboxes.php:679
241
+ msgid "Software"
242
+ msgstr ""
243
+
244
+ #: ../admin/metaboxes.php:680
245
+ msgid "Store"
246
+ msgstr ""
247
+
248
+ #: ../admin/metaboxes.php:681
249
+ msgid "Thing (Default)"
250
+ msgstr ""
251
+
252
+ #: ../admin/metaboxes.php:682
253
+ msgid "TV Series"
254
+ msgstr ""
255
+
256
+ #: ../admin/metaboxes.php:683
257
+ msgid "Website"
258
+ msgstr ""
259
+
260
+ #: ../admin/options.php:31 ../includes/functions.php:1022
261
+ #: ../includes/widget.php:77
262
+ msgid "Star"
263
+ msgstr ""
264
+
265
+ #: ../admin/options.php:31 ../includes/functions.php:1032
266
+ #: ../includes/widget.php:78
267
+ msgid "Point"
268
+ msgstr ""
269
+
270
+ #: ../admin/options.php:31 ../includes/functions.php:1042
271
+ #: ../includes/widget.php:79
272
+ msgid "Percentage"
273
+ msgstr ""
274
+
275
+ #: ../admin/options.php:31 ../includes/functions.php:1053
276
+ msgid "Circle"
277
+ msgstr ""
278
+
279
+ #: ../admin/options.php:80
280
+ msgid "WP Review Pro Settings"
281
+ msgstr ""
282
+
283
+ #: ../admin/options.php:154
284
+ msgid "General"
285
+ msgstr ""
286
+
287
+ #: ../admin/options.php:155 ../admin/options.php:235
288
+ msgid "Styling"
289
+ msgstr ""
290
+
291
+ #: ../admin/options.php:156 ../admin/options.php:282
292
+ msgid "Defaults"
293
+ msgstr ""
294
+
295
+ #: ../admin/options.php:158
296
+ msgid "Migrate Ratings"
297
+ msgstr ""
298
+
299
+ #: ../admin/options.php:163
300
+ msgid "General Settings"
301
+ msgstr ""
302
+
303
+ #: ../admin/options.php:166
304
  msgid ""
305
  "There is a filter set for the review location that may modify the options "
306
  "below."
307
  msgstr ""
308
 
309
+ #: ../admin/options.php:171
310
  msgid "The current theme provides default settings for the plugin."
311
  msgstr ""
312
 
313
+ #: ../admin/options.php:173
314
  msgid "Set to theme defaults"
315
  msgstr ""
316
 
317
+ #: ../admin/options.php:179
318
+ msgid "Comment form integration"
319
+ msgstr ""
320
+
321
+ #: ../admin/options.php:184
322
+ msgid "Replace"
323
+ msgstr ""
324
+
325
+ #: ../admin/options.php:185
326
+ msgid "Replace form fields."
327
+ msgstr ""
328
+
329
+ #: ../admin/options.php:190
330
+ msgid "Extend"
331
+ msgstr ""
332
+
333
+ #: ../admin/options.php:191
334
+ msgid "Add new fields without modifying the default fields."
335
+ msgstr ""
336
+
337
+ #: ../admin/options.php:196
338
+ msgid "Restrict rating to registered users only"
339
+ msgstr ""
340
+
341
+ #: ../admin/options.php:201
342
+ msgid "Require a rating when commenting"
343
+ msgstr ""
344
+
345
+ #: ../admin/options.php:206
346
+ msgid "Allow comment feedback (helpful/unhelpful)"
347
  msgstr ""
348
 
349
+ #: ../admin/options.php:211
350
+ msgid "Add total rating to thumbnails"
351
+ msgstr ""
352
+
353
+ #: ../admin/options.php:217
354
+ msgid "Rating to show: "
355
+ msgstr ""
356
+
357
+ #: ../admin/options.php:219
358
+ msgid "Author total"
359
+ msgstr ""
360
+
361
+ #: ../admin/options.php:220
362
+ msgid "Visitors total"
363
+ msgstr ""
364
+
365
+ #: ../admin/options.php:221
366
+ msgid "Comments total"
367
+ msgstr ""
368
+
369
+ #: ../admin/options.php:225
370
+ msgid "Registered image sizes: "
371
+ msgstr ""
372
+
373
+ #: ../admin/options.php:237
374
  msgid ""
375
  "There is a filter set for the review colors that may modify the options "
376
  "below."
377
  msgstr ""
378
 
379
+ #: ../admin/options.php:298
380
+ msgid "Copy &amp; paste this shortcode in the post content."
381
+ msgstr ""
382
+
383
+ #: ../admin/options.php:313
384
+ msgid "Features"
385
  msgstr ""
386
 
387
+ #: ../admin/options.php:351
388
+ msgid "Default features are set by a filter function. Remove it to change."
389
  msgstr ""
390
 
391
+ #: ../admin/options.php:353
392
  msgid "Add default feature"
393
  msgstr ""
394
 
395
+ #: ../admin/options.php:358
396
+ msgid "Links"
397
+ msgstr ""
398
+
399
+ #: ../admin/options.php:382
400
+ msgid "Add default link"
401
+ msgstr ""
402
+
403
+ #: ../admin/options.php:386
404
+ msgid "User Ratings"
405
+ msgstr ""
406
+
407
+ #: ../admin/options.php:403
408
+ msgid "Force Enable User Ratings"
409
+ msgstr ""
410
+
411
+ #: ../admin/options.php:405
412
+ msgid ""
413
+ "Enable user ratings on all posts, pages and custom post types where it is "
414
+ "not disabled explicitly."
415
+ msgstr ""
416
+
417
+ #: ../admin/options.php:419
418
+ msgid ""
419
+ "Here you can import your existing user ratings from WP Review 1.x and WP "
420
+ "Review Pro 1.x."
421
+ msgstr ""
422
+
423
+ #: ../admin/options.php:420
424
+ #, php-format
425
+ msgid "%s ratings left to import."
426
+ msgstr ""
427
+
428
+ #: ../admin/options.php:421
429
+ msgid "Start import"
430
+ msgstr ""
431
+
432
+ #: ../admin/options.php:424
433
+ msgid "Ratings have already been migrated."
434
+ msgstr ""
435
+
436
+ #: ../admin/options.php:432
437
  msgid "Save Changes"
438
  msgstr ""
439
 
440
+ #: ../admin/options.php:443
441
  msgid "Settings"
442
  msgstr ""
443
 
444
+ #: ../box-templates/default.php:107
445
+ msgid "User Rating"
446
  msgstr ""
447
 
448
+ #: ../box-templates/default.php:127
449
+ msgid "Comments Rating"
450
+ msgstr ""
451
+
452
+ #: ../filter-list.php:34
453
+ msgid "Enable Reviews"
454
  msgstr ""
455
 
456
+ #: ../filter-list.php:41
457
+ msgid "Audio"
458
  msgstr ""
459
 
460
+ #: ../filter-list.php:41
461
+ msgid "Visual"
462
+ msgstr ""
463
+
464
+ #: ../filter-list.php:41
465
+ msgid "UX"
466
+ msgstr ""
467
+
468
+ #: ../filter-list.php:41
469
+ msgid "Price"
470
+ msgstr ""
471
+
472
+ #: ../filter-list.php:139
473
+ msgid "10 Stars"
474
+ msgstr ""
475
+
476
+ #: ../filter-list.php:142 ../includes/functions.php:961
477
+ #: ../includes/functions.php:1025
478
+ #, php-format
479
+ msgid "%s Stars"
480
+ msgstr ""
481
+
482
+ #: ../filter-list.php:143 ../includes/functions.php:1026
483
+ #, php-format
484
+ msgid "%s Star"
485
+ msgstr ""
486
+
487
+ #: ../includes/comments.php:38 ../includes/comments.php:103
488
+ #: ../includes/comments.php:139 ../includes/comments.php:343
489
+ #: ../includes/functions.php:1575
490
+ msgid "Rating"
491
+ msgstr ""
492
+
493
+ #: ../includes/comments.php:38 ../includes/comments.php:103
494
+ msgid "Rating *"
495
+ msgstr ""
496
+
497
+ #: ../includes/comments.php:94 ../includes/comments.php:136
498
+ #: ../includes/comments.php:338
499
+ msgid "Review Title"
500
+ msgstr ""
501
+
502
+ #: ../includes/comments.php:122
503
+ #, php-format
504
+ msgid "WP Review Rating (%s)"
505
+ msgstr ""
506
+
507
+ #: ../includes/comments.php:331
508
+ msgid "Edit Comment"
509
+ msgstr ""
510
+
511
+ #: ../includes/comments.php:332
512
+ msgid "Reply to Comment"
513
+ msgstr ""
514
+
515
+ #: ../includes/comments.php:333
516
+ msgid "Add new Comment"
517
+ msgstr ""
518
+
519
+ #: ../includes/comments.php:350 ../includes/comments.php:486
520
+ msgid "Comment"
521
+ msgstr ""
522
+
523
+ #: ../includes/comments.php:359
524
+ msgid "Name"
525
+ msgstr ""
526
+
527
+ #: ../includes/comments.php:364
528
+ msgid "Email"
529
+ msgstr ""
530
+
531
+ #: ../includes/comments.php:376
532
+ msgid "Add Comment"
533
+ msgstr ""
534
+
535
+ #: ../includes/comments.php:377
536
+ msgid "Update Comment"
537
+ msgstr ""
538
+
539
+ #: ../includes/comments.php:378
540
+ msgid "Submit Reply"
541
+ msgstr ""
542
+
543
+ #: ../includes/comments.php:379
544
+ msgid "Cancel"
545
+ msgstr ""
546
+
547
+ #: ../includes/comments.php:441
548
+ msgid "Edit this item inline"
549
+ msgstr ""
550
+
551
+ #: ../includes/comments.php:441
552
+ msgid "Quick Edit"
553
+ msgstr ""
554
+
555
+ #: ../includes/functions.php:515 ../includes/functions.php:585
556
+ #: ../includes/functions.php:961
557
+ #, php-format
558
+ msgid "Visitor Rating: %s"
559
+ msgstr ""
560
+
561
+ #: ../includes/functions.php:609
562
+ msgid "Invalid comment ID."
563
+ msgstr ""
564
+
565
+ #: ../includes/functions.php:629
566
+ msgid "You already gave feedback."
567
+ msgstr ""
568
+
569
+ #: ../includes/functions.php:688
570
+ msgid "Comment Reviews"
571
+ msgstr ""
572
+
573
+ #: ../includes/functions.php:689
574
+ msgid "Visitor Reviews"
575
+ msgstr ""
576
+
577
+ #: ../includes/functions.php:1035 ../includes/functions.php:1036
578
+ #, php-format
579
+ msgid "%s/10"
580
+ msgstr ""
581
+
582
+ #: ../includes/functions.php:1045 ../includes/functions.php:1046
583
+ #, php-format
584
+ msgid "%s%%"
585
+ msgstr ""
586
+
587
+ #: ../includes/functions.php:1056 ../includes/functions.php:1057
588
+ #, php-format
589
+ msgid "%s"
590
+ msgstr ""
591
+
592
+ #: ../includes/functions.php:1584
593
+ msgid "No Rating"
594
+ msgstr ""
595
+
596
+ #: ../includes/functions.php:1627
597
+ #, php-format
598
+ msgid ""
599
+ "Thank you for updating WP Review Pro. Your existing user ratings will show "
600
+ "up after importing them in %s."
601
  msgstr ""
602
 
603
+ #: ../includes/functions.php:1627
604
+ msgid "Settings &gt; WP Review Pro &gt; Migrate Ratings"
605
  msgstr ""
606
 
607
  #: ../includes/widget.php:13
612
  msgid "WP Review Widget"
613
  msgstr ""
614
 
615
+ #: ../includes/widget.php:36 ../includes/widget.php:54
616
+ #: ../includes/widget.php:138 ../includes/widget.php:158
617
  msgid "Top Rated"
618
  msgstr ""
619
 
620
+ #: ../includes/widget.php:36 ../includes/widget.php:58
621
+ #: ../includes/widget.php:142 ../includes/widget.php:162
622
  msgid "Recent"
623
  msgstr ""
624
 
625
+ #: ../includes/widget.php:36 ../includes/widget.php:62
626
+ #: ../includes/widget.php:146 ../includes/widget.php:166
627
  msgid "Most Voted"
628
  msgstr ""
629
 
630
+ #: ../includes/widget.php:36
631
  msgid "Editor's choice"
632
  msgstr ""
633
 
634
+ #: ../includes/widget.php:49
635
  msgid "Select Tabs"
636
  msgstr ""
637
 
638
+ #: ../includes/widget.php:66 ../includes/widget.php:150
639
+ #: ../includes/widget.php:170
640
  msgid "Custom"
641
  msgstr ""
642
 
643
+ #: ../includes/widget.php:74
644
  msgid "Review type:"
645
  msgstr ""
646
 
647
+ #: ../includes/widget.php:76
648
  msgid "Any"
649
  msgstr ""
650
 
651
+ #: ../includes/widget.php:86
652
  msgid "Allow pagination"
653
  msgstr ""
654
 
655
+ #: ../includes/widget.php:91
656
  msgid "Number of reviews to show:"
657
  msgstr ""
658
 
659
+ #: ../includes/widget.php:98
660
  msgid "Title length (words):"
661
  msgstr ""
662
 
663
+ #: ../includes/widget.php:107
664
  msgid "Thumbnail size:"
665
  msgstr ""
666
 
667
+ #: ../includes/widget.php:109
668
  msgid "Small"
669
  msgstr ""
670
 
671
+ #: ../includes/widget.php:110
672
  msgid "Large"
673
  msgstr ""
674
 
675
+ #: ../includes/widget.php:117
676
  msgid "Show date"
677
  msgstr ""
678
 
679
+ #: ../includes/widget.php:122
680
  msgid "Reviews on Custom tab:"
681
  msgstr ""
682
 
683
+ #: ../includes/widget.php:132
684
  msgid "Tab Titles"
685
  msgstr ""
686
 
687
+ #: ../includes/widget.php:132
688
  msgid "Tab Order"
689
  msgstr ""
690
 
691
+ #: ../includes/widget.php:471
692
  msgid "&laquo; Previous"
693
  msgstr ""
694
 
695
+ #: ../includes/widget.php:474
696
  msgid "Next &raquo;"
697
  msgstr ""
698
+
699
+ #: ../rating-types/circle-input.php:39
700
+ msgid "Send Rating"
701
+ msgstr ""
702
+
703
+ #: ../rating-types/percentage-input.php:25
704
+ #: ../rating-types/point-input.php:23 ../rating-types/star-input.php:23
705
+ msgid "Sending"
706
+ msgstr ""
707
+
708
+ #: ../rating-types/percentage-input.php:29
709
+ #: ../rating-types/point-input.php:27
710
+ #, php-format
711
+ msgid "Your rating: %s"
712
+ msgstr ""
713
+
714
+ #: ../wp-review.php:39
715
+ msgid "Please deactivate WP Review plugin first to use the Premium features!"
716
+ msgstr ""
license.txt CHANGED
@@ -1,339 +1,339 @@
1
- GNU GENERAL PUBLIC LICENSE
2
- Version 2, June 1991
3
-
4
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
- Everyone is permitted to copy and distribute verbatim copies
7
- of this license document, but changing it is not allowed.
8
-
9
- Preamble
10
-
11
- The licenses for most software are designed to take away your
12
- freedom to share and change it. By contrast, the GNU General Public
13
- License is intended to guarantee your freedom to share and change free
14
- software--to make sure the software is free for all its users. This
15
- General Public License applies to most of the Free Software
16
- Foundation's software and to any other program whose authors commit to
17
- using it. (Some other Free Software Foundation software is covered by
18
- the GNU Lesser General Public License instead.) You can apply it to
19
- your programs, too.
20
-
21
- When we speak of free software, we are referring to freedom, not
22
- price. Our General Public Licenses are designed to make sure that you
23
- have the freedom to distribute copies of free software (and charge for
24
- this service if you wish), that you receive source code or can get it
25
- if you want it, that you can change the software or use pieces of it
26
- in new free programs; and that you know you can do these things.
27
-
28
- To protect your rights, we need to make restrictions that forbid
29
- anyone to deny you these rights or to ask you to surrender the rights.
30
- These restrictions translate to certain responsibilities for you if you
31
- distribute copies of the software, or if you modify it.
32
-
33
- For example, if you distribute copies of such a program, whether
34
- gratis or for a fee, you must give the recipients all the rights that
35
- you have. You must make sure that they, too, receive or can get the
36
- source code. And you must show them these terms so they know their
37
- rights.
38
-
39
- We protect your rights with two steps: (1) copyright the software, and
40
- (2) offer you this license which gives you legal permission to copy,
41
- distribute and/or modify the software.
42
-
43
- Also, for each author's protection and ours, we want to make certain
44
- that everyone understands that there is no warranty for this free
45
- software. If the software is modified by someone else and passed on, we
46
- want its recipients to know that what they have is not the original, so
47
- that any problems introduced by others will not reflect on the original
48
- authors' reputations.
49
-
50
- Finally, any free program is threatened constantly by software
51
- patents. We wish to avoid the danger that redistributors of a free
52
- program will individually obtain patent licenses, in effect making the
53
- program proprietary. To prevent this, we have made it clear that any
54
- patent must be licensed for everyone's free use or not licensed at all.
55
-
56
- The precise terms and conditions for copying, distribution and
57
- modification follow.
58
-
59
- GNU GENERAL PUBLIC LICENSE
60
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
-
62
- 0. This License applies to any program or other work which contains
63
- a notice placed by the copyright holder saying it may be distributed
64
- under the terms of this General Public License. The "Program", below,
65
- refers to any such program or work, and a "work based on the Program"
66
- means either the Program or any derivative work under copyright law:
67
- that is to say, a work containing the Program or a portion of it,
68
- either verbatim or with modifications and/or translated into another
69
- language. (Hereinafter, translation is included without limitation in
70
- the term "modification".) Each licensee is addressed as "you".
71
-
72
- Activities other than copying, distribution and modification are not
73
- covered by this License; they are outside its scope. The act of
74
- running the Program is not restricted, and the output from the Program
75
- is covered only if its contents constitute a work based on the
76
- Program (independent of having been made by running the Program).
77
- Whether that is true depends on what the Program does.
78
-
79
- 1. You may copy and distribute verbatim copies of the Program's
80
- source code as you receive it, in any medium, provided that you
81
- conspicuously and appropriately publish on each copy an appropriate
82
- copyright notice and disclaimer of warranty; keep intact all the
83
- notices that refer to this License and to the absence of any warranty;
84
- and give any other recipients of the Program a copy of this License
85
- along with the Program.
86
-
87
- You may charge a fee for the physical act of transferring a copy, and
88
- you may at your option offer warranty protection in exchange for a fee.
89
-
90
- 2. You may modify your copy or copies of the Program or any portion
91
- of it, thus forming a work based on the Program, and copy and
92
- distribute such modifications or work under the terms of Section 1
93
- above, provided that you also meet all of these conditions:
94
-
95
- a) You must cause the modified files to carry prominent notices
96
- stating that you changed the files and the date of any change.
97
-
98
- b) You must cause any work that you distribute or publish, that in
99
- whole or in part contains or is derived from the Program or any
100
- part thereof, to be licensed as a whole at no charge to all third
101
- parties under the terms of this License.
102
-
103
- c) If the modified program normally reads commands interactively
104
- when run, you must cause it, when started running for such
105
- interactive use in the most ordinary way, to print or display an
106
- announcement including an appropriate copyright notice and a
107
- notice that there is no warranty (or else, saying that you provide
108
- a warranty) and that users may redistribute the program under
109
- these conditions, and telling the user how to view a copy of this
110
- License. (Exception: if the Program itself is interactive but
111
- does not normally print such an announcement, your work based on
112
- the Program is not required to print an announcement.)
113
-
114
- These requirements apply to the modified work as a whole. If
115
- identifiable sections of that work are not derived from the Program,
116
- and can be reasonably considered independent and separate works in
117
- themselves, then this License, and its terms, do not apply to those
118
- sections when you distribute them as separate works. But when you
119
- distribute the same sections as part of a whole which is a work based
120
- on the Program, the distribution of the whole must be on the terms of
121
- this License, whose permissions for other licensees extend to the
122
- entire whole, and thus to each and every part regardless of who wrote it.
123
-
124
- Thus, it is not the intent of this section to claim rights or contest
125
- your rights to work written entirely by you; rather, the intent is to
126
- exercise the right to control the distribution of derivative or
127
- collective works based on the Program.
128
-
129
- In addition, mere aggregation of another work not based on the Program
130
- with the Program (or with a work based on the Program) on a volume of
131
- a storage or distribution medium does not bring the other work under
132
- the scope of this License.
133
-
134
- 3. You may copy and distribute the Program (or a work based on it,
135
- under Section 2) in object code or executable form under the terms of
136
- Sections 1 and 2 above provided that you also do one of the following:
137
-
138
- a) Accompany it with the complete corresponding machine-readable
139
- source code, which must be distributed under the terms of Sections
140
- 1 and 2 above on a medium customarily used for software interchange; or,
141
-
142
- b) Accompany it with a written offer, valid for at least three
143
- years, to give any third party, for a charge no more than your
144
- cost of physically performing source distribution, a complete
145
- machine-readable copy of the corresponding source code, to be
146
- distributed under the terms of Sections 1 and 2 above on a medium
147
- customarily used for software interchange; or,
148
-
149
- c) Accompany it with the information you received as to the offer
150
- to distribute corresponding source code. (This alternative is
151
- allowed only for noncommercial distribution and only if you
152
- received the program in object code or executable form with such
153
- an offer, in accord with Subsection b above.)
154
-
155
- The source code for a work means the preferred form of the work for
156
- making modifications to it. For an executable work, complete source
157
- code means all the source code for all modules it contains, plus any
158
- associated interface definition files, plus the scripts used to
159
- control compilation and installation of the executable. However, as a
160
- special exception, the source code distributed need not include
161
- anything that is normally distributed (in either source or binary
162
- form) with the major components (compiler, kernel, and so on) of the
163
- opereview system on which the executable runs, unless that component
164
- itself accompanies the executable.
165
-
166
- If distribution of executable or object code is made by offering
167
- access to copy from a designated place, then offering equivalent
168
- access to copy the source code from the same place counts as
169
- distribution of the source code, even though third parties are not
170
- compelled to copy the source along with the object code.
171
-
172
- 4. You may not copy, modify, sublicense, or distribute the Program
173
- except as expressly provided under this License. Any attempt
174
- otherwise to copy, modify, sublicense or distribute the Program is
175
- void, and will automatically terminate your rights under this License.
176
- However, parties who have received copies, or rights, from you under
177
- this License will not have their licenses terminated so long as such
178
- parties remain in full compliance.
179
-
180
- 5. You are not required to accept this License, since you have not
181
- signed it. However, nothing else grants you permission to modify or
182
- distribute the Program or its derivative works. These actions are
183
- prohibited by law if you do not accept this License. Therefore, by
184
- modifying or distributing the Program (or any work based on the
185
- Program), you indicate your acceptance of this License to do so, and
186
- all its terms and conditions for copying, distributing or modifying
187
- the Program or works based on it.
188
-
189
- 6. Each time you redistribute the Program (or any work based on the
190
- Program), the recipient automatically receives a license from the
191
- original licensor to copy, distribute or modify the Program subject to
192
- these terms and conditions. You may not impose any further
193
- restrictions on the recipients' exercise of the rights granted herein.
194
- You are not responsible for enforcing compliance by third parties to
195
- this License.
196
-
197
- 7. If, as a consequence of a court judgment or allegation of patent
198
- infringement or for any other reason (not limited to patent issues),
199
- conditions are imposed on you (whether by court order, agreement or
200
- otherwise) that contradict the conditions of this License, they do not
201
- excuse you from the conditions of this License. If you cannot
202
- distribute so as to satisfy simultaneously your obligations under this
203
- License and any other pertinent obligations, then as a consequence you
204
- may not distribute the Program at all. For example, if a patent
205
- license would not permit royalty-free redistribution of the Program by
206
- all those who receive copies directly or indirectly through you, then
207
- the only way you could satisfy both it and this License would be to
208
- refrain entirely from distribution of the Program.
209
-
210
- If any portion of this section is held invalid or unenforceable under
211
- any particular circumstance, the balance of the section is intended to
212
- apply and the section as a whole is intended to apply in other
213
- circumstances.
214
-
215
- It is not the purpose of this section to induce you to infringe any
216
- patents or other property right claims or to contest validity of any
217
- such claims; this section has the sole purpose of protecting the
218
- integrity of the free software distribution system, which is
219
- implemented by public license practices. Many people have made
220
- generous contributions to the wide range of software distributed
221
- through that system in reliance on consistent application of that
222
- system; it is up to the author/donor to decide if he or she is willing
223
- to distribute software through any other system and a licensee cannot
224
- impose that choice.
225
-
226
- This section is intended to make thoroughly clear what is believed to
227
- be a consequence of the rest of this License.
228
-
229
- 8. If the distribution and/or use of the Program is restricted in
230
- certain countries either by patents or by copyrighted interfaces, the
231
- original copyright holder who places the Program under this License
232
- may add an explicit geographical distribution limitation excluding
233
- those countries, so that distribution is permitted only in or among
234
- countries not thus excluded. In such case, this License incorporates
235
- the limitation as if written in the body of this License.
236
-
237
- 9. The Free Software Foundation may publish revised and/or new versions
238
- of the General Public License from time to time. Such new versions will
239
- be similar in spirit to the present version, but may differ in detail to
240
- address new problems or concerns.
241
-
242
- Each version is given a distinguishing version number. If the Program
243
- specifies a version number of this License which applies to it and "any
244
- later version", you have the option of following the terms and conditions
245
- either of that version or of any later version published by the Free
246
- Software Foundation. If the Program does not specify a version number of
247
- this License, you may choose any version ever published by the Free Software
248
- Foundation.
249
-
250
- 10. If you wish to incorporate parts of the Program into other free
251
- programs whose distribution conditions are different, write to the author
252
- to ask for permission. For software which is copyrighted by the Free
253
- Software Foundation, write to the Free Software Foundation; we sometimes
254
- make exceptions for this. Our decision will be guided by the two goals
255
- of preserving the free status of all derivatives of our free software and
256
- of promoting the sharing and reuse of software generally.
257
-
258
- NO WARRANTY
259
-
260
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
- FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
- OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
- PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
- OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
- TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
- PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
- REPAIR OR CORRECTION.
269
-
270
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
- WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
- REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
- INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
- OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
- TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
- YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
- PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
- POSSIBILITY OF SUCH DAMAGES.
279
-
280
- END OF TERMS AND CONDITIONS
281
-
282
- How to Apply These Terms to Your New Programs
283
-
284
- If you develop a new program, and you want it to be of the greatest
285
- possible use to the public, the best way to achieve this is to make it
286
- free software which everyone can redistribute and change under these terms.
287
-
288
- To do so, attach the following notices to the program. It is safest
289
- to attach them to the start of each source file to most effectively
290
- convey the exclusion of warranty; and each file should have at least
291
- the "copyright" line and a pointer to where the full notice is found.
292
-
293
- <one line to give the program's name and a brief idea of what it does.>
294
- Copyright (C) <year> <name of author>
295
-
296
- This program is free software; you can redistribute it and/or modify
297
- it under the terms of the GNU General Public License as published by
298
- the Free Software Foundation; either version 2 of the License, or
299
- (at your option) any later version.
300
-
301
- This program is distributed in the hope that it will be useful,
302
- but WITHOUT ANY WARRANTY; without even the implied warranty of
303
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
- GNU General Public License for more details.
305
-
306
- You should have received a copy of the GNU General Public License along
307
- with this program; if not, write to the Free Software Foundation, Inc.,
308
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
-
310
- Also add information on how to contact you by electronic and paper mail.
311
-
312
- If the program is interactive, make it output a short notice like this
313
- when it starts in an interactive mode:
314
-
315
- Gnomovision version 69, Copyright (C) year name of author
316
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
- This is free software, and you are welcome to redistribute it
318
- under certain conditions; type `show c' for details.
319
-
320
- The hypothetical commands `show w' and `show c' should show the appropriate
321
- parts of the General Public License. Of course, the commands you use may
322
- be called something other than `show w' and `show c'; they could even be
323
- mouse-clicks or menu items--whatever suits your program.
324
-
325
- You should also get your employer (if you work as a programmer) or your
326
- school, if any, to sign a "copyright disclaimer" for the program, if
327
- necessary. Here is a sample; alter the names:
328
-
329
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
-
332
- <signature of Ty Coon>, 1 April 1989
333
- Ty Coon, President of Vice
334
-
335
- This General Public License does not permit incorporeview your program into
336
- proprietary programs. If your program is a subroutine library, you may
337
- consider it more useful to permit linking proprietary applications with the
338
- library. If this is what you want to do, use the GNU Lesser General
339
  Public License instead of this License.
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ opereview system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ <one line to give the program's name and a brief idea of what it does.>
294
+ Copyright (C) <year> <name of author>
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, write to the Free Software Foundation, Inc.,
308
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
+
310
+ Also add information on how to contact you by electronic and paper mail.
311
+
312
+ If the program is interactive, make it output a short notice like this
313
+ when it starts in an interactive mode:
314
+
315
+ Gnomovision version 69, Copyright (C) year name of author
316
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
+ This is free software, and you are welcome to redistribute it
318
+ under certain conditions; type `show c' for details.
319
+
320
+ The hypothetical commands `show w' and `show c' should show the appropriate
321
+ parts of the General Public License. Of course, the commands you use may
322
+ be called something other than `show w' and `show c'; they could even be
323
+ mouse-clicks or menu items--whatever suits your program.
324
+
325
+ You should also get your employer (if you work as a programmer) or your
326
+ school, if any, to sign a "copyright disclaimer" for the program, if
327
+ necessary. Here is a sample; alter the names:
328
+
329
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
+
332
+ <signature of Ty Coon>, 1 April 1989
333
+ Ty Coon, President of Vice
334
+
335
+ This General Public License does not permit incorporeview your program into
336
+ proprietary programs. If your program is a subroutine library, you may
337
+ consider it more useful to permit linking proprietary applications with the
338
+ library. If this is what you want to do, use the GNU Lesser General
339
  Public License instead of this License.
rating-types/percentage-input.js ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
2
+ $('.wp-review-user-rating-percentage, .wp-review-comment-rating-percentage').each(function(index, el) {
3
+ var $rating_wrapper = $(this);
4
+
5
+ $rating_wrapper.find('.review-result').each(function() {
6
+ var $this = $(this);
7
+ $this.closest('.review-result-wrapper').data('originalwidth', $this[0].style.width);
8
+ });
9
+
10
+ $rating_wrapper.find('.review-result-wrapper').click(function(e) {
11
+ var $this = $(this);
12
+ var offset = $this.offset().left;
13
+ var width = ( ( ( e.pageX - offset ) / $this.width() ) * 100 ).toFixed();
14
+
15
+ // snap to nearest 5
16
+ // width = Math.round(width / 5) * 5;
17
+
18
+ // no 0-star ratings allowed
19
+ if (width == 0)
20
+ width = 1;
21
+
22
+ $this.find('.review-result').width(width + '%');
23
+ $this.data('originalrating', width );
24
+ $this.data('originalwidth', $this.find('.review-result')[0].style.width);
25
+
26
+ $rating_wrapper.addClass('wp-review-input-set');
27
+
28
+ // set input value
29
+ $rating_wrapper.find('.wp-review-user-rating-val').val( width );
30
+
31
+ wp_review_rate( $rating_wrapper );
32
+ }).on('mouseenter mousemove', function(e) {
33
+ var $this = $(this);
34
+ var offset = $this.offset().left;
35
+ var width = ( ( ( e.pageX - offset ) / $this.width() ) * 100 ).toFixed();
36
+
37
+ // snap to nearest 5
38
+ // width = Math.round(width / 5) * 5;
39
+
40
+ // no 0-star ratings allowed
41
+ if (width == 0)
42
+ width = 1;
43
+
44
+ $this.find('.review-result').width(width + '%');
45
+
46
+ $rating_wrapper.find('.wp-review-your-rating').css('left', width + '%').find('.wp-review-your-rating-value').text(''+width+'%');
47
+
48
+ }).on('mouseleave', function(e){
49
+ var $this = $(this);
50
+ $this.find('.review-result').width($this.data('originalwidth'));
51
+ $rating_wrapper.find('.wp-review-your-rating-value').text($this.data('originalrating')+'%');
52
+ });
53
+ });
54
+ });
rating-types/percentage-input.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Star rating type output template
4
+ *
5
+ * @since 2.0
6
+ * @copyright Copyright (c) 2013, MyThemesShop
7
+ * @author MyThemesShop
8
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9
+ */
10
+
11
+ // Exit if accessed directly
12
+ if ( ! defined( 'ABSPATH' ) ) exit;
13
+
14
+ global $wp_review_rating_types;
15
+
16
+ // For now, enqueue in footer
17
+ wp_enqueue_script( 'wp-review-percentage-input', trailingslashit( WP_REVIEW_URI ) . 'rating-types/percentage-input.js', array( 'jquery' ) );
18
+
19
+ $class = 'review-percentage';
20
+ if (!empty($rating['args']['class']))
21
+ $class .= ' '.sanitize_html_class( $rating['args']['class'] );
22
+
23
+ ?>
24
+ <div class="<?php echo $class; ?>">
25
+ <div class="wp-review-loading-msg"><span class="animate-spin mts-icon-loader"></span><?php _e( 'Sending', 'wp-review' ); ?></div>
26
+ <div class="review-result-wrapper" data-originalrating="<?php echo esc_attr( $rating['value'] ); ?>">
27
+ <div class="review-result" style="width:<?php echo esc_attr( $rating['value'] ); ?>%; background-color: <?php echo esc_attr( $rating['color'] ); ?>;"></div>
28
+ </div>
29
+ <div class="wp-review-your-rating" style="background-color: <?php echo esc_attr( $rating['colors']['bgcolor1'] ); ?>; color: <?php echo esc_attr( $rating['color'] ); ?>;"><?php printf(__('Your rating: %s', 'wp-review'), '<span class="wp-review-your-rating-value"></span>'); ?></div>
30
+
31
+ <input type="hidden" class="wp-review-user-rating-val" name="wp-review-user-rating-val" value="<?php echo esc_attr( $rating['value'] ); ?>" />
32
+ <input type="hidden" class="wp-review-user-rating-nonce" value="<?php echo esc_attr( wp_create_nonce( 'wp-review-security' ) ); ?>" />
33
+ <input type="hidden" class="wp-review-user-rating-postid" value="<?php echo esc_attr( $rating['post_id'] ); ?>" />
34
+ </div>
rating-types/percentage-output.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Star rating type output template
4
+ *
5
+ * @since 2.0
6
+ * @copyright Copyright (c) 2013, MyThemesShop
7
+ * @author MyThemesShop
8
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9
+ */
10
+
11
+ // Exit if accessed directly
12
+ if ( ! defined( 'ABSPATH' ) ) exit;
13
+
14
+ global $wp_review_rating_types;
15
+
16
+ $class = 'review-percentage';
17
+ if (!empty($rating['args']['class']))
18
+ $class .= ' '.sanitize_html_class( $rating['args']['class'] );
19
+
20
+ ?>
21
+ <div class="<?php echo $class; ?>">
22
+ <div class="review-result-wrapper">
23
+ <div class="review-result" style="width:<?php echo esc_attr( $rating['value'] ); ?>%; background-color: <?php echo esc_attr( $rating['color'] ); ?>;"></div>
24
+ <div class="review-result-text" style="color: <?php echo esc_attr( $rating['colors']['bgcolor1'] ); ?>;"><?php echo sprintf( $wp_review_rating_types[$rating['type']]['value_text'], $rating['value'] ); ?></div>
25
+ </div>
26
+ </div><!-- .review-percentage -->
rating-types/point-input.js ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
2
+ $('.wp-review-user-rating-point, .wp-review-comment-rating-point').each(function(index, el) {
3
+ var $rating_wrapper = $(this);
4
+
5
+ $rating_wrapper.find('.review-result').each(function() {
6
+ var $this = $(this);
7
+ $this.closest('.review-result-wrapper').data('originalwidth', $this[0].style.width);
8
+ });
9
+
10
+ $rating_wrapper.find('.review-result-wrapper').click(function(e) {
11
+ var $this = $(this);
12
+ var offset = $this.offset().left;
13
+ var width = ( ( ( e.pageX - offset ) / $this.width() ) * 100 ).toFixed();
14
+
15
+ // snap to nearest 5
16
+ var width_snapped = Math.round(width / 5) * 5;
17
+
18
+ // no 0-star ratings allowed
19
+ if (width_snapped == 0)
20
+ width_snapped = 5;
21
+
22
+ $this.find('.review-result').width(width_snapped + '%');
23
+ $this.data('originalrating', ( width_snapped / 10 ) );
24
+ $this.data('originalwidth', $this.find('.review-result')[0].style.width);
25
+
26
+ $rating_wrapper.addClass('wp-review-input-set');
27
+
28
+ // set input value
29
+ $rating_wrapper.find('.wp-review-user-rating-val').val( width_snapped / 10 );
30
+
31
+ wp_review_rate( $rating_wrapper );
32
+ }).on('mouseenter mousemove', function(e) {
33
+ var $this = $(this);
34
+ var offset = $this.offset().left;
35
+ var width = ( ( ( e.pageX - offset ) / $this.width() ) * 100 ).toFixed();
36
+
37
+ // snap to nearest 0.5
38
+ var width_snapped = Math.round(width / 5) * 5;
39
+
40
+ // no 0-star ratings allowed
41
+ if (width_snapped == 0)
42
+ width_snapped = 5;
43
+
44
+ $this.find('.review-result').width(width + '%');
45
+
46
+ $rating_wrapper.find('.wp-review-your-rating').css('left', width + '%').find('.wp-review-your-rating-value').css('left', width_snapped + '%').text(''+(width_snapped/10)+'/10');
47
+
48
+ }).on('mouseleave', function(e){
49
+ var $this = $(this);
50
+ var originalwidth = $this.data('originalwidth');
51
+ $this.find('.review-result').width(originalwidth);
52
+ $rating_wrapper.find('.wp-review-your-rating').css('left', originalwidth);
53
+ $rating_wrapper.find('.wp-review-your-rating-value').text($this.data('originalrating')+'/10');
54
+ });
55
+ });
56
+ });
rating-types/point-input.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Star rating type output template
4
+ *
5
+ * @since 2.0
6
+ * @copyright Copyright (c) 2013, MyThemesShop
7
+ * @author MyThemesShop
8
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9
+ */
10
+
11
+ // Exit if accessed directly
12
+ if ( ! defined( 'ABSPATH' ) ) exit;
13
+
14
+ // For now, enqueue in footer
15
+ wp_enqueue_script( 'wp-review-point-input', trailingslashit( WP_REVIEW_URI ) . 'rating-types/point-input.js', array( 'jquery' ) );
16
+
17
+ $class = 'review-point';
18
+ if (!empty($rating['args']['class']))
19
+ $class .= ' '.sanitize_html_class( $rating['args']['class'] );
20
+
21
+ ?>
22
+ <div class="<?php echo $class; ?>">
23
+ <div class="wp-review-loading-msg"><span class="animate-spin mts-icon-loader"></span><?php _e( 'Sending', 'wp-review' ); ?></div>
24
+ <div class="review-result-wrapper" data-originalrating="<?php echo esc_attr( $rating['value'] ); ?>">
25
+ <div class="review-result" style="width:<?php echo esc_attr( $rating['value'] * 10 ); ?>%; background-color: <?php echo esc_attr( $rating['color'] ); ?>;"></div>
26
+ </div>
27
+ <div class="wp-review-your-rating" style="background-color: <?php echo esc_attr( $rating['colors']['bgcolor1'] ); ?>; color: <?php echo esc_attr( $rating['color'] ); ?>;"><?php printf(__('Your rating: %s', 'wp-review'), '<span class="wp-review-your-rating-value"></span>'); ?></div>
28
+
29
+ <input type="hidden" class="wp-review-user-rating-val" name="wp-review-user-rating-val" value="<?php echo esc_attr( $rating['value'] ); ?>" />
30
+ <input type="hidden" class="wp-review-user-rating-nonce" value="<?php echo esc_attr( wp_create_nonce( 'wp-review-security' ) ); ?>" />
31
+ <input type="hidden" class="wp-review-user-rating-postid" value="<?php echo esc_attr( $rating['post_id'] ); ?>" />
32
+ </div>
rating-types/point-output.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Star rating type output template
4
+ *
5
+ * @since 2.0
6
+ * @copyright Copyright (c) 2013, MyThemesShop
7
+ * @author MyThemesShop
8
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9
+ */
10
+
11
+ // Exit if accessed directly
12
+ if ( ! defined( 'ABSPATH' ) ) exit;
13
+
14
+ global $wp_review_rating_types;
15
+
16
+ $class = 'review-point';
17
+ if (!empty($rating['args']['class']))
18
+ $class .= ' '.sanitize_html_class( $rating['args']['class'] );
19
+
20
+ ?>
21
+ <div class="<?php echo $class; ?>">
22
+ <div class="review-result-wrapper">
23
+ <div class="review-result" style="width:<?php echo esc_attr( $rating['value'] * 10 ); ?>%; background-color: <?php echo esc_attr( $rating['color'] ); ?>;"></div>
24
+ <div class="review-result-text" style="color: <?php echo esc_attr( $rating['colors']['bgcolor1'] ); ?>;"><?php echo sprintf( $wp_review_rating_types[$rating['type']]['value_text'], $rating['value'] ); ?></div>
25
+ </div>
26
+ </div><!-- .review-percentage -->
rating-types/star-input.js ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
2
+ $('.wp-review-user-rating-star, .wp-review-comment-rating-star').each(function(index, el) {
3
+ var $rating_wrapper = $(this);
4
+
5
+ $rating_wrapper.find('.review-result-wrapper > span').click(function(event) {
6
+ var stars = $(this).data('input-value');
7
+ $rating_wrapper.find('.review-result').css('width', '' + ( 20 * stars ) + '%');
8
+ $rating_wrapper.find('.wp-review-user-rating-val').val( stars );
9
+
10
+ wp_review_rate( $rating_wrapper );
11
+ });
12
+ });
13
+ });
rating-types/star-input.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Star rating type output template
4
+ *
5
+ * @since 2.0
6
+ * @copyright Copyright (c) 2013, MyThemesShop
7
+ * @author MyThemesShop
8
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9
+ */
10
+
11
+ // Exit if accessed directly
12
+ if ( ! defined( 'ABSPATH' ) ) exit;
13
+
14
+ // For now, enqueue in footer
15
+ wp_enqueue_script( 'wp-review-star-input', trailingslashit( WP_REVIEW_URI ) . 'rating-types/star-input.js', array( 'jquery' ) );
16
+
17
+ $class = '';
18
+ if (!empty($rating['args']['class']))
19
+ $class .= sanitize_html_class( $rating['args']['class'] );
20
+
21
+ ?>
22
+ <div class="review-total-star <?php echo $class; ?>" data-post-id="<?php echo esc_attr( $rating['post_id'] ); ?>" data-token="<?php echo esc_attr( wp_create_nonce( 'wp-review-security' ) ); ?>">
23
+ <div class="wp-review-loading-msg"><span class="animate-spin mts-icon-loader"></span><?php _e( 'Sending', 'wp-review' ); ?></div>
24
+ <div class="review-result-wrapper">
25
+ <span data-input-value="1" title="1/5"><i class="mts-icon-star"></i></span>
26
+ <span data-input-value="2" title="2/5"><i class="mts-icon-star"></i></span>
27
+ <span data-input-value="3" title="3/5"><i class="mts-icon-star"></i></span>
28
+ <span data-input-value="4" title="4/5"><i class="mts-icon-star"></i></span>
29
+ <span data-input-value="5" title="5/5"><i class="mts-icon-star"></i></span>
30
+ <div class="review-result" style="width:<?php echo esc_attr( $rating['value'] * 20 ); ?>%;">
31
+ <i class="mts-icon-star"></i>
32
+ <i class="mts-icon-star"></i>
33
+ <i class="mts-icon-star"></i>
34
+ <i class="mts-icon-star"></i>
35
+ <i class="mts-icon-star"></i>
36
+ </div>
37
+ </div>
38
+ <input type="hidden" class="wp-review-user-rating-val" name="wp-review-user-rating-val" value="<?php echo esc_attr( $rating['value'] ); ?>" />
39
+ <input type="hidden" class="wp-review-user-rating-nonce" value="<?php echo esc_attr( wp_create_nonce( 'wp-review-security' ) ); ?>" />
40
+ <input type="hidden" class="wp-review-user-rating-postid" value="<?php echo esc_attr( $rating['post_id'] ); ?>" />
41
+ </div>
42
+
43
+ <?php
44
+ $color_output = <<<EOD
45
+
46
+ <style type="text/css">
47
+ .wp-review-{$rating['post_id']} .review-result-wrapper .review-result i { color: {$rating['color']}; opacity: 1; filter: alpha(opacity=100); }
48
+ .wp-review-{$rating['post_id']} .review-result-wrapper i { color: {$rating['color']}; opacity: 0.50; filter: alpha(opacity=50); }
49
+ .wp-review-{$rating['post_id']} .mts-user-review-star-container .selected i, .wp-review-{$rating['post_id']} .user-review-area .review-result i { color: {$rating['color']}; opacity: 1; filter: alpha(opacity=100); }
50
+ </style>
51
+
52
+ EOD;
53
+
54
+ echo $color_output;
rating-types/star-output.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Star rating type output template
4
+ *
5
+ * @since 2.0
6
+ * @copyright Copyright (c) 2013, MyThemesShop
7
+ * @author MyThemesShop
8
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9
+ */
10
+
11
+ // Exit if accessed directly
12
+ if ( ! defined( 'ABSPATH' ) ) exit;
13
+
14
+ $class = 'review-star';
15
+ if (!empty($rating['args']['class']))
16
+ $class .= ' '.sanitize_html_class( $rating['args']['class'] );
17
+
18
+ ?>
19
+ <div class="<?php echo $class; ?>">
20
+ <div class="review-result-wrapper">
21
+ <i class="mts-icon-star"></i>
22
+ <i class="mts-icon-star"></i>
23
+ <i class="mts-icon-star"></i>
24
+ <i class="mts-icon-star"></i>
25
+ <i class="mts-icon-star"></i>
26
+ <div class="review-result" style="width:<?php echo ( $rating['value'] * 20 ); ?>%; color:<?php echo $rating['color']; ?>;">
27
+ <i class="mts-icon-star"></i>
28
+ <i class="mts-icon-star"></i>
29
+ <i class="mts-icon-star"></i>
30
+ <i class="mts-icon-star"></i>
31
+ <i class="mts-icon-star"></i>
32
+ </div><!-- .review-result -->
33
+ </div><!-- .review-result-wrapper -->
34
+ </div><!-- .review-star -->
readme.txt CHANGED
@@ -4,7 +4,7 @@ Creator's website link: http://mythemeshop.com/plugins/wp-review/
4
  Tags: review, wp review, rating, wp rating, user rating, google rating, star rating, product review
5
  Requires at least: 3.0.1
6
  Tested up to: 4.4
7
- Stable tag: 3.3.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -101,6 +101,25 @@ Please disable all plugins and check if rating is working properly. Then you can
101
 
102
  == Changelog ==
103
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  = 3.3.5 =
105
  * Fixed spelling mistake in notification
106
 
4
  Tags: review, wp review, rating, wp rating, user rating, google rating, star rating, product review
5
  Requires at least: 3.0.1
6
  Tested up to: 4.4
7
+ Stable tag: 4.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
101
 
102
  == Changelog ==
103
 
104
+ = 4.0.2 =
105
+ * Added back missing Widget Title field
106
+
107
+ = 4.0.1 =
108
+ * Replaced anonymous functions for compatibility with older PHP versions
109
+ * Added optional backlink (an option to disable it can be found on the plugin settings page)
110
+ * Removed unneeded Review Links metabox
111
+
112
+ = 4.0 =
113
+ * Huge code improvement and optimization
114
+ * Choose any rating type for user reviews (user reviews were restricted to stars before)
115
+ * View and edit user ratings from the WordPress dashbaord
116
+ * Added Drag & Drop for Review Items
117
+ * Added Rating Column on 'Posts' page
118
+ * For developers: Review box templates - Create custom review box templates
119
+ * For developers: Rating type templates - Create custom rating types
120
+ * Various bug fixes and improvements
121
+ * NOTE: After updating the plugin, existing user ratings must be migrated in Settings > WP Review Pro > Migrate Ratings
122
+
123
  = 3.3.5 =
124
  * Fixed spelling mistake in notification
125
 
wp-review.php CHANGED
@@ -1,116 +1,119 @@
1
- <?php
2
- /**
3
- * Plugin Name: WP Review
4
- * Plugin URI: http://mythemeshop.com/plugins/wp-review/
5
- * Description: Create reviews! Choose from stars, percentages or points for review scores. Supports Retina Display, WPMU and Unlimited Color Schemes.
6
- * Version: 3.3.5
7
- * Author: MyThemesShop
8
- * Author URI: http://mythemeshop.com/
9
- *
10
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
11
- * General Public License version 2, as published by the Free Software Foundation. You may NOT assume
12
- * that you can use any other version of the GPL.
13
- *
14
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
15
- * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
- *
17
- * @since 1.0
18
- * @copyright Copyright (c) 2013, MyThemesShop
19
- * @author MyThemesShop
20
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21
- */
22
-
23
- // Exit if accessed directly
24
- if ( ! defined( 'ABSPATH' ) ) exit;
25
- // WP Review activated?
26
- if ( ! defined( 'MTS_WP_REVIEW_DB_TABLE' ) ) {
27
-
28
- /* Plugin version */
29
- define( 'WP_REVIEW_PLUGIN_VERSION', '3.3.5' );
30
-
31
- /* Sets the custom db table name. */
32
- define( 'MTS_WP_REVIEW_DB_TABLE', 'mts_wp_reviews' );
33
-
34
- /* When plugin is activated */
35
- register_activation_hook( __FILE__, 'wp_review_activation' );
36
-
37
-
38
- /* Defines constants used by the plugin. */
39
- add_action( 'plugins_loaded', 'wp_review_constants', 1 );
40
-
41
- /* Internationalize the text strings used. */
42
- add_action( 'plugins_loaded', 'wp_review_i18n', 2 );
43
-
44
- /* Loads libraries. */
45
- add_action( 'plugins_loaded', 'wp_review_includes_libraries', 3 );
46
-
47
- /**
48
- * Defines constants.
49
- *
50
- * @since 1.0
51
- */
52
- function wp_review_constants() {
53
-
54
- /* Sets the path to the plugin directory. */
55
- define( 'WP_REVIEW_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
56
-
57
- /* Sets the path to the plugin directory URI. */
58
- define( 'WP_REVIEW_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );
59
-
60
- /* Sets the path to the `admin` directory. */
61
- define( 'WP_REVIEW_ADMIN', WP_REVIEW_DIR . trailingslashit( 'admin' ) );
62
-
63
- /* Sets the path to the `includes` directory. */
64
- define( 'WP_REVIEW_INCLUDES', WP_REVIEW_DIR . trailingslashit( 'includes' ) );
65
-
66
- /* Sets the path to the `assets` directory. */
67
- define( 'WP_REVIEW_ASSETS', WP_REVIEW_URI . trailingslashit( 'assets' ) );
68
-
69
- /* Sets plugin base 'directory/file.php' */
70
- define( 'WP_REVIEW_PLUGIN_BASE', plugin_basename(__FILE__) );
71
-
72
- }
73
-
74
- /**
75
- * Internationalize the text strings used.
76
- *
77
- * @since 1.0
78
- */
79
- function wp_review_i18n() {
80
- load_plugin_textdomain( 'wp-review', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
81
- }
82
-
83
- /**
84
- * Loads the initial files needed by the plugin.
85
- *
86
- * @since 1.0
87
- */
88
- function wp_review_includes_libraries() {
89
-
90
- /* Loads the admin functions. */
91
- require_once( WP_REVIEW_ADMIN . 'admin.php' );
92
-
93
- /* Loads the meta boxes. */
94
- require_once( WP_REVIEW_ADMIN . 'metaboxes.php' );
95
-
96
- /* Loads the front-end functions. */
97
- require_once( WP_REVIEW_INCLUDES . 'functions.php' );
98
-
99
- /* Loads the widget. */
100
- require_once( WP_REVIEW_INCLUDES . 'widget.php' );
101
-
102
- /* Loads the enqueue functions. */
103
- require_once( WP_REVIEW_INCLUDES . 'enqueue.php' );
104
-
105
- /* Loads the settings page. */
106
- require_once( WP_REVIEW_ADMIN . 'options.php' );
107
-
108
- }
109
-
110
- function wp_review_activation(){
111
- /* Loads activation functions */
112
- //require_once( plugin_dir_path( __FILE__ ) . '/includes/functions.php' );
113
- require_once( plugin_dir_path( __FILE__ ) . '/admin/activation.php' );
114
- }
115
- }
 
 
 
116
  ?>
1
+ <?php
2
+ /**
3
+ * Plugin Name: WP Review
4
+ * Plugin URI: http://mythemeshop.com/plugins/wp-review/
5
+ * Description: Create reviews! Choose from stars, percentages or points for review scores. Supports Retina Display, WPMU and Unlimited Color Schemes.
6
+ * Version: 4.0.2
7
+ * Author: MyThemesShop
8
+ * Author URI: http://mythemeshop.com/
9
+ *
10
+ * @since 1.0
11
+ * @copyright Copyright (c) 2013, MyThemesShop
12
+ * @author MyThemesShop
13
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
14
+ */
15
+
16
+ // Exit if accessed directly
17
+ if ( ! defined( 'ABSPATH' ) ) exit;
18
+
19
+ // WP Review Pro activated?
20
+ if ( ! defined( 'MTS_WP_REVIEW_DB_TABLE' )) {
21
+
22
+ /* Plugin version */
23
+ define( 'WP_REVIEW_PLUGIN_VERSION', '3.3.5' );
24
+
25
+ /* Sets the custom db table name. */
26
+ define( 'MTS_WP_REVIEW_DB_TABLE', 'mts_wp_reviews' );
27
+
28
+ /* When plugin is activated */
29
+ register_activation_hook( __FILE__, 'wp_review_activation' );
30
+
31
+ /* Defines constants used by the plugin. */
32
+ add_action( 'plugins_loaded', 'wp_review_constants', 1 );
33
+
34
+ /* Internationalize the text strings used. */
35
+ add_action( 'plugins_loaded', 'wp_review_i18n', 2 );
36
+
37
+ /* Loads libraries. */
38
+ add_action( 'plugins_loaded', 'wp_review_includes_libraries', 3 );
39
+
40
+ /**
41
+ * Defines constants.
42
+ *
43
+ * @since 1.0
44
+ */
45
+ function wp_review_constants() {
46
+
47
+ /* Sets the path to the plugin directory. */
48
+ define( 'WP_REVIEW_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
49
+
50
+ /* Sets the path to the plugin directory URI. */
51
+ define( 'WP_REVIEW_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );
52
+
53
+ /* Sets the path to the `admin` directory. */
54
+ define( 'WP_REVIEW_ADMIN', WP_REVIEW_DIR . trailingslashit( 'admin' ) );
55
+
56
+ /* Sets the path to the `includes` directory. */
57
+ define( 'WP_REVIEW_INCLUDES', WP_REVIEW_DIR . trailingslashit( 'includes' ) );
58
+
59
+ /* Sets the path to the `assets` directory. */
60
+ define( 'WP_REVIEW_ASSETS', WP_REVIEW_URI . trailingslashit( 'assets' ) );
61
+
62
+ /* Sets plugin base 'directory/file.php' */
63
+ define( 'WP_REVIEW_PLUGIN_BASE', plugin_basename(__FILE__) );
64
+
65
+ define( 'WP_REVIEW_COMMENT_TYPE_VISITOR', 'wp_review_visitor' );
66
+
67
+ define( 'WP_REVIEW_VISITOR_RATING_METAKEY', 'wp_review_visitor_rating' );
68
+
69
+ /* Keys for user review permissions */
70
+ define( 'WP_REVIEW_REVIEW_DISABLED', '0' );
71
+ define( 'WP_REVIEW_REVIEW_VISITOR_ONLY', '2' );
72
+
73
+ }
74
+
75
+ /**
76
+ * Internationalize the text strings used.
77
+ *
78
+ * @since 1.0
79
+ */
80
+ function wp_review_i18n() {
81
+ load_plugin_textdomain( 'wp-review', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
82
+ }
83
+
84
+ /**
85
+ * Loads the initial files needed by the plugin.
86
+ *
87
+ * @since 1.0
88
+ */
89
+ function wp_review_includes_libraries() {
90
+
91
+ /* Loads the admin functions. */
92
+ require_once( WP_REVIEW_ADMIN . 'admin.php' );
93
+
94
+ /* Loads the meta boxes. */
95
+ require_once( WP_REVIEW_ADMIN . 'metaboxes.php' );
96
+
97
+ /* Loads the front-end functions. */
98
+ require_once( WP_REVIEW_INCLUDES . 'functions.php' );
99
+
100
+ /* Loads the widget. */
101
+ require_once( WP_REVIEW_INCLUDES . 'widget.php' );
102
+
103
+ /* Loads the enqueue functions. */
104
+ require_once( WP_REVIEW_INCLUDES . 'enqueue.php' );
105
+
106
+ /* Loads the settings page. */
107
+ require_once( WP_REVIEW_ADMIN . 'options.php' );
108
+
109
+ }
110
+
111
+ function wp_review_activation(){
112
+ /* Loads activation functions */
113
+ //require_once( plugin_dir_path( __FILE__ ) . '/includes/functions.php' );
114
+ require_once( plugin_dir_path( __FILE__ ) . '/admin/activation.php' );
115
+ }
116
+
117
+ }
118
+
119
  ?>