WP Review - Version 4.0.13

Version Description

Download this release

Release Info

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

Code changes from version 4.0.12 to 4.0.13

admin/activation.php CHANGED
@@ -1 +1 @@
1
- <?php // SILENCE IS GOLDEN.
1
+ <?php // SILENCE IS GOLDEN.
admin/admin.php CHANGED
@@ -1,78 +1,78 @@
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
- add_action( 'wp_ajax_wpreview_rated', 'wp_review_rated_ajax', 10 );
15
- add_filter( 'admin_footer_text', 'wp_review_admin_footer_text', 10 );
16
-
17
- /**
18
- * Register custom style for the meta box.
19
- *
20
- * @since 1.0
21
- */
22
- function wp_review_admin_style( $hook_suffix ) {
23
- wp_enqueue_style( 'wp-review-admin-style', WP_REVIEW_ASSETS . 'css/admin.css', array( 'wp-color-picker' ) );
24
- wp_enqueue_script(
25
- 'wp-review-admin-script',
26
- WP_REVIEW_ASSETS . 'js/admin.js',
27
- array( 'wp-color-picker', 'jquery', 'jquery-ui-core', 'jquery-ui-slider', 'jquery-ui-sortable' ),
28
- false,
29
- true
30
- );
31
-
32
- wp_enqueue_style(
33
- 'wp-review-admin-ui-css',
34
- '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/smoothness/jquery-ui.css',
35
- false,
36
- null,
37
- false
38
- );
39
-
40
- // Load frontend css but not on the post editor screen
41
- if ( stripos('post.php', $hook_suffix) === false ) {
42
- wp_enqueue_style( 'wp_review-style', trailingslashit( WP_REVIEW_ASSETS ) . 'css/wp-review.css', array(), WP_REVIEW_PLUGIN_VERSION, 'all' );
43
- }
44
- }
45
-
46
- function wp_review_admin_footer_text( $footer_text ) {
47
- $current_screen = get_current_screen();
48
-
49
- $post_types = get_post_types( array('public' => true), 'names' );
50
- $excluded_post_types = apply_filters('wp_review_excluded_post_types', array('attachment'));
51
- $allowed_post_types = array_diff($post_types, $excluded_post_types);
52
-
53
- // Check to make sure we're on a Review Editing page
54
- if ( ( isset( $current_screen->id ) && strpos($current_screen->id, 'wp-review') !== false ) ||
55
- ( isset( $current_screen->action ) && $current_screen->action == 'add' && in_array( $current_screen->id, $allowed_post_types ) ) ||
56
- ( isset( $_GET['action'] ) && $_GET['action'] == 'edit' && in_array( $current_screen->id, $allowed_post_types ) ) ) {
57
- // Change the footer text
58
- if ( ! get_option( 'wpreview_admin_footer_text_rated' ) ) {
59
- $footer_text = sprintf( __( 'If you like <strong>WP Review</strong> please leave us a %s rating. A huge thank you from MyThemeShop in advance!', 'woocommerce' ), '<a href="https://wordpress.org/support/view/plugin-reviews/wp-review?filter=5" target="_blank" class="wpreview-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'wp-review' ) . '"><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span></a>' );
60
- $footer_text .= "
61
- <script type=\"text/javascript\">
62
- jQuery( 'a.wpreview-rating-link' ).click( function() {
63
- jQuery.post( ajaxurl, { action: 'wpreview_rated' } );
64
- jQuery( this ).parent().text( jQuery( this ).data( 'rated' ) );
65
- });
66
- </script>
67
- ";
68
- } else {
69
- //$footer_text = __( 'Thank you for using WP Review.', 'wp-review' );
70
- }
71
- }
72
-
73
- return $footer_text;
74
- }
75
-
76
- function wp_review_rated_ajax() {
77
- update_option( 'wpreview_admin_footer_text_rated', '1' );
78
  }
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
+ add_action( 'wp_ajax_wpreview_rated', 'wp_review_rated_ajax', 10 );
15
+ add_filter( 'admin_footer_text', 'wp_review_admin_footer_text', 10 );
16
+
17
+ /**
18
+ * Register custom style for the meta box.
19
+ *
20
+ * @since 1.0
21
+ */
22
+ function wp_review_admin_style( $hook_suffix ) {
23
+ wp_enqueue_style( 'wp-review-admin-style', WP_REVIEW_ASSETS . 'css/admin.css', array( 'wp-color-picker' ) );
24
+ wp_enqueue_script(
25
+ 'wp-review-admin-script',
26
+ WP_REVIEW_ASSETS . 'js/admin.js',
27
+ array( 'wp-color-picker', 'jquery', 'jquery-ui-core', 'jquery-ui-slider', 'jquery-ui-sortable' ),
28
+ false,
29
+ true
30
+ );
31
+
32
+ wp_enqueue_style(
33
+ 'wp-review-admin-ui-css',
34
+ '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/smoothness/jquery-ui.css',
35
+ false,
36
+ null,
37
+ false
38
+ );
39
+
40
+ // Load frontend css but not on the post editor screen
41
+ if ( stripos('post.php', $hook_suffix) === false ) {
42
+ wp_enqueue_style( 'wp_review-style', trailingslashit( WP_REVIEW_ASSETS ) . 'css/wp-review.css', array(), WP_REVIEW_PLUGIN_VERSION, 'all' );
43
+ }
44
+ }
45
+
46
+ function wp_review_admin_footer_text( $footer_text ) {
47
+ $current_screen = get_current_screen();
48
+
49
+ $post_types = get_post_types( array('public' => true), 'names' );
50
+ $excluded_post_types = apply_filters('wp_review_excluded_post_types', array('attachment'));
51
+ $allowed_post_types = array_diff($post_types, $excluded_post_types);
52
+
53
+ // Check to make sure we're on a Review Editing page
54
+ if ( ( isset( $current_screen->id ) && strpos($current_screen->id, 'wp-review') !== false ) ||
55
+ ( isset( $current_screen->action ) && $current_screen->action == 'add' && in_array( $current_screen->id, $allowed_post_types ) ) ||
56
+ ( isset( $_GET['action'] ) && $_GET['action'] == 'edit' && in_array( $current_screen->id, $allowed_post_types ) ) ) {
57
+ // Change the footer text
58
+ if ( ! get_option( 'wpreview_admin_footer_text_rated' ) ) {
59
+ $footer_text = sprintf( __( 'If you like <strong>WP Review</strong> please leave us a %s rating. A huge thank you from MyThemeShop in advance!', 'woocommerce' ), '<a href="https://wordpress.org/support/view/plugin-reviews/wp-review?filter=5" target="_blank" class="wpreview-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'wp-review' ) . '"><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span></a>' );
60
+ $footer_text .= "
61
+ <script type=\"text/javascript\">
62
+ jQuery( 'a.wpreview-rating-link' ).click( function() {
63
+ jQuery.post( ajaxurl, { action: 'wpreview_rated' } );
64
+ jQuery( this ).parent().text( jQuery( this ).data( 'rated' ) );
65
+ });
66
+ </script>
67
+ ";
68
+ } else {
69
+ //$footer_text = __( 'Thank you for using WP Review.', 'wp-review' );
70
+ }
71
+ }
72
+
73
+ return $footer_text;
74
+ }
75
+
76
+ function wp_review_rated_ajax() {
77
+ update_option( 'wpreview_admin_footer_text_rated', '1' );
78
  }
admin/metaboxes.php CHANGED
@@ -1,499 +1,499 @@
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 ( empty( $_POST['wp_review_type'] ) ) {
386
- return;
387
- }
388
-
389
- /* If this is an autosave, our form has not been submitted, so we don't want to do anything. */
390
- if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
391
- return $post_id;
392
-
393
- /* Check the user's permissions. */
394
- if ( 'page' == $_POST['post_type'] ) {
395
- if ( ! current_user_can( 'edit_page', $post_id ) )
396
- return $post_id;
397
- } else {
398
- if ( ! current_user_can( 'edit_post', $post_id ) )
399
- return $post_id;
400
- }
401
-
402
- $meta = array(
403
- 'wp_review_custom_location' => filter_input( INPUT_POST, 'wp_review_custom_location', FILTER_SANITIZE_STRING ),
404
- 'wp_review_custom_colors' => filter_input( INPUT_POST, 'wp_review_custom_colors', FILTER_SANITIZE_STRING ),
405
- 'wp_review_custom_width' => filter_input( INPUT_POST, 'wp_review_custom_width', FILTER_SANITIZE_STRING ),
406
- 'wp_review_custom_author' => filter_input( INPUT_POST, 'wp_review_custom_author', FILTER_SANITIZE_STRING ),
407
- 'wp_review_location' => filter_input( INPUT_POST, 'wp_review_location', FILTER_SANITIZE_STRING ),
408
- 'wp_review_type' => filter_input( INPUT_POST, 'wp_review_type', FILTER_SANITIZE_STRING ),
409
- 'wp_review_heading' => filter_input( INPUT_POST, 'wp_review_heading', FILTER_SANITIZE_STRING ),
410
- 'wp_review_desc_title' => filter_input( INPUT_POST, 'wp_review_desc_title', FILTER_SANITIZE_STRING ),
411
- 'wp_review_desc' => wp_kses_post( $_POST['wp_review_desc'] ),
412
- 'wp_review_hide_desc' => filter_input( INPUT_POST, 'wp_review_hide_desc', FILTER_SANITIZE_STRING ),
413
- 'wp_review_userReview' => filter_input( INPUT_POST, 'wp_review_userReview', FILTER_SANITIZE_STRING ),
414
- 'wp_review_total' => filter_input( INPUT_POST, 'wp_review_total', FILTER_SANITIZE_STRING ),
415
- 'wp_review_color' => filter_input( INPUT_POST, 'wp_review_color', FILTER_SANITIZE_STRING ),
416
- 'wp_review_fontcolor' => filter_input( INPUT_POST, 'wp_review_fontcolor', FILTER_SANITIZE_STRING ),
417
- 'wp_review_bgcolor1' => filter_input( INPUT_POST, 'wp_review_bgcolor1', FILTER_SANITIZE_STRING ),
418
- 'wp_review_bgcolor2' => filter_input( INPUT_POST, 'wp_review_bgcolor2', FILTER_SANITIZE_STRING ),
419
- 'wp_review_bordercolor' => filter_input( INPUT_POST, 'wp_review_bordercolor', FILTER_SANITIZE_STRING ),
420
- 'wp_review_width' => filter_input( INPUT_POST, 'wp_review_width', FILTER_SANITIZE_STRING ),
421
- 'wp_review_align' => filter_input( INPUT_POST, 'wp_review_align', FILTER_SANITIZE_STRING ),
422
- 'wp_review_author' => filter_input( INPUT_POST, 'wp_review_author', FILTER_SANITIZE_STRING ),
423
- 'wp_review_schema' => filter_input( INPUT_POST, 'wp_review_schema', FILTER_SANITIZE_STRING ),
424
- 'wp_review_user_review_type' => filter_input( INPUT_POST, 'wp_review_user_review_type', FILTER_SANITIZE_STRING ),
425
- );
426
-
427
- foreach ( $meta as $meta_key => $new_meta_value ) {
428
-
429
- /* Get the meta value of the custom field key. */
430
- $meta_value = get_post_meta( $post_id, $meta_key, true );
431
-
432
- /* If there is no new meta value but an old value exists, delete it. */
433
- if ( current_user_can( 'delete_post_meta', $post_id, $meta_key ) && empty( $new_meta_value ) && $meta_value )
434
- delete_post_meta( $post_id, $meta_key, $meta_value );
435
-
436
- /* If a new meta value was added and there was no previous value, add it. */
437
- elseif ( current_user_can( 'add_post_meta', $post_id, $meta_key ) && ($new_meta_value || $new_meta_value === '0') && '' == $meta_value )
438
- add_post_meta( $post_id, $meta_key, $new_meta_value, true );
439
-
440
- /* If the new meta value does not match the old value, update it. */
441
- elseif ( current_user_can( 'edit_post_meta', $post_id, $meta_key ) && ($new_meta_value || $new_meta_value === '0') && $new_meta_value != $meta_value )
442
- update_post_meta( $post_id, $meta_key, $new_meta_value );
443
- }
444
-
445
- /* Repeatable update and delete meta fields method. */
446
- $title = $_POST['wp_review_item_title'];
447
- $star = $_POST['wp_review_item_star'];
448
-
449
- $old = get_post_meta( $post_id, 'wp_review_item', true );
450
- $new = array();
451
-
452
- $count = count( $title );
453
-
454
- for ( $i = 0; $i < $count; $i++ ) {
455
- if ( $title[$i] != '' )
456
- $new[$i]['wp_review_item_title'] = sanitize_text_field( $title[$i] );
457
- if ( $star[$i] != '' )
458
- $new[$i]['wp_review_item_star'] = sanitize_text_field( $star[$i] );
459
- }
460
-
461
- if ( !empty( $new ) && $new != $old )
462
- update_post_meta( $post_id, 'wp_review_item', $new );
463
- elseif ( empty($new) && $old )
464
- delete_post_meta( $post_id, 'wp_review_item', $old );
465
-
466
- /**
467
- * Delete all data when switched to 'No Review' type.
468
- */
469
- $type = $meta['wp_review_type'];//get_post_meta( $post_id, 'wp_review_type', true );
470
- if ( $type == '' ) {
471
- delete_post_meta( $post_id, 'wp_review_desc', $_POST['wp_review_desc'] );
472
- delete_post_meta( $post_id, 'wp_review_heading', $_POST['wp_review_heading'] );
473
- delete_post_meta( $post_id, 'wp_review_userReview', $_POST['wp_review_userReview'] );
474
- delete_post_meta( $post_id, 'wp_review_item', $old );
475
- }
476
-
477
- }
478
-
479
- // Fix for post previews
480
- // with this code, the review meta data will actually get saved on Preview
481
- add_filter('_wp_post_revision_fields', 'add_field_debug_preview');
482
- function add_field_debug_preview($fields){
483
- $fields["debug_preview"] = "debug_preview";
484
- return $fields;
485
- }
486
- add_action( 'edit_form_after_title', 'add_input_debug_preview' );
487
- function add_input_debug_preview() {
488
- echo '<input type="hidden" name="debug_preview" value="debug_preview">';
489
- }
490
-
491
- function wp_review_default_schema_types( $types ) {
492
- $default = array(
493
- 'Thing' => __( 'Thing (Default)', 'wp-review' ),
494
- );
495
-
496
- return array_merge( $types, $default );
497
- }
498
- add_filter( 'wp_review_schema_types', 'wp_review_default_schema_types' );
499
- ?>
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 ( !isset( $_POST['wp_review_type'] ) ) {
386
+ return;
387
+ }
388
+
389
+ /* If this is an autosave, our form has not been submitted, so we don't want to do anything. */
390
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
391
+ return $post_id;
392
+
393
+ /* Check the user's permissions. */
394
+ if ( 'page' == $_POST['post_type'] ) {
395
+ if ( ! current_user_can( 'edit_page', $post_id ) )
396
+ return $post_id;
397
+ } else {
398
+ if ( ! current_user_can( 'edit_post', $post_id ) )
399
+ return $post_id;
400
+ }
401
+
402
+ $meta = array(
403
+ 'wp_review_custom_location' => filter_input( INPUT_POST, 'wp_review_custom_location', FILTER_SANITIZE_STRING ),
404
+ 'wp_review_custom_colors' => filter_input( INPUT_POST, 'wp_review_custom_colors', FILTER_SANITIZE_STRING ),
405
+ 'wp_review_custom_width' => filter_input( INPUT_POST, 'wp_review_custom_width', FILTER_SANITIZE_STRING ),
406
+ 'wp_review_custom_author' => filter_input( INPUT_POST, 'wp_review_custom_author', FILTER_SANITIZE_STRING ),
407
+ 'wp_review_location' => filter_input( INPUT_POST, 'wp_review_location', FILTER_SANITIZE_STRING ),
408
+ 'wp_review_type' => filter_input( INPUT_POST, 'wp_review_type', FILTER_SANITIZE_STRING ),
409
+ 'wp_review_heading' => filter_input( INPUT_POST, 'wp_review_heading', FILTER_SANITIZE_STRING ),
410
+ 'wp_review_desc_title' => filter_input( INPUT_POST, 'wp_review_desc_title', FILTER_SANITIZE_STRING ),
411
+ 'wp_review_desc' => wp_kses_post( $_POST['wp_review_desc'] ),
412
+ 'wp_review_hide_desc' => filter_input( INPUT_POST, 'wp_review_hide_desc', FILTER_SANITIZE_STRING ),
413
+ 'wp_review_userReview' => filter_input( INPUT_POST, 'wp_review_userReview', FILTER_SANITIZE_STRING ),
414
+ 'wp_review_total' => filter_input( INPUT_POST, 'wp_review_total', FILTER_SANITIZE_STRING ),
415
+ 'wp_review_color' => filter_input( INPUT_POST, 'wp_review_color', FILTER_SANITIZE_STRING ),
416
+ 'wp_review_fontcolor' => filter_input( INPUT_POST, 'wp_review_fontcolor', FILTER_SANITIZE_STRING ),
417
+ 'wp_review_bgcolor1' => filter_input( INPUT_POST, 'wp_review_bgcolor1', FILTER_SANITIZE_STRING ),
418
+ 'wp_review_bgcolor2' => filter_input( INPUT_POST, 'wp_review_bgcolor2', FILTER_SANITIZE_STRING ),
419
+ 'wp_review_bordercolor' => filter_input( INPUT_POST, 'wp_review_bordercolor', FILTER_SANITIZE_STRING ),
420
+ 'wp_review_width' => filter_input( INPUT_POST, 'wp_review_width', FILTER_SANITIZE_STRING ),
421
+ 'wp_review_align' => filter_input( INPUT_POST, 'wp_review_align', FILTER_SANITIZE_STRING ),
422
+ 'wp_review_author' => filter_input( INPUT_POST, 'wp_review_author', FILTER_SANITIZE_STRING ),
423
+ 'wp_review_schema' => filter_input( INPUT_POST, 'wp_review_schema', FILTER_SANITIZE_STRING ),
424
+ 'wp_review_user_review_type' => filter_input( INPUT_POST, 'wp_review_user_review_type', FILTER_SANITIZE_STRING ),
425
+ );
426
+
427
+ foreach ( $meta as $meta_key => $new_meta_value ) {
428
+
429
+ /* Get the meta value of the custom field key. */
430
+ $meta_value = get_post_meta( $post_id, $meta_key, true );
431
+
432
+ /* If there is no new meta value but an old value exists, delete it. */
433
+ if ( current_user_can( 'delete_post_meta', $post_id, $meta_key ) && empty( $new_meta_value ) && $meta_value )
434
+ delete_post_meta( $post_id, $meta_key, $meta_value );
435
+
436
+ /* If a new meta value was added and there was no previous value, add it. */
437
+ elseif ( current_user_can( 'add_post_meta', $post_id, $meta_key ) && ($new_meta_value || $new_meta_value === '0') && '' == $meta_value )
438
+ add_post_meta( $post_id, $meta_key, $new_meta_value, true );
439
+
440
+ /* If the new meta value does not match the old value, update it. */
441
+ elseif ( current_user_can( 'edit_post_meta', $post_id, $meta_key ) && ($new_meta_value || $new_meta_value === '0') && $new_meta_value != $meta_value )
442
+ update_post_meta( $post_id, $meta_key, $new_meta_value );
443
+ }
444
+
445
+ /* Repeatable update and delete meta fields method. */
446
+ $title = $_POST['wp_review_item_title'];
447
+ $star = $_POST['wp_review_item_star'];
448
+
449
+ $old = get_post_meta( $post_id, 'wp_review_item', true );
450
+ $new = array();
451
+
452
+ $count = count( $title );
453
+
454
+ for ( $i = 0; $i < $count; $i++ ) {
455
+ if ( $title[$i] != '' )
456
+ $new[$i]['wp_review_item_title'] = sanitize_text_field( $title[$i] );
457
+ if ( $star[$i] != '' )
458
+ $new[$i]['wp_review_item_star'] = sanitize_text_field( $star[$i] );
459
+ }
460
+
461
+ if ( !empty( $new ) && $new != $old )
462
+ update_post_meta( $post_id, 'wp_review_item', $new );
463
+ elseif ( empty($new) && $old )
464
+ delete_post_meta( $post_id, 'wp_review_item', $old );
465
+
466
+ /**
467
+ * Delete all data when switched to 'No Review' type.
468
+ */
469
+ $type = $meta['wp_review_type'];//get_post_meta( $post_id, 'wp_review_type', true );
470
+ if ( $type == '' ) {
471
+ delete_post_meta( $post_id, 'wp_review_desc', $_POST['wp_review_desc'] );
472
+ delete_post_meta( $post_id, 'wp_review_heading', $_POST['wp_review_heading'] );
473
+ delete_post_meta( $post_id, 'wp_review_userReview', $_POST['wp_review_userReview'] );
474
+ delete_post_meta( $post_id, 'wp_review_item', $old );
475
+ }
476
+
477
+ }
478
+
479
+ // Fix for post previews
480
+ // with this code, the review meta data will actually get saved on Preview
481
+ add_filter('_wp_post_revision_fields', 'add_field_debug_preview');
482
+ function add_field_debug_preview($fields){
483
+ $fields["debug_preview"] = "debug_preview";
484
+ return $fields;
485
+ }
486
+ add_action( 'edit_form_after_title', 'add_input_debug_preview' );
487
+ function add_input_debug_preview() {
488
+ echo '<input type="hidden" name="debug_preview" value="debug_preview">';
489
+ }
490
+
491
+ function wp_review_default_schema_types( $types ) {
492
+ $default = array(
493
+ 'Thing' => __( 'Thing (Default)', 'wp-review' ),
494
+ );
495
+
496
+ return array_merge( $types, $default );
497
+ }
498
+ add_filter( 'wp_review_schema_types', 'wp_review_default_schema_types' );
499
+ ?>
admin/options.php CHANGED
@@ -1,351 +1,351 @@
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')));
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
- 'last_tab' => 'styling',
47
- );
48
- // set defaults
49
- if (empty($options)) {
50
- update_option( 'wp_review_options', $options = $default_options );
51
- }
52
-
53
- $opt_name = 'wp_review_options_'.wp_get_theme();
54
- $options_updated = get_option( $opt_name );
55
- $suggest_theme_defaults = true;
56
- if (!empty($_GET['wp-review-theme-defaults']) && empty($_GET['settings-updated'])) {
57
- wp_review_theme_defaults($options_updated, true);
58
- $options = get_option('wp_review_options');
59
- $suggest_theme_defaults = false;
60
- }
61
- // test to see if we need to sugges setting theme defaults
62
- if (empty($options_updated)) $options_updated = array();
63
- $opts_tmp = array_merge($options, $options_updated);
64
- if ($opts_tmp == $options) $suggest_theme_defaults = false;
65
-
66
- // Migrate
67
- global $wpdb;
68
- $current_blog_id = get_current_blog_id();
69
- $total_rows = 0;
70
- $rows_left = 0;
71
- $migrated_rows = get_option( 'wp_review_migrated_rows', 0 );
72
- $has_migrated = get_option( 'wp_review_has_migrated', false );
73
- if ( ! $has_migrated && $wpdb->get_var("SHOW TABLES LIKE '{$wpdb->base_prefix}mts_wp_reviews'") == "{$wpdb->base_prefix}mts_wp_reviews") {
74
- // Table exists and not migrated (fully) yet
75
- $total_rows = $wpdb->get_var( 'SELECT COUNT(*) FROM '.$wpdb->base_prefix.'mts_wp_reviews WHERE blog_id = '.$current_blog_id );
76
- $rows_left = $total_rows - $migrated_rows;
77
- }
78
-
79
- ?>
80
- <div id="col-right" class="wrap wp-review" style="float: left; padding-right: 3%; box-sizing: border-box;">
81
- <h2><?php _e('WP Review Settings', 'wp-review'); ?></h2>
82
-
83
- <form method="post" action="options.php">
84
- <?php settings_fields( 'wpreview-settings-group' ); ?>
85
-
86
- <?php
87
-
88
- $defaultColors = apply_filters('wp_review_default_colors', array(
89
- 'color' => '#1e73be',
90
- 'fontcolor' => '#555555',
91
- 'bgcolor1' => '#e7e7e7',
92
- 'bgcolor2' => '#ffffff',
93
- 'bordercolor' => '#e7e7e7'
94
- ));
95
- $defaultLocation = apply_filters('wp_review_default_location', 'bottom');
96
-
97
- $defaultCriteria = apply_filters('wp_review_default_criteria', array());
98
- $defaultItems = array();
99
- foreach ($defaultCriteria as $item) {
100
- $defaultItems[] = array( 'wp_review_item_title' => $item, 'wp_review_item_star' => '');
101
- }
102
- $default_schema = empty( $options['default_schema_type'] ) ? $default_options['default_schema_type'] : $options['default_schema_type'];
103
- $default_user_review_type = empty( $options['default_user_review_type'] ) ? WP_REVIEW_REVIEW_DISABLED : $options['default_user_review_type'];
104
- $options['colors'] = apply_filters( 'wp_review_colors', $options['colors'], 0 );
105
- if (!isset($options['deafults'])) $options['deafults'] = array();
106
- /* Retrieve an existing value from the database. */
107
- $items = ! empty($options['default_features']) ? $options['default_features'] : '';
108
- $link_texts = ! empty( $options['default_link_text'] ) ? $options['default_link_text'] : array();
109
- $link_urls = ! empty( $options['default_link_url'] ) ? $options['default_link_url'] : array();
110
- $color = ! empty($options['colors']['color']) ? $options['colors']['color'] : '';
111
- $location = ! empty($options['review_location']) ? $options['review_location'] : '';
112
- $fontcolor = ! empty($options['colors']['fontcolor']) ? $options['colors']['fontcolor'] : '';
113
- $bgcolor1 = ! empty($options['colors']['bgcolor1']) ? $options['colors']['bgcolor1'] : '';
114
- $bgcolor2 = ! empty($options['colors']['bgcolor2']) ? $options['colors']['bgcolor2'] : '';
115
- $bordercolor = ! empty($options['colors']['bordercolor']) ? $options['colors']['bordercolor'] : '';
116
- $registered_only = ! empty( $options['registered_only'] ) ? $options['registered_only'] : '';
117
- $add_backlink = ! empty( $options['add_backlink'] ) ? true : false;
118
- $last_tab = ! empty( $options['last_tab'] ) ? $options['last_tab'] : 'styling' ;
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="#help" class="nav-tab" data-tab="help"><?php _e('Help', 'wp-review'); ?></a>
145
- <a href="#pro" class="nav-tab" data-tab="pro"><?php _e('Pro', 'wp-review'); ?></a>
146
- <?php if ( $rows_left ) : ?>
147
- <a href="#migrate" class="nav-tab" data-tab="migrate"><?php _e('Migrate Ratings', 'wp-review'); ?></a>
148
- <?php endif; ?>
149
- </div>
150
- <div id="wp-review-settings-tab-contents">
151
-
152
- <div class="settings-tab-styling">
153
-
154
- <h3><?php _e( 'Styling', 'wp-review' ); ?></h3>
155
-
156
- <?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>'; ?>
157
-
158
- <div class="wp-review-color-options">
159
- <p class="wp-review-field"<?php if (empty($displayed_fields['color'])) echo ' style="display: none;"'; ?>>
160
- <label for="wp_review_color"><?php _e( 'Review Color', 'wp-review' ); ?></label>
161
- <input type="text" class="wp-review-color" name="wp_review_options[colors][color]" value="<?php echo $color; ?>" />
162
- </p>
163
-
164
- <p class="wp-review-field"<?php if (empty($displayed_fields['fontcolor'])) echo ' style="display: none;"'; ?>>
165
- <label for="wp_review_fontcolor"><?php _e( 'Font Color', 'wp-review' ); ?></label>
166
- <input type="text" class="wp-review-color" name="wp_review_options[colors][fontcolor]" id ="wp_review_fontcolor" value="<?php echo $fontcolor; ?>" />
167
- </p>
168
-
169
- <p class="wp-review-field"<?php if (empty($displayed_fields['bgcolor1'])) echo ' style="display: none;"'; ?>>
170
- <label for="wp_review_bgcolor1"><?php _e( 'Heading Background Color', 'wp-review' ); ?></label>
171
- <input type="text" class="wp-review-color" name="wp_review_options[colors][bgcolor1]" id ="wp_review_bgcolor1" value="<?php echo $bgcolor1; ?>" />
172
- </p>
173
-
174
- <p class="wp-review-field"<?php if (empty($displayed_fields['bgcolor2'])) echo ' style="display: none;"'; ?>>
175
- <label for="wp_review_bgcolor2"><?php _e( 'Background Color', 'wp-review' ); ?></label>
176
- <input type="text" class="wp-review-color" name="wp_review_options[colors][bgcolor2]" id="wp_review_bgcolor2" value="<?php echo $bgcolor2; ?>" />
177
- </p>
178
-
179
- <p class="wp-review-field"<?php if (empty($displayed_fields['bordercolor'])) echo ' style="display: none;"'; ?>>
180
- <label for="wp_review_bordercolor"><?php _e( 'Border Color', 'wp-review' ); ?></label>
181
- <input type="text" class="wp-review-color" name="wp_review_options[colors][bordercolor]" id="wp_review_bordercolor" value="<?php echo $bordercolor; ?>" />
182
- </p>
183
-
184
-
185
- </div>
186
-
187
- <p class="wp-review-field">
188
- <?php
189
- $backlink_text = wp_review_get_backlink();
190
- ?>
191
- <input name="wp_review_options[add_backlink]" type="hidden" value="0" />
192
- <input name="wp_review_options[add_backlink]" id="wp_review_add_backlink" type="checkbox" value="1" <?php checked( $add_backlink, '1' ); ?> />
193
- <label for="wp_review_add_backlink" style="width: 300px;"><?php printf(__( 'Add Backlink (%s)', 'wp-review' ), $backlink_text); ?></label>
194
- </p>
195
-
196
- <p class="submit">
197
- <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
198
- </p>
199
-
200
- <input name="wp_review_options[last_tab]" id="wp_review_last_tab" type="hidden" value="<?php echo esc_attr($last_tab); ?>" />
201
-
202
- </div>
203
- <div class="settings-tab-defaults">
204
- <h3><?php _e( 'Defaults', 'wp-review' ); ?></h3>
205
-
206
- <?php $has_criteria_filter = has_filter( 'wp_review_default_criteria' ); ?>
207
- <?php $schemas = apply_filters( 'wp_review_schema_types', array() ); ?>
208
-
209
- <table class="form-table">
210
- <tr>
211
- <th scope="row"><?php _e( 'Review Location', 'wp-review' ); ?></th>
212
- <td>
213
- <select name="wp_review_options[review_location]" id="wp_review_location">
214
- <option value="bottom" <?php selected( $location, 'bottom' ); ?>><?php _e( 'After Content', 'wp-review' ) ?></option>
215
- <option value="top" <?php selected( $location, 'top' ); ?>><?php _e( 'Before Content', 'wp-review' ) ?></option>
216
- <option value="custom" <?php selected( $location, 'custom' ); ?>><?php _e( 'Custom (use shortcode)', 'wp-review' ) ?></option>
217
- </select>
218
- <p class="wp-review-field" id="wp_review_shortcode_hint_field">
219
- <input id="wp_review_shortcode_hint" type="text" value="[wp-review]" readonly="readonly" />
220
- <span><?php _e('Copy &amp; paste this shortcode in the post content.', 'wp-review') ?></span>
221
- </p>
222
- </td>
223
- </tr>
224
- <tr>
225
- <th scope="row"><?php _e( 'Features', 'wp-review' ); ?></th>
226
- <td>
227
- <table id="wp-review-item">
228
- <?php if ( $has_criteria_filter ) : ?>
229
- <?php foreach ( $defaultCriteria as $item ) : ?>
230
- <?php if ( ! empty( $item ) ) : ?>
231
- <tr>
232
- <td style="padding:0">
233
- <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"' : ''; ?> />
234
- <?php if ( ! $has_criteria_filter ) : ?>
235
- <a class="button remove-row" href="#"><?php _e( 'Delete', 'wp-review' ); ?></a>
236
- <?php endif; ?>
237
- </td>
238
- </tr>
239
- <?php endif; ?>
240
- <?php endforeach; ?>
241
- <?php else : ?>
242
- <?php foreach ( $items as $item ) : ?>
243
- <?php if ( ! empty( $item ) ) : ?>
244
- <tr>
245
- <td style="padding:0">
246
- <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"' : ''; ?> />
247
- <?php if ( ! $has_criteria_filter ) : ?>
248
- <a class="button remove-row" href="#"><?php _e( 'Delete', 'wp-review' ); ?></a>
249
- <?php endif; ?>
250
- </td>
251
- </tr>
252
- <?php endif; ?>
253
- <?php endforeach; ?>
254
- <?php endif; ?>
255
- <tr class="empty-row screen-reader-text">
256
- <td style="padding:0">
257
- <input class="focus-on-add" type="text" name="wp_review_options[default_features][]" />
258
- <a class="button remove-row" href="#"><?php _e( 'Delete', 'wp-review' ); ?></a>
259
- </td>
260
- </tr>
261
- </table>
262
- <?php if ( $has_criteria_filter ) : ?>
263
- <p class="description"><?php _e('Default features are set by a filter function. Remove it to change.', 'wp-review'); ?></p>
264
- <?php else : ?>
265
- <a class="add-row button" data-target="#wp-review-item" href="#"><?php _e( 'Add default feature', 'wp-review' ) ?></a>
266
- <?php endif; ?>
267
- </td>
268
- </tr>
269
- </table>
270
-
271
- <p class="submit">
272
- <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
273
- </p>
274
-
275
- </div>
276
-
277
- <div class="settings-tab-help">
278
- <p>
279
- <object type="application/x-shockwave-flash" style="width:450px; height:366px;" data="//www.youtube.com/v/NzMe-QY_WZY?version=3">
280
- <param name="movie" value="//www.youtube.com/v/NzMe-QY_WZY?version=3" />
281
- <param name="allowFullScreen" value="true" />
282
- <param name="allowscriptaccess" value="always" />
283
- </object>
284
- </p>
285
- <p>
286
- <?php _e('All support for this plugin is provided through our forums. If you have not registered yet, you can do so here for ​<strong>FREE​</strong>: ', 'wp-review'); ?>
287
- <a target="_blank" href="https://mythemeshop.com/#signup">https://mythemeshop.com/#signup</a>
288
- </p>
289
- <p>
290
- <?php _e('Check our free WordPress video tutorials here: ', 'wp-review'); ?>
291
- <a target="_blank" href="https://mythemeshop.com/wordpress-101/">https://mythemeshop.com/wordpress-101/</a>
292
- <?php _e('(no registration required)', 'wp-review'); ?>
293
- </p>
294
- <p>
295
- <?php _e('Thank you for using our plugin.', 'wp-review'); ?>
296
- </p>
297
-
298
- <p class="submit">
299
- <a href="https://mythemeshop.com/#login" target="_blank" class="button-primary"><?php _e('Get Support for Free') ?></a>
300
- </p>
301
- </div>
302
-
303
- <div class="settings-tab-pro">
304
- <p>
305
- <?php _e('Create Reviews Easily &amp; Rank Higher In Search Engines', 'wp-review'); ?> - <a target="_blank" href="https://mythemeshop.com/plugins/wp-review-pro/?utm_source=WP+Review&utm_medium=Notification+Link&utm_content=WP+Review+Pro+LP&utm_campaign=WordPressOrg"><strong><?php _e('WP Review Pro Plugin', 'wp-review'); ?></strong></a>
306
- </p>
307
-
308
- <p class="submit">
309
- <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" class="button-primary"><?php _e('Check the Pro Version') ?></a>
310
- </p>
311
- </div>
312
-
313
- <?php if ( $rows_left ) : ?>
314
- <div class="settings-tab-migrate">
315
- <div id="settings-allow-migrate">
316
- <p><?php _e('Here you can import your existing user ratings from WP Review &lt; 4.0', 'wp-review'); ?></p>
317
- <p class="migrate-items"><?php printf( __( '%s ratings left to import.', 'wp-review'), '<span id="migrate-items-num">'.$rows_left.'</span>' ); ?></p>
318
- <a href="#" class="button button-secondary" id="start-migrate" data-start="<?php echo $migrated_rows; ?>"><?php _e('Start import', 'wp-review'); ?></a>
319
- <textarea id="wp-review-migrate-log"></textarea>
320
- </div>
321
- <p class="already-migrated-msg"><?php _e('Ratings have already been migrated.', 'wp-review'); ?></p>
322
- </div>
323
- <?php endif; ?>
324
-
325
- </div>
326
-
327
-
328
-
329
-
330
- </form>
331
- </div>
332
- <?php if (!apply_filters( 'wp_review_remove_branding', false )) : ?>
333
- <div id="col-left" style="float: right; margin-top: 47px;">
334
- <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">
335
- <img src="<?php echo trailingslashit( WP_REVIEW_ASSETS ); ?>/images/wp-review-pro.jpg">
336
- </a>
337
- </div>
338
- <?php endif; ?>
339
- <?php }
340
-
341
- // Add settings link on plugin page
342
- function wpreview_plugin_settings_link($links) {
343
- $dir = explode('/', WP_REVIEW_PLUGIN_BASE);
344
- $dir = $dir[0];
345
- $settings_link = '<a href="options-general.php?page='.$dir.'/admin/options.php">'.__('Settings', 'wp-review').'</a>';
346
- array_unshift($links, $settings_link);
347
- return $links;
348
- }
349
- add_filter('plugin_action_links_'.WP_REVIEW_PLUGIN_BASE, 'wpreview_plugin_settings_link' );
350
-
351
  ?>
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')));
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
+ 'last_tab' => 'styling',
47
+ );
48
+ // set defaults
49
+ if (empty($options)) {
50
+ update_option( 'wp_review_options', $options = $default_options );
51
+ }
52
+
53
+ $opt_name = 'wp_review_options_'.wp_get_theme();
54
+ $options_updated = get_option( $opt_name );
55
+ $suggest_theme_defaults = true;
56
+ if (!empty($_GET['wp-review-theme-defaults']) && empty($_GET['settings-updated'])) {
57
+ wp_review_theme_defaults($options_updated, true);
58
+ $options = get_option('wp_review_options');
59
+ $suggest_theme_defaults = false;
60
+ }
61
+ // test to see if we need to sugges setting theme defaults
62
+ if (empty($options_updated)) $options_updated = array();
63
+ $opts_tmp = array_merge($options, $options_updated);
64
+ if ($opts_tmp == $options) $suggest_theme_defaults = false;
65
+
66
+ // Migrate
67
+ global $wpdb;
68
+ $current_blog_id = get_current_blog_id();
69
+ $total_rows = 0;
70
+ $rows_left = 0;
71
+ $migrated_rows = get_option( 'wp_review_migrated_rows', 0 );
72
+ $has_migrated = get_option( 'wp_review_has_migrated', false );
73
+ if ( ! $has_migrated && $wpdb->get_var("SHOW TABLES LIKE '{$wpdb->base_prefix}mts_wp_reviews'") == "{$wpdb->base_prefix}mts_wp_reviews") {
74
+ // Table exists and not migrated (fully) yet
75
+ $total_rows = $wpdb->get_var( 'SELECT COUNT(*) FROM '.$wpdb->base_prefix.'mts_wp_reviews WHERE blog_id = '.$current_blog_id );
76
+ $rows_left = $total_rows - $migrated_rows;
77
+ }
78
+
79
+ ?>
80
+ <div id="col-right" class="wrap wp-review" style="float: left; padding-right: 3%; box-sizing: border-box;">
81
+ <h2><?php _e('WP Review Settings', 'wp-review'); ?></h2>
82
+
83
+ <form method="post" action="options.php">
84
+ <?php settings_fields( 'wpreview-settings-group' ); ?>
85
+
86
+ <?php
87
+
88
+ $defaultColors = apply_filters('wp_review_default_colors', array(
89
+ 'color' => '#1e73be',
90
+ 'fontcolor' => '#555555',
91
+ 'bgcolor1' => '#e7e7e7',
92
+ 'bgcolor2' => '#ffffff',
93
+ 'bordercolor' => '#e7e7e7'
94
+ ));
95
+ $defaultLocation = apply_filters('wp_review_default_location', 'bottom');
96
+
97
+ $defaultCriteria = apply_filters('wp_review_default_criteria', array());
98
+ $defaultItems = array();
99
+ foreach ($defaultCriteria as $item) {
100
+ $defaultItems[] = array( 'wp_review_item_title' => $item, 'wp_review_item_star' => '');
101
+ }
102
+ $default_schema = empty( $options['default_schema_type'] ) ? $default_options['default_schema_type'] : $options['default_schema_type'];
103
+ $default_user_review_type = empty( $options['default_user_review_type'] ) ? WP_REVIEW_REVIEW_DISABLED : $options['default_user_review_type'];
104
+ $options['colors'] = apply_filters( 'wp_review_colors', $options['colors'], 0 );
105
+ if (!isset($options['deafults'])) $options['deafults'] = array();
106
+ /* Retrieve an existing value from the database. */
107
+ $items = ! empty($options['default_features']) ? $options['default_features'] : '';
108
+ $link_texts = ! empty( $options['default_link_text'] ) ? $options['default_link_text'] : array();
109
+ $link_urls = ! empty( $options['default_link_url'] ) ? $options['default_link_url'] : array();
110
+ $color = ! empty($options['colors']['color']) ? $options['colors']['color'] : '';
111
+ $location = ! empty($options['review_location']) ? $options['review_location'] : '';
112
+ $fontcolor = ! empty($options['colors']['fontcolor']) ? $options['colors']['fontcolor'] : '';
113
+ $bgcolor1 = ! empty($options['colors']['bgcolor1']) ? $options['colors']['bgcolor1'] : '';
114
+ $bgcolor2 = ! empty($options['colors']['bgcolor2']) ? $options['colors']['bgcolor2'] : '';
115
+ $bordercolor = ! empty($options['colors']['bordercolor']) ? $options['colors']['bordercolor'] : '';
116
+ $registered_only = ! empty( $options['registered_only'] ) ? $options['registered_only'] : '';
117
+ $add_backlink = ! empty( $options['add_backlink'] ) ? true : false;
118
+ $last_tab = ! empty( $options['last_tab'] ) ? $options['last_tab'] : 'styling' ;
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="#help" class="nav-tab" data-tab="help"><?php _e('Help', 'wp-review'); ?></a>
145
+ <a href="#pro" class="nav-tab" data-tab="pro"><?php _e('Pro', 'wp-review'); ?></a>
146
+ <?php if ( $rows_left ) : ?>
147
+ <a href="#migrate" class="nav-tab" data-tab="migrate"><?php _e('Migrate Ratings', 'wp-review'); ?></a>
148
+ <?php endif; ?>
149
+ </div>
150
+ <div id="wp-review-settings-tab-contents">
151
+
152
+ <div class="settings-tab-styling">
153
+
154
+ <h3><?php _e( 'Styling', 'wp-review' ); ?></h3>
155
+
156
+ <?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>'; ?>
157
+
158
+ <div class="wp-review-color-options">
159
+ <p class="wp-review-field"<?php if (empty($displayed_fields['color'])) echo ' style="display: none;"'; ?>>
160
+ <label for="wp_review_color"><?php _e( 'Review Color', 'wp-review' ); ?></label>
161
+ <input type="text" class="wp-review-color" name="wp_review_options[colors][color]" value="<?php echo $color; ?>" />
162
+ </p>
163
+
164
+ <p class="wp-review-field"<?php if (empty($displayed_fields['fontcolor'])) echo ' style="display: none;"'; ?>>
165
+ <label for="wp_review_fontcolor"><?php _e( 'Font Color', 'wp-review' ); ?></label>
166
+ <input type="text" class="wp-review-color" name="wp_review_options[colors][fontcolor]" id ="wp_review_fontcolor" value="<?php echo $fontcolor; ?>" />
167
+ </p>
168
+
169
+ <p class="wp-review-field"<?php if (empty($displayed_fields['bgcolor1'])) echo ' style="display: none;"'; ?>>
170
+ <label for="wp_review_bgcolor1"><?php _e( 'Heading Background Color', 'wp-review' ); ?></label>
171
+ <input type="text" class="wp-review-color" name="wp_review_options[colors][bgcolor1]" id ="wp_review_bgcolor1" value="<?php echo $bgcolor1; ?>" />
172
+ </p>
173
+
174
+ <p class="wp-review-field"<?php if (empty($displayed_fields['bgcolor2'])) echo ' style="display: none;"'; ?>>
175
+ <label for="wp_review_bgcolor2"><?php _e( 'Background Color', 'wp-review' ); ?></label>
176
+ <input type="text" class="wp-review-color" name="wp_review_options[colors][bgcolor2]" id="wp_review_bgcolor2" value="<?php echo $bgcolor2; ?>" />
177
+ </p>
178
+
179
+ <p class="wp-review-field"<?php if (empty($displayed_fields['bordercolor'])) echo ' style="display: none;"'; ?>>
180
+ <label for="wp_review_bordercolor"><?php _e( 'Border Color', 'wp-review' ); ?></label>
181
+ <input type="text" class="wp-review-color" name="wp_review_options[colors][bordercolor]" id="wp_review_bordercolor" value="<?php echo $bordercolor; ?>" />
182
+ </p>
183
+
184
+
185
+ </div>
186
+
187
+ <p class="wp-review-field">
188
+ <?php
189
+ $backlink_text = wp_review_get_backlink();
190
+ ?>
191
+ <input name="wp_review_options[add_backlink]" type="hidden" value="0" />
192
+ <input name="wp_review_options[add_backlink]" id="wp_review_add_backlink" type="checkbox" value="1" <?php checked( $add_backlink, '1' ); ?> />
193
+ <label for="wp_review_add_backlink" style="width: 300px;"><?php printf(__( 'Add Backlink (%s)', 'wp-review' ), $backlink_text); ?></label>
194
+ </p>
195
+
196
+ <p class="submit">
197
+ <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
198
+ </p>
199
+
200
+ <input name="wp_review_options[last_tab]" id="wp_review_last_tab" type="hidden" value="<?php echo esc_attr($last_tab); ?>" />
201
+
202
+ </div>
203
+ <div class="settings-tab-defaults">
204
+ <h3><?php _e( 'Defaults', 'wp-review' ); ?></h3>
205
+
206
+ <?php $has_criteria_filter = has_filter( 'wp_review_default_criteria' ); ?>
207
+ <?php $schemas = apply_filters( 'wp_review_schema_types', array() ); ?>
208
+
209
+ <table class="form-table">
210
+ <tr>
211
+ <th scope="row"><?php _e( 'Review Location', 'wp-review' ); ?></th>
212
+ <td>
213
+ <select name="wp_review_options[review_location]" id="wp_review_location">
214
+ <option value="bottom" <?php selected( $location, 'bottom' ); ?>><?php _e( 'After Content', 'wp-review' ) ?></option>
215
+ <option value="top" <?php selected( $location, 'top' ); ?>><?php _e( 'Before Content', 'wp-review' ) ?></option>
216
+ <option value="custom" <?php selected( $location, 'custom' ); ?>><?php _e( 'Custom (use shortcode)', 'wp-review' ) ?></option>
217
+ </select>
218
+ <p class="wp-review-field" id="wp_review_shortcode_hint_field">
219
+ <input id="wp_review_shortcode_hint" type="text" value="[wp-review]" readonly="readonly" />
220
+ <span><?php _e('Copy &amp; paste this shortcode in the post content.', 'wp-review') ?></span>
221
+ </p>
222
+ </td>
223
+ </tr>
224
+ <tr>
225
+ <th scope="row"><?php _e( 'Features', 'wp-review' ); ?></th>
226
+ <td>
227
+ <table id="wp-review-item">
228
+ <?php if ( $has_criteria_filter ) : ?>
229
+ <?php foreach ( $defaultCriteria as $item ) : ?>
230
+ <?php if ( ! empty( $item ) ) : ?>
231
+ <tr>
232
+ <td style="padding:0">
233
+ <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"' : ''; ?> />
234
+ <?php if ( ! $has_criteria_filter ) : ?>
235
+ <a class="button remove-row" href="#"><?php _e( 'Delete', 'wp-review' ); ?></a>
236
+ <?php endif; ?>
237
+ </td>
238
+ </tr>
239
+ <?php endif; ?>
240
+ <?php endforeach; ?>
241
+ <?php else : ?>
242
+ <?php foreach ( $items as $item ) : ?>
243
+ <?php if ( ! empty( $item ) ) : ?>
244
+ <tr>
245
+ <td style="padding:0">
246
+ <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"' : ''; ?> />
247
+ <?php if ( ! $has_criteria_filter ) : ?>
248
+ <a class="button remove-row" href="#"><?php _e( 'Delete', 'wp-review' ); ?></a>
249
+ <?php endif; ?>
250
+ </td>
251
+ </tr>
252
+ <?php endif; ?>
253
+ <?php endforeach; ?>
254
+ <?php endif; ?>
255
+ <tr class="empty-row screen-reader-text">
256
+ <td style="padding:0">
257
+ <input class="focus-on-add" type="text" name="wp_review_options[default_features][]" />
258
+ <a class="button remove-row" href="#"><?php _e( 'Delete', 'wp-review' ); ?></a>
259
+ </td>
260
+ </tr>
261
+ </table>
262
+ <?php if ( $has_criteria_filter ) : ?>
263
+ <p class="description"><?php _e('Default features are set by a filter function. Remove it to change.', 'wp-review'); ?></p>
264
+ <?php else : ?>
265
+ <a class="add-row button" data-target="#wp-review-item" href="#"><?php _e( 'Add default feature', 'wp-review' ) ?></a>
266
+ <?php endif; ?>
267
+ </td>
268
+ </tr>
269
+ </table>
270
+
271
+ <p class="submit">
272
+ <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
273
+ </p>
274
+
275
+ </div>
276
+
277
+ <div class="settings-tab-help">
278
+ <p>
279
+ <object type="application/x-shockwave-flash" style="width:450px; height:366px;" data="//www.youtube.com/v/NzMe-QY_WZY?version=3">
280
+ <param name="movie" value="//www.youtube.com/v/NzMe-QY_WZY?version=3" />
281
+ <param name="allowFullScreen" value="true" />
282
+ <param name="allowscriptaccess" value="always" />
283
+ </object>
284
+ </p>
285
+ <p>
286
+ <?php _e('All support for this plugin is provided through our forums. If you have not registered yet, you can do so here for ​<strong>FREE​</strong>: ', 'wp-review'); ?>
287
+ <a target="_blank" href="https://mythemeshop.com/#signup">https://mythemeshop.com/#signup</a>
288
+ </p>
289
+ <p>
290
+ <?php _e('Check our free WordPress video tutorials here: ', 'wp-review'); ?>
291
+ <a target="_blank" href="https://mythemeshop.com/wordpress-101/">https://mythemeshop.com/wordpress-101/</a>
292
+ <?php _e('(no registration required)', 'wp-review'); ?>
293
+ </p>
294
+ <p>
295
+ <?php _e('Thank you for using our plugin.', 'wp-review'); ?>
296
+ </p>
297
+
298
+ <p class="submit">
299
+ <a href="https://mythemeshop.com/#login" target="_blank" class="button-primary"><?php _e('Get Support for Free') ?></a>
300
+ </p>
301
+ </div>
302
+
303
+ <div class="settings-tab-pro">
304
+ <p>
305
+ <?php _e('Create Reviews Easily &amp; Rank Higher In Search Engines', 'wp-review'); ?> - <a target="_blank" href="https://mythemeshop.com/plugins/wp-review-pro/?utm_source=WP+Review&utm_medium=Notification+Link&utm_content=WP+Review+Pro+LP&utm_campaign=WordPressOrg"><strong><?php _e('WP Review Pro Plugin', 'wp-review'); ?></strong></a>
306
+ </p>
307
+
308
+ <p class="submit">
309
+ <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" class="button-primary"><?php _e('Check the Pro Version') ?></a>
310
+ </p>
311
+ </div>
312
+
313
+ <?php if ( $rows_left ) : ?>
314
+ <div class="settings-tab-migrate">
315
+ <div id="settings-allow-migrate">
316
+ <p><?php _e('Here you can import your existing user ratings from WP Review &lt; 4.0', 'wp-review'); ?></p>
317
+ <p class="migrate-items"><?php printf( __( '%s ratings left to import.', 'wp-review'), '<span id="migrate-items-num">'.$rows_left.'</span>' ); ?></p>
318
+ <a href="#" class="button button-secondary" id="start-migrate" data-start="<?php echo $migrated_rows; ?>"><?php _e('Start import', 'wp-review'); ?></a>
319
+ <textarea id="wp-review-migrate-log"></textarea>
320
+ </div>
321
+ <p class="already-migrated-msg"><?php _e('Ratings have already been migrated.', 'wp-review'); ?></p>
322
+ </div>
323
+ <?php endif; ?>
324
+
325
+ </div>
326
+
327
+
328
+
329
+
330
+ </form>
331
+ </div>
332
+ <?php if (!apply_filters( 'wp_review_remove_branding', false )) : ?>
333
+ <div id="col-left" style="float: right; margin-top: 47px;">
334
+ <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">
335
+ <img src="<?php echo trailingslashit( WP_REVIEW_ASSETS ); ?>/images/wp-review-pro.jpg">
336
+ </a>
337
+ </div>
338
+ <?php endif; ?>
339
+ <?php }
340
+
341
+ // Add settings link on plugin page
342
+ function wpreview_plugin_settings_link($links) {
343
+ $dir = explode('/', WP_REVIEW_PLUGIN_BASE);
344
+ $dir = $dir[0];
345
+ $settings_link = '<a href="options-general.php?page='.$dir.'/admin/options.php">'.__('Settings', 'wp-review').'</a>';
346
+ array_unshift($links, $settings_link);
347
+ return $links;
348
+ }
349
+ add_filter('plugin_action_links_'.WP_REVIEW_PLUGIN_BASE, 'wpreview_plugin_settings_link' );
350
+
351
  ?>
