Version Description
- FIXED: yasr_visitor_multiset didn't work
Download this release
Release Info
Developer | Dudo |
Plugin | Yasr – Yet Another Stars Rating |
Version | 1.7.2 |
Comparing to | |
See all releases |
Code changes from version 1.7.1 to 1.7.2
- js/yasr-front.js +1 -1
- lib/yasr-ajax-functions.php +1 -2
- lib/yasr-shortcode-functions.php +1 -3
- readme.txt +4 -1
- yet-another-stars-rating.php +241 -237
js/yasr-front.js
CHANGED
@@ -52,7 +52,7 @@ document.addEventListener('DOMContentLoaded', function(event) {
|
|
52 |
|
53 |
if (typeof yasrMultiSetData !== 'undefined') {
|
54 |
|
55 |
-
|
56 |
|
57 |
}
|
58 |
|
52 |
|
53 |
if (typeof yasrMultiSetData !== 'undefined') {
|
54 |
|
55 |
+
yasrVisitorsMultiSet ();
|
56 |
|
57 |
}
|
58 |
|
lib/yasr-ajax-functions.php
CHANGED
@@ -1202,10 +1202,9 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
1202 |
}
|
1203 |
|
1204 |
if ( ! wp_verify_nonce( $nonce, 'yasr_nonce_insert_visitor_rating_multiset' ) ) {
|
1205 |
-
die( 'Security
|
1206 |
}
|
1207 |
|
1208 |
-
|
1209 |
delete_transient( 'yasr_visitor_multi_set_' . $post_id . '_' . $set_type );
|
1210 |
|
1211 |
global $wpdb;
|
1202 |
}
|
1203 |
|
1204 |
if ( ! wp_verify_nonce( $nonce, 'yasr_nonce_insert_visitor_rating_multiset' ) ) {
|
1205 |
+
die( 'Security Check' );
|
1206 |
}
|
1207 |
|
|
|
1208 |
delete_transient( 'yasr_visitor_multi_set_' . $post_id . '_' . $set_type );
|
1209 |
|
1210 |
global $wpdb;
|
lib/yasr-shortcode-functions.php
CHANGED
@@ -709,12 +709,10 @@ add_shortcode ('yasr_visitor_multiset', 'yasr_visitor_multiset_callback');
|
|
709 |
|
710 |
$shortcode_html.="</table>";
|
711 |
|
712 |
-
$var_ajax_nonce_visitor_multiset = json_encode($ajax_nonce_visitor_multiset);
|
713 |
-
|
714 |
$shortcode_html .= '<!-- End Yasr Multi Set Visitor Shortcode-->';
|
715 |
|
716 |
wp_localize_script( 'yasrfront', "yasrMultiSetData", array(
|
717 |
-
'nonceVisitor' => $
|
718 |
'setType' => $setid
|
719 |
)
|
720 |
);
|
709 |
|
710 |
$shortcode_html.="</table>";
|
711 |
|
|
|
|
|
712 |
$shortcode_html .= '<!-- End Yasr Multi Set Visitor Shortcode-->';
|
713 |
|
714 |
wp_localize_script( 'yasrfront', "yasrMultiSetData", array(
|
715 |
+
'nonceVisitor' => $ajax_nonce_visitor_multiset,
|
716 |
'setType' => $setid
|
717 |
)
|
718 |
);
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Requires at least: 4.3.0
|
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 5.0
|
7 |
Requires PHP: 5.3
|
8 |
-
Stable tag: 1.7.
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
Boost the way people interact with your website, e-commerce or blog with an easy and intuitive WordPress rating system!
|
@@ -108,6 +108,9 @@ Of course not: you can easily add it on the visual editor just by clicking the "
|
|
108 |
|
109 |
The full changelog can be found in the plugin's directory. Recent entries:
|
110 |
|
|
|
|
|
|
|
111 |
= 1.7.1 =
|
112 |
* FIXED: security fix
|
113 |
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 5.0
|
7 |
Requires PHP: 5.3
|
8 |
+
Stable tag: 1.7.2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
Boost the way people interact with your website, e-commerce or blog with an easy and intuitive WordPress rating system!
|
108 |
|
109 |
The full changelog can be found in the plugin's directory. Recent entries:
|
110 |
|
111 |
+
= 1.7.2 =
|
112 |
+
* FIXED: yasr_visitor_multiset didn't work
|
113 |
+
|
114 |
= 1.7.1 =
|
115 |
* FIXED: security fix
|
116 |
|
yet-another-stars-rating.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Yet Another Stars Rating
|
5 |
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
|
6 |
* Description: Yet Another Stars Rating turn your WordPress into a complete review website.
|
7 |
-
* Version: 1.7.
|
8 |
* Author: Dario Curvino
|
9 |
* Author URI: https://yetanotherstarsrating.com/
|
10 |
* Text Domain: yet-another-stars-rating
|
@@ -35,268 +35,272 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
35 |
exit( 'You\'re not allowed to see this page' );
|
36 |
}
|
37 |
// Exit if accessed directly
|
38 |
-
//
|
39 |
-
|
40 |
-
{
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
67 |
}
|
|
|
|
|
68 |
}
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
//
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
//
|
81 |
-
define( "
|
82 |
-
//
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
//
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
$yasr_stored_options = get_option( 'yasr_general_options' );
|
94 |
-
global $yasr_stored_options ;
|
95 |
-
define( "YASR_AUTO_INSERT_ENABLED", $yasr_stored_options['auto_insert_enabled'] );
|
96 |
-
|
97 |
-
if ( YASR_AUTO_INSERT_ENABLED == 1 ) {
|
98 |
-
define( "YASR_AUTO_INSERT_WHAT", $yasr_stored_options['auto_insert_what'] );
|
99 |
-
define( "YASR_AUTO_INSERT_WHERE", $yasr_stored_options['auto_insert_where'] );
|
100 |
-
define( "YASR_AUTO_INSERT_SIZE", $yasr_stored_options['auto_insert_size'] );
|
101 |
-
define( "YASR_AUTO_INSERT_EXCLUDE_PAGES", $yasr_stored_options['auto_insert_exclude_pages'] );
|
102 |
-
define( "YASR_AUTO_INSERT_CUSTOM_POST_ONLY", $yasr_stored_options['auto_insert_custom_post_only'] );
|
103 |
-
} else {
|
104 |
-
define( "YASR_AUTO_INSERT_WHAT", NULL );
|
105 |
-
define( "YASR_AUTO_INSERT_WHERE", NULL );
|
106 |
-
define( "YASR_AUTO_INSERT_SIZE", NULL );
|
107 |
-
define( "YASR_AUTO_INSERT_EXCLUDE_PAGES", NULL );
|
108 |
-
define( "YASR_AUTO_INSERT_CUSTOM_POST_ONLY", NULL );
|
109 |
-
}
|
110 |
-
|
111 |
-
define( "YASR_SHOW_OVERALL_IN_LOOP", $yasr_stored_options['show_overall_in_loop'] );
|
112 |
-
define( "YASR_SHOW_VISITOR_VOTES_IN_LOOP", $yasr_stored_options['show_visitor_votes_in_loop'] );
|
113 |
-
define( "YASR_TEXT_BEFORE_STARS", $yasr_stored_options['text_before_stars'] );
|
114 |
-
|
115 |
-
if ( YASR_TEXT_BEFORE_STARS == 1 ) {
|
116 |
-
define( "YASR_TEXT_BEFORE_OVERALL", $yasr_stored_options['text_before_overall'] );
|
117 |
-
define( "YASR_TEXT_BEFORE_VISITOR_RATING", $yasr_stored_options['text_before_visitor_rating'] );
|
118 |
-
define( "YASR_TEXT_AFTER_VISITOR_RATING", $yasr_stored_options['text_after_visitor_rating'] );
|
119 |
-
define( "YASR_CUSTOM_TEXT_USER_VOTED", $yasr_stored_options['custom_text_user_voted'] );
|
120 |
-
}
|
121 |
-
|
122 |
-
define( "YASR_VISITORS_STATS", $yasr_stored_options['visitors_stats'] );
|
123 |
-
define( "YASR_ALLOWED_USER", $yasr_stored_options['allowed_user'] );
|
124 |
-
define( "YASR_ENABLE_IP", $yasr_stored_options['enable_ip'] );
|
125 |
-
define( "YASR_SNIPPET", $yasr_stored_options['snippet'] );
|
126 |
-
define( "YASR_ITEMTYPE", $yasr_stored_options['snippet_itemtype'] );
|
127 |
-
|
128 |
-
if ( isset( $yasr_stored_options['blogposting_organization_name'] ) ) {
|
129 |
-
define( "YASR_BLOGPOSTING_ORGANIZATION_NAME", $yasr_stored_options['blogposting_organization_name'] );
|
130 |
-
} else {
|
131 |
-
define( "YASR_BLOGPOSTING_ORGANIZATION_NAME", '' );
|
132 |
-
}
|
133 |
-
|
134 |
-
if ( isset( $yasr_stored_options['blogposting_organization_logo'] ) ) {
|
135 |
-
if ( filter_var( $yasr_stored_options['blogposting_organization_logo'], FILTER_VALIDATE_URL ) !== FALSE ) {
|
136 |
-
define( "YASR_BLOGPOSTING_ORGANIZATION_LOGO", $yasr_stored_options['blogposting_organization_logo'] );
|
137 |
-
}
|
138 |
-
}
|
139 |
-
define( "YASR_METABOX_OVERALL_RATING", $yasr_stored_options['metabox_overall_rating'] );
|
140 |
-
define( "YASR_JQUERY_DISABLED", $yasr_stored_options['disable_jquery'] );
|
141 |
-
//Get stored style options
|
142 |
-
$style_options = get_option( 'yasr_style_options' );
|
143 |
-
|
144 |
-
if ( $style_options ) {
|
145 |
|
146 |
-
if (
|
147 |
-
define( "
|
|
|
|
|
|
|
|
|
148 |
} else {
|
149 |
-
define( "
|
|
|
|
|
|
|
|
|
150 |
}
|
151 |
|
|
|
|
|
|
|
152 |
|
153 |
-
if (
|
154 |
-
define( "
|
155 |
-
|
156 |
-
define( "
|
|
|
157 |
}
|
158 |
|
|
|
|
|
|
|
|
|
|
|
159 |
|
160 |
-
if ( isset( $
|
161 |
-
define( "
|
162 |
} else {
|
163 |
-
define( "
|
164 |
}
|
165 |
-
|
166 |
-
} else {
|
167 |
-
define( "YASR_CUSTOM_CSS_RULES", NULL );
|
168 |
-
define( "YASR_SCHEME_COLOR", NULL );
|
169 |
-
define( "YASR_STARS_SET", NULL );
|
170 |
-
}
|
171 |
-
|
172 |
-
//Multi set options
|
173 |
-
$multi_set_options = get_option( 'yasr_multiset_options' );
|
174 |
-
if ( $multi_set_options ) {
|
175 |
|
176 |
-
if ( isset( $
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
}
|
181 |
-
|
182 |
-
}
|
183 |
-
/****** End Getting options ******/
|
184 |
-
// Include function file
|
185 |
-
require YASR_ABSOLUTE_PATH . '/lib/yasr-functions.php';
|
186 |
-
require YASR_ABSOLUTE_PATH . '/lib/yasr-admin-actions.php';
|
187 |
-
require YASR_ABSOLUTE_PATH . '/lib/yasr-settings-functions.php';
|
188 |
-
require YASR_ABSOLUTE_PATH . '/lib/yasr-db-functions.php';
|
189 |
-
require YASR_ABSOLUTE_PATH . '/lib/yasr-ajax-functions.php';
|
190 |
-
require YASR_ABSOLUTE_PATH . '/lib/yasr-shortcode-functions.php';
|
191 |
-
require YASR_ABSOLUTE_PATH . '/lib/yasr-widgets.php';
|
192 |
-
if ( is_admin() ) {
|
193 |
-
require YASR_ABSOLUTE_PATH . '/lib/class-wp-list-table.php';
|
194 |
-
}
|
195 |
-
global $wpdb ;
|
196 |
-
define( "YASR_VOTES_TABLE", $wpdb->prefix . 'yasr_votes' );
|
197 |
-
//Used in background
|
198 |
-
define( "YASR_MULTI_SET_NAME_TABLE", $wpdb->prefix . 'yasr_multi_set' );
|
199 |
-
define( "YASR_MULTI_SET_FIELDS_TABLE", $wpdb->prefix . 'yasr_multi_set_fields' );
|
200 |
-
define( "YASR_MULTI_SET_VALUES_TABLE", $wpdb->prefix . 'yasr_multi_values' );
|
201 |
-
define( "YASR_LOG_TABLE", $wpdb->prefix . 'yasr_log' );
|
202 |
-
define( "YASR_LOADER_IMAGE", YASR_IMG_DIR . "/loader.gif" );
|
203 |
-
$yasr_version_installed = get_option( 'yasr-version' );
|
204 |
-
global $yasr_version_installed ;
|
205 |
-
//Run this only on plugin activation (doesn't work on update)
|
206 |
-
register_activation_hook( __FILE__, 'yasr_on_activation' );
|
207 |
-
function yasr_on_activation()
|
208 |
-
{
|
209 |
-
global $yasr_version_installed ;
|
210 |
-
//If this is a fresh new installation
|
211 |
-
if ( !$yasr_version_installed ) {
|
212 |
-
yasr_install();
|
213 |
}
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
function yasr_update_version()
|
219 |
-
{
|
220 |
-
//do only in admin
|
221 |
|
222 |
-
if (
|
223 |
-
global $wpdb ;
|
224 |
-
global $yasr_version_installed ;
|
225 |
-
global $yasr_stored_options ;
|
226 |
|
227 |
-
if (
|
228 |
-
$
|
229 |
-
|
|
|
230 |
}
|
231 |
|
232 |
|
233 |
-
if (
|
234 |
-
$
|
235 |
-
|
|
|
236 |
}
|
237 |
|
238 |
-
//Remove end DECEMBER 2018
|
239 |
-
//This is a very important update: yasr_votes table will not be used anymore, using post meta instead
|
240 |
|
241 |
-
if (
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
if ( $rating->overall_rating > 0 ) {
|
246 |
-
add_post_meta(
|
247 |
-
$rating->post_id,
|
248 |
-
'yasr_overall_rating',
|
249 |
-
$rating->overall_rating,
|
250 |
-
TRUE
|
251 |
-
);
|
252 |
-
}
|
253 |
-
//add review type only if is not empty
|
254 |
-
if ( $rating->review_type != '' ) {
|
255 |
-
add_post_meta(
|
256 |
-
$rating->post_id,
|
257 |
-
'yasr_review_type',
|
258 |
-
$rating->review_type,
|
259 |
-
TRUE
|
260 |
-
);
|
261 |
-
}
|
262 |
-
}
|
263 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
|
265 |
-
|
266 |
-
|
267 |
-
|
|
|
268 |
}
|
|
|
269 |
}
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
}
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
'
|
286 |
-
'
|
287 |
-
|
288 |
-
|
289 |
-
);
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
|
|
|
|
|
|
|
|
|
|
296 |
}
|
297 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
}
|
299 |
-
|
300 |
-
//this is for user who use extensions
|
301 |
-
//remove on Gen 2019
|
302 |
-
define( 'YASR_EDD_SL_STORE_URL', 'http://yetanotherstarsrating.com' );
|
4 |
* Plugin Name: Yet Another Stars Rating
|
5 |
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
|
6 |
* Description: Yet Another Stars Rating turn your WordPress into a complete review website.
|
7 |
+
* Version: 1.7.2
|
8 |
* Author: Dario Curvino
|
9 |
* Author URI: https://yetanotherstarsrating.com/
|
10 |
* Text Domain: yet-another-stars-rating
|
35 |
exit( 'You\'re not allowed to see this page' );
|
36 |
}
|
37 |
// Exit if accessed directly
|
38 |
+
//Auto disable yasr free when yasr pro is activated
|
39 |
+
|
40 |
+
if ( !function_exists( 'yasr_fs' ) ) {
|
41 |
+
// Create a helper function for easy SDK access.
|
42 |
+
function yasr_fs()
|
43 |
+
{
|
44 |
+
global $yasr_fs ;
|
45 |
+
|
46 |
+
if ( !isset( $yasr_fs ) ) {
|
47 |
+
// Include Freemius SDK.
|
48 |
+
require_once dirname( __FILE__ ) . '/freemius/start.php';
|
49 |
+
try {
|
50 |
+
$yasr_fs = fs_dynamic_init( array(
|
51 |
+
'id' => '256',
|
52 |
+
'slug' => 'yet-another-stars-rating',
|
53 |
+
'type' => 'plugin',
|
54 |
+
'public_key' => 'pk_907af437fd2bd1f123a3b228785a1',
|
55 |
+
'is_premium' => false,
|
56 |
+
'has_addons' => false,
|
57 |
+
'has_paid_plans' => true,
|
58 |
+
'trial' => array(
|
59 |
+
'days' => 14,
|
60 |
+
'is_require_payment' => false,
|
61 |
+
),
|
62 |
+
'menu' => array(
|
63 |
+
'slug' => 'yasr_settings_page',
|
64 |
+
'contact' => false,
|
65 |
+
'support' => false,
|
66 |
+
),
|
67 |
+
'is_live' => true,
|
68 |
+
) );
|
69 |
+
} catch ( Freemius_Exception $e ) {
|
70 |
+
}
|
71 |
}
|
72 |
+
|
73 |
+
return $yasr_fs;
|
74 |
}
|
75 |
|
76 |
+
// Init Freemius.
|
77 |
+
yasr_fs();
|
78 |
+
// Signal that SDK was initiated.
|
79 |
+
do_action( 'yasr_fs_loaded' );
|
80 |
+
define( 'YASR_VERSION_NUM', '1.7.2' );
|
81 |
+
//Plugin relative path
|
82 |
+
define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
|
83 |
+
//Plugin RELATIVE PATH without slashes (just the directory's name)
|
84 |
+
define( "YASR_RELATIVE_PATH", dirname( plugin_basename( __FILE__ ) ) );
|
85 |
+
//Plugin language directory: here I've to use relative path
|
86 |
+
//because load_plugin_textdomain wants relative and not absolute path
|
87 |
+
define( "YASR_LANG_DIR", YASR_RELATIVE_PATH . '/languages/' );
|
88 |
+
//Js directory absolute
|
89 |
+
define( "YASR_JS_DIR", plugins_url() . '/' . YASR_RELATIVE_PATH . '/js/' );
|
90 |
+
//CSS directory absolute
|
91 |
+
define( "YASR_CSS_DIR", plugins_url() . '/' . YASR_RELATIVE_PATH . '/css/' );
|
92 |
+
//IMG directory absolute
|
93 |
+
define( "YASR_IMG_DIR", plugins_url() . '/' . YASR_RELATIVE_PATH . '/img/' );
|
94 |
+
/****** Getting options ******/
|
95 |
+
//Get general options
|
96 |
+
$yasr_stored_options = get_option( 'yasr_general_options' );
|
97 |
+
global $yasr_stored_options ;
|
98 |
+
define( "YASR_AUTO_INSERT_ENABLED", $yasr_stored_options['auto_insert_enabled'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
|
100 |
+
if ( YASR_AUTO_INSERT_ENABLED == 1 ) {
|
101 |
+
define( "YASR_AUTO_INSERT_WHAT", $yasr_stored_options['auto_insert_what'] );
|
102 |
+
define( "YASR_AUTO_INSERT_WHERE", $yasr_stored_options['auto_insert_where'] );
|
103 |
+
define( "YASR_AUTO_INSERT_SIZE", $yasr_stored_options['auto_insert_size'] );
|
104 |
+
define( "YASR_AUTO_INSERT_EXCLUDE_PAGES", $yasr_stored_options['auto_insert_exclude_pages'] );
|
105 |
+
define( "YASR_AUTO_INSERT_CUSTOM_POST_ONLY", $yasr_stored_options['auto_insert_custom_post_only'] );
|
106 |
} else {
|
107 |
+
define( "YASR_AUTO_INSERT_WHAT", null );
|
108 |
+
define( "YASR_AUTO_INSERT_WHERE", null );
|
109 |
+
define( "YASR_AUTO_INSERT_SIZE", null );
|
110 |
+
define( "YASR_AUTO_INSERT_EXCLUDE_PAGES", null );
|
111 |
+
define( "YASR_AUTO_INSERT_CUSTOM_POST_ONLY", null );
|
112 |
}
|
113 |
|
114 |
+
define( "YASR_SHOW_OVERALL_IN_LOOP", $yasr_stored_options['show_overall_in_loop'] );
|
115 |
+
define( "YASR_SHOW_VISITOR_VOTES_IN_LOOP", $yasr_stored_options['show_visitor_votes_in_loop'] );
|
116 |
+
define( "YASR_TEXT_BEFORE_STARS", $yasr_stored_options['text_before_stars'] );
|
117 |
|
118 |
+
if ( YASR_TEXT_BEFORE_STARS == 1 ) {
|
119 |
+
define( "YASR_TEXT_BEFORE_OVERALL", $yasr_stored_options['text_before_overall'] );
|
120 |
+
define( "YASR_TEXT_BEFORE_VISITOR_RATING", $yasr_stored_options['text_before_visitor_rating'] );
|
121 |
+
define( "YASR_TEXT_AFTER_VISITOR_RATING", $yasr_stored_options['text_after_visitor_rating'] );
|
122 |
+
define( "YASR_CUSTOM_TEXT_USER_VOTED", $yasr_stored_options['custom_text_user_voted'] );
|
123 |
}
|
124 |
|
125 |
+
define( "YASR_VISITORS_STATS", $yasr_stored_options['visitors_stats'] );
|
126 |
+
define( "YASR_ALLOWED_USER", $yasr_stored_options['allowed_user'] );
|
127 |
+
define( "YASR_ENABLE_IP", $yasr_stored_options['enable_ip'] );
|
128 |
+
define( "YASR_SNIPPET", $yasr_stored_options['snippet'] );
|
129 |
+
define( "YASR_ITEMTYPE", $yasr_stored_options['snippet_itemtype'] );
|
130 |
|
131 |
+
if ( isset( $yasr_stored_options['blogposting_organization_name'] ) ) {
|
132 |
+
define( "YASR_BLOGPOSTING_ORGANIZATION_NAME", $yasr_stored_options['blogposting_organization_name'] );
|
133 |
} else {
|
134 |
+
define( "YASR_BLOGPOSTING_ORGANIZATION_NAME", '' );
|
135 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
+
if ( isset( $yasr_stored_options['blogposting_organization_logo'] ) ) {
|
138 |
+
if ( filter_var( $yasr_stored_options['blogposting_organization_logo'], FILTER_VALIDATE_URL ) !== false ) {
|
139 |
+
define( "YASR_BLOGPOSTING_ORGANIZATION_LOGO", $yasr_stored_options['blogposting_organization_logo'] );
|
140 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
}
|
142 |
+
define( "YASR_METABOX_OVERALL_RATING", $yasr_stored_options['metabox_overall_rating'] );
|
143 |
+
define( "YASR_JQUERY_DISABLED", $yasr_stored_options['disable_jquery'] );
|
144 |
+
//Get stored style options
|
145 |
+
$style_options = get_option( 'yasr_style_options' );
|
|
|
|
|
|
|
146 |
|
147 |
+
if ( $style_options ) {
|
|
|
|
|
|
|
148 |
|
149 |
+
if ( isset( $style_options['textarea'] ) ) {
|
150 |
+
define( "YASR_CUSTOM_CSS_RULES", $style_options['textarea'] );
|
151 |
+
} else {
|
152 |
+
define( "YASR_CUSTOM_CSS_RULES", null );
|
153 |
}
|
154 |
|
155 |
|
156 |
+
if ( isset( $style_options['scheme_color_multiset'] ) ) {
|
157 |
+
define( "YASR_SCHEME_COLOR", $style_options['scheme_color_multiset'] );
|
158 |
+
} else {
|
159 |
+
define( "YASR_SCHEME_COLOR", null );
|
160 |
}
|
161 |
|
|
|
|
|
162 |
|
163 |
+
if ( isset( $style_options['stars_set_free'] ) ) {
|
164 |
+
define( "YASR_STARS_SET", $style_options['stars_set_free'] );
|
165 |
+
} else {
|
166 |
+
define( "YASR_STARS_SET", null );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
}
|
168 |
+
|
169 |
+
} else {
|
170 |
+
define( "YASR_CUSTOM_CSS_RULES", null );
|
171 |
+
define( "YASR_SCHEME_COLOR", null );
|
172 |
+
define( "YASR_STARS_SET", null );
|
173 |
+
}
|
174 |
+
|
175 |
+
//Multi set options
|
176 |
+
$multi_set_options = get_option( 'yasr_multiset_options' );
|
177 |
+
if ( $multi_set_options ) {
|
178 |
|
179 |
+
if ( isset( $multi_set_options['show_average'] ) ) {
|
180 |
+
define( "YASR_MULTI_SHOW_AVERAGE", $multi_set_options['show_average'] );
|
181 |
+
} else {
|
182 |
+
define( "YASR_MULTI_SHOW_AVERAGE", 'yes' );
|
183 |
}
|
184 |
+
|
185 |
}
|
186 |
+
/****** End Getting options ******/
|
187 |
+
// Include function file
|
188 |
+
require YASR_ABSOLUTE_PATH . '/lib/yasr-functions.php';
|
189 |
+
require YASR_ABSOLUTE_PATH . '/lib/yasr-admin-actions.php';
|
190 |
+
require YASR_ABSOLUTE_PATH . '/lib/yasr-settings-functions.php';
|
191 |
+
require YASR_ABSOLUTE_PATH . '/lib/yasr-db-functions.php';
|
192 |
+
require YASR_ABSOLUTE_PATH . '/lib/yasr-ajax-functions.php';
|
193 |
+
require YASR_ABSOLUTE_PATH . '/lib/yasr-shortcode-functions.php';
|
194 |
+
require YASR_ABSOLUTE_PATH . '/lib/yasr-widgets.php';
|
195 |
+
if ( is_admin() ) {
|
196 |
+
require YASR_ABSOLUTE_PATH . '/lib/class-wp-list-table.php';
|
197 |
+
}
|
198 |
+
global $wpdb ;
|
199 |
+
define( "YASR_VOTES_TABLE", $wpdb->prefix . 'yasr_votes' );
|
200 |
+
//Used in background
|
201 |
+
define( "YASR_MULTI_SET_NAME_TABLE", $wpdb->prefix . 'yasr_multi_set' );
|
202 |
+
define( "YASR_MULTI_SET_FIELDS_TABLE", $wpdb->prefix . 'yasr_multi_set_fields' );
|
203 |
+
define( "YASR_MULTI_SET_VALUES_TABLE", $wpdb->prefix . 'yasr_multi_values' );
|
204 |
+
define( "YASR_LOG_TABLE", $wpdb->prefix . 'yasr_log' );
|
205 |
+
define( "YASR_LOADER_IMAGE", YASR_IMG_DIR . "/loader.gif" );
|
206 |
+
$yasr_version_installed = get_option( 'yasr-version' );
|
207 |
+
global $yasr_version_installed ;
|
208 |
+
//Run this only on plugin activation (doesn't work on update)
|
209 |
+
register_activation_hook( __FILE__, 'yasr_on_activation' );
|
210 |
+
function yasr_on_activation()
|
211 |
+
{
|
212 |
+
global $yasr_version_installed ;
|
213 |
+
//If this is a fresh new installation
|
214 |
+
if ( !$yasr_version_installed ) {
|
215 |
+
yasr_install();
|
216 |
+
}
|
217 |
}
|
218 |
+
|
219 |
+
/****** backward compatibility functions ******/
|
220 |
+
add_action( 'plugins_loaded', 'yasr_update_version' );
|
221 |
+
function yasr_update_version()
|
222 |
+
{
|
223 |
+
//do only in admin
|
224 |
+
|
225 |
+
if ( is_admin() ) {
|
226 |
+
global $wpdb ;
|
227 |
+
global $yasr_version_installed ;
|
228 |
+
global $yasr_stored_options ;
|
229 |
+
|
230 |
+
if ( $yasr_version_installed && $yasr_version_installed < '1.6.5' ) {
|
231 |
+
$yasr_stored_options['disable_jquery'] = 'no';
|
232 |
+
update_option( 'yasr_general_options', $yasr_stored_options );
|
233 |
+
}
|
234 |
+
|
235 |
+
|
236 |
+
if ( $yasr_version_installed && $yasr_version_installed < '1.6.1' ) {
|
237 |
+
$yasr_stored_options['enable_ip'] = 'no';
|
238 |
+
update_option( 'yasr_general_options', $yasr_stored_options );
|
239 |
+
}
|
240 |
+
|
241 |
+
//Remove end DECEMBER 2018
|
242 |
+
//This is a very important update: yasr_votes table will not be used anymore, using post meta instead
|
243 |
+
|
244 |
+
if ( $yasr_version_installed && $yasr_version_installed < '1.3.5' ) {
|
245 |
+
$overall_rating_array = $wpdb->get_results( "SELECT post_id, overall_rating, review_type\n FROM " . YASR_VOTES_TABLE . "\n WHERE overall_rating > 0\n OR review_type IS NOT NULL\n ORDER BY post_id ASC" );
|
246 |
+
foreach ( $overall_rating_array as $rating ) {
|
247 |
+
//add post meta only if overall rating is > 0
|
248 |
+
if ( $rating->overall_rating > 0 ) {
|
249 |
+
add_post_meta(
|
250 |
+
$rating->post_id,
|
251 |
+
'yasr_overall_rating',
|
252 |
+
$rating->overall_rating,
|
253 |
+
true
|
254 |
+
);
|
255 |
+
}
|
256 |
+
//add review type only if is not empty
|
257 |
+
if ( $rating->review_type != '' ) {
|
258 |
+
add_post_meta(
|
259 |
+
$rating->post_id,
|
260 |
+
'yasr_review_type',
|
261 |
+
$rating->review_type,
|
262 |
+
true
|
263 |
+
);
|
264 |
+
}
|
265 |
+
}
|
266 |
+
}
|
267 |
+
|
268 |
+
/****** End backward compatibility functions ******/
|
269 |
+
if ( $yasr_version_installed != YASR_VERSION_NUM ) {
|
270 |
+
update_option( 'yasr-version', YASR_VERSION_NUM );
|
271 |
+
}
|
272 |
+
}
|
273 |
+
|
274 |
+
}
|
275 |
+
|
276 |
+
//this add a link under the plugin name, must be in the main plugin file
|
277 |
+
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'yasr_add_links_below_plugin_name' );
|
278 |
+
function yasr_add_links_below_plugin_name( $links )
|
279 |
+
{
|
280 |
+
$settings_link = '<a href="' . admin_url( 'options-general.php?page=yasr_settings_page' ) . '">General Settings</a>';
|
281 |
+
//array_unshit adds to the begin of array
|
282 |
+
array_unshift( $links, $settings_link );
|
283 |
+
return $links;
|
284 |
+
}
|
285 |
+
|
286 |
+
//this add a link under the plugin description
|
287 |
+
add_filter(
|
288 |
+
'plugin_row_meta',
|
289 |
+
'yasr_plugin_row_meta',
|
290 |
+
10,
|
291 |
+
5
|
292 |
+
);
|
293 |
+
function yasr_plugin_row_meta( $links, $file )
|
294 |
+
{
|
295 |
+
$plugin = plugin_basename( __FILE__ );
|
296 |
+
// create link
|
297 |
+
if ( $file == $plugin ) {
|
298 |
+
$links[] = '<a href="https://yetanotherstarsrating.com/">' . __( 'Buy Yasr Pro', 'yet-another-stars-rating' ) . '</a>';
|
299 |
+
}
|
300 |
+
return $links;
|
301 |
+
}
|
302 |
+
|
303 |
+
//this is for user who use extensions
|
304 |
+
//remove on Gen 2019
|
305 |
+
define( 'YASR_EDD_SL_STORE_URL', 'http://yetanotherstarsrating.com' );
|
306 |
}
|
|
|
|
|
|
|
|