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;