assets/css/admin.css CHANGED
@@ -1,195 +1,195 @@
1
- /*
2
- * Plugin Name: WP Review
3
- * Plugin URI: https://wordpress.org/plugins/wp-review/
4
- * Description: Create reviews! Choose from Stars, Percentages 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-review-color-options .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
- }
182
-
183
- .settings-tab-styling .wp-review-plugin-backlink {
184
- display: inline;
185
- margin-bottom: 0;
186
- }
187
- #wpfooter .wpreview-rating-link:hover {
188
- text-decoration: none;
189
- }
190
-
191
- #wpfooter .wpreview-rating-link .dashicons {
192
- font-size: 16px;
193
- width: 16px;
194
- height: 16px;
195
- }
1
+ /*
2
+ * Plugin Name: WP Review
3
+ * Plugin URI: https://wordpress.org/plugins/wp-review/
4
+ * Description: Create reviews! Choose from Stars, Percentages 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-review-color-options .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
+ }
182
+
183
+ .settings-tab-styling .wp-review-plugin-backlink {
184
+ display: inline;
185
+ margin-bottom: 0;
186
+ }
187
+ #wpfooter .wpreview-rating-link:hover {
188
+ text-decoration: none;
189
+ }
190
+
191
+ #wpfooter .wpreview-rating-link .dashicons {
192
+ font-size: 16px;
193
+ width: 16px;
194
+ height: 16px;
195
+ }
assets/css/wp-review-ie7.css CHANGED
@@ -1,14 +1,14 @@
1
- /*
2
- * Plugin Name: WP Review
3
- * Plugin URI: https://wordpress.org/plugins/wp-review/
4
- * Description: Create reviews! Choose from Stars, Percentages 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';
10
- font-style: normal;
11
- font-weight: normal;
12
- line-height: 1em;
13
- }
14
  .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 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';
10
+ font-style: normal;
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,191 +1,191 @@
1
- /*
2
- * Plugin Name: WP Review
3
- * Plugin URI: https://wordpress.org/plugins/wp-review/
4
- * Description: Create reviews! Choose from Stars, Percentages 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;
119
- position: absolute;
120
- top: 0;
121
- right: 0;
122
- bottom: 0;
123
- left: 0;
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;
131
- font-size: 10px;
132
- position: absolute;
133
- top: 45%;
134
- left: 49%;
135
- z-index: 12;
136
- text-indent: -9999em;
137
- border-top: 0.4em solid rgba(0, 0, 0, 0.2);
138
- border-right: 0.4em solid rgba(0, 0, 0, 0.2);
139
- border-bottom: 0.4em solid rgba(0, 0, 0, 0.2);
140
- border-left: 0.4em solid #000;
141
- -webkit-animation: load8 0.5s infinite linear;
142
- animation: load8 0.5s infinite linear;
143
- border-radius: 50%;
144
- width: 2em;
145
- height: 2em;
146
- }
147
- @-webkit-keyframes load8 {
148
- 0% {
149
- -webkit-transform: rotate(0deg);
150
- transform: rotate(0deg);
151
- }
152
- 100% {
153
- -webkit-transform: rotate(360deg);
154
- transform: rotate(360deg);
155
- }
156
- }
157
- @keyframes load8 {
158
- 0% {
159
- -webkit-transform: rotate(0deg);
160
- transform: rotate(0deg);
161
- }
162
- 100% {
163
- -webkit-transform: rotate(360deg);
164
- transform: rotate(360deg);
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 }
1
+ /*
2
+ * Plugin Name: WP Review
3
+ * Plugin URI: https://wordpress.org/plugins/wp-review/
4
+ * Description: Create reviews! Choose from Stars, Percentages 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;
119
+ position: absolute;
120
+ top: 0;
121
+ right: 0;
122
+ bottom: 0;
123
+ left: 0;
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;
131
+ font-size: 10px;
132
+ position: absolute;
133
+ top: 45%;
134
+ left: 49%;
135
+ z-index: 12;
136
+ text-indent: -9999em;
137
+ border-top: 0.4em solid rgba(0, 0, 0, 0.2);
138
+ border-right: 0.4em solid rgba(0, 0, 0, 0.2);
139
+ border-bottom: 0.4em solid rgba(0, 0, 0, 0.2);
140
+ border-left: 0.4em solid #000;
141
+ -webkit-animation: load8 0.5s infinite linear;
142
+ animation: load8 0.5s infinite linear;
143
+ border-radius: 50%;
144
+ width: 2em;
145
+ height: 2em;
146
+ }
147
+ @-webkit-keyframes load8 {
148
+ 0% {
149
+ -webkit-transform: rotate(0deg);
150
+ transform: rotate(0deg);
151
+ }
152
+ 100% {
153
+ -webkit-transform: rotate(360deg);
154
+ transform: rotate(360deg);
155
+ }
156
+ }
157
+ @keyframes load8 {
158
+ 0% {
159
+ -webkit-transform: rotate(0deg);
160
+ transform: rotate(0deg);
161
+ }
162
+ 100% {
163
+ -webkit-transform: rotate(360deg);
164
+ transform: rotate(360deg);
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,606 +1,606 @@
1
- /*
2
- * Plugin Name: WP Review
3
- * Plugin URI: https://wordpress.org/plugins/wp-review/
4
- * Description: Create reviews! Choose from Stars, Percentages 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
- */
256
- .entry-content .review-title, #content .review-title { margin: 0 }
257
- .entry-content .review-wrapper li { margin: 0 }
258
- .entry-content .review-summary-title, #content .review-summary-title { margin-bottom: 5px }
259
- #content .review-list { margin: 0 }
260
- #content .review-desc p:last-child { margin-bottom: 0 }
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
- */
473
- @font-face {
474
- font-family: 'font-icons';
475
- src: url('../fonts/font-icons.eot');
476
- src: url('../fonts/font-icons.eot') format('embedded-opentype'),
477
- url('../fonts/font-icons.woff') format('woff'),
478
- url('../fonts/font-icons.ttf') format('truetype'),
479
- url('../fonts/font-icons.svg') format('svg');
480
- font-weight: normal;
481
- font-style: normal;
482
- }
483
-
484
- [class^="mts-icon-"]:before, [class*=" mts-icon-"]:before {
485
- font-family: "font-icons";
486
- font-style: normal;
487
- font-weight: normal;
488
- speak: none;
489
- display: inline-block;
490
- text-decoration: inherit;
491
- width: 1em;
492
- margin-right: 0;
493
- text-align: center;
494
- font-variant: normal;
495
- text-transform: none;
496
- line-height: 1em;
497
- margin-left: 2px;
498
- }
499
-
500
- [class*="mts-icon-loader"]:before {
501
- font-family: "font-icons";
502
- font-style: normal;
503
- font-weight: normal;
504
- speak: none;
505
- display: inline-block;
506
- text-decoration: inherit;
507
- width: 1em;
508
- margin-right: .2em;
509
- text-align: center;
510
- font-variant: normal;
511
- text-transform: none;
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
- #review.wp-review-box-with-backlink {
525
- margin-bottom: 0;
526
- }
527
-
528
- /*
529
- Spin Animation For Loader
530
- */
531
- .animate-spin {
532
- -webkit-animation: spin 1s infinite linear;
533
- animation: spin 1s infinite linear;
534
- display: inline-block;
535
- }
536
- @-webkit-keyframes spin {
537
- 0% {
538
- -webkit-transform: rotate(0deg);
539
- transform: rotate(0deg);
540
- }
541
- 100% {
542
- -webkit-transform: rotate(359deg);
543
- transform: rotate(359deg);
544
- }
545
- }
546
- @keyframes spin {
547
- 0% {
548
- -webkit-transform: rotate(0deg);
549
- transform: rotate(0deg);
550
- }
551
- 100% {
552
- -webkit-transform: rotate(359deg);
553
- transform: rotate(359deg);
554
- }
555
- }
556
- /*-----------------------------------------------------*/
557
- /* Responsvie
558
- /*-----------------------------------------------------*/
559
- @media screen and (max-width:1040px) {
560
- .review-desc { width: 71% }
561
- }
562
- @media screen and (max-width:860px) {
563
- .review-desc { width: 66% }
564
- }
565
- @media screen and (max-width:470px) {
566
- .review-desc {
567
- padding: 4%;
568
- width: 100%;
569
- }
570
- .review-total-wrapper {
571
- width: 100%;
572
- margin-right: 0;
573
- }
574
- .review-total-wrapper span.review-total-box {
575
- padding: 10px 0 20px;
576
- text-align: left;
577
- padding-left: 10px;
578
- }
579
- .rtl .review-total-wrapper span.review-total-box {
580
- padding: 10px 0 20px;
581
- text-align: right;
582
- padding-left: 0;
583
- padding-right: 10px;
584
- }
585
- .review-total-star {
586
- position: absolute;
587
- right: 20px;
588
- top: 5px;
589
- }
590
- .rtl .review-total-star {
591
- right: auto;
592
- left: 20px;
593
- }
594
- .user-total-wrapper { width: 96% }
595
- .review-total-star.allowed-to-rate {
596
- position: relative;
597
- right: auto;
598
- left: 0;
599
- float: left;
600
- }
601
- .rtl .review-total-star.allowed-to-rat e{
602
- right: 0;
603
- left: auto;
604
- float: right;
605
- }
606
  }
1
+ /*
2
+ * Plugin Name: WP Review
3
+ * Plugin URI: https://wordpress.org/plugins/wp-review/
4
+ * Description: Create reviews! Choose from Stars, Percentages 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
+ */
256
+ .entry-content .review-title, #content .review-title { margin: 0 }
257
+ .entry-content .review-wrapper li { margin: 0 }
258
+ .entry-content .review-summary-title, #content .review-summary-title { margin-bottom: 5px }
259
+ #content .review-list { margin: 0 }
260
+ #content .review-desc p:last-child { margin-bottom: 0 }
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
+ */
473
+ @font-face {
474
+ font-family: 'font-icons';
475
+ src: url('../fonts/font-icons.eot');
476
+ src: url('../fonts/font-icons.eot') format('embedded-opentype'),
477
+ url('../fonts/font-icons.woff') format('woff'),
478
+ url('../fonts/font-icons.ttf') format('truetype'),
479
+ url('../fonts/font-icons.svg') format('svg');
480
+ font-weight: normal;
481
+ font-style: normal;
482
+ }
483
+
484
+ [class^="mts-icon-"]:before, [class*=" mts-icon-"]:before {
485
+ font-family: "font-icons";
486
+ font-style: normal;
487
+ font-weight: normal;
488
+ speak: none;
489
+ display: inline-block;
490
+ text-decoration: inherit;
491
+ width: 1em;
492
+ margin-right: 0;
493
+ text-align: center;
494
+ font-variant: normal;
495
+ text-transform: none;
496
+ line-height: 1em;
497
+ margin-left: 2px;
498
+ }
499
+
500
+ [class*="mts-icon-loader"]:before {
501
+ font-family: "font-icons";
502
+ font-style: normal;
503
+ font-weight: normal;
504
+ speak: none;
505
+ display: inline-block;
506
+ text-decoration: inherit;
507
+ width: 1em;
508
+ margin-right: .2em;
509
+ text-align: center;
510
+ font-variant: normal;
511
+ text-transform: none;
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
+ #review.wp-review-box-with-backlink {
525
+ margin-bottom: 0;
526
+ }
527
+
528
+ /*
529
+ Spin Animation For Loader
530
+ */
531
+ .animate-spin {
532
+ -webkit-animation: spin 1s infinite linear;
533
+ animation: spin 1s infinite linear;
534
+ display: inline-block;
535
+ }
536
+ @-webkit-keyframes spin {
537
+ 0% {
538
+ -webkit-transform: rotate(0deg);
539
+ transform: rotate(0deg);
540
+ }
541
+ 100% {
542
+ -webkit-transform: rotate(359deg);
543
+ transform: rotate(359deg);
544
+ }
545
+ }
546
+ @keyframes spin {
547
+ 0% {
548
+ -webkit-transform: rotate(0deg);
549
+ transform: rotate(0deg);
550
+ }
551
+ 100% {
552
+ -webkit-transform: rotate(359deg);
553
+ transform: rotate(359deg);
554
+ }
555
+ }
556
+ /*-----------------------------------------------------*/
557
+ /* Responsvie
558
+ /*-----------------------------------------------------*/
559
+ @media screen and (max-width:1040px) {
560
+ .review-desc { width: 71% }
561
+ }
562
+ @media screen and (max-width:860px) {
563
+ .review-desc { width: 66% }
564
+ }
565
+ @media screen and (max-width:470px) {
566
+ .review-desc {
567
+ padding: 4%;
568
+ width: 100%;
569
+ }
570
+ .review-total-wrapper {
571
+ width: 100%;
572
+ margin-right: 0;
573
+ }
574
+ .review-total-wrapper span.review-total-box {
575
+ padding: 10px 0 20px;
576
+ text-align: left;
577
+ padding-left: 10px;
578
+ }
579
+ .rtl .review-total-wrapper span.review-total-box {
580
+ padding: 10px 0 20px;
581
+ text-align: right;
582
+ padding-left: 0;
583
+ padding-right: 10px;
584
+ }
585
+ .review-total-star {
586
+ position: absolute;
587
+ right: 20px;
588
+ top: 5px;
589
+ }
590
+ .rtl .review-total-star {
591
+ right: auto;
592
+ left: 20px;
593
+ }
594
+ .user-total-wrapper { width: 96% }
595
+ .review-total-star.allowed-to-rate {
596
+ position: relative;
597
+ right: auto;
598
+ left: 0;
599
+ float: left;
600
+ }
601
+ .rtl .review-total-star.allowed-to-rat e{
602
+ right: 0;
603
+ left: auto;
604
+ float: right;
605
+ }
606
  }
assets/fonts/font-icons.eot CHANGED
File without changes
assets/fonts/font-icons.svg CHANGED
@@ -1,13 +1,13 @@
1
- <?xml version="1.0" standalone="no"?>
2
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
- <svg xmlns="http://www.w3.org/2000/svg">
4
- <metadata>Copyright (C) 2014 by original authors @ fontello.com</metadata>
5
- <defs>
6
- <font id="font-icons" horiz-adv-x="1000" >
7
- <font-face font-family="font-icons" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
8
- <missing-glyph horiz-adv-x="1000" />
9
- <glyph glyph-name="star" unicode="&#xe800;" d="m0 489q0 21 31 26l280 40 126 254q11 23 27 23t28-23l125-254 280-40q32-5 32-26 0-12-15-27l-203-197 48-279q1-4 1-12 0-11-6-19t-17-9q-10 0-22 7l-251 132-250-132q-13-7-23-7-11 0-17 9t-6 19q0 4 1 12l48 279-203 197q-14 15-14 27z" horiz-adv-x="928.6" />
10
- <glyph glyph-name="spin3" unicode="&#xe801;" d="m494 850c-266 0-483-210-494-472-1-19 13-20 13-20l84 0c16 0 19 10 19 18 10 199 176 358 378 358 107 0 205-45 273-118l-58-57c-11-12-11-27 5-31l247-50c21-5 46 11 37 44l-58 227c-2 9-16 22-29 13l-65-60c-89 91-214 148-352 148z m409-508c-16 0-19-10-19-18-10-199-176-358-377-358-108 0-205 45-274 118l59 57c10 12 10 27-5 31l-248 50c-21 5-46-11-37-44l58-227c2-9 16-22 30-13l64 60c89-91 214-148 353-148 265 0 482 210 493 473 1 18-13 19-13 19l-84 0z" horiz-adv-x="1000" />
11
- </font>
12
- </defs>
13
  </svg>
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Copyright (C) 2014 by original authors @ fontello.com</metadata>
5
+ <defs>
6
+ <font id="font-icons" horiz-adv-x="1000" >
7
+ <font-face font-family="font-icons" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
8
+ <missing-glyph horiz-adv-x="1000" />
9
+ <glyph glyph-name="star" unicode="&#xe800;" d="m0 489q0 21 31 26l280 40 126 254q11 23 27 23t28-23l125-254 280-40q32-5 32-26 0-12-15-27l-203-197 48-279q1-4 1-12 0-11-6-19t-17-9q-10 0-22 7l-251 132-250-132q-13-7-23-7-11 0-17 9t-6 19q0 4 1 12l48 279-203 197q-14 15-14 27z" horiz-adv-x="928.6" />
10
+ <glyph glyph-name="spin3" unicode="&#xe801;" d="m494 850c-266 0-483-210-494-472-1-19 13-20 13-20l84 0c16 0 19 10 19 18 10 199 176 358 378 358 107 0 205-45 273-118l-58-57c-11-12-11-27 5-31l247-50c21-5 46 11 37 44l-58 227c-2 9-16 22-29 13l-65-60c-89 91-214 148-352 148z m409-508c-16 0-19-10-19-18-10-199-176-358-377-358-108 0-205 45-274 118l59 57c10 12 10 27-5 31l-248 50c-21 5-46-11-37-44l58-227c2-9 16-22 30-13l64 60c89-91 214-148 353-148 265 0 482 210 493 473 1 18-13 19-13 19l-84 0z" horiz-adv-x="1000" />
11
+ </font>
12
+ </defs>
13
  </svg>
assets/fonts/font-icons.ttf CHANGED
File without changes
assets/fonts/font-icons.woff CHANGED
File without changes
assets/images/largethumb.png CHANGED
File without changes
assets/images/smallthumb.png CHANGED
File without changes
assets/images/wp-review-pro.jpg CHANGED
File without changes
assets/js/admin.js CHANGED
@@ -1,311 +1,311 @@
1
- /*
2
- * Plugin Name: WP Review
3
- * Plugin URI: https://wordpress.org/plugins/wp-review/
4
- * Description: Create reviews! Choose from Stars, Percentages 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
- */
83
- $('#wp-review-metabox-item').hide();
84
- $('#wp-review-metabox-heading').hide();
85
- $('#wp-review-metabox-desc').hide();
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
- var ratings_initiated = false;
94
- $('#wp_review_type').on( 'change', function() {
95
- var selected_val = $(this).val();
96
- var $selected_option = $(this).find('option:selected');
97
- $('#wp-review-metabox-item').toggle( selected_val != '' );
98
- $('#wp-review-metabox-heading').toggle( selected_val != '' );
99
- $('#wp-review-metabox-desc').toggle( selected_val != '' );
100
- $('#wp-review-metabox-userReview').toggle( selected_val != '' );
101
- $('#wp_review_id_hint').toggle( selected_val != '' );
102
- $('#wp_review_schema_group').toggle( selected_val != '' );
103
- $('#wp-review-metabox-reviewLinks').toggle( selected_val != '' );
104
- $('#wp_review_heading_group').toggle( selected_val != '' );
105
-
106
- // Build dynamic text
107
- var max = $selected_option.data('max');
108
- var decimals = $selected_option.data('decimals');
109
- var val_text = $selected_option.text() + ' (1 - ' + max + ')';
110
- $('.dynamic-text').text(val_text);
111
-
112
- current_rating_max = max;
113
- current_rating_decimals = decimals;
114
- $.validate_review_value( max );
115
- if (ratings_initiated) {
116
- $.review_total();
117
- }
118
- ratings_initiated = true;
119
- }).change();
120
-
121
- $('#wp_review_custom_colors').change(function(e) {
122
- if ( $(this).is(':checked') ) {
123
- $('.wp-review-color-options').show();
124
- } else {
125
- $('.wp-review-color-options').hide();
126
- }
127
- });
128
- $('#wp_review_custom_location').change(function(e) {
129
- if ( $(this).is(':checked') ) {
130
- $('.wp-review-location-options').show();
131
- } else {
132
- $('.wp-review-location-options').hide();
133
- }
134
- });
135
- $('#wp_review_custom_width').change(function(e) {
136
- if ( $(this).is(':checked') ) {
137
- $('.wp-review-width-options').show();
138
- } else {
139
- $('.wp-review-width-options').hide();
140
- }
141
- });
142
- $('#wp_review_custom_author').change(function(e) {
143
- if ( $(this).is(':checked') ) {
144
- $('.wp-review-author-options').show();
145
- } else {
146
- $('.wp-review-author-options').hide();
147
- }
148
- });
149
- $('#wp_review_show_on_thumbnails').change(function(e) {
150
- if ( $(this).is(':checked') ) {
151
- $('.wp-review-thumbnail-options').show();
152
- } else {
153
- $('.wp-review-thumbnail-options').hide();
154
- }
155
- });
156
-
157
- $('#wp-wp_review_desc-wrap').toggle(! $('#wp_review_hide_desc').is(':checked'));
158
- $('#wp_review_hide_desc').change(function() {
159
- $('#wp-wp_review_desc-wrap, #wp-review-desc-title').toggle(!$(this).is(':checked'));
160
- });
161
-
162
- $('#wp_review_location').on('change', function() {
163
- $('#wp_review_shortcode_hint_field').toggle($(this).val() == 'custom');
164
- });
165
- $('#wp_review_shortcode_hint').click(function() {
166
- $(this).select();
167
- });
168
- if ($('#wp_review_location').val() == 'custom') {
169
- $('#wp_review_shortcode_hint_field').show();
170
- }
171
- $('#wp_review_width').on('change', function() {
172
- var value = parseInt($(this).val());
173
- if (value < 100) {
174
- $('.wp-review-align-options').show();
175
- } else {
176
- $('.wp-review-align-options').hide();
177
- }
178
- $("#wp-review-width-slider").slider("value", parseInt(value));
179
- });
180
- $("#wp-review-width-slider").slider({
181
- range: "min",
182
- value: $('#wp_review_width').val(),
183
- step: 1,
184
- min: 1,
185
- max: 100,
186
- slide: function(event, ui) {
187
- $("#wp_review_width").val(ui.value).trigger('change');
188
- }
189
- });
190
-
191
- $('.wp-review-userReview-options').change(function(event) {
192
- $('#wp-review-through-comment-option').toggle(!!parseInt($(this).val()));
193
- });
194
-
195
-
196
-
197
- //$.review_total();
198
- //$.validate_review_value();
199
- //$('.review-star').trigger('change');
200
-
201
- /**
202
- * Color picker setup
203
- */
204
- $('.wp-review-color').wpColorPicker();
205
-
206
- $('.wp-review-theme-defaults-msg .close-notice').click(function() {
207
- $('.wp-review-theme-defaults-msg').remove();
208
- });
209
- $('.wp-review-theme-defaults-msg a.button').click(function() {
210
- return confirm('Are you sure? This may override the current settings.');
211
- });
212
- /*
213
- var $wrapper = $('.review-result-wrapper');
214
- $wrapper.on('mouseenter', 'a, i', function(e){
215
- var $this = $(this);
216
- $this.closest('.review-result-wrapper').find('.review-result').width(parseInt($this.data('value'))*20 + '%');
217
- });
218
- $wrapper.on('click', 'a, i', function(e){
219
- var $this = $(this);
220
- var $wrapper = $this.closest('.review-result-wrapper');
221
- var val = $this.data('value');
222
- $wrapper.find('.review-result').data('value', val);
223
- $wrapper.prev().val(val);
224
- });
225
- $wrapper.on('mouseleave', function(e){
226
- var $result = $(this).find('.review-result');
227
- $result.width(parseInt($result.data('value'))*20 + '%');
228
- });
229
- */
230
- $('[name=wp_review_userReview]').change(function(e){
231
- var val = $(this).val();
232
- var $type = $('#wp_review_comment_rating_type');
233
- if(ratingPermissions.commentOnly === val || ratingPermissions.both === val){
234
- $type.show();
235
- } else {
236
- $type.hide();
237
- }
238
- });
239
-
240
-
241
- $('td.wp_review_comment_rating, #wp-review-comment-rating').each(function(){
242
- var $features = $(this).find('.wp-review-rating-feature');
243
- var maxWidth = 0;
244
- $features.each(function(){
245
- var width = $(this).outerWidth();
246
- if ( width > maxWidth ) maxWidth = width;
247
- });
248
- $features.width( maxWidth + 10 );
249
- });
250
-
251
- /*$('.wrap.wp-review .nav-tab-wrapper .nav-tab').click(function(event) {
252
- event.preventDefault();
253
- var $this = $(this);
254
- window.location.hash = $this.data('tab');
255
- $this.addClass('nav-tab-active').siblings().removeClass('nav-tab-active');
256
- $('#wp-review-settings-tab-contents').find('.settings-tab-'+$this.data('tab')).show().siblings().hide();
257
- });*/
258
- var hash = window.location.hash.substr(1);
259
- if (hash == '') hash = $('#wp_review_last_tab').val();
260
- if ($('#wp-review-settings-tab-contents').find('.settings-tab-'+hash).length) {
261
- $('.wrap.wp-review .nav-tab-wrapper .nav-tab').filter('[data-tab='+hash+']').addClass('nav-tab-active').siblings().removeClass('nav-tab-active');
262
- $('#wp-review-settings-tab-contents').find('.settings-tab-'+hash).show().siblings().hide();
263
- }
264
- $(window).on('hashchange', function() {
265
- var hash = window.location.hash.substr(1);
266
- if ($('#wp-review-settings-tab-contents').find('.settings-tab-'+hash).length) {
267
- $('.wrap.wp-review .nav-tab-wrapper .nav-tab').filter('[data-tab='+hash+']').addClass('nav-tab-active').siblings().removeClass('nav-tab-active');
268
- $('#wp-review-settings-tab-contents').find('.settings-tab-'+hash).show().siblings().hide();
269
- $('#wp_review_last_tab').val(hash);
270
- }
271
- });
272
- if ($('#wp-review-migrate-log').length) {
273
- var $migrate_log = $('#wp-review-migrate-log');
274
- var migrate_started = false;
275
- var rows_left = parseInt($('#migrate-items-num').text());
276
- var migrated_rows = $('#start-migrate').data('start');
277
- var migrate_finished = false;
278
- var updatelog = function( text ) {
279
- $migrate_log.css('display', 'block').val(function(index, old) { return text + "\n" + old });
280
- }
281
- var ajax_migrate = function( startindex ) {
282
- $.ajax({
283
- url: ajaxurl,
284
- type: 'POST',
285
- dataType: 'json',
286
- data: { action: 'wp_review_migrate_ratings', start: startindex },
287
- })
288
- .done(function( data ) {
289
- $('#migrate-items-num').text(data.rowsleft);
290
- updatelog( 'Imported ratings: ' + (startindex + 1) + ' - ' + data.lastrow + '...' );
291
- if ( ! data.finished )
292
- ajax_migrate( data.lastrow );
293
- else
294
- updatelog('Import complete.');
295
- });
296
-
297
- }
298
- $('#start-migrate').click(function(event) {
299
- event.preventDefault();
300
- if (migrate_started)
301
- return false;
302
-
303
- migrate_started = true;
304
- updatelog('Import started, please wait...');
305
-
306
- ajax_migrate(migrated_rows);
307
- });
308
-
309
- }
310
-
311
  });
