Version Description
- Fixed the,
'
switching in to/
issue (http://bit.ly/PFMGAq) - Added
[wp-review]
shortcode to show the ratings anywhere in the content. - Added an option to not show review automatically in the Review Location dropdown.
- Added support for Custom post types and pages.
- For Developers Added new function for showing only total rating, it could be used in themes' archives. A custom class name can be passed to the function, for easier customization. See
wp_review_show_total()
function in includes/functions.php file. There's also a shortcode for it, just in case: [wp-review-total] - For Developers Added the default colors which appear in the meta boxes are now stored in an option. It can be modified directly with
update_option()
, or using the newwp_review_set_default_colors()
function, which is also called on plugin activation to set the plugin's default colors. - Made small CSS and responsive improvements.
Download this release
Release Info
Developer | MyThemeShop |
Plugin | WP Review |
Version | 2.0 |
Comparing to | |
See all releases |
Version 2.0
- admin/activation.php +36 -0
- admin/admin.php +26 -0
- admin/metaboxes.php +399 -0
- assets/css/admin.css +48 -0
- assets/css/wp-review-ie7.css +8 -0
- assets/css/wp-review.css +417 -0
- assets/fonts/font-loader.eot +0 -0
- assets/fonts/font-loader.svg +12 -0
- assets/fonts/font-loader.ttf +0 -0
- assets/fonts/font-loader.woff +0 -0
- assets/fonts/font-star.eot +0 -0
- assets/fonts/font-star.svg +12 -0
- assets/fonts/font-star.ttf +0 -0
- assets/fonts/font-star.woff +0 -0
- assets/images/bigthumb.png +0 -0
- assets/images/smallthumb.png +0 -0
- assets/js/admin.js +151 -0
- assets/js/main.js +40 -0
- includes/enqueue.php +50 -0
- includes/functions.php +482 -0
- languages/default.mo +0 -0
- languages/default.po +93 -0
- license.txt +339 -0
- readme.txt +93 -0
- wp-review.php +101 -0
admin/activation.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function mts_create_review_tables(){
|
3 |
+
|
4 |
+
global $wpdb;
|
5 |
+
$table_name = $wpdb->prefix . MTS_WP_REVIEW_DB_TABLE;
|
6 |
+
if (function_exists('is_multisite') && is_multisite()) $table_name = $wpdb->base_prefix . MTS_WP_REVIEW_DB_TABLE;
|
7 |
+
|
8 |
+
/*$sql = "DROP TABLE IF_EXISTS $table_name;";
|
9 |
+
$e = $wpdb->query($sql);
|
10 |
+
die(var_dump($e));*/
|
11 |
+
$my_stat_sql = "CREATE TABLE IF NOT EXISTS $table_name (
|
12 |
+
id int(11) NOT NULL auto_increment,
|
13 |
+
blog_id int(11) NOT NULL,
|
14 |
+
post_id int(11) NOT NULL,
|
15 |
+
user_id int(11) NOT NULL,
|
16 |
+
user_ip varchar(55) NOT NULL,
|
17 |
+
rate int(11) NOT NULL,
|
18 |
+
date datetime NOT NULL,
|
19 |
+
UNIQUE KEY id (id)
|
20 |
+
);";
|
21 |
+
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
22 |
+
dbDelta( $my_stat_sql );
|
23 |
+
}
|
24 |
+
mts_create_review_tables();
|
25 |
+
|
26 |
+
// set default colors
|
27 |
+
$defaultColors = array(
|
28 |
+
'review_color' => '#1e73be',
|
29 |
+
'font_color' => '#555555',
|
30 |
+
'bg_color1' => '#e7e7e7',
|
31 |
+
'bg_color2' => '#ffffff',
|
32 |
+
'border_color' => '#e7e7e7'
|
33 |
+
);
|
34 |
+
wp_review_set_default_colors($defaultColors);
|
35 |
+
|
36 |
+
?>
|
admin/admin.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin functions for this plugin.
|
4 |
+
*
|
5 |
+
* @since 1.0
|
6 |
+
* @copyright Copyright (c) 2013, MyThemesShop
|
7 |
+
* @author MyThemesShop
|
8 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
9 |
+
*/
|
10 |
+
|
11 |
+
/* Register admin.css file. */
|
12 |
+
add_action( 'admin_enqueue_scripts', 'wp_review_admin_style' );
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Register custom style for the meta box.
|
16 |
+
*
|
17 |
+
* @since 1.0
|
18 |
+
*/
|
19 |
+
function wp_review_admin_style( $hook_suffix ) {
|
20 |
+
wp_enqueue_style( 'wp-review-admin-style', WP_REVIEW_ASSETS . 'css/admin.css' );
|
21 |
+
wp_enqueue_script( 'wp-review-admin-script', WP_REVIEW_ASSETS . 'js/admin.js', array( 'wp-color-picker', 'jquery' ), false, true );
|
22 |
+
|
23 |
+
/* Load the color picker dependencies style. */
|
24 |
+
wp_enqueue_style( 'wp-color-picker' );
|
25 |
+
}
|
26 |
+
?>
|
admin/metaboxes.php
ADDED
@@ -0,0 +1,399 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 = array('attachment');
|
25 |
+
|
26 |
+
foreach ($post_types as $post_type) {
|
27 |
+
if (!in_array($post_type, $excluded_post_types)) {
|
28 |
+
add_meta_box(
|
29 |
+
'wp-review-metabox-review',
|
30 |
+
__( 'Review', 'wp-review' ),
|
31 |
+
'wp_review_render_meta_box_review_options',
|
32 |
+
$post_type,
|
33 |
+
'normal',
|
34 |
+
'high'
|
35 |
+
);
|
36 |
+
|
37 |
+
add_meta_box(
|
38 |
+
'wp-review-metabox-item',
|
39 |
+
__( 'Review Item', 'wp-review' ),
|
40 |
+
'wp_review_render_meta_box_item',
|
41 |
+
$post_type,
|
42 |
+
'normal',
|
43 |
+
'high'
|
44 |
+
);
|
45 |
+
|
46 |
+
add_meta_box(
|
47 |
+
'wp-review-metabox-heading',
|
48 |
+
__( 'Review Heading', 'wp-review' ),
|
49 |
+
'wp_review_render_meta_box_heading',
|
50 |
+
$post_type,
|
51 |
+
'normal',
|
52 |
+
'high'
|
53 |
+
);
|
54 |
+
|
55 |
+
add_meta_box(
|
56 |
+
'wp-review-metabox-desc',
|
57 |
+
__( 'Review Description', 'wp-review' ),
|
58 |
+
'wp_review_render_meta_box_desc',
|
59 |
+
$post_type,
|
60 |
+
'normal',
|
61 |
+
'high'
|
62 |
+
);
|
63 |
+
|
64 |
+
add_meta_box(
|
65 |
+
'wp-review-metabox-userReview',
|
66 |
+
__( 'User Reviews', 'wp-review' ),
|
67 |
+
'wp_review_render_meta_box_userReview',
|
68 |
+
$post_type,
|
69 |
+
'normal',
|
70 |
+
'high'
|
71 |
+
);
|
72 |
+
}
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Render the meta box.
|
78 |
+
*
|
79 |
+
* @since 1.0
|
80 |
+
*/
|
81 |
+
function wp_review_render_meta_box_review_options( $post ) {
|
82 |
+
global $post;
|
83 |
+
|
84 |
+
/* Add an nonce field so we can check for it later. */
|
85 |
+
wp_nonce_field( basename( __FILE__ ), 'wp-review-review-options-nonce' );
|
86 |
+
|
87 |
+
/* Retrieve an existing value from the database. */
|
88 |
+
$type = get_post_meta( $post->ID, 'wp_review_type', true );
|
89 |
+
?>
|
90 |
+
|
91 |
+
<p class="wp-review-field">
|
92 |
+
<label for="wp_review_type"><?php _e( 'Review Type', 'wp-review' ); ?></label>
|
93 |
+
<select name="wp_review_type" id="wp_review_type">
|
94 |
+
<option value=""><?php _e( 'No Review', 'wp-review' ) ?></option>
|
95 |
+
<option value="star" <?php selected( $type, 'star' ); ?>><?php _e( 'Star', 'wp-review' ) ?></option>
|
96 |
+
<option value="point" <?php selected( $type, 'point' ); ?>><?php _e( 'Point', 'wp-review' ) ?></option>
|
97 |
+
<option value="percentage" <?php selected( $type, 'percentage' ); ?>><?php _e( 'Percentage', 'wp-review' ) ?></option>
|
98 |
+
</select>
|
99 |
+
</p>
|
100 |
+
|
101 |
+
<?php
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Render the meta box.
|
106 |
+
*
|
107 |
+
* @since 1.0
|
108 |
+
*/
|
109 |
+
function wp_review_render_meta_box_item( $post ) {
|
110 |
+
global $post;
|
111 |
+
$defaultColors = get_option('wp_review_default_colors');
|
112 |
+
|
113 |
+
/* Add an nonce field so we can check for it later. */
|
114 |
+
wp_nonce_field( basename( __FILE__ ), 'wp-review-item-nonce' );
|
115 |
+
|
116 |
+
/* Retrieve an existing value from the database. */
|
117 |
+
$items = get_post_meta( $post->ID, 'wp_review_item', true );
|
118 |
+
$color = get_post_meta( $post->ID, 'wp_review_color', true );
|
119 |
+
$location = get_post_meta( $post->ID, 'wp_review_location', true );
|
120 |
+
$fontcolor = get_post_meta( $post->ID, 'wp_review_fontcolor', true );
|
121 |
+
$bgcolor1 = get_post_meta( $post->ID, 'wp_review_bgcolor1', true );
|
122 |
+
$bgcolor2 = get_post_meta( $post->ID, 'wp_review_bgcolor2', true );
|
123 |
+
$bordercolor = get_post_meta( $post->ID, 'wp_review_bordercolor', true );
|
124 |
+
if( $color == '' ) $color = $defaultColors['review_color'];
|
125 |
+
if( $fontcolor == '' ) $fontcolor = $defaultColors['font_color'];
|
126 |
+
if( $bgcolor1 == '' ) $bgcolor1 = $defaultColors['bg_color1'];
|
127 |
+
if( $bgcolor2 == '' ) $bgcolor2 = $defaultColors['bg_color2'];
|
128 |
+
if( $bordercolor == '' ) $bordercolor = $defaultColors['border_color'];
|
129 |
+
|
130 |
+
?>
|
131 |
+
|
132 |
+
<p class="wp-review-field">
|
133 |
+
<label for="wp_review_location"><?php _e( 'Review Location', 'wp-review' ); ?></label>
|
134 |
+
<select name="wp_review_location" id="wp_review_location">
|
135 |
+
<option value="bottom" <?php selected( $location, 'bottom' ); ?>><?php _e( 'After Content', 'wp-review' ) ?></option>
|
136 |
+
<option value="top" <?php selected( $location, 'top' ); ?>><?php _e( 'Before Content', 'wp-review' ) ?></option>
|
137 |
+
<option value="custom" <?php selected( $location, 'custom' ); ?>><?php _e( 'Custom (use shortcode)', 'wp-review' ) ?></option>
|
138 |
+
</select>
|
139 |
+
</p>
|
140 |
+
|
141 |
+
<p class="wp-review-field" id="wp_review_shortcode_hint_field">
|
142 |
+
<label for="wp_review_shortcode_hint"></label>
|
143 |
+
<input id="wp_review_shortcode_hint" type="text" value="[wp-review]" readonly="readonly" />
|
144 |
+
<span><?php _e('Copy & paste this shortcode in the content.', 'wp-review') ?></span>
|
145 |
+
</p>
|
146 |
+
|
147 |
+
<p class="wp-review-field">
|
148 |
+
<label for="wp_review_color"><?php _e( 'Review Color', 'wp-review' ); ?></label>
|
149 |
+
<input type="text" class="wp-review-color" name="wp_review_color" value="<?php echo $color; ?>" />
|
150 |
+
</p>
|
151 |
+
|
152 |
+
<p class="wp-review-field">
|
153 |
+
<label for="wp_review_fontcolor"><?php _e( 'Font Color', 'wp-review' ); ?></label>
|
154 |
+
<input type="text" class="wp-review-color" name="wp_review_fontcolor" id ="wp_review_fontcolor" value="<?php echo $fontcolor; ?>" />
|
155 |
+
</p>
|
156 |
+
|
157 |
+
<p class="wp-review-field">
|
158 |
+
<label for="wp_review_bgcolor1"><?php _e( 'Heading Background Color', 'wp-review' ); ?></label>
|
159 |
+
<input type="text" class="wp-review-color" name="wp_review_bgcolor1" id ="wp_review_bgcolor1" value="<?php echo $bgcolor1; ?>" />
|
160 |
+
</p>
|
161 |
+
|
162 |
+
<p class="wp-review-field">
|
163 |
+
<label for="wp_review_bgcolor2"><?php _e( 'Background Color', 'wp-review' ); ?></label>
|
164 |
+
<input type="text" class="wp-review-color" name="wp_review_bgcolor2" id="wp_review_bgcolor2" value="<?php echo $bgcolor2; ?>" />
|
165 |
+
</p>
|
166 |
+
|
167 |
+
<p class="wp-review-field">
|
168 |
+
<label for="wp_review_bordercolor"><?php _e( 'Border Color', 'wp-review' ); ?></label>
|
169 |
+
<input type="text" class="wp-review-color" name="wp_review_bordercolor" id="wp_review_bordercolor" value="<?php echo $bordercolor; ?>" />
|
170 |
+
</p>
|
171 |
+
|
172 |
+
<!-- Start repeater field -->
|
173 |
+
<table id="wp-review-item" class="wp-review-item" width="100%">
|
174 |
+
|
175 |
+
<thead>
|
176 |
+
<tr>
|
177 |
+
<th width="80%"><?php _e( 'Feature Name', 'wp-review' ); ?></th>
|
178 |
+
<th width="10%" class="dynamic-text"><?php _e( 'Star (1-5)', 'wp-review' ); ?></th>
|
179 |
+
<th width="10%"></th>
|
180 |
+
</tr>
|
181 |
+
</thead>
|
182 |
+
|
183 |
+
<tbody>
|
184 |
+
<?php if ( $items ) : ?>
|
185 |
+
|
186 |
+
<?php foreach ( $items as $item ) { ?>
|
187 |
+
|
188 |
+
<tr>
|
189 |
+
<td>
|
190 |
+
<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'] ); ?>" />
|
191 |
+
</td>
|
192 |
+
<td>
|
193 |
+
<input type="text" class="widefat review-star" name="wp_review_item_star[]" value="<?php if ( !empty ($item['wp_review_item_star'] ) ) echo $item['wp_review_item_star']; ?>" />
|
194 |
+
</td>
|
195 |
+
<td><a class="button remove-row" href="#"><?php _e( 'Delete', 'wp-review' ); ?></a></td>
|
196 |
+
</tr>
|
197 |
+
|
198 |
+
<?php } ?>
|
199 |
+
|
200 |
+
<?php else : ?>
|
201 |
+
|
202 |
+
<tr>
|
203 |
+
<td><input type="text" class="widefat" name="wp_review_item_title[]" /></td>
|
204 |
+
<td><input type="text" class="widefat review-star" name="wp_review_item_star[]" /></td>
|
205 |
+
<td><a class="button remove-row" href="#"><?php _e( 'Delete', 'wp-review' ); ?></a></td>
|
206 |
+
</tr>
|
207 |
+
|
208 |
+
<?php endif; ?>
|
209 |
+
|
210 |
+
<!-- empty hidden one for jQuery -->
|
211 |
+
<tr class="empty-row screen-reader-text">
|
212 |
+
<td><input type="text" class="widefat" name="wp_review_item_title[]" /></td>
|
213 |
+
<td><input type="text" class="widefat" name="wp_review_item_star[]" /></td>
|
214 |
+
<td><a class="button remove-row" href="#"><?php _e( 'Delete', 'wp-review' ); ?></a></td>
|
215 |
+
</tr>
|
216 |
+
|
217 |
+
</tbody>
|
218 |
+
|
219 |
+
</table>
|
220 |
+
|
221 |
+
<table width="100%">
|
222 |
+
<tr>
|
223 |
+
<td width="80%"><a id="add-row" class="button" href="#"><?php _e( 'Add another', 'wp-review' ) ?></a></td>
|
224 |
+
<td width="10%">
|
225 |
+
<input type="text" class="widefat wp-review-total" name="wp_review_total" value="<?php echo get_post_meta( $post->ID, 'wp_review_total', true ); ?>" readonly="readonly" />
|
226 |
+
</td>
|
227 |
+
<td width="10%"><?php _e( 'Total', 'wp-review' ); ?></td>
|
228 |
+
</tr>
|
229 |
+
</table>
|
230 |
+
|
231 |
+
<?php
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Render the meta box.
|
236 |
+
*
|
237 |
+
* @since 1.0
|
238 |
+
*/
|
239 |
+
function wp_review_render_meta_box_heading( $post ) {
|
240 |
+
/* Add an nonce field so we can check for it later. */
|
241 |
+
wp_nonce_field( basename( __FILE__ ), 'wp-review-heading-nonce' );
|
242 |
+
|
243 |
+
/* Retrieve an existing value from the database. */
|
244 |
+
$heading = get_post_meta( $post->ID, 'wp_review_heading', true );
|
245 |
+
?>
|
246 |
+
<p class="wp-review-field">
|
247 |
+
<label><?php _e( 'Review Heading', 'wp-review' ); ?></label>
|
248 |
+
<input type="text" name="wp_review_heading" id="wp_review_heading" value="<?php _e( $heading ); ?>" />
|
249 |
+
</p>
|
250 |
+
<?php
|
251 |
+
}
|
252 |
+
|
253 |
+
function wp_review_render_meta_box_desc( $post ) {
|
254 |
+
|
255 |
+
/* Add an nonce field so we can check for it later. */
|
256 |
+
wp_nonce_field( basename( __FILE__ ), 'wp-review-desc-nonce' );
|
257 |
+
|
258 |
+
/* Retrieve an existing value from the database. */
|
259 |
+
$desc = get_post_meta( $post->ID, 'wp_review_desc', true );
|
260 |
+
|
261 |
+
/* Display wp editor field. */
|
262 |
+
wp_editor(
|
263 |
+
$desc,
|
264 |
+
'wp_review_desc',
|
265 |
+
array(
|
266 |
+
'tinymce' => false,
|
267 |
+
'quicktags' => true,
|
268 |
+
'media_buttons' => false,
|
269 |
+
'textarea_rows' => 10
|
270 |
+
)
|
271 |
+
);
|
272 |
+
|
273 |
+
}
|
274 |
+
|
275 |
+
function wp_review_render_meta_box_userReview( $post ) {
|
276 |
+
/* Add an nonce field so we can check for it later. */
|
277 |
+
wp_nonce_field( basename( __FILE__ ), 'wp-review-userReview-nonce' );
|
278 |
+
|
279 |
+
/* Retrieve an existing value from the database. */
|
280 |
+
$userReviews = get_post_meta( $post->ID, 'wp_review_userReview', true );
|
281 |
+
$enabled = false;
|
282 |
+
if( is_array( $userReviews ) && $userReviews[0] == 1 ) $enabled = true;
|
283 |
+
?>
|
284 |
+
|
285 |
+
<p class="wp-review-field">
|
286 |
+
<label for="wp-review-userReview-disable"> <?php _e( 'Disabled', 'wp-review' ); ?>
|
287 |
+
<input type="radio" name="wp_review_userReview[]" id="wp-review-userReview-disable" value="0" <?php echo !$enabled ? 'checked' : ''; ?> />
|
288 |
+
</label>
|
289 |
+
|
290 |
+
<label for="wp-review-userReview-enable"> <?php _e( 'Enabled', 'wp-review' ); ?>
|
291 |
+
<input type="radio" name="wp_review_userReview[]" id="wp-review-userReview-enable" value="1" <?php echo $enabled ? 'checked' : ''; ?> />
|
292 |
+
</label>
|
293 |
+
|
294 |
+
</p>
|
295 |
+
|
296 |
+
<?php
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Saves the meta box.
|
301 |
+
*
|
302 |
+
* @since 1.0
|
303 |
+
*/
|
304 |
+
function wp_review_save_postdata( $post_id, $post ) {
|
305 |
+
|
306 |
+
if ( !isset( $_POST['wp-review-review-options-nonce'] ) || !wp_verify_nonce( $_POST['wp-review-review-options-nonce'], basename( __FILE__ ) ) )
|
307 |
+
return;
|
308 |
+
|
309 |
+
if ( !isset( $_POST['wp-review-item-nonce'] ) || !wp_verify_nonce( $_POST['wp-review-item-nonce'], basename( __FILE__ ) ) )
|
310 |
+
return;
|
311 |
+
|
312 |
+
if ( !isset( $_POST['wp-review-heading-nonce'] ) || !wp_verify_nonce( $_POST['wp-review-heading-nonce'], basename( __FILE__ ) ) )
|
313 |
+
return;
|
314 |
+
|
315 |
+
if ( !isset( $_POST['wp-review-desc-nonce'] ) || !wp_verify_nonce( $_POST['wp-review-desc-nonce'], basename( __FILE__ ) ) )
|
316 |
+
return;
|
317 |
+
|
318 |
+
if ( !isset( $_POST['wp-review-userReview-nonce'] ) || !wp_verify_nonce( $_POST['wp-review-userReview-nonce'], basename( __FILE__ ) ) )
|
319 |
+
return;
|
320 |
+
|
321 |
+
/* If this is an autosave, our form has not been submitted, so we don't want to do anything. */
|
322 |
+
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
323 |
+
return $post_id;
|
324 |
+
|
325 |
+
/* Check the user's permissions. */
|
326 |
+
if ( 'page' == $_POST['post_type'] ) {
|
327 |
+
if ( ! current_user_can( 'edit_page', $post_id ) )
|
328 |
+
return $post_id;
|
329 |
+
} else {
|
330 |
+
if ( ! current_user_can( 'edit_post', $post_id ) )
|
331 |
+
return $post_id;
|
332 |
+
}
|
333 |
+
|
334 |
+
$meta = array(
|
335 |
+
'wp_review_location' => $_POST['wp_review_location'],
|
336 |
+
'wp_review_type' => $_POST['wp_review_type'],
|
337 |
+
'wp_review_heading' => $_POST['wp_review_heading'],
|
338 |
+
'wp_review_desc' => $_POST['wp_review_desc'],
|
339 |
+
'wp_review_userReview' => $_POST['wp_review_userReview'],
|
340 |
+
'wp_review_total' => $_POST['wp_review_total'],
|
341 |
+
'wp_review_color' => $_POST['wp_review_color'],
|
342 |
+
'wp_review_fontcolor' => $_POST['wp_review_fontcolor'],
|
343 |
+
'wp_review_bgcolor1' => $_POST['wp_review_bgcolor1'],
|
344 |
+
'wp_review_bgcolor2' => $_POST['wp_review_bgcolor2'],
|
345 |
+
'wp_review_bordercolor' => $_POST['wp_review_bordercolor']
|
346 |
+
);
|
347 |
+
|
348 |
+
foreach ( $meta as $meta_key => $new_meta_value ) {
|
349 |
+
|
350 |
+
/* Get the meta value of the custom field key. */
|
351 |
+
$meta_value = get_post_meta( $post_id, $meta_key, true );
|
352 |
+
|
353 |
+
/* If there is no new meta value but an old value exists, delete it. */
|
354 |
+
if ( current_user_can( 'delete_post_meta', $post_id, $meta_key ) && '' == $new_meta_value && $meta_value )
|
355 |
+
delete_post_meta( $post_id, $meta_key, $meta_value );
|
356 |
+
|
357 |
+
/* If a new meta value was added and there was no previous value, add it. */
|
358 |
+
elseif ( current_user_can( 'add_post_meta', $post_id, $meta_key ) && $new_meta_value && '' == $meta_value )
|
359 |
+
add_post_meta( $post_id, $meta_key, $new_meta_value, true );
|
360 |
+
|
361 |
+
/* If the new meta value does not match the old value, update it. */
|
362 |
+
elseif ( current_user_can( 'edit_post_meta', $post_id, $meta_key ) && $new_meta_value && $new_meta_value != $meta_value )
|
363 |
+
update_post_meta( $post_id, $meta_key, $new_meta_value );
|
364 |
+
}
|
365 |
+
|
366 |
+
/* Repeatable update and delete meta fields method. */
|
367 |
+
$title = $_POST['wp_review_item_title'];
|
368 |
+
$star = $_POST['wp_review_item_star'];
|
369 |
+
|
370 |
+
$old = get_post_meta( $post_id, 'wp_review_item', true );
|
371 |
+
$new = array();
|
372 |
+
|
373 |
+
$count = count( $title );
|
374 |
+
|
375 |
+
for ( $i = 0; $i < $count; $i++ ) {
|
376 |
+
if ( $title[$i] != '' )
|
377 |
+
$new[$i]['wp_review_item_title'] = sanitize_text_field( $title[$i] );
|
378 |
+
if ( $star[$i] != '' )
|
379 |
+
$new[$i]['wp_review_item_star'] = sanitize_text_field( $star[$i] );
|
380 |
+
}
|
381 |
+
|
382 |
+
if ( !empty( $new ) && $new != $old )
|
383 |
+
update_post_meta( $post_id, 'wp_review_item', $new );
|
384 |
+
elseif ( empty($new) && $old )
|
385 |
+
delete_post_meta( $post_id, 'wp_review_item', $old );
|
386 |
+
|
387 |
+
/**
|
388 |
+
* Delete all data when switched to 'No Review' type.
|
389 |
+
*/
|
390 |
+
$type = get_post_meta( $post_id, 'wp_review_type', true );
|
391 |
+
if ( $type == '' ) {
|
392 |
+
delete_post_meta( $post_id, 'wp_review_desc', $_POST['wp_review_desc'] );
|
393 |
+
delete_post_meta( $post_id, 'wp_review_heading', $_POST['wp_review_heading'] );
|
394 |
+
delete_post_meta( $post_id, 'wp_review_userReview', $_POST['wp_review_userReview'] );
|
395 |
+
delete_post_meta( $post_id, 'wp_review_item', $old );
|
396 |
+
}
|
397 |
+
|
398 |
+
}
|
399 |
+
?>
|
assets/css/admin.css
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wp-review-field label {
|
2 |
+
width: 15%;
|
3 |
+
display: inline-block;
|
4 |
+
*display: inline;
|
5 |
+
*zoom: 1;
|
6 |
+
}
|
7 |
+
|
8 |
+
.wp-review-field select {
|
9 |
+
width: 15em;
|
10 |
+
}
|
11 |
+
|
12 |
+
.wp-review-field .wp-color-result {
|
13 |
+
margin: 0;
|
14 |
+
}
|
15 |
+
|
16 |
+
.wp-review-item th {
|
17 |
+
text-align: left;
|
18 |
+
}
|
19 |
+
|
20 |
+
.has-border-bottom {
|
21 |
+
border-bottom: 1px solid #ddd;
|
22 |
+
margin-bottom: 20px;
|
23 |
+
padding-bottom: 20px;
|
24 |
+
}
|
25 |
+
|
26 |
+
.review-total {
|
27 |
+
text-align: right;
|
28 |
+
}
|
29 |
+
|
30 |
+
.wp-picker-holder {
|
31 |
+
position: absolute;
|
32 |
+
z-index: 9;
|
33 |
+
}
|
34 |
+
|
35 |
+
#wp-review-item .review-value-incorrect {
|
36 |
+
border-color: #F00;
|
37 |
+
}
|
38 |
+
|
39 |
+
#wp_review_shortcode_hint_field span {
|
40 |
+
color: #777;
|
41 |
+
font-style: italic;
|
42 |
+
display: block;
|
43 |
+
margin-left: 116px;
|
44 |
+
margin-top: 2px;
|
45 |
+
}
|
46 |
+
#wp_review_shortcode_hint {
|
47 |
+
width: 94px;
|
48 |
+
}
|
assets/css/wp-review-ie7.css
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[class^="icon-"], [class*=" icon-"] {
|
2 |
+
font-family: 'font-star';
|
3 |
+
font-style: normal;
|
4 |
+
font-weight: normal;
|
5 |
+
line-height: 1em;
|
6 |
+
}
|
7 |
+
|
8 |
+
.icon-star { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
assets/css/wp-review.css
ADDED
@@ -0,0 +1,417 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
Plugin: WP Review
|
3 |
+
Created By: MyThemeShop.com
|
4 |
+
*/
|
5 |
+
.review-wrapper {
|
6 |
+
border: 1px solid #e7e7e7;
|
7 |
+
margin-bottom: 1.5em;
|
8 |
+
overflow: hidden;
|
9 |
+
}
|
10 |
+
|
11 |
+
.review-title {
|
12 |
+
background-color: #f6f6f6;
|
13 |
+
border-bottom: 1px solid #e7e7e7;
|
14 |
+
margin: 0;
|
15 |
+
padding: 10px;
|
16 |
+
}
|
17 |
+
|
18 |
+
.review-wrapper .review-list {
|
19 |
+
margin: 0;
|
20 |
+
list-style: none;
|
21 |
+
padding: 0;
|
22 |
+
}
|
23 |
+
|
24 |
+
.review-list li {
|
25 |
+
border-bottom: 1px solid #e7e7e7;
|
26 |
+
padding: 10px;
|
27 |
+
position: relative;
|
28 |
+
list-style: none;
|
29 |
+
}
|
30 |
+
|
31 |
+
.review-list li:nth-child(even) {
|
32 |
+
background-color: #fafafa;
|
33 |
+
}
|
34 |
+
|
35 |
+
.review-list li:last-child {
|
36 |
+
border-bottom: 1px solid #e7e7e7;
|
37 |
+
}
|
38 |
+
|
39 |
+
.review-summary-title {
|
40 |
+
margin-bottom: 5px;
|
41 |
+
}
|
42 |
+
|
43 |
+
.review-desc {
|
44 |
+
float: left;
|
45 |
+
width: 75%;
|
46 |
+
padding: 2%;
|
47 |
+
-webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;
|
48 |
+
}
|
49 |
+
|
50 |
+
.review-desc p:last-child {
|
51 |
+
margin-bottom: 0;
|
52 |
+
}
|
53 |
+
|
54 |
+
.review-result-wrapper i {
|
55 |
+
font-style: normal;
|
56 |
+
font-size: 16px;
|
57 |
+
}
|
58 |
+
|
59 |
+
.review-result {
|
60 |
+
position: absolute;
|
61 |
+
top: 0;
|
62 |
+
left: 0;
|
63 |
+
height: 22px;
|
64 |
+
overflow: hidden;
|
65 |
+
white-space: nowrap;
|
66 |
+
}
|
67 |
+
|
68 |
+
.review-total-wrapper {
|
69 |
+
float: right;
|
70 |
+
margin: 0;
|
71 |
+
margin-right: 0;
|
72 |
+
padding-right: 0;
|
73 |
+
position: relative;
|
74 |
+
-webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;
|
75 |
+
margin-right: 20px;
|
76 |
+
}
|
77 |
+
|
78 |
+
.review-total-wrapper span.review-total-box {
|
79 |
+
border-top: 0;
|
80 |
+
border-bottom: 0;
|
81 |
+
border-left: 0;
|
82 |
+
border-right: 0;
|
83 |
+
display: block;
|
84 |
+
font-size: 40px;
|
85 |
+
font-weight: 700;
|
86 |
+
text-align: right;
|
87 |
+
margin: 0;
|
88 |
+
padding: 35px 0 20px;
|
89 |
+
width: 100%;
|
90 |
+
-webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;
|
91 |
+
}
|
92 |
+
.review-total-wrapper span.review-total-box small{font-size: 12px; display: block;}
|
93 |
+
/*.review-total-wrapper span.review-total-box.hidden{display: none;}*/
|
94 |
+
.percentage-icon {
|
95 |
+
font-size: 22px;
|
96 |
+
position: relative;
|
97 |
+
top: -14px;
|
98 |
+
}
|
99 |
+
|
100 |
+
.review-total-star {
|
101 |
+
position: relative;
|
102 |
+
margin-top: 5px;
|
103 |
+
margin: 5px auto 15px auto;
|
104 |
+
float: right;
|
105 |
+
}
|
106 |
+
|
107 |
+
.review-total-star.allowed-to-rate{margin-top:-10px;}
|
108 |
+
|
109 |
+
.review-total-star.allowed-to-rate.has-not-rated-yet a{cursor: pointer;}
|
110 |
+
|
111 |
+
.review-total-star.allowed-to-rate.has-not-rated-yet:hover .review-result {opacity: 0; filter: alpha(opacity=0); display:none}
|
112 |
+
.review-total-star.allowed-to-rate.has-not-rated-yet a:hover > i{opacity: 1; filter: alpha(opacity=1);}
|
113 |
+
.review-total-star.allowed-to-rate a.hovered i{opacity: 1; filter: alpha(opacity=1);}
|
114 |
+
.mts-review-wait-msg{display: none;}
|
115 |
+
|
116 |
+
.review-total {
|
117 |
+
position: absolute;
|
118 |
+
top: 0px;
|
119 |
+
left: 0px;
|
120 |
+
height: 16px;
|
121 |
+
z-index: 99;
|
122 |
+
text-indent: -9999px;
|
123 |
+
}
|
124 |
+
|
125 |
+
.review-star {
|
126 |
+
position: absolute;
|
127 |
+
right: 20px;
|
128 |
+
top: 10px;
|
129 |
+
}
|
130 |
+
|
131 |
+
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Bar & Percentage Point
|
135 |
+
*/
|
136 |
+
.bar-point .review-star,
|
137 |
+
.percentage-point .review-star {
|
138 |
+
position: relative;
|
139 |
+
margin: 6px 0;
|
140 |
+
top: 0;
|
141 |
+
right: 0;
|
142 |
+
}
|
143 |
+
|
144 |
+
.bar-point .review-result-wrapper,
|
145 |
+
.percentage-point .review-result-wrapper {
|
146 |
+
background: rgba(0,0,0,0.1) 0 -24px repeat-x;
|
147 |
+
width: 100%;
|
148 |
+
height: 22px;
|
149 |
+
}
|
150 |
+
|
151 |
+
.bar-point .review-result,
|
152 |
+
.percentage-point .review-result {
|
153 |
+
position: absolute;
|
154 |
+
top: 0px;
|
155 |
+
left: 0px;
|
156 |
+
height: 22px;
|
157 |
+
z-index: 99;
|
158 |
+
text-indent: -9999px;
|
159 |
+
}
|
160 |
+
|
161 |
+
.review-total-star.allowed-to-rate .review-result-wrapper{background: none;}
|
162 |
+
/**
|
163 |
+
* Twenty series themes compatibilty
|
164 |
+
*/
|
165 |
+
.entry-content .review-title,
|
166 |
+
#content .review-title {
|
167 |
+
margin: 0;
|
168 |
+
}
|
169 |
+
|
170 |
+
.entry-content .review-wrapper li {
|
171 |
+
margin: 0;
|
172 |
+
}
|
173 |
+
|
174 |
+
.entry-content .review-summary-title,
|
175 |
+
#content .review-summary-title {
|
176 |
+
margin-bottom: 5px;
|
177 |
+
}
|
178 |
+
|
179 |
+
#content .review-list {
|
180 |
+
margin: 0;
|
181 |
+
}
|
182 |
+
|
183 |
+
#content .review-desc p:last-child {
|
184 |
+
margin-bottom: 0;
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Basic styling for wp_review_display_total
|
189 |
+
*/
|
190 |
+
.review-total-only {
|
191 |
+
padding: 3px 10px;
|
192 |
+
background: rgba(0, 0, 0, 0.6);
|
193 |
+
color:#fff;
|
194 |
+
font-size:13px;
|
195 |
+
display: inline-block;
|
196 |
+
}
|
197 |
+
.review-total-only .percentage-icon {
|
198 |
+
font-size: inherit;
|
199 |
+
top: 0;
|
200 |
+
}
|
201 |
+
.review-total-only .review-type-star {
|
202 |
+
font-size:12px;
|
203 |
+
padding: 3px 6px;
|
204 |
+
}
|
205 |
+
.review-total-only .review-total-star {
|
206 |
+
font-size:12px;
|
207 |
+
margin: 0;
|
208 |
+
}
|
209 |
+
.review-total-only .review-result-wrapper i {
|
210 |
+
color: #FFF !important;
|
211 |
+
opacity: 0.50;
|
212 |
+
filter: alpha(opacity=50);
|
213 |
+
}
|
214 |
+
.review-total-only .review-result-wrapper .review-result i {
|
215 |
+
opacity: 1;
|
216 |
+
filter: alpha(opacity=100);
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Users review area
|
221 |
+
*/
|
222 |
+
.user-review-area{ border-top: 1px solid #e7e7e7; /*border: none;*/ margin-top: -1.5em; overflow: hidden; padding: 10px; position: relative; clear: both;}
|
223 |
+
.user-total-wrapper{float: left; margin:0; }
|
224 |
+
.review-total-star.allowed-to-rate{float: right; margin:0;margin-right: 10px;}
|
225 |
+
.user-total-wrapper .user-review-title{/*font-size: 20px;*/ font-weight: bold;margin:0;}
|
226 |
+
.user-total-wrapper #mts-user-reviews-total{/*font-size: 20px;*/}
|
227 |
+
/*.user-total-wrapper small{font-size:16px;}*/
|
228 |
+
/*#review.review-wrapper{float: left; width: 45%;}*/
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Font icon
|
232 |
+
*/
|
233 |
+
@font-face {
|
234 |
+
font-family: 'font-star';
|
235 |
+
src: url('../fonts/font-star.eot?75880836');
|
236 |
+
src: url('../fonts/font-star.eot?75880836#iefix') format('embedded-opentype'),
|
237 |
+
url('../fonts/font-star.woff?75880836') format('woff'),
|
238 |
+
url('../fonts/font-star.ttf?75880836') format('truetype'),
|
239 |
+
url('../fonts/font-star.svg?75880836#font-star') format('svg');
|
240 |
+
font-weight: normal;
|
241 |
+
font-style: normal;
|
242 |
+
}
|
243 |
+
|
244 |
+
[class^="mts-icon-"]:before, [class*=" mts-icon-"]:before {
|
245 |
+
font-family: "font-star";
|
246 |
+
font-style: normal;
|
247 |
+
font-weight: normal;
|
248 |
+
speak: none;
|
249 |
+
display: inline-block;
|
250 |
+
text-decoration: inherit;
|
251 |
+
width: 1em;
|
252 |
+
margin-right: 0;
|
253 |
+
text-align: center;
|
254 |
+
font-variant: normal;
|
255 |
+
text-transform: none;
|
256 |
+
line-height: 1em;
|
257 |
+
margin-left: 2px;
|
258 |
+
}
|
259 |
+
|
260 |
+
.mts-icon-star:before { content: '\e800'; }
|
261 |
+
|
262 |
+
@font-face {
|
263 |
+
font-family: 'font-loader';
|
264 |
+
src: url('../fonts/font-loader.eot?75880836');
|
265 |
+
src: url('../fonts/font-loader.eot?75880836#iefix') format('embedded-opentype'),
|
266 |
+
url('../fonts/font-loader.woff?75880836') format('woff'),
|
267 |
+
url('../fonts/font-loader.ttf?75880836') format('truetype'),
|
268 |
+
url('../fonts/font-loader.svg?75880836#font-loader') format('svg');
|
269 |
+
font-weight: normal;
|
270 |
+
font-style: normal;
|
271 |
+
}
|
272 |
+
|
273 |
+
[class*="mts-icon-loader"]:before {
|
274 |
+
font-family: "font-loader";
|
275 |
+
font-style: normal;
|
276 |
+
font-weight: normal;
|
277 |
+
speak: none;
|
278 |
+
|
279 |
+
display: inline-block;
|
280 |
+
text-decoration: inherit;
|
281 |
+
width: 1em;
|
282 |
+
margin-right: .2em;
|
283 |
+
text-align: center;
|
284 |
+
/* opacity: .8; */
|
285 |
+
|
286 |
+
/* For safety - reset parent styles, that can break glyph codes*/
|
287 |
+
font-variant: normal;
|
288 |
+
text-transform: none;
|
289 |
+
|
290 |
+
/* fix buttons height, for twitter bootstrap */
|
291 |
+
line-height: 1em;
|
292 |
+
|
293 |
+
/* Animation center compensation - margins should be symmetric */
|
294 |
+
/* remove if not needed */
|
295 |
+
margin-left: .2em;
|
296 |
+
|
297 |
+
/* you can be more comfortable with increased icons size */
|
298 |
+
/* font-size: 120%; */
|
299 |
+
|
300 |
+
/* Uncomment for 3D effect */
|
301 |
+
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
|
302 |
+
}
|
303 |
+
|
304 |
+
|
305 |
+
|
306 |
+
|
307 |
+
/*
|
308 |
+
Spin Animation For Loader
|
309 |
+
*/
|
310 |
+
|
311 |
+
|
312 |
+
.mts-icon-loader:before { content: '\e800'; } /* '' */
|
313 |
+
|
314 |
+
.animate-spin {
|
315 |
+
-moz-animation: spin 1s infinite linear;
|
316 |
+
-o-animation: spin 1s infinite linear;
|
317 |
+
-webkit-animation: spin 1s infinite linear;
|
318 |
+
animation: spin 1s infinite linear;
|
319 |
+
display: inline-block;
|
320 |
+
}
|
321 |
+
@-moz-keyframes spin {
|
322 |
+
0% {
|
323 |
+
-moz-transform: rotate(0deg);
|
324 |
+
-o-transform: rotate(0deg);
|
325 |
+
-webkit-transform: rotate(0deg);
|
326 |
+
transform: rotate(0deg);
|
327 |
+
}
|
328 |
+
|
329 |
+
100% {
|
330 |
+
-moz-transform: rotate(359deg);
|
331 |
+
-o-transform: rotate(359deg);
|
332 |
+
-webkit-transform: rotate(359deg);
|
333 |
+
transform: rotate(359deg);
|
334 |
+
}
|
335 |
+
}
|
336 |
+
@-webkit-keyframes spin {
|
337 |
+
0% {
|
338 |
+
-moz-transform: rotate(0deg);
|
339 |
+
-o-transform: rotate(0deg);
|
340 |
+
-webkit-transform: rotate(0deg);
|
341 |
+
transform: rotate(0deg);
|
342 |
+
}
|
343 |
+
|
344 |
+
100% {
|
345 |
+
-moz-transform: rotate(359deg);
|
346 |
+
-o-transform: rotate(359deg);
|
347 |
+
-webkit-transform: rotate(359deg);
|
348 |
+
transform: rotate(359deg);
|
349 |
+
}
|
350 |
+
}
|
351 |
+
@-o-keyframes spin {
|
352 |
+
0% {
|
353 |
+
-moz-transform: rotate(0deg);
|
354 |
+
-o-transform: rotate(0deg);
|
355 |
+
-webkit-transform: rotate(0deg);
|
356 |
+
transform: rotate(0deg);
|
357 |
+
}
|
358 |
+
|
359 |
+
100% {
|
360 |
+
-moz-transform: rotate(359deg);
|
361 |
+
-o-transform: rotate(359deg);
|
362 |
+
-webkit-transform: rotate(359deg);
|
363 |
+
transform: rotate(359deg);
|
364 |
+
}
|
365 |
+
}
|
366 |
+
@-ms-keyframes spin {
|
367 |
+
0% {
|
368 |
+
-moz-transform: rotate(0deg);
|
369 |
+
-o-transform: rotate(0deg);
|
370 |
+
-webkit-transform: rotate(0deg);
|
371 |
+
transform: rotate(0deg);
|
372 |
+
}
|
373 |
+
|
374 |
+
100% {
|
375 |
+
-moz-transform: rotate(359deg);
|
376 |
+
-o-transform: rotate(359deg);
|
377 |
+
-webkit-transform: rotate(359deg);
|
378 |
+
transform: rotate(359deg);
|
379 |
+
}
|
380 |
+
}
|
381 |
+
@keyframes spin {
|
382 |
+
0% {
|
383 |
+
-moz-transform: rotate(0deg);
|
384 |
+
-o-transform: rotate(0deg);
|
385 |
+
-webkit-transform: rotate(0deg);
|
386 |
+
transform: rotate(0deg);
|
387 |
+
}
|
388 |
+
|
389 |
+
100% {
|
390 |
+
-moz-transform: rotate(359deg);
|
391 |
+
-o-transform: rotate(359deg);
|
392 |
+
-webkit-transform: rotate(359deg);
|
393 |
+
transform: rotate(359deg);
|
394 |
+
}
|
395 |
+
}
|
396 |
+
|
397 |
+
/*-----------------------------------------------------*/
|
398 |
+
/* Responsvie
|
399 |
+
/*-----------------------------------------------------*/
|
400 |
+
@media screen and (max-width:1040px) {
|
401 |
+
.review-desc { width: 71%;}
|
402 |
+
/*.review-total-wrapper { width: 26.8%; }*/
|
403 |
+
}
|
404 |
+
|
405 |
+
@media screen and (max-width:860px) {
|
406 |
+
.review-desc { width: 66%;}
|
407 |
+
/*.review-total-wrapper { width: 31.8%; }*/
|
408 |
+
}
|
409 |
+
@media screen and (max-width:470px) {
|
410 |
+
.review-desc { padding: 4%; width: 100%;}
|
411 |
+
.review-total-wrapper { width: 100%; margin-right: 0;}
|
412 |
+
.review-total-wrapper span.review-total-box { padding: 10px 0 20px; text-align: left; padding-left: 10px;}
|
413 |
+
.review-total-star { position: absolute; right: 20px; top: 5px;}
|
414 |
+
.user-total-wrapper{width: 96%;}
|
415 |
+
.review-total-star.allowed-to-rate{position: relative; right: auto;left: 0;float: left;}
|
416 |
+
|
417 |
+
}
|
assets/fonts/font-loader.eot
ADDED
Binary file
|
assets/fonts/font-loader.svg
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" standalone="no"?>
|
2 |
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3 |
+
<svg xmlns="http://www.w3.org/2000/svg">
|
4 |
+
<metadata>Copyright (C) 2013 by original authors @ fontello.com</metadata>
|
5 |
+
<defs>
|
6 |
+
<font id="fontello" horiz-adv-x="1000" >
|
7 |
+
<font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
|
8 |
+
<missing-glyph horiz-adv-x="1000" />
|
9 |
+
<glyph glyph-name="spin3" unicode="" d="m494 850c-266 0-483-210-494-472c-1-19 13-20 13-20l84 0c16 0 19 10 19 18c10 199 176 358 378 358c107 0 205-45 273-118l-58-57c-11-12-11-27 5-31l247-50c21-5 46 11 37 44l-58 227c-2 9-16 22-29 13l-65-60c-89 91-214 148-352 148z m409-508c-16 0-19-10-19-18c-10-199-176-358-377-358c-108 0-205 45-274 118l59 57c10 12 10 27-5 31l-248 50c-21 5-46-11-37-44l58-227c2-9 16-22 30-13l64 60c89-91 214-148 353-148c265 0 482 210 493 473c1 18-13 19-13 19l-84 0z" horiz-adv-x="1000" />
|
10 |
+
</font>
|
11 |
+
</defs>
|
12 |
+
</svg>
|
assets/fonts/font-loader.ttf
ADDED
Binary file
|
assets/fonts/font-loader.woff
ADDED
Binary file
|
assets/fonts/font-star.eot
ADDED
Binary file
|
assets/fonts/font-star.svg
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" standalone="no"?>
|
2 |
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3 |
+
<svg xmlns="http://www.w3.org/2000/svg">
|
4 |
+
<metadata>Copyright (C) 2013 by original authors @ fontello.com</metadata>
|
5 |
+
<defs>
|
6 |
+
<font id="font-star" horiz-adv-x="1000" >
|
7 |
+
<font-face font-family="font-star" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
|
8 |
+
<missing-glyph horiz-adv-x="1000" />
|
9 |
+
<glyph glyph-name="star" unicode="" d="m929 489q0-12-15-27l-203-197l48-279q1-4 1-12q0-11-6-19t-17-9q-10 0-22 7l-251 132l-250-132q-13-7-23-7q-11 0-17 9t-6 19q0 4 1 12l48 279l-203 197q-14 15-14 27q0 21 31 26l280 40l126 254q11 23 27 23t28-23l125-254l280-40q32-5 32-26z" horiz-adv-x="928.6" />
|
10 |
+
</font>
|
11 |
+
</defs>
|
12 |
+
</svg>
|
assets/fonts/font-star.ttf
ADDED
Binary file
|
assets/fonts/font-star.woff
ADDED
Binary file
|
assets/images/bigthumb.png
ADDED
Binary file
|
assets/images/smallthumb.png
ADDED
Binary file
|
assets/js/admin.js
ADDED
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var $ = jQuery.noConflict();
|
2 |
+
$(document).ready(function() {
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Repeatable field
|
6 |
+
*/
|
7 |
+
$('#add-row').on('click', function(e) {
|
8 |
+
e.preventDefault();
|
9 |
+
var row = $('.empty-row.screen-reader-text').clone(true);
|
10 |
+
row.removeClass('empty-row screen-reader-text');
|
11 |
+
row.insertBefore('#wp-review-item tbody>tr:last');
|
12 |
+
row.find("[name='wp_review_item_star[]']").addClass('review-star');
|
13 |
+
$.review_total();
|
14 |
+
});
|
15 |
+
|
16 |
+
$('.remove-row').on('click', function(e) {
|
17 |
+
e.preventDefault();
|
18 |
+
$(this).parents('tr').remove();
|
19 |
+
$.review_total();
|
20 |
+
});
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Toggle meta box
|
24 |
+
*/
|
25 |
+
$('#wp-review-metabox-item').hide();
|
26 |
+
$('#wp-review-metabox-heading').hide();
|
27 |
+
$('#wp-review-metabox-desc').hide();
|
28 |
+
$('#wp-review-metabox-userReview').hide();
|
29 |
+
$('#wp_review_shortcode_hint_field').hide();
|
30 |
+
|
31 |
+
$('#wp_review_type').on( 'change', function() {
|
32 |
+
|
33 |
+
$('#wp-review-metabox-item').toggle( $(this).val() != '' );
|
34 |
+
$('#wp-review-metabox-heading').toggle( $(this).val() != '' );
|
35 |
+
$('#wp-review-metabox-desc').toggle( $(this).val() != '' );
|
36 |
+
$('#wp-review-metabox-userReview').toggle( $(this).val() != '' );
|
37 |
+
|
38 |
+
if ( $(this).val() == 'point' ) {
|
39 |
+
$('.dynamic-text').text('Points (1-10)');
|
40 |
+
}
|
41 |
+
|
42 |
+
if ( $(this).val() == 'star' ) {
|
43 |
+
$('.dynamic-text').text('Star (1-5)');
|
44 |
+
}
|
45 |
+
|
46 |
+
if ( $(this).val() == 'percentage' ) {
|
47 |
+
$('.dynamic-text').text('Percentage (1-100)');
|
48 |
+
}
|
49 |
+
|
50 |
+
$.validate_review_value();
|
51 |
+
|
52 |
+
});
|
53 |
+
|
54 |
+
if ( $('#wp_review_type option:selected').val() === 'star' ) {
|
55 |
+
$('#wp-review-metabox-item').show();
|
56 |
+
$('#wp-review-metabox-heading').show();
|
57 |
+
$('#wp-review-metabox-desc').show();
|
58 |
+
$('#wp-review-metabox-userReview').show();
|
59 |
+
}
|
60 |
+
|
61 |
+
if ( $('#wp_review_type option:selected').val() === 'point' ) {
|
62 |
+
$('.dynamic-text').text('Points (1-10)');
|
63 |
+
$('#wp-review-metabox-item').show();
|
64 |
+
$('#wp-review-metabox-heading').show();
|
65 |
+
$('#wp-review-metabox-desc').show();
|
66 |
+
$('#wp-review-metabox-userReview').show();
|
67 |
+
}
|
68 |
+
|
69 |
+
if ( $('#wp_review_type option:selected').val() === 'percentage' ) {
|
70 |
+
$('.dynamic-text').text('Percentage (1-100)');
|
71 |
+
$('#wp-review-metabox-item').show();
|
72 |
+
$('#wp-review-metabox-heading').show();
|
73 |
+
$('#wp-review-metabox-desc').show();
|
74 |
+
$('#wp-review-metabox-userReview').show();
|
75 |
+
}
|
76 |
+
|
77 |
+
$('#wp_review_location').on('change', function() {
|
78 |
+
$('#wp_review_shortcode_hint_field').toggle($(this).val() == 'custom');
|
79 |
+
});
|
80 |
+
$('#wp_review_shortcode_hint').click(function() {
|
81 |
+
$(this).select();
|
82 |
+
});
|
83 |
+
if ($('#wp_review_location').val() == 'custom') {
|
84 |
+
$('#wp_review_shortcode_hint_field').show();
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Review total
|
89 |
+
*/
|
90 |
+
$.extend({
|
91 |
+
|
92 |
+
review_total: function(){
|
93 |
+
$('.review-star').on( 'change', function () {
|
94 |
+
|
95 |
+
var sum = 0,
|
96 |
+
value = 0,
|
97 |
+
input = $('.review-star').length;
|
98 |
+
|
99 |
+
$('.review-star').each(function () {
|
100 |
+
value = Number($(this).val());
|
101 |
+
if (!isNaN(value)) sum += value / input;
|
102 |
+
});
|
103 |
+
|
104 |
+
$('.wp-review-total').val( Math.round(sum * 10) / 10 );
|
105 |
+
|
106 |
+
$.validate_review_value();
|
107 |
+
|
108 |
+
});
|
109 |
+
|
110 |
+
},
|
111 |
+
|
112 |
+
validate_review_value: function(){
|
113 |
+
|
114 |
+
var type = $('#wp_review_type'),
|
115 |
+
fields = $('input.review-star'),
|
116 |
+
minval = 0,
|
117 |
+
maxval = 999;
|
118 |
+
|
119 |
+
if ( type.val() == 'point' ) {
|
120 |
+
minval = 1;
|
121 |
+
maxval = 10;
|
122 |
+
} else if ( type.val() == 'star' ) {
|
123 |
+
minval = 1;
|
124 |
+
maxval = 5;
|
125 |
+
} else if ( type.val() == 'percentage' ) {
|
126 |
+
minval = 1;
|
127 |
+
maxval = 100;
|
128 |
+
}
|
129 |
+
|
130 |
+
fields.each(function () {
|
131 |
+
var value = Number($(this).val());
|
132 |
+
if ( (value) && (value<minval || value>maxval) )
|
133 |
+
$(this).addClass('review-value-incorrect');
|
134 |
+
else
|
135 |
+
$(this).removeClass('review-value-incorrect');
|
136 |
+
});
|
137 |
+
|
138 |
+
},
|
139 |
+
|
140 |
+
});
|
141 |
+
|
142 |
+
$.review_total();
|
143 |
+
$.validate_review_value();
|
144 |
+
$('.review-star').trigger('change');
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Color picker setup
|
148 |
+
*/
|
149 |
+
$('.wp-review-color').wpColorPicker();
|
150 |
+
|
151 |
+
});
|
assets/js/main.js
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($){
|
2 |
+
$('.review-total-star.allowed-to-rate.has-not-rated-yet a').hover(function(){
|
3 |
+
$(this).addClass( "hovered" ).prevAll().addClass( "hovered" );
|
4 |
+
$('#mts-review-user-rate').val($(this).attr('data-input-value'));
|
5 |
+
},
|
6 |
+
function(){
|
7 |
+
$(this).removeClass( "hovered" ).prevAll().removeClass( "hovered" );
|
8 |
+
$('#mts-review-user-rate').val('');
|
9 |
+
});
|
10 |
+
|
11 |
+
$('.review-total-star.allowed-to-rate.has-not-rated-yet a').on('click', function(){
|
12 |
+
$('.review-total-star.allowed-to-rate .review-result-wrapper').hide();
|
13 |
+
$('.mts-review-wait-msg').show();
|
14 |
+
var blogID = $('#blog_id').val();
|
15 |
+
var userIP = $('#mts-userIP').val();
|
16 |
+
var post_id = $('#post_id').val();
|
17 |
+
var user_id = $('#user_id').val();
|
18 |
+
var review = $(this).attr('data-input-value');
|
19 |
+
$.ajax ({
|
20 |
+
data: {action: 'mts_review_get_review', post_id: post_id, user_id: user_id, ip: userIP, review: review},
|
21 |
+
type: 'post',
|
22 |
+
url: ajaxurl,
|
23 |
+
success: function( response ){
|
24 |
+
if( response != 'MTS_REVIEW_DB_ERROR' ){
|
25 |
+
response = response.split('|');
|
26 |
+
$('#mts-user-reviews-total').html(response[0]);
|
27 |
+
$('#mts-user-reviews-counter').html(response[1]);
|
28 |
+
$('.mts-review-wait-msg').hide();
|
29 |
+
$('.review-total-star.allowed-to-rate .review-result-wrapper').show();
|
30 |
+
$('.review-total-star.allowed-to-rate').removeClass('has-not-rated-yet');
|
31 |
+
$('.review-total-star.allowed-to-rate a, .review-total-star.allowed-to-rate a').off();
|
32 |
+
$('.review-total-wrapper span.review-total-box.hidden').removeClass('hidden').show();
|
33 |
+
var starsWidth = response[0] *20;
|
34 |
+
$('.review-total-star .review-result').css('width', starsWidth+'%');
|
35 |
+
}
|
36 |
+
}
|
37 |
+
});
|
38 |
+
|
39 |
+
});
|
40 |
+
});
|
includes/enqueue.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Custom style for the plugin.
|
4 |
+
*
|
5 |
+
* @since 1.0
|
6 |
+
* @copyright Copyright (c) 2013, MyThemesShop
|
7 |
+
* @author MyThemesShop
|
8 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
9 |
+
*/
|
10 |
+
|
11 |
+
/* Enqueue style for this plugin. */
|
12 |
+
add_action( 'wp_enqueue_scripts', 'wp_review_enqueue' );
|
13 |
+
|
14 |
+
/* IE7 style for the font icon. */
|
15 |
+
add_action( 'wp_head', 'wp_review_ie7' );
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Enqueue style
|
19 |
+
*
|
20 |
+
* @since 1.0
|
21 |
+
*/
|
22 |
+
function wp_review_enqueue() {
|
23 |
+
global $post;
|
24 |
+
if(is_singular()) {
|
25 |
+
/* Retrieve the meta box data. */
|
26 |
+
$type = get_post_meta( $post->ID, 'wp_review_type', true );
|
27 |
+
|
28 |
+
if ( $type != '' ){
|
29 |
+
wp_enqueue_style( 'wp_review-style', trailingslashit( WP_REVIEW_ASSETS ) . 'css/wp-review.css', array(), '1.0', 'all' );
|
30 |
+
wp_enqueue_script( 'wp_review-js', trailingslashit( WP_REVIEW_ASSETS ) . 'js/main.js', array(), '1.0', 'all' );
|
31 |
+
?>
|
32 |
+
<script type="text/javascript">
|
33 |
+
var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
|
34 |
+
</script>
|
35 |
+
<?php
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* IE7 style for the font icon.
|
42 |
+
*
|
43 |
+
* @since 1.0
|
44 |
+
*/
|
45 |
+
function wp_review_ie7() { ?>
|
46 |
+
<!--[if IE 7]>
|
47 |
+
<link rel="stylesheet" href="<?php echo trailingslashit( WP_REVIEW_ASSETS ) . 'css/wp-review-ie7.css'; ?>">
|
48 |
+
<![endif]-->
|
49 |
+
<?php }
|
50 |
+
?>
|
includes/functions.php
ADDED
@@ -0,0 +1,482 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
ob_start();
|
3 |
+
/**
|
4 |
+
* WP Review
|
5 |
+
*
|
6 |
+
* @since 2.0
|
7 |
+
* @copyright Copyright (c) 2013, MyThemesShop
|
8 |
+
* @author MyThemesShop
|
9 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
10 |
+
*/
|
11 |
+
|
12 |
+
/* Display the meta box data below 'the_content' hook. */
|
13 |
+
add_filter( 'the_content', 'wp_review_inject_data' );
|
14 |
+
|
15 |
+
/* Custom review color. */
|
16 |
+
add_action( 'wp_head', 'wp_review_color_output', 20 );
|
17 |
+
|
18 |
+
/* Get review with Ajax */
|
19 |
+
add_action('wp_ajax_mts_review_get_review', 'mts_review_get_review');
|
20 |
+
add_action('wp_ajax_nopriv_mts_review_get_review', 'mts_review_get_review');
|
21 |
+
|
22 |
+
/* Show with shortcode */
|
23 |
+
add_shortcode('wp-review', 'wp_review_get_data');
|
24 |
+
add_shortcode('wp-review-total', 'wp_review_total_shortcode');
|
25 |
+
|
26 |
+
// image sizes for the widgets
|
27 |
+
//add_image_size( 'wp_review_big', 320, 200, true );
|
28 |
+
//add_image_size( 'wp_review_small', 65, 65, true );
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Set new default colors for the WP Review meta boxes.
|
32 |
+
* Passed array doesn't have to contain all values,
|
33 |
+
* it is possible to change values separately, eg.
|
34 |
+
* wp_review_set_default_colors( array( 'font_color' => '#222222' ) );
|
35 |
+
*
|
36 |
+
* To be used in themes & plugins.
|
37 |
+
*
|
38 |
+
* @since 1.0
|
39 |
+
*
|
40 |
+
*/
|
41 |
+
function wp_review_set_default_colors( $colors = array() ) {
|
42 |
+
$current_colors = get_option('wp_review_default_colors', $defaultColors);
|
43 |
+
$colors = wp_parse_args($colors, $current_colors);
|
44 |
+
update_option('wp_review_default_colors', $colors);
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Get the meta box data.
|
50 |
+
*
|
51 |
+
* @since 1.0
|
52 |
+
*
|
53 |
+
*/
|
54 |
+
function wp_review_get_data() {
|
55 |
+
global $post;
|
56 |
+
global $blog_id;
|
57 |
+
|
58 |
+
/* Retrieve the meta box data. */
|
59 |
+
$heading = get_post_meta( $post->ID, 'wp_review_heading', true );
|
60 |
+
$desc = get_post_meta( $post->ID, 'wp_review_desc', true );
|
61 |
+
$items = get_post_meta( $post->ID, 'wp_review_item', true );
|
62 |
+
$type = get_post_meta( $post->ID, 'wp_review_type', true );
|
63 |
+
$total = get_post_meta( $post->ID, 'wp_review_total', true );
|
64 |
+
$allowUsers = get_post_meta( $post->ID, 'wp_review_userReview', true );
|
65 |
+
|
66 |
+
/* Define a custom class for bar type. */
|
67 |
+
$class = '';
|
68 |
+
if ( 'point' == $type ) {
|
69 |
+
$class = 'bar-point';
|
70 |
+
} elseif ( 'percentage' == $type ) {
|
71 |
+
$class = 'percentage-point';
|
72 |
+
}
|
73 |
+
$post_types = get_post_types( array('public' => true), 'names' );
|
74 |
+
$excluded_post_types = array('attachment');
|
75 |
+
$allowed_post_types = array();
|
76 |
+
foreach ($post_types as $i => $post_type) {
|
77 |
+
if (!in_array($post_type, $excluded_post_types)) {
|
78 |
+
$allowed_post_types[] = $post_type;
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Add the custom data from the meta box to the main query an
|
84 |
+
* make sure the hook only apply on single post.
|
85 |
+
*/
|
86 |
+
if ( $type != '' && is_singular($allowed_post_types) && is_main_query() ) {
|
87 |
+
|
88 |
+
|
89 |
+
$review = '<div id="review" class="review-wrapper ' . $class . '" >';
|
90 |
+
|
91 |
+
/* Review title. */
|
92 |
+
if( $heading != '' ){
|
93 |
+
$review .= '<h5 class="review-title">' . __( $heading ) . '</h5>';
|
94 |
+
}
|
95 |
+
|
96 |
+
|
97 |
+
/* Review item. */
|
98 |
+
if ( $items ) {
|
99 |
+
$review .= '<ul class="review-list">';
|
100 |
+
foreach( $items as $item ) {
|
101 |
+
|
102 |
+
$item['wp_review_item_title'] = ( !empty( $item['wp_review_item_title'] ) ) ? $item['wp_review_item_title'] : '';
|
103 |
+
$item['wp_review_item_star'] = ( !empty( $item['wp_review_item_star'] ) ) ? $item['wp_review_item_star'] : '';
|
104 |
+
|
105 |
+
if ( 'star' == $type ) {
|
106 |
+
$result = $item['wp_review_item_star'] * 20;
|
107 |
+
$bestresult = '<meta itemprop="best" content="5"/>';
|
108 |
+
$best = '5';
|
109 |
+
} elseif( 'point' == $type ) {
|
110 |
+
$result = $item['wp_review_item_star'] * 10;
|
111 |
+
$bestresult = '<meta itemprop="best" content="10"/>';
|
112 |
+
$best = '10';
|
113 |
+
} else {
|
114 |
+
$result = $item['wp_review_item_star'] * 100 / 100;
|
115 |
+
$bestresult = '<meta itemprop="best" content="100"/>';
|
116 |
+
$best = '100';
|
117 |
+
}
|
118 |
+
|
119 |
+
$review .= '<li>';
|
120 |
+
|
121 |
+
if ( 'point' == $type ) {
|
122 |
+
$review .= '<span>' . wp_kses_post( $item['wp_review_item_title'] ) . ' - ' . $item['wp_review_item_star'] . '</span>';
|
123 |
+
} elseif( 'percentage' == $type ) {
|
124 |
+
$review .= '<span>' . wp_kses_post( $item['wp_review_item_title'] ) . ' - ' . $item['wp_review_item_star'] . '%' . '</span>';
|
125 |
+
} else {
|
126 |
+
$review .= '<span>' . wp_kses_post( $item['wp_review_item_title'] ) . '</span>';
|
127 |
+
}
|
128 |
+
|
129 |
+
$review .= '<div class="review-star">';
|
130 |
+
$review .= '<div class="review-result-wrapper">';
|
131 |
+
|
132 |
+
if ( 'star' == $type ) {
|
133 |
+
$review .= '<i class="mts-icon-star"></i>';
|
134 |
+
$review .= '<i class="mts-icon-star"></i>';
|
135 |
+
$review .= '<i class="mts-icon-star"></i>';
|
136 |
+
$review .= '<i class="mts-icon-star"></i>';
|
137 |
+
$review .= '<i class="mts-icon-star"></i>';
|
138 |
+
$review .= '<div class="review-result" style="width:' . $result . '%;">';
|
139 |
+
$review .= '<i class="mts-icon-star"></i>';
|
140 |
+
$review .= '<i class="mts-icon-star"></i>';
|
141 |
+
$review .= '<i class="mts-icon-star"></i>';
|
142 |
+
$review .= '<i class="mts-icon-star"></i>';
|
143 |
+
$review .= '<i class="mts-icon-star"></i>';
|
144 |
+
$review .= '</div><!-- .review-result -->';
|
145 |
+
} elseif ( 'point' == $type ) {
|
146 |
+
$review .= '<div class="review-result" style="width:' . $result . '%;">' . $item['wp_review_item_star'] . '</div>';
|
147 |
+
} else {
|
148 |
+
$review .= '<div class="review-result" style="width:' . $result . '%;">' . $item['wp_review_item_star'] . '</div>';
|
149 |
+
}
|
150 |
+
|
151 |
+
$review .= '</div><!-- .review-result-wrapper -->';
|
152 |
+
$review .= '</div><!-- .review-star -->';
|
153 |
+
$review .= '</li>';
|
154 |
+
|
155 |
+
}
|
156 |
+
$review .= '</ul>';
|
157 |
+
}
|
158 |
+
|
159 |
+
/* Review description. */
|
160 |
+
if ( $desc ) {
|
161 |
+
$review .= '<div class="review-desc" >';
|
162 |
+
$review .= '<p class="review-summary-title"><strong>' . __( 'Summary', 'mts-review' ) . '</strong></p>';
|
163 |
+
$review .= wp_kses_post( wpautop( $desc ) );
|
164 |
+
$review .= '</div><!-- .review-desc -->';
|
165 |
+
|
166 |
+
}//**END IF HAS DESCRIPTION**
|
167 |
+
if( $total != '' ){
|
168 |
+
$review .= '<div class="review-total-wrapper"> ';
|
169 |
+
|
170 |
+
if ( 'percentage' == $type ) {
|
171 |
+
$review .= '<span class="review-total-box"><span itemprop="review">' . $total . '</span> <i class="percentage-icon">%</i>' . '</span>';
|
172 |
+
} elseif ( 'point' == $type ) {
|
173 |
+
$review .= '<span class="review-total-box" itemprop="review">' . $total . '/'.__('10','mts-review').'</span></span>';
|
174 |
+
} else {
|
175 |
+
$review .= '<span class="review-total-box" itemprop="review">' . $total . '</span></span>';
|
176 |
+
}
|
177 |
+
|
178 |
+
if ( 'star' == $type ) {
|
179 |
+
$review .= '<div class="review-total-star">';
|
180 |
+
$review .= '<div class="review-result-wrapper">';
|
181 |
+
$review .= '<i class="mts-icon-star"></i>';
|
182 |
+
$review .= '<i class="mts-icon-star"></i>';
|
183 |
+
$review .= '<i class="mts-icon-star"></i>';
|
184 |
+
$review .= '<i class="mts-icon-star"></i>';
|
185 |
+
$review .= '<i class="mts-icon-star"></i>';
|
186 |
+
$review .= '<div class="review-result" style="width:' . $total*20 . '%;">';
|
187 |
+
$review .= '<i class="mts-icon-star"></i>';
|
188 |
+
$review .= '<i class="mts-icon-star"></i>';
|
189 |
+
$review .= '<i class="mts-icon-star"></i>';
|
190 |
+
$review .= '<i class="mts-icon-star"></i>';
|
191 |
+
$review .= '<i class="mts-icon-star"></i>';
|
192 |
+
$review .= '</div><!-- .review-result -->';
|
193 |
+
$review .= '</div><!-- .review-result-wrapper -->';
|
194 |
+
$review .= '</div><!-- .review-star -->';
|
195 |
+
}
|
196 |
+
|
197 |
+
$review .= '</div>';
|
198 |
+
|
199 |
+
|
200 |
+
$review .= '<div itemscope="itemscope" itemtype="http://data-vocabulary.org/Review">
|
201 |
+
<meta itemprop="itemreviewed" content="'.__( $heading ).'">
|
202 |
+
|
203 |
+
<span itemprop="rating" itemscope="itemscope"itemtype="http://data-vocabulary.org/Rating">
|
204 |
+
<meta itemprop="value" content="'.$total.'">
|
205 |
+
<meta itemprop="best" content="'.$best.'">
|
206 |
+
</span>
|
207 |
+
<span itemprop="reviewer" itemscope="itemscope" itemtype="http://data-vocabulary.org/Person">
|
208 |
+
<meta itemprop="name" content="'. get_the_author() .'">
|
209 |
+
</span>
|
210 |
+
</div>';
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* USERS REVIEW AREA
|
215 |
+
*/
|
216 |
+
|
217 |
+
if( is_array( $allowUsers ) && $allowUsers[0] == 1 ){
|
218 |
+
$allowedClass = 'allowed-to-rate';
|
219 |
+
$hasNotRatedClass = 'has-not-rated-yet';
|
220 |
+
$postReviews = mts_get_post_reviews( $post->ID );
|
221 |
+
$userTotal = $postReviews[0]->reviewsAvg;
|
222 |
+
$usersReviewsCount = $postReviews[0]->reviewsNum;
|
223 |
+
|
224 |
+
$review .= '<div style="clear: both;"></div>';
|
225 |
+
|
226 |
+
$review .= '<div class="user-review-area">';
|
227 |
+
|
228 |
+
//$ip = $_SERVER['REMOTE_ADDR'];
|
229 |
+
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
230 |
+
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
231 |
+
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
232 |
+
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
233 |
+
} else {
|
234 |
+
$ip = $_SERVER['REMOTE_ADDR'];
|
235 |
+
}
|
236 |
+
$user_id = '';
|
237 |
+
if ( is_user_logged_in() ) { $user_id = get_current_user_id(); }
|
238 |
+
//echo $blog_id;
|
239 |
+
$review .= '<input type="hidden" id="blog_id" value="'.$blog_id.'">';
|
240 |
+
$review .= '<input type="hidden" id="post_id" value="'.$post->ID.'">';
|
241 |
+
$review .= '<input type="hidden" id="user_id" value="'.$user_id.'">';
|
242 |
+
$review .= '<input type="hidden" id="mts-userIP" value="'.$ip.'">';
|
243 |
+
|
244 |
+
if( $userTotal == '' ) $userTotal = '0.0';
|
245 |
+
$review .= '<div class="user-total-wrapper"><span class="user-review-title">'.__('User Rating','mts-review').': </span><span class="review-total-box"><span id="mts-user-reviews-total">' . $userTotal . '</span> ';
|
246 |
+
$review.= '<small>(<span id="mts-user-reviews-counter" >'.$usersReviewsCount.'</span> '.__('votes', 'mts-review').')</small></span></div>';
|
247 |
+
|
248 |
+
if( hasPreviousReview( $post->ID, $user_id, $ip )) {
|
249 |
+
$hasNotRatedClass = '';
|
250 |
+
}
|
251 |
+
|
252 |
+
$review .= '<div class="review-total-star '.$allowedClass.' '.$hasNotRatedClass.'" >';
|
253 |
+
$review .='<div class="mts-review-wait-msg"><span class="animate-spin mts-icon-loader"></span>'.__('Sending','mts-review').'</div>';
|
254 |
+
$review .= '<div class="review-result-wrapper">';
|
255 |
+
$review .= '<a data-input-value="1" title="1/5"><i class="mts-icon-star"></i></a>';
|
256 |
+
$review .= '<a data-input-value="2" title="2/5"><i class="mts-icon-star"></i></a>';
|
257 |
+
$review .= '<a data-input-value="3" title="3/5"><i class="mts-icon-star"></i></a>';
|
258 |
+
$review .= '<a data-input-value="4" title="4/5"><i class="mts-icon-star"></i></a>';
|
259 |
+
$review .= '<a data-input-value="5" title="5/5"><i class="mts-icon-star"></i></a>';
|
260 |
+
$review .= '<div class="review-result" style="width:' . $userTotal*20 . '%;">';
|
261 |
+
$review .= '<i class="mts-icon-star"></i>';
|
262 |
+
$review .= '<i class="mts-icon-star"></i>';
|
263 |
+
$review .= '<i class="mts-icon-star"></i>';
|
264 |
+
$review .= '<i class="mts-icon-star" style=""></i>';
|
265 |
+
$review .= '<i class="mts-icon-star"></i>';
|
266 |
+
$review .= '</div><!-- .review-result -->';
|
267 |
+
$review .= '</div><!-- .review-result-wrapper -->';
|
268 |
+
$review .= '</div><!-- .review-star -->';
|
269 |
+
$review .= '<input type="hidden" id="mts-review-user-rate" value="" />';
|
270 |
+
|
271 |
+
$review .= '</div>';
|
272 |
+
|
273 |
+
$review .= '<div itemscope itemtype="http://schema.org/Review">
|
274 |
+
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/AggregateRating">
|
275 |
+
<meta itemprop="ratingValue" content="'.$userTotal.'" />
|
276 |
+
<meta itemprop="bestRating" content="5"/>
|
277 |
+
<meta itemprop="ratingCount" content="'.$usersReviewsCount.'" />
|
278 |
+
</div>
|
279 |
+
</div>';
|
280 |
+
|
281 |
+
}//**END IF USERS ALLOWED TO RATE**
|
282 |
+
|
283 |
+
|
284 |
+
$review .= '</div><!-- #review -->';
|
285 |
+
|
286 |
+
return $review;
|
287 |
+
} else {
|
288 |
+
return '';
|
289 |
+
}
|
290 |
+
}
|
291 |
+
|
292 |
+
function wp_review_inject_data( $content ) {
|
293 |
+
global $post;
|
294 |
+
$location = get_post_meta( $post->ID, 'wp_review_location', true );
|
295 |
+
if (empty($location) || $location == 'custom') {
|
296 |
+
return $content;
|
297 |
+
}
|
298 |
+
|
299 |
+
$review = wp_review_get_data();
|
300 |
+
if ( 'bottom' == $location ) {
|
301 |
+
return $content .= $review;
|
302 |
+
} elseif ( 'top' == $location ) {
|
303 |
+
return $review .= $content;
|
304 |
+
} else {
|
305 |
+
return $content;
|
306 |
+
}
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* Retrieve only total rating.
|
311 |
+
* To be used on archive pages, etc.
|
312 |
+
*
|
313 |
+
* @since 1.0
|
314 |
+
*
|
315 |
+
*/
|
316 |
+
function wp_review_show_total($echo = true, $class = 'review-total-only') {
|
317 |
+
global $post;
|
318 |
+
$type = get_post_meta( $post->ID, 'wp_review_type', true );
|
319 |
+
$total = get_post_meta( $post->ID, 'wp_review_total', true );
|
320 |
+
$review = '';
|
321 |
+
|
322 |
+
if (!empty($type) && !empty($total)) {
|
323 |
+
wp_enqueue_style( 'wp_review-style', trailingslashit( WP_REVIEW_ASSETS ) . 'css/wp-review.css', array(), '1.0', 'all' );
|
324 |
+
|
325 |
+
$review = '<div class="review-type-'.$type.' '.esc_attr($class).'"> ';
|
326 |
+
|
327 |
+
if ( 'percentage' == $type ) {
|
328 |
+
$review .= '<span class="review-total-box"><span itemprop="review">' . $total . '</span> <i class="percentage-icon">%</i>' . '</span>';
|
329 |
+
} elseif ( 'point' == $type ) {
|
330 |
+
$review .= '<span class="review-total-box" itemprop="review">' . $total . '</span>/'.__('10','mts-review').'</span>';
|
331 |
+
} else {
|
332 |
+
// star
|
333 |
+
$review .= '<div class="review-total-star">';
|
334 |
+
$review .= '<div class="review-result-wrapper">';
|
335 |
+
$review .= '<i class="mts-icon-star"></i>';
|
336 |
+
$review .= '<i class="mts-icon-star"></i>';
|
337 |
+
$review .= '<i class="mts-icon-star"></i>';
|
338 |
+
$review .= '<i class="mts-icon-star"></i>';
|
339 |
+
$review .= '<i class="mts-icon-star"></i>';
|
340 |
+
$review .= '<div class="review-result" style="width:' . $total*22 . '%;">';
|
341 |
+
$review .= '<i class="mts-icon-star"></i>';
|
342 |
+
$review .= '<i class="mts-icon-star"></i>';
|
343 |
+
$review .= '<i class="mts-icon-star"></i>';
|
344 |
+
$review .= '<i class="mts-icon-star"></i>';
|
345 |
+
$review .= '<i class="mts-icon-star"></i>';
|
346 |
+
$review .= '</div><!-- .review-result -->';
|
347 |
+
$review .= '</div><!-- .review-result-wrapper -->';
|
348 |
+
$review .= '</div><!-- .review-star -->';
|
349 |
+
}
|
350 |
+
|
351 |
+
$review .= '</div>';
|
352 |
+
}
|
353 |
+
|
354 |
+
if ($echo)
|
355 |
+
echo $review;
|
356 |
+
else
|
357 |
+
return $review;
|
358 |
+
}
|
359 |
+
function wp_review_total_shortcode($atts, $content) {
|
360 |
+
if (empty($atts['class']))
|
361 |
+
$atts['class'] = 'review-total-only review-total-shortcode';
|
362 |
+
|
363 |
+
return wp_review_show_total(false, $atts['class']);
|
364 |
+
}
|
365 |
+
|
366 |
+
function mts_get_post_reviews( $post_id ){
|
367 |
+
if( is_numeric( $post_id ) && $post_id > 0 ){
|
368 |
+
global $wpdb;
|
369 |
+
global $blog_id;
|
370 |
+
$table_name = $wpdb->prefix . MTS_WP_REVIEW_DB_TABLE;
|
371 |
+
if (function_exists('is_multisite') && is_multisite()) {$table_name = $wpdb->base_prefix . MTS_WP_REVIEW_DB_TABLE;}
|
372 |
+
$reviews = $wpdb->get_results( $wpdb->prepare("SELECT ROUND( AVG(rate) ,1 ) as reviewsAvg, COUNT(id) as reviewsNum FROM $table_name WHERE blog_id = '%d' AND post_id = '%d'", $blog_id, $post_id) );
|
373 |
+
return $reviews;
|
374 |
+
}
|
375 |
+
}
|
376 |
+
|
377 |
+
|
378 |
+
/**
|
379 |
+
* Star review color
|
380 |
+
*
|
381 |
+
* @since 1.0
|
382 |
+
*/
|
383 |
+
function wp_review_color_output() {
|
384 |
+
global $post;
|
385 |
+
|
386 |
+
/* Retrieve the meta box data. */
|
387 |
+
if(is_singular()) {
|
388 |
+
$color = get_post_meta( $post->ID, 'wp_review_color', true );
|
389 |
+
$type = get_post_meta( $post->ID, 'wp_review_type', true );
|
390 |
+
$fontcolor = get_post_meta( $post->ID, 'wp_review_fontcolor', true );
|
391 |
+
$bgcolor1 = get_post_meta( $post->ID, 'wp_review_bgcolor1', true );
|
392 |
+
$bgcolor2 = get_post_meta( $post->ID, 'wp_review_bgcolor2', true );
|
393 |
+
$bordercolor = get_post_meta( $post->ID, 'wp_review_bordercolor', true );
|
394 |
+
$total = get_post_meta( $post->ID, 'wp_review_total', true );
|
395 |
+
|
396 |
+
if( !$color ) $color = '#333333';
|
397 |
+
|
398 |
+
if( $color ) {
|
399 |
+
echo '<style type="text/css">';
|
400 |
+
|
401 |
+
if ( 'star' == $type ) { ?>
|
402 |
+
|
403 |
+
.review-result-wrapper .review-result i { color: <?php echo $color; ?>; opacity: 1; filter: alpha(opacity=100); }
|
404 |
+
.review-result-wrapper i{ color: <?php echo $color; ?>; opacity: 0.50; filter: alpha(opacity=50); }
|
405 |
+
|
406 |
+
<?php } elseif ( 'point' == $type ) { ?>
|
407 |
+
|
408 |
+
.bar-point .review-result { background-color: <?php echo $color; ?>; }
|
409 |
+
|
410 |
+
<?php } else { ?>
|
411 |
+
|
412 |
+
.percentage-point .review-result { background-color: <?php echo $color; ?>; }
|
413 |
+
|
414 |
+
<?php }
|
415 |
+
?>
|
416 |
+
.review-wrapper, .review-title, .review-desc p{ color: <?php echo $fontcolor; ?>;}
|
417 |
+
.review-list li, .review-wrapper{ background: <?php echo $bgcolor2; ?>;}
|
418 |
+
.review-title, .review-list li:nth-child(2n){background: <?php echo $bgcolor1; ?>;}
|
419 |
+
|
420 |
+
.bar-point .allowed-to-rate .review-result, .percentage-point .allowed-to-rate .review-result{background: none;}
|
421 |
+
.review-total-star.allowed-to-rate a i { color: <?php echo $color; ?>; opacity: 0.50; filter: alpha(opacity=50); }
|
422 |
+
.bar-point .allowed-to-rate .review-result, .percentage-point .allowed-to-rate .review-result{text-indent:0;}
|
423 |
+
.bar-point .allowed-to-rate .review-result i, .percentage-point .allowed-to-rate .review-result i, .mts-user-review-star-container .selected i { color: <?php echo $color; ?>; opacity: 1; filter: alpha(opacity=100); }
|
424 |
+
.review-wrapper, .review-title, .review-list li, .review-list li:last-child, .user-review-area{border-color: <?php echo $bordercolor; ?>;}
|
425 |
+
<?php
|
426 |
+
if( $total == '' ){?>
|
427 |
+
.user-review-area{border: 1px solid <?php echo $bordercolor; ?>; margin-top: 0px;}
|
428 |
+
.review-desc{width: 100%;}
|
429 |
+
.review-wrapper{border: none; overflow: visible;}
|
430 |
+
<?php }
|
431 |
+
echo '</style>';
|
432 |
+
}
|
433 |
+
}
|
434 |
+
}
|
435 |
+
|
436 |
+
/**
|
437 |
+
*Check if user has reviewed this post previously
|
438 |
+
*/
|
439 |
+
function hasPreviousReview( $post_id, $user_id, $ip ){
|
440 |
+
if( is_numeric( $post_id ) && $post_id > 0 ){
|
441 |
+
global $wpdb;
|
442 |
+
global $blog_id;
|
443 |
+
$table_name = $wpdb->prefix . MTS_WP_REVIEW_DB_TABLE;
|
444 |
+
if (function_exists('is_multisite') && is_multisite()) {$table_name = $wpdb->base_prefix . MTS_WP_REVIEW_DB_TABLE;}
|
445 |
+
if( is_numeric( $user_id ) && $user_id > 0 ){
|
446 |
+
$prevRates = $wpdb->get_row( $wpdb->prepare("SELECT COUNT(id) as reviewsNum FROM $table_name WHERE blog_id = '%d' AND post_id = '%d' AND user_id = '%d'", $blog_id, $post_id, $user_id) );
|
447 |
+
if( $prevRates->reviewsNum > 0 ) return true; else return false;
|
448 |
+
}
|
449 |
+
elseif( $ip != '' ){
|
450 |
+
$prevRates = $wpdb->get_row( $wpdb->prepare("SELECT COUNT(id) as reviewsNum FROM $table_name WHERE blog_id = '%d' AND post_id = '%d' AND user_ip = '%s' AND user_id = '0'", $blog_id, $post_id, $ip) );
|
451 |
+
if( $prevRates->reviewsNum > 0 ) return true; else return false;
|
452 |
+
}
|
453 |
+
else return false;
|
454 |
+
}
|
455 |
+
return false;
|
456 |
+
}
|
457 |
+
|
458 |
+
|
459 |
+
/**
|
460 |
+
*Get review with Ajax
|
461 |
+
*/
|
462 |
+
function mts_review_get_review(){
|
463 |
+
global $wpdb;
|
464 |
+
|
465 |
+
$table_name = $wpdb->prefix . MTS_WP_REVIEW_DB_TABLE;
|
466 |
+
if (function_exists('is_multisite') && is_multisite()) {$table_name = $wpdb->base_prefix . MTS_WP_REVIEW_DB_TABLE;}
|
467 |
+
|
468 |
+
global $blog_id;
|
469 |
+
$post_id = $_POST['post_id'];
|
470 |
+
$user_id = $_POST['user_id'];
|
471 |
+
$uip = $_POST['ip'];
|
472 |
+
$data = $_POST['review'];
|
473 |
+
|
474 |
+
if( $rows_affected = $wpdb->insert( $table_name, array('blog_id' => $blog_id, 'post_id' => $post_id, 'user_id' => $user_id, 'user_ip' => $uip, 'rate' => $data, 'date' => current_time('mysql')) ) ){
|
475 |
+
$reviews = $wpdb->get_row( $wpdb->prepare("SELECT ROUND( AVG(rate) ,1 ) as reviewsAvg, COUNT(id) as reviewsNum FROM $table_name WHERE blog_id = '%d' AND post_id = '%d'", $blog_id, $post_id) );
|
476 |
+
echo $reviews->reviewsAvg.'|'.$reviews->reviewsNum;
|
477 |
+
}
|
478 |
+
else echo 'MTS_REVIEW_DB_ERROR';
|
479 |
+
exit;
|
480 |
+
}
|
481 |
+
|
482 |
+
?>
|
languages/default.mo
ADDED
Binary file
|
languages/default.po
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: WP Review Plugin\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2014-01-01 02:07+0530\n"
|
6 |
+
"PO-Revision-Date: 2014-01-01 02:07+0530\n"
|
7 |
+
"Last-Translator: MyThemeShop <support-team@mythemeshop.com>\n"
|
8 |
+
"Language-Team: MyThemeShop\n"
|
9 |
+
"Language: en_US\n"
|
10 |
+
"MIME-Version: 1.0\n"
|
11 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
+
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"X-Poedit-KeywordsList: __;_e\n"
|
14 |
+
"X-Poedit-Basepath: .\n"
|
15 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
16 |
+
"X-Generator: Poedit 1.6.2\n"
|
17 |
+
"X-Poedit-SearchPath-0: .\n"
|
18 |
+
|
19 |
+
#: admin/metaboxes.php:26
|
20 |
+
msgid "Review"
|
21 |
+
msgstr ""
|
22 |
+
|
23 |
+
#: admin/metaboxes.php:35
|
24 |
+
msgid "Review Item"
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: admin/metaboxes.php:44
|
28 |
+
msgid "Review Description"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: admin/metaboxes.php:69
|
32 |
+
msgid "Review Type"
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: admin/metaboxes.php:71
|
36 |
+
msgid "No Review"
|
37 |
+
msgstr ""
|
38 |
+
|
39 |
+
#: admin/metaboxes.php:72
|
40 |
+
msgid "Star"
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
#: admin/metaboxes.php:73
|
44 |
+
msgid "Point"
|
45 |
+
msgstr ""
|
46 |
+
|
47 |
+
#: admin/metaboxes.php:74
|
48 |
+
msgid "Percentage"
|
49 |
+
msgstr ""
|
50 |
+
|
51 |
+
#: admin/metaboxes.php:99
|
52 |
+
msgid "Review Location"
|
53 |
+
msgstr ""
|
54 |
+
|
55 |
+
#: admin/metaboxes.php:101
|
56 |
+
msgid "After Content"
|
57 |
+
msgstr ""
|
58 |
+
|
59 |
+
#: admin/metaboxes.php:102
|
60 |
+
msgid "Before Content"
|
61 |
+
msgstr ""
|
62 |
+
|
63 |
+
#: admin/metaboxes.php:107
|
64 |
+
msgid "Review Color"
|
65 |
+
msgstr ""
|
66 |
+
|
67 |
+
#: admin/metaboxes.php:116
|
68 |
+
msgid "Feature Name"
|
69 |
+
msgstr ""
|
70 |
+
|
71 |
+
#: admin/metaboxes.php:117
|
72 |
+
msgid "Star (1-5)"
|
73 |
+
msgstr ""
|
74 |
+
|
75 |
+
#: admin/metaboxes.php:134 admin/metaboxes.php:144 admin/metaboxes.php:153
|
76 |
+
msgid "Delete"
|
77 |
+
msgstr ""
|
78 |
+
|
79 |
+
#: admin/metaboxes.php:162
|
80 |
+
msgid "Add another"
|
81 |
+
msgstr ""
|
82 |
+
|
83 |
+
#: admin/metaboxes.php:166
|
84 |
+
msgid "Total"
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: includes/functions.php:52
|
88 |
+
msgid "Review Overview"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: includes/functions.php:117
|
92 |
+
msgid "Summary"
|
93 |
+
msgstr ""
|
license.txt
ADDED
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 2, June 1991
|
3 |
+
|
4 |
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
5 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6 |
+
Everyone is permitted to copy and distribute verbatim copies
|
7 |
+
of this license document, but changing it is not allowed.
|
8 |
+
|
9 |
+
Preamble
|
10 |
+
|
11 |
+
The licenses for most software are designed to take away your
|
12 |
+
freedom to share and change it. By contrast, the GNU General Public
|
13 |
+
License is intended to guarantee your freedom to share and change free
|
14 |
+
software--to make sure the software is free for all its users. This
|
15 |
+
General Public License applies to most of the Free Software
|
16 |
+
Foundation's software and to any other program whose authors commit to
|
17 |
+
using it. (Some other Free Software Foundation software is covered by
|
18 |
+
the GNU Lesser General Public License instead.) You can apply it to
|
19 |
+
your programs, too.
|
20 |
+
|
21 |
+
When we speak of free software, we are referring to freedom, not
|
22 |
+
price. Our General Public Licenses are designed to make sure that you
|
23 |
+
have the freedom to distribute copies of free software (and charge for
|
24 |
+
this service if you wish), that you receive source code or can get it
|
25 |
+
if you want it, that you can change the software or use pieces of it
|
26 |
+
in new free programs; and that you know you can do these things.
|
27 |
+
|
28 |
+
To protect your rights, we need to make restrictions that forbid
|
29 |
+
anyone to deny you these rights or to ask you to surrender the rights.
|
30 |
+
These restrictions translate to certain responsibilities for you if you
|
31 |
+
distribute copies of the software, or if you modify it.
|
32 |
+
|
33 |
+
For example, if you distribute copies of such a program, whether
|
34 |
+
gratis or for a fee, you must give the recipients all the rights that
|
35 |
+
you have. You must make sure that they, too, receive or can get the
|
36 |
+
source code. And you must show them these terms so they know their
|
37 |
+
rights.
|
38 |
+
|
39 |
+
We protect your rights with two steps: (1) copyright the software, and
|
40 |
+
(2) offer you this license which gives you legal permission to copy,
|
41 |
+
distribute and/or modify the software.
|
42 |
+
|
43 |
+
Also, for each author's protection and ours, we want to make certain
|
44 |
+
that everyone understands that there is no warranty for this free
|
45 |
+
software. If the software is modified by someone else and passed on, we
|
46 |
+
want its recipients to know that what they have is not the original, so
|
47 |
+
that any problems introduced by others will not reflect on the original
|
48 |
+
authors' reputations.
|
49 |
+
|
50 |
+
Finally, any free program is threatened constantly by software
|
51 |
+
patents. We wish to avoid the danger that redistributors of a free
|
52 |
+
program will individually obtain patent licenses, in effect making the
|
53 |
+
program proprietary. To prevent this, we have made it clear that any
|
54 |
+
patent must be licensed for everyone's free use or not licensed at all.
|
55 |
+
|
56 |
+
The precise terms and conditions for copying, distribution and
|
57 |
+
modification follow.
|
58 |
+
|
59 |
+
GNU GENERAL PUBLIC LICENSE
|
60 |
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61 |
+
|
62 |
+
0. This License applies to any program or other work which contains
|
63 |
+
a notice placed by the copyright holder saying it may be distributed
|
64 |
+
under the terms of this General Public License. The "Program", below,
|
65 |
+
refers to any such program or work, and a "work based on the Program"
|
66 |
+
means either the Program or any derivative work under copyright law:
|
67 |
+
that is to say, a work containing the Program or a portion of it,
|
68 |
+
either verbatim or with modifications and/or translated into another
|
69 |
+
language. (Hereinafter, translation is included without limitation in
|
70 |
+
the term "modification".) Each licensee is addressed as "you".
|
71 |
+
|
72 |
+
Activities other than copying, distribution and modification are not
|
73 |
+
covered by this License; they are outside its scope. The act of
|
74 |
+
running the Program is not restricted, and the output from the Program
|
75 |
+
is covered only if its contents constitute a work based on the
|
76 |
+
Program (independent of having been made by running the Program).
|
77 |
+
Whether that is true depends on what the Program does.
|
78 |
+
|
79 |
+
1. You may copy and distribute verbatim copies of the Program's
|
80 |
+
source code as you receive it, in any medium, provided that you
|
81 |
+
conspicuously and appropriately publish on each copy an appropriate
|
82 |
+
copyright notice and disclaimer of warranty; keep intact all the
|
83 |
+
notices that refer to this License and to the absence of any warranty;
|
84 |
+
and give any other recipients of the Program a copy of this License
|
85 |
+
along with the Program.
|
86 |
+
|
87 |
+
You may charge a fee for the physical act of transferring a copy, and
|
88 |
+
you may at your option offer warranty protection in exchange for a fee.
|
89 |
+
|
90 |
+
2. You may modify your copy or copies of the Program or any portion
|
91 |
+
of it, thus forming a work based on the Program, and copy and
|
92 |
+
distribute such modifications or work under the terms of Section 1
|
93 |
+
above, provided that you also meet all of these conditions:
|
94 |
+
|
95 |
+
a) You must cause the modified files to carry prominent notices
|
96 |
+
stating that you changed the files and the date of any change.
|
97 |
+
|
98 |
+
b) You must cause any work that you distribute or publish, that in
|
99 |
+
whole or in part contains or is derived from the Program or any
|
100 |
+
part thereof, to be licensed as a whole at no charge to all third
|
101 |
+
parties under the terms of this License.
|
102 |
+
|
103 |
+
c) If the modified program normally reads commands interactively
|
104 |
+
when run, you must cause it, when started running for such
|
105 |
+
interactive use in the most ordinary way, to print or display an
|
106 |
+
announcement including an appropriate copyright notice and a
|
107 |
+
notice that there is no warranty (or else, saying that you provide
|
108 |
+
a warranty) and that users may redistribute the program under
|
109 |
+
these conditions, and telling the user how to view a copy of this
|
110 |
+
License. (Exception: if the Program itself is interactive but
|
111 |
+
does not normally print such an announcement, your work based on
|
112 |
+
the Program is not required to print an announcement.)
|
113 |
+
|
114 |
+
These requirements apply to the modified work as a whole. If
|
115 |
+
identifiable sections of that work are not derived from the Program,
|
116 |
+
and can be reasonably considered independent and separate works in
|
117 |
+
themselves, then this License, and its terms, do not apply to those
|
118 |
+
sections when you distribute them as separate works. But when you
|
119 |
+
distribute the same sections as part of a whole which is a work based
|
120 |
+
on the Program, the distribution of the whole must be on the terms of
|
121 |
+
this License, whose permissions for other licensees extend to the
|
122 |
+
entire whole, and thus to each and every part regardless of who wrote it.
|
123 |
+
|
124 |
+
Thus, it is not the intent of this section to claim rights or contest
|
125 |
+
your rights to work written entirely by you; rather, the intent is to
|
126 |
+
exercise the right to control the distribution of derivative or
|
127 |
+
collective works based on the Program.
|
128 |
+
|
129 |
+
In addition, mere aggregation of another work not based on the Program
|
130 |
+
with the Program (or with a work based on the Program) on a volume of
|
131 |
+
a storage or distribution medium does not bring the other work under
|
132 |
+
the scope of this License.
|
133 |
+
|
134 |
+
3. You may copy and distribute the Program (or a work based on it,
|
135 |
+
under Section 2) in object code or executable form under the terms of
|
136 |
+
Sections 1 and 2 above provided that you also do one of the following:
|
137 |
+
|
138 |
+
a) Accompany it with the complete corresponding machine-readable
|
139 |
+
source code, which must be distributed under the terms of Sections
|
140 |
+
1 and 2 above on a medium customarily used for software interchange; or,
|
141 |
+
|
142 |
+
b) Accompany it with a written offer, valid for at least three
|
143 |
+
years, to give any third party, for a charge no more than your
|
144 |
+
cost of physically performing source distribution, a complete
|
145 |
+
machine-readable copy of the corresponding source code, to be
|
146 |
+
distributed under the terms of Sections 1 and 2 above on a medium
|
147 |
+
customarily used for software interchange; or,
|
148 |
+
|
149 |
+
c) Accompany it with the information you received as to the offer
|
150 |
+
to distribute corresponding source code. (This alternative is
|
151 |
+
allowed only for noncommercial distribution and only if you
|
152 |
+
received the program in object code or executable form with such
|
153 |
+
an offer, in accord with Subsection b above.)
|
154 |
+
|
155 |
+
The source code for a work means the preferred form of the work for
|
156 |
+
making modifications to it. For an executable work, complete source
|
157 |
+
code means all the source code for all modules it contains, plus any
|
158 |
+
associated interface definition files, plus the scripts used to
|
159 |
+
control compilation and installation of the executable. However, as a
|
160 |
+
special exception, the source code distributed need not include
|
161 |
+
anything that is normally distributed (in either source or binary
|
162 |
+
form) with the major components (compiler, kernel, and so on) of the
|
163 |
+
opereview system on which the executable runs, unless that component
|
164 |
+
itself accompanies the executable.
|
165 |
+
|
166 |
+
If distribution of executable or object code is made by offering
|
167 |
+
access to copy from a designated place, then offering equivalent
|
168 |
+
access to copy the source code from the same place counts as
|
169 |
+
distribution of the source code, even though third parties are not
|
170 |
+
compelled to copy the source along with the object code.
|
171 |
+
|
172 |
+
4. You may not copy, modify, sublicense, or distribute the Program
|
173 |
+
except as expressly provided under this License. Any attempt
|
174 |
+
otherwise to copy, modify, sublicense or distribute the Program is
|
175 |
+
void, and will automatically terminate your rights under this License.
|
176 |
+
However, parties who have received copies, or rights, from you under
|
177 |
+
this License will not have their licenses terminated so long as such
|
178 |
+
parties remain in full compliance.
|
179 |
+
|
180 |
+
5. You are not required to accept this License, since you have not
|
181 |
+
signed it. However, nothing else grants you permission to modify or
|
182 |
+
distribute the Program or its derivative works. These actions are
|
183 |
+
prohibited by law if you do not accept this License. Therefore, by
|
184 |
+
modifying or distributing the Program (or any work based on the
|
185 |
+
Program), you indicate your acceptance of this License to do so, and
|
186 |
+
all its terms and conditions for copying, distributing or modifying
|
187 |
+
the Program or works based on it.
|
188 |
+
|
189 |
+
6. Each time you redistribute the Program (or any work based on the
|
190 |
+
Program), the recipient automatically receives a license from the
|
191 |
+
original licensor to copy, distribute or modify the Program subject to
|
192 |
+
these terms and conditions. You may not impose any further
|
193 |
+
restrictions on the recipients' exercise of the rights granted herein.
|
194 |
+
You are not responsible for enforcing compliance by third parties to
|
195 |
+
this License.
|
196 |
+
|
197 |
+
7. If, as a consequence of a court judgment or allegation of patent
|
198 |
+
infringement or for any other reason (not limited to patent issues),
|
199 |
+
conditions are imposed on you (whether by court order, agreement or
|
200 |
+
otherwise) that contradict the conditions of this License, they do not
|
201 |
+
excuse you from the conditions of this License. If you cannot
|
202 |
+
distribute so as to satisfy simultaneously your obligations under this
|
203 |
+
License and any other pertinent obligations, then as a consequence you
|
204 |
+
may not distribute the Program at all. For example, if a patent
|
205 |
+
license would not permit royalty-free redistribution of the Program by
|
206 |
+
all those who receive copies directly or indirectly through you, then
|
207 |
+
the only way you could satisfy both it and this License would be to
|
208 |
+
refrain entirely from distribution of the Program.
|
209 |
+
|
210 |
+
If any portion of this section is held invalid or unenforceable under
|
211 |
+
any particular circumstance, the balance of the section is intended to
|
212 |
+
apply and the section as a whole is intended to apply in other
|
213 |
+
circumstances.
|
214 |
+
|
215 |
+
It is not the purpose of this section to induce you to infringe any
|
216 |
+
patents or other property right claims or to contest validity of any
|
217 |
+
such claims; this section has the sole purpose of protecting the
|
218 |
+
integrity of the free software distribution system, which is
|
219 |
+
implemented by public license practices. Many people have made
|
220 |
+
generous contributions to the wide range of software distributed
|
221 |
+
through that system in reliance on consistent application of that
|
222 |
+
system; it is up to the author/donor to decide if he or she is willing
|
223 |
+
to distribute software through any other system and a licensee cannot
|
224 |
+
impose that choice.
|
225 |
+
|
226 |
+
This section is intended to make thoroughly clear what is believed to
|
227 |
+
be a consequence of the rest of this License.
|
228 |
+
|
229 |
+
8. If the distribution and/or use of the Program is restricted in
|
230 |
+
certain countries either by patents or by copyrighted interfaces, the
|
231 |
+
original copyright holder who places the Program under this License
|
232 |
+
may add an explicit geographical distribution limitation excluding
|
233 |
+
those countries, so that distribution is permitted only in or among
|
234 |
+
countries not thus excluded. In such case, this License incorporates
|
235 |
+
the limitation as if written in the body of this License.
|
236 |
+
|
237 |
+
9. The Free Software Foundation may publish revised and/or new versions
|
238 |
+
of the General Public License from time to time. Such new versions will
|
239 |
+
be similar in spirit to the present version, but may differ in detail to
|
240 |
+
address new problems or concerns.
|
241 |
+
|
242 |
+
Each version is given a distinguishing version number. If the Program
|
243 |
+
specifies a version number of this License which applies to it and "any
|
244 |
+
later version", you have the option of following the terms and conditions
|
245 |
+
either of that version or of any later version published by the Free
|
246 |
+
Software Foundation. If the Program does not specify a version number of
|
247 |
+
this License, you may choose any version ever published by the Free Software
|
248 |
+
Foundation.
|
249 |
+
|
250 |
+
10. If you wish to incorporate parts of the Program into other free
|
251 |
+
programs whose distribution conditions are different, write to the author
|
252 |
+
to ask for permission. For software which is copyrighted by the Free
|
253 |
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
254 |
+
make exceptions for this. Our decision will be guided by the two goals
|
255 |
+
of preserving the free status of all derivatives of our free software and
|
256 |
+
of promoting the sharing and reuse of software generally.
|
257 |
+
|
258 |
+
NO WARRANTY
|
259 |
+
|
260 |
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261 |
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262 |
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263 |
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264 |
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265 |
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266 |
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267 |
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268 |
+
REPAIR OR CORRECTION.
|
269 |
+
|
270 |
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272 |
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273 |
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274 |
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275 |
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276 |
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277 |
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278 |
+
POSSIBILITY OF SUCH DAMAGES.
|
279 |
+
|
280 |
+
END OF TERMS AND CONDITIONS
|
281 |
+
|
282 |
+
How to Apply These Terms to Your New Programs
|
283 |
+
|
284 |
+
If you develop a new program, and you want it to be of the greatest
|
285 |
+
possible use to the public, the best way to achieve this is to make it
|
286 |
+
free software which everyone can redistribute and change under these terms.
|
287 |
+
|
288 |
+
To do so, attach the following notices to the program. It is safest
|
289 |
+
to attach them to the start of each source file to most effectively
|
290 |
+
convey the exclusion of warranty; and each file should have at least
|
291 |
+
the "copyright" line and a pointer to where the full notice is found.
|
292 |
+
|
293 |
+
<one line to give the program's name and a brief idea of what it does.>
|
294 |
+
Copyright (C) <year> <name of author>
|
295 |
+
|
296 |
+
This program is free software; you can redistribute it and/or modify
|
297 |
+
it under the terms of the GNU General Public License as published by
|
298 |
+
the Free Software Foundation; either version 2 of the License, or
|
299 |
+
(at your option) any later version.
|
300 |
+
|
301 |
+
This program is distributed in the hope that it will be useful,
|
302 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
303 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
304 |
+
GNU General Public License for more details.
|
305 |
+
|
306 |
+
You should have received a copy of the GNU General Public License along
|
307 |
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
308 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
309 |
+
|
310 |
+
Also add information on how to contact you by electronic and paper mail.
|
311 |
+
|
312 |
+
If the program is interactive, make it output a short notice like this
|
313 |
+
when it starts in an interactive mode:
|
314 |
+
|
315 |
+
Gnomovision version 69, Copyright (C) year name of author
|
316 |
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
317 |
+
This is free software, and you are welcome to redistribute it
|
318 |
+
under certain conditions; type `show c' for details.
|
319 |
+
|
320 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
321 |
+
parts of the General Public License. Of course, the commands you use may
|
322 |
+
be called something other than `show w' and `show c'; they could even be
|
323 |
+
mouse-clicks or menu items--whatever suits your program.
|
324 |
+
|
325 |
+
You should also get your employer (if you work as a programmer) or your
|
326 |
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
327 |
+
necessary. Here is a sample; alter the names:
|
328 |
+
|
329 |
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
330 |
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
331 |
+
|
332 |
+
<signature of Ty Coon>, 1 April 1989
|
333 |
+
Ty Coon, President of Vice
|
334 |
+
|
335 |
+
This General Public License does not permit incorporeview your program into
|
336 |
+
proprietary programs. If your program is a subroutine library, you may
|
337 |
+
consider it more useful to permit linking proprietary applications with the
|
338 |
+
library. If this is what you want to do, use the GNU Lesser General
|
339 |
+
Public License instead of this License.
|
readme.txt
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== WP Review ===
|
2 |
+
Contributors: mythemeshop
|
3 |
+
Creator's website link: http://mythemeshop.com/
|
4 |
+
Tags: review, wp review, rating, wp rating, user rating, google rating, star rating, product review
|
5 |
+
Requires at least: 3.0.1
|
6 |
+
Tested up to: 3.9
|
7 |
+
Stable tag: 2.0
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
Create reviews! Choose from stars, percentages or points for review scores. Supports Retina Display, WPMU & Unlimited Color Schemes.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
Did you always want to increase the user interaction on your website by rating products/services/anything? We at <a href="http://mythemeshop.com/">MyThemeShop</a> understand your need, & created a premium Review plugin. We are now distributing it for FREE to give back to the WordPress community. We have been given so much by the WordPress community, it's time to give back.
|
16 |
+
|
17 |
+
**WP Review plugin** is an easy yet powerful way to review content easily, without affecting the speed of your site. If you're a blogger, you probably occasionally review or rank products, services, tools, recipes, or other content on your site. WP Review plugin is a customizable and lightweight way to create reviews, using stars, percentage or point rating, and it includes support for translation, WPMU, Google rich snippets and unlimited colors. Just install it and follow the simple configuration instructions to place it in your desired location.
|
18 |
+
|
19 |
+
= Live Demos =
|
20 |
+
See WP Review in action on our demo pages:
|
21 |
+
* <a href="http://demo.mythemeshop.com/spike-gaming/2014/03/12/the-12-most-inspirational-female-characters-in-games/" target="_blank">Star Review Type</a>
|
22 |
+
* <a href="http://demo.mythemeshop.com/spike-wedding/2014/03/13/top-10-wedding-guest-complaints/" target="_blank">Point Review Type</a>
|
23 |
+
* <a href="http://demo.mythemeshop.com/spike-health/2014/02/27/high-calorie-foods-you-should-never-eat-before-going-to-bed/" target="_blank">Percentage Review Type</a>
|
24 |
+
|
25 |
+
= Why WP Review from <a href="http://mythemeshop.com">MyThemeShop</a>: =
|
26 |
+
* Fastest review plugin.
|
27 |
+
* Stars, percentage and point rating system.
|
28 |
+
* Supports Google Rich Snippets(schema.org)
|
29 |
+
* 100% Fluid Responsive.
|
30 |
+
* WP Multisite and Multiuser (WPMU / WPMS / WordPress MU) compatible.
|
31 |
+
* Design it as you want, unlimited color options.
|
32 |
+
* Translation Ready.
|
33 |
+
* Reviews are displayed to visitors in a friendly format.
|
34 |
+
* Completely customizable, including which fields to ask for, require, and show.
|
35 |
+
* Minimal design but could be instantly made modern.
|
36 |
+
* Works with caching plugins and all majority of themes.
|
37 |
+
* Easy to modify the CSS to better fit your theme style.
|
38 |
+
* Support for adding your own custom fields.
|
39 |
+
* Minimalist, lightweight, and efficient code means that your users won’t notice any hiccups.
|
40 |
+
* Position it above or below the content with ease and no coding.
|
41 |
+
* Supports Shortcode `[wp-review]` to show review anywhere in post.
|
42 |
+
|
43 |
+
= Support =
|
44 |
+
We will do our best to provide support through the WordPress forums. However, all plugin support is provided in our forum. If you have not registered yet, you can do so here: <a href="https://mythemeshop.com/go/signup/index/c/free">https://mythemeshop.com/go/signup/index/c/free</a>. After searching the knowledge base and forum if you are still stuck, feel free to open a new thread, and a member of our support team will be happy to help. Cheers!<br>
|
45 |
+
Support link: <a href="http://community.mythemeshop.com/forum/free/plugin-support">http://community.mythemeshop.com/forum/free/plugin-support</a>
|
46 |
+
|
47 |
+
= Developer Zone =
|
48 |
+
Yes, this plugin is so developer friendly, so you could use it with any theme you develop. Define default CSS, custom position, one line integration in your theme's code.
|
49 |
+
|
50 |
+
Show average review in your theme using below function:
|
51 |
+
`<?php if (function_exists('wp_review_show_total')) wp_review_show_total(); ?>`
|
52 |
+
|
53 |
+
GitHub link: <a href="https://github.com/MyThemeShop/WP-Review-by-MyThemeShop">https://github.com/MyThemeShop/WP-Review-by-MyThemeShop</a>
|
54 |
+
|
55 |
+
= Feedback =
|
56 |
+
If you like this plugin, then please leave us a good rating and review.<br> Consider following us on <a rel="author" href="https://plus.google.com/+Mythemeshop/">Google+</a>, <a href="https://twitter.com/MyThemeShopTeam">Twitter</a>, and <a href="https://www.facebook.com/MyThemeShop">Facebook</a>
|
57 |
+
|
58 |
+
== Installation ==
|
59 |
+
|
60 |
+
This section describes how to install the plugin and get it working.
|
61 |
+
|
62 |
+
1. Upload the `wp-review` folder to the to the `/wp-content/plugins/` directory
|
63 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress
|
64 |
+
3. You can see rating options on single post editor.
|
65 |
+
4. Configure the available rating options as you want.
|
66 |
+
|
67 |
+
== Frequently Asked Questions ==
|
68 |
+
|
69 |
+
= User rating not working =
|
70 |
+
|
71 |
+
Please disable all plugins and check if rating is working properly. Then you can enable all plugins one by one to find out which plugin is conflicting with WP Rating plugin.
|
72 |
+
|
73 |
+
== Screenshots ==
|
74 |
+
|
75 |
+
1. Plugin Options
|
76 |
+
2. Plugin Options 2
|
77 |
+
3. Star Review type
|
78 |
+
4. Point Review type
|
79 |
+
5. Percentage Review type
|
80 |
+
|
81 |
+
== Changelog ==
|
82 |
+
|
83 |
+
= 2.0 =
|
84 |
+
* Fixed the, `'` switching in to `/` issue (<a href="http://bit.ly/PFMGAq">http://bit.ly/PFMGAq</a>)
|
85 |
+
* Added `[wp-review]` shortcode to show the ratings anywhere in the content.
|
86 |
+
* Added an option to not show review automatically in the Review Location dropdown.
|
87 |
+
* Added support for Custom post types and pages.
|
88 |
+
* For Developers Added new function for showing only total rating, it could be used in themes' archives. A custom class name can be passed to the function, for easier customization. See `wp_review_show_total()` function in includes/functions.php file. There's also a shortcode for it, just in case: [wp-review-total]
|
89 |
+
* For Developers Added the default colors which appear in the meta boxes are now stored in an option. It can be modified directly with `update_option()`, or using the new `wp_review_set_default_colors()` function, which is also called on plugin activation to set the plugin's default colors.
|
90 |
+
* Made small CSS and responsive improvements.
|
91 |
+
|
92 |
+
= 1.0 =
|
93 |
+
* Official plugin release.
|
wp-review.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: WP Review
|
4 |
+
* Plugin URI: http://mythemeshop.com/
|
5 |
+
* Description: Create reviews! Choose from stars, percentages or points for review scores. Supports Retina Display, WPMU & Unlimited Color Schemes.
|
6 |
+
* Version: 2.0
|
7 |
+
* Author: MyThemesShop
|
8 |
+
* Author URI: http://mythemeshop.com/
|
9 |
+
*
|
10 |
+
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU
|
11 |
+
* General Public License version 2, as published by the Free Software Foundation. You may NOT assume
|
12 |
+
* that you can use any other version of the GPL.
|
13 |
+
*
|
14 |
+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
15 |
+
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
16 |
+
*
|
17 |
+
* @since 1.0
|
18 |
+
* @copyright Copyright (c) 2013, MyThemesShop
|
19 |
+
* @author MyThemesShop
|
20 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
21 |
+
*/
|
22 |
+
|
23 |
+
// Exit if accessed directly
|
24 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
25 |
+
|
26 |
+
/* Sets the custom db table name. */
|
27 |
+
define( 'MTS_WP_REVIEW_DB_TABLE', 'mts_wp_reviews' );
|
28 |
+
|
29 |
+
/* When plugin is activated */
|
30 |
+
register_activation_hook( __FILE__, 'wp_review_activation' );
|
31 |
+
|
32 |
+
|
33 |
+
/* Defines constants used by the plugin. */
|
34 |
+
add_action( 'plugins_loaded', 'wp_review_constants', 1 );
|
35 |
+
|
36 |
+
/* Internationalize the text strings used. */
|
37 |
+
add_action( 'plugins_loaded', 'wp_review_i18n', 2 );
|
38 |
+
|
39 |
+
/* Loads libraries. */
|
40 |
+
add_action( 'plugins_loaded', 'wp_review_includes_libraries', 3 );
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Defines constants.
|
44 |
+
*
|
45 |
+
* @since 1.0
|
46 |
+
*/
|
47 |
+
function wp_review_constants() {
|
48 |
+
|
49 |
+
/* Sets the path to the plugin directory. */
|
50 |
+
define( 'WP_REVIEW_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
|
51 |
+
|
52 |
+
/* Sets the path to the plugin directory URI. */
|
53 |
+
define( 'WP_REVIEW_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );
|
54 |
+
|
55 |
+
/* Sets the path to the `admin` directory. */
|
56 |
+
define( 'WP_REVIEW_ADMIN', WP_REVIEW_DIR . trailingslashit( 'admin' ) );
|
57 |
+
|
58 |
+
/* Sets the path to the `includes` directory. */
|
59 |
+
define( 'WP_REVIEW_INCLUDES', WP_REVIEW_DIR . trailingslashit( 'includes' ) );
|
60 |
+
|
61 |
+
/* Sets the path to the `assets` directory. */
|
62 |
+
define( 'WP_REVIEW_ASSETS', WP_REVIEW_URI . trailingslashit( 'assets' ) );
|
63 |
+
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Internationalize the text strings used.
|
68 |
+
*
|
69 |
+
* @since 1.0
|
70 |
+
*/
|
71 |
+
function wp_review_i18n() {
|
72 |
+
load_plugin_textdomain( 'wp-review', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Loads the initial files needed by the plugin.
|
77 |
+
*
|
78 |
+
* @since 1.0
|
79 |
+
*/
|
80 |
+
function wp_review_includes_libraries() {
|
81 |
+
|
82 |
+
/* Loads the admin functions. */
|
83 |
+
require_once( WP_REVIEW_ADMIN . 'admin.php' );
|
84 |
+
|
85 |
+
/* Loads the meta boxes. */
|
86 |
+
require_once( WP_REVIEW_ADMIN . 'metaboxes.php' );
|
87 |
+
|
88 |
+
/* Loads the front-end functions. */
|
89 |
+
require_once( WP_REVIEW_INCLUDES . 'functions.php' );
|
90 |
+
|
91 |
+
/* Loads the enqueue functions. */
|
92 |
+
require_once( WP_REVIEW_INCLUDES . 'enqueue.php' );
|
93 |
+
|
94 |
+
}
|
95 |
+
|
96 |
+
function wp_review_activation(){
|
97 |
+
/* Loads activation functions */
|
98 |
+
require_once( plugin_dir_path( __FILE__ ) . '/includes/functions.php' );
|
99 |
+
require_once( plugin_dir_path( __FILE__ ) . '/admin/activation.php' );
|
100 |
+
}
|
101 |
+
?>
|