1
+ /*
2
+ * Plugin Name: WP Review
3
+ * Plugin URI: https://wordpress.org/plugins/wp-review/
4
+ * Description: Create reviews! Choose from Stars, Percentages 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
+ */
83
+ $('#wp-review-metabox-item').hide();
84
+ $('#wp-review-metabox-heading').hide();
85
+ $('#wp-review-metabox-desc').hide();
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
+ var ratings_initiated = false;
94
+ $('#wp_review_type').on( 'change', function() {
95
+ var selected_val = $(this).val();
96
+ var $selected_option = $(this).find('option:selected');
97
+ $('#wp-review-metabox-item').toggle( selected_val != '' );
98
+ $('#wp-review-metabox-heading').toggle( selected_val != '' );
99
+ $('#wp-review-metabox-desc').toggle( selected_val != '' );
100
+ $('#wp-review-metabox-userReview').toggle( selected_val != '' );
101
+ $('#wp_review_id_hint').toggle( selected_val != '' );
102
+ $('#wp_review_schema_group').toggle( selected_val != '' );
103
+ $('#wp-review-metabox-reviewLinks').toggle( selected_val != '' );
104
+ $('#wp_review_heading_group').toggle( selected_val != '' );
105
+
106
+ // Build dynamic text
107
+ var max = $selected_option.data('max');
108
+ var decimals = $selected_option.data('decimals');
109
+ var val_text = $selected_option.text() + ' (1 - ' + max + ')';
110
+ $('.dynamic-text').text(val_text);
111
+
112
+ current_rating_max = max;
113
+ current_rating_decimals = decimals;
114
+ $.validate_review_value( max );
115
+ if (ratings_initiated) {
116
+ $.review_total();
117
+ }
118
+ ratings_initiated = true;
119
+ }).change();
120
+
121
+ $('#wp_review_custom_colors').change(function(e) {
122
+ if ( $(this).is(':checked') ) {
123
+ $('.wp-review-color-options').show();
124
+ } else {
125
+ $('.wp-review-color-options').hide();
126
+ }
127
+ });
128
+ $('#wp_review_custom_location').change(function(e) {
129
+ if ( $(this).is(':checked') ) {
130
+ $('.wp-review-location-options').show();
131
+ } else {
132
+ $('.wp-review-location-options').hide();
133
+ }
134
+ });
135
+ $('#wp_review_custom_width').change(function(e) {
136
+ if ( $(this).is(':checked') ) {
137
+ $('.wp-review-width-options').show();
138
+ } else {
139
+ $('.wp-review-width-options').hide();
140
+ }
141
+ });
142
+ $('#wp_review_custom_author').change(function(e) {
143
+ if ( $(this).is(':checked') ) {
144
+ $('.wp-review-author-options').show();
145
+ } else {
146
+ $('.wp-review-author-options').hide();
147
+ }
148
+ });
149
+ $('#wp_review_show_on_thumbnails').change(function(e) {
150
+ if ( $(this).is(':checked') ) {
151
+ $('.wp-review-thumbnail-options').show();
152
+ } else {
153
+ $('.wp-review-thumbnail-options').hide();
154
+ }
155
+ });
156
+
157
+ $('#wp-wp_review_desc-wrap').toggle(! $('#wp_review_hide_desc').is(':checked'));
158
+ $('#wp_review_hide_desc').change(function() {
159
+ $('#wp-wp_review_desc-wrap, #wp-review-desc-title').toggle(!$(this).is(':checked'));
160
+ });
161
+
162
+ $('#wp_review_location').on('change', function() {
163
+ $('#wp_review_shortcode_hint_field').toggle($(this).val() == 'custom');
164
+ });
165
+ $('#wp_review_shortcode_hint').click(function() {
166
+ $(this).select();
167
+ });
168
+ if ($('#wp_review_location').val() == 'custom') {
169
+ $('#wp_review_shortcode_hint_field').show();
170
+ }
171
+ $('#wp_review_width').on('change', function() {
172
+ var value = parseInt($(this).val());
173
+ if (value < 100) {
174
+ $('.wp-review-align-options').show();
175
+ } else {
176
+ $('.wp-review-align-options').hide();
177
+ }
178
+ $("#wp-review-width-slider").slider("value", parseInt(value));
179
+ });
180
+ $("#wp-review-width-slider").slider({
181
+ range: "min",
182
+ value: $('#wp_review_width').val(),
183
+ step: 1,
184
+ min: 1,
185
+ max: 100,
186
+ slide: function(event, ui) {
187
+ $("#wp_review_width").val(ui.value).trigger('change');
188
+ }
189
+ });
190
+
191
+ $('.wp-review-userReview-options').change(function(event) {
192
+ $('#wp-review-through-comment-option').toggle(!!parseInt($(this).val()));
193
+ });
194
+
195
+
196
+
197
+ //$.review_total();
198
+ //$.validate_review_value();
199
+ //$('.review-star').trigger('change');
200
+
201
+ /**
202
+ * Color picker setup
203
+ */
204
+ $('.wp-review-color').wpColorPicker();
205
+
206
+ $('.wp-review-theme-defaults-msg .close-notice').click(function() {
207
+ $('.wp-review-theme-defaults-msg').remove();
208
+ });
209
+ $('.wp-review-theme-defaults-msg a.button').click(function() {
210
+ return confirm('Are you sure? This may override the current settings.');
211
+ });
212
+ /*
213
+ var $wrapper = $('.review-result-wrapper');
214
+ $wrapper.on('mouseenter', 'a, i', function(e){
215
+ var $this = $(this);
216
+ $this.closest('.review-result-wrapper').find('.review-result').width(parseInt($this.data('value'))*20 + '%');
217
+ });
218
+ $wrapper.on('click', 'a, i', function(e){
219
+ var $this = $(this);
220
+ var $wrapper = $this.closest('.review-result-wrapper');
221
+ var val = $this.data('value');
222
+ $wrapper.find('.review-result').data('value', val);
223
+ $wrapper.prev().val(val);
224
+ });
225
+ $wrapper.on('mouseleave', function(e){
226
+ var $result = $(this).find('.review-result');
227
+ $result.width(parseInt($result.data('value'))*20 + '%');
228
+ });
229
+ */
230
+ $('[name=wp_review_userReview]').change(function(e){
231
+ var val = $(this).val();
232
+ var $type = $('#wp_review_comment_rating_type');
233
+ if(ratingPermissions.commentOnly === val || ratingPermissions.both === val){
234
+ $type.show();
235
+ } else {
236
+ $type.hide();
237
+ }
238
+ });
239
+
240
+
241
+ $('td.wp_review_comment_rating, #wp-review-comment-rating').each(function(){
242
+ var $features = $(this).find('.wp-review-rating-feature');
243
+ var maxWidth = 0;
244
+ $features.each(function(){
245
+ var width = $(this).outerWidth();
246
+ if ( width > maxWidth ) maxWidth = width;
247
+ });
248
+ $features.width( maxWidth + 10 );
249
+ });
250
+
251
+ /*$('.wrap.wp-review .nav-tab-wrapper .nav-tab').click(function(event) {
252
+ event.preventDefault();
253
+ var $this = $(this);
254
+ window.location.hash = $this.data('tab');
255
+ $this.addClass('nav-tab-active').siblings().removeClass('nav-tab-active');
256
+ $('#wp-review-settings-tab-contents').find('.settings-tab-'+$this.data('tab')).show().siblings().hide();
257
+ });*/
258
+ var hash = window.location.hash.substr(1);
259
+ if (hash == '') hash = $('#wp_review_last_tab').val();
260
+ if ($('#wp-review-settings-tab-contents').find('.settings-tab-'+hash).length) {
261
+ $('.wrap.wp-review .nav-tab-wrapper .nav-tab').filter('[data-tab='+hash+']').addClass('nav-tab-active').siblings().removeClass('nav-tab-active');
262
+ $('#wp-review-settings-tab-contents').find('.settings-tab-'+hash).show().siblings().hide();
263
+ }
264
+ $(window).on('hashchange', function() {
265
+ var hash = window.location.hash.substr(1);
266
+ if ($('#wp-review-settings-tab-contents').find('.settings-tab-'+hash).length) {
267
+ $('.wrap.wp-review .nav-tab-wrapper .nav-tab').filter('[data-tab='+hash+']').addClass('nav-tab-active').siblings().removeClass('nav-tab-active');
268
+ $('#wp-review-settings-tab-contents').find('.settings-tab-'+hash).show().siblings().hide();
269
+ $('#wp_review_last_tab').val(hash);
270
+ }
271
+ });
272
+ if ($('#wp-review-migrate-log').length) {
273
+ var $migrate_log = $('#wp-review-migrate-log');
274
+ var migrate_started = false;
275
+ var rows_left = parseInt($('#migrate-items-num').text());
276
+ var migrated_rows = $('#start-migrate').data('start');
277
+ var migrate_finished = false;
278
+ var updatelog = function( text ) {
279
+ $migrate_log.css('display', 'block').val(function(index, old) { return text + "\n" + old });
280
+ }
281
+ var ajax_migrate = function( startindex ) {
282
+ $.ajax({
283
+ url: ajaxurl,
284
+ type: 'POST',
285
+ dataType: 'json',
286
+ data: { action: 'wp_review_migrate_ratings', start: startindex },
287
+ })
288
+ .done(function( data ) {
289
+ $('#migrate-items-num').text(data.rowsleft);
290
+ updatelog( 'Imported ratings: ' + (startindex + 1) + ' - ' + data.lastrow + '...' );
291
+ if ( ! data.finished )
292
+ ajax_migrate( data.lastrow );
293
+ else
294
+ updatelog('Import complete.');
295
+ });
296
+
297
+ }
298
+ $('#start-migrate').click(function(event) {
299
+ event.preventDefault();
300
+ if (migrate_started)
301
+ return false;
302
+
303
+ migrate_started = true;
304
+ updatelog('Import started, please wait...');
305
+
306
+ ajax_migrate(migrated_rows);
307
+ });
308
+
309
+ }
310
+
311
  });
assets/js/main.js CHANGED
@@ -1,101 +1,101 @@
1
- /*
2
- * Plugin Name: WP Review
3
- * Plugin URI: https://wordpress.org/plugins/wp-review/
4
- * Description: Create reviews! Choose from Stars, Percentages 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
  }
1
+ /*
2
+ * Plugin Name: WP Review
3
+ * Plugin URI: https://wordpress.org/plugins/wp-review/
4
+ * Description: Create reviews! Choose from Stars, Percentages 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,34 +1,34 @@
1
- /*
2
- * Plugin Name: WP Review
3
- * Plugin URI: https://wordpress.org/plugins/wp-review/
4
- * Description: Create reviews! Choose from Stars, Percentages 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
  });
1
+ /*
2
+ * Plugin Name: WP Review
3
+ * Plugin URI: https://wordpress.org/plugins/wp-review/
4
+ * Description: Create reviews! Choose from Stars, Percentages 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,70 +1,70 @@
1
- /*
2
- * Plugin Name: WP Review
3
- * Plugin URI: https://wordpress.org/plugins/wp-review/
4
- * Description: Create reviews! Choose from Stars, Percentages 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);
11
- var tab_content = container.find('#'+tab_name+'-tab-content');
12
-
13
- // only load content if it wasn't already loaded
14
- var isLoaded = tab_content.data('loaded');
15
-
16
- if (!isLoaded || page_num != 1) {
17
- if (!container.hasClass('wp-review-tab-loading')) {
18
- container.addClass('wp-review-tab-loading');
19
-
20
- tab_content.load(wp_review_tab.ajax_url, {
21
- action: 'wp_review_tab_widget_content',
22
- tab: tab_name,
23
- page: page_num,
24
- args: args_obj
25
- }, function() {
26
- container.removeClass('wp-review-tab-loading');
27
- tab_content.data('loaded', 1).hide().fadeIn().siblings().hide();
28
- }
29
- );
30
- }
31
- } else {
32
- tab_content.fadeIn().siblings().hide();
33
- }
34
- }
35
-
36
- jQuery(document).ready(function() {
37
- jQuery('.wp_review_tab_widget_content').each(function() {
38
- var $this = jQuery(this);
39
- var widget_id = this.id;
40
- var args = $this.data('args');
41
-
42
- // load tab content on click
43
- $this.find('.wp-review-tabs a').click(function(e) {
44
- e.preventDefault();
45
- jQuery(this).parent().addClass('selected').siblings().removeClass('selected');
46
- var tab_name = this.id.slice(0, -4); // -tab
47
- wp_review_tab_loadTabContent(tab_name, 1, $this, args);
48
- });
49
-
50
- // pagination
51
- $this.on('click', '.wp-review-tab-pagination a', function(e) {
52
- e.preventDefault();
53
- var $this_a = jQuery(this);
54
- var tab_name = $this_a.closest('.tab-content').attr('id').slice(0, -12); // -tab-content
55
- var page_num = parseInt($this_a.closest('.tab-content').children('.page_num').val());
56
-
57
- if ($this_a.hasClass('next')) {
58
- wp_review_tab_loadTabContent(tab_name, page_num + 1, $this, args);
59
- } else {
60
- $this.find('#'+tab_name+'-tab-content').data('loaded', 0);
61
- wp_review_tab_loadTabContent(tab_name, page_num - 1, $this, args);
62
- }
63
-
64
- });
65
-
66
- // load first tab now
67
- $this.find('.wp-review-tabs a').first().click();
68
- });
69
-
70
  });
1
+ /*
2
+ * Plugin Name: WP Review
3
+ * Plugin URI: https://wordpress.org/plugins/wp-review/
4
+ * Description: Create reviews! Choose from Stars, Percentages 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);
11
+ var tab_content = container.find('#'+tab_name+'-tab-content');
12
+
13
+ // only load content if it wasn't already loaded
14
+ var isLoaded = tab_content.data('loaded');
15
+
16
+ if (!isLoaded || page_num != 1) {
17
+ if (!container.hasClass('wp-review-tab-loading')) {
18
+ container.addClass('wp-review-tab-loading');
19
+
20
+ tab_content.load(wp_review_tab.ajax_url, {
21
+ action: 'wp_review_tab_widget_content',
22
+ tab: tab_name,
23
+ page: page_num,
24
+ args: args_obj
25
+ }, function() {
26
+ container.removeClass('wp-review-tab-loading');
27
+ tab_content.data('loaded', 1).hide().fadeIn().siblings().hide();
28
+ }
29
+ );
30
+ }
31
+ } else {
32
+ tab_content.fadeIn().siblings().hide();
33
+ }
34
+ }
35
+
36
+ jQuery(document).ready(function() {
37
+ jQuery('.wp_review_tab_widget_content').each(function() {
38
+ var $this = jQuery(this);
39
+ var widget_id = this.id;
40
+ var args = $this.data('args');
41
+
42
+ // load tab content on click
43
+ $this.find('.wp-review-tabs a').click(function(e) {
44
+ e.preventDefault();
45
+ jQuery(this).parent().addClass('selected').siblings().removeClass('selected');
46
+ var tab_name = this.id.slice(0, -4); // -tab
47
+ wp_review_tab_loadTabContent(tab_name, 1, $this, args);
48
+ });
49
+
50
+ // pagination
51
+ $this.on('click', '.wp-review-tab-pagination a', function(e) {
52
+ e.preventDefault();
53
+ var $this_a = jQuery(this);
54
+ var tab_name = $this_a.closest('.tab-content').attr('id').slice(0, -12); // -tab-content
55
+ var page_num = parseInt($this_a.closest('.tab-content').children('.page_num').val());
56
+
57
+ if ($this_a.hasClass('next')) {
58
+ wp_review_tab_loadTabContent(tab_name, page_num + 1, $this, args);
59
+ } else {
60
+ $this.find('#'+tab_name+'-tab-content').data('loaded', 0);
61
+ wp_review_tab_loadTabContent(tab_name, page_num - 1, $this, args);
62
+ }
63
+
64
+ });
65
+
66
+ // load first tab now
67
+ $this.find('.wp-review-tabs a').first().click();
68
+ });
69
+
70
  });
box-templates/default.php CHANGED
@@ -1,153 +1,153 @@
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
81
- if( isset( $item['wp_review_item_star'] )) {
82
- echo wp_review_rating( $item['wp_review_item_star'] );
83
- }
84
- ?>
85
- </li>
86
- <?php endforeach; ?>
87
- </ul>
88
- <?php endif; ?>
89
- <?php if ( ! $review['hide_desc'] ) : ?>
90
- <?php if ( $review['desc'] ) : ?>
91
- <div class="review-desc" itemprop="description">
92
- <p class="review-summary-title"><strong><?php echo $review['desc_title']; ?></strong></p>
93
- <?php echo do_shortcode( shortcode_unautop( wp_kses_post( wpautop( $review['desc'] ) ) ) ); ?>
94
- </div>
95
- <?php endif; ?>
96
- <?php if ( ! empty( $review['total'] ) ) :
97
- $total_text = $review['total'];
98
- if ( $review['type'] != 'star' ) {
99
- $total_text = sprintf( $wp_review_rating_types[$review['type']]['value_text'], $total_text );
100
- }
101
- ?>
102
- <div class="review-total-wrapper">
103
- <span class="review-total-box"><?php echo $total_text; ?></span>
104
- <?php if ($review['type'] != 'point' && $review['type'] != 'percentage') : ?>
105
- <?php echo wp_review_rating( $review['total'], $review['post_id'], array('class' => 'review-total') ); ?>
106
- <?php endif; ?>
107
- </div>
108
- <span itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
109
- <meta itemprop="ratingValue" content="<?php echo esc_attr( $review['total'] ); ?>">
110
- <meta itemprop="bestRating" content="<?php echo $wp_review_rating_types[$review['type']]['max']; ?>">
111
- </span>
112
- <?php endif; ?>
113
- <?php endif; ?>
114
- <?php if ( $review['user_review'] ) : ?>
115
- <div class="user-review-area visitors-review-area">
116
- <div class="user-total-wrapper">
117
- <span class="user-review-title"><?php _e( 'User Rating', 'wp-review' ); ?></span>
118
- <span class="review-total-box">
119
- <?php
120
- $usertotal_text = $review['user_review_total'];
121
- if ($review['user_review_type'] != 'star') {
122
- $usertotal_text = sprintf( $wp_review_rating_types[$review['user_review_type']]['value_text'], $review['user_review_total'] );
123
- }
124
- ?>
125
- <span class="wp-review-user-rating-total"><?php echo esc_html( $usertotal_text ); ?></span>
126
- <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>
127
- </span>
128
- </div>
129
- <?php echo wp_review_user_rating( $review['post_id'] ); ?>
130
- </div>
131
- <?php endif; // $review['user_review'] ?>
132
- </div>
133
- <?php if ($review['add_backlink']) : ?>
134
- <?php echo wp_review_get_backlink(); ?>
135
- <?php endif; ?>
136
- <?php
137
- $colors = $review['colors'];
138
- $color_output = <<<EOD
139
-
140
- <style type="text/css">
141
- .wp-review-{$review['post_id']}.review-wrapper { width: {$review['width']}%; float: {$review['align']} }
142
- .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']};}
143
- .wp-review-{$review['post_id']} .review-links a { color: {$colors['color']};}
144
- .wp-review-{$review['post_id']} .review-links a:hover { color: {$colors['fontcolor']};}
145
- .wp-review-{$review['post_id']} .review-list li, .wp-review-{$review['post_id']}.review-wrapper{ background: {$colors['bgcolor2']};}
146
- .wp-review-{$review['post_id']} .review-title, .wp-review-{$review['post_id']} .review-list li:nth-child(2n){background: {$colors['bgcolor1']};}
147
- .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']};}
148
- </style>
149
-
150
- EOD;
151
-
152
- // Apply legacy filter
153
- echo apply_filters( 'wp_review_color_output', $color_output, $review['post_id'], $review['colors'] );
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
81
+ if( isset( $item['wp_review_item_star'] )) {
82
+ echo wp_review_rating( $item['wp_review_item_star'] );
83
+ }
84
+ ?>
85
+ </li>
86
+ <?php endforeach; ?>
87
+ </ul>
88
+ <?php endif; ?>
89
+ <?php if ( ! $review['hide_desc'] ) : ?>
90
+ <?php if ( $review['desc'] ) : ?>
91
+ <div class="review-desc" itemprop="description">
92
+ <p class="review-summary-title"><strong><?php echo $review['desc_title']; ?></strong></p>
93
+ <?php echo do_shortcode( shortcode_unautop( wp_kses_post( wpautop( $review['desc'] ) ) ) ); ?>
94
+ </div>
95
+ <?php endif; ?>
96
+ <?php if ( ! empty( $review['total'] ) ) :
97
+ $total_text = $review['total'];
98
+ if ( $review['type'] != 'star' ) {
99
+ $total_text = sprintf( $wp_review_rating_types[$review['type']]['value_text'], $total_text );
100
+ }
101
+ ?>
102
+ <div class="review-total-wrapper">
103
+ <span class="review-total-box"><?php echo $total_text; ?></span>
104
+ <?php if ($review['type'] != 'point' && $review['type'] != 'percentage') : ?>
105
+ <?php echo wp_review_rating( $review['total'], $review['post_id'], array('class' => 'review-total') ); ?>
106
+ <?php endif; ?>
107
+ </div>
108
+ <span itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
109
+ <meta itemprop="ratingValue" content="<?php echo esc_attr( $review['total'] ); ?>">
110
+ <meta itemprop="bestRating" content="<?php echo $wp_review_rating_types[$review['type']]['max']; ?>">
111
+ </span>
112
+ <?php endif; ?>
113
+ <?php endif; ?>
114
+ <?php if ( $review['user_review'] ) : ?>
115
+ <div class="user-review-area visitors-review-area">
116
+ <div class="user-total-wrapper">
117
+ <span class="user-review-title"><?php _e( 'User Rating', 'wp-review' ); ?></span>
118
+ <span class="review-total-box">
119
+ <?php
120
+ $usertotal_text = $review['user_review_total'];
121
+ if ($review['user_review_type'] != 'star') {
122
+ $usertotal_text = sprintf( $wp_review_rating_types[$review['user_review_type']]['value_text'], $review['user_review_total'] );
123
+ }
124
+ ?>
125
+ <span class="wp-review-user-rating-total"><?php echo esc_html( $usertotal_text ); ?></span>
126
+ <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>
127
+ </span>
128
+ </div>
129
+ <?php echo wp_review_user_rating( $review['post_id'] ); ?>
130
+ </div>
131
+ <?php endif; // $review['user_review'] ?>
132
+ </div>
133
+ <?php if ($review['add_backlink']) : ?>
134
+ <?php echo wp_review_get_backlink(); ?>
135
+ <?php endif; ?>
136
+ <?php
137
+ $colors = $review['colors'];
138
+ $color_output = <<<EOD
139
+
140
+ <style type="text/css">
141
+ .wp-review-{$review['post_id']}.review-wrapper { width: {$review['width']}%; float: {$review['align']} }
142
+ .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']};}
143
+ .wp-review-{$review['post_id']} .review-links a { color: {$colors['color']};}
144
+ .wp-review-{$review['post_id']} .review-links a:hover { color: {$colors['fontcolor']};}
145
+ .wp-review-{$review['post_id']} .review-list li, .wp-review-{$review['post_id']}.review-wrapper{ background: {$colors['bgcolor2']};}
146
+ .wp-review-{$review['post_id']} .review-title, .wp-review-{$review['post_id']} .review-list li:nth-child(2n){background: {$colors['bgcolor1']};}
147
+ .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']};}
148
+ </style>
149
+
150
+ EOD;
151
+
152
+ // Apply legacy filter
153
+ echo apply_filters( 'wp_review_color_output', $color_output, $review['post_id'], $review['colors'] );
filter-list.php CHANGED
@@ -1,132 +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
- /**
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
  }
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,48 +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
-
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
  ?>
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
@@ -1,1369 +1,1369 @@
1
- <?php
2
- ob_start();
3
- /**
4
- * WP Review
5
- *
6
- * @since 2.0
7
- * @copyright Copyright (c) 2013, MyThemesShop
8
- * @author MyThemesShop
9
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10
- */
11
-
12
- $options = get_option('wp_review_options');
13
-
14
- /* Display the meta box data below 'the_content' hook. */
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');
67
- $custom_location = get_post_meta( $post->ID, 'wp_review_custom_location', true );
68
- $location = get_post_meta( $post->ID, 'wp_review_location', true );
69
- if (!$custom_location && !empty($options['review_location'])) {
70
- $location = $options['review_location'];
71
- }
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_singular() ) {
76
- return $content;
77
- }
78
- $review = wp_review_get_review_box();
79
- if ( 'bottom' == $location ) {
80
- global $multipage, $numpages, $page;
81
- if( $multipage ) {
82
- if ($page == $numpages) {
83
- return $content .= $review;
84
- } else {
85
- return $content;
86
- }
87
- } else {
88
- return $content .= $review;
89
- }
90
- } elseif ( 'top' == $location ) {
91
- return $review .= $content;
92
- } else {
93
- return $content;
94
- }
95
- }
96
-
97
- /**
98
- * Retrieve only total rating.
99
- * To be used on archive pages, etc.
100
- *
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
- $atts = shortcode_atts( array( 'id' => null, 'class' => 'review-total-only review-total-shortcode' ), $atts );
161
- $output = wp_review_show_total( false, $atts['class'], $atts['id'], array( 'shortcode' => true ) );
162
-
163
- return apply_filters( 'wp_review_total_shortcode', $output, $atts );
164
- }
165
-
166
- function wp_review_shortcode( $atts, $content = "") {
167
- $atts = shortcode_atts( array( 'id' => null ), $atts );
168
- $output = wp_review_get_data($atts['id']);
169
-
170
- return apply_filters( 'wp_review_shortcode', $output, $atts );
171
- }
172
-
173
- function wp_review_visitor_rating_shortcode( $atts, $content = "" ) {
174
- wp_enqueue_style( 'wp_review-style' );
175
- wp_enqueue_script( 'wp_review-js' );
176
-
177
- $atts = shortcode_atts( array( 'id' => null ), $atts );
178
- $id = empty( $atts['id'] ) ? get_the_ID() : absint( $atts['id'] );
179
-
180
- $text = '<div class="wp-review-' . $id . ' review-wrapper visitor-rating-shortcode">';
181
- $text .= wp_review_user_rating( $id );
182
- $text .= '</div>';
183
-
184
- return apply_filters( 'wp_review_visitor_rating_shortcode', $text, $atts );
185
- }
186
-
187
- function mts_get_post_reviews( $post_id, $force = false ){
188
- 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 ) ) ) {
189
- return array( 'rating' => $post_reviews, 'count' => $review_count );
190
- }
191
-
192
- if( is_numeric( $post_id ) && $post_id > 0 ){
193
- $comments = get_comments( array(
194
- 'post_id' => $post_id,
195
- 'type' => WP_REVIEW_COMMENT_TYPE_VISITOR,
196
- 'status' => 'approve'
197
- ) );
198
- $rating = array_reduce( $comments, 'wpreview_comments_count_callback', 0 );
199
-
200
- $count = count( $comments );
201
-
202
- $post_reviews = array(
203
- 'rating' => $count > 0 ? round( $rating / $count, 2 ) : 0,
204
- 'count' => $count,
205
- );
206
-
207
- update_post_meta( $post_id, 'wp_review_user_reviews', $post_reviews['rating'] );
208
- update_post_meta( $post_id, 'wp_review_review_count', $post_reviews['count'] );
209
-
210
- return $post_reviews;
211
- }
212
- }
213
-
214
- function wpreview_comments_count_callback( $carry, $comment ) {
215
- $rating = get_comment_meta( $comment->comment_ID, WP_REVIEW_VISITOR_RATING_METAKEY, true );
216
- $carry += (int) $rating;
217
- return $carry;
218
- }
219
-
220
- /**
221
- *Check if user has reviewed this post previously
222
- *
223
- * @param $post_id
224
- * @param $user_id
225
- * @param $ip
226
- * @param string $type
227
- *
228
- * @return bool
229
- */
230
- function hasPreviousReview( $post_id, $user_id, $ip, $type = 'any' ){
231
- if( is_numeric( $post_id ) && $post_id > 0 ){
232
- $args = array( 'post_id' => $post_id, 'count' => true, 'user_id' => 0 );
233
- set_query_var( 'wp_review_commenttype', $type );
234
- add_filter( 'pre_get_comments', 'wp_review_add_comment_type_to_query' );
235
- if ( $user_id ) {
236
- $args['user_id'] = $user_id;
237
- } else {
238
- set_query_var( 'wp_review_ip', $ip );
239
- add_filter( 'comments_clauses', 'wp_review_filter_comment_by_ip' );
240
- }
241
- $count = intval( get_comments( $args ) );
242
- remove_filter( 'pre_get_comments', 'wp_review_add_comment_type_to_query' );
243
- remove_filter( 'comments_clauses', 'wp_review_filter_comment_by_ip' );
244
- return $count > 0;
245
- }
246
- return false;
247
- }
248
-
249
- /**
250
- * Add the comment type to comment query.
251
- *
252
- * @param WP_Comment_Query $query
253
- *
254
- * @return WP_Comment_Query
255
- */
256
- function wp_review_add_comment_type_to_query( \WP_Comment_Query $query ) {
257
- $commenttype = get_query_var( 'wp_review_commenttype' );
258
- if ( 'any' === $commenttype ) {
259
- $query->query_vars['type__in'] = array( WP_REVIEW_COMMENT_TYPE_VISITOR );
260
- } else {
261
- $query->query_vars['type'] = $commenttype;
262
- }
263
- return $query;
264
- }
265
-
266
- /**
267
- * Add a conditional to filter the comment query by IP.
268
- *
269
- * @param array $clauses
270
- *
271
- * @return array
272
- */
273
- function wp_review_filter_comment_by_ip( array $clauses ) {
274
- global $wpdb;
275
- $clauses['where'] .= $wpdb->prepare( ' AND comment_author_IP = %s', get_query_var( 'wp_review_ip' ) );
276
- return $clauses;
277
- }
278
-
279
- function getPreviousReview( $post_id, $user_id, $ip, $type = 'any' ) {
280
- if( is_numeric( $post_id ) && $post_id > 0 ){
281
- $args = array( 'post_id' => $post_id, 'user_id' => 0 );
282
- set_query_var( 'wp_review_commenttype', $type );
283
- add_filter( 'pre_get_comments', 'wp_review_add_comment_type_to_query' );
284
- if ( $user_id ) {
285
- $args['user_id'] = array( $user_id );
286
- } else {
287
- set_query_var( 'wp_review_ip', $ip );
288
- add_filter( 'comments_clauses', 'wp_review_filter_comment_by_ip' );
289
- }
290
-
291
- $comment = get_comments( $args );
292
- remove_filter( 'pre_get_comments', 'wp_review_add_comment_type_to_query' );
293
- remove_filter( 'comments_clauses', 'wp_review_filter_comment_by_ip' );
294
-
295
- if ( ! empty( $comment ) ) {
296
- return get_comment_meta( $comment[0]->comment_ID, WP_REVIEW_COMMENT_RATING_METAKEY, true );
297
- }
298
- }
299
- return false;
300
- }
301
-
302
- /**
303
- * AJAX User review rating
304
- * Replaces mts_review_get_review()
305
- * @return null
306
- */
307
- function wp_review_ajax_rate() {
308
- global $wp_review_rating_types;
309
- check_ajax_referer( 'wp-review-security', 'nonce' );
310
- $options = get_option('wp_review_options');
311
- $post_id = intval($_POST['post_id']);
312
- $user_id = is_user_logged_in() ? get_current_user_id() : 0;
313
- $review = round( abs( filter_input( INPUT_POST, 'review' ) ), 2 );
314
- $type = wp_review_get_post_user_review_type( $post_id );
315
- $uip = wp_review_get_user_ip();
316
-
317
- $output = array('status' => '', 'html' => '', 'rating_total' => '', 'rating_count' => '');
318
-
319
- if ( empty( $type ) ) {
320
- // No user reviews allowed
321
- echo wp_json_encode( $output );
322
- exit;
323
- }
324
-
325
- add_action( 'comment_duplicate_trigger', 'wp_review_comment_duplicate_trigger' );
326
-
327
- // don't allow higher rating than max
328
- if ($review > $wp_review_rating_types[$type]['max']) {
329
- $review = $wp_review_rating_types[$type]['max'];
330
- }
331
-
332
- if ( $review > 0 &&
333
- ! hasPreviousReview( $post_id, $user_id, $uip, WP_REVIEW_COMMENT_TYPE_VISITOR ) &&
334
- (
335
- ( is_user_logged_in() && ! empty( $options['registered_only'] ) ) ||
336
- ( is_user_logged_in() && empty( $options['registered_only'] ) ) ||
337
- ( ! is_user_logged_in() && empty( $options['registered_only'] ) )
338
- )
339
- ) {
340
- if ( $insert = wp_insert_comment( array(
341
- 'user_id' => $user_id,
342
- 'comment_type' => WP_REVIEW_COMMENT_TYPE_VISITOR,
343
- 'comment_post_ID' => $post_id,
344
- 'comment_parent' => 0,
345
- 'comment_author_IP' => $uip,
346
- 'comment_content' => sprintf( __('Visitor Rating: %s', 'wp-review'), sprintf( $wp_review_rating_types[$type]['value_text'], $review ) ),
347
- 'comment_agent' => isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT']: '',
348
- 'comment_date' => current_time('mysql'),
349
- 'comment_date_gmt' => current_time( 'mysql', 1 ),
350
- 'comment_approved' => 1
351
- ) ) ) {
352
- if ( update_comment_meta( $insert, WP_REVIEW_VISITOR_RATING_METAKEY, $review ) ) {
353
- $post_reviews = mts_get_post_reviews( $post_id, true );
354
-
355
- // "lock" user review type when the first rating comes in
356
- // to prevent issues with changing types
357
- // update_post_meta( $post_id, 'wp_review_user_review_type_locked', 1 );
358
-
359
- //echo $post_reviews['rating'] . '|' . $post_reviews['count'];
360
- $output['status'] = 'ok';
361
- $output['html'] = wp_review_rating( $post_reviews['rating'], $post_id, array( 'user_rating' => true ) );
362
- $output['rating_total'] = $post_reviews['rating'];
363
- $output['rating_count'] = $post_reviews['count'];
364
- echo wp_json_encode( $output );
365
- exit;
366
- } else {
367
- wp_delete_comment( $insert );
368
- }
369
- }
370
- }
371
- $post_reviews = mts_get_post_reviews( $post_id );
372
- $output['status'] = 'fail';
373
- $output['error'] = 'db_error';
374
- $output['rating_total'] = $post_reviews['rating'];
375
- $output['rating_count'] = $post_reviews['count'];
376
- $output['html'] = wp_review_rating( $post_reviews['rating'], $post_id, array( 'user_rating' => true ) );
377
- echo wp_json_encode( $output );
378
- exit;
379
- }
380
-
381
- function wp_review_comment_duplicate_trigger( $commentdata ) {
382
- $post_reviews = mts_get_post_reviews( $commentdata['comment_post_ID'] );
383
- $output['status'] = 'fail';
384
- $output['error'] = 'duplicate';
385
- $output['rating_total'] = $post_reviews['rating'];
386
- $output['rating_count'] = $post_reviews['count'];
387
- $output['html'] = wp_review_rating( $post_reviews['rating'], $commentdata['comment_post_ID'], array( 'user_rating' => true ) );
388
- echo wp_json_encode( $output );
389
- exit;
390
- }
391
-
392
- /*
393
- * Get review with Ajax
394
- */
395
- function mts_review_get_review() {
396
- // security
397
- check_ajax_referer( 'wp-review-security', 'nonce' );
398
-
399
- $options = get_option('wp_review_options');
400
- $post_id = intval($_POST['post_id']);
401
- $user_id = is_user_logged_in() ? get_current_user_id() : 0;
402
- $review = round( abs( filter_input( INPUT_POST, 'review' ) ), 2 );
403
-
404
- $review_text = $review;
405
-
406
- $uip = wp_review_get_user_ip();
407
-
408
- add_action( 'comment_duplicate_trigger', 'wp_review_comment_duplicate_trigger' );
409
-
410
- if ( $review > 0 &&
411
- ! hasPreviousReview( $post_id, $user_id, $uip, WP_REVIEW_COMMENT_TYPE_VISITOR ) &&
412
- (
413
- ( is_user_logged_in() && ! empty( $options['registered_only'] ) ) ||
414
- ( is_user_logged_in() && empty( $options['registered_only'] ) ) ||
415
- ( ! is_user_logged_in() && empty( $options['registered_only'] ) )
416
- )
417
- ) {
418
- if ( $insert = wp_insert_comment( array(
419
- 'user_id' => $user_id,
420
- 'comment_type' => WP_REVIEW_COMMENT_TYPE_VISITOR,
421
- 'comment_post_ID' => $post_id,
422
- 'comment_parent' => 0,
423
- 'comment_author_IP' => $uip,
424
- 'comment_content' => sprintf(__('Visitor Rating: %s', 'wp-review'), $review_text),
425
- 'comment_agent' => isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT']: '',
426
- 'comment_date' => current_time('mysql'),
427
- 'comment_date_gmt' => current_time( 'mysql', 1 ),
428
- 'comment_approved' => 1
429
- ) ) ) {
430
- if ( update_comment_meta( $insert, WP_REVIEW_VISITOR_RATING_METAKEY, $review ) ) {
431
- $post_reviews = mts_get_post_reviews( $post_id, true );
432
-
433
- echo $post_reviews['rating'] . '|' . $post_reviews['count'];
434
- exit;
435
- } else {
436
- wp_delete_comment( $insert );
437
- }
438
- }
439
- }
440
-
441
- echo 'MTS_REVIEW_DB_ERROR';
442
- exit;
443
- }
444
-
445
-
446
- function wp_review_theme_defaults($new_options, $force_change = false) {
447
- global $pagenow;
448
- $opt_name = 'wp_review_options_'.wp_get_theme();
449
- $options = get_option('wp_review_options');
450
- if (empty($options)) $options = array();
451
- $options_updated = get_option( $opt_name );
452
- // if the theme was just activated OR options weren't updated yet
453
- if ( empty( $options_updated ) || $options_updated != $new_options || $force_change || ( isset( $_GET['activated'] ) && $pagenow == 'themes.php' )) {
454
- update_option( 'wp_review_options', array_merge($options, $new_options) );
455
- update_option( $opt_name, $new_options );
456
- }
457
- }
458
-
459
- /**
460
- * Exclude review-type comments from being included in the comment query.
461
- *
462
- * @param WP_Comment_Query $query
463
- */
464
- function wp_review_exclude_review_comments(\WP_Comment_Query $query) {
465
- 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'] )) ) {
466
- $query->query_vars['type__not_in'] = array_merge(
467
- is_array( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array(),
468
- array( WP_REVIEW_COMMENT_TYPE_VISITOR )
469
- );
470
- }
471
- }
472
- add_action( 'pre_get_comments', 'wp_review_exclude_review_comments', 15 );
473
-
474
- /**
475
- * Add "Reviews" to comments table view.
476
- *
477
- * @param array $comment_types
478
- *
479
- * @return mixed
480
- */
481
- function wp_review_add_to_comment_table_dropdown( $comment_types ) {
482
- $comment_types[ WP_REVIEW_COMMENT_TYPE_VISITOR ] = __( 'Visitor Reviews', 'wp-review' );
483
-
484
- return $comment_types;
485
- }
486
- add_filter( 'admin_comment_types_dropdown', 'wp_review_add_to_comment_table_dropdown' );
487
-
488
- /**
489
- * @param int $post_id
490
- *
491
- * @return string
492
- *
493
- * 0 - Disabled
494
- * 2 - Visitor Rating Only
495
- */
496
- function wp_review_get_user_rating_setup( $post_id ) {
497
- /* Retrieve an existing value from the database. */
498
- $options = get_option( 'wp_review_options' );
499
- //$default = empty( $options['default_user_review_type'] ) ? WP_REVIEW_REVIEW_DISABLED : $options['default_user_review_type'];
500
- $default = WP_REVIEW_REVIEW_DISABLED;
501
- $userReviews = get_post_meta( $post_id, 'wp_review_userReview', true );
502
- $enabled = empty( $userReviews ) ? $default : $userReviews;
503
- if ( is_array( $userReviews ) ) {
504
- $enabled = $userReviews[0];
505
- }
506
-
507
- // Compatibility with the old option.
508
- if ( '1' === $enabled ) {
509
- $enabled = WP_REVIEW_REVIEW_VISITOR_ONLY;
510
- }
511
-
512
- return $enabled;
513
- }
514
-
515
- /**
516
- * Exclude visitor ratings when updating a post's comment count.
517
- * @param $post_id
518
- * @param $new
519
- * @param $old
520
- *
521
- * @internal param $comment_id
522
- * @internal param $comment
523
- */
524
- function wp_review_exclude_visitor_review_count( $post_id, $new, $old ) {
525
- global $wpdb;
526
- $count = get_comments( array(
527
- 'type__not_in' => array( WP_REVIEW_COMMENT_TYPE_VISITOR ),
528
- 'post_id' => $post_id,
529
- 'count' => true
530
- ) );
531
- $wpdb->update( $wpdb->posts, array( 'comment_count' => $count ), array( 'ID' => $post_id ) );
532
-
533
- // Update user review count.
534
- mts_get_post_reviews( $post_id, true );
535
-
536
- clean_post_cache( $post_id );
537
- }
538
- add_action( 'wp_update_comment_count', 'wp_review_exclude_visitor_review_count', 10, 3 );
539
-
540
- /**
541
- * Get the schema type of a review.
542
- * @param int $post_id
543
- *
544
- * @return mixed|string
545
- */
546
- function wp_review_get_review_schema( $post_id ) {
547
- return 'Thing';
548
- }
549
-
550
- /**
551
- * Get the IP of the current user.
552
- *
553
- * @return string
554
- */
555
- function wp_review_get_user_ip() {
556
- if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
557
- $ip = $_SERVER['HTTP_CLIENT_IP'];
558
- } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
559
- $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
560
- } else {
561
- $ip = $_SERVER['REMOTE_ADDR'];
562
- }
563
-
564
- return $ip;
565
- }
566
-
567
- /**
568
- * Get the HTML for user reviews in review box.
569
- *
570
- * @param $post_id
571
- * @param bool $votable
572
- * @param bool $force_display
573
- *
574
- * @return string
575
- */
576
- function wp_review_user_review( $post_id, $votable = true, $force_display = false ) {
577
- $review = '';
578
-
579
- if ( $force_display || in_array( wp_review_get_user_rating_setup( $post_id ), array( WP_REVIEW_REVIEW_VISITOR_ONLY ) ) ) {
580
- $allowedClass = 'allowed-to-rate';
581
- $hasNotRatedClass = ' has-not-rated-yet';
582
- $postReviews = mts_get_post_reviews( $post_id );
583
- $userTotal = $postReviews['rating'];
584
- $usersReviewsCount = $postReviews['count'];
585
- $total = get_post_meta( $post_id, 'wp_review_total', true );
586
- $type = get_post_meta( $post_id, 'wp_review_user_review_type', true );
587
-
588
- $options = get_option('wp_review_options');
589
- $custom_colors = get_post_meta( $post_id, 'wp_review_custom_colors', true );
590
-
591
- $colors['color'] = get_post_meta( $post_id, 'wp_review_color', true );
592
- if( empty($colors['color']) ) $colors['color'] = '#333333';
593
- $colors['type'] = get_post_meta( $post_id, 'wp_review_type', true );
594
- $colors['fontcolor'] = get_post_meta( $post_id, 'wp_review_fontcolor', true );
595
- $colors['bgcolor1'] = get_post_meta( $post_id, 'wp_review_bgcolor1', true );
596
- $colors['bgcolor2'] = get_post_meta( $post_id, 'wp_review_bgcolor2', true );
597
- $colors['bordercolor'] = get_post_meta( $post_id, 'wp_review_bordercolor', true );
598
- if ( ! $custom_colors && ! empty($options['colors'] ) && is_array($options['colors'] ) ) {
599
- $colors = array_merge($colors, $options['colors']);
600
- }
601
- $colors = apply_filters('wp_review_colors', $colors, $post_id);
602
- $color = $colors['color'];
603
-
604
- $user_id = '';
605
- if ( is_user_logged_in() ) {
606
- $user_id = get_current_user_id();
607
- }
608
-
609
-
610
- if ( $userTotal == '' ) {
611
- $userTotal = '0.0';
612
- }
613
- $value = $userTotal;
614
-
615
- 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'] ) ) ) {
616
- $hasNotRatedClass = '';
617
- }
618
-
619
- $class = $allowedClass . $hasNotRatedClass;
620
-
621
- $template = mts_get_template_path( $type, 'star-output' );
622
- set_query_var( 'rating', compact( 'value', 'usersReviewsCount', 'user_id', 'class', 'post_id', 'color', 'colors' ) );
623
- ob_start();
624
- load_template( $template, false );
625
- $review = ob_get_contents();
626
- ob_end_clean();
627
-
628
-
629
-
630
- if ( $userTotal !== '0.0' && $total === '' ) {// dont'show if no user ratings and there is review
631
- $review .= '<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
632
- <meta itemprop="ratingValue" content="' . $userTotal . '" />
633
- <meta itemprop="reviewCount" content="' . $usersReviewsCount . '" />
634
- </div>';
635
- }
636
- }
637
-
638
- return $review;
639
- }
640
-
641
- /**
642
- * Get available review types/templates.
643
- *
644
- * @param string $type
645
- *
646
- * @return array
647
- */
648
- /*
649
- function wp_review_get_review_types( $type = '' ) {
650
- $dirs = array(
651
- WP_REVIEW_DIR . 'templates/',
652
- get_stylesheet_directory() . '/wp-review/',
653
- );
654
- $types = array();
655
-
656
- foreach ( $dirs as $dir ) {
657
- if ( is_dir( $dir ) ) {
658
- $handle = opendir( $dir );
659
- while ( $file = readdir( $handle ) ) {
660
- if ( '..' === $file || '.' === $file ) {
661
- continue;
662
- }
663
- $key = basename( $file, '.php' );
664
-
665
- if ( ! empty( $type ) && substr( $key, -strlen( $type ) ) !== $type ) {
666
- continue;
667
- }
668
- if ( empty( $type ) and strpos( $key, '-' ) !== false ) {
669
- continue;
670
- }
671
-
672
- $template_data = implode( '', file( $dir . $file ) );
673
- if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) ) {
674
- $types[ $key ] = $name[1];
675
- } else {
676
- $keys_arr = explode( '-', $key );
677
- $types[ $key ] = ucfirst( reset( $keys_arr ) );
678
- }
679
- }
680
- }
681
- }
682
-
683
- return $types;
684
- }
685
- */
686
-
687
- /**
688
- * Get the path to a template prioritizing theme directory first.
689
- *
690
- * @param $type
691
- * @param string $default
692
- *
693
- * @return string
694
- */
695
- function mts_get_template_path( $type, $default = 'star' ) {
696
- $template = get_stylesheet_directory() . '/wp-review/' . $type . '.php';
697
-
698
- // Template does not exist on theme dir, use plugin dir.
699
- if ( ! file_exists( $template ) ) {
700
- $template = WP_REVIEW_DIR . 'rating-types/' . $type . '.php';
701
- }
702
-
703
- // Template does not exist, fallback to star.
704
- if ( ! file_exists( $template ) ) {
705
- $template = WP_REVIEW_DIR . 'rating-types/' . $default . '.php';
706
- }
707
-
708
- return $template;
709
- }
710
-
711
- function wp_review_ajax_migrate_ratings() {
712
- $start = isset( $_POST['start'] ) ? intval( $_POST['start'] ) : 0;
713
- $limit = 100;
714
-
715
- if ( get_option( 'wp_review_has_migrated', false ) ) {
716
- return;
717
- }
718
-
719
- global $wpdb;
720
-
721
- $current_blog_id = get_current_blog_id();
722
-
723
- $query = $wpdb->get_results( 'SELECT * from '.$wpdb->base_prefix.'mts_wp_reviews WHERE blog_id = '.$current_blog_id.' LIMIT '.$limit.' OFFSET '.$start );
724
-
725
- foreach ( $query as $review ) {
726
-
727
- if ($review->rate == 0)
728
- continue; // skip 0-star ratings
729
-
730
- if ( $insert = wp_insert_comment( array(
731
- 'user_id' => $review->user_id,
732
- 'comment_type' => WP_REVIEW_COMMENT_TYPE_VISITOR,
733
- 'comment_post_ID' => $review->post_id,
734
- 'comment_parent' => 0,
735
- 'comment_content' => sprintf(__('Visitor Rating: %s', 'wp-review'), sprintf( __( '%s Stars' , 'wp-review' ), $review->rate ) ),
736
- 'comment_author_IP' => $review->user_ip,
737
- 'comment_date' => gmdate( 'Y-m-d H:i:s', ( strtotime( $review->date ) + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) ),
738
- 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', strtotime( $review->date ) ),
739
- 'comment_approved' => 1
740
- ) ) ) {
741
- if ( update_comment_meta( $insert, WP_REVIEW_VISITOR_RATING_METAKEY, $review->rate ) ) {
742
- // Purge cache.
743
- mts_get_post_reviews( $review->post_id, true );
744
- } else {
745
- wp_delete_comment( $insert );
746
- }
747
- }
748
-
749
- }
750
-
751
- $end = $start + count($query);//$wpdb->num_rows;
752
- //$migrated_rows = get_option( 'wp_review_migrated_rows', 0 );
753
- update_option( 'wp_review_migrated_rows', $end );
754
-
755
- $total_rows = $wpdb->get_var( 'SELECT COUNT(*) FROM '.$wpdb->base_prefix.'mts_wp_reviews WHERE blog_id = '.$current_blog_id );
756
- $migration_finished = 0;
757
- if ( $total_rows == $end ) {
758
- update_option( 'wp_review_has_migrated', 1 );
759
- $migration_finished = 1;
760
- }
761
-
762
- echo wp_json_encode( array( 'start' => $start, 'lastrow' => $end, 'rowsleft' => $total_rows - $end, 'finished' => $migration_finished ) );
763
-
764
-
765
- die();
766
- }
767
-
768
- /*
769
- * Custom Rating Types
770
- *
771
- */
772
- $wp_review_rating_types = array();
773
-
774
- function wp_review_register_rating_type( $rating_type, $args ) {
775
- global $wp_review_rating_types;
776
-
777
-
778
- if (empty($args['output_template']) && empty($args['template']))
779
- return false;
780
-
781
- // If it has combined 'template'
782
- // or 'input_template' (for user rating)
783
- if (!empty($args['template']) || !empty($args['input_template']))
784
- $args['user_rating'] = true;
785
- else
786
- $args['user_rating'] = false;
787
-
788
- $wp_review_rating_types[$rating_type] = $args;
789
-
790
- return true;
791
- }
792
- add_action( 'init', 'wp_review_register_default_rating_types' );
793
-
794
- function wp_review_register_default_rating_types() {
795
- wp_review_register_rating_type( 'star', array(
796
- 'label' => __('Star', 'wp-review'),
797
- 'max' => 5,
798
- 'decimals' => 1,
799
- 'value_text' => __('%s Stars', 'wp-review'),
800
- 'value_text_singular' => __('%s Star', 'wp-review'),
801
- 'input_template' => WP_REVIEW_DIR . 'rating-types/star-input.php',
802
- 'output_template' => WP_REVIEW_DIR . 'rating-types/star-output.php',
803
- ) );
804
-
805
- wp_review_register_rating_type( 'point', array(
806
- 'label' => __('Point', 'wp-review'),
807
- 'max' => 10,
808
- 'decimals' => 1,
809
- 'value_text' => __('%s/10', 'wp-review'),
810
- 'value_text_singular' => __('%s/10', 'wp-review'),
811
- 'input_template' => WP_REVIEW_DIR . 'rating-types/point-input.php',
812
- 'output_template' => WP_REVIEW_DIR . 'rating-types/point-output.php',
813
- ) );
814
-
815
- wp_review_register_rating_type( 'percentage', array(
816
- 'label' => __('Percentage', 'wp-review'),
817
- 'max' => 100,
818
- 'decimals' => 0,
819
- 'value_text' => __('%s%%', 'wp-review'),
820
- 'value_text_singular' => __('%s%%', 'wp-review'),
821
- 'input_template' => WP_REVIEW_DIR . 'rating-types/percentage-input.php',
822
- 'output_template' => WP_REVIEW_DIR . 'rating-types/percentage-output.php',
823
- ) );
824
- }
825
-
826
- function wp_review_get_post_review_type( $post_id = null ) {
827
- global $post, $wp_review_rating_types;
828
-
829
- if ( empty( $post_id ) ) {
830
- if ( is_a( $post, 'WP_Post') )
831
- $post_id = $post->ID;
832
- else
833
- return '';
834
- }
835
-
836
- $type = get_post_meta( $post_id, 'wp_review_type', true );
837
- if ( empty( $type ) )
838
- return ''; // not a review
839
-
840
- $output = '';
841
- if ( isset( $wp_review_rating_types[$type] ) )
842
- $output = $type;
843
- else
844
- $output = 'star'; // fallback if specific $type is not available anymore
845
-
846
- return apply_filters( 'wp_review_get_review_type', $output, $post_id );
847
- }
848
-
849
- function wp_review_get_post_user_review_type( $post_id = null ) {
850
- global $post, $wp_review_rating_types;
851
-
852
- if ( empty( $post_id ) )
853
- $post_id = $post->ID;
854
-
855
- $type = wp_review_get_post_review_type( $post_id );
856
- if ( empty( $type ) )
857
- return ''; // not a review
858
-
859
- $userreview_type = get_post_meta( $post_id, 'wp_review_user_review_type', true );
860
- if ( empty( $userreview_type ) )
861
- $userreview_type = 'star';
862
-
863
- $userreviews = in_array( wp_review_get_user_rating_setup( $post_id ), array( WP_REVIEW_REVIEW_VISITOR_ONLY ) );
864
- if ( ! $userreviews )
865
- return ''; // user ratings not enabled
866
-
867
- $output = '';
868
- if ( isset( $wp_review_rating_types[$userreview_type] ) && $wp_review_rating_types[$userreview_type]['user_rating'] )
869
- $output = $userreview_type;
870
- else
871
- $output = 'star'; // fallback if specific $type is not available
872
-
873
- return apply_filters( 'wp_review_get_user_review_type', $output, $post_id );
874
- }
875
-
876
- /*
877
- * Custom Box Templates
878
- *
879
- */
880
- function wp_review_get_post_box_template( $post_id ) {
881
- global $post, $wp_review_rating_types;
882
-
883
- if ( empty( $post_id ) )
884
- $post_id = $post->ID;
885
-
886
- $type = wp_review_get_post_review_type( $post_id );
887
- if ( empty( $type ) )
888
- return ''; // not a review
889
-
890
- $template = get_post_meta( $post_id, 'wp_review_box_template', true );
891
- if ( empty( $template ) || ! wp_review_locate_box_template( $template ) )
892
- $template = 'default.php'; // fallback to default.php
893
-
894
- return apply_filters( 'wp_review_get_box_template', $template, $post_id );
895
- }
896
-
897
- function wp_review_locate_box_template( $template_name, $return_full_path = true ) {
898
- // We look for box templates in:
899
- // 1. plugins_dir/box-templates
900
- // 2. theme_dir/wp-review
901
- // 3. childtheme_dir/wp-review
902
- // 4... Use filter to add more
903
- $default_paths = array(
904
- WP_REVIEW_DIR.'box-templates',
905
- get_template_directory().'/wp-review',
906
- get_stylesheet_directory().'/wp-review',
907
- );
908
- $template_paths = apply_filters( 'wp_review_box_template_paths', $default_paths );
909
-
910
-
911
- $paths = array_reverse($template_paths);
912
- $located = '';
913
- $path_partial = '';
914
- foreach ($paths as $path) {
915
- if (file_exists($full_path = trailingslashit($path).$template_name)) {
916
- $located = $full_path;
917
- $path_partial = $path;
918
- break;
919
- }
920
- }
921
- return ($return_full_path ? $located : $path_partial);
922
- }
923
-
924
- /**
925
- * Shows rating using output template
926
- *
927
- * @param mixed $value rating value
928
- * @param mixed $post_id optional post ID
929
- * @return [type] [description]
930
- */
931
- function wp_review_rating( $value, $post_id = null, $args = array() ) {
932
- global $wp_review_rating_types, $post;
933
-
934
- if ( ! empty( $args['user_rating'] ) ) {
935
- $type = wp_review_get_post_user_review_type( $post_id );
936
- } else {
937
- $type = wp_review_get_post_review_type( $post_id );
938
- }
939
-
940
- if ( empty( $type ) )
941
- return '';
942
-
943
- if (empty($post_id))
944
- $post_id = $post->ID;
945
-
946
- $options = get_option('wp_review_options');
947
- $custom_colors = get_post_meta( $post_id, 'wp_review_custom_colors', true );
948
- $colors['color'] = get_post_meta( $post_id, 'wp_review_color', true );
949
- if( empty($colors['color']) ) $colors['color'] = '#333333';
950
- $colors['type'] = get_post_meta( $post_id, 'wp_review_type', true );
951
- $colors['fontcolor'] = get_post_meta( $post_id, 'wp_review_fontcolor', true );
952
- $colors['bgcolor1'] = get_post_meta( $post_id, 'wp_review_bgcolor1', true );
953
- $colors['bgcolor2'] = get_post_meta( $post_id, 'wp_review_bgcolor2', true );
954
- $colors['bordercolor'] = get_post_meta( $post_id, 'wp_review_bordercolor', true );
955
- if ( ! $custom_colors && ! empty($options['colors'] ) && is_array($options['colors'] ) ) {
956
- $colors = array_merge($colors, $options['colors']);
957
- }
958
- $colors = apply_filters('wp_review_colors', $colors, $post_id);
959
-
960
- // Override colors if is_admin()
961
- if (is_admin() && !defined('DOING_AJAX')) {
962
- $admin_colors = array(
963
- 'color' => '#444444',
964
- 'bgcolor1' => '#ffffff',
965
- );
966
- $colors = array_merge($colors, $admin_colors);
967
- }
968
- $color = $colors['color'];
969
-
970
- // don't allow higher rating than max
971
- if ($value > $wp_review_rating_types[$type]['max']) {
972
- $value = $wp_review_rating_types[$type]['max'];
973
- }
974
-
975
- $template = $wp_review_rating_types[$type]['output_template'];
976
- $comment_rating = false;
977
- set_query_var( 'rating', compact( 'value', 'post_id', 'type', 'args', 'comment_rating', 'color', 'colors' ) );
978
- ob_start();
979
- load_template( $template, false );
980
- $review = ob_get_contents();
981
- ob_end_clean();
982
- return $review;
983
- }
984
-
985
- function wp_review_user_rating( $post_id = null, $args = array() ) {
986
- global $wp_review_rating_types;
987
- $type = wp_review_get_post_user_review_type( $post_id );
988
-
989
- if ( empty( $type ) )
990
- return '';
991
-
992
- $review = '';
993
-
994
- $postReviews = mts_get_post_reviews( $post_id );
995
- $value = $postReviews['rating'];
996
- $count = $postReviews['count'];
997
- $total = get_post_meta( $post_id, 'wp_review_total', true );
998
-
999
- $user_id = '';
1000
- if ( is_user_logged_in() ) {
1001
- $user_id = get_current_user_id();
1002
- }
1003
-
1004
- if ( $value == '' ) {
1005
- $value = '0.0';
1006
- }
1007
-
1008
- if ( hasPreviousReview( $post_id, $user_id, wp_review_get_user_ip(), WP_REVIEW_COMMENT_TYPE_VISITOR ) || ( ! is_user_logged_in() && ! empty( $options['registered_only'] ) ) ) {
1009
- return wp_review_rating( $value, $post_id, array( 'user_rating' => true ) ); // return just output template
1010
- }
1011
-
1012
- $options = get_option('wp_review_options');
1013
- $custom_colors = get_post_meta( $post_id, 'wp_review_custom_colors', true );
1014
- $colors['color'] = get_post_meta( $post_id, 'wp_review_color', true );
1015
- if( empty($colors['color']) ) $colors['color'] = '#333333';
1016
- $colors['type'] = get_post_meta( $post_id, 'wp_review_type', true );
1017
- $colors['fontcolor'] = get_post_meta( $post_id, 'wp_review_fontcolor', true );
1018
- $colors['bgcolor1'] = get_post_meta( $post_id, 'wp_review_bgcolor1', true );
1019
- $colors['bgcolor2'] = get_post_meta( $post_id, 'wp_review_bgcolor2', true );
1020
- $colors['bordercolor'] = get_post_meta( $post_id, 'wp_review_bordercolor', true );
1021
- if ( ! $custom_colors && ! empty($options['colors'] ) && is_array($options['colors'] ) ) {
1022
- $colors = array_merge($colors, $options['colors']);
1023
- }
1024
- $colors = apply_filters('wp_review_colors', $colors, $post_id);
1025
- $color = $colors['color'];
1026
-
1027
- $rating_type_template = $wp_review_rating_types[$type]['input_template'];
1028
- $comment_rating = false;
1029
- set_query_var( 'rating', compact( 'value', 'post_id', 'comment_rating', 'args', 'color', 'colors' ) );
1030
- ob_start();
1031
- load_template( $rating_type_template, false );
1032
- $review = '<div class="wp-review-user-rating wp-review-user-rating-'.$type.'">'.ob_get_contents().'</div>';
1033
- ob_end_clean();
1034
-
1035
- if ( $value !== '0.0' && $total === '' ) {// dont'show if no user ratings and there is review
1036
- $review .= '<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
1037
- <meta itemprop="ratingValue" content="' . $userTotal . '" />
1038
- <meta itemprop="reviewCount" content="' . $usersReviewsCount . '" />
1039
- </div>';
1040
- }
1041
- return $review;
1042
- }
1043
-
1044
- /**
1045
- * Returns WP Review box html using the box template chosen for the review
1046
- * Replaces wp_review_get_data()
1047
- *
1048
- * @param [type] $post_id [description]
1049
- * @return [type] [description]
1050
- */
1051
- function wp_review_get_review_box( $post_id = null ) {
1052
- global $post;
1053
- if (empty($post_id))
1054
- $post_id = $post->ID;
1055
- $type = wp_review_get_post_review_type( $post_id );
1056
- if ( ! $type )
1057
- return '';
1058
-
1059
- // Load variables
1060
- $options = get_option('wp_review_options');
1061
-
1062
- /* Retrieve the meta box data. */
1063
- $heading = get_post_meta( $post_id, 'wp_review_heading', true );
1064
- $desc_title = get_post_meta( $post_id, 'wp_review_desc_title', true );
1065
- if ( ! $desc_title ) $desc_title = __('Summary', 'wp-review');
1066
- $desc = get_post_meta( $post_id, 'wp_review_desc', true );
1067
- $items = get_post_meta( $post_id, 'wp_review_item', true );
1068
- $type = get_post_meta( $post_id, 'wp_review_type', true );
1069
- $total = get_post_meta( $post_id, 'wp_review_total', true );
1070
- $hide_desc = get_post_meta( $post_id, 'wp_review_hide_desc', true );
1071
- $schema = wp_review_get_review_schema( $post_id );
1072
- $links = get_post_meta( $post_id, 'wp_review_links', true );
1073
-
1074
- $custom_author = get_post_meta( $post_id, 'wp_review_custom_author', true );
1075
- $author_field = get_post_meta( $post_id, 'wp_review_author', true );
1076
-
1077
- $author = ( !$author_field || empty( $author_field ) || !$custom_author ) ? get_the_author() : $author_field;
1078
- $add_backlink = ! empty( $options['add_backlink'] ) ? true : false;
1079
-
1080
- $colors = array();
1081
- $colors['custom_colors'] = get_post_meta( $post_id, 'wp_review_custom_colors', true );
1082
- $colors['custom_location'] = get_post_meta( $post_id, 'wp_review_custom_location', true );
1083
- $colors['custom_width'] = get_post_meta( $post_id, 'wp_review_custom_width', true );
1084
-
1085
- $colors['color'] = get_post_meta( $post_id, 'wp_review_color', true );
1086
- if( empty($colors['color']) ) $colors['color'] = '#333333';
1087
- $colors['type'] = get_post_meta( $post_id, 'wp_review_type', true );
1088
- $colors['fontcolor'] = get_post_meta( $post_id, 'wp_review_fontcolor', true );
1089
- $colors['bgcolor1'] = get_post_meta( $post_id, 'wp_review_bgcolor1', true );
1090
- $colors['bgcolor2'] = get_post_meta( $post_id, 'wp_review_bgcolor2', true );
1091
- $colors['bordercolor'] = get_post_meta( $post_id, 'wp_review_bordercolor', true );
1092
- $colors['total'] = get_post_meta( $post_id, 'wp_review_total', true );
1093
-
1094
- if ( ! $colors['custom_colors'] && ! empty($options['colors'] ) && is_array($options['colors'] ) ) {
1095
- $colors = array_merge($colors, $options['colors']);
1096
- }
1097
- $colors = apply_filters('wp_review_colors', $colors, $post_id);
1098
-
1099
- $width = get_post_meta( $post_id, 'wp_review_width', true );
1100
- if (empty($width)) $width = 100;
1101
- $align = get_post_meta( $post_id, 'wp_review_align', true );
1102
- if (empty($align)) $align = 'left';
1103
-
1104
- if (!$colors['custom_width']) {
1105
- $width = ! empty($options['width']) ? $options['width'] : 100;
1106
- $align = ! empty($options['align']) ? $options['align'] : 'left';
1107
- }
1108
-
1109
- $post_types = get_post_types( array('public' => true), 'names' );
1110
- $excluded_post_types = apply_filters('wp_review_excluded_post_types', array('attachment'));
1111
- $allowed_post_types = array_diff($post_types, $excluded_post_types);
1112
-
1113
- $user_review = in_array( wp_review_get_user_rating_setup( $post_id ), array( WP_REVIEW_REVIEW_VISITOR_ONLY ) );
1114
- $user_review_type = '';
1115
- $user_review_total = '';
1116
- $user_review_count = 0;
1117
- $user_has_reviewed = false;
1118
- if ( $user_review ) {
1119
- $user_review_type = wp_review_get_post_user_review_type( $post_id );
1120
- }
1121
- if ( $user_review ) {
1122
- $postReviews = mts_get_post_reviews( $post_id );
1123
- $user_review_total = $postReviews['rating'];
1124
- $user_review_count = $postReviews['count'];
1125
- $user_id = is_user_logged_in() ? get_current_user_id() : 0;
1126
- $uip = wp_review_get_user_ip();
1127
- if ( hasPreviousReview( $post_id, $user_id, $uip, WP_REVIEW_COMMENT_TYPE_VISITOR ) )
1128
- $user_has_reviewed = true;
1129
- }
1130
-
1131
-
1132
-
1133
- $template = wp_review_get_post_box_template( $post_id );
1134
- $box_template_path = wp_review_locate_box_template( $template );
1135
- // pass variables to template
1136
- set_query_var( 'review', compact(
1137
- 'post_id',
1138
- 'type',
1139
- 'heading',
1140
- 'author',
1141
- 'items',
1142
- 'hide_desc',
1143
- 'desc',
1144
- 'desc_title',
1145
- 'total',
1146
- 'colors',
1147
- 'width',
1148
- 'align',
1149
- 'schema',
1150
- 'links',
1151
- 'user_review',
1152
- 'user_review_type',
1153
- 'user_review_total',
1154
- 'user_review_count',
1155
- 'user_has_reviewed',
1156
- 'add_backlink'
1157
- ) );
1158
- ob_start();
1159
- load_template( $box_template_path, false );
1160
- $review = ob_get_contents();
1161
- ob_end_clean();
1162
- $review = apply_filters('wp_review_get_data', $review, $post_id, $type, $total, $items);
1163
- return $review;// . wp_review_color_output( $post_id ); // add color CSS to output
1164
- }
1165
-
1166
-
1167
- function wp_review_get_box_template_info( $template = false ) {
1168
- $default_template_headers = array(
1169
- 'Name' => 'WP Review',
1170
- 'TemplateURI' => 'Template URI',
1171
- 'Version' => 'Version',
1172
- 'Description' => 'Description',
1173
- 'Author' => 'Author',
1174
- 'AuthorURI' => 'Author URI'
1175
- );
1176
-
1177
- if ( ! $template )
1178
- $template = wp_review_get_post_box_template();
1179
-
1180
- $path = wp_review_locate_box_template( $template );
1181
-
1182
- if ( $path )
1183
- return get_file_data( $path, $default_template_headers );
1184
- else
1185
- return array( $default_template_headers );
1186
- }
1187
-
1188
- /**
1189
- * Returns absolute path to template directory.
1190
- * @return string path
1191
- */
1192
- function wp_review_get_box_template_directory() {
1193
- $template = wp_review_get_post_box_template();
1194
- if ( ! $template )
1195
- return '';
1196
-
1197
- $current_template_directory = wp_review_locate_box_template( $template );
1198
-
1199
- return dirname($current_template_directory);
1200
- }
1201
-
1202
- /**
1203
- * Returns template directory URI. To be used in template file.
1204
- * @return string path
1205
- */
1206
- function wp_review_get_box_template_directory_uri() {
1207
- // let's hope this will work in most cases
1208
- return get_bloginfo( 'url' ).'/'.str_replace(ABSPATH, '', wp_review_get_box_template_directory());
1209
- }
1210
-
1211
-
1212
- function wp_review_get_box_templates_list() {
1213
-
1214
- $default_paths = array(
1215
- WP_REVIEW_DIR.'box-templates',
1216
- get_template_directory().'/wp-review',
1217
- get_stylesheet_directory().'/wp-review',
1218
- );
1219
- $paths = apply_filters( 'wp_review_box_template_paths', $default_paths );
1220
-
1221
- $templates = array();
1222
-
1223
- foreach ($paths as $path) {
1224
- $path = trailingslashit( $path );
1225
- // Look for files containing our header 'Launcher template'
1226
- $files = (array) wp_review_scandir( $path, 'php', 2 );
1227
- foreach ( $files as $file => $full_path ) {//echo ' <br> '.$file.' - '.$full_path;
1228
- if ( ! $full_path || ! preg_match( '|WP Review:(.*)$|mi', file_get_contents( $full_path ), $header ) )
1229
- continue;
1230
-
1231
- $templates[ $file ] = wp_review_get_box_template_info( $file );
1232
- $templates[ $file ]['path'] = $path;
1233
- }
1234
- }
1235
- return $templates;
1236
- }
1237
-
1238
- function wp_review_get_rating_types() {
1239
- global $wp_review_rating_types;
1240
- return $wp_review_rating_types;
1241
- }
1242
-
1243
- function wp_review_scandir( $path, $extensions = null, $depth = 0, $relative_path = '' ) {
1244
- if ( ! is_dir( $path ) )
1245
- return false;
1246
- if ( $extensions ) {
1247
- $extensions = (array) $extensions;
1248
- $_extensions = implode( '|', $extensions );
1249
- }
1250
- $relative_path = trailingslashit( $relative_path );
1251
- if ( '/' == $relative_path )
1252
- $relative_path = '';
1253
- $results = scandir( $path );
1254
- $files = array();
1255
- foreach ( $results as $result ) {
1256
- if ( '.' == $result[0] )
1257
- continue;
1258
- if ( is_dir( $path . '/' . $result ) ) {
1259
- if ( ! $depth || 'CVS' == $result )
1260
- continue;
1261
- $found = wp_review_scandir( $path . '/' . $result, $extensions, $depth - 1 , $relative_path . $result );
1262
- $files = array_merge_recursive( $files, $found );
1263
- } elseif ( ! $extensions || preg_match( '~\.(' . $_extensions . ')$~', $result ) ) {
1264
- $files[ $relative_path . $result ] = $path . '/' . $result;
1265
- }
1266
- }
1267
- return $files;
1268
- }
1269
-
1270
-
1271
- add_action( 'init', 'wp_review_add_admin_columns' );
1272
- function wp_review_add_admin_columns() {
1273
- $post_types = get_post_types( array('public' => true), 'names' );
1274
- $excluded_post_types = apply_filters('wp_review_excluded_post_types', array('attachment'));
1275
- $allowed_post_types = array_diff($post_types, $excluded_post_types);
1276
- foreach ($allowed_post_types as $key => $value) {
1277
- // Add post list table column
1278
- add_filter('manage_'.$value.'_posts_columns', 'wp_review_post_list_column');
1279
- // Post list table column content
1280
- add_action('manage_'.$value.'_posts_custom_column', 'wp_review_post_list_column_content', 10, 2);
1281
- }
1282
- }
1283
- function wp_review_post_list_column($defaults) {
1284
- $defaults['wp_review_rating'] = __('Rating', 'wp-review');
1285
- return $defaults;
1286
- }
1287
- function wp_review_post_list_column_content($column_name, $post_ID) {
1288
- if ($column_name == 'wp_review_rating') {
1289
- $total = get_post_meta( $post_ID, 'wp_review_total', true );
1290
- if ( $total )
1291
- echo wp_review_rating($total, $post_ID);
1292
- else
1293
- echo '<span class="no-rating">'.__( 'No Rating', 'wp-review' ).'</span>';
1294
- }
1295
- }
1296
-
1297
- function wp_review_get_backlink() {
1298
- $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>';
1299
- return $backlink_text;
1300
- }
1301
-
1302
- // Notice about migrating ratings
1303
- add_action( 'admin_notices', 'wp_review_migrate_notice' );
1304
- add_action('admin_init', 'wp_review_migrate_notice_ignore');
1305
-
1306
- function wp_review_migrate_notice_ignore() {
1307
- global $current_user;
1308
- $user_id = $current_user->ID;
1309
- /* If user clicks to ignore the notice, add that to their user meta */
1310
- if ( isset($_GET['wp_review_migrate_notice_ignore']) && '1' == $_GET['wp_review_migrate_notice_ignore'] ) {
1311
- add_user_meta($user_id, 'wp_review_migrate_notice_ignore', 'true', true);
1312
- }
1313
- }
1314
- function wp_review_migrate_notice() {
1315
- // Migrate
1316
- global $wpdb, $current_user;
1317
- $user_id = $current_user->ID;
1318
- if ( get_user_meta($user_id, 'wp_review_migrate_notice_ignore') )
1319
- return;
1320
-
1321
- $has_migrated = get_option( 'wp_review_has_migrated', false );
1322
- if ($has_migrated)
1323
- return;
1324
-
1325
- $current_blog_id = get_current_blog_id();
1326
- $total_rows = 0;
1327
- $rows_left = 0;
1328
- $migrated_rows = get_option( 'wp_review_migrated_rows', 0 );
1329
- if ( ! $has_migrated && $wpdb->get_var("SHOW TABLES LIKE '{$wpdb->base_prefix}mts_wp_reviews'") == "{$wpdb->base_prefix}mts_wp_reviews") {
1330
- // Table exists and not migrated (fully) yet
1331
- $total_rows = $wpdb->get_var( 'SELECT COUNT(*) FROM '.$wpdb->base_prefix.'mts_wp_reviews WHERE blog_id = '.$current_blog_id );
1332
- $rows_left = $total_rows - $migrated_rows;
1333
- }
1334
-
1335
- if (!$rows_left)
1336
- return;
1337
- ?>
1338
- <div class="updated notice-info wp-review-notice">
1339
- <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>
1340
- </div>
1341
- <?php
1342
- }
1343
-
1344
- /* Display a notice*/
1345
-
1346
- add_action('admin_notices', 'wp_review_admin_notice');
1347
-
1348
- function wp_review_admin_notice() {
1349
- global $current_user ;
1350
- $user_id = $current_user->ID;
1351
- /* Check that the user hasn't already clicked to ignore the message */
1352
- /* Only show the notice 2 days after plugin activation */
1353
- if ( ! get_user_meta($user_id, 'wp_review_ignore_notice') && time() >= (get_option( 'wp_review_activated', 0 ) + (2 * 24 * 60 * 60)) ) {
1354
- echo '<div class="updated notice-info wp-review-notice" id="wpreview-notice" style="position:relative;">';
1355
- printf(__('<p>Create Reviews Easily & Rank Higher In Search Engines - <a target="_blank" href="https://mythemeshop.com/plugins/wp-review-pro/?utm_source=WP+Review&utm_medium=Notification+Link&utm_content=WP+Review+Pro+LP&utm_campaign=WordPressOrg"><strong>WP Review Pro Plugin</strong></a></p><a class="notice-dismiss" href="%1$s"></a>'), '?wp_review_admin_notice_ignore=0');
1356
- echo "</div>";
1357
- }
1358
- }
1359
-
1360
- add_action('admin_init', 'wp_review_admin_notice_ignore');
1361
-
1362
- function wp_review_admin_notice_ignore() {
1363
- global $current_user;
1364
- $user_id = $current_user->ID;
1365
- /* If user clicks to ignore the notice, add that to their user meta */
1366
- if ( isset($_GET['wp_review_admin_notice_ignore']) && '0' == $_GET['wp_review_admin_notice_ignore'] ) {
1367
- add_user_meta($user_id, 'wp_review_ignore_notice', 'true', true);
1368
- }
1369
- }
1
+ <?php
2
+ ob_start();
3
+ /**
4
+ * WP Review
5
+ *
6
+ * @since 2.0
7
+ * @copyright Copyright (c) 2013, MyThemesShop
8
+ * @author MyThemesShop
9
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10
+ */
11
+
12
+ $options = get_option('wp_review_options');
13
+
14
+ /* Display the meta box data below 'the_content' hook. */
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');
67
+ $custom_location = get_post_meta( $post->ID, 'wp_review_custom_location', true );
68
+ $location = get_post_meta( $post->ID, 'wp_review_location', true );
69
+ if (!$custom_location && !empty($options['review_location'])) {
70
+ $location = $options['review_location'];
71
+ }
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_singular() ) {
76
+ return $content;
77
+ }
78
+ $review = wp_review_get_review_box();
79
+ if ( 'bottom' == $location ) {
80
+ global $multipage, $numpages, $page;
81
+ if( $multipage ) {
82
+ if ($page == $numpages) {
83
+ return $content .= $review;
84
+ } else {
85
+ return $content;
86
+ }
87
+ } else {
88
+ return $content .= $review;
89
+ }
90
+ } elseif ( 'top' == $location ) {
91
+ return $review .= $content;
92
+ } else {
93
+ return $content;
94
+ }
95
+ }
96
+
97
+ /**
98
+ * Retrieve only total rating.
99
+ * To be used on archive pages, etc.
100
+ *
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
+ $atts = shortcode_atts( array( 'id' => null, 'class' => 'review-total-only review-total-shortcode' ), $atts );
161
+ $output = wp_review_show_total( false, $atts['class'], $atts['id'], array( 'shortcode' => true ) );
162
+
163
+ return apply_filters( 'wp_review_total_shortcode', $output, $atts );
164
+ }
165
+
166
+ function wp_review_shortcode( $atts, $content = "") {
167
+ $atts = shortcode_atts( array( 'id' => null ), $atts );
168
+ $output = wp_review_get_data($atts['id']);
169
+
170
+ return apply_filters( 'wp_review_shortcode', $output, $atts );
171
+ }
172
+
173
+ function wp_review_visitor_rating_shortcode( $atts, $content = "" ) {
174
+ wp_enqueue_style( 'wp_review-style' );
175
+ wp_enqueue_script( 'wp_review-js' );
176
+
177
+ $atts = shortcode_atts( array( 'id' => null ), $atts );
178
+ $id = empty( $atts['id'] ) ? get_the_ID() : absint( $atts['id'] );
179
+
180
+ $text = '<div class="wp-review-' . $id . ' review-wrapper visitor-rating-shortcode">';
181
+ $text .= wp_review_user_rating( $id );
182
+ $text .= '</div>';
183
+
184
+ return apply_filters( 'wp_review_visitor_rating_shortcode', $text, $atts );
185
+ }
186
+
187
+ function mts_get_post_reviews( $post_id, $force = false ){
188
+ 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 ) ) ) {
189
+ return array( 'rating' => $post_reviews, 'count' => $review_count );
190
+ }
191
+
192
+ if( is_numeric( $post_id ) && $post_id > 0 ){
193
+ $comments = get_comments( array(
194
+ 'post_id' => $post_id,
195
+ 'type' => WP_REVIEW_COMMENT_TYPE_VISITOR,
196
+ 'status' => 'approve'
197
+ ) );
198
+ $rating = array_reduce( $comments, 'wpreview_comments_count_callback', 0 );
199
+
200
+ $count = count( $comments );
201
+
202
+ $post_reviews = array(
203
+ 'rating' => $count > 0 ? round( $rating / $count, 2 ) : 0,
204
+ 'count' => $count,
205
+ );
206
+
207
+ update_post_meta( $post_id, 'wp_review_user_reviews', $post_reviews['rating'] );
208
+ update_post_meta( $post_id, 'wp_review_review_count', $post_reviews['count'] );
209
+
210
+ return $post_reviews;
211
+ }
212
+ }
213
+
214
+ function wpreview_comments_count_callback( $carry, $comment ) {
215
+ $rating = get_comment_meta( $comment->comment_ID, WP_REVIEW_VISITOR_RATING_METAKEY, true );
216
+ $carry += (int) $rating;
217
+ return $carry;
218
+ }
219
+
220
+ /**
221
+ *Check if user has reviewed this post previously
222
+ *
223
+ * @param $post_id
224
+ * @param $user_id
225
+ * @param $ip
226
+ * @param string $type
227
+ *
228
+ * @return bool
229
+ */
230
+ function hasPreviousReview( $post_id, $user_id, $ip, $type = 'any' ){
231
+ if( is_numeric( $post_id ) && $post_id > 0 ){
232
+ $args = array( 'post_id' => $post_id, 'count' => true, 'user_id' => 0 );
233
+ set_query_var( 'wp_review_commenttype', $type );
234
+ add_filter( 'pre_get_comments', 'wp_review_add_comment_type_to_query' );
235
+ if ( $user_id ) {
236
+ $args['user_id'] = $user_id;
237
+ } else {
238
+ set_query_var( 'wp_review_ip', $ip );
239
+ add_filter( 'comments_clauses', 'wp_review_filter_comment_by_ip' );
240
+ }
241
+ $count = intval( get_comments( $args ) );
242
+ remove_filter( 'pre_get_comments', 'wp_review_add_comment_type_to_query' );
243
+ remove_filter( 'comments_clauses', 'wp_review_filter_comment_by_ip' );
244
+ return $count > 0;
245
+ }
246
+ return false;
247
+ }
248
+
249
+ /**
250
+ * Add the comment type to comment query.
251
+ *
252
+ * @param WP_Comment_Query $query
253
+ *
254
+ * @return WP_Comment_Query
255
+ */
256
+ function wp_review_add_comment_type_to_query( \WP_Comment_Query $query ) {
257
+ $commenttype = get_query_var( 'wp_review_commenttype' );
258
+ if ( 'any' === $commenttype ) {
259
+ $query->query_vars['type__in'] = array( WP_REVIEW_COMMENT_TYPE_VISITOR );
260
+ } else {
261
+ $query->query_vars['type'] = $commenttype;
262
+ }
263
+ return $query;
264
+ }
265
+
266
+ /**
267
+ * Add a conditional to filter the comment query by IP.
268
+ *
269
+ * @param array $clauses
270
+ *
271
+ * @return array
272
+ */
273
+ function wp_review_filter_comment_by_ip( array $clauses ) {
274
+ global $wpdb;
275
+ $clauses['where'] .= $wpdb->prepare( ' AND comment_author_IP = %s', get_query_var( 'wp_review_ip' ) );
276
+ return $clauses;
277
+ }
278
+
279
+ function getPreviousReview( $post_id, $user_id, $ip, $type = 'any' ) {
280
+ if( is_numeric( $post_id ) && $post_id > 0 ){
281
+ $args = array( 'post_id' => $post_id, 'user_id' => 0 );
282
+ set_query_var( 'wp_review_commenttype', $type );
283
+ add_filter( 'pre_get_comments', 'wp_review_add_comment_type_to_query' );
284
+ if ( $user_id ) {
285
+ $args['user_id'] = array( $user_id );
286
+ } else {
287
+ set_query_var( 'wp_review_ip', $ip );
288
+ add_filter( 'comments_clauses', 'wp_review_filter_comment_by_ip' );
289
+ }
290
+
291
+ $comment = get_comments( $args );
292
+ remove_filter( 'pre_get_comments', 'wp_review_add_comment_type_to_query' );
293
+ remove_filter( 'comments_clauses', 'wp_review_filter_comment_by_ip' );
294
+
295
+ if ( ! empty( $comment ) ) {
296
+ return get_comment_meta( $comment[0]->comment_ID, WP_REVIEW_COMMENT_RATING_METAKEY, true );
297
+ }
298
+ }
299
+ return false;
300
+ }
301
+
302
+ /**
303
+ * AJAX User review rating
304
+ * Replaces mts_review_get_review()
305
+ * @return null
306
+ */
307
+ function wp_review_ajax_rate() {
308
+ global $wp_review_rating_types;
309
+ check_ajax_referer( 'wp-review-security', 'nonce' );
310
+ $options = get_option('wp_review_options');
311
+ $post_id = intval($_POST['post_id']);
312
+ $user_id = is_user_logged_in() ? get_current_user_id() : 0;
313
+ $review = round( abs( filter_input( INPUT_POST, 'review' ) ), 2 );
314
+ $type = wp_review_get_post_user_review_type( $post_id );
315
+ $uip = wp_review_get_user_ip();
316
+
317
+ $output = array('status' => '', 'html' => '', 'rating_total' => '', 'rating_count' => '');
318
+
319
+ if ( empty( $type ) ) {
320
+ // No user reviews allowed
321
+ echo wp_json_encode( $output );
322
+ exit;
323
+ }
324
+
325
+ add_action( 'comment_duplicate_trigger', 'wp_review_comment_duplicate_trigger' );
326
+
327
+ // don't allow higher rating than max
328
+ if ($review > $wp_review_rating_types[$type]['max']) {
329
+ $review = $wp_review_rating_types[$type]['max'];
330
+ }
331
+
332
+ if ( $review > 0 &&
333
+ ! hasPreviousReview( $post_id, $user_id, $uip, WP_REVIEW_COMMENT_TYPE_VISITOR ) &&
334
+ (
335
+ ( is_user_logged_in() && ! empty( $options['registered_only'] ) ) ||
336
+ ( is_user_logged_in() && empty( $options['registered_only'] ) ) ||
337
+ ( ! is_user_logged_in() && empty( $options['registered_only'] ) )
338
+ )
339
+ ) {
340
+ if ( $insert = wp_insert_comment( array(
341
+ 'user_id' => $user_id,
342
+ 'comment_type' => WP_REVIEW_COMMENT_TYPE_VISITOR,
343
+ 'comment_post_ID' => $post_id,
344
+ 'comment_parent' => 0,
345
+ 'comment_author_IP' => $uip,
346
+ 'comment_content' => sprintf( __('Visitor Rating: %s', 'wp-review'), sprintf( $wp_review_rating_types[$type]['value_text'], $review ) ),
347
+ 'comment_agent' => isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT']: '',
348
+ 'comment_date' => current_time('mysql'),
349
+ 'comment_date_gmt' => current_time( 'mysql', 1 ),
350
+ 'comment_approved' => 1
351
+ ) ) ) {
352
+ if ( update_comment_meta( $insert, WP_REVIEW_VISITOR_RATING_METAKEY, $review ) ) {
353
+ $post_reviews = mts_get_post_reviews( $post_id, true );
354
+
355
+ // "lock" user review type when the first rating comes in
356
+ // to prevent issues with changing types
357
+ // update_post_meta( $post_id, 'wp_review_user_review_type_locked', 1 );
358
+
359
+ //echo $post_reviews['rating'] . '|' . $post_reviews['count'];
360
+ $output['status'] = 'ok';
361
+ $output['html'] = wp_review_rating( $post_reviews['rating'], $post_id, array( 'user_rating' => true ) );
362
+ $output['rating_total'] = $post_reviews['rating'];
363
+ $output['rating_count'] = $post_reviews['count'];
364
+ echo wp_json_encode( $output );
365
+ exit;
366
+ } else {
367
+ wp_delete_comment( $insert );
368
+ }
369
+ }
370
+ }
371
+ $post_reviews = mts_get_post_reviews( $post_id );
372
+ $output['status'] = 'fail';
373
+ $output['error'] = 'db_error';
374
+ $output['rating_total'] = $post_reviews['rating'];
375
+ $output['rating_count'] = $post_reviews['count'];
376
+ $output['html'] = wp_review_rating( $post_reviews['rating'], $post_id, array( 'user_rating' => true ) );
377
+ echo wp_json_encode( $output );
378
+ exit;
379
+ }
380
+
381
+ function wp_review_comment_duplicate_trigger( $commentdata ) {
382
+ $post_reviews = mts_get_post_reviews( $commentdata['comment_post_ID'] );
383
+ $output['status'] = 'fail';
384
+ $output['error'] = 'duplicate';
385
+ $output['rating_total'] = $post_reviews['rating'];
386
+ $output['rating_count'] = $post_reviews['count'];
387
+ $output['html'] = wp_review_rating( $post_reviews['rating'], $commentdata['comment_post_ID'], array( 'user_rating' => true ) );
388
+ echo wp_json_encode( $output );
389
+ exit;
390
+ }
391
+
392
+ /*
393
+ * Get review with Ajax
394
+ */
395
+ function mts_review_get_review() {
396
+ // security
397
+ check_ajax_referer( 'wp-review-security', 'nonce' );
398
+
399
+ $options = get_option('wp_review_options');
400
+ $post_id = intval($_POST['post_id']);
401
+ $user_id = is_user_logged_in() ? get_current_user_id() : 0;
402
+ $review = round( abs( filter_input( INPUT_POST, 'review' ) ), 2 );
403
+
404
+ $review_text = $review;
405
+
406
+ $uip = wp_review_get_user_ip();
407
+
408
+ add_action( 'comment_duplicate_trigger', 'wp_review_comment_duplicate_trigger' );
409
+
410
+ if ( $review > 0 &&
411
+ ! hasPreviousReview( $post_id, $user_id, $uip, WP_REVIEW_COMMENT_TYPE_VISITOR ) &&
412
+ (
413
+ ( is_user_logged_in() && ! empty( $options['registered_only'] ) ) ||
414
+ ( is_user_logged_in() && empty( $options['registered_only'] ) ) ||
415
+ ( ! is_user_logged_in() && empty( $options['registered_only'] ) )
416
+ )
417
+ ) {
418
+ if ( $insert = wp_insert_comment( array(
419
+ 'user_id' => $user_id,
420
+ 'comment_type' => WP_REVIEW_COMMENT_TYPE_VISITOR,
421
+ 'comment_post_ID' => $post_id,
422
+ 'comment_parent' => 0,
423
+ 'comment_author_IP' => $uip,
424
+ 'comment_content' => sprintf(__('Visitor Rating: %s', 'wp-review'), $review_text),
425
+ 'comment_agent' => isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT']: '',
426
+ 'comment_date' => current_time('mysql'),
427
+ 'comment_date_gmt' => current_time( 'mysql', 1 ),
428
+ 'comment_approved' => 1
429
+ ) ) ) {
430
+ if ( update_comment_meta( $insert, WP_REVIEW_VISITOR_RATING_METAKEY, $review ) ) {
431
+ $post_reviews = mts_get_post_reviews( $post_id, true );
432
+
433
+ echo $post_reviews['rating'] . '|' . $post_reviews['count'];
434
+ exit;
435
+ } else {
436
+ wp_delete_comment( $insert );
437
+ }
438
+ }
439
+ }
440
+
441
+ echo 'MTS_REVIEW_DB_ERROR';
442
+ exit;
443
+ }
444
+
445
+
446
+ function wp_review_theme_defaults($new_options, $force_change = false) {
447
+ global $pagenow;
448
+ $opt_name = 'wp_review_options_'.wp_get_theme();
449
+ $options = get_option('wp_review_options');
450
+ if (empty($options)) $options = array();
451
+ $options_updated = get_option( $opt_name );
452
+ // if the theme was just activated OR options weren't updated yet
453
+ if ( empty( $options_updated ) || $options_updated != $new_options || $force_change || ( isset( $_GET['activated'] ) && $pagenow == 'themes.php' )) {
454
+ update_option( 'wp_review_options', array_merge($options, $new_options) );
455
+ update_option( $opt_name, $new_options );
456
+ }
457
+ }
458
+
459
+ /**
460
+ * Exclude review-type comments from being included in the comment query.
461
+ *
462
+ * @param WP_Comment_Query $query
463
+ */
464
+ function wp_review_exclude_review_comments(\WP_Comment_Query $query) {
465
+ 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'] )) ) {
466
+ $query->query_vars['type__not_in'] = array_merge(
467
+ is_array( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array(),
468
+ array( WP_REVIEW_COMMENT_TYPE_VISITOR )
469
+ );
470
+ }
471
+ }
472
+ add_action( 'pre_get_comments', 'wp_review_exclude_review_comments', 15 );
473
+
474
+ /**
475
+ * Add "Reviews" to comments table view.
476
+ *
477
+ * @param array $comment_types
478
+ *
479
+ * @return mixed
480
+ */
481
+ function wp_review_add_to_comment_table_dropdown( $comment_types ) {
482
+ $comment_types[ WP_REVIEW_COMMENT_TYPE_VISITOR ] = __( 'Visitor Reviews', 'wp-review' );
483
+
484
+ return $comment_types;
485
+ }
486
+ add_filter( 'admin_comment_types_dropdown', 'wp_review_add_to_comment_table_dropdown' );
487
+
488
+ /**
489
+ * @param int $post_id
490
+ *
491
+ * @return string
492
+ *
493
+ * 0 - Disabled
494
+ * 2 - Visitor Rating Only
495
+ */
496
+ function wp_review_get_user_rating_setup( $post_id ) {
497
+ /* Retrieve an existing value from the database. */
498
+ $options = get_option( 'wp_review_options' );
499
+ //$default = empty( $options['default_user_review_type'] ) ? WP_REVIEW_REVIEW_DISABLED : $options['default_user_review_type'];
500
+ $default = WP_REVIEW_REVIEW_DISABLED;
501
+ $userReviews = get_post_meta( $post_id, 'wp_review_userReview', true );
502
+ $enabled = empty( $userReviews ) ? $default : $userReviews;
503
+ if ( is_array( $userReviews ) ) {
504
+ $enabled = $userReviews[0];
505
+ }
506
+
507
+ // Compatibility with the old option.
508
+ if ( '1' === $enabled ) {
509
+ $enabled = WP_REVIEW_REVIEW_VISITOR_ONLY;
510
+ }
511
+
512
+ return $enabled;
513
+ }
514
+
515
+ /**
516
+ * Exclude visitor ratings when updating a post's comment count.
517
+ * @param $post_id
518
+ * @param $new
519
+ * @param $old
520
+ *
521
+ * @internal param $comment_id
522
+ * @internal param $comment
523
+ */
524
+ function wp_review_exclude_visitor_review_count( $post_id, $new, $old ) {
525
+ global $wpdb;
526
+ $count = get_comments( array(
527
+ 'type__not_in' => array( WP_REVIEW_COMMENT_TYPE_VISITOR ),
528
+ 'post_id' => $post_id,
529
+ 'count' => true
530
+ ) );
531
+ $wpdb->update( $wpdb->posts, array( 'comment_count' => $count ), array( 'ID' => $post_id ) );
532
+
533
+ // Update user review count.
534
+ mts_get_post_reviews( $post_id, true );
535
+
536
+ clean_post_cache( $post_id );
537
+ }
538
+ add_action( 'wp_update_comment_count', 'wp_review_exclude_visitor_review_count', 10, 3 );
539
+
540
+ /**
541
+ * Get the schema type of a review.
542
+ * @param int $post_id
543
+ *
544
+ * @return mixed|string
545
+ */
546
+ function wp_review_get_review_schema( $post_id ) {
547
+ return 'Thing';
548
+ }
549
+
550
+ /**
551
+ * Get the IP of the current user.
552
+ *
553
+ * @return string
554
+ */
555
+ function wp_review_get_user_ip() {
556
+ if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
557
+ $ip = $_SERVER['HTTP_CLIENT_IP'];
558
+ } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
559
+ $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
560
+ } else {
561
+ $ip = $_SERVER['REMOTE_ADDR'];
562
+ }
563
+
564
+ return $ip;
565
+ }
566
+
567
+ /**
568
+ * Get the HTML for user reviews in review box.
569
+ *
570
+ * @param $post_id
571
+ * @param bool $votable
572
+ * @param bool $force_display
573
+ *
574
+ * @return string
575
+ */
576
+ function wp_review_user_review( $post_id, $votable = true, $force_display = false ) {
577
+ $review = '';
578
+
579
+ if ( $force_display || in_array( wp_review_get_user_rating_setup( $post_id ), array( WP_REVIEW_REVIEW_VISITOR_ONLY ) ) ) {
580
+ $allowedClass = 'allowed-to-rate';
581
+ $hasNotRatedClass = ' has-not-rated-yet';
582
+ $postReviews = mts_get_post_reviews( $post_id );
583
+ $userTotal = $postReviews['rating'];
584
+ $usersReviewsCount = $postReviews['count'];
585
+ $total = get_post_meta( $post_id, 'wp_review_total', true );
586
+ $type = get_post_meta( $post_id, 'wp_review_user_review_type', true );
587
+
588
+ $options = get_option('wp_review_options');
589
+ $custom_colors = get_post_meta( $post_id, 'wp_review_custom_colors', true );
590
+
591
+ $colors['color'] = get_post_meta( $post_id, 'wp_review_color', true );
592
+ if( empty($colors['color']) ) $colors['color'] = '#333333';
593
+ $colors['type'] = get_post_meta( $post_id, 'wp_review_type', true );
594
+ $colors['fontcolor'] = get_post_meta( $post_id, 'wp_review_fontcolor', true );
595
+ $colors['bgcolor1'] = get_post_meta( $post_id, 'wp_review_bgcolor1', true );
596
+ $colors['bgcolor2'] = get_post_meta( $post_id, 'wp_review_bgcolor2', true );
597
+ $colors['bordercolor'] = get_post_meta( $post_id, 'wp_review_bordercolor', true );
598
+ if ( ! $custom_colors && ! empty($options['colors'] ) && is_array($options['colors'] ) ) {
599
+ $colors = array_merge($colors, $options['colors']);
600
+ }
601
+ $colors = apply_filters('wp_review_colors', $colors, $post_id);
602
+ $color = $colors['color'];
603
+
604
+ $user_id = '';
605
+ if ( is_user_logged_in() ) {
606
+ $user_id = get_current_user_id();
607
+ }
608
+
609
+
610
+ if ( $userTotal == '' ) {
611
+ $userTotal = '0.0';
612
+ }
613
+ $value = $userTotal;
614
+
615
+ 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'] ) ) ) {
616
+ $hasNotRatedClass = '';
617
+ }
618
+
619
+ $class = $allowedClass . $hasNotRatedClass;
620
+
621
+ $template = mts_get_template_path( $type, 'star-output' );
622
+ set_query_var( 'rating', compact( 'value', 'usersReviewsCount', 'user_id', 'class', 'post_id', 'color', 'colors' ) );
623
+ ob_start();
624
+ load_template( $template, false );
625
+ $review = ob_get_contents();
626
+ ob_end_clean();
627
+
628
+
629
+
630
+ if ( $userTotal !== '0.0' && $total === '' ) {// dont'show if no user ratings and there is review
631
+ $review .= '<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
632
+ <meta itemprop="ratingValue" content="' . $userTotal . '" />
633
+ <meta itemprop="reviewCount" content="' . $usersReviewsCount . '" />
634
+ </div>';
635
+ }
636
+ }
637
+
638
+ return $review;
639
+ }
640
+
641
+ /**
642
+ * Get available review types/templates.
643
+ *
644
+ * @param string $type
645
+ *
646
+ * @return array
647
+ */
648
+ /*
649
+ function wp_review_get_review_types( $type = '' ) {
650
+ $dirs = array(
651
+ WP_REVIEW_DIR . 'templates/',
652
+ get_stylesheet_directory() . '/wp-review/',
653
+ );
654
+ $types = array();
655
+
656
+ foreach ( $dirs as $dir ) {
657
+ if ( is_dir( $dir ) ) {
658
+ $handle = opendir( $dir );
659
+ while ( $file = readdir( $handle ) ) {
660
+ if ( '..' === $file || '.' === $file ) {
661
+ continue;
662
+ }
663
+ $key = basename( $file, '.php' );
664
+
665
+ if ( ! empty( $type ) && substr( $key, -strlen( $type ) ) !== $type ) {
666
+ continue;
667
+ }
668
+ if ( empty( $type ) and strpos( $key, '-' ) !== false ) {
669
+ continue;
670
+ }
671
+
672
+ $template_data = implode( '', file( $dir . $file ) );
673
+ if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) ) {
674
+ $types[ $key ] = $name[1];
675
+ } else {
676
+ $keys_arr = explode( '-', $key );
677
+ $types[ $key ] = ucfirst( reset( $keys_arr ) );
678
+ }
679
+ }
680
+ }
681
+ }
682
+
683
+ return $types;
684
+ }
685
+ */
686
+
687
+ /**
688
+ * Get the path to a template prioritizing theme directory first.
689
+ *
690
+ * @param $type
691
+ * @param string $default
692
+ *
693
+ * @return string
694
+ */
695
+ function mts_get_template_path( $type, $default = 'star' ) {
696
+ $template = get_stylesheet_directory() . '/wp-review/' . $type . '.php';
697
+
698
+ // Template does not exist on theme dir, use plugin dir.
699
+ if ( ! file_exists( $template ) ) {
700
+ $template = WP_REVIEW_DIR . 'rating-types/' . $type . '.php';
701
+ }
702
+
703
+ // Template does not exist, fallback to star.
704
+ if ( ! file_exists( $template ) ) {
705
+ $template = WP_REVIEW_DIR . 'rating-types/' . $default . '.php';
706
+ }
707
+
708
+ return $template;
709
+ }
710
+
711
+ function wp_review_ajax_migrate_ratings() {
712
+ $start = isset( $_POST['start'] ) ? intval( $_POST['start'] ) : 0;
713
+ $limit = 100;
714
+
715
+ if ( get_option( 'wp_review_has_migrated', false ) ) {
716
+ return;
717
+ }
718
+
719
+ global $wpdb;
720
+
721
+ $current_blog_id = get_current_blog_id();
722
+
723
+ $query = $wpdb->get_results( 'SELECT * from '.$wpdb->base_prefix.'mts_wp_reviews WHERE blog_id = '.$current_blog_id.' LIMIT '.$limit.' OFFSET '.$start );
724
+
725
+ foreach ( $query as $review ) {
726
+
727
+ if ($review->rate == 0)
728
+ continue; // skip 0-star ratings
729
+
730
+ if ( $insert = wp_insert_comment( array(
731
+ 'user_id' => $review->user_id,
732
+ 'comment_type' => WP_REVIEW_COMMENT_TYPE_VISITOR,
733
+ 'comment_post_ID' => $review->post_id,
734
+ 'comment_parent' => 0,
735
+ 'comment_content' => sprintf(__('Visitor Rating: %s', 'wp-review'), sprintf( __( '%s Stars' , 'wp-review' ), $review->rate ) ),
736
+ 'comment_author_IP' => $review->user_ip,
737
+ 'comment_date' => gmdate( 'Y-m-d H:i:s', ( strtotime( $review->date ) + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) ),
738
+ 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', strtotime( $review->date ) ),
739
+ 'comment_approved' => 1
740
+ ) ) ) {
741
+ if ( update_comment_meta( $insert, WP_REVIEW_VISITOR_RATING_METAKEY, $review->rate ) ) {
742
+ // Purge cache.
743
+ mts_get_post_reviews( $review->post_id, true );
744
+ } else {
745
+ wp_delete_comment( $insert );
746
+ }
747
+ }
748
+
749
+ }
750
+
751
+ $end = $start + count($query);//$wpdb->num_rows;
752
+ //$migrated_rows = get_option( 'wp_review_migrated_rows', 0 );
753
+ update_option( 'wp_review_migrated_rows', $end );
754
+
755
+ $total_rows = $wpdb->get_var( 'SELECT COUNT(*) FROM '.$wpdb->base_prefix.'mts_wp_reviews WHERE blog_id = '.$current_blog_id );
756
+ $migration_finished = 0;
757
+ if ( $total_rows == $end ) {
758
+ update_option( 'wp_review_has_migrated', 1 );
759
+ $migration_finished = 1;
760
+ }
761
+
762
+ echo wp_json_encode( array( 'start' => $start, 'lastrow' => $end, 'rowsleft' => $total_rows - $end, 'finished' => $migration_finished ) );
763
+
764
+
765
+ die();
766
+ }
767
+
768
+ /*
769
+ * Custom Rating Types
770
+ *
771
+ */
772
+ $wp_review_rating_types = array();
773
+
774
+ function wp_review_register_rating_type( $rating_type, $args ) {
775
+ global $wp_review_rating_types;
776
+
777
+
778
+ if (empty($args['output_template']) && empty($args['template']))
779
+ return false;
780
+
781
+ // If it has combined 'template'
782
+ // or 'input_template' (for user rating)
783
+ if (!empty($args['template']) || !empty($args['input_template']))
784
+ $args['user_rating'] = true;
785
+ else
786
+ $args['user_rating'] = false;
787
+
788
+ $wp_review_rating_types[$rating_type] = $args;
789
+
790
+ return true;
791
+ }
792
+ add_action( 'init', 'wp_review_register_default_rating_types' );
793
+
794
+ function wp_review_register_default_rating_types() {
795
+ wp_review_register_rating_type( 'star', array(
796
+ 'label' => __('Star', 'wp-review'),
797
+ 'max' => 5,
798
+ 'decimals' => 1,
799
+ 'value_text' => __('%s Stars', 'wp-review'),
800
+ 'value_text_singular' => __('%s Star', 'wp-review'),
801
+ 'input_template' => WP_REVIEW_DIR . 'rating-types/star-input.php',
802
+ 'output_template' => WP_REVIEW_DIR . 'rating-types/star-output.php',
803
+ ) );
804
+
805
+ wp_review_register_rating_type( 'point', array(
806
+ 'label' => __('Point', 'wp-review'),
807
+ 'max' => 10,
808
+ 'decimals' => 1,
809
+ 'value_text' => __('%s/10', 'wp-review'),
810
+ 'value_text_singular' => __('%s/10', 'wp-review'),
811
+ 'input_template' => WP_REVIEW_DIR . 'rating-types/point-input.php',
812
+ 'output_template' => WP_REVIEW_DIR . 'rating-types/point-output.php',
813
+ ) );
814
+
815
+ wp_review_register_rating_type( 'percentage', array(
816
+ 'label' => __('Percentage', 'wp-review'),
817
+ 'max' => 100,
818
+ 'decimals' => 0,
819
+ 'value_text' => __('%s%%', 'wp-review'),
820
+ 'value_text_singular' => __('%s%%', 'wp-review'),
821
+ 'input_template' => WP_REVIEW_DIR . 'rating-types/percentage-input.php',
822
+ 'output_template' => WP_REVIEW_DIR . 'rating-types/percentage-output.php',
823
+ ) );
824
+ }
825
+
826
+ function wp_review_get_post_review_type( $post_id = null ) {
827
+ global $post, $wp_review_rating_types;
828
+
829
+ if ( empty( $post_id ) ) {
830
+ if ( is_a( $post, 'WP_Post') )
831
+ $post_id = $post->ID;
832
+ else
833
+ return '';
834
+ }
835
+
836
+ $type = get_post_meta( $post_id, 'wp_review_type', true );
837
+ if ( empty( $type ) )
838
+ return ''; // not a review
839
+
840
+ $output = '';
841
+ if ( isset( $wp_review_rating_types[$type] ) )
842
+ $output = $type;
843
+ else
844
+ $output = 'star'; // fallback if specific $type is not available anymore
845
+
846
+ return apply_filters( 'wp_review_get_review_type', $output, $post_id );
847
+ }
848
+
849
+ function wp_review_get_post_user_review_type( $post_id = null ) {
850
+ global $post, $wp_review_rating_types;
851
+
852
+ if ( empty( $post_id ) )
853
+ $post_id = $post->ID;
854
+
855
+ $type = wp_review_get_post_review_type( $post_id );
856
+ if ( empty( $type ) )
857
+ return ''; // not a review
858
+
859
+ $userreview_type = get_post_meta( $post_id, 'wp_review_user_review_type', true );
860
+ if ( empty( $userreview_type ) )
861
+ $userreview_type = 'star';
862
+
863
+ $userreviews = in_array( wp_review_get_user_rating_setup( $post_id ), array( WP_REVIEW_REVIEW_VISITOR_ONLY ) );
864
+ if ( ! $userreviews )
865
+ return ''; // user ratings not enabled
866
+
867
+ $output = '';
868
+ if ( isset( $wp_review_rating_types[$userreview_type] ) && $wp_review_rating_types[$userreview_type]['user_rating'] )
869
+ $output = $userreview_type;
870
+ else
871
+ $output = 'star'; // fallback if specific $type is not available
872
+
873
+ return apply_filters( 'wp_review_get_user_review_type', $output, $post_id );
874
+ }
875
+
876
+ /*
877
+ * Custom Box Templates
878
+ *
879
+ */
880
+ function wp_review_get_post_box_template( $post_id ) {
881
+ global $post, $wp_review_rating_types;
882
+
883
+ if ( empty( $post_id ) )
884
+ $post_id = $post->ID;
885
+
886
+ $type = wp_review_get_post_review_type( $post_id );
887
+ if ( empty( $type ) )
888
+ return ''; // not a review
889
+
890
+ $template = get_post_meta( $post_id, 'wp_review_box_template', true );
891
+ if ( empty( $template ) || ! wp_review_locate_box_template( $template ) )
892
+ $template = 'default.php'; // fallback to default.php
893
+
894
+ return apply_filters( 'wp_review_get_box_template', $template, $post_id );
895
+ }
896
+
897
+ function wp_review_locate_box_template( $template_name, $return_full_path = true ) {
898
+ // We look for box templates in:
899
+ // 1. plugins_dir/box-templates
900
+ // 2. theme_dir/wp-review
901
+ // 3. childtheme_dir/wp-review
902
+ // 4... Use filter to add more
903
+ $default_paths = array(
904
+ WP_REVIEW_DIR.'box-templates',
905
+ get_template_directory().'/wp-review',
906
+ get_stylesheet_directory().'/wp-review',
907
+ );
908
+ $template_paths = apply_filters( 'wp_review_box_template_paths', $default_paths );
909
+
910
+
911
+ $paths = array_reverse($template_paths);
912
+ $located = '';
913
+ $path_partial = '';
914
+ foreach ($paths as $path) {
915
+ if (file_exists($full_path = trailingslashit($path).$template_name)) {
916
+ $located = $full_path;
917
+ $path_partial = $path;
918
+ break;
919
+ }
920
+ }
921
+ return ($return_full_path ? $located : $path_partial);
922
+ }
923
+
924
+ /**
925
+ * Shows rating using output template
926
+ *
927
+ * @param mixed $value rating value
928
+ * @param mixed $post_id optional post ID
929
+ * @return [type] [description]
930
+ */
931
+ function wp_review_rating( $value, $post_id = null, $args = array() ) {
932
+ global $wp_review_rating_types, $post;
933
+
934
+ if ( ! empty( $args['user_rating'] ) ) {
935
+ $type = wp_review_get_post_user_review_type( $post_id );
936
+ } else {
937
+ $type = wp_review_get_post_review_type( $post_id );
938
+ }
939
+
940
+ if ( empty( $type ) )
941
+ return '';
942
+
943
+ if (empty($post_id))
944
+ $post_id = $post->ID;
945
+
946
+ $options = get_option('wp_review_options');
947
+ $custom_colors = get_post_meta( $post_id, 'wp_review_custom_colors', true );
948
+ $colors['color'] = get_post_meta( $post_id, 'wp_review_color', true );
949
+ if( empty($colors['color']) ) $colors['color'] = '#333333';
950
+ $colors['type'] = get_post_meta( $post_id, 'wp_review_type', true );
951
+ $colors['fontcolor'] = get_post_meta( $post_id, 'wp_review_fontcolor', true );
952
+ $colors['bgcolor1'] = get_post_meta( $post_id, 'wp_review_bgcolor1', true );
953
+ $colors['bgcolor2'] = get_post_meta( $post_id, 'wp_review_bgcolor2', true );
954
+ $colors['bordercolor'] = get_post_meta( $post_id, 'wp_review_bordercolor', true );
955
+ if ( ! $custom_colors && ! empty($options['colors'] ) && is_array($options['colors'] ) ) {
956
+ $colors = array_merge($colors, $options['colors']);
957
+ }
958
+ $colors = apply_filters('wp_review_colors', $colors, $post_id);
959
+
960
+ // Override colors if is_admin()
961
+ if (is_admin() && !defined('DOING_AJAX')) {
962
+ $admin_colors = array(
963
+ 'color' => '#444444',
964
+ 'bgcolor1' => '#ffffff',
965
+ );
966
+ $colors = array_merge($colors, $admin_colors);
967
+ }
968
+ $color = $colors['color'];
969
+
970
+ // don't allow higher rating than max
971
+ if ($value > $wp_review_rating_types[$type]['max']) {
972
+ $value = $wp_review_rating_types[$type]['max'];
973
+ }
974
+
975
+ $template = $wp_review_rating_types[$type]['output_template'];
976
+ $comment_rating = false;
977
+ set_query_var( 'rating', compact( 'value', 'post_id', 'type', 'args', 'comment_rating', 'color', 'colors' ) );
978
+ ob_start();
979
+ load_template( $template, false );
980
+ $review = ob_get_contents();
981
+ ob_end_clean();
982
+ return $review;
983
+ }
984
+
985
+ function wp_review_user_rating( $post_id = null, $args = array() ) {
986
+ global $wp_review_rating_types;
987
+ $type = wp_review_get_post_user_review_type( $post_id );
988
+
989
+ if ( empty( $type ) )
990
+ return '';
991
+
992
+ $review = '';
993
+
994
+ $postReviews = mts_get_post_reviews( $post_id );
995
+ $value = $postReviews['rating'];
996
+ $count = $postReviews['count'];
997
+ $total = get_post_meta( $post_id, 'wp_review_total', true );
998
+
999
+ $user_id = '';
1000
+ if ( is_user_logged_in() ) {
1001
+ $user_id = get_current_user_id();
1002
+ }
1003
+
1004
+ if ( $value == '' ) {
1005
+ $value = '0.0';
1006
+ }
1007
+
1008
+ if ( hasPreviousReview( $post_id, $user_id, wp_review_get_user_ip(), WP_REVIEW_COMMENT_TYPE_VISITOR ) || ( ! is_user_logged_in() && ! empty( $options['registered_only'] ) ) ) {
1009
+ return wp_review_rating( $value, $post_id, array( 'user_rating' => true ) ); // return just output template
1010
+ }
1011
+
1012
+ $options = get_option('wp_review_options');
1013
+ $custom_colors = get_post_meta( $post_id, 'wp_review_custom_colors', true );
1014
+ $colors['color'] = get_post_meta( $post_id, 'wp_review_color', true );
1015
+ if( empty($colors['color']) ) $colors['color'] = '#333333';
1016
+ $colors['type'] = get_post_meta( $post_id, 'wp_review_type', true );
1017
+ $colors['fontcolor'] = get_post_meta( $post_id, 'wp_review_fontcolor', true );
1018
+ $colors['bgcolor1'] = get_post_meta( $post_id, 'wp_review_bgcolor1', true );
1019
+ $colors['bgcolor2'] = get_post_meta( $post_id, 'wp_review_bgcolor2', true );
1020
+ $colors['bordercolor'] = get_post_meta( $post_id, 'wp_review_bordercolor', true );
1021
+ if ( ! $custom_colors && ! empty($options['colors'] ) && is_array($options['colors'] ) ) {
1022
+ $colors = array_merge($colors, $options['colors']);
1023
+ }
1024
+ $colors = apply_filters('wp_review_colors', $colors, $post_id);
1025
+ $color = $colors['color'];
1026
+
1027
+ $rating_type_template = $wp_review_rating_types[$type]['input_template'];
1028
+ $comment_rating = false;
1029
+ set_query_var( 'rating', compact( 'value', 'post_id', 'comment_rating', 'args', 'color', 'colors' ) );
1030
+ ob_start();
1031
+ load_template( $rating_type_template, false );
1032
+ $review = '<div class="wp-review-user-rating wp-review-user-rating-'.$type.'">'.ob_get_contents().'</div>';
1033
+ ob_end_clean();
1034
+
1035
+ if ( $value !== '0.0' && $total === '' ) {// dont'show if no user ratings and there is review
1036
+ $review .= '<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
1037
+ <meta itemprop="ratingValue" content="' . $userTotal . '" />
1038
+ <meta itemprop="reviewCount" content="' . $usersReviewsCount . '" />
1039
+ </div>';
1040
+ }
1041
+ return $review;
1042
+ }
1043
+
1044
+ /**
1045
+ * Returns WP Review box html using the box template chosen for the review
1046
+ * Replaces wp_review_get_data()
1047
+ *
1048
+ * @param [type] $post_id [description]
1049
+ * @return [type] [description]
1050
+ */
1051
+ function wp_review_get_review_box( $post_id = null ) {
1052
+ global $post;
1053
+ if (empty($post_id))
1054
+ $post_id = $post->ID;
1055
+ $type = wp_review_get_post_review_type( $post_id );
1056
+ if ( ! $type )
1057
+ return '';
1058
+
1059
+ // Load variables
1060
+ $options = get_option('wp_review_options');
1061
+
1062
+ /* Retrieve the meta box data. */
1063
+ $heading = get_post_meta( $post_id, 'wp_review_heading', true );
1064
+ $desc_title = get_post_meta( $post_id, 'wp_review_desc_title', true );
1065
+ if ( ! $desc_title ) $desc_title = __('Summary', 'wp-review');
1066
+ $desc = get_post_meta( $post_id, 'wp_review_desc', true );
1067
+ $items = get_post_meta( $post_id, 'wp_review_item', true );
1068
+ $type = get_post_meta( $post_id, 'wp_review_type', true );
1069
+ $total = get_post_meta( $post_id, 'wp_review_total', true );
1070
+ $hide_desc = get_post_meta( $post_id, 'wp_review_hide_desc', true );
1071
+ $schema = wp_review_get_review_schema( $post_id );
1072
+ $links = get_post_meta( $post_id, 'wp_review_links', true );
1073
+
1074
+ $custom_author = get_post_meta( $post_id, 'wp_review_custom_author', true );
1075
+ $author_field = get_post_meta( $post_id, 'wp_review_author', true );
1076
+
1077
+ $author = ( !$author_field || empty( $author_field ) || !$custom_author ) ? get_the_author() : $author_field;
1078
+ $add_backlink = ! empty( $options['add_backlink'] ) ? true : false;
1079
+
1080
+ $colors = array();
1081
+ $colors['custom_colors'] = get_post_meta( $post_id, 'wp_review_custom_colors', true );
1082
+ $colors['custom_location'] = get_post_meta( $post_id, 'wp_review_custom_location', true );
1083
+ $colors['custom_width'] = get_post_meta( $post_id, 'wp_review_custom_width', true );
1084
+
1085
+ $colors['color'] = get_post_meta( $post_id, 'wp_review_color', true );
1086
+ if( empty($colors['color']) ) $colors['color'] = '#333333';
1087
+ $colors['type'] = get_post_meta( $post_id, 'wp_review_type', true );
1088
+ $colors['fontcolor'] = get_post_meta( $post_id, 'wp_review_fontcolor', true );
1089
+ $colors['bgcolor1'] = get_post_meta( $post_id, 'wp_review_bgcolor1', true );
1090
+ $colors['bgcolor2'] = get_post_meta( $post_id, 'wp_review_bgcolor2', true );
1091
+ $colors['bordercolor'] = get_post_meta( $post_id, 'wp_review_bordercolor', true );
1092
+ $colors['total'] = get_post_meta( $post_id, 'wp_review_total', true );
1093
+
1094
+ if ( ! $colors['custom_colors'] && ! empty($options['colors'] ) && is_array($options['colors'] ) ) {
1095
+ $colors = array_merge($colors, $options['colors']);
1096
+ }
1097
+ $colors = apply_filters('wp_review_colors', $colors, $post_id);
1098
+
1099
+ $width = get_post_meta( $post_id, 'wp_review_width', true );
1100
+ if (empty($width)) $width = 100;
1101
+ $align = get_post_meta( $post_id, 'wp_review_align', true );
1102
+ if (empty($align)) $align = 'left';
1103
+
1104
+ if (!$colors['custom_width']) {
1105
+ $width = ! empty($options['width']) ? $options['width'] : 100;
1106
+ $align = ! empty($options['align']) ? $options['align'] : 'left';
1107
+ }
1108
+
1109
+ $post_types = get_post_types( array('public' => true), 'names' );
1110
+ $excluded_post_types = apply_filters('wp_review_excluded_post_types', array('attachment'));
1111
+ $allowed_post_types = array_diff($post_types, $excluded_post_types);
1112
+
1113
+ $user_review = in_array( wp_review_get_user_rating_setup( $post_id ), array( WP_REVIEW_REVIEW_VISITOR_ONLY ) );
1114
+ $user_review_type = '';
1115
+ $user_review_total = '';
1116
+ $user_review_count = 0;
1117
+ $user_has_reviewed = false;
1118
+ if ( $user_review ) {
1119
+ $user_review_type = wp_review_get_post_user_review_type( $post_id );
1120
+ }
1121
+ if ( $user_review ) {
1122
+ $postReviews = mts_get_post_reviews( $post_id );
1123
+ $user_review_total = $postReviews['rating'];
1124
+ $user_review_count = $postReviews['count'];
1125
+ $user_id = is_user_logged_in() ? get_current_user_id() : 0;
1126
+ $uip = wp_review_get_user_ip();
1127
+ if ( hasPreviousReview( $post_id, $user_id, $uip, WP_REVIEW_COMMENT_TYPE_VISITOR ) )
1128
+ $user_has_reviewed = true;
1129
+ }
1130
+
1131
+
1132
+
1133
+ $template = wp_review_get_post_box_template( $post_id );
1134
+ $box_template_path = wp_review_locate_box_template( $template );
1135
+ // pass variables to template
1136
+ set_query_var( 'review', compact(
1137
+ 'post_id',
1138
+ 'type',
1139
+ 'heading',
1140
+ 'author',
1141
+ 'items',
1142
+ 'hide_desc',
1143
+ 'desc',
1144
+ 'desc_title',
1145
+ 'total',
1146
+ 'colors',
1147
+ 'width',
1148
+ 'align',
1149
+ 'schema',
1150
+ 'links',
1151
+ 'user_review',
1152
+ 'user_review_type',
1153
+ 'user_review_total',
1154
+ 'user_review_count',
1155
+ 'user_has_reviewed',
1156
+ 'add_backlink'
1157
+ ) );
1158
+ ob_start();
1159
+ load_template( $box_template_path, false );
1160
+ $review = ob_get_contents();
1161
+ ob_end_clean();
1162
+ $review = apply_filters('wp_review_get_data', $review, $post_id, $type, $total, $items);
1163
+ return $review;// . wp_review_color_output( $post_id ); // add color CSS to output
1164
+ }
1165
+
1166
+
1167
+ function wp_review_get_box_template_info( $template = false ) {
1168
+ $default_template_headers = array(
1169
+ 'Name' => 'WP Review',
1170
+ 'TemplateURI' => 'Template URI',
1171
+ 'Version' => 'Version',
1172
+ 'Description' => 'Description',
1173
+ 'Author' => 'Author',
1174
+ 'AuthorURI' => 'Author URI'
1175
+ );
1176
+
1177
+ if ( ! $template )
1178
+ $template = wp_review_get_post_box_template();
1179
+
1180
+ $path = wp_review_locate_box_template( $template );
1181
+
1182
+ if ( $path )
1183
+ return get_file_data( $path, $default_template_headers );
1184
+ else
1185
+ return array( $default_template_headers );
1186
+ }
1187
+
1188
+ /**
1189
+ * Returns absolute path to template directory.
1190
+ * @return string path
1191
+ */
1192
+ function wp_review_get_box_template_directory() {
1193
+ $template = wp_review_get_post_box_template();
1194
+ if ( ! $template )
1195
+ return '';
1196
+
1197
+ $current_template_directory = wp_review_locate_box_template( $template );
1198
+
1199
+ return dirname($current_template_directory);
1200
+ }
1201
+
1202
+ /**
1203
+ * Returns template directory URI. To be used in template file.
1204
+ * @return string path
1205
+ */
1206
+ function wp_review_get_box_template_directory_uri() {
1207
+ // let's hope this will work in most cases
1208
+ return get_bloginfo( 'url' ).'/'.str_replace(ABSPATH, '', wp_review_get_box_template_directory());
1209
+ }
1210
+
1211
+
1212
+ function wp_review_get_box_templates_list() {
1213
+
1214
+ $default_paths = array(
1215
+ WP_REVIEW_DIR.'box-templates',
1216
+ get_template_directory().'/wp-review',
1217
+ get_stylesheet_directory().'/wp-review',
1218
+ );
1219
+ $paths = apply_filters( 'wp_review_box_template_paths', $default_paths );
1220
+
1221
+ $templates = array();
1222
+
1223
+ foreach ($paths as $path) {
1224
+ $path = trailingslashit( $path );
1225
+ // Look for files containing our header 'Launcher template'
1226
+ $files = (array) wp_review_scandir( $path, 'php', 2 );
1227
+ foreach ( $files as $file => $full_path ) {//echo ' <br> '.$file.' - '.$full_path;
1228
+ if ( ! $full_path || ! preg_match( '|WP Review:(.*)$|mi', file_get_contents( $full_path ), $header ) )
1229
+ continue;
1230
+
1231
+ $templates[ $file ] = wp_review_get_box_template_info( $file );
1232
+ $templates[ $file ]['path'] = $path;
1233
+ }
1234
+ }
1235
+ return $templates;
1236
+ }
1237
+
1238
+ function wp_review_get_rating_types() {
1239
+ global $wp_review_rating_types;
1240
+ return $wp_review_rating_types;
1241
+ }
1242
+
1243
+ function wp_review_scandir( $path, $extensions = null, $depth = 0, $relative_path = '' ) {
1244
+ if ( ! is_dir( $path ) )
1245
+ return false;
1246
+ if ( $extensions ) {
1247
+ $extensions = (array) $extensions;
1248
+ $_extensions = implode( '|', $extensions );
1249
+ }
1250
+ $relative_path = trailingslashit( $relative_path );
1251
+ if ( '/' == $relative_path )
1252
+ $relative_path = '';
1253
+ $results = scandir( $path );
1254
+ $files = array();
1255
+ foreach ( $results as $result ) {
1256
+ if ( '.' == $result[0] )
1257
+ continue;
1258
+ if ( is_dir( $path . '/' . $result ) ) {
1259
+ if ( ! $depth || 'CVS' == $result )
1260
+ continue;
1261
+ $found = wp_review_scandir( $path . '/' . $result, $extensions, $depth - 1 , $relative_path . $result );
1262
+ $files = array_merge_recursive( $files, $found );
1263
+ } elseif ( ! $extensions || preg_match( '~\.(' . $_extensions . ')$~', $result ) ) {
1264
+ $files[ $relative_path . $result ] = $path . '/' . $result;
1265
+ }
1266
+ }
1267
+ return $files;
1268
+ }
1269
+
1270
+
1271
+ add_action( 'init', 'wp_review_add_admin_columns' );
1272
+ function wp_review_add_admin_columns() {
1273
+ $post_types = get_post_types( array('public' => true), 'names' );
1274
+ $excluded_post_types = apply_filters('wp_review_excluded_post_types', array('attachment'));
1275
+ $allowed_post_types = array_diff($post_types, $excluded_post_types);
1276
+ foreach ($allowed_post_types as $key => $value) {
1277
+ // Add post list table column
1278
+ add_filter('manage_'.$value.'_posts_columns', 'wp_review_post_list_column');
1279
+ // Post list table column content
1280
+ add_action('manage_'.$value.'_posts_custom_column', 'wp_review_post_list_column_content', 10, 2);
1281
+ }
1282
+ }
1283
+ function wp_review_post_list_column($defaults) {
1284
+ $defaults['wp_review_rating'] = __('Rating', 'wp-review');
1285
+ return $defaults;
1286
+ }
1287
+ function wp_review_post_list_column_content($column_name, $post_ID) {
1288
+ if ($column_name == 'wp_review_rating') {
1289
+ $total = get_post_meta( $post_ID, 'wp_review_total', true );
1290
+ if ( $total )
1291
+ echo wp_review_rating($total, $post_ID);
1292
+ else
1293
+ echo '<span class="no-rating">'.__( 'No Rating', 'wp-review' ).'</span>';
1294
+ }
1295
+ }
1296
+
1297
+ function wp_review_get_backlink() {
1298
+ $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>';
1299
+ return $backlink_text;
1300
+ }
1301
+
1302
+ // Notice about migrating ratings
1303
+ add_action( 'admin_notices', 'wp_review_migrate_notice' );
1304
+ add_action('admin_init', 'wp_review_migrate_notice_ignore');
1305
+
1306
+ function wp_review_migrate_notice_ignore() {
1307
+ global $current_user;
1308
+ $user_id = $current_user->ID;
1309
+ /* If user clicks to ignore the notice, add that to their user meta */
1310
+ if ( isset($_GET['wp_review_migrate_notice_ignore']) && '1' == $_GET['wp_review_migrate_notice_ignore'] ) {
1311
+ add_user_meta($user_id, 'wp_review_migrate_notice_ignore', 'true', true);
1312
+ }
1313
+ }
1314
+ function wp_review_migrate_notice() {
1315
+ // Migrate
1316
+ global $wpdb, $current_user;
1317
+ $user_id = $current_user->ID;
1318
+ if ( get_user_meta($user_id, 'wp_review_migrate_notice_ignore') )
1319
+ return;
1320
+
1321
+ $has_migrated = get_option( 'wp_review_has_migrated', false );
1322
+ if ($has_migrated)
1323
+ return;
1324
+
1325
+ $current_blog_id = get_current_blog_id();
1326
+ $total_rows = 0;
1327
+ $rows_left = 0;
1328
+ $migrated_rows = get_option( 'wp_review_migrated_rows', 0 );
1329
+ if ( ! $has_migrated && $wpdb->get_var("SHOW TABLES LIKE '{$wpdb->base_prefix}mts_wp_reviews'") == "{$wpdb->base_prefix}mts_wp_reviews") {
1330
+ // Table exists and not migrated (fully) yet
1331
+ $total_rows = $wpdb->get_var( 'SELECT COUNT(*) FROM '.$wpdb->base_prefix.'mts_wp_reviews WHERE blog_id = '.$current_blog_id );
1332
+ $rows_left = $total_rows - $migrated_rows;
1333
+ }
1334
+
1335
+ if (!$rows_left)
1336
+ return;
1337
+ ?>
1338
+ <div class="updated notice-info wp-review-notice">
1339
+ <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>
1340
+ </div>
1341
+ <?php
1342
+ }
1343
+
1344
+ /* Display a notice*/
1345
+
1346
+ add_action('admin_notices', 'wp_review_admin_notice');
1347
+
1348
+ function wp_review_admin_notice() {
1349
+ global $current_user ;
1350
+ $user_id = $current_user->ID;
1351
+ /* Check that the user hasn't already clicked to ignore the message */
1352
+ /* Only show the notice 2 days after plugin activation */
1353
+ if ( ! get_user_meta($user_id, 'wp_review_ignore_notice') && time() >= (get_option( 'wp_review_activated', 0 ) + (2 * 24 * 60 * 60)) ) {
1354
+ echo '<div class="updated notice-info wp-review-notice" id="wpreview-notice" style="position:relative;">';
1355
+ printf(__('<p>Create Reviews Easily & Rank Higher In Search Engines - <a target="_blank" href="https://mythemeshop.com/plugins/wp-review-pro/?utm_source=WP+Review&utm_medium=Notification+Link&utm_content=WP+Review+Pro+LP&utm_campaign=WordPressOrg"><strong>WP Review Pro Plugin</strong></a></p><a class="notice-dismiss" href="%1$s"></a>'), '?wp_review_admin_notice_ignore=0');
1356
+ echo "</div>";
1357
+ }
1358
+ }
1359
+
1360
+ add_action('admin_init', 'wp_review_admin_notice_ignore');
1361
+
1362
+ function wp_review_admin_notice_ignore() {
1363
+ global $current_user;
1364
+ $user_id = $current_user->ID;
1365
+ /* If user clicks to ignore the notice, add that to their user meta */
1366
+ if ( isset($_GET['wp_review_admin_notice_ignore']) && '0' == $_GET['wp_review_admin_notice_ignore'] ) {
1367
+ add_user_meta($user_id, 'wp_review_ignore_notice', 'true', true);
1368
+ }
1369
+ }
includes/widget.php CHANGED
@@ -1,516 +1,516 @@
1
- <?php
2
- class wp_review_tab_widget extends WP_Widget {
3
- function __construct() {
4
- // ajax functions
5
- add_action('wp_ajax_wp_review_tab_widget_content', array(&$this, 'ajax_wp_review_tab_widget_content'));
6
- add_action('wp_ajax_nopriv_wp_review_tab_widget_content', array(&$this, 'ajax_wp_review_tab_widget_content'));
7
-
8
- // css
9
- add_action('wp_enqueue_scripts', array(&$this, 'wp_review_tab_register_scripts'));
10
- add_action('admin_enqueue_scripts', array(&$this, 'wp_review_tab_admin_scripts'));
11
- add_action('customize_controls_enqueue_scripts', array(&$this, 'wp_review_tab_admin_scripts'));
12
-
13
- $widget_ops = array('classname' => 'widget_wp_review_tab', 'description' => __('Display Reviews in tabbed format.', 'wp-review'));
14
- $control_ops = array('width' => 200, 'height' => 350);
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 ) {
33
- $instance = wp_parse_args( (array) $instance, array(
34
- 'widget_title' => '',
35
- 'tabs' => array('toprated' => 1, 'recent' => 1, 'mostvoted' => 0, 'custom' => 0),
36
- 'tab_order' => array('toprated' => 1, 'recent' => 2, 'mostvoted' => 3, 'custom' => 4),
37
- 'tab_titles' => array('toprated' => __('Top Rated'), 'recent' => __('Recent'), 'mostvoted' => __('Most Voted'), 'custom' => __('Editor\'s choice')),
38
- 'allow_pagination' => 1,
39
- 'review_type' => 'any',
40
- 'post_num' => '5',
41
- 'comment_num' => '5',
42
- 'thumb_size' => 'small',
43
- 'show_date' => 1,
44
- 'custom_reviews' => '',
45
- 'title_length' => apply_filters( 'wpt_title_length_default', '15' )
46
- ));
47
-
48
- extract($instance);
49
- ?>
50
- <div class="wp_review_tab_options_form">
51
-
52
- <p>
53
- <label for="<?php echo $this->get_field_id( 'widget_title' ); ?>"><?php _e( 'Title:','mythemeshop' ); ?></label>
54
- <input class="widefat" id="<?php echo $this->get_field_id( 'widget_title' ); ?>" name="<?php echo $this->get_field_name( 'widget_title' ); ?>" type="text" value="<?php echo esc_attr( $widget_title ); ?>" />
55
- </p>
56
-
57
- <h4><?php _e('Select Tabs', 'wp-review'); ?></h4>
58
-
59
- <div class="wp_review_tab_select_tabs">
60
- <label class="alignleft" style="display: block; width: 50%; margin-bottom: 7px;" for="<?php echo $this->get_field_id("tabs"); ?>_toprated">
61
- <input type="checkbox" class="checkbox wp_review_tab_enable_toprated" id="<?php echo $this->get_field_id("tabs"); ?>_toprated" name="<?php echo $this->get_field_name("tabs"); ?>[toprated]" value="1" <?php if (isset($tabs['toprated'])) { checked( 1, $tabs['toprated'], true ); } ?> />
62
- <?php _e( 'Top Rated', 'wp-review'); ?>
63
- </label>
64
- <label class="alignleft" style="display: block; width: 50%; margin-bottom: 7px;" for="<?php echo $this->get_field_id("tabs"); ?>_recent">
65
- <input type="checkbox" class="checkbox wp_review_tab_enable_recent" id="<?php echo $this->get_field_id("tabs"); ?>_recent" name="<?php echo $this->get_field_name("tabs"); ?>[recent]" value="1" <?php if (isset($tabs['recent'])) { checked( 1, $tabs['recent'], true ); } ?> />
66
- <?php _e( 'Recent', 'wp-review'); ?>
67
- </label>
68
- <label class="alignleft" style="display: block; width: 50%;" for="<?php echo $this->get_field_id("tabs"); ?>_mostvoted">
69
- <input type="checkbox" class="checkbox wp_review_tab_enable_mostvoted" id="<?php echo $this->get_field_id("tabs"); ?>_mostvoted" name="<?php echo $this->get_field_name("tabs"); ?>[mostvoted]" value="1" <?php if (isset($tabs['mostvoted'])) { checked( 1, $tabs['mostvoted'], true ); } ?> />
70
- <?php _e( 'Most Voted', 'wp-review'); ?>
71
- </label>
72
- <label class="alignleft" style="display: block; width: 50%;" for="<?php echo $this->get_field_id("tabs"); ?>_custom">
73
- <input type="checkbox" class="checkbox wp_review_tab_enable_custom" id="<?php echo $this->get_field_id("tabs"); ?>_custom" name="<?php echo $this->get_field_name("tabs"); ?>[custom]" value="1" <?php if (isset($tabs['custom'])) { checked( 1, $tabs['custom'], true ); } ?> />
74
- <?php _e( 'Custom', 'wp-review'); ?>
75
- </label>
76
- </div>
77
- <div class="clear"></div>
78
-
79
- <div class="wp_review_tab_advanced_options">
80
-
81
- <p class="wp_review_tab_review_type">
82
- <label for="<?php echo $this->get_field_id('review_type'); ?>"><?php _e('Review type:', 'wp-review'); ?></label>
83
- <select id="<?php echo $this->get_field_id('review_type'); ?>" name="<?php echo $this->get_field_name('review_type'); ?>" style="margin-left: 12px;">
84
- <option value="any" <?php selected($review_type, 'any', true); ?>><?php _e('Any', 'wp-review'); ?></option>
85
- <option value="star" <?php selected($review_type, 'star', true); ?>><?php _e('Star', 'wp-review'); ?></option>
86
- <option value="point" <?php selected($review_type, 'point', true); ?>><?php _e('Point', 'wp-review'); ?></option>
87
- <option value="percentage" <?php selected($review_type, 'percentage', true); ?>><?php _e('Percentage', 'wp-review'); ?></option>
88
- </select>
89
- </p>
90
-
91
- <p>
92
- <label for="<?php echo $this->get_field_id("allow_pagination"); ?>">
93
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("allow_pagination"); ?>" name="<?php echo $this->get_field_name("allow_pagination"); ?>" value="1" <?php if (isset($allow_pagination)) { checked( 1, $allow_pagination, true ); } ?> />
94
- <?php _e( 'Allow pagination', 'wp-review'); ?>
95
- </label>
96
- </p>
97
-
98
- <p>
99
- <label for="<?php echo $this->get_field_id('post_num'); ?>"><?php _e('Number of reviews to show:', 'wp-review'); ?>
100
- <br />
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
- <!-- dummy input so that WP doesn't pick up title_length as title -->
109
- <input id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="" style="display: none;" />
110
- <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; ?>" />
111
- </label>
112
- </p>
113
-
114
- <p class="wp_review_tab_thumbnail_size">
115
- <label for="<?php echo $this->get_field_id('thumb_size'); ?>"><?php _e('Thumbnail size:', 'wp-review'); ?></label>
116
- <select id="<?php echo $this->get_field_id('thumb_size'); ?>" name="<?php echo $this->get_field_name('thumb_size'); ?>" style="margin-left: 12px;">
117
- <option value="small" <?php selected($thumb_size, 'small', true); ?>><?php _e('Small', 'wp-review'); ?></option>
118
- <option value="large" <?php selected($thumb_size, 'large', true); ?>><?php _e('Large', 'wp-review'); ?></option>
119
- </select>
120
- </p>
121
-
122
- <p>
123
- <label for="<?php echo $this->get_field_id("show_date"); ?>">
124
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("show_date"); ?>" name="<?php echo $this->get_field_name("show_date"); ?>" value="1" <?php if (isset($show_date)) { checked( 1, $show_date, true ); } ?> />
125
- <?php _e( 'Show date', 'wp-review'); ?>
126
- </label>
127
- </p>
128
-
129
- <p class="wp_review_tab_custom_reviews"<?php echo (empty($tabs['custom']) ? ' style="display: none;"' : ''); ?>>
130
- <label for="<?php echo $this->get_field_id('custom_reviews'); ?>"><?php _e('Reviews on Custom tab:', 'wp-review'); ?>
131
- <br />
132
- <input id="<?php echo $this->get_field_id('custom_reviews'); ?>" name="<?php echo $this->get_field_name('custom_reviews'); ?>" type="text" value="<?php echo $custom_reviews; ?>" />
133
- <br />
134
- <span style="color: #999;">Add IDs, separated by commas, eg. <em>145, 168, 229</em></span>
135
- </label>
136
- </p>
137
-
138
- <div class="clear"></div>
139
-
140
- <h4><a href="#" class="wp_review_tab_titles_header"><?php _e('Tab Titles', 'wp-review'); ?></a> | <a href="#" class="wp_review_tab_order_header"><?php _e('Tab Order', 'wp-review'); ?></a></h4>
141
-
142
- <div class="wp_review_tab_order" style="display: none;">
143
-
144
- <label class="alignleft wp_review_tab_toprated_order" for="<?php echo $this->get_field_id('tab_order'); ?>_toprated" style="width: 50%;<?php echo (empty($tabs['toprated']) ? ' display: none;' : ''); ?>">
145
- <input id="<?php echo $this->get_field_id('tab_order'); ?>_toprated" name="<?php echo $this->get_field_name('tab_order'); ?>[toprated]" type="number" min="1" step="1" value="<?php echo $tab_order['toprated']; ?>" style="width: 48px;" />
146
- <?php _e('Top Rated', 'wp-review'); ?>
147
- </label>
148
- <label class="alignleft wp_review_tab_recent_order" for="<?php echo $this->get_field_id('tab_order'); ?>_recent" style="width: 50%;<?php echo (empty($tabs['recent']) ? ' display: none;' : ''); ?>">
149
- <input id="<?php echo $this->get_field_id('tab_order'); ?>_recent" name="<?php echo $this->get_field_name('tab_order'); ?>[recent]" type="number" min="1" step="1" value="<?php echo $tab_order['recent']; ?>" style="width: 48px;" />
150
- <?php _e('Recent', 'wp-review'); ?>
151
- </label>
152
- <label class="alignleft wp_review_tab_mostvoted_order" for="<?php echo $this->get_field_id('tab_order'); ?>_mostvoted" style="width: 50%;<?php echo (empty($tabs['mostvoted']) ? ' display: none;' : ''); ?>">
153
- <input id="<?php echo $this->get_field_id('tab_order'); ?>_mostvoted" name="<?php echo $this->get_field_name('tab_order'); ?>[mostvoted]" type="number" min="1" step="1" value="<?php echo $tab_order['mostvoted']; ?>" style="width: 48px;" />
154
- <?php _e('Most Voted', 'wp-review'); ?>
155
- </label>
156
- <label class="alignleft wp_review_tab_custom_order" for="<?php echo $this->get_field_id('tab_order'); ?>_custom" style="width: 50%;<?php echo (empty($tabs['custom']) ? ' display: none;' : ''); ?>">
157
- <input id="<?php echo $this->get_field_id('tab_order'); ?>_custom" name="<?php echo $this->get_field_name('tab_order'); ?>[custom]" type="number" min="1" step="1" value="<?php echo $tab_order['custom']; ?>" style="width: 48px;" />
158
- <?php _e('Custom', 'wp-review'); ?>
159
- </label>
160
- </div>
161
- <div class="clear" style="margin-bottom: 15px;"></div>
162
-
163
- <div class="wp_review_tab_titles" style="display: none;">
164
-
165
- <label class="alignleft wp_review_tab_toprated_title" for="<?php echo $this->get_field_id('tab_titles'); ?>_toprated" style="width: 50%;<?php echo (empty($tabs['toprated']) ? ' display: none;' : ''); ?>">
166
- <?php _e('Top Rated', 'wp-review'); ?>
167
- <input id="<?php echo $this->get_field_id('tab_titles'); ?>_toprated" name="<?php echo $this->get_field_name('tab_titles'); ?>[toprated]" type="text" value="<?php echo esc_attr($tab_titles['toprated']); ?>" style="width: 98%;" />
168
- </label>
169
- <label class="alignleft wp_review_tab_recent_title" for="<?php echo $this->get_field_id('tab_titles'); ?>_recent" style="width: 50%;<?php echo (empty($tabs['recent']) ? ' display: none;' : ''); ?>">
170
- <?php _e('Recent', 'wp-review'); ?>
171
- <input id="<?php echo $this->get_field_id('tab_titles'); ?>_recent" name="<?php echo $this->get_field_name('tab_titles'); ?>[recent]" type="text" value="<?php echo esc_attr($tab_titles['recent']); ?>" style="width: 98%;" />
172
- </label>
173
- <label class="alignleft wp_review_tab_mostvoted_title" for="<?php echo $this->get_field_id('tab_titles'); ?>_mostvoted" style="width: 50%;<?php echo (empty($tabs['mostvoted']) ? ' display: none;' : ''); ?>">
174
- <?php _e('Most Voted', 'wp-review'); ?>
175
- <input id="<?php echo $this->get_field_id('tab_titles'); ?>_mostvoted" name="<?php echo $this->get_field_name('tab_titles'); ?>[mostvoted]" type="text" value="<?php echo esc_attr($tab_titles['mostvoted']); ?>" style="width: 98%;" />
176
- </label>
177
- <label class="alignleft wp_review_tab_custom_title" for="<?php echo $this->get_field_id('tab_titles'); ?>_custom" style="width: 50%;<?php echo (empty($tabs['custom']) ? ' display: none;' : ''); ?>">
178
- <?php _e('Custom', 'wp-review'); ?>
179
- <input id="<?php echo $this->get_field_id('tab_titles'); ?>_custom" name="<?php echo $this->get_field_name('tab_titles'); ?>[custom]" type="text" value="<?php echo esc_attr($tab_titles['custom']); ?>" style="width: 98%;" />
180
- </label>
181
- </div>
182
- <div class="clear" style="margin-bottom: 15px;"></div>
183
-
184
- </div><!-- .wp_review_tab_advanced_options -->
185
- </div><!-- .wp_review_tab_options_form -->
186
- <?php
187
- }
188
-
189
- function update( $new_instance, $old_instance ) {
190
- $instance = $old_instance;
191
- $instance['widget_title'] = strip_tags( $new_instance['widget_title'] );
192
- $instance['tabs'] = $new_instance['tabs'];
193
- $instance['tab_order'] = $new_instance['tab_order'];
194
- $instance['tab_titles'] = wp_kses_post($new_instance['tab_titles']);
195
- $instance['review_type'] = $new_instance['review_type'];
196
- $instance['allow_pagination'] = $new_instance['allow_pagination'];
197
- $instance['post_num'] = $new_instance['post_num'];
198
- $instance['title_length'] = $new_instance['title_length'];
199
- $instance['thumb_size'] = $new_instance['thumb_size'];
200
- $instance['show_date'] = $new_instance['show_date'];
201
- $instance['custom_reviews'] = $new_instance['custom_reviews'];
202
-
203
- return $instance;
204
- }
205
- function widget( $args, $instance ) {
206
- extract($args, EXTR_SKIP);
207
- extract($instance, EXTR_SKIP);
208
- $widget_title = apply_filters( 'widget_title', $widget_title );
209
- wp_enqueue_script( 'wp_review_tab_widget' );
210
- wp_enqueue_script( 'wp_review-js' );
211
- wp_enqueue_style( 'wp_review-style' );
212
- wp_enqueue_style( 'wp_review_tab_widget' );
213
- wp_localize_script( 'wp_review-js', 'wpreview', array(
214
- 'ajaxurl' => admin_url('admin-ajax.php')
215
- ) );
216
- if (empty($tabs)) $tabs = array('recent' => 1, 'toprated' => 1);
217
- $tabs_count = count($tabs);
218
- if ($tabs_count <= 1) {
219
- $tabs_count = 1;
220
- } elseif($tabs_count > 3) {
221
- $tabs_count = 4;
222
- }
223
-
224
- $available_tabs = array(
225
- 'toprated' => $tab_titles['toprated'],
226
- 'recent' => $tab_titles['recent'],
227
- 'mostvoted' => $tab_titles['mostvoted'],
228
- 'custom' => $tab_titles['custom']
229
- );
230
-
231
- array_multisort($tab_order, $available_tabs);
232
-
233
- ?>
234
- <?php echo $before_widget;
235
- if ( ! empty( $widget_title ) ) echo $before_title . $widget_title . $after_title; ?>
236
- <div class="wp_review_tab_widget_content" id="<?php echo $widget_id; ?>_content">
237
- <ul class="wp-review-tabs <?php echo "has-$tabs_count-"; ?>tabs">
238
- <?php foreach ($available_tabs as $tab => $label) : ?>
239
- <?php if (!empty($tabs[$tab])): ?>
240
- <li class="tab_title"><a href="#" id="<?php echo $tab; ?>-tab"><?php echo $label; ?></a></li>
241
- <?php endif; ?>
242
- <?php endforeach; ?>
243
- </ul> <!--end .tabs-->
244
- <div class="clear"></div>
245
- <div class="inside">
246
- <?php if (!empty($tabs['toprated'])): ?>
247
- <div id="toprated-tab-content" class="tab-content">
248
- </div> <!--end #toprated-tab-content-->
249
- <?php endif; ?>
250
- <?php if (!empty($tabs['recent'])): ?>
251
- <div id="recent-tab-content" class="tab-content">
252
- </div> <!--end #recent-tab-content-->
253
- <?php endif; ?>
254
- <?php if (!empty($tabs['mostvoted'])): ?>
255
- <div id="mostvoted-tab-content" class="tab-content">
256
- <ul>
257
- </ul>
258
- </div> <!--end #mostvoted-tab-content-->
259
- <?php endif; ?>
260
- <?php if (!empty($tabs['custom'])): ?>
261
- <div id="custom-tab-content" class="tab-content">
262
- <ul>
263
- </ul>
264
- </div> <!--end #custom-tab-content-->
265
- <?php endif; ?>
266
- <div class="clear"></div>
267
- </div> <!--end .inside -->
268
- <div class="clear"></div>
269
- </div><!--end #tabber -->
270
- <?php
271
- // inline script
272
- // to support multiple instances per page with different settings
273
-
274
- unset($instance['tabs'], $instance['tab_order'], $instance['tab_titles']); // unset unneeded
275
- ?>
276
- <script type="text/javascript">
277
- jQuery(function($) {
278
- $('#<?php echo $widget_id; ?>_content').data('args', <?php echo wp_json_encode($instance); ?>);
279
- });
280
- </script>
281
- <?php echo $after_widget; ?>
282
- <?php
283
- }
284
-
285
- function get_most_voted($limit = 20){
286
- $comments = get_comments( array(
287
- 'type__in' => array( WP_REVIEW_COMMENT_TYPE_VISITOR ),
288
-
289
- ) );
290
-
291
- $args = array(
292
- 'orderby' => 'meta_value_num',
293
- 'meta_key' => 'wp_review_review_count',
294
- 'fields' => 'ids',
295
- 'posts_per_page' => $limit,
296
- );
297
-
298
- $posts = new WP_Query( $args );
299
- if ( $posts->have_posts() ) {
300
- return $posts->posts;
301
- }
302
-
303
- return array();
304
- }
305
-
306
- function ajax_wp_review_tab_widget_content() {
307
- $tab = $_POST['tab'];
308
- $args = $_POST['args'];
309
- $page = intval($_POST['page']);
310
- if ($page < 1)
311
- $page = 1;
312
- if (!is_array($args))
313
- return '';
314
-
315
- // sanitize args
316
- $post_num = (empty($args['post_num']) ? 5 : intval($args['post_num']));
317
- if ($post_num > 20 || $post_num < 1) { // max 20 posts
318
- $post_num = 5;
319
- }
320
-
321
- $thumb_size = $args['thumb_size'];
322
- if ($thumb_size != 'small' && $thumb_size != 'large') {
323
- $thumb_size = 'small'; // default
324
- }
325
-
326
- $custom_reviews = array();
327
- if (!empty($args['custom_reviews'])) {
328
- $custom_reviews = explode(',', $args['custom_reviews']);
329
- $custom_reviews = array_map('trim', $custom_reviews);
330
- $custom_reviews = array_map('intval', $custom_reviews);
331
- }
332
-
333
- $show_date = !empty($args['show_date']);
334
- $allow_pagination = !empty($args['allow_pagination']);
335
- $review_type = '';
336
- if (in_array($args['review_type'], array('star', 'point', 'percentage'))) {
337
- $review_type = $args['review_type'];
338
- }
339
-
340
- $title_length = ! empty($args['title_length']) ? $args['title_length'] : apply_filters( 'wpt_title_length_default', '15' );
341
-
342
-
343
- switch ($tab) {
344
- case "toprated":
345
- $custom_query = array(
346
- 'ignore_sticky_posts' => 1,
347
- 'post_type' => 'any',
348
- 'posts_per_page' => $post_num,
349
- 'post_status' => 'publish',
350
- 'orderby' => 'meta_value_num',
351
- 'meta_key' => 'wp_review_total',
352
- 'order' => 'desc',
353
- 'paged' => $page
354
- );
355
- // Meta Query
356
- $custom_query['meta_query'] = array('relation' => 'AND');
357
- if (!empty($review_type)) {
358
- $custom_query['meta_query'][] = array(
359
- 'key' => 'wp_review_type',
360
- 'compare' => '=',
361
- 'value' => $review_type
362
- );
363
- } else {
364
- $custom_query['meta_query'][] = array(
365
- 'key' => 'wp_review_type',
366
- 'compare' => '!=',
367
- 'value' => ''
368
- );
369
- }
370
- break;
371
-
372
- case "mostvoted":
373
- $most_voted = $this->get_most_voted();
374
- $custom_query = array(
375
- 'ignore_sticky_posts' => 1,
376
- 'post_type' => 'any',
377
- 'posts_per_page' => $post_num,
378
- 'post_status' => 'publish',
379
- 'orderby' => 'post__in',
380
- 'post__in' => $most_voted,
381
- 'paged' => $page
382
- );
383
- // Meta Query
384
- $custom_query['meta_query'] = array('relation' => 'AND');
385
- if (!empty($review_type)) {
386
- $custom_query['meta_query'][] = array(
387
- 'key' => 'wp_review_type',
388
- 'compare' => '=',
389
- 'value' => $review_type
390
- );
391
- } else {
392
- $custom_query['meta_query'][] = array(
393
- 'key' => 'wp_review_type',
394
- 'compare' => '!=',
395
- 'value' => ''
396
- );
397
- }
398
- break;
399
-
400
- case "custom":
401
- $custom_query = array(
402
- 'ignore_sticky_posts' => 1,
403
- 'post_type' => 'any',
404
- 'posts_per_page' => $post_num,
405
- 'post_status' => 'publish',
406
- 'orderby' => 'post__in',
407
- 'post__in' => $custom_reviews,
408
- 'paged' => $page
409
- );
410
- break;
411
-
412
- case "recent":
413
- default:
414
- $custom_query = array(
415
- 'ignore_sticky_posts' => 1,
416
- 'post_type' => 'any',
417
- 'posts_per_page' => $post_num,
418
- 'post_status' => 'publish',
419
- 'orderby' => 'date',
420
- 'order' => 'desc',
421
- 'paged' => $page
422
- );
423
- // Meta Query
424
- $custom_query['meta_query'] = array('relation' => 'AND');
425
- if (!empty($review_type)) {
426
- $custom_query['meta_query'][] = array(
427
- 'key' => 'wp_review_type',
428
- 'compare' => '=',
429
- 'value' => $review_type
430
- );
431
- } else {
432
- $custom_query['meta_query'][] = array(
433
- 'key' => 'wp_review_type',
434
- 'compare' => '!=',
435
- 'value' => ''
436
- );
437
- }
438
- break;
439
- }
440
-
441
- ?>
442
- <ul>
443
- <?php
444
- $review_query = new WP_Query($custom_query);
445
- $last_page = $review_query->max_num_pages;
446
- while ($review_query->have_posts()) : $review_query->the_post(); ?>
447
- <li>
448
- <a title="<?php the_title(); ?>" rel="nofollow" href="<?php the_permalink() ?>">
449
- <div class="wp_review_tab_thumbnail wp_review_tab_thumb_<?php echo $thumb_size; ?>">
450
- <?php if(has_post_thumbnail()): ?>
451
- <?php the_post_thumbnail('wp_review_'.$thumb_size, array('title' => '')); ?>
452
- <?php else: ?>
453
- <img src="<?php echo WP_REVIEW_ASSETS.'images/'.$thumb_size.'thumb.png'; ?>" alt="<?php the_title(); ?>" class="wp-post-image" />
454
- <?php endif; ?>
455
- </div>
456
- </a>
457
- <div class="title-right">
458
- <div class="entry-title"><a title="<?php the_title(); ?>" href="<?php the_permalink() ?>"><?php echo $this->post_title( $title_length ); ?></div></a>
459
- <?php wp_review_show_total(true, 'review-total-only '.$thumb_size.'-thumb', null, array('in_widget' => true)); ?>
460
- <?php if ( $show_date ) : ?>
461
- <div class="wp-review-tab-postmeta">
462
- <?php the_time('M j, Y'); ?>
463
- </div> <!--end .entry-meta-->
464
- <?php endif; ?>
465
- </div>
466
- <div class="clear"></div>
467
- </li>
468
- <?php $post_num++; endwhile; wp_reset_query(); ?>
469
- </ul>
470
- <div class="clear"></div>
471
- <?php if ($allow_pagination) : ?>
472
- <?php $this->tab_pagination($page, $last_page); ?>
473
- <?php endif; ?>
474
- <?php
475
- die(); // required to return a proper result
476
- }
477
- function tab_pagination($page, $last_page) {
478
- ?>
479
- <div class="wp-review-tab-pagination">
480
- <?php if ($page > 1) : ?>
481
- <a href="#" class="previous"><span><?php _e('&laquo; Previous', 'wp-review'); ?></span></a>
482
- <?php endif; ?>
483
- <?php if ($page != $last_page) : ?>
484
- <a href="#" class="next"><span><?php _e('Next &raquo;', 'wp-review'); ?></span></a>
485
- <?php endif; ?>
486
- </div>
487
- <div class="clear"></div>
488
- <input type="hidden" class="page_num" name="page_num" value="<?php echo $page; ?>" />
489
- <?php
490
- }
491
- function post_title($limit = 15) {
492
- $limit++;
493
- $title = explode(' ', get_the_title(), $limit);
494
- if (count($title)>=$limit) {
495
- array_pop($title);
496
- $title = implode(" ",$title).'...';
497
- } else {
498
- $title = implode(" ",$title);
499
- }
500
- return $title;
501
- }
502
- function truncate($str, $length = 24) {
503
- if (mb_strlen($str) > $length) {
504
- return mb_substr($str, 0, $length).'...';
505
- } else {
506
- return $str;
507
- }
508
- }
509
- }
510
-
511
- function wpreview_register_widget() {
512
- register_widget( "wp_review_tab_widget" );
513
- }
514
- add_action( 'widgets_init', 'wpreview_register_widget' );
515
-
516
  ?>
1
+ <?php
2
+ class wp_review_tab_widget extends WP_Widget {
3
+ function __construct() {
4
+ // ajax functions
5
+ add_action('wp_ajax_wp_review_tab_widget_content', array(&$this, 'ajax_wp_review_tab_widget_content'));
6
+ add_action('wp_ajax_nopriv_wp_review_tab_widget_content', array(&$this, 'ajax_wp_review_tab_widget_content'));
7
+
8
+ // css
9
+ add_action('wp_enqueue_scripts', array(&$this, 'wp_review_tab_register_scripts'));
10
+ add_action('admin_enqueue_scripts', array(&$this, 'wp_review_tab_admin_scripts'));
11
+ add_action('customize_controls_enqueue_scripts', array(&$this, 'wp_review_tab_admin_scripts'));
12
+
13
+ $widget_ops = array('classname' => 'widget_wp_review_tab', 'description' => __('Display Reviews in tabbed format.', 'wp-review'));
14
+ $control_ops = array('width' => 200, 'height' => 350);
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 ) {
33
+ $instance = wp_parse_args( (array) $instance, array(
34
+ 'widget_title' => '',
35
+ 'tabs' => array('toprated' => 1, 'recent' => 1, 'mostvoted' => 0, 'custom' => 0),
36
+ 'tab_order' => array('toprated' => 1, 'recent' => 2, 'mostvoted' => 3, 'custom' => 4),
37
+ 'tab_titles' => array('toprated' => __('Top Rated'), 'recent' => __('Recent'), 'mostvoted' => __('Most Voted'), 'custom' => __('Editor\'s choice')),
38
+ 'allow_pagination' => 1,
39
+ 'review_type' => 'any',
40
+ 'post_num' => '5',
41
+ 'comment_num' => '5',
42
+ 'thumb_size' => 'small',
43
+ 'show_date' => 1,
44
+ 'custom_reviews' => '',
45
+ 'title_length' => apply_filters( 'wpt_title_length_default', '15' )
46
+ ));
47
+
48
+ extract($instance);
49
+ ?>
50
+ <div class="wp_review_tab_options_form">
51
+
52
+ <p>
53
+ <label for="<?php echo $this->get_field_id( 'widget_title' ); ?>"><?php _e( 'Title:','mythemeshop' ); ?></label>
54
+ <input class="widefat" id="<?php echo $this->get_field_id( 'widget_title' ); ?>" name="<?php echo $this->get_field_name( 'widget_title' ); ?>" type="text" value="<?php echo esc_attr( $widget_title ); ?>" />
55
+ </p>
56
+
57
+ <h4><?php _e('Select Tabs', 'wp-review'); ?></h4>
58
+
59
+ <div class="wp_review_tab_select_tabs">
60
+ <label class="alignleft" style="display: block; width: 50%; margin-bottom: 7px;" for="<?php echo $this->get_field_id("tabs"); ?>_toprated">
61
+ <input type="checkbox" class="checkbox wp_review_tab_enable_toprated" id="<?php echo $this->get_field_id("tabs"); ?>_toprated" name="<?php echo $this->get_field_name("tabs"); ?>[toprated]" value="1" <?php if (isset($tabs['toprated'])) { checked( 1, $tabs['toprated'], true ); } ?> />
62
+ <?php _e( 'Top Rated', 'wp-review'); ?>
63
+ </label>
64
+ <label class="alignleft" style="display: block; width: 50%; margin-bottom: 7px;" for="<?php echo $this->get_field_id("tabs"); ?>_recent">
65
+ <input type="checkbox" class="checkbox wp_review_tab_enable_recent" id="<?php echo $this->get_field_id("tabs"); ?>_recent" name="<?php echo $this->get_field_name("tabs"); ?>[recent]" value="1" <?php if (isset($tabs['recent'])) { checked( 1, $tabs['recent'], true ); } ?> />
66
+ <?php _e( 'Recent', 'wp-review'); ?>
67
+ </label>
68
+ <label class="alignleft" style="display: block; width: 50%;" for="<?php echo $this->get_field_id("tabs"); ?>_mostvoted">
69
+ <input type="checkbox" class="checkbox wp_review_tab_enable_mostvoted" id="<?php echo $this->get_field_id("tabs"); ?>_mostvoted" name="<?php echo $this->get_field_name("tabs"); ?>[mostvoted]" value="1" <?php if (isset($tabs['mostvoted'])) { checked( 1, $tabs['mostvoted'], true ); } ?> />
70
+ <?php _e( 'Most Voted', 'wp-review'); ?>
71
+ </label>
72
+ <label class="alignleft" style="display: block; width: 50%;" for="<?php echo $this->get_field_id("tabs"); ?>_custom">
73
+ <input type="checkbox" class="checkbox wp_review_tab_enable_custom" id="<?php echo $this->get_field_id("tabs"); ?>_custom" name="<?php echo $this->get_field_name("tabs"); ?>[custom]" value="1" <?php if (isset($tabs['custom'])) { checked( 1, $tabs['custom'], true ); } ?> />
74
+ <?php _e( 'Custom', 'wp-review'); ?>
75
+ </label>
76
+ </div>
77
+ <div class="clear"></div>
78
+
79
+ <div class="wp_review_tab_advanced_options">
80
+
81
+ <p class="wp_review_tab_review_type">
82
+ <label for="<?php echo $this->get_field_id('review_type'); ?>"><?php _e('Review type:', 'wp-review'); ?></label>
83
+ <select id="<?php echo $this->get_field_id('review_type'); ?>" name="<?php echo $this->get_field_name('review_type'); ?>" style="margin-left: 12px;">
84
+ <option value="any" <?php selected($review_type, 'any', true); ?>><?php _e('Any', 'wp-review'); ?></option>
85
+ <option value="star" <?php selected($review_type, 'star', true); ?>><?php _e('Star', 'wp-review'); ?></option>
86
+ <option value="point" <?php selected($review_type, 'point', true); ?>><?php _e('Point', 'wp-review'); ?></option>
87
+ <option value="percentage" <?php selected($review_type, 'percentage', true); ?>><?php _e('Percentage', 'wp-review'); ?></option>
88
+ </select>
89
+ </p>
90
+
91
+ <p>
92
+ <label for="<?php echo $this->get_field_id("allow_pagination"); ?>">
93
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("allow_pagination"); ?>" name="<?php echo $this->get_field_name("allow_pagination"); ?>" value="1" <?php if (isset($allow_pagination)) { checked( 1, $allow_pagination, true ); } ?> />
94
+ <?php _e( 'Allow pagination', 'wp-review'); ?>
95
+ </label>
96
+ </p>
97
+
98
+ <p>
99
+ <label for="<?php echo $this->get_field_id('post_num'); ?>"><?php _e('Number of reviews to show:', 'wp-review'); ?>
100
+ <br />
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
+ <!-- dummy input so that WP doesn't pick up title_length as title -->
109
+ <input id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="" style="display: none;" />
110
+ <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; ?>" />
111
+ </label>
112
+ </p>
113
+
114
+ <p class="wp_review_tab_thumbnail_size">
115
+ <label for="<?php echo $this->get_field_id('thumb_size'); ?>"><?php _e('Thumbnail size:', 'wp-review'); ?></label>
116
+ <select id="<?php echo $this->get_field_id('thumb_size'); ?>" name="<?php echo $this->get_field_name('thumb_size'); ?>" style="margin-left: 12px;">
117
+ <option value="small" <?php selected($thumb_size, 'small', true); ?>><?php _e('Small', 'wp-review'); ?></option>
118
+ <option value="large" <?php selected($thumb_size, 'large', true); ?>><?php _e('Large', 'wp-review'); ?></option>
119
+ </select>
120
+ </p>
121
+
122
+ <p>
123
+ <label for="<?php echo $this->get_field_id("show_date"); ?>">
124
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("show_date"); ?>" name="<?php echo $this->get_field_name("show_date"); ?>" value="1" <?php if (isset($show_date)) { checked( 1, $show_date, true ); } ?> />
125
+ <?php _e( 'Show date', 'wp-review'); ?>
126
+ </label>
127
+ </p>
128
+
129
+ <p class="wp_review_tab_custom_reviews"<?php echo (empty($tabs['custom']) ? ' style="display: none;"' : ''); ?>>
130
+ <label for="<?php echo $this->get_field_id('custom_reviews'); ?>"><?php _e('Reviews on Custom tab:', 'wp-review'); ?>
131
+ <br />
132
+ <input id="<?php echo $this->get_field_id('custom_reviews'); ?>" name="<?php echo $this->get_field_name('custom_reviews'); ?>" type="text" value="<?php echo $custom_reviews; ?>" />
133
+ <br />
134
+ <span style="color: #999;">Add IDs, separated by commas, eg. <em>145, 168, 229</em></span>
135
+ </label>
136
+ </p>
137
+
138
+ <div class="clear"></div>
139
+
140
+ <h4><a href="#" class="wp_review_tab_titles_header"><?php _e('Tab Titles', 'wp-review'); ?></a> | <a href="#" class="wp_review_tab_order_header"><?php _e('Tab Order', 'wp-review'); ?></a></h4>
141
+
142
+ <div class="wp_review_tab_order" style="display: none;">
143
+
144
+ <label class="alignleft wp_review_tab_toprated_order" for="<?php echo $this->get_field_id('tab_order'); ?>_toprated" style="width: 50%;<?php echo (empty($tabs['toprated']) ? ' display: none;' : ''); ?>">
145
+ <input id="<?php echo $this->get_field_id('tab_order'); ?>_toprated" name="<?php echo $this->get_field_name('tab_order'); ?>[toprated]" type="number" min="1" step="1" value="<?php echo $tab_order['toprated']; ?>" style="width: 48px;" />
146
+ <?php _e('Top Rated', 'wp-review'); ?>
147
+ </label>
148
+ <label class="alignleft wp_review_tab_recent_order" for="<?php echo $this->get_field_id('tab_order'); ?>_recent" style="width: 50%;<?php echo (empty($tabs['recent']) ? ' display: none;' : ''); ?>">
149
+ <input id="<?php echo $this->get_field_id('tab_order'); ?>_recent" name="<?php echo $this->get_field_name('tab_order'); ?>[recent]" type="number" min="1" step="1" value="<?php echo $tab_order['recent']; ?>" style="width: 48px;" />
150
+ <?php _e('Recent', 'wp-review'); ?>
151
+ </label>
152
+ <label class="alignleft wp_review_tab_mostvoted_order" for="<?php echo $this->get_field_id('tab_order'); ?>_mostvoted" style="width: 50%;<?php echo (empty($tabs['mostvoted']) ? ' display: none;' : ''); ?>">
153
+ <input id="<?php echo $this->get_field_id('tab_order'); ?>_mostvoted" name="<?php echo $this->get_field_name('tab_order'); ?>[mostvoted]" type="number" min="1" step="1" value="<?php echo $tab_order['mostvoted']; ?>" style="width: 48px;" />
154
+ <?php _e('Most Voted', 'wp-review'); ?>
155
+ </label>
156
+ <label class="alignleft wp_review_tab_custom_order" for="<?php echo $this->get_field_id('tab_order'); ?>_custom" style="width: 50%;<?php echo (empty($tabs['custom']) ? ' display: none;' : ''); ?>">
157
+ <input id="<?php echo $this->get_field_id('tab_order'); ?>_custom" name="<?php echo $this->get_field_name('tab_order'); ?>[custom]" type="number" min="1" step="1" value="<?php echo $tab_order['custom']; ?>" style="width: 48px;" />
158
+ <?php _e('Custom', 'wp-review'); ?>
159
+ </label>
160
+ </div>
161
+ <div class="clear" style="margin-bottom: 15px;"></div>
162
+
163
+ <div class="wp_review_tab_titles" style="display: none;">
164
+
165
+ <label class="alignleft wp_review_tab_toprated_title" for="<?php echo $this->get_field_id('tab_titles'); ?>_toprated" style="width: 50%;<?php echo (empty($tabs['toprated']) ? ' display: none;' : ''); ?>">
166
+ <?php _e('Top Rated', 'wp-review'); ?>
167
+ <input id="<?php echo $this->get_field_id('tab_titles'); ?>_toprated" name="<?php echo $this->get_field_name('tab_titles'); ?>[toprated]" type="text" value="<?php echo esc_attr($tab_titles['toprated']); ?>" style="width: 98%;" />
168
+ </label>
169
+ <label class="alignleft wp_review_tab_recent_title" for="<?php echo $this->get_field_id('tab_titles'); ?>_recent" style="width: 50%;<?php echo (empty($tabs['recent']) ? ' display: none;' : ''); ?>">
170
+ <?php _e('Recent', 'wp-review'); ?>
171
+ <input id="<?php echo $this->get_field_id('tab_titles'); ?>_recent" name="<?php echo $this->get_field_name('tab_titles'); ?>[recent]" type="text" value="<?php echo esc_attr($tab_titles['recent']); ?>" style="width: 98%;" />
172
+ </label>
173
+ <label class="alignleft wp_review_tab_mostvoted_title" for="<?php echo $this->get_field_id('tab_titles'); ?>_mostvoted" style="width: 50%;<?php echo (empty($tabs['mostvoted']) ? ' display: none;' : ''); ?>">
174
+ <?php _e('Most Voted', 'wp-review'); ?>
175
+ <input id="<?php echo $this->get_field_id('tab_titles'); ?>_mostvoted" name="<?php echo $this->get_field_name('tab_titles'); ?>[mostvoted]" type="text" value="<?php echo esc_attr($tab_titles['mostvoted']); ?>" style="width: 98%;" />
176
+ </label>
177
+ <label class="alignleft wp_review_tab_custom_title" for="<?php echo $this->get_field_id('tab_titles'); ?>_custom" style="width: 50%;<?php echo (empty($tabs['custom']) ? ' display: none;' : ''); ?>">
178
+ <?php _e('Custom', 'wp-review'); ?>
179
+ <input id="<?php echo $this->get_field_id('tab_titles'); ?>_custom" name="<?php echo $this->get_field_name('tab_titles'); ?>[custom]" type="text" value="<?php echo esc_attr($tab_titles['custom']); ?>" style="width: 98%;" />
180
+ </label>
181
+ </div>
182
+ <div class="clear" style="margin-bottom: 15px;"></div>
183
+
184
+ </div><!-- .wp_review_tab_advanced_options -->
185
+ </div><!-- .wp_review_tab_options_form -->
186
+ <?php
187
+ }
188
+
189
+ function update( $new_instance, $old_instance ) {
190
+ $instance = $old_instance;
191
+ $instance['widget_title'] = strip_tags( $new_instance['widget_title'] );
192
+ $instance['tabs'] = $new_instance['tabs'];
193
+ $instance['tab_order'] = $new_instance['tab_order'];
194
+ $instance['tab_titles'] = wp_kses_post($new_instance['tab_titles']);
195
+ $instance['review_type'] = $new_instance['review_type'];
196
+ $instance['allow_pagination'] = $new_instance['allow_pagination'];
197
+ $instance['post_num'] = $new_instance['post_num'];
198
+ $instance['title_length'] = $new_instance['title_length'];
199
+ $instance['thumb_size'] = $new_instance['thumb_size'];
200
+ $instance['show_date'] = $new_instance['show_date'];
201
+ $instance['custom_reviews'] = $new_instance['custom_reviews'];
202
+
203
+ return $instance;
204
+ }
205
+ function widget( $args, $instance ) {
206
+ extract($args, EXTR_SKIP);
207
+ extract($instance, EXTR_SKIP);
208
+ $widget_title = apply_filters( 'widget_title', $widget_title );
209
+ wp_enqueue_script( 'wp_review_tab_widget' );
210
+ wp_enqueue_script( 'wp_review-js' );
211
+ wp_enqueue_style( 'wp_review-style' );
212
+ wp_enqueue_style( 'wp_review_tab_widget' );
213
+ wp_localize_script( 'wp_review-js', 'wpreview', array(
214
+ 'ajaxurl' => admin_url('admin-ajax.php')
215
+ ) );
216
+ if (empty($tabs)) $tabs = array('recent' => 1, 'toprated' => 1);
217
+ $tabs_count = count($tabs);
218
+ if ($tabs_count <= 1) {
219
+ $tabs_count = 1;
220
+ } elseif($tabs_count > 3) {
221
+ $tabs_count = 4;
222
+ }
223
+
224
+ $available_tabs = array(
225
+ 'toprated' => $tab_titles['toprated'],
226
+ 'recent' => $tab_titles['recent'],
227
+ 'mostvoted' => $tab_titles['mostvoted'],
228
+ 'custom' => $tab_titles['custom']
229
+ );
230
+
231
+ array_multisort($tab_order, $available_tabs);
232
+
233
+ ?>
234
+ <?php echo $before_widget;
235
+ if ( ! empty( $widget_title ) ) echo $before_title . $widget_title . $after_title; ?>
236
+ <div class="wp_review_tab_widget_content" id="<?php echo $widget_id; ?>_content">
237
+ <ul class="wp-review-tabs <?php echo "has-$tabs_count-"; ?>tabs">
238
+ <?php foreach ($available_tabs as $tab => $label) : ?>
239
+ <?php if (!empty($tabs[$tab])): ?>
240
+ <li class="tab_title"><a href="#" id="<?php echo $tab; ?>-tab"><?php echo $label; ?></a></li>
241
+ <?php endif; ?>
242
+ <?php endforeach; ?>
243
+ </ul> <!--end .tabs-->
244
+ <div class="clear"></div>
245
+ <div class="inside">
246
+ <?php if (!empty($tabs['toprated'])): ?>
247
+ <div id="toprated-tab-content" class="tab-content">
248
+ </div> <!--end #toprated-tab-content-->
249
+ <?php endif; ?>
250
+ <?php if (!empty($tabs['recent'])): ?>
251
+ <div id="recent-tab-content" class="tab-content">
252
+ </div> <!--end #recent-tab-content-->
253
+ <?php endif; ?>
254
+ <?php if (!empty($tabs['mostvoted'])): ?>
255
+ <div id="mostvoted-tab-content" class="tab-content">
256
+ <ul>
257
+ </ul>
258
+ </div> <!--end #mostvoted-tab-content-->
259
+ <?php endif; ?>
260
+ <?php if (!empty($tabs['custom'])): ?>
261
+ <div id="custom-tab-content" class="tab-content">
262
+ <ul>
263
+ </ul>
264
+ </div> <!--end #custom-tab-content-->
265
+ <?php endif; ?>
266
+ <div class="clear"></div>
267
+ </div> <!--end .inside -->
268
+ <div class="clear"></div>
269
+ </div><!--end #tabber -->
270
+ <?php
271
+ // inline script
272
+ // to support multiple instances per page with different settings
273
+
274
+ unset($instance['tabs'], $instance['tab_order'], $instance['tab_titles']); // unset unneeded
275
+ ?>
276
+ <script type="text/javascript">
277
+ jQuery(function($) {
278
+ $('#<?php echo $widget_id; ?>_content').data('args', <?php echo wp_json_encode($instance); ?>);
279
+ });
280
+ </script>
281
+ <?php echo $after_widget; ?>
282
+ <?php
283
+ }
284
+
285
+ function get_most_voted($limit = 20){
286
+ $comments = get_comments( array(
287
+ 'type__in' => array( WP_REVIEW_COMMENT_TYPE_VISITOR ),
288
+
289
+ ) );
290
+
291
+ $args = array(
292
+ 'orderby' => 'meta_value_num',
293
+ 'meta_key' => 'wp_review_review_count',
294
+ 'fields' => 'ids',
295
+ 'posts_per_page' => $limit,
296
+ );
297
+
298
+ $posts = new WP_Query( $args );
299
+ if ( $posts->have_posts() ) {
300
+ return $posts->posts;
301
+ }
302
+
303
+ return array();
304
+ }
305
+
306
+ function ajax_wp_review_tab_widget_content() {
307
+ $tab = $_POST['tab'];
308
+ $args = $_POST['args'];
309
+ $page = intval($_POST['page']);
310
+ if ($page < 1)
311
+ $page = 1;
312
+ if (!is_array($args))
313
+ return '';
314
+
315
+ // sanitize args
316
+ $post_num = (empty($args['post_num']) ? 5 : intval($args['post_num']));
317
+ if ($post_num > 20 || $post_num < 1) { // max 20 posts
318
+ $post_num = 5;
319
+ }
320
+
321
+ $thumb_size = $args['thumb_size'];
322
+ if ($thumb_size != 'small' && $thumb_size != 'large') {
323
+ $thumb_size = 'small'; // default
324
+ }
325
+
326
+ $custom_reviews = array();
327
+ if (!empty($args['custom_reviews'])) {
328
+ $custom_reviews = explode(',', $args['custom_reviews']);
329
+ $custom_reviews = array_map('trim', $custom_reviews);
330
+ $custom_reviews = array_map('intval', $custom_reviews);
331
+ }
332
+
333
+ $show_date = !empty($args['show_date']);
334
+ $allow_pagination = !empty($args['allow_pagination']);
335
+ $review_type = '';
336
+ if (in_array($args['review_type'], array('star', 'point', 'percentage'))) {
337
+ $review_type = $args['review_type'];
338
+ }
339
+
340
+ $title_length = ! empty($args['title_length']) ? $args['title_length'] : apply_filters( 'wpt_title_length_default', '15' );
341
+
342
+
343
+ switch ($tab) {
344
+ case "toprated":
345
+ $custom_query = array(
346
+ 'ignore_sticky_posts' => 1,
347
+ 'post_type' => 'any',
348
+ 'posts_per_page' => $post_num,
349
+ 'post_status' => 'publish',
350
+ 'orderby' => 'meta_value_num',
351
+ 'meta_key' => 'wp_review_total',
352
+ 'order' => 'desc',
353
+ 'paged' => $page
354
+ );
355
+ // Meta Query
356
+ $custom_query['meta_query'] = array('relation' => 'AND');
357
+ if (!empty($review_type)) {
358
+ $custom_query['meta_query'][] = array(
359
+ 'key' => 'wp_review_type',
360
+ 'compare' => '=',
361
+ 'value' => $review_type
362
+ );
363
+ } else {
364
+ $custom_query['meta_query'][] = array(
365
+ 'key' => 'wp_review_type',
366
+ 'compare' => '!=',
367
+ 'value' => ''
368
+ );
369
+ }
370
+ break;
371
+
372
+ case "mostvoted":
373
+ $most_voted = $this->get_most_voted();
374
+ $custom_query = array(
375
+ 'ignore_sticky_posts' => 1,
376
+ 'post_type' => 'any',
377
+ 'posts_per_page' => $post_num,
378
+ 'post_status' => 'publish',
379
+ 'orderby' => 'post__in',
380
+ 'post__in' => $most_voted,
381
+ 'paged' => $page
382
+ );
383
+ // Meta Query
384
+ $custom_query['meta_query'] = array('relation' => 'AND');
385
+ if (!empty($review_type)) {
386
+ $custom_query['meta_query'][] = array(
387
+ 'key' => 'wp_review_type',
388
+ 'compare' => '=',
389
+ 'value' => $review_type
390
+ );
391
+ } else {
392
+ $custom_query['meta_query'][] = array(
393
+ 'key' => 'wp_review_type',
394
+ 'compare' => '!=',
395
+ 'value' => ''
396
+ );
397
+ }
398
+ break;
399
+
400
+ case "custom":
401
+ $custom_query = array(
402
+ 'ignore_sticky_posts' => 1,
403
+ 'post_type' => 'any',
404
+ 'posts_per_page' => $post_num,
405
+ 'post_status' => 'publish',
406
+ 'orderby' => 'post__in',
407
+ 'post__in' => $custom_reviews,
408
+ 'paged' => $page
409
+ );
410
+ break;
411
+
412
+ case "recent":
413
+ default:
414
+ $custom_query = array(
415
+ 'ignore_sticky_posts' => 1,
416
+ 'post_type' => 'any',
417
+ 'posts_per_page' => $post_num,
418
+ 'post_status' => 'publish',
419
+ 'orderby' => 'date',
420
+ 'order' => 'desc',
421
+ 'paged' => $page
422
+ );
423
+ // Meta Query
424
+ $custom_query['meta_query'] = array('relation' => 'AND');
425
+ if (!empty($review_type)) {
426
+ $custom_query['meta_query'][] = array(
427
+ 'key' => 'wp_review_type',
428
+ 'compare' => '=',
429
+ 'value' => $review_type
430
+ );
431
+ } else {
432
+ $custom_query['meta_query'][] = array(
433
+ 'key' => 'wp_review_type',
434
+ 'compare' => '!=',
435
+ 'value' => ''
436
+ );
437
+ }
438
+ break;
439
+ }
440
+
441
+ ?>
442
+ <ul>
443
+ <?php
444
+ $review_query = new WP_Query($custom_query);
445
+ $last_page = $review_query->max_num_pages;
446
+ while ($review_query->have_posts()) : $review_query->the_post(); ?>
447
+ <li>
448
+ <a title="<?php the_title(); ?>" rel="nofollow" href="<?php the_permalink() ?>">
449
+ <div class="wp_review_tab_thumbnail wp_review_tab_thumb_<?php echo $thumb_size; ?>">
450
+ <?php if(has_post_thumbnail()): ?>
451
+ <?php the_post_thumbnail('wp_review_'.$thumb_size, array('title' => '')); ?>
452
+ <?php else: ?>
453
+ <img src="<?php echo WP_REVIEW_ASSETS.'images/'.$thumb_size.'thumb.png'; ?>" alt="<?php the_title(); ?>" class="wp-post-image" />
454
+ <?php endif; ?>
455
+ </div>
456
+ </a>
457
+ <div class="title-right">
458
+ <div class="entry-title"><a title="<?php the_title(); ?>" href="<?php the_permalink() ?>"><?php echo $this->post_title( $title_length ); ?></div></a>
459
+ <?php wp_review_show_total(true, 'review-total-only '.$thumb_size.'-thumb', null, array('in_widget' => true)); ?>
460
+ <?php if ( $show_date ) : ?>
461
+ <div class="wp-review-tab-postmeta">
462
+ <?php the_time('M j, Y'); ?>
463
+ </div> <!--end .entry-meta-->
464
+ <?php endif; ?>
465
+ </div>
466
+ <div class="clear"></div>
467
+ </li>
468
+ <?php $post_num++; endwhile; wp_reset_query(); ?>
469
+ </ul>
470
+ <div class="clear"></div>
471
+ <?php if ($allow_pagination) : ?>
472
+ <?php $this->tab_pagination($page, $last_page); ?>
473
+ <?php endif; ?>
474
+ <?php
475
+ die(); // required to return a proper result
476
+ }
477
+ function tab_pagination($page, $last_page) {
478
+ ?>
479
+ <div class="wp-review-tab-pagination">
480
+ <?php if ($page > 1) : ?>
481
+ <a href="#" class="previous"><span><?php _e('&laquo; Previous', 'wp-review'); ?></span></a>
482
+ <?php endif; ?>
483
+ <?php if ($page != $last_page) : ?>
484
+ <a href="#" class="next"><span><?php _e('Next &raquo;', 'wp-review'); ?></span></a>
485
+ <?php endif; ?>
486
+ </div>
487
+ <div class="clear"></div>
488
+ <input type="hidden" class="page_num" name="page_num" value="<?php echo $page; ?>" />
489
+ <?php
490
+ }
491
+ function post_title($limit = 15) {
492
+ $limit++;
493
+ $title = explode(' ', get_the_title(), $limit);
494
+ if (count($title)>=$limit) {
495
+ array_pop($title);
496
+ $title = implode(" ",$title).'...';
497
+ } else {
498
+ $title = implode(" ",$title);
499
+ }
500
+ return $title;
501
+ }
502
+ function truncate($str, $length = 24) {
503
+ if (mb_strlen($str) > $length) {
504
+ return mb_substr($str, 0, $length).'...';
505
+ } else {
506
+ return $str;
507
+ }
508
+ }
509
+ }
510
+
511
+ function wpreview_register_widget() {
512
+ register_widget( "wp_review_tab_widget" );
513
+ }
514
+ add_action( 'widgets_init', 'wpreview_register_widget' );
515
+
516
  ?>
languages/default.mo CHANGED
File without changes
languages/default.po CHANGED
@@ -1,716 +1,716 @@
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"
10
- "MIME-Version: 1.0\n"
11
- "Content-Type: text/plain; charset=UTF-8\n"
12
- "Content-Transfer-Encoding: 8bit\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
-
23
- #: ../admin/metaboxes.php:39
24
- msgid "Review Item"
25
- msgstr ""
26
-
27
- #: ../admin/metaboxes.php:48
28
- msgid "Review Links"
29
- msgstr ""
30
-
31
- #: ../admin/metaboxes.php:57
32
- msgid "Review Description"
33
- msgstr ""
34
-
35
- #: ../admin/metaboxes.php:66
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
608
- msgid "Display Reviews in tabbed format."
609
- msgstr ""
610
-
611
- #: ../includes/widget.php:15
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 ""
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"
10
+ "MIME-Version: 1.0\n"
11
+ "Content-Type: text/plain; charset=UTF-8\n"
12
+ "Content-Transfer-Encoding: 8bit\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
+
23
+ #: ../admin/metaboxes.php:39
24
+ msgid "Review Item"
25
+ msgstr ""
26
+
27
+ #: ../admin/metaboxes.php:48
28
+ msgid "Review Links"
29
+ msgstr ""
30
+
31
+ #: ../admin/metaboxes.php:57
32
+ msgid "Review Description"
33
+ msgstr ""
34
+
35
+ #: ../admin/metaboxes.php:66
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
608
+ msgid "Display Reviews in tabbed format."
609
+ msgstr ""
610
+
611
+ #: ../includes/widget.php:15
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 CHANGED
@@ -1,54 +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
  });
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 CHANGED
@@ -1,34 +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>
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 CHANGED
@@ -1,26 +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 -->
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 CHANGED
@@ -1,56 +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
  });
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 CHANGED
@@ -1,32 +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>
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 CHANGED
@@ -1,26 +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 -->
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 CHANGED
@@ -1,13 +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
  });
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 CHANGED
@@ -1,54 +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;
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 CHANGED
@@ -1,34 +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 -->
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
@@ -1,283 +1,286 @@
1
- === WP Review ===
2
- Contributors: mythemeshop
3
- 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: 4.0
6
- Tested up to: 4.9.5
7
- Stable tag: 4.0.12
8
- License: GPLv2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
-
11
- Create reviews! Choose from Stars, Percentages or Points for review scores. Supports Retina Display, WPMU & Unlimited Color Schemes.
12
-
13
- == Description ==
14
- [youtube https://www.youtube.com/watch?v=IvJUHKNYAMc]
15
-
16
- = Complete Setup Tutorial =
17
- [youtube https://www.youtube.com/watch?v=NzMe-QY_WZY]
18
-
19
- Did you always want to increase the user interaction on your website by rating products/services/anything? We at <a rel="nofollow" href="http://mythemeshop.com/">MyThemeShop</a> understand your need, & created a premium Review plugin. We are now distributing it for FREE to give back to the WordPress community. We have been given so much by the WordPress community, it's time to give back.
20
-
21
- **WP Review plugin** is an easy yet powerful way to review content easily, without affecting the speed of your site. If you're a blogger, you probably occasionally review or rank products, services, tools, recipes, or other content on your site. <a rel="nofollow" href="https://mythemeshop.com/plugins/wp-review/">WP Review plugin</a> is a customizable and lightweight way to create reviews, using stars, percentage or point rating, and it includes support for translation, WPMU, Google rich snippets and unlimited colors. Just install it and follow the simple configuration instructions to place it in your desired location.
22
-
23
- Check the live demos of different Review types offered
24
- * <a rel="nofollow" href="http://demo.mythemeshop.com/point/fatebuntur-stoici-haec-omnia-dicta-esse-praeclare/"><strong>Star Review</strong></a>
25
- * <a rel="nofollow" href="http://demo.mythemeshop.com/point/modo-etiam-paulum-ad-dexteram-de-via-declinavi/"><strong>Point Review</strong></a>
26
- * <a rel="nofollow" href="http://demo.mythemeshop.com/point/sed-nonne-merninisti-licere-mihi-ista-probare/"><strong>Percentage Review</strong></a>
27
-
28
- You can also check <a rel="nfollow" href="https://mythemeshop.com/plugins/wp-review-pro/">WP Review Pro</a> which is one of the best <a rel="nofollow" href="https://mythemeshop.com/plugins/">Premium WordPress Plugins</a> for creating extraordinary reviews on your <a rel="nofollow" href="https://mythemeshop.com/blog/">WordPress blog</a> and website.
29
-
30
- = Why WP Review from <a rel="nofollow" href="http://mythemeshop.com/">MyThemeShop</a>: =
31
- * Fastest review plugin.
32
- * Stars, percentage and point rating system.
33
- * Supports Google Rich Snippets(schema.org)
34
- * 100% Fluid Responsive.
35
- * Option to set Global Position.
36
- * Option to change Global Colors.
37
- * Option to change individual review Colors and Positions.
38
- * Included tabbed widget to show recent reviews and popular reviews.
39
- * WP Multisite and Multiuser (WPMU / WPMS / WordPress MU) compatible.
40
- * Design it as you want, unlimited color options.
41
- * Easily use it in both Free and <a rel="nofollow" href="https://mythemeshop.com/themes/">Premium WordPress Themes.
42
- * Translation Ready.
43
- * Reviews are displayed to visitors in a friendly format.
44
- * Completely customizable, including which fields to ask for, require, and show.
45
- * Minimal design but could be instantly made modern.
46
- * Works with caching plugins and all majority of themes.
47
- * Easy to modify the CSS to better fit your theme style.
48
- * Support for adding your own custom fields.
49
- * Minimalist, lightweight, and efficient code means that your users wonít notice any hiccups.
50
- * Position it above or below the content with ease and no coding.
51
- * Supports Shortcode [wp-review] to show review anywhere in post.
52
- * Developer friendly - Useful filters are included! So you can use it in your themes.
53
-
54
- = Support =
55
- All support for this plugin is provided through our forums. If you have not registered yet, you can do so for FREE by <a rel="nofollow" href="https://mythemeshop.com/#signup">**signing up**</a> on our website.
56
-
57
- You can also check our <a rel="nofollow" href="https://mythemeshop.com/wordpress-101/">WordPress Training videos</a>
58
-
59
- If you still feel stuck, please feel free to open a new thread on our <a rel="nofollow" href="https://community.mythemeshop.com/forum/11-free-plugin-support/">Support Forum</a>. A member of our support team will be happy to help.
60
-
61
- = Developer Zone =
62
- Yes, this plugin is so developer friendly, so you could use it with any theme you develop. Define default CSS, custom position, one line integration in your theme's code.
63
-
64
- Show average review in your theme using below function:
65
- `<?php if (function_exists('wp_review_show_total')) wp_review_show_total(); ?>`
66
-
67
- You can find full list of the available filters here https://github.com/MyThemeShopTeam/WP-Review/blob/master/filter-list.php
68
-
69
- GitHub link: https://github.com/MyThemeShopTeam/WP-Review/
70
-
71
- You can also use the WP Review plugin for creating product reviews and pair it up with a <a rel="nofollow" href="https://mythemeshop.com/theme-category/wordpress-ecommerce-themes/">WordPress Ecommerce Theme</a> to increase the trust of new users on your website.
72
-
73
-
74
- = Feedback =
75
- If you like this plugin, then please consider leaving us a good rating and a review feedback</a>.
76
- If would like, you can follow us on <a rel="nofollow" href="https://plus.google.com/+Mythemeshop/">Google+</a>, <a rel="nofollow" href="https://twitter.com/MyThemeShopTeam">Twitter</a>, and <a rel="nofollow" href="https://www.facebook.com/MyThemeShop">Facebook</a>
77
-
78
- == Installation ==
79
-
80
- This section describes how to install the plugin and get it working.
81
-
82
- 1. Upload the `wp-review` folder to the to the `/wp-content/plugins/` directory
83
- 2. Activate the plugin through the 'Plugins' menu in WordPress
84
- 3. You can see rating options on single post editor.
85
- 4. Configure the available rating options as you want.
86
-
87
- == Frequently Asked Questions ==
88
-
89
- = User rating not working =
90
-
91
- Please disable all plugins and check if rating is working properly. Then you can enable all plugins one by one to find out which plugin is conflicting with WP Rating plugin.
92
-
93
- == Screenshots ==
94
-
95
- 1. Options Panel
96
- 2. Plugin Options
97
- 3. Plugin Options 2
98
- 4. Review Widget
99
- 5. Star Review type
100
- 6. Point Review type
101
- 7. Percentage Review type
102
-
103
- == Changelog ==
104
-
105
- = v4.0.12 (Apr 21, 2018) =
106
- * Fixed PHP warnings and errors
107
- * Improved code and PHP 7.2 compatibility
108
-
109
- = v4.0.11 (Dec 11, 2017) =
110
- * Prevent review-related post fields from getting added when the post has no review
111
-
112
- = v4.0.10 (May 23, 2017) =
113
- * Fixed shortcode attribute-related PHP warnings
114
-
115
-
116
- = v4.0.9 (Feb 11, 2017) =
117
- * Fixed color picker issue in the Theme Customizer
118
-
119
-
120
- = v4.0.8 (Feb 7, 2017) =
121
- * Improved support for older PHP versions
122
-
123
-
124
- = v4.0.7 (Mar 26, 2016) =
125
- * Fixed widget title issue
126
-
127
-
128
- = v4.0.6 (Mar 11, 2016) =
129
- * Embedded full video tutorial
130
-
131
-
132
- = v4.0.5 (Mar 9, 2016) =
133
- * Fixed: final rating can now be entered manually again
134
- * Fixed: removed unneeded code related to circle review type
135
-
136
-
137
- = v4.0.4 (Mar 7, 2016) =
138
- * Fixed: backlink option is not enabled by default anymore. Sorry for that!
139
-
140
-
141
- = v4.0.3 (Mar 5, 2016) =
142
- * Fixed decimals issue in Point reviews
143
- * Fixed bug preventing reviews to appear on Pages
144
-
145
-
146
- = v4.0.2 (Mar 4, 2016) =
147
- * Added back missing Widget Title field
148
-
149
-
150
- = v4.0.1 (Mar 1, 2016) =
151
- * Replaced anonymous functions for compatibility with older PHP versions
152
- * Added optional backlink
153
- * Removed unneeded Review Links metabox
154
-
155
-
156
- = v4.0.0 (Mar 1, 2016) =
157
- * Huge code improvement and optimization
158
- * Choose any rating type for user reviews (user reviews were restricted to stars before)
159
- * View and edit user ratings from the WordPress dashboard
160
- * Added Drag & Drop for Review Items
161
- * Added Rating Column on 'Posts' page
162
- * For developers: Review box templates: Create custom review box templates
163
- * For developers: Rating type templates: Create custom rating types
164
- * Various bug fixes and improvements
165
- * NOTE: After updating the plugin, existing user ratings must be migrated in Settings > WP Review Pro > Migrate Ratings
166
-
167
-
168
- = v3.3.5 (Sep 17, 2015) =
169
- * Fixed spelling mistake in notification
170
-
171
-
172
- = v3.3.4 (Sep 17, 2015) =
173
- * Fixed notification closing issue
174
-
175
-
176
- = v3.3.3 (Sep 17, 2015) =
177
- * Fixed function conflict with WP Subscribe Plugin
178
-
179
-
180
- = v3.3.2 (Sep 16, 2015) =
181
- * Switched to PHP 5 style constructor method for the widget class
182
-
183
-
184
- = v3.3.1 (May 5, 2015) =
185
- * Rating stars are showing on search engine results page
186
-
187
-
188
- = v3.3 (Mar 14, 2015) =
189
- * Fixed Google structured data testing tool errors and warnings
190
-
191
-
192
- = v3.2.9 (Feb 2, 2015) =
193
- * Fixed star rating issue on small screens.
194
-
195
-
196
- = v3.2.8 (Jan 20, 2015) =
197
- * Removed extra closing span tag in markup
198
- * Added Title option for widget
199
-
200
-
201
- = v3.2.7 (Oct 19, 2014) =
202
- * Added Title Length option for widget
203
- * Added Filter to control default title length
204
-
205
-
206
- = v3.2.6 (Oct 3, 2014) =
207
- * Added optional 'id' parameter for shortcode
208
- * Added filter to modify style output
209
-
210
-
211
- = v3.2.5 (Oct 1, 2014) =
212
- * Added loading animation in widget
213
- * Fixed minor bug in user ratings
214
-
215
-
216
- = v3.2.4 (Oct 1, 2014) =
217
- * Fixed text from review box appearing in widgets
218
- * Fixed PHP notice on reviews with only total rating and no criteria
219
-
220
-
221
- = v3.2.3 (Sept 24, 2014) =
222
- * Added version number to wp_enqueue_ functions
223
- * Added filter to remove banner from options page
224
-
225
-
226
- = v3.2.2 (Sept 12, 2014) =
227
- * Fixed Stars were not appearing in Tabbed widget.
228
-
229
-
230
- = v3.2.1 (Sept 11, 2014) =
231
- * Fixed error appearing when plugin settings weren't saved.
232
- * Fixed JS issues.
233
- * Fixed Tabbed Widget issue.
234
-
235
-
236
- = v3.2 (Sept 9, 2014) =
237
- * Added Options Panel for Global Option
238
- * Added option to set Global Colors.
239
- * Added option to Global position.
240
- * Added option to add Global Features.
241
- * Added option to change review description title (Summary).
242
- * Added option to hide Description and Total Rating.
243
- * Added option to add your own Total Score.
244
- * Fixed schema tag issue in wp_review_show_total()
245
- * Fixed jQuery issue.
246
- * Fixed post preview issue.
247
- * Fixed conflict with Redux Framework, Visual Composer and Mailpoet.
248
- * Added New Filters.
249
- * Updated No Preview thumbnail.
250
- * Merged Star and Loader icon files in one.
251
- * Fixed many small bugs.
252
- * Optimized code for better performance.
253
-
254
-
255
- = v3.1 (Mar 30, 2014) =
256
- * Fixed average star rating number issue.
257
- * Added New filter to exclude post types.
258
- * Updated filter list.
259
-
260
-
261
- = v3.0 (Mar 23, 2014) =
262
- * Major security updates
263
- * New AJAXified Tab widget for Popular and Recent reviews, try it, you gonna love it.
264
- * Language file updated fully.
265
- * Added a nonce (a security token) to ensure that the user actually voted from the review
266
- * More developer possibilities
267
- * Added filters for developers. Using a filter is much better than a function for setting the default colors.
268
- * Compatible with WordPress 3.9 Beta
269
- * Plugin will support the widget customizer coming up in WordPress 3.9
270
-
271
-
272
- = v2.0 (Mar 19, 2014) =
273
- * Fixed the, `'` switching in to `/` issue (http://bit.ly/PFMGAq)
274
- * Added `[wp-review]` shortcode to show the ratings anywhere in the content.
275
- * Added an option to not show review automatically in the Review Location dropdown.
276
- * Added support for Custom post types and pages.
277
- * For Developers Added new function for showing only total rating, it could be used in themes' archives. A custom class name can be passed to the function, for easier customization. See `wp_review_show_total()` function in includes/functions.php file. There's also a shortcode for it, just in case: [wp-review-total]
278
- * For Developers Added the default colors which appear in the meta boxes are now stored in an option. It can be modified directly with `update_option()`, or using the new `wp_review_set_default_colors()` function, which is also called on plugin activation to set the plugin's default colors.
279
- * Made small CSS and responsive improvements.
280
-
281
-
282
- = v1.0 (Feb 18, 2014) =
283
- * Official plugin release.
 
 
 
1
+ === WP Review ===
2
+ Contributors: mythemeshop
3
+ 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: 4.0
6
+ Tested up to: 4.9.6
7
+ Stable tag: 4.0.13
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Create reviews! Choose from Stars, Percentages or Points for review scores. Supports Retina Display, WPMU & Unlimited Color Schemes.
12
+
13
+ == Description ==
14
+ [youtube https://www.youtube.com/watch?v=IvJUHKNYAMc]
15
+
16
+ = Complete Setup Tutorial =
17
+ [youtube https://www.youtube.com/watch?v=NzMe-QY_WZY]
18
+
19
+ Did you always want to increase the user interaction on your website by rating products/services/anything? We at <a rel="nofollow" href="http://mythemeshop.com/">MyThemeShop</a> understand your need, & created a premium Review plugin. We are now distributing it for FREE to give back to the WordPress community. We have been given so much by the WordPress community, it's time to give back.
20
+
21
+ **WP Review plugin** is an easy yet powerful way to review content easily, without affecting the speed of your site. If you're a blogger, you probably occasionally review or rank products, services, tools, recipes, or other content on your site. <a rel="nofollow" href="https://mythemeshop.com/plugins/wp-review/">WP Review plugin</a> is a customizable and lightweight way to create reviews, using stars, percentage or point rating, and it includes support for translation, WPMU, Google rich snippets and unlimited colors. Just install it and follow the simple configuration instructions to place it in your desired location.
22
+
23
+ Check the live demos of different Review types offered
24
+ * <a rel="nofollow" href="http://demo.mythemeshop.com/point/fatebuntur-stoici-haec-omnia-dicta-esse-praeclare/"><strong>Star Review</strong></a>
25
+ * <a rel="nofollow" href="http://demo.mythemeshop.com/point/modo-etiam-paulum-ad-dexteram-de-via-declinavi/"><strong>Point Review</strong></a>
26
+ * <a rel="nofollow" href="http://demo.mythemeshop.com/point/sed-nonne-merninisti-licere-mihi-ista-probare/"><strong>Percentage Review</strong></a>
27
+
28
+ You can also check <a rel="nfollow" href="https://mythemeshop.com/plugins/wp-review-pro/">WP Review Pro</a> which is one of the best <a rel="nofollow" href="https://mythemeshop.com/plugins/">Premium WordPress Plugins</a> for creating extraordinary reviews on your <a rel="nofollow" href="https://mythemeshop.com/blog/">WordPress blog</a> and website.
29
+
30
+ = Why WP Review from <a rel="nofollow" href="http://mythemeshop.com/">MyThemeShop</a>: =
31
+ * Fastest review plugin.
32
+ * Stars, percentage and point rating system.
33
+ * Supports Google Rich Snippets(schema.org)
34
+ * 100% Fluid Responsive.
35
+ * Option to set Global Position.
36
+ * Option to change Global Colors.
37
+ * Option to change individual review Colors and Positions.
38
+ * Included tabbed widget to show recent reviews and popular reviews.
39
+ * WP Multisite and Multiuser (WPMU / WPMS / WordPress MU) compatible.
40
+ * Design it as you want, unlimited color options.
41
+ * Easily use it in both Free and <a rel="nofollow" href="https://mythemeshop.com/themes/">Premium WordPress Themes.
42
+ * Translation Ready.
43
+ * Reviews are displayed to visitors in a friendly format.
44
+ * Completely customizable, including which fields to ask for, require, and show.
45
+ * Minimal design but could be instantly made modern.
46
+ * Works with caching plugins and all majority of themes.
47
+ * Easy to modify the CSS to better fit your theme style.
48
+ * Support for adding your own custom fields.
49
+ * Minimalist, lightweight, and efficient code means that your users wonít notice any hiccups.
50
+ * Position it above or below the content with ease and no coding.
51
+ * Supports Shortcode [wp-review] to show review anywhere in post.
52
+ * Developer friendly - Useful filters are included! So you can use it in your themes.
53
+
54
+ = Support =
55
+ All support for this plugin is provided through our forums. If you have not registered yet, you can do so for FREE by <a rel="nofollow" href="https://mythemeshop.com/#signup">**signing up**</a> on our website.
56
+
57
+ You can also check our <a rel="nofollow" href="https://mythemeshop.com/wordpress-101/">WordPress Training videos</a>
58
+
59
+ If you still feel stuck, please feel free to open a new thread on our <a rel="nofollow" href="https://community.mythemeshop.com/forum/11-free-plugin-support/">Support Forum</a>. A member of our support team will be happy to help.
60
+
61
+ = Developer Zone =
62
+ Yes, this plugin is so developer friendly, so you could use it with any theme you develop. Define default CSS, custom position, one line integration in your theme's code.
63
+
64
+ Show average review in your theme using below function:
65
+ `<?php if (function_exists('wp_review_show_total')) wp_review_show_total(); ?>`
66
+
67
+ You can find full list of the available filters here https://github.com/MyThemeShopTeam/WP-Review/blob/master/filter-list.php
68
+
69
+ GitHub link: https://github.com/MyThemeShopTeam/WP-Review/
70
+
71
+ You can also use the WP Review plugin for creating product reviews and pair it up with a <a rel="nofollow" href="https://mythemeshop.com/theme-category/wordpress-ecommerce-themes/">WordPress Ecommerce Theme</a> to increase the trust of new users on your website.
72
+
73
+
74
+ = Feedback =
75
+ If you like this plugin, then please consider leaving us a good rating and a review feedback</a>.
76
+ If would like, you can follow us on <a rel="nofollow" href="https://plus.google.com/+Mythemeshop/">Google+</a>, <a rel="nofollow" href="https://twitter.com/MyThemeShopTeam">Twitter</a>, and <a rel="nofollow" href="https://www.facebook.com/MyThemeShop">Facebook</a>
77
+
78
+ == Installation ==
79
+
80
+ This section describes how to install the plugin and get it working.
81
+
82
+ 1. Upload the `wp-review` folder to the to the `/wp-content/plugins/` directory
83
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
84
+ 3. You can see rating options on single post editor.
85
+ 4. Configure the available rating options as you want.
86
+
87
+ == Frequently Asked Questions ==
88
+
89
+ = User rating not working =
90
+
91
+ Please disable all plugins and check if rating is working properly. Then you can enable all plugins one by one to find out which plugin is conflicting with WP Rating plugin.
92
+
93
+ == Screenshots ==
94
+
95
+ 1. Options Panel
96
+ 2. Plugin Options
97
+ 3. Plugin Options 2
98
+ 4. Review Widget
99
+ 5. Star Review type
100
+ 6. Point Review type
101
+ 7. Percentage Review type
102
+
103
+ == Changelog ==
104
+
105
+ = v4.0.13 (May 31, 2018) =
106
+ * Fixed disable review issue
107
+
108
+ = v4.0.12 (Apr 21, 2018) =
109
+ * Fixed PHP warnings and errors
110
+ * Improved code and PHP 7.2 compatibility
111
+
112
+ = v4.0.11 (Dec 11, 2017) =
113
+ * Prevent review-related post fields from getting added when the post has no review
114
+
115
+ = v4.0.10 (May 23, 2017) =
116
+ * Fixed shortcode attribute-related PHP warnings
117
+
118
+
119
+ = v4.0.9 (Feb 11, 2017) =
120
+ * Fixed color picker issue in the Theme Customizer
121
+
122
+
123
+ = v4.0.8 (Feb 7, 2017) =
124
+ * Improved support for older PHP versions
125
+
126
+
127
+ = v4.0.7 (Mar 26, 2016) =
128
+ * Fixed widget title issue
129
+
130
+
131
+ = v4.0.6 (Mar 11, 2016) =
132
+ * Embedded full video tutorial
133
+
134
+
135
+ = v4.0.5 (Mar 9, 2016) =
136
+ * Fixed: final rating can now be entered manually again
137
+ * Fixed: removed unneeded code related to circle review type
138
+
139
+
140
+ = v4.0.4 (Mar 7, 2016) =
141
+ * Fixed: backlink option is not enabled by default anymore. Sorry for that!
142
+
143
+
144
+ = v4.0.3 (Mar 5, 2016) =
145
+ * Fixed decimals issue in Point reviews
146
+ * Fixed bug preventing reviews to appear on Pages
147
+
148
+
149
+ = v4.0.2 (Mar 4, 2016) =
150
+ * Added back missing Widget Title field
151
+
152
+
153
+ = v4.0.1 (Mar 1, 2016) =
154
+ * Replaced anonymous functions for compatibility with older PHP versions
155
+ * Added optional backlink
156
+ * Removed unneeded Review Links metabox
157
+
158
+
159
+ = v4.0.0 (Mar 1, 2016) =
160
+ * Huge code improvement and optimization
161
+ * Choose any rating type for user reviews (user reviews were restricted to stars before)
162
+ * View and edit user ratings from the WordPress dashboard
163
+ * Added Drag & Drop for Review Items
164
+ * Added Rating Column on 'Posts' page
165
+ * For developers: Review box templates: Create custom review box templates
166
+ * For developers: Rating type templates: Create custom rating types
167
+ * Various bug fixes and improvements
168
+ * NOTE: After updating the plugin, existing user ratings must be migrated in Settings > WP Review Pro > Migrate Ratings
169
+
170
+
171
+ = v3.3.5 (Sep 17, 2015) =
172
+ * Fixed spelling mistake in notification
173
+
174
+
175
+ = v3.3.4 (Sep 17, 2015) =
176
+ * Fixed notification closing issue
177
+
178
+
179
+ = v3.3.3 (Sep 17, 2015) =
180
+ * Fixed function conflict with WP Subscribe Plugin
181
+
182
+
183
+ = v3.3.2 (Sep 16, 2015) =
184
+ * Switched to PHP 5 style constructor method for the widget class
185
+
186
+
187
+ = v3.3.1 (May 5, 2015) =
188
+ * Rating stars are showing on search engine results page
189
+
190
+
191
+ = v3.3 (Mar 14, 2015) =
192
+ * Fixed Google structured data testing tool errors and warnings
193
+
194
+
195
+ = v3.2.9 (Feb 2, 2015) =
196
+ * Fixed star rating issue on small screens.
197
+
198
+
199
+ = v3.2.8 (Jan 20, 2015) =
200
+ * Removed extra closing span tag in markup
201
+ * Added Title option for widget
202
+
203
+
204
+ = v3.2.7 (Oct 19, 2014) =
205
+ * Added Title Length option for widget
206
+ * Added Filter to control default title length
207
+
208
+
209
+ = v3.2.6 (Oct 3, 2014) =
210
+ * Added optional 'id' parameter for shortcode
211
+ * Added filter to modify style output
212
+
213
+
214
+ = v3.2.5 (Oct 1, 2014) =
215
+ * Added loading animation in widget
216
+ * Fixed minor bug in user ratings
217
+
218
+
219
+ = v3.2.4 (Oct 1, 2014) =
220
+ * Fixed text from review box appearing in widgets
221
+ * Fixed PHP notice on reviews with only total rating and no criteria
222
+
223
+
224
+ = v3.2.3 (Sept 24, 2014) =
225
+ * Added version number to wp_enqueue_ functions
226
+ * Added filter to remove banner from options page
227
+
228
+
229
+ = v3.2.2 (Sept 12, 2014) =
230
+ * Fixed Stars were not appearing in Tabbed widget.
231
+
232
+
233
+ = v3.2.1 (Sept 11, 2014) =
234
+ * Fixed error appearing when plugin settings weren't saved.
235
+ * Fixed JS issues.
236
+ * Fixed Tabbed Widget issue.
237
+
238
+
239
+ = v3.2 (Sept 9, 2014) =
240
+ * Added Options Panel for Global Option
241
+ * Added option to set Global Colors.
242
+ * Added option to Global position.
243
+ * Added option to add Global Features.
244
+ * Added option to change review description title (Summary).
245
+ * Added option to hide Description and Total Rating.
246
+ * Added option to add your own Total Score.
247
+ * Fixed schema tag issue in wp_review_show_total()
248
+ * Fixed jQuery issue.
249
+ * Fixed post preview issue.
250
+ * Fixed conflict with Redux Framework, Visual Composer and Mailpoet.
251
+ * Added New Filters.
252
+ * Updated No Preview thumbnail.
253
+ * Merged Star and Loader icon files in one.
254
+ * Fixed many small bugs.
255
+ * Optimized code for better performance.
256
+
257
+
258
+ = v3.1 (Mar 30, 2014) =
259
+ * Fixed average star rating number issue.
260
+ * Added New filter to exclude post types.
261
+ * Updated filter list.
262
+
263
+
264
+ = v3.0 (Mar 23, 2014) =
265
+ * Major security updates
266
+ * New AJAXified Tab widget for Popular and Recent reviews, try it, you gonna love it.
267
+ * Language file updated fully.
268
+ * Added a nonce (a security token) to ensure that the user actually voted from the review
269
+ * More developer possibilities
270
+ * Added filters for developers. Using a filter is much better than a function for setting the default colors.
271
+ * Compatible with WordPress 3.9 Beta
272
+ * Plugin will support the widget customizer coming up in WordPress 3.9
273
+
274
+
275
+ = v2.0 (Mar 19, 2014) =
276
+ * Fixed the, `'` switching in to `/` issue (http://bit.ly/PFMGAq)
277
+ * Added `[wp-review]` shortcode to show the ratings anywhere in the content.
278
+ * Added an option to not show review automatically in the Review Location dropdown.
279
+ * Added support for Custom post types and pages.
280
+ * For Developers Added new function for showing only total rating, it could be used in themes' archives. A custom class name can be passed to the function, for easier customization. See `wp_review_show_total()` function in includes/functions.php file. There's also a shortcode for it, just in case: [wp-review-total]
281
+ * For Developers Added the default colors which appear in the meta boxes are now stored in an option. It can be modified directly with `update_option()`, or using the new `wp_review_set_default_colors()` function, which is also called on plugin activation to set the plugin's default colors.
282
+ * Made small CSS and responsive improvements.
283
+
284
+
285
+ = v1.0 (Feb 18, 2014) =
286
+ * Official plugin release.
wp-review.php CHANGED
@@ -1,128 +1,128 @@
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.12
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', '4.0.12' );
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
- add_action('admin_init', 'wp_review_settings_redirect');
31
-
32
- /* Defines constants used by the plugin. */
33
- add_action( 'plugins_loaded', 'wp_review_constants', 1 );
34
-
35
- /* Internationalize the text strings used. */
36
- add_action( 'plugins_loaded', 'wp_review_i18n', 2 );
37
-
38
- /* Loads libraries. */
39
- add_action( 'plugins_loaded', 'wp_review_includes_libraries', 3 );
40
-
41
- /**
42
- * Defines constants.
43
- *
44
- * @since 1.0
45
- */
46
- function wp_review_constants() {
47
-
48
- /* Sets the path to the plugin directory. */
49
- define( 'WP_REVIEW_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
50
-
51
- /* Sets the path to the plugin directory URI. */
52
- define( 'WP_REVIEW_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );
53
-
54
- /* Sets the path to the `admin` directory. */
55
- define( 'WP_REVIEW_ADMIN', WP_REVIEW_DIR . trailingslashit( 'admin' ) );
56
-
57
- /* Sets the path to the `includes` directory. */
58
- define( 'WP_REVIEW_INCLUDES', WP_REVIEW_DIR . trailingslashit( 'includes' ) );
59
-
60
- /* Sets the path to the `assets` directory. */
61
- define( 'WP_REVIEW_ASSETS', WP_REVIEW_URI . trailingslashit( 'assets' ) );
62
-
63
- /* Sets plugin base 'directory/file.php' */
64
- define( 'WP_REVIEW_PLUGIN_BASE', plugin_basename(__FILE__) );
65
-
66
- define( 'WP_REVIEW_COMMENT_TYPE_VISITOR', 'wp_review_visitor' );
67
-
68
- define( 'WP_REVIEW_VISITOR_RATING_METAKEY', 'wp_review_visitor_rating' );
69
-
70
- /* Keys for user review permissions */
71
- define( 'WP_REVIEW_REVIEW_DISABLED', '0' );
72
- define( 'WP_REVIEW_REVIEW_VISITOR_ONLY', '2' );
73
-
74
- }
75
-
76
- /**
77
- * Internationalize the text strings used.
78
- *
79
- * @since 1.0
80
- */
81
- function wp_review_i18n() {
82
- load_plugin_textdomain( 'wp-review', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
83
- }
84
-
85
- /**
86
- * Loads the initial files needed by the plugin.
87
- *
88
- * @since 1.0
89
- */
90
- function wp_review_includes_libraries() {
91
-
92
- /* Loads the admin functions. */
93
- require_once( WP_REVIEW_ADMIN . 'admin.php' );
94
-
95
- /* Loads the meta boxes. */
96
- require_once( WP_REVIEW_ADMIN . 'metaboxes.php' );
97
-
98
- /* Loads the front-end functions. */
99
- require_once( WP_REVIEW_INCLUDES . 'functions.php' );
100
-
101
- /* Loads the widget. */
102
- require_once( WP_REVIEW_INCLUDES . 'widget.php' );
103
-
104
- /* Loads the enqueue functions. */
105
- require_once( WP_REVIEW_INCLUDES . 'enqueue.php' );
106
-
107
- /* Loads the settings page. */
108
- require_once( WP_REVIEW_ADMIN . 'options.php' );
109
-
110
- }
111
-
112
- function wp_review_activation(){
113
- /* Loads activation functions */
114
- add_option('wp_review_do_activation_redirect', true);
115
- update_option('wp_review_activated', time());
116
- }
117
-
118
- function wp_review_settings_redirect() {
119
- if (get_option('wp_review_do_activation_redirect', false)) {
120
- delete_option('wp_review_do_activation_redirect');
121
- wp_redirect('options-general.php?page=wp-review%2Fadmin%2Foptions.php#help');
122
- exit;
123
- }
124
- }
125
-
126
- }
127
-
128
- ?>
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.13
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', '4.0.13' );
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
+ add_action('admin_init', 'wp_review_settings_redirect');
31
+
32
+ /* Defines constants used by the plugin. */
33
+ add_action( 'plugins_loaded', 'wp_review_constants', 1 );
34
+
35
+ /* Internationalize the text strings used. */
36
+ add_action( 'plugins_loaded', 'wp_review_i18n', 2 );
37
+
38
+ /* Loads libraries. */
39
+ add_action( 'plugins_loaded', 'wp_review_includes_libraries', 3 );
40
+
41
+ /**
42
+ * Defines constants.
43
+ *
44
+ * @since 1.0
45
+ */
46
+ function wp_review_constants() {
47
+
48
+ /* Sets the path to the plugin directory. */
49
+ define( 'WP_REVIEW_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
50
+
51
+ /* Sets the path to the plugin directory URI. */
52
+ define( 'WP_REVIEW_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );
53
+
54
+ /* Sets the path to the `admin` directory. */
55
+ define( 'WP_REVIEW_ADMIN', WP_REVIEW_DIR . trailingslashit( 'admin' ) );
56
+
57
+ /* Sets the path to the `includes` directory. */
58
+ define( 'WP_REVIEW_INCLUDES', WP_REVIEW_DIR . trailingslashit( 'includes' ) );
59
+
60
+ /* Sets the path to the `assets` directory. */
61
+ define( 'WP_REVIEW_ASSETS', WP_REVIEW_URI . trailingslashit( 'assets' ) );
62
+
63
+ /* Sets plugin base 'directory/file.php' */
64
+ define( 'WP_REVIEW_PLUGIN_BASE', plugin_basename(__FILE__) );
65
+
66
+ define( 'WP_REVIEW_COMMENT_TYPE_VISITOR', 'wp_review_visitor' );
67
+
68
+ define( 'WP_REVIEW_VISITOR_RATING_METAKEY', 'wp_review_visitor_rating' );
69
+
70
+ /* Keys for user review permissions */
71
+ define( 'WP_REVIEW_REVIEW_DISABLED', '0' );
72
+ define( 'WP_REVIEW_REVIEW_VISITOR_ONLY', '2' );
73
+
74
+ }
75
+
76
+ /**
77
+ * Internationalize the text strings used.
78
+ *
79
+ * @since 1.0
80
+ */
81
+ function wp_review_i18n() {
82
+ load_plugin_textdomain( 'wp-review', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
83
+ }
84
+
85
+ /**
86
+ * Loads the initial files needed by the plugin.
87
+ *
88
+ * @since 1.0
89
+ */
90
+ function wp_review_includes_libraries() {
91
+
92
+ /* Loads the admin functions. */
93
+ require_once( WP_REVIEW_ADMIN . 'admin.php' );
94
+
95
+ /* Loads the meta boxes. */
96
+ require_once( WP_REVIEW_ADMIN . 'metaboxes.php' );
97
+
98
+ /* Loads the front-end functions. */
99
+ require_once( WP_REVIEW_INCLUDES . 'functions.php' );
100
+
101
+ /* Loads the widget. */
102
+ require_once( WP_REVIEW_INCLUDES . 'widget.php' );
103
+
104
+ /* Loads the enqueue functions. */
105
+ require_once( WP_REVIEW_INCLUDES . 'enqueue.php' );
106
+
107
+ /* Loads the settings page. */
108
+ require_once( WP_REVIEW_ADMIN . 'options.php' );
109
+
110
+ }
111
+
112
+ function wp_review_activation(){
113
+ /* Loads activation functions */
114
+ add_option('wp_review_do_activation_redirect', true);
115
+ update_option('wp_review_activated', time());
116
+ }
117
+
118
+ function wp_review_settings_redirect() {
119
+ if (get_option('wp_review_do_activation_redirect', false)) {
120
+ delete_option('wp_review_do_activation_redirect');
121
+ wp_redirect('options-general.php?page=wp-review%2Fadmin%2Foptions.php#help');
122
+ exit;
123
+ }
124
+ }
125
+
126
+ }
127
+
128
+ ?>