Version Description
- FIXED: "Load results with AJAX" option works with all post types, not the "posts" one
- FIXED: CSS fix in settings pages
- FIXED: minor fix with multiSet
Download this release
Release Info
Developer | Dudo |
Plugin | Yasr – Yet Another Stars Rating |
Version | 2.3.3 |
Comparing to | |
See all releases |
Code changes from version 2.3.2 to 2.3.3
- admin/classes/YasrEditCategory.php +69 -0
- admin/classes/YasrSettings.php +128 -0
- admin/css/yasr-admin.css +2 -1
- admin/editor/yasr-editor-functions.php +5 -7
- admin/editor/yasr-metabox-multiple-rating.php +10 -9
- admin/editor/yasr-metabox-schema.php +1 -1
- admin/js/src/guten/yasr-guten-blocks.js +683 -0
- admin/js/src/guten/yasr-guten-panel.js +289 -0
- admin/js/src/yasr-dashboard.js +99 -0
- admin/js/src/yasr-functions.js +22 -0
- admin/js/src/yasr-settings-page.js +237 -0
- admin/js/yasr-admin.js +1 -374
- admin/js/yasr-editor-screen.js +1 -2
- admin/js/yasr-guten-panel.js +1 -1
- admin/settings/multiset/yasr-settings-functions-multiset-page.php +4 -3
- admin/settings/multiset/yasr-settings-functions-multiset.php +10 -10
- admin/settings/yasr-settings-functions-misc.php +10 -4
- admin/settings/yasr-settings-functions.php +10 -30
- admin/settings/yasr-settings-page.php +64 -86
- admin/yasr-admin-actions.php +8 -0
- admin/yasr-admin-functions.php +146 -1
- admin/yasr-admin-init.php +1 -140
- changelog.txt +4 -16
- includes/classes/YasrCustomPostTypes.php +110 -0
- includes/js/yasr-front.js +3 -1
- includes/rest/classes/YasrCustomFields.php +4 -4
- includes/rest/classes/YasrPostMeta.php +4 -4
- includes/rest/yasr-rest.php +3 -0
- includes/shortcodes/classes/YasrNoStarsRankings.php +140 -0
- includes/shortcodes/classes/YasrOverallRating.php +5 -5
- includes/shortcodes/classes/YasrShortcode.php +4 -0
- includes/shortcodes/classes/YasrVisitorVotes.php +1 -0
- includes/shortcodes/yasr-shortcode-functions.php +7 -113
- includes/yasr-includes-db-functions.php +16 -9
- includes/yasr-includes-functions.php +18 -46
- includes/yasr-includes-init.php +5 -3
- public/yasr-public-filters.php +1 -1
- readme.txt +10 -12
- yet-another-stars-rating.php +2 -2
admin/classes/YasrEditCategory.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
|
4 |
+
Copyright 2014 Dario Curvino (email : d.curvino@tiscali.it)
|
5 |
+
|
6 |
+
This program is free software: you can redistribute it and/or modify
|
7 |
+
it under the terms of the GNU General Public License as published by
|
8 |
+
the Free Software Foundation, either version 2 of the License, or
|
9 |
+
(at your option) any later version.
|
10 |
+
|
11 |
+
This program is distributed in the hope that it will be useful,
|
12 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
+
GNU General Public License for more details.
|
15 |
+
|
16 |
+
You should have received a copy of the GNU General Public License
|
17 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>
|
18 |
+
*/
|
19 |
+
|
20 |
+
if (!defined('ABSPATH')) {
|
21 |
+
exit('You\'re not allowed to see this page');
|
22 |
+
} // Exit if accessed directly
|
23 |
+
|
24 |
+
|
25 |
+
class YasrEditCategory {
|
26 |
+
public static function init() {
|
27 |
+
if (yasr_fs()->is_free_plan() && !yasr_fs()->is_trial()) {
|
28 |
+
add_action( 'category_edit_form_fields', array('YasrEditCategory', 'categoryEditFormFieldsLock' ) );
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
public static function categoryEditFormFieldsLock() {
|
36 |
+
?>
|
37 |
+
<tr class="form-field term-name-wrap">
|
38 |
+
<th scope="row">
|
39 |
+
<label for="yasr-default-itemtype-category">
|
40 |
+
<?php _e( 'Select default itemType', 'yet-another-stars-rating' ) ?>
|
41 |
+
</label>
|
42 |
+
<span class="dashicons dashicons-lock"></span>
|
43 |
+
<?php
|
44 |
+
$string = sprintf(
|
45 |
+
__('Upgrade to %s to unlock this feature', 'yet-another-stars-rating'),
|
46 |
+
'<a href="https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=edit_category&utm_campaign=yasr_editor_category#yasr-pro">YASR PRO</a>'
|
47 |
+
);
|
48 |
+
?>
|
49 |
+
<span class="description">
|
50 |
+
<?php echo $string ?>
|
51 |
+
</span>
|
52 |
+
</th>
|
53 |
+
<td>
|
54 |
+
<?php yasr_select_itemtype('yasr-pro-select-itemtype-category', 1, true ); ?>
|
55 |
+
<p></p>
|
56 |
+
<label for="yasr-pro-checkbox-itemtype-category" class="yasr-indented-answer">
|
57 |
+
<input type="checkbox"
|
58 |
+
id="yasr-pro-checkbox-itemtype-category"
|
59 |
+
disabled
|
60 |
+
>
|
61 |
+
<span class="description">
|
62 |
+
<?php _e('Check to update YASR itemType', 'yet-another-stars-rating') ?>
|
63 |
+
</span>
|
64 |
+
</label>
|
65 |
+
</td>
|
66 |
+
</tr >
|
67 |
+
<?php
|
68 |
+
}
|
69 |
+
}
|
admin/classes/YasrSettings.php
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@tiscali.it)
|
6 |
+
|
7 |
+
This program is free software: you can redistribute it and/or modify
|
8 |
+
it under the terms of the GNU General Public License as published by
|
9 |
+
the Free Software Foundation, either version 2 of the License, or
|
10 |
+
(at your option) any later version.
|
11 |
+
|
12 |
+
This program is distributed in the hope that it will be useful,
|
13 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
+
GNU General Public License for more details.
|
16 |
+
|
17 |
+
You should have received a copy of the GNU General Public License
|
18 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>
|
19 |
+
*/
|
20 |
+
|
21 |
+
if (!defined('ABSPATH')) {
|
22 |
+
exit('You\'re not allowed to see this page');
|
23 |
+
} // Exit if accessed directly
|
24 |
+
|
25 |
+
class YasrSettings {
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @since 2.3.3
|
29 |
+
*
|
30 |
+
* @param $name
|
31 |
+
* @param $class
|
32 |
+
* @param $db_value
|
33 |
+
* @param $id
|
34 |
+
*
|
35 |
+
* return void
|
36 |
+
*/
|
37 |
+
public static function radioSelectSize($name, $class, $db_value=false, $id=false) {
|
38 |
+
$array_size = array('small', 'medium', 'large');
|
39 |
+
|
40 |
+
foreach($array_size as $size) {
|
41 |
+
$id_string = $id . $size;
|
42 |
+
|
43 |
+
//must be inside for each, or when loop arrive to last element
|
44 |
+
//checked is defined
|
45 |
+
$checked = '';
|
46 |
+
|
47 |
+
//If db_value === false, there is no need to check for db value
|
48 |
+
//so checked is the medium star (i.e. ranking page)
|
49 |
+
if($db_value === false) {
|
50 |
+
if($size === 'medium') {
|
51 |
+
$checked = 'checked';
|
52 |
+
}
|
53 |
+
} else if ($db_value === $size) {
|
54 |
+
$checked = 'checked';
|
55 |
+
}
|
56 |
+
|
57 |
+
echo sprintf( '<div class="yasr-option-div">
|
58 |
+
<label for="%s">
|
59 |
+
<input type="radio"
|
60 |
+
name="%s"
|
61 |
+
value="%s"
|
62 |
+
class="%s"
|
63 |
+
id="%s"
|
64 |
+
%s
|
65 |
+
>
|
66 |
+
<img src="%syasr-stars-%s.png"
|
67 |
+
class="yasr-img-option-size" alt=%s>
|
68 |
+
<span class="yasr-text-options-size">
|
69 |
+
%s
|
70 |
+
</span>
|
71 |
+
</label>
|
72 |
+
</div>',
|
73 |
+
$id_string, $name, $size, $class, $id_string, $checked, YASR_IMG_DIR, $size, $size,
|
74 |
+
__( ucwords( $size ), 'yet-another-stars-rating' ) );
|
75 |
+
|
76 |
+
} //end foreach
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* @param string $option_title
|
81 |
+
* @param array $array_options
|
82 |
+
* @param string $name
|
83 |
+
* @param string $class
|
84 |
+
* @param bool | string | int $default_value
|
85 |
+
* @param bool | string $id
|
86 |
+
*/
|
87 |
+
public static function printRadioType($option_title, $array_options, $name, $class, $default_value=false, $id=false) {
|
88 |
+
|
89 |
+
echo '<strong>' . $option_title . '</strong><br />';
|
90 |
+
|
91 |
+
if(is_array($array_options)) {
|
92 |
+
foreach ($array_options as $value => $label) {
|
93 |
+
$id_string = $id . '-' . strtolower(trim(str_replace(' ', '', $value)));
|
94 |
+
//must be inside foreach, or when loop arrive to last element
|
95 |
+
//checked is defined
|
96 |
+
$checked = '';
|
97 |
+
|
98 |
+
//If db_value === false, there is no need to check for db value
|
99 |
+
//so checked is the medium star (i.e. ranking page)
|
100 |
+
if($default_value === $value) {
|
101 |
+
$checked = 'checked';
|
102 |
+
}
|
103 |
+
|
104 |
+
//string value must be empty
|
105 |
+
if($value === 0) {
|
106 |
+
$value = '';
|
107 |
+
}
|
108 |
+
|
109 |
+
echo sprintf('<div>
|
110 |
+
<label for="%s">
|
111 |
+
<input type="radio"
|
112 |
+
name="%s"
|
113 |
+
value="%s"
|
114 |
+
class="%s"
|
115 |
+
id="%s"
|
116 |
+
%s
|
117 |
+
>
|
118 |
+
%s
|
119 |
+
</label>
|
120 |
+
</div>',
|
121 |
+
$id_string, $name, $value, $class, $id_string, $checked,
|
122 |
+
__(ucwords($label), 'yet-another-stars-rating'));
|
123 |
+
|
124 |
+
} //end foreach
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
}
|
admin/css/yasr-admin.css
CHANGED
@@ -300,6 +300,7 @@
|
|
300 |
|
301 |
.yasr-donatedivdx {
|
302 |
float: right;
|
|
|
303 |
display: block !important;
|
304 |
min-width: 250px;
|
305 |
width: 15%;
|
@@ -382,7 +383,7 @@
|
|
382 |
content: "+";
|
383 |
}
|
384 |
|
385 |
-
.yasr-option-
|
386 |
vertical-align: bottom;
|
387 |
display: block;
|
388 |
margin-bottom: 15px;
|
300 |
|
301 |
.yasr-donatedivdx {
|
302 |
float: right;
|
303 |
+
clear: right;
|
304 |
display: block !important;
|
305 |
min-width: 250px;
|
306 |
width: 15%;
|
383 |
content: "+";
|
384 |
}
|
385 |
|
386 |
+
.yasr-option-div {
|
387 |
vertical-align: bottom;
|
388 |
display: block;
|
389 |
margin-bottom: 15px;
|
admin/editor/yasr-editor-functions.php
CHANGED
@@ -99,7 +99,7 @@ function yasr_add_metaboxes() {
|
|
99 |
$post_type_where_display_metabox = array('post', 'page');
|
100 |
|
101 |
//get the custom post type
|
102 |
-
$custom_post_types =
|
103 |
|
104 |
if ($custom_post_types) {
|
105 |
//First merge array then changes keys to int
|
@@ -411,12 +411,10 @@ function yasr_output_multiple_set_callback() {
|
|
411 |
wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
|
412 |
}
|
413 |
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
die();
|
419 |
-
}
|
420 |
|
421 |
//set fields name and ids
|
422 |
$set_fields = YasrMultiSetData::multisetFieldsAndID($set_id);
|
99 |
$post_type_where_display_metabox = array('post', 'page');
|
100 |
|
101 |
//get the custom post type
|
102 |
+
$custom_post_types = YasrCustomPostTypes::getCustomPostTypes();
|
103 |
|
104 |
if ($custom_post_types) {
|
105 |
//First merge array then changes keys to int
|
411 |
wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
|
412 |
}
|
413 |
|
414 |
+
//in version < 2.1.0 set id could be 0
|
415 |
+
$set_id = (int) $_POST['set_id'];
|
416 |
+
$post_id = (int) $_POST['post_id'];
|
417 |
+
|
|
|
|
|
418 |
|
419 |
//set fields name and ids
|
420 |
$set_fields = YasrMultiSetData::multisetFieldsAndID($set_id);
|
admin/editor/yasr-metabox-multiple-rating.php
CHANGED
@@ -33,17 +33,20 @@ $n_multi_set = $wpdb->num_rows; //wpdb->num_rows always store the the count numb
|
|
33 |
if ($n_multi_set > 1) {
|
34 |
?>
|
35 |
<div>
|
36 |
-
<?php _e("Choose
|
37 |
<br />
|
38 |
-
<
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
43 |
|
44 |
<button href="#" class="button-delete" id="yasr-button-select-set"><?php _e("Select"); ?></button>
|
45 |
|
46 |
-
<span id="yasr-loader-select-multi-set" style="display:none;" > 
|
|
|
47 |
</span>
|
48 |
</div>
|
49 |
|
@@ -52,12 +55,10 @@ if ($n_multi_set > 1) {
|
|
52 |
} //End if if ($n_multi_set>1)
|
53 |
|
54 |
elseif ($n_multi_set === 1) {
|
55 |
-
|
56 |
//If multiset is only 1, array index will be always 0
|
57 |
////get the set_id
|
58 |
$set_id = $multi_set[0]->set_id;
|
59 |
$set_id = (int)$set_id;
|
60 |
-
|
61 |
}
|
62 |
|
63 |
|
33 |
if ($n_multi_set > 1) {
|
34 |
?>
|
35 |
<div>
|
36 |
+
<?php _e("Choose which set you want to use", 'yet-another-stars-rating'); ?>
|
37 |
<br />
|
38 |
+
<label for="select_set">
|
39 |
+
<select id="select_set">
|
40 |
+
<?php foreach ($multi_set as $name) { ?>
|
41 |
+
<option value="<?php echo $name->set_id ?>"><?php echo $name->set_name ?></option>
|
42 |
+
<?php } //End foreach ?>
|
43 |
+
</select>
|
44 |
+
</label>
|
45 |
|
46 |
<button href="#" class="button-delete" id="yasr-button-select-set"><?php _e("Select"); ?></button>
|
47 |
|
48 |
+
<span id="yasr-loader-select-multi-set" style="display:none;" >
|
49 |
+
<img src="<?php echo YASR_IMG_DIR . "/loader.gif" ?>" alt="yasr-loader">
|
50 |
</span>
|
51 |
</div>
|
52 |
|
55 |
} //End if if ($n_multi_set>1)
|
56 |
|
57 |
elseif ($n_multi_set === 1) {
|
|
|
58 |
//If multiset is only 1, array index will be always 0
|
59 |
////get the set_id
|
60 |
$set_id = $multi_set[0]->set_id;
|
61 |
$set_id = (int)$set_id;
|
|
|
62 |
}
|
63 |
|
64 |
|
admin/editor/yasr-metabox-schema.php
CHANGED
@@ -28,7 +28,7 @@ global $post;
|
|
28 |
wp_nonce_field('yasr_nonce_is_post_review_action', 'yasr_nonce_is_post_review');
|
29 |
|
30 |
//itemType select
|
31 |
-
|
32 |
|
33 |
//get all additional post meta
|
34 |
$saved_data = get_post_meta($post->ID, 'yasr_schema_additional_fields', true);
|
28 |
wp_nonce_field('yasr_nonce_is_post_review_action', 'yasr_nonce_is_post_review');
|
29 |
|
30 |
//itemType select
|
31 |
+
wp_nonce_field('yasr_nonce_review_type_action', 'yasr_nonce_review_type');
|
32 |
|
33 |
//get all additional post meta
|
34 |
$saved_data = get_post_meta($post->ID, 'yasr_schema_additional_fields', true);
|
admin/js/src/guten/yasr-guten-blocks.js
ADDED
@@ -0,0 +1,683 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
//setting costants
|
2 |
+
const { __ } = wp.i18n; // Import __() from wp.i18n
|
3 |
+
const {registerBlockType} = wp.blocks; // Import from wp.blocks
|
4 |
+
const {PanelBody, PanelRow} = wp.components;
|
5 |
+
const {Fragment} = wp.element;
|
6 |
+
const {BlockControls,InspectorControls} = wp.editor;
|
7 |
+
|
8 |
+
|
9 |
+
const yasrOptionalText = __('All these settings are optional', 'yet-another-stars-rating');
|
10 |
+
|
11 |
+
const yasrLabelSelectSize = __('Choose Size', 'yet-another-stars-rating');
|
12 |
+
|
13 |
+
const yasrSelectSizeChoose = __('Choose stars size', 'yet-another-stars-rating');
|
14 |
+
const yasrSelectSizeSmall = __('Small', 'yet-another-stars-rating');
|
15 |
+
const yasrSelectSizeMedium = __('Medium', 'yet-another-stars-rating');
|
16 |
+
const yasrSelectSizeLarge = __('Large', 'yet-another-stars-rating');
|
17 |
+
|
18 |
+
const yasrLeaveThisBlankText = __('Leave this blank if you don\'t know what you\'re doing.', 'yet-another-stars-rating');
|
19 |
+
|
20 |
+
const yasrOverallDescription = __('Remember: only the post author can rate here.', 'yet-another-stars-rating');
|
21 |
+
const yasrVisitorVotesDescription = __('This is the star set where your users will be able to vote', 'yet-another-stars-rating');
|
22 |
+
|
23 |
+
/******* function to check ajax response *****/
|
24 |
+
/*function checkResponse(res) {
|
25 |
+
if (res.status >= 400 && res.status < 600) {
|
26 |
+
throw new Error(`Failed with status ${res.status}`);
|
27 |
+
}
|
28 |
+
|
29 |
+
return res;
|
30 |
+
}*/
|
31 |
+
|
32 |
+
function YasrProText () {
|
33 |
+
|
34 |
+
const YasrProText1 = __('To be able to customize this ranking, you need', 'yet-another-stars-rating');
|
35 |
+
const YasrProText2 = __('You can buy the plugin, including one year of support, updates and upgrades, on',
|
36 |
+
'yet-another-stars-rating');
|
37 |
+
|
38 |
+
return (
|
39 |
+
<h3>
|
40 |
+
{YasrProText1}
|
41 |
+
|
42 |
+
<a href="https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings#yasr-pro">
|
43 |
+
Yasr Pro.
|
44 |
+
</a><br />
|
45 |
+
{YasrProText2}
|
46 |
+
|
47 |
+
<a href="https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings">
|
48 |
+
yetanotherstarsrating.com
|
49 |
+
</a>
|
50 |
+
</h3>
|
51 |
+
)
|
52 |
+
|
53 |
+
}
|
54 |
+
|
55 |
+
function YasrNoSettingsPanel (props) {
|
56 |
+
|
57 |
+
return (
|
58 |
+
<InspectorControls>
|
59 |
+
<PanelBody title='Settings'>
|
60 |
+
<YasrProText/>
|
61 |
+
</PanelBody>
|
62 |
+
</InspectorControls>
|
63 |
+
);
|
64 |
+
|
65 |
+
}
|
66 |
+
|
67 |
+
/*function YasrPrintSelectRows () {
|
68 |
+
|
69 |
+
let optionValueRows = [];
|
70 |
+
|
71 |
+
for (let i=2; i<=30; i++) {
|
72 |
+
if (i === 9) {
|
73 |
+
optionValueRows.push(<option value={i} selected disabled>{i}</option>);
|
74 |
+
} else {
|
75 |
+
optionValueRows.push(<option value={i} disabled>{i}</option>);
|
76 |
+
}
|
77 |
+
|
78 |
+
}
|
79 |
+
|
80 |
+
return(
|
81 |
+
<form>
|
82 |
+
<select>
|
83 |
+
{optionValueRows}
|
84 |
+
</select>
|
85 |
+
<span className="dashicons dashicons-lock"></span>
|
86 |
+
</form>
|
87 |
+
)
|
88 |
+
|
89 |
+
}
|
90 |
+
|
91 |
+
|
92 |
+
function YasrPrintSelectSize () {
|
93 |
+
return (
|
94 |
+
<form>
|
95 |
+
<select>
|
96 |
+
<option value="--">{yasrSelectSizeChoose}</option>
|
97 |
+
<option value="small" disabled>{yasrSelectSizeSmall}</option>
|
98 |
+
<option value="medium" disabled>{yasrSelectSizeMedium}</option>
|
99 |
+
<option value="large" disabled>{yasrSelectSizeLarge}</option>
|
100 |
+
</select>
|
101 |
+
<span className="dashicons dashicons-lock"></span>
|
102 |
+
</form>
|
103 |
+
);
|
104 |
+
}
|
105 |
+
|
106 |
+
function YasrPrintTextPosition () {
|
107 |
+
return (
|
108 |
+
<form>
|
109 |
+
<select>
|
110 |
+
<option value="before" selected disabled>Before</option>
|
111 |
+
<option value="after" disabled>After</option>
|
112 |
+
</select>
|
113 |
+
<span className="dashicons dashicons-lock"></span>
|
114 |
+
</form>
|
115 |
+
);
|
116 |
+
}
|
117 |
+
*/
|
118 |
+
/**
|
119 |
+
* Register: a Gutenberg Block.
|
120 |
+
*
|
121 |
+
* Registers a new block provided a unique name and an object defining its
|
122 |
+
* behavior. Once registered, the block is made editor as an option to any
|
123 |
+
* editor interface where blocks are implemented.
|
124 |
+
*
|
125 |
+
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
126 |
+
* @param {string} name Block name.
|
127 |
+
* @param {Object} settings Block settings.
|
128 |
+
* @return {?WPBlock} The block, if it has been successfully
|
129 |
+
* registered; otherwise `undefined`.
|
130 |
+
*/
|
131 |
+
|
132 |
+
registerBlockType(
|
133 |
+
'yet-another-stars-rating/yasr-overall-rating', {
|
134 |
+
title: __( 'Yasr: Overall Rating', 'yet-another-stars-rating' ),
|
135 |
+
description: __('Insert the author rating', ''),
|
136 |
+
icon: 'star-half',
|
137 |
+
category: 'yet-another-stars-rating',
|
138 |
+
keywords: [
|
139 |
+
__('rating', 'yet-another-stars-rating'),
|
140 |
+
__('author', 'yet-another-stars-rating'),
|
141 |
+
__('overall', 'yet-another-stars-rating')
|
142 |
+
],
|
143 |
+
attributes: {
|
144 |
+
overallRatingMeta: {
|
145 |
+
type: 'number',
|
146 |
+
source: 'meta',
|
147 |
+
meta: 'yasr_overall_rating'
|
148 |
+
},
|
149 |
+
size: {
|
150 |
+
type: 'string',
|
151 |
+
default: '--'
|
152 |
+
},
|
153 |
+
postId: {
|
154 |
+
type: 'number',
|
155 |
+
default: ''
|
156 |
+
},
|
157 |
+
},
|
158 |
+
|
159 |
+
edit:
|
160 |
+
|
161 |
+
function(props) {
|
162 |
+
|
163 |
+
const { attributes: {overallRatingMeta, size, postId}, setAttributes, isSelected } = props;
|
164 |
+
|
165 |
+
let overallRating = overallRatingMeta;
|
166 |
+
|
167 |
+
let sizeAttribute = null;
|
168 |
+
let postIdAttribute = null;
|
169 |
+
let isNum = false;
|
170 |
+
|
171 |
+
if (size !== '--') {
|
172 |
+
sizeAttribute = ' size="' + size + '"';
|
173 |
+
}
|
174 |
+
|
175 |
+
isNum = /^\d+$/.test(postId);
|
176 |
+
|
177 |
+
if (postId && isNum === true) {
|
178 |
+
postIdAttribute = ' postid="' +postId + '"';
|
179 |
+
}
|
180 |
+
|
181 |
+
class YasrDivRatingOverall extends React.Component {
|
182 |
+
|
183 |
+
constructor(props) {
|
184 |
+
super(props);
|
185 |
+
this.yasrOverallRateThis = __("Rate this article / item", 'yet-another-stars-rating');
|
186 |
+
}
|
187 |
+
|
188 |
+
render () {
|
189 |
+
return (
|
190 |
+
<div>
|
191 |
+
{this.yasrOverallRateThis}
|
192 |
+
<div>
|
193 |
+
<div id="overall-rater" ref={()=>
|
194 |
+
raterJs({
|
195 |
+
starSize: 32,
|
196 |
+
step: 0.1,
|
197 |
+
showToolTip: false,
|
198 |
+
rating: overallRating,
|
199 |
+
readOnly: false,
|
200 |
+
element: document.querySelector("#overall-rater"),
|
201 |
+
rateCallback: function rateCallback(rating, done) {
|
202 |
+
|
203 |
+
rating = rating.toFixed(1);
|
204 |
+
rating = parseFloat(rating);
|
205 |
+
|
206 |
+
setAttributes( { overallRatingMeta: rating } );
|
207 |
+
|
208 |
+
this.setRating(rating);
|
209 |
+
|
210 |
+
done();
|
211 |
+
|
212 |
+
}
|
213 |
+
})
|
214 |
+
}
|
215 |
+
/>
|
216 |
+
</div>
|
217 |
+
</div>
|
218 |
+
|
219 |
+
);
|
220 |
+
}
|
221 |
+
|
222 |
+
}
|
223 |
+
|
224 |
+
function YasrPrintSelectSize () {
|
225 |
+
return (
|
226 |
+
<form>
|
227 |
+
<select value={size} onChange={ yasrSetStarsSize }>
|
228 |
+
<option value="--">{yasrSelectSizeChoose}</option>
|
229 |
+
<option value="small">{yasrSelectSizeSmall}</option>
|
230 |
+
<option value="medium">{yasrSelectSizeMedium}</option>
|
231 |
+
<option value="large">{yasrSelectSizeLarge}</option>
|
232 |
+
</select>
|
233 |
+
</form>
|
234 |
+
);
|
235 |
+
}
|
236 |
+
|
237 |
+
function yasrSetStarsSize(event) {
|
238 |
+
const selected = event.target.querySelector( 'option:checked' );
|
239 |
+
setAttributes( { size: selected.value } );
|
240 |
+
event.preventDefault();
|
241 |
+
}
|
242 |
+
|
243 |
+
function YasrPrintInputId() {
|
244 |
+
return (
|
245 |
+
<div>
|
246 |
+
<input type="text" size="4" onKeyPress={yasrSetPostId} />
|
247 |
+
</div>
|
248 |
+
);
|
249 |
+
}
|
250 |
+
|
251 |
+
function yasrSetPostId (event) {
|
252 |
+
if (event.key === 'Enter') {
|
253 |
+
const postIdValue = event.target.value;
|
254 |
+
|
255 |
+
//postID is always a string, here I check if this string is made only by digits
|
256 |
+
var isNum = /^\d+$/.test(postIdValue);
|
257 |
+
|
258 |
+
if (isNum === true) {
|
259 |
+
setAttributes({postId: postIdValue})
|
260 |
+
}
|
261 |
+
event.preventDefault();
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
function YasrOverallPanel (props) {
|
266 |
+
|
267 |
+
return (
|
268 |
+
<InspectorControls>
|
269 |
+
<div class="yasr-guten-block-panel yasr-guten-block-panel-center">
|
270 |
+
<YasrDivRatingOverall />
|
271 |
+
</div>
|
272 |
+
|
273 |
+
<PanelBody title='Settings'>
|
274 |
+
<h3>{yasrOptionalText}</h3>
|
275 |
+
|
276 |
+
<div className="yasr-guten-block-panel">
|
277 |
+
<label>{yasrLabelSelectSize}</label>
|
278 |
+
<div>
|
279 |
+
<YasrPrintSelectSize />
|
280 |
+
</div>
|
281 |
+
</div>
|
282 |
+
|
283 |
+
<div className="yasr-guten-block-panel">
|
284 |
+
<label>Post ID</label>
|
285 |
+
<YasrPrintInputId/>
|
286 |
+
<div className="yasr-guten-block-explain">
|
287 |
+
{yasrLeaveThisBlankText}
|
288 |
+
</div>
|
289 |
+
</div>
|
290 |
+
|
291 |
+
<div className="yasr-guten-block-panel">
|
292 |
+
{yasrOverallDescription}
|
293 |
+
</div>
|
294 |
+
</PanelBody>
|
295 |
+
</InspectorControls>
|
296 |
+
);
|
297 |
+
|
298 |
+
}
|
299 |
+
|
300 |
+
return (
|
301 |
+
<Fragment>
|
302 |
+
<YasrOverallPanel />
|
303 |
+
<div className={ props.className }>
|
304 |
+
[yasr_overall_rating{sizeAttribute}{postIdAttribute}]
|
305 |
+
{isSelected && <YasrPrintSelectSize />}
|
306 |
+
</div>
|
307 |
+
</Fragment>
|
308 |
+
);
|
309 |
+
},
|
310 |
+
|
311 |
+
/**
|
312 |
+
* The save function defines the way in which the different attributes should be combined
|
313 |
+
* into the final markup, which is then serialized by Gutenberg into post_content.
|
314 |
+
*
|
315 |
+
* The "save" property must be specified and must be a valid function.
|
316 |
+
*
|
317 |
+
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
318 |
+
*/
|
319 |
+
save:
|
320 |
+
function( props ) {
|
321 |
+
const {attributes: {size, postId}} = props;
|
322 |
+
|
323 |
+
let yasrOverallAttributes = null;
|
324 |
+
|
325 |
+
if (size) {
|
326 |
+
yasrOverallAttributes += ' size="' +size+ '"';
|
327 |
+
}
|
328 |
+
if (postId) {
|
329 |
+
yasrOverallAttributes += ' postid="'+postId+'"';
|
330 |
+
}
|
331 |
+
|
332 |
+
return (
|
333 |
+
<div>[yasr_overall_rating {yasrOverallAttributes}]</div>
|
334 |
+
);
|
335 |
+
},
|
336 |
+
|
337 |
+
});
|
338 |
+
|
339 |
+
registerBlockType(
|
340 |
+
'yet-another-stars-rating/yasr-visitor-votes', {
|
341 |
+
|
342 |
+
title: __( 'Yasr: Visitor Votes', 'yet-another-stars-rating' ),
|
343 |
+
description: __('Insert the ability for your visitors to vote', 'yet-another-stars-rating'),
|
344 |
+
icon: 'star-half',
|
345 |
+
category: 'yet-another-stars-rating',
|
346 |
+
keywords: [
|
347 |
+
__('rating', 'yet-another-stars-rating'),
|
348 |
+
__('visitor', 'yet-another-stars-rating'),
|
349 |
+
__('votes', 'yet-another-stars-rating')
|
350 |
+
],
|
351 |
+
attributes: {
|
352 |
+
//name of the attribute
|
353 |
+
size: {
|
354 |
+
type: 'string',
|
355 |
+
default: '--'
|
356 |
+
},
|
357 |
+
postId: {
|
358 |
+
type: 'number',
|
359 |
+
default: ''
|
360 |
+
},
|
361 |
+
},
|
362 |
+
|
363 |
+
edit:
|
364 |
+
|
365 |
+
function( props ) {
|
366 |
+
|
367 |
+
const { attributes: { size, postId }, setAttributes, isSelected } = props;
|
368 |
+
|
369 |
+
let sizeAttribute = null;
|
370 |
+
let postIdAttribute = null;
|
371 |
+
let isNum = false;
|
372 |
+
|
373 |
+
isNum = /^\d+$/.test(postId);
|
374 |
+
|
375 |
+
if (size !== '--') {
|
376 |
+
sizeAttribute = ' size="' + size + '"';
|
377 |
+
}
|
378 |
+
|
379 |
+
if (postId && isNum === true) {
|
380 |
+
postIdAttribute = ' postid="' +postId + '"';
|
381 |
+
}
|
382 |
+
|
383 |
+
|
384 |
+
function YasrPrintSelectSize () {
|
385 |
+
return (
|
386 |
+
<form>
|
387 |
+
<select value={size} onChange={ yasrSetStarsSize }>
|
388 |
+
<option value="--">{yasrSelectSizeChoose}</option>
|
389 |
+
<option value="small">{yasrSelectSizeSmall}</option>
|
390 |
+
<option value="medium">{yasrSelectSizeMedium}</option>
|
391 |
+
<option value="large">{yasrSelectSizeLarge}</option>
|
392 |
+
</select>
|
393 |
+
</form>
|
394 |
+
);
|
395 |
+
}
|
396 |
+
|
397 |
+
function yasrSetStarsSize(event) {
|
398 |
+
const selected = event.target.querySelector( 'option:checked' );
|
399 |
+
setAttributes( { size: selected.value } );
|
400 |
+
event.preventDefault();
|
401 |
+
}
|
402 |
+
|
403 |
+
function YasrPrintInputId() {
|
404 |
+
return (
|
405 |
+
<div>
|
406 |
+
<input type="text" size="4" onKeyPress={yasrSetPostId} />
|
407 |
+
</div>
|
408 |
+
);
|
409 |
+
}
|
410 |
+
|
411 |
+
function yasrSetPostId (event) {
|
412 |
+
if (event.key === 'Enter') {
|
413 |
+
const postIdValue = event.target.value;
|
414 |
+
|
415 |
+
//postID is always a string, here I check if this string is made only by digits
|
416 |
+
var isNum = /^\d+$/.test(postIdValue);
|
417 |
+
|
418 |
+
if (isNum === true) {
|
419 |
+
setAttributes({postId: postIdValue})
|
420 |
+
}
|
421 |
+
event.preventDefault();
|
422 |
+
}
|
423 |
+
}
|
424 |
+
|
425 |
+
function YasrVVPanel (props) {
|
426 |
+
|
427 |
+
return (
|
428 |
+
<InspectorControls>
|
429 |
+
<PanelBody title='Settings'>
|
430 |
+
<h3>{yasrOptionalText}</h3>
|
431 |
+
|
432 |
+
<div className="yasr-guten-block-panel">
|
433 |
+
<label>{yasrLabelSelectSize}</label>
|
434 |
+
<div>
|
435 |
+
<YasrPrintSelectSize />
|
436 |
+
</div>
|
437 |
+
</div>
|
438 |
+
|
439 |
+
<div className="yasr-guten-block-panel">
|
440 |
+
<label>Post ID</label>
|
441 |
+
<YasrPrintInputId/>
|
442 |
+
<div className="yasr-guten-block-explain">
|
443 |
+
{yasrLeaveThisBlankText}
|
444 |
+
</div>
|
445 |
+
</div>
|
446 |
+
|
447 |
+
<div className="yasr-guten-block-panel">
|
448 |
+
{yasrVisitorVotesDescription}
|
449 |
+
</div>
|
450 |
+
</PanelBody>
|
451 |
+
</InspectorControls>
|
452 |
+
);
|
453 |
+
|
454 |
+
}
|
455 |
+
|
456 |
+
return (
|
457 |
+
<Fragment>
|
458 |
+
<YasrVVPanel />
|
459 |
+
<div className={props.className}>
|
460 |
+
[yasr_visitor_votes{sizeAttribute}{postIdAttribute}]
|
461 |
+
{isSelected && <YasrPrintSelectSize />}
|
462 |
+
</div>
|
463 |
+
</Fragment>
|
464 |
+
);
|
465 |
+
},
|
466 |
+
|
467 |
+
/**
|
468 |
+
* The save function defines the way in which the different attributes should be combined
|
469 |
+
* into the final markup, which is then serialized by Gutenberg into post_content.
|
470 |
+
*
|
471 |
+
* The "save" property must be specified and must be a valid function.
|
472 |
+
*
|
473 |
+
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
474 |
+
*/
|
475 |
+
save:
|
476 |
+
function( props ) {
|
477 |
+
const { attributes: {size, postId} } = props;
|
478 |
+
|
479 |
+
let yasrVVAttributes = null;
|
480 |
+
|
481 |
+
if (size) {
|
482 |
+
yasrVVAttributes += ' size="' +size+ '"';
|
483 |
+
}
|
484 |
+
if (postId) {
|
485 |
+
yasrVVAttributes += ' postid="'+postId+'"';
|
486 |
+
}
|
487 |
+
|
488 |
+
return (
|
489 |
+
<div>[yasr_visitor_votes {yasrVVAttributes}]</div>
|
490 |
+
);
|
491 |
+
},
|
492 |
+
|
493 |
+
});
|
494 |
+
|
495 |
+
registerBlockType(
|
496 |
+
'yet-another-stars-rating/overall-rating-ranking', {
|
497 |
+
|
498 |
+
title: __('Yasr: Top 10 Reviews', 'yet-another-stars-rating'),
|
499 |
+
description: __(
|
500 |
+
'This ranking shows the highest rated posts rated through the overall_rating shortcode.',
|
501 |
+
'yet-another-stars-rating'
|
502 |
+
),
|
503 |
+
icon: 'star-half',
|
504 |
+
category: 'yet-another-stars-rating',
|
505 |
+
keywords: [
|
506 |
+
__('ranking', 'yet-another-stars-rating'),
|
507 |
+
__('highest', 'yet-another-stars-rating'),
|
508 |
+
__('chart', 'yet-another-stars-rating')
|
509 |
+
],
|
510 |
+
|
511 |
+
edit:
|
512 |
+
function(props) {
|
513 |
+
return (
|
514 |
+
<Fragment>
|
515 |
+
<YasrNoSettingsPanel />
|
516 |
+
<div className={props.className}>
|
517 |
+
[yasr_top_ten_highest_rated]
|
518 |
+
</div>
|
519 |
+
</Fragment>
|
520 |
+
);
|
521 |
+
},
|
522 |
+
|
523 |
+
|
524 |
+
/**
|
525 |
+
* The save function defines the way in which the different attributes should be combined
|
526 |
+
* into the final markup, which is then serialized by Gutenberg into post_content.
|
527 |
+
*
|
528 |
+
* The "save" property must be specified and must be a valid function.
|
529 |
+
*
|
530 |
+
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
531 |
+
*/
|
532 |
+
save:
|
533 |
+
function(props) {
|
534 |
+
return (
|
535 |
+
<div>[yasr_top_ten_highest_rated]</div>
|
536 |
+
);
|
537 |
+
},
|
538 |
+
|
539 |
+
});
|
540 |
+
|
541 |
+
registerBlockType(
|
542 |
+
'yet-another-stars-rating/visitor-votes-ranking', {
|
543 |
+
|
544 |
+
title: __('Yasr: Top 10 By Visitors Votes', 'yet-another-stars-rating'),
|
545 |
+
description: __(
|
546 |
+
'This ranking shows both the highest and most rated posts rated through the yasr_visitor_votes shortcode. For an item to appear in this chart, it has to be rated at least twice. ',
|
547 |
+
'yet-another-stars-rating'
|
548 |
+
),
|
549 |
+
icon: 'star-half',
|
550 |
+
category: 'yet-another-stars-rating',
|
551 |
+
keywords: [
|
552 |
+
__('ranking', 'yet-another-stars-rating'),
|
553 |
+
__('highest', 'yet-another-stars-rating'),
|
554 |
+
__('most', 'yet-another-stars-rating'),
|
555 |
+
__('chart', 'yet-another-stars-rating')
|
556 |
+
],
|
557 |
+
|
558 |
+
edit:
|
559 |
+
|
560 |
+
function(props) {
|
561 |
+
|
562 |
+
return (
|
563 |
+
<Fragment>
|
564 |
+
<YasrNoSettingsPanel />
|
565 |
+
<div className={props.className}>
|
566 |
+
[yasr_most_or_highest_rated_posts]
|
567 |
+
</div>
|
568 |
+
</Fragment>
|
569 |
+
);
|
570 |
+
},
|
571 |
+
|
572 |
+
/**
|
573 |
+
* The save function defines the way in which the different attributes should be combined
|
574 |
+
* into the final markup, which is then serialized by Gutenberg into post_content.
|
575 |
+
*
|
576 |
+
* The "save" property must be specified and must be a valid function.
|
577 |
+
*
|
578 |
+
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
579 |
+
*/
|
580 |
+
save:
|
581 |
+
function(props) {
|
582 |
+
return (
|
583 |
+
<div>[yasr_most_or_highest_rated_posts]</div>
|
584 |
+
);
|
585 |
+
},
|
586 |
+
|
587 |
+
});
|
588 |
+
|
589 |
+
registerBlockType(
|
590 |
+
'yet-another-stars-rating/most-active-reviewers', {
|
591 |
+
|
592 |
+
title: __('Yasr: Most Active Authors', 'yet-another-stars-rating'),
|
593 |
+
description: __('This ranking shows the 5 most active reviewers on your site.',
|
594 |
+
'yet-another-stars-rating'
|
595 |
+
),
|
596 |
+
icon: 'star-half',
|
597 |
+
category: 'yet-another-stars-rating',
|
598 |
+
keywords: [
|
599 |
+
__('ranking', 'yet-another-stars-rating'),
|
600 |
+
__('highest', 'yet-another-stars-rating'),
|
601 |
+
__('most', 'yet-another-stars-rating'),
|
602 |
+
__('chart', 'yet-another-stars-rating'),
|
603 |
+
__('authors', 'yet-another-stars-rating')
|
604 |
+
],
|
605 |
+
|
606 |
+
edit:
|
607 |
+
|
608 |
+
function(props) {
|
609 |
+
|
610 |
+
return (
|
611 |
+
<Fragment>
|
612 |
+
<YasrNoSettingsPanel />
|
613 |
+
<div className={props.className}>
|
614 |
+
[yasr_top_5_reviewers]
|
615 |
+
</div>
|
616 |
+
</Fragment>
|
617 |
+
);
|
618 |
+
},
|
619 |
+
|
620 |
+
/**
|
621 |
+
* The save function defines the way in which the different attributes should be combined
|
622 |
+
* into the final markup, which is then serialized by Gutenberg into post_content.
|
623 |
+
*
|
624 |
+
* The "save" property must be specified and must be a valid function.
|
625 |
+
*
|
626 |
+
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
627 |
+
*/
|
628 |
+
save:
|
629 |
+
function(props) {
|
630 |
+
return (
|
631 |
+
<div>[yasr_top_5_reviewers]</div>
|
632 |
+
);
|
633 |
+
},
|
634 |
+
|
635 |
+
});
|
636 |
+
|
637 |
+
registerBlockType(
|
638 |
+
'yet-another-stars-rating/most-active-users', {
|
639 |
+
|
640 |
+
title: __('Yasr: Most Active Visitors', 'yet-another-stars-rating'),
|
641 |
+
description: __('This ranking shows the 10 most active users, displaying the login name if logged in or “Anonymous” if not.',
|
642 |
+
'yet-another-stars-rating'
|
643 |
+
),
|
644 |
+
icon: 'star-half',
|
645 |
+
category: 'yet-another-stars-rating',
|
646 |
+
keywords: [
|
647 |
+
__('ranking', 'yet-another-stars-rating'),
|
648 |
+
__('highest', 'yet-another-stars-rating'),
|
649 |
+
__('most', 'yet-another-stars-rating'),
|
650 |
+
__('chart', 'yet-another-stars-rating'),
|
651 |
+
__('visitors', 'yet-another-stars-rating')
|
652 |
+
],
|
653 |
+
|
654 |
+
edit:
|
655 |
+
|
656 |
+
function(props) {
|
657 |
+
|
658 |
+
return (
|
659 |
+
<Fragment>
|
660 |
+
<YasrNoSettingsPanel />
|
661 |
+
<div className={props.className}>
|
662 |
+
[yasr_top_ten_active_users]
|
663 |
+
</div>
|
664 |
+
</Fragment>
|
665 |
+
);
|
666 |
+
},
|
667 |
+
|
668 |
+
/**
|
669 |
+
* The save function defines the way in which the different attributes should be combined
|
670 |
+
* into the final markup, which is then serialized by Gutenberg into post_content.
|
671 |
+
*
|
672 |
+
* The "save" property must be specified and must be a valid function.
|
673 |
+
*
|
674 |
+
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
675 |
+
*/
|
676 |
+
save:
|
677 |
+
function(props) {
|
678 |
+
return (
|
679 |
+
<div>[yasr_top_ten_active_users]</div>
|
680 |
+
);
|
681 |
+
},
|
682 |
+
|
683 |
+
});
|
admin/js/src/guten/yasr-guten-panel.js
ADDED
@@ -0,0 +1,289 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const {registerPlugin} = wp.plugins;
|
2 |
+
const {PluginSidebar, PluginSidebarMoreMenuItem} = wp.editPost;
|
3 |
+
const {TextControl, PanelBody, PanelRow} = wp.components;
|
4 |
+
const {BlockControls,InspectorControls} = wp.editor;
|
5 |
+
|
6 |
+
const yasrDisableAutoInsert = __('Disable auto insert for this post or page?', 'yet-another-stars-rating');
|
7 |
+
const yasrRichSnippetOptions = __('Rich snippet options', 'yet-another-stars-rating');
|
8 |
+
const yasrPostExcluded = __('Is this a review?', 'yet-another-stars-rating');
|
9 |
+
const yasrSelectSnippetTitle = __('Select ItemType ', 'yet-another-stars-rating');
|
10 |
+
|
11 |
+
const ContentBelowSidebar = () => {
|
12 |
+
return <div/>;
|
13 |
+
};
|
14 |
+
|
15 |
+
|
16 |
+
class YasrDivRatingOverall extends React.Component {
|
17 |
+
|
18 |
+
shouldComponentUpdate(nextProps, nextState) {
|
19 |
+
return false;
|
20 |
+
}
|
21 |
+
|
22 |
+
constructor(props) {
|
23 |
+
super(props);
|
24 |
+
this.yasrOverallRateThis = __("Rate this article / item", 'yet-another-stars-rating');
|
25 |
+
this.yasrOverallMoreInfo =
|
26 |
+
__("This is the same value that you find the \"Yasr: Overall Rating\" block.",
|
27 |
+
'yet-another-stars-rating');
|
28 |
+
}
|
29 |
+
|
30 |
+
printDivOverallRater() {
|
31 |
+
return(
|
32 |
+
<div>
|
33 |
+
<div id="overall-rater-panel" ref={()=>
|
34 |
+
raterJs({
|
35 |
+
starSize: 32,
|
36 |
+
step: 0.1,
|
37 |
+
showToolTip: false,
|
38 |
+
rating: wp.data.select('core/editor').getCurrentPost().meta.yasr_overall_rating,
|
39 |
+
readOnly: false,
|
40 |
+
element: document.querySelector("#overall-rater-panel"),
|
41 |
+
rateCallback: function(rating, done){
|
42 |
+
|
43 |
+
rating = rating.toFixed(1);
|
44 |
+
rating = parseFloat(rating);
|
45 |
+
|
46 |
+
wp.data.dispatch('core/editor').editPost(
|
47 |
+
{ meta: { yasr_overall_rating: rating } }
|
48 |
+
);
|
49 |
+
|
50 |
+
this.setRating(rating);
|
51 |
+
|
52 |
+
done();
|
53 |
+
}
|
54 |
+
})
|
55 |
+
}
|
56 |
+
/>
|
57 |
+
<br />
|
58 |
+
{this.yasrOverallMoreInfo}
|
59 |
+
</div>
|
60 |
+
)
|
61 |
+
}
|
62 |
+
|
63 |
+
render () {
|
64 |
+
return (
|
65 |
+
<div>
|
66 |
+
{this.yasrOverallRateThis}
|
67 |
+
<div>
|
68 |
+
{this.printDivOverallRater()}
|
69 |
+
</div>
|
70 |
+
</div>
|
71 |
+
|
72 |
+
);
|
73 |
+
}
|
74 |
+
|
75 |
+
}
|
76 |
+
|
77 |
+
class YasrSideBarAutoInsert extends React.Component {
|
78 |
+
|
79 |
+
constructor(props) {
|
80 |
+
super(props);
|
81 |
+
|
82 |
+
let isThisPostExluded = wp.data.select('core/editor').getCurrentPost().meta.yasr_auto_insert_disabled;
|
83 |
+
let isThisPostExludedCheckbox = false;
|
84 |
+
|
85 |
+
if (isThisPostExluded === 'yes') {
|
86 |
+
isThisPostExludedCheckbox = true;
|
87 |
+
}
|
88 |
+
|
89 |
+
this.state = {postExcluded: isThisPostExludedCheckbox};
|
90 |
+
|
91 |
+
this.yasrUpdatePostMetaAutoInsert = this.yasrUpdatePostMetaAutoInsert.bind(this);
|
92 |
+
}
|
93 |
+
|
94 |
+
yasrUpdatePostMetaAutoInsert(event) {
|
95 |
+
const target = event.target;
|
96 |
+
const postExcluded = target.type === 'checkbox' ? target.checked : target.value;
|
97 |
+
|
98 |
+
this.setState({postExcluded: postExcluded});
|
99 |
+
|
100 |
+
if (postExcluded === true) {
|
101 |
+
wp.data.dispatch('core/editor').editPost(
|
102 |
+
{ meta: { yasr_auto_insert_disabled: 'yes' } }
|
103 |
+
);
|
104 |
+
} else {
|
105 |
+
wp.data.dispatch('core/editor').editPost(
|
106 |
+
{ meta: { yasr_auto_insert_disabled: 'no' } }
|
107 |
+
);
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
render () {
|
112 |
+
return (
|
113 |
+
<div className="yasr-guten-block-panel-center">
|
114 |
+
<hr />
|
115 |
+
<label><span>{yasrDisableAutoInsert}</span></label>
|
116 |
+
<div className="yasr-onoffswitch-big yasr-onoffswitch-big-center" id="yasr-switcher-disable-auto-insert">
|
117 |
+
<input type="checkbox"
|
118 |
+
name="yasr_auto_insert_disabled"
|
119 |
+
className="yasr-onoffswitch-checkbox"
|
120 |
+
value="yes"
|
121 |
+
id="yasr-auto-insert-disabled-switch"
|
122 |
+
defaultChecked={this.state.postExcluded}
|
123 |
+
onChange={this.yasrUpdatePostMetaAutoInsert}
|
124 |
+
/>
|
125 |
+
<label className="yasr-onoffswitch-label" htmlFor="yasr-auto-insert-disabled-switch">
|
126 |
+
<span className="yasr-onoffswitch-inner"/>
|
127 |
+
<span className="yasr-onoffswitch-switch"/>
|
128 |
+
</label>
|
129 |
+
</div>
|
130 |
+
</div>
|
131 |
+
);
|
132 |
+
}
|
133 |
+
|
134 |
+
}
|
135 |
+
|
136 |
+
/*class YasrDivIsReview extends React.Component {
|
137 |
+
|
138 |
+
constructor(props) {
|
139 |
+
super(props);
|
140 |
+
|
141 |
+
let isThisPostReview = wp.data.select('core/editor').getCurrentPost().meta.yasr_post_is_review;
|
142 |
+
let isThisPostReviewCheckbox = false;
|
143 |
+
|
144 |
+
if (isThisPostReview === 'yes') {
|
145 |
+
isThisPostReviewCheckbox = true;
|
146 |
+
}
|
147 |
+
|
148 |
+
this.state = {postIsReview: isThisPostReviewCheckbox};
|
149 |
+
|
150 |
+
this.yasrUpdatePostMetaIsReview = this.yasrUpdatePostMetaIsReview.bind(this);
|
151 |
+
}
|
152 |
+
|
153 |
+
yasrUpdatePostMetaIsReview(event) {
|
154 |
+
|
155 |
+
const target = event.target;
|
156 |
+
const postIsReview = target.type === 'checkbox' ? target.checked : target.value;
|
157 |
+
|
158 |
+
this.setState({postIsReview: postIsReview});
|
159 |
+
|
160 |
+
if (postIsReview === true) {
|
161 |
+
wp.data.dispatch('core/editor').editPost(
|
162 |
+
{ meta: { yasr_post_is_review: 'yes' } }
|
163 |
+
);
|
164 |
+
} else {
|
165 |
+
wp.data.dispatch('core/editor').editPost(
|
166 |
+
{ meta: { yasr_post_is_review: 'no' } }
|
167 |
+
);
|
168 |
+
}
|
169 |
+
|
170 |
+
}
|
171 |
+
|
172 |
+
render () {
|
173 |
+
return (
|
174 |
+
<div className="yasr-guten-block-panel-center">
|
175 |
+
<div className="rich-snippet-title">{yasrRichSnippetOptions}</div>
|
176 |
+
<label><span>{yasrPostExcluded}</span></label>
|
177 |
+
<div className="yasr-onoffswitch-big yasr-onoffswitch-big-center" id="yasr-switcher-post-is-review">
|
178 |
+
<input type="checkbox"
|
179 |
+
name="yasr_post_is_review"
|
180 |
+
className="yasr-onoffswitch-checkbox"
|
181 |
+
value="yes"
|
182 |
+
id="yasr-post-is-review-switch"
|
183 |
+
defaultChecked={this.state.postIsReview}
|
184 |
+
onChange={this.yasrUpdatePostMetaIsReview}
|
185 |
+
/>
|
186 |
+
<label className="yasr-onoffswitch-label" htmlFor="yasr-post-is-review-switch">
|
187 |
+
<span className="yasr-onoffswitch-inner"></span>
|
188 |
+
<span className="yasr-onoffswitch-switch"></span>
|
189 |
+
</label>
|
190 |
+
</div>
|
191 |
+
<p></p>
|
192 |
+
</div>
|
193 |
+
);
|
194 |
+
}
|
195 |
+
|
196 |
+
}
|
197 |
+
|
198 |
+
class YasrSideBarSelectSnippets extends React.Component {
|
199 |
+
|
200 |
+
supportedItemtype;
|
201 |
+
|
202 |
+
constructor(props) {
|
203 |
+
super(props);
|
204 |
+
|
205 |
+
//at the begin, get the default type
|
206 |
+
let snippetType = yasrConstantGutenberg.defaultItemType;
|
207 |
+
|
208 |
+
//get array with all supported itemtypes
|
209 |
+
this.supportedItemtype = wp.data.select('core/editor').getCurrentPost().yasr_all_itemtypes;
|
210 |
+
|
211 |
+
//get postmeta itemtype
|
212 |
+
let postMetaItemType = wp.data.select('core/editor').getCurrentPost().meta.yasr_review_type;
|
213 |
+
|
214 |
+
//if the postmeta is in the array of all item, set in the select the postmeta_itemtype
|
215 |
+
if(this.supportedItemtype.includes(postMetaItemType)) {
|
216 |
+
snippetType = postMetaItemType;
|
217 |
+
}
|
218 |
+
|
219 |
+
this.state = {snippet: snippetType};
|
220 |
+
|
221 |
+
this.yasrSetItemType = this.yasrSetItemType.bind(this);
|
222 |
+
}
|
223 |
+
|
224 |
+
yasrSetItemType(event) {
|
225 |
+
this.setState({snippet: event.target.value});
|
226 |
+
|
227 |
+
wp.data.dispatch( 'core/editor' ).editPost(
|
228 |
+
{ meta: { yasr_review_type: event.target.value } }
|
229 |
+
);
|
230 |
+
}
|
231 |
+
|
232 |
+
render() {
|
233 |
+
return (
|
234 |
+
<div className="yasr-guten-block-panel-center">
|
235 |
+
<label><span>{yasrSelectSnippetTitle}</span></label>
|
236 |
+
<select value={this.state.snippet} onChange={this.yasrSetItemType}>
|
237 |
+
{this.supportedItemtype.map((snippet) => {
|
238 |
+
return <option value={snippet}>{snippet}</option>;
|
239 |
+
})}
|
240 |
+
</select>
|
241 |
+
</div>
|
242 |
+
);
|
243 |
+
}
|
244 |
+
}*/
|
245 |
+
|
246 |
+
class yasrSidebar extends React.Component {
|
247 |
+
|
248 |
+
constructor(props) {
|
249 |
+
super(props);
|
250 |
+
|
251 |
+
let yasrAutoInsertEnabled = false;
|
252 |
+
|
253 |
+
//this is not for the post, but from settings
|
254 |
+
if (yasrConstantGutenberg.autoInsert !== 'disabled') {
|
255 |
+
yasrAutoInsertEnabled = true;
|
256 |
+
}
|
257 |
+
|
258 |
+
this.state = {yasrAutoInsertEnabled: yasrAutoInsertEnabled};
|
259 |
+
|
260 |
+
}
|
261 |
+
|
262 |
+
render() {
|
263 |
+
return (
|
264 |
+
<Fragment>
|
265 |
+
<PluginSidebarMoreMenuItem name="yasr-sidebar" type="sidebar" target="yasr-guten-sidebar" >
|
266 |
+
{ __( 'YASR post settings', 'yet-another-stars-rating' ) }
|
267 |
+
</PluginSidebarMoreMenuItem>
|
268 |
+
<PluginSidebar name="yasr-guten-sidebar" title="YASR Settings">
|
269 |
+
<PanelBody>
|
270 |
+
<div className="yasr-guten-block-panel yasr-guten-block-panel-center">
|
271 |
+
<YasrDivRatingOverall />
|
272 |
+
{this.state.yasrAutoInsertEnabled && <YasrSideBarAutoInsert/>}
|
273 |
+
{<ContentBelowSidebar />}
|
274 |
+
</div>
|
275 |
+
</PanelBody>
|
276 |
+
</PluginSidebar>
|
277 |
+
</Fragment>
|
278 |
+
);
|
279 |
+
}
|
280 |
+
}
|
281 |
+
|
282 |
+
|
283 |
+
|
284 |
+
//Custom sidebar
|
285 |
+
registerPlugin( 'yasr-sidebar', {
|
286 |
+
icon: 'star-half',
|
287 |
+
title: __( 'Yasr: Page Settings', 'yet-another-stars-rating' ),
|
288 |
+
render: yasrSidebar
|
289 |
+
} );
|
admin/js/src/yasr-dashboard.js
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
//Vote log
|
2 |
+
jQuery(document).ready(function () {
|
3 |
+
|
4 |
+
//Log
|
5 |
+
jQuery('.yasr-log-pagenum').on('click', function () {
|
6 |
+
|
7 |
+
jQuery('#yasr-loader-log-metabox').show();
|
8 |
+
|
9 |
+
var data = {
|
10 |
+
action: 'yasr_change_log_page',
|
11 |
+
pagenum: jQuery(this).val(),
|
12 |
+
totalpages: jQuery('#yasr-log-total-pages').data('yasr-log-total-pages')
|
13 |
+
|
14 |
+
};
|
15 |
+
|
16 |
+
jQuery.post(ajaxurl, data, function (response) {
|
17 |
+
jQuery('#yasr-loader-log-metabox').hide();
|
18 |
+
jQuery('#yasr-log-container').html(response);
|
19 |
+
});
|
20 |
+
|
21 |
+
});
|
22 |
+
|
23 |
+
jQuery(document).ajaxComplete(function (event, xhr, settings) {
|
24 |
+
var isYasrAjaxCall = true;
|
25 |
+
|
26 |
+
if(settings.data !== 'undefined') {
|
27 |
+
//check if the ajax call is done by yasr with action yasr_change_log_page
|
28 |
+
isYasrAjaxCall = settings.data.search("action=yasr_change_log_page");
|
29 |
+
}
|
30 |
+
|
31 |
+
if (isYasrAjaxCall !== -1) {
|
32 |
+
jQuery('.yasr-log-pagenum').on('click', function () {
|
33 |
+
jQuery('#yasr-loader-log-metabox').show();
|
34 |
+
|
35 |
+
var data = {
|
36 |
+
action: 'yasr_change_log_page',
|
37 |
+
pagenum: jQuery(this).val(),
|
38 |
+
totalpages: jQuery('#yasr-log-total-pages').data('yasr-log-total-pages')
|
39 |
+
};
|
40 |
+
|
41 |
+
jQuery.post(ajaxurl, data, function (response) {
|
42 |
+
jQuery('#yasr-log-container').html(response); //This will hide the loader gif too
|
43 |
+
});
|
44 |
+
});
|
45 |
+
}
|
46 |
+
|
47 |
+
});
|
48 |
+
|
49 |
+
});
|
50 |
+
|
51 |
+
|
52 |
+
//Vote user log
|
53 |
+
jQuery(document).ready(function () {
|
54 |
+
|
55 |
+
//Log
|
56 |
+
jQuery('.yasr-user-log-page-num').on('click', function () {
|
57 |
+
jQuery('#yasr-loader-user-log-metabox').show();
|
58 |
+
var data = {
|
59 |
+
action: 'yasr_change_user_log_page',
|
60 |
+
pagenum: jQuery(this).val(),
|
61 |
+
totalpages: jQuery('#yasr-user-log-total-pages').data('yasr-log-total-pages')
|
62 |
+
|
63 |
+
};
|
64 |
+
jQuery.post(ajaxurl, data, function (response) {
|
65 |
+
jQuery('#yasr-loader-log-metabox').hide();
|
66 |
+
jQuery('#yasr-user-log-container').html(response);
|
67 |
+
});
|
68 |
+
});
|
69 |
+
|
70 |
+
jQuery(document).ajaxComplete(function (event, xhr, settings) {
|
71 |
+
var isYasrAjaxCall = true;
|
72 |
+
|
73 |
+
if (typeof settings.data === 'undefined') {
|
74 |
+
return;
|
75 |
+
}
|
76 |
+
|
77 |
+
//check if the ajax call is done by yasr with action yasr_change_log_page
|
78 |
+
isYasrAjaxCall = settings.data.search("action=yasr_change_log_page");
|
79 |
+
|
80 |
+
if (isYasrAjaxCall !== -1) {
|
81 |
+
jQuery('.yasr-user-log-page-num').on('click', function () {
|
82 |
+
jQuery('#yasr-loader-user-log-metabox').show();
|
83 |
+
|
84 |
+
var data = {
|
85 |
+
action: 'yasr_change_user_log_page',
|
86 |
+
pagenum: jQuery(this).val(),
|
87 |
+
totalpages: jQuery('#yasr-user-log-total-pages').data('yasr-log-total-pages')
|
88 |
+
};
|
89 |
+
|
90 |
+
jQuery.post(ajaxurl, data, function (response) {
|
91 |
+
jQuery('#yasr-user-log-container').html(response); //This will hide the loader gif too
|
92 |
+
});
|
93 |
+
});
|
94 |
+
|
95 |
+
}
|
96 |
+
|
97 |
+
});
|
98 |
+
|
99 |
+
});
|
admin/js/src/yasr-functions.js
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
copyToClipboard = string => {
|
2 |
+
const el = document.createElement('textarea');
|
3 |
+
el.value = string;
|
4 |
+
el.setAttribute('readonly', '');
|
5 |
+
el.style.position = 'absolute';
|
6 |
+
el.style.left = '-9999px';
|
7 |
+
document.body.appendChild(el);
|
8 |
+
el.select();
|
9 |
+
document.execCommand('copy');
|
10 |
+
document.body.removeChild(el);
|
11 |
+
};
|
12 |
+
|
13 |
+
tippy(
|
14 |
+
document.querySelectorAll('.yasr-copy-shortcode'),
|
15 |
+
{
|
16 |
+
content: 'Copied! Insert into your post!',
|
17 |
+
theme: 'yasr',
|
18 |
+
arrow: 'true',
|
19 |
+
arrowType: 'round',
|
20 |
+
trigger: 'click'
|
21 |
+
}
|
22 |
+
);
|
admin/js/src/yasr-settings-page.js
ADDED
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/****** Yasr Settings Page ******/
|
2 |
+
|
3 |
+
document.addEventListener('DOMContentLoaded', function(event) {
|
4 |
+
|
5 |
+
if (typeof document.getElementsByClassName('nav-tab-active')[0] === 'undefined') {
|
6 |
+
return;
|
7 |
+
}
|
8 |
+
|
9 |
+
//get active Tab
|
10 |
+
let activeTab = document.getElementsByClassName('nav-tab-active')[0].id;
|
11 |
+
|
12 |
+
//-------------------General Settings Code---------------------
|
13 |
+
if (activeTab === 'general_settings') {
|
14 |
+
|
15 |
+
let autoInsertEnabled = document.getElementById('yasr_auto_insert_switch').checked;
|
16 |
+
let textBeforeStars = document.getElementById('yasr-general-options-text-before-stars-switch').checked;
|
17 |
+
|
18 |
+
if (autoInsertEnabled === false) {
|
19 |
+
jQuery('.yasr-auto-insert-options-class').prop('disabled', true);
|
20 |
+
}
|
21 |
+
|
22 |
+
//First Div, for auto insert
|
23 |
+
jQuery('#yasr_auto_insert_switch').change(function () {
|
24 |
+
if (jQuery(this).is(':checked')) {
|
25 |
+
jQuery('.yasr-auto-insert-options-class').prop('disabled', false);
|
26 |
+
} else {
|
27 |
+
jQuery('.yasr-auto-insert-options-class').prop('disabled', true);
|
28 |
+
}
|
29 |
+
});
|
30 |
+
|
31 |
+
//for text before stars
|
32 |
+
if (textBeforeStars === false) {
|
33 |
+
jQuery('.yasr-general-options-text-before').prop('disabled', true);
|
34 |
+
}
|
35 |
+
|
36 |
+
jQuery('#yasr-general-options-text-before-stars-switch').change(function () {
|
37 |
+
if (jQuery(this).is(':checked')) {
|
38 |
+
|
39 |
+
jQuery('.yasr-general-options-text-before').prop('disabled', false);
|
40 |
+
jQuery('#yasr-general-options-custom-text-before-overall').val('Our Score');
|
41 |
+
jQuery('#yasr-general-options-custom-text-before-visitor').val('Click to rate this post!');
|
42 |
+
jQuery('#yasr-general-options-custom-text-after-visitor').val('[Total: %total_count% Average: %average%]');
|
43 |
+
jQuery('#yasr-general-options-custom-text-must-sign-in').val('You must sign in to vote');
|
44 |
+
jQuery('#yasr-general-options-custom-text-already-rated').val('You have already voted for this article');
|
45 |
+
|
46 |
+
} else {
|
47 |
+
jQuery('.yasr-general-options-text-before').prop('disabled', true);
|
48 |
+
}
|
49 |
+
|
50 |
+
});
|
51 |
+
|
52 |
+
jQuery('#yasr-doc-custom-text-link').on('click', function () {
|
53 |
+
jQuery('#yasr-doc-custom-text-div').toggle('slow');
|
54 |
+
return false;
|
55 |
+
});
|
56 |
+
|
57 |
+
jQuery('#yasr-stats-explained-link').on('click', function () {
|
58 |
+
jQuery('#yasr-stats-explained').toggle('slow');
|
59 |
+
return false;
|
60 |
+
});
|
61 |
+
|
62 |
+
} //End if general settings
|
63 |
+
|
64 |
+
|
65 |
+
//--------------Multi Sets Page ------------------
|
66 |
+
if (activeTab === 'manage_multi') {
|
67 |
+
|
68 |
+
let nMultiSet = document.getElementById('n-multiset').value;
|
69 |
+
|
70 |
+
jQuery('#yasr-multi-set-doc-link').on('click', function () {
|
71 |
+
jQuery('#yasr-multi-set-doc-box').toggle("slow");
|
72 |
+
});
|
73 |
+
|
74 |
+
jQuery('#yasr-multi-set-doc-link-hide').on('click', function () {
|
75 |
+
jQuery('#yasr-multi-set-doc-box').toggle("slow");
|
76 |
+
});
|
77 |
+
|
78 |
+
if (nMultiSet === 1) {
|
79 |
+
var counter = jQuery("#yasr-edit-form-number-elements").attr('value');
|
80 |
+
|
81 |
+
counter++;
|
82 |
+
|
83 |
+
jQuery("#yasr-add-field-edit-multiset").on('click', function () {
|
84 |
+
if (counter > 9) {
|
85 |
+
jQuery('#yasr-element-limit').show();
|
86 |
+
jQuery('#yasr-add-field-edit-multiset').hide();
|
87 |
+
return false;
|
88 |
+
}
|
89 |
+
|
90 |
+
var newTextBoxDiv = jQuery(document.createElement('tr'));
|
91 |
+
newTextBoxDiv.html('<td colspan="2">Element #' + counter + ' <input type="text" name="edit-multi-set-element-' + counter + '" value="" ></td>');
|
92 |
+
newTextBoxDiv.appendTo("#yasr-table-form-edit-multi-set");
|
93 |
+
counter++;
|
94 |
+
});
|
95 |
+
|
96 |
+
|
97 |
+
} //End if ($n_multi_set == 1)
|
98 |
+
|
99 |
+
if (nMultiSet > 1) {
|
100 |
+
|
101 |
+
//If more then 1 set is used...
|
102 |
+
jQuery('#yasr-button-select-set-edit-form').on("click", function () {
|
103 |
+
|
104 |
+
var data = {
|
105 |
+
action: 'yasr_get_multi_set',
|
106 |
+
set_id: jQuery('#yasr_select_edit_set').val()
|
107 |
+
};
|
108 |
+
|
109 |
+
jQuery.post(ajaxurl, data, function (response) {
|
110 |
+
jQuery('#yasr-multi-set-response').show();
|
111 |
+
jQuery('#yasr-multi-set-response').html(response);
|
112 |
+
});
|
113 |
+
|
114 |
+
return false; // prevent default click action from happening!
|
115 |
+
|
116 |
+
});
|
117 |
+
|
118 |
+
jQuery(document).ajaxComplete(function () {
|
119 |
+
var counter = jQuery("#yasr-edit-form-number-elements").attr('value');
|
120 |
+
counter++;
|
121 |
+
|
122 |
+
jQuery("#yasr-add-field-edit-multiset").on('click', function () {
|
123 |
+
if (counter > 9) {
|
124 |
+
jQuery('#yasr-element-limit').show();
|
125 |
+
jQuery('#yasr-add-field-edit-multiset').hide();
|
126 |
+
return false;
|
127 |
+
}
|
128 |
+
var newTextBoxDiv = jQuery(document.createElement('tr'));
|
129 |
+
newTextBoxDiv.html('<td colspan="2">Element #' + counter + ' <input type="text" name="edit-multi-set-element-' + counter + '" value="" ></td>');
|
130 |
+
newTextBoxDiv.appendTo("#yasr-table-form-edit-multi-set");
|
131 |
+
counter++;
|
132 |
+
});
|
133 |
+
|
134 |
+
});
|
135 |
+
|
136 |
+
} //End if ($n_multi_set > 1)
|
137 |
+
|
138 |
+
} //end if active_tab=='manage_multi'
|
139 |
+
|
140 |
+
if (activeTab === 'style_options') {
|
141 |
+
wp.codeEditor.initialize(
|
142 |
+
document.getElementById('yasr_style_options_textarea'),
|
143 |
+
yasr_cm_settings
|
144 |
+
);
|
145 |
+
|
146 |
+
jQuery('#yasr-color-scheme-preview-link').on('click', function () {
|
147 |
+
jQuery('#yasr-color-scheme-preview').toggle('slow');
|
148 |
+
return false; // prevent default click action from happening!
|
149 |
+
});
|
150 |
+
|
151 |
+
}
|
152 |
+
|
153 |
+
if (activeTab === 'migration_tools') {
|
154 |
+
jQuery('#yasr-import-ratemypost-submit').on('click', function () {
|
155 |
+
|
156 |
+
//show loader on click
|
157 |
+
document.getElementById('yasr-import-ratemypost-answer').innerHTML = '<img src="'
|
158 |
+
+ yasrCommonDataAdmin.loaderHtml + '"</img>';
|
159 |
+
|
160 |
+
var nonce = document.getElementById('yasr-import-rmp-nonce').value;
|
161 |
+
|
162 |
+
var data = {
|
163 |
+
action: 'yasr_import_ratemypost',
|
164 |
+
nonce: nonce
|
165 |
+
};
|
166 |
+
|
167 |
+
jQuery.post(ajaxurl, data, function (response) {
|
168 |
+
response = JSON.parse(response);
|
169 |
+
document.getElementById('yasr-import-ratemypost-answer').innerHTML = response;
|
170 |
+
});
|
171 |
+
|
172 |
+
});
|
173 |
+
|
174 |
+
jQuery('#yasr-import-wppr-submit').on('click', function () {
|
175 |
+
|
176 |
+
//show loader on click
|
177 |
+
document.getElementById('yasr-import-wppr-answer').innerHTML = '<img src="'
|
178 |
+
+ yasrCommonDataAdmin.loaderHtml + '"</img>';
|
179 |
+
|
180 |
+
var nonce = document.getElementById('yasr-import-wppr-nonce').value;
|
181 |
+
|
182 |
+
var data = {
|
183 |
+
action: 'yasr_import_wppr',
|
184 |
+
nonce: nonce
|
185 |
+
};
|
186 |
+
|
187 |
+
jQuery.post(ajaxurl, data, function (response) {
|
188 |
+
//response = JSON.parse(response);
|
189 |
+
document.getElementById('yasr-import-wppr-answer').innerHTML = response;
|
190 |
+
});
|
191 |
+
|
192 |
+
});
|
193 |
+
|
194 |
+
jQuery('#yasr-import-kksr-submit').on('click', function () {
|
195 |
+
|
196 |
+
//show loader on click
|
197 |
+
document.getElementById('yasr-import-kksr-answer').innerHTML = '<img src="'
|
198 |
+
+ yasrCommonDataAdmin.loaderHtml + '"</img>';
|
199 |
+
|
200 |
+
var nonce = document.getElementById('yasr-import-kksr-nonce').value;
|
201 |
+
|
202 |
+
var data = {
|
203 |
+
action: 'yasr_import_kksr',
|
204 |
+
nonce: nonce
|
205 |
+
};
|
206 |
+
|
207 |
+
jQuery.post(ajaxurl, data, function (response) {
|
208 |
+
//response = JSON.parse(response);
|
209 |
+
document.getElementById('yasr-import-kksr-answer').innerHTML = response;
|
210 |
+
});
|
211 |
+
|
212 |
+
});
|
213 |
+
|
214 |
+
//import multi rating
|
215 |
+
jQuery('#yasr-import-mr-submit').on('click', function () {
|
216 |
+
|
217 |
+
//show loader on click
|
218 |
+
document.getElementById('yasr-import-mr-answer').innerHTML = '<img src="'
|
219 |
+
+ yasrCommonDataAdmin.loaderHtml + '"</img>';
|
220 |
+
|
221 |
+
var nonce = document.getElementById('yasr-import-mr-nonce').value;
|
222 |
+
|
223 |
+
var data = {
|
224 |
+
action: 'yasr_import_mr',
|
225 |
+
nonce: nonce
|
226 |
+
};
|
227 |
+
|
228 |
+
jQuery.post(ajaxurl, data, function (response) {
|
229 |
+
//response = JSON.parse(response);
|
230 |
+
document.getElementById('yasr-import-mr-answer').innerHTML = response;
|
231 |
+
});
|
232 |
+
|
233 |
+
});
|
234 |
+
}
|
235 |
+
});
|
236 |
+
|
237 |
+
/****** End Yasr Settings Page ******/
|
admin/js/yasr-admin.js
CHANGED
@@ -1,374 +1 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
Copyright 2014 Dario Curvino (email : d.curvino@tiscali.it)
|
4 |
-
|
5 |
-
This program is free software: you can redistribute it and/or modify
|
6 |
-
it under the terms of the GNU General Public License as published by
|
7 |
-
the Free Software Foundation, either version 2 of the License, or
|
8 |
-
(at your option) any later version.
|
9 |
-
|
10 |
-
This program is distributed in the hope that it will be useful,
|
11 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
-
GNU General Public License for more details.
|
14 |
-
|
15 |
-
You should have received a copy of the GNU General Public License
|
16 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>
|
17 |
-
*/
|
18 |
-
|
19 |
-
|
20 |
-
/*** Constant used by yasr
|
21 |
-
|
22 |
-
yasrCommonDataAdmin (loaderHtml)
|
23 |
-
|
24 |
-
***/
|
25 |
-
|
26 |
-
/****** Yasr Settings Page ******/
|
27 |
-
|
28 |
-
function YasrSettingsPage(activeTab, nMultiSet, autoInsertEnabled, textBeforeStars) {
|
29 |
-
|
30 |
-
//-------------------General Settings Code---------------------
|
31 |
-
|
32 |
-
if (activeTab === 'general_settings') {
|
33 |
-
|
34 |
-
if (autoInsertEnabled == 0) {
|
35 |
-
jQuery('.yasr-auto-insert-options-class').prop('disabled', true);
|
36 |
-
}
|
37 |
-
|
38 |
-
//First Div, for auto insert
|
39 |
-
jQuery('#yasr_auto_insert_switch').change(function () {
|
40 |
-
if (jQuery(this).is(':checked')) {
|
41 |
-
jQuery('.yasr-auto-insert-options-class').prop('disabled', false);
|
42 |
-
} else {
|
43 |
-
jQuery('.yasr-auto-insert-options-class').prop('disabled', true);
|
44 |
-
}
|
45 |
-
});
|
46 |
-
|
47 |
-
//for text before stars
|
48 |
-
if (textBeforeStars == 0) {
|
49 |
-
jQuery('.yasr-general-options-text-before').prop('disabled', true);
|
50 |
-
}
|
51 |
-
|
52 |
-
jQuery('#yasr-general-options-text-before-stars-switch').change(function () {
|
53 |
-
if (jQuery(this).is(':checked')) {
|
54 |
-
|
55 |
-
jQuery('.yasr-general-options-text-before').prop('disabled', false);
|
56 |
-
jQuery('#yasr-general-options-custom-text-before-overall').val('Our Score');
|
57 |
-
jQuery('#yasr-general-options-custom-text-before-visitor').val('Click to rate this post!');
|
58 |
-
jQuery('#yasr-general-options-custom-text-after-visitor').val('[Total: %total_count% Average: %average%]');
|
59 |
-
jQuery('#yasr-general-options-custom-text-must-sign-in').val('You must sign in to vote');
|
60 |
-
jQuery('#yasr-general-options-custom-text-already-rated').val('You have already voted for this article');
|
61 |
-
|
62 |
-
} else {
|
63 |
-
jQuery('.yasr-general-options-text-before').prop('disabled', true);
|
64 |
-
}
|
65 |
-
|
66 |
-
});
|
67 |
-
|
68 |
-
jQuery('#yasr-doc-custom-text-link').on('click', function () {
|
69 |
-
jQuery('#yasr-doc-custom-text-div').toggle('slow');
|
70 |
-
return false;
|
71 |
-
});
|
72 |
-
|
73 |
-
jQuery('#yasr-stats-explained-link').on('click', function () {
|
74 |
-
jQuery('#yasr-stats-explained').toggle('slow');
|
75 |
-
return false;
|
76 |
-
});
|
77 |
-
|
78 |
-
} //End if general settings
|
79 |
-
|
80 |
-
//--------------Multi Sets Page ------------------
|
81 |
-
|
82 |
-
if (activeTab === 'manage_multi') {
|
83 |
-
|
84 |
-
jQuery('#yasr-multi-set-doc-link').on('click', function () {
|
85 |
-
jQuery('#yasr-multi-set-doc-box').toggle("slow");
|
86 |
-
});
|
87 |
-
|
88 |
-
jQuery('#yasr-multi-set-doc-link-hide').on('click', function () {
|
89 |
-
jQuery('#yasr-multi-set-doc-box').toggle("slow");
|
90 |
-
});
|
91 |
-
|
92 |
-
if (nMultiSet == 1) {
|
93 |
-
|
94 |
-
var counter = jQuery("#yasr-edit-form-number-elements").attr('value');
|
95 |
-
|
96 |
-
counter++;
|
97 |
-
|
98 |
-
jQuery("#yasr-add-field-edit-multiset").on('click', function () {
|
99 |
-
|
100 |
-
if (counter > 9) {
|
101 |
-
jQuery('#yasr-element-limit').show();
|
102 |
-
jQuery('#yasr-add-field-edit-multiset').hide();
|
103 |
-
return false;
|
104 |
-
}
|
105 |
-
|
106 |
-
var newTextBoxDiv = jQuery(document.createElement('tr'));
|
107 |
-
|
108 |
-
newTextBoxDiv.html('<td colspan="2">Element #' + counter + ' <input type="text" name="edit-multi-set-element-' + counter + '" value="" ></td>');
|
109 |
-
|
110 |
-
newTextBoxDiv.appendTo("#yasr-table-form-edit-multi-set");
|
111 |
-
|
112 |
-
counter++;
|
113 |
-
|
114 |
-
});
|
115 |
-
|
116 |
-
|
117 |
-
} //End if ($n_multi_set == 1)
|
118 |
-
|
119 |
-
if (nMultiSet > 1) {
|
120 |
-
|
121 |
-
//If more then 1 set is used...
|
122 |
-
jQuery('#yasr-button-select-set-edit-form').on("click", function () {
|
123 |
-
|
124 |
-
var data = {
|
125 |
-
action: 'yasr_get_multi_set',
|
126 |
-
set_id: jQuery('#yasr_select_edit_set').val()
|
127 |
-
};
|
128 |
-
|
129 |
-
jQuery.post(ajaxurl, data, function (response) {
|
130 |
-
jQuery('#yasr-multi-set-response').show();
|
131 |
-
jQuery('#yasr-multi-set-response').html(response);
|
132 |
-
});
|
133 |
-
|
134 |
-
return false; // prevent default click action from happening!
|
135 |
-
|
136 |
-
});
|
137 |
-
|
138 |
-
jQuery(document).ajaxComplete(function () {
|
139 |
-
|
140 |
-
var counter = jQuery("#yasr-edit-form-number-elements").attr('value');
|
141 |
-
|
142 |
-
counter++;
|
143 |
-
|
144 |
-
jQuery("#yasr-add-field-edit-multiset").on('click', function () {
|
145 |
-
|
146 |
-
if (counter > 9) {
|
147 |
-
jQuery('#yasr-element-limit').show();
|
148 |
-
jQuery('#yasr-add-field-edit-multiset').hide();
|
149 |
-
return false;
|
150 |
-
}
|
151 |
-
|
152 |
-
var newTextBoxDiv = jQuery(document.createElement('tr'));
|
153 |
-
|
154 |
-
newTextBoxDiv.html('<td colspan="2">Element #' + counter + ' <input type="text" name="edit-multi-set-element-' + counter + '" value="" ></td>');
|
155 |
-
|
156 |
-
newTextBoxDiv.appendTo("#yasr-table-form-edit-multi-set");
|
157 |
-
|
158 |
-
counter++;
|
159 |
-
|
160 |
-
});
|
161 |
-
|
162 |
-
});
|
163 |
-
|
164 |
-
} //End if ($n_multi_set > 1)
|
165 |
-
|
166 |
-
|
167 |
-
} //end if active_tab=='manage_multi'
|
168 |
-
|
169 |
-
|
170 |
-
if (activeTab === 'style_options') {
|
171 |
-
wp.codeEditor.initialize(
|
172 |
-
document.getElementById('yasr_style_options_textarea'),
|
173 |
-
yasr_cm_settings
|
174 |
-
);
|
175 |
-
|
176 |
-
jQuery('#yasr-color-scheme-preview-link').on('click', function () {
|
177 |
-
jQuery('#yasr-color-scheme-preview').toggle('slow');
|
178 |
-
return false; // prevent default click action from happening!
|
179 |
-
});
|
180 |
-
|
181 |
-
}
|
182 |
-
|
183 |
-
|
184 |
-
}
|
185 |
-
|
186 |
-
|
187 |
-
/****** Migration tools page ******/
|
188 |
-
document.addEventListener('DOMContentLoaded', function(event) {
|
189 |
-
|
190 |
-
jQuery('#yasr-import-ratemypost-submit').on('click', function() {
|
191 |
-
|
192 |
-
//show loader on click
|
193 |
-
document.getElementById('yasr-import-ratemypost-answer').innerHTML = '<img src="'
|
194 |
-
+yasrCommonDataAdmin.loaderHtml+'"</img>';
|
195 |
-
|
196 |
-
var nonce = document.getElementById('yasr-import-rmp-nonce').value;
|
197 |
-
|
198 |
-
var data = {
|
199 |
-
action: 'yasr_import_ratemypost',
|
200 |
-
nonce: nonce
|
201 |
-
};
|
202 |
-
|
203 |
-
jQuery.post(ajaxurl, data, function (response) {
|
204 |
-
response = JSON.parse(response);
|
205 |
-
document.getElementById('yasr-import-ratemypost-answer').innerHTML = response;
|
206 |
-
});
|
207 |
-
|
208 |
-
});
|
209 |
-
|
210 |
-
jQuery('#yasr-import-wppr-submit').on('click', function() {
|
211 |
-
|
212 |
-
//show loader on click
|
213 |
-
document.getElementById('yasr-import-wppr-answer').innerHTML = '<img src="'
|
214 |
-
+yasrCommonDataAdmin.loaderHtml+'"</img>';
|
215 |
-
|
216 |
-
var nonce = document.getElementById('yasr-import-wppr-nonce').value;
|
217 |
-
|
218 |
-
var data = {
|
219 |
-
action: 'yasr_import_wppr',
|
220 |
-
nonce: nonce
|
221 |
-
};
|
222 |
-
|
223 |
-
jQuery.post(ajaxurl, data, function (response) {
|
224 |
-
//response = JSON.parse(response);
|
225 |
-
document.getElementById('yasr-import-wppr-answer').innerHTML = response;
|
226 |
-
});
|
227 |
-
|
228 |
-
});
|
229 |
-
|
230 |
-
jQuery('#yasr-import-kksr-submit').on('click', function() {
|
231 |
-
|
232 |
-
//show loader on click
|
233 |
-
document.getElementById('yasr-import-kksr-answer').innerHTML = '<img src="'
|
234 |
-
+yasrCommonDataAdmin.loaderHtml+'"</img>';
|
235 |
-
|
236 |
-
var nonce = document.getElementById('yasr-import-kksr-nonce').value;
|
237 |
-
|
238 |
-
var data = {
|
239 |
-
action: 'yasr_import_kksr',
|
240 |
-
nonce: nonce
|
241 |
-
};
|
242 |
-
|
243 |
-
jQuery.post(ajaxurl, data, function (response) {
|
244 |
-
//response = JSON.parse(response);
|
245 |
-
document.getElementById('yasr-import-kksr-answer').innerHTML = response;
|
246 |
-
});
|
247 |
-
|
248 |
-
});
|
249 |
-
|
250 |
-
//import multi rating
|
251 |
-
jQuery('#yasr-import-mr-submit').on('click', function() {
|
252 |
-
|
253 |
-
//show loader on click
|
254 |
-
document.getElementById('yasr-import-mr-answer').innerHTML = '<img src="'
|
255 |
-
+yasrCommonDataAdmin.loaderHtml+'"</img>';
|
256 |
-
|
257 |
-
var nonce = document.getElementById('yasr-import-mr-nonce').value;
|
258 |
-
|
259 |
-
var data = {
|
260 |
-
action: 'yasr_import_mr',
|
261 |
-
nonce: nonce
|
262 |
-
};
|
263 |
-
|
264 |
-
jQuery.post(ajaxurl, data, function (response) {
|
265 |
-
//response = JSON.parse(response);
|
266 |
-
document.getElementById('yasr-import-mr-answer').innerHTML = response;
|
267 |
-
});
|
268 |
-
|
269 |
-
});
|
270 |
-
|
271 |
-
});
|
272 |
-
|
273 |
-
/****** End Yasr Settings Page ******/
|
274 |
-
|
275 |
-
/****** Yasr db functions ******/
|
276 |
-
|
277 |
-
//Vote log
|
278 |
-
jQuery(document).ready(function () {
|
279 |
-
|
280 |
-
//Log
|
281 |
-
jQuery('.yasr-log-pagenum').on('click', function () {
|
282 |
-
|
283 |
-
jQuery('#yasr-loader-log-metabox').show();
|
284 |
-
|
285 |
-
var data = {
|
286 |
-
action: 'yasr_change_log_page',
|
287 |
-
pagenum: jQuery(this).val(),
|
288 |
-
totalpages: jQuery('#yasr-log-total-pages').data('yasr-log-total-pages')
|
289 |
-
|
290 |
-
};
|
291 |
-
|
292 |
-
jQuery.post(ajaxurl, data, function (response) {
|
293 |
-
jQuery('#yasr-loader-log-metabox').hide();
|
294 |
-
jQuery('#yasr-log-container').html(response);
|
295 |
-
});
|
296 |
-
|
297 |
-
});
|
298 |
-
|
299 |
-
jQuery(document).ajaxComplete(function (event, xhr, settings) {
|
300 |
-
var isYasrAjaxCall = true;
|
301 |
-
|
302 |
-
if(settings.data !== 'undefined') {
|
303 |
-
//check if the ajax call is done by yasr with action yasr_change_log_page
|
304 |
-
isYasrAjaxCall = settings.data.search("action=yasr_change_log_page");
|
305 |
-
}
|
306 |
-
|
307 |
-
if (isYasrAjaxCall !== -1) {
|
308 |
-
jQuery('.yasr-log-pagenum').on('click', function () {
|
309 |
-
jQuery('#yasr-loader-log-metabox').show();
|
310 |
-
|
311 |
-
var data = {
|
312 |
-
action: 'yasr_change_log_page',
|
313 |
-
pagenum: jQuery(this).val(),
|
314 |
-
totalpages: jQuery('#yasr-log-total-pages').data('yasr-log-total-pages')
|
315 |
-
};
|
316 |
-
|
317 |
-
jQuery.post(ajaxurl, data, function (response) {
|
318 |
-
jQuery('#yasr-log-container').html(response); //This will hide the loader gif too
|
319 |
-
});
|
320 |
-
});
|
321 |
-
}
|
322 |
-
|
323 |
-
});
|
324 |
-
|
325 |
-
});
|
326 |
-
|
327 |
-
|
328 |
-
//Vote user log
|
329 |
-
jQuery(document).ready(function () {
|
330 |
-
|
331 |
-
//Log
|
332 |
-
jQuery('.yasr-user-log-page-num').on('click', function () {
|
333 |
-
jQuery('#yasr-loader-user-log-metabox').show();
|
334 |
-
var data = {
|
335 |
-
action: 'yasr_change_user_log_page',
|
336 |
-
pagenum: jQuery(this).val(),
|
337 |
-
totalpages: jQuery('#yasr-user-log-total-pages').data('yasr-log-total-pages')
|
338 |
-
|
339 |
-
};
|
340 |
-
jQuery.post(ajaxurl, data, function (response) {
|
341 |
-
jQuery('#yasr-loader-log-metabox').hide();
|
342 |
-
jQuery('#yasr-user-log-container').html(response);
|
343 |
-
});
|
344 |
-
});
|
345 |
-
|
346 |
-
jQuery(document).ajaxComplete(function (event, xhr, settings) {
|
347 |
-
var isYasrAjaxCall = true;
|
348 |
-
|
349 |
-
if(settings.data !== 'undefined') {
|
350 |
-
//check if the ajax call is done by yasr with action yasr_change_log_page
|
351 |
-
isYasrAjaxCall = settings.data.search("action=yasr_change_log_page");
|
352 |
-
}
|
353 |
-
if (isYasrAjaxCall !== -1) {
|
354 |
-
jQuery('.yasr-user-log-page-num').on('click', function () {
|
355 |
-
jQuery('#yasr-loader-user-log-metabox').show();
|
356 |
-
|
357 |
-
var data = {
|
358 |
-
action: 'yasr_change_user_log_page',
|
359 |
-
pagenum: jQuery(this).val(),
|
360 |
-
totalpages: jQuery('#yasr-user-log-total-pages').data('yasr-log-total-pages')
|
361 |
-
};
|
362 |
-
|
363 |
-
jQuery.post(ajaxurl, data, function (response) {
|
364 |
-
jQuery('#yasr-user-log-container').html(response); //This will hide the loader gif too
|
365 |
-
});
|
366 |
-
});
|
367 |
-
|
368 |
-
}
|
369 |
-
|
370 |
-
});
|
371 |
-
|
372 |
-
});
|
373 |
-
|
374 |
-
/****** End yasr db functions ******/
|
1 |
+
!function(e){var t={};function r(o){if(t[o])return t[o].exports;var a=t[o]={i:o,l:!1,exports:{}};return e[o].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(o,a,function(t){return e[t]}.bind(null,a));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){r(1),r(2),e.exports=r(3)},function(e,t){copyToClipboard=e=>{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)},tippy(document.querySelectorAll(".yasr-copy-shortcode"),{content:"Copied! Insert into your post!",theme:"yasr",arrow:"true",arrowType:"round",trigger:"click"})},function(e,t){jQuery(document).ready((function(){jQuery(".yasr-log-pagenum").on("click",(function(){jQuery("#yasr-loader-log-metabox").show();var e={action:"yasr_change_log_page",pagenum:jQuery(this).val(),totalpages:jQuery("#yasr-log-total-pages").data("yasr-log-total-pages")};jQuery.post(ajaxurl,e,(function(e){jQuery("#yasr-loader-log-metabox").hide(),jQuery("#yasr-log-container").html(e)}))})),jQuery(document).ajaxComplete((function(e,t,r){var o=!0;"undefined"!==r.data&&(o=r.data.search("action=yasr_change_log_page")),-1!==o&&jQuery(".yasr-log-pagenum").on("click",(function(){jQuery("#yasr-loader-log-metabox").show();var e={action:"yasr_change_log_page",pagenum:jQuery(this).val(),totalpages:jQuery("#yasr-log-total-pages").data("yasr-log-total-pages")};jQuery.post(ajaxurl,e,(function(e){jQuery("#yasr-log-container").html(e)}))}))}))})),jQuery(document).ready((function(){jQuery(".yasr-user-log-page-num").on("click",(function(){jQuery("#yasr-loader-user-log-metabox").show();var e={action:"yasr_change_user_log_page",pagenum:jQuery(this).val(),totalpages:jQuery("#yasr-user-log-total-pages").data("yasr-log-total-pages")};jQuery.post(ajaxurl,e,(function(e){jQuery("#yasr-loader-log-metabox").hide(),jQuery("#yasr-user-log-container").html(e)}))})),jQuery(document).ajaxComplete((function(e,t,r){void 0!==r.data&&-1!==r.data.search("action=yasr_change_log_page")&&jQuery(".yasr-user-log-page-num").on("click",(function(){jQuery("#yasr-loader-user-log-metabox").show();var e={action:"yasr_change_user_log_page",pagenum:jQuery(this).val(),totalpages:jQuery("#yasr-user-log-total-pages").data("yasr-log-total-pages")};jQuery.post(ajaxurl,e,(function(e){jQuery("#yasr-user-log-container").html(e)}))}))}))}))},function(e,t){document.addEventListener("DOMContentLoaded",(function(e){if(void 0===document.getElementsByClassName("nav-tab-active")[0])return;let t=document.getElementsByClassName("nav-tab-active")[0].id;if("general_settings"===t){let e=document.getElementById("yasr_auto_insert_switch").checked,t=document.getElementById("yasr-general-options-text-before-stars-switch").checked;!1===e&&jQuery(".yasr-auto-insert-options-class").prop("disabled",!0),jQuery("#yasr_auto_insert_switch").change((function(){jQuery(this).is(":checked")?jQuery(".yasr-auto-insert-options-class").prop("disabled",!1):jQuery(".yasr-auto-insert-options-class").prop("disabled",!0)})),!1===t&&jQuery(".yasr-general-options-text-before").prop("disabled",!0),jQuery("#yasr-general-options-text-before-stars-switch").change((function(){jQuery(this).is(":checked")?(jQuery(".yasr-general-options-text-before").prop("disabled",!1),jQuery("#yasr-general-options-custom-text-before-overall").val("Our Score"),jQuery("#yasr-general-options-custom-text-before-visitor").val("Click to rate this post!"),jQuery("#yasr-general-options-custom-text-after-visitor").val("[Total: %total_count% Average: %average%]"),jQuery("#yasr-general-options-custom-text-must-sign-in").val("You must sign in to vote"),jQuery("#yasr-general-options-custom-text-already-rated").val("You have already voted for this article")):jQuery(".yasr-general-options-text-before").prop("disabled",!0)})),jQuery("#yasr-doc-custom-text-link").on("click",(function(){return jQuery("#yasr-doc-custom-text-div").toggle("slow"),!1})),jQuery("#yasr-stats-explained-link").on("click",(function(){return jQuery("#yasr-stats-explained").toggle("slow"),!1}))}if("manage_multi"===t){let e=document.getElementById("n-multiset").value;if(jQuery("#yasr-multi-set-doc-link").on("click",(function(){jQuery("#yasr-multi-set-doc-box").toggle("slow")})),jQuery("#yasr-multi-set-doc-link-hide").on("click",(function(){jQuery("#yasr-multi-set-doc-box").toggle("slow")})),1===e){var r=jQuery("#yasr-edit-form-number-elements").attr("value");r++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(r>9)return jQuery("#yasr-element-limit").show(),jQuery("#yasr-add-field-edit-multiset").hide(),!1;var e=jQuery(document.createElement("tr"));e.html('<td colspan="2">Element #'+r+' <input type="text" name="edit-multi-set-element-'+r+'" value="" ></td>'),e.appendTo("#yasr-table-form-edit-multi-set"),r++}))}e>1&&(jQuery("#yasr-button-select-set-edit-form").on("click",(function(){var e={action:"yasr_get_multi_set",set_id:jQuery("#yasr_select_edit_set").val()};return jQuery.post(ajaxurl,e,(function(e){jQuery("#yasr-multi-set-response").show(),jQuery("#yasr-multi-set-response").html(e)})),!1})),jQuery(document).ajaxComplete((function(){var e=jQuery("#yasr-edit-form-number-elements").attr("value");e++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(e>9)return jQuery("#yasr-element-limit").show(),jQuery("#yasr-add-field-edit-multiset").hide(),!1;var t=jQuery(document.createElement("tr"));t.html('<td colspan="2">Element #'+e+' <input type="text" name="edit-multi-set-element-'+e+'" value="" ></td>'),t.appendTo("#yasr-table-form-edit-multi-set"),e++}))})))}"style_options"===t&&(wp.codeEditor.initialize(document.getElementById("yasr_style_options_textarea"),yasr_cm_settings),jQuery("#yasr-color-scheme-preview-link").on("click",(function(){return jQuery("#yasr-color-scheme-preview").toggle("slow"),!1}))),"migration_tools"===t&&(jQuery("#yasr-import-ratemypost-submit").on("click",(function(){document.getElementById("yasr-import-ratemypost-answer").innerHTML='<img src="'+yasrCommonDataAdmin.loaderHtml+'"</img>';var e={action:"yasr_import_ratemypost",nonce:document.getElementById("yasr-import-rmp-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-ratemypost-answer").innerHTML=e}))})),jQuery("#yasr-import-wppr-submit").on("click",(function(){document.getElementById("yasr-import-wppr-answer").innerHTML='<img src="'+yasrCommonDataAdmin.loaderHtml+'"</img>';var e={action:"yasr_import_wppr",nonce:document.getElementById("yasr-import-wppr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-wppr-answer").innerHTML=e}))})),jQuery("#yasr-import-kksr-submit").on("click",(function(){document.getElementById("yasr-import-kksr-answer").innerHTML='<img src="'+yasrCommonDataAdmin.loaderHtml+'"</img>';var e={action:"yasr_import_kksr",nonce:document.getElementById("yasr-import-kksr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-kksr-answer").innerHTML=e}))})),jQuery("#yasr-import-mr-submit").on("click",(function(){document.getElementById("yasr-import-mr-answer").innerHTML='<img src="'+yasrCommonDataAdmin.loaderHtml+'"</img>';var e={action:"yasr_import_mr",nonce:document.getElementById("yasr-import-mr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-mr-answer").innerHTML=e}))})))}))}]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/js/yasr-editor-screen.js
CHANGED
@@ -164,7 +164,6 @@ function yasrAdminMultiSet(nMultiSet, postid, setId) {
|
|
164 |
|
165 |
}
|
166 |
|
167 |
-
|
168 |
//print the table
|
169 |
function yasrPrintAdminMultiSet(setId, postid, moreThanOneMultiSet) {
|
170 |
|
@@ -196,7 +195,7 @@ function yasrPrintAdminMultiSet(setId, postid, moreThanOneMultiSet) {
|
|
196 |
content += '<td><div class="yasr-multiset-admin" id="yasr-multiset-admin-' + valueID + '" data-rating="'
|
197 |
+ valueRating + '" data-multi-idfield="' + valueID + '"></div>';
|
198 |
content += '<span id="yasr-loader-multi-set-field-' + valueID + '" style="display: none">';
|
199 |
-
content += '<img src="' + yasrCommonDataAdmin.loaderHtml + '"></span>';
|
200 |
content += '</span>';
|
201 |
content += '</td>';
|
202 |
content += '</tr>';
|
164 |
|
165 |
}
|
166 |
|
|
|
167 |
//print the table
|
168 |
function yasrPrintAdminMultiSet(setId, postid, moreThanOneMultiSet) {
|
169 |
|
195 |
content += '<td><div class="yasr-multiset-admin" id="yasr-multiset-admin-' + valueID + '" data-rating="'
|
196 |
+ valueRating + '" data-multi-idfield="' + valueID + '"></div>';
|
197 |
content += '<span id="yasr-loader-multi-set-field-' + valueID + '" style="display: none">';
|
198 |
+
content += '<img src="' + yasrCommonDataAdmin.loaderHtml + '" alt="yasr-loader"></span>';
|
199 |
content += '</span>';
|
200 |
content += '</td>';
|
201 |
content += '</tr>';
|
admin/js/yasr-guten-panel.js
CHANGED
@@ -327,7 +327,7 @@ var yasrSidebar = function (_React$Component3) {
|
|
327 |
{ className: 'yasr-guten-block-panel yasr-guten-block-panel-center' },
|
328 |
React.createElement(YasrDivRatingOverall, null),
|
329 |
this.state.yasrAutoInsertEnabled && React.createElement(YasrSideBarAutoInsert, null),
|
330 |
-
|
331 |
)
|
332 |
)
|
333 |
)
|
327 |
{ className: 'yasr-guten-block-panel yasr-guten-block-panel-center' },
|
328 |
React.createElement(YasrDivRatingOverall, null),
|
329 |
this.state.yasrAutoInsertEnabled && React.createElement(YasrSideBarAutoInsert, null),
|
330 |
+
React.createElement(ContentBelowSidebar, null)
|
331 |
)
|
332 |
)
|
333 |
)
|
admin/settings/multiset/yasr-settings-functions-multiset-page.php
CHANGED
@@ -26,7 +26,7 @@ $error_new_multi_set = yasr_process_new_multi_set_form(); //defined in yasr-sett
|
|
26 |
$error_edit_multi_set = yasr_process_edit_multi_set_form(); //defined in yasr-settings-functions
|
27 |
|
28 |
if ($error_new_multi_set) {
|
29 |
-
echo "<div class
|
30 |
|
31 |
foreach ($error_new_multi_set as $error) {
|
32 |
_e($error, 'yet-another-stars-rating');
|
@@ -37,7 +37,7 @@ if ($error_new_multi_set) {
|
|
37 |
}
|
38 |
|
39 |
if ($error_edit_multi_set) {
|
40 |
-
echo "<div class
|
41 |
|
42 |
foreach ($error_edit_multi_set as $error) {
|
43 |
_e($error, 'yet-another-stars-rating');
|
@@ -50,11 +50,12 @@ if ($error_edit_multi_set) {
|
|
50 |
global $wpdb;
|
51 |
|
52 |
$multi_set = YasrMultiSetData::returnMultiSetNames();
|
53 |
-
$n_multi_set = $wpdb->num_rows; //wpdb->num_rows always store the last of the last query
|
54 |
|
55 |
?>
|
56 |
|
57 |
<div class="yasr-settingsdiv">
|
|
|
58 |
<h3> <?php _e("Manage Multi Set", 'yet-another-stars-rating'); ?></h3>
|
59 |
|
60 |
<p>
|
26 |
$error_edit_multi_set = yasr_process_edit_multi_set_form(); //defined in yasr-settings-functions
|
27 |
|
28 |
if ($error_new_multi_set) {
|
29 |
+
echo "<div class='error'> <p> <strong>";
|
30 |
|
31 |
foreach ($error_new_multi_set as $error) {
|
32 |
_e($error, 'yet-another-stars-rating');
|
37 |
}
|
38 |
|
39 |
if ($error_edit_multi_set) {
|
40 |
+
echo "<div class='error'> <p> <strong>";
|
41 |
|
42 |
foreach ($error_edit_multi_set as $error) {
|
43 |
_e($error, 'yet-another-stars-rating');
|
50 |
global $wpdb;
|
51 |
|
52 |
$multi_set = YasrMultiSetData::returnMultiSetNames();
|
53 |
+
$n_multi_set = (int)$wpdb->num_rows; //wpdb->num_rows always store the last of the last query
|
54 |
|
55 |
?>
|
56 |
|
57 |
<div class="yasr-settingsdiv">
|
58 |
+
<input type="hidden" value="<?php echo $n_multi_set; ?>" id="n-multiset">
|
59 |
<h3> <?php _e("Manage Multi Set", 'yet-another-stars-rating'); ?></h3>
|
60 |
|
61 |
<p>
|
admin/settings/multiset/yasr-settings-functions-multiset.php
CHANGED
@@ -49,9 +49,7 @@ function yasr_multiset_options_init() {
|
|
49 |
}
|
50 |
|
51 |
function yasr_multiset_section_callback() {
|
52 |
-
|
53 |
//Silence
|
54 |
-
|
55 |
}
|
56 |
|
57 |
function yasr_multiset_hide_average_callback($option_multiset) {
|
@@ -75,7 +73,9 @@ function yasr_multiset_hide_average_callback($option_multiset) {
|
|
75 |
|
76 |
<?php
|
77 |
|
78 |
-
_e(
|
|
|
|
|
79 |
|
80 |
}
|
81 |
|
@@ -147,7 +147,7 @@ function yasr_edit_multi_form() {
|
|
147 |
|
148 |
$multi_set = YasrMultiSetData::returnMultiSetNames();
|
149 |
|
150 |
-
$n_multi_set = $wpdb->num_rows; //wpdb->num_rows always store the last of the last query
|
151 |
|
152 |
if ($n_multi_set > 1) {
|
153 |
?>
|
@@ -170,7 +170,7 @@ function yasr_edit_multi_form() {
|
|
170 |
|
171 |
} //End if n_multi_set >1
|
172 |
|
173 |
-
elseif ($n_multi_set
|
174 |
|
175 |
$set_name = $wpdb->get_results("SELECT field_name AS name, field_id AS id, parent_set_id AS set_id
|
176 |
FROM " . YASR_MULTI_SET_FIELDS_TABLE . "
|
@@ -281,11 +281,7 @@ function yasr_edit_multi_form() {
|
|
281 |
|
282 |
add_action('wp_ajax_yasr_get_multi_set', 'yasr_get_multi_set_callback');
|
283 |
function yasr_get_multi_set_callback() {
|
284 |
-
|
285 |
-
$set_id = (int)$_POST['set_id'];
|
286 |
-
} else {
|
287 |
-
return;
|
288 |
-
}
|
289 |
|
290 |
global $wpdb;
|
291 |
|
@@ -298,6 +294,10 @@ function yasr_get_multi_set_callback() {
|
|
298 |
$set_id)
|
299 |
);
|
300 |
|
|
|
|
|
|
|
|
|
301 |
?>
|
302 |
|
303 |
<form action="<?php echo admin_url('options-general.php?page=yasr_settings_page&tab=manage_multi') ?>"
|
49 |
}
|
50 |
|
51 |
function yasr_multiset_section_callback() {
|
|
|
52 |
//Silence
|
|
|
53 |
}
|
54 |
|
55 |
function yasr_multiset_hide_average_callback($option_multiset) {
|
73 |
|
74 |
<?php
|
75 |
|
76 |
+
_e('If you select no, the "Average" row will not be displayed.
|
77 |
+
You can override this in the single multi set by using the parameter "show_average"',
|
78 |
+
'yet-another-stars-rating');
|
79 |
|
80 |
}
|
81 |
|
147 |
|
148 |
$multi_set = YasrMultiSetData::returnMultiSetNames();
|
149 |
|
150 |
+
$n_multi_set = (int)$wpdb->num_rows; //wpdb->num_rows always store the last of the last query
|
151 |
|
152 |
if ($n_multi_set > 1) {
|
153 |
?>
|
170 |
|
171 |
} //End if n_multi_set >1
|
172 |
|
173 |
+
elseif ($n_multi_set === 1) {
|
174 |
|
175 |
$set_name = $wpdb->get_results("SELECT field_name AS name, field_id AS id, parent_set_id AS set_id
|
176 |
FROM " . YASR_MULTI_SET_FIELDS_TABLE . "
|
281 |
|
282 |
add_action('wp_ajax_yasr_get_multi_set', 'yasr_get_multi_set_callback');
|
283 |
function yasr_get_multi_set_callback() {
|
284 |
+
$set_id = (int)$_POST['set_id'];
|
|
|
|
|
|
|
|
|
285 |
|
286 |
global $wpdb;
|
287 |
|
294 |
$set_id)
|
295 |
);
|
296 |
|
297 |
+
if($set_name === null) {
|
298 |
+
return;
|
299 |
+
}
|
300 |
+
|
301 |
?>
|
302 |
|
303 |
<form action="<?php echo admin_url('options-general.php?page=yasr_settings_page&tab=manage_multi') ?>"
|
admin/settings/yasr-settings-functions-misc.php
CHANGED
@@ -8,6 +8,7 @@ function yasr_settings_tabs( $active_tab )
|
|
8 |
<h2 class="nav-tab-wrapper yasr-no-underline">
|
9 |
|
10 |
<a href="?page=yasr_settings_page&tab=general_settings"
|
|
|
11 |
class="nav-tab <?php
|
12 |
if ( $active_tab === 'general_settings' ) {
|
13 |
echo 'nav-tab-active' ;
|
@@ -18,7 +19,9 @@ function yasr_settings_tabs( $active_tab )
|
|
18 |
?>
|
19 |
</a>
|
20 |
|
21 |
-
<a href="?page=yasr_settings_page&tab=manage_multi"
|
|
|
|
|
22 |
if ( $active_tab === 'manage_multi' ) {
|
23 |
echo 'nav-tab-active' ;
|
24 |
}
|
@@ -29,6 +32,7 @@ function yasr_settings_tabs( $active_tab )
|
|
29 |
</a>
|
30 |
|
31 |
<a href="?page=yasr_settings_page&tab=style_options"
|
|
|
32 |
class="nav-tab <?php
|
33 |
if ( $active_tab === 'style_options' ) {
|
34 |
echo 'nav-tab-active' ;
|
@@ -45,7 +49,9 @@ function yasr_settings_tabs( $active_tab )
|
|
45 |
|
46 |
if ( $rating_plugin_exists->yasr_search_wppr() || $rating_plugin_exists->yasr_search_rmp() || $rating_plugin_exists->yasr_search_kksr() || $rating_plugin_exists->yasr_search_mr() ) {
|
47 |
?>
|
48 |
-
<a href="?page=yasr_settings_page&tab=migration_tools"
|
|
|
|
|
49 |
if ( $active_tab === 'migration_tools' ) {
|
50 |
echo 'nav-tab-active' ;
|
51 |
}
|
@@ -69,7 +75,7 @@ function yasr_upgrade_pro_box( $position = false )
|
|
69 |
|
70 |
if ( yasr_fs()->is_free_plan() ) {
|
71 |
|
72 |
-
if ( $position && $position
|
73 |
$yasr_upgrade_class = "yasr-donatedivbottom";
|
74 |
} else {
|
75 |
$yasr_upgrade_class = "yasr-donatedivdx";
|
@@ -130,7 +136,7 @@ function yasr_upgrade_pro_box( $position = false )
|
|
130 |
function yasr_resources_box( $position = false )
|
131 |
{
|
132 |
|
133 |
-
if ( $position && $position
|
134 |
$yasr_metabox_class = "yasr-donatedivbottom";
|
135 |
} else {
|
136 |
$yasr_metabox_class = "yasr-donatedivdx";
|
8 |
<h2 class="nav-tab-wrapper yasr-no-underline">
|
9 |
|
10 |
<a href="?page=yasr_settings_page&tab=general_settings"
|
11 |
+
id="general_settings"
|
12 |
class="nav-tab <?php
|
13 |
if ( $active_tab === 'general_settings' ) {
|
14 |
echo 'nav-tab-active' ;
|
19 |
?>
|
20 |
</a>
|
21 |
|
22 |
+
<a href="?page=yasr_settings_page&tab=manage_multi"
|
23 |
+
id="manage_multi"
|
24 |
+
class="nav-tab <?php
|
25 |
if ( $active_tab === 'manage_multi' ) {
|
26 |
echo 'nav-tab-active' ;
|
27 |
}
|
32 |
</a>
|
33 |
|
34 |
<a href="?page=yasr_settings_page&tab=style_options"
|
35 |
+
id="style_options"
|
36 |
class="nav-tab <?php
|
37 |
if ( $active_tab === 'style_options' ) {
|
38 |
echo 'nav-tab-active' ;
|
49 |
|
50 |
if ( $rating_plugin_exists->yasr_search_wppr() || $rating_plugin_exists->yasr_search_rmp() || $rating_plugin_exists->yasr_search_kksr() || $rating_plugin_exists->yasr_search_mr() ) {
|
51 |
?>
|
52 |
+
<a href="?page=yasr_settings_page&tab=migration_tools"
|
53 |
+
id="migration_tools"
|
54 |
+
class="nav-tab <?php
|
55 |
if ( $active_tab === 'migration_tools' ) {
|
56 |
echo 'nav-tab-active' ;
|
57 |
}
|
75 |
|
76 |
if ( yasr_fs()->is_free_plan() ) {
|
77 |
|
78 |
+
if ( $position && $position === "bottom" ) {
|
79 |
$yasr_upgrade_class = "yasr-donatedivbottom";
|
80 |
} else {
|
81 |
$yasr_upgrade_class = "yasr-donatedivdx";
|
136 |
function yasr_resources_box( $position = false )
|
137 |
{
|
138 |
|
139 |
+
if ( $position && $position === "bottom" ) {
|
140 |
$yasr_metabox_class = "yasr-donatedivbottom";
|
141 |
} else {
|
142 |
$yasr_metabox_class = "yasr-donatedivdx";
|
admin/settings/yasr-settings-functions.php
CHANGED
@@ -277,33 +277,13 @@ function yasr_auto_insert_callback($option) {
|
|
277 |
|
278 |
<div class="yasr-indented-answer">
|
279 |
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
</div>
|
288 |
-
|
289 |
-
<div class="yasr-option-size">
|
290 |
-
<input type="radio" name="yasr_general_options[auto_insert_size]" value="medium"
|
291 |
-
class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_size'] === 'medium') {
|
292 |
-
echo " checked=\"checked\" ";
|
293 |
-
} ?> >
|
294 |
-
<img src="<?php echo YASR_IMG_DIR . "yasr-stars-medium.png" ?>" class="yasr-img-option-size"><span
|
295 |
-
class="yasr-text-options-size"><?php _e('Medium', 'yet-another-stars-rating') ?></span>
|
296 |
-
</div>
|
297 |
-
|
298 |
-
<div class="yasr-option-size">
|
299 |
-
<input type="radio" name="yasr_general_options[auto_insert_size]" value="large"
|
300 |
-
class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_size'] === 'large') {
|
301 |
-
echo " checked=\"checked\" ";
|
302 |
-
} ?> >
|
303 |
-
<img src="<?php echo YASR_IMG_DIR . "yasr-stars-large.png" ?>" class="yasr-img-option-size"><span
|
304 |
-
class="yasr-text-options-size"><?php _e('Large', 'yet-another-stars-rating') ?></span>
|
305 |
-
</div>
|
306 |
-
</div>
|
307 |
</div>
|
308 |
|
309 |
<p> </p>
|
@@ -331,7 +311,7 @@ function yasr_auto_insert_callback($option) {
|
|
331 |
|
332 |
<?php
|
333 |
|
334 |
-
$custom_post_types =
|
335 |
|
336 |
if ($custom_post_types) { ?>
|
337 |
<strong><?php _e('Use only in custom post types?', 'yet-another-stars-rating'); ?></strong>
|
@@ -727,8 +707,8 @@ function yasr_choose_snippet_callback($option) {
|
|
727 |
'This will affect only the post/page where you didn\'t change manually the itemtype yet.',
|
728 |
'yet-another-stars-rating'); ?>
|
729 |
<br />
|
730 |
-
<?php echo(sprintf(__('Please keep in mind that since
|
731 |
-
no show stars in SERP anymore. %sHere%s the
|
732 |
'yet-another-stars-rating'),
|
733 |
'<a href="https://webmasters.googleblog.com/2019/09/making-review-rich-results-more-helpful.html">',
|
734 |
'</a>'));
|
277 |
|
278 |
<div class="yasr-indented-answer">
|
279 |
|
280 |
+
<?php
|
281 |
+
$name = 'yasr_general_options[auto_insert_size]';
|
282 |
+
$class = 'yasr-auto-insert-options-class';
|
283 |
+
$id = 'yasr-auto-insert-options-stars-size-';
|
284 |
+
|
285 |
+
YasrSettings::radioSelectSize($name, $class, $option['auto_insert_size'], $id);
|
286 |
+
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
</div>
|
288 |
|
289 |
<p> </p>
|
311 |
|
312 |
<?php
|
313 |
|
314 |
+
$custom_post_types = YasrCustomPostTypes::getCustomPostTypes();
|
315 |
|
316 |
if ($custom_post_types) { ?>
|
317 |
<strong><?php _e('Use only in custom post types?', 'yet-another-stars-rating'); ?></strong>
|
707 |
'This will affect only the post/page where you didn\'t change manually the itemtype yet.',
|
708 |
'yet-another-stars-rating'); ?>
|
709 |
<br />
|
710 |
+
<?php echo(sprintf(__('Please keep in mind that since September, 16, 2019 blogPosting item type will
|
711 |
+
no show stars in SERP anymore. %sHere%s the announcement by Google.',
|
712 |
'yet-another-stars-rating'),
|
713 |
'<a href="https://webmasters.googleblog.com/2019/09/making-review-rich-results-more-helpful.html">',
|
714 |
'</a>'));
|
admin/settings/yasr-settings-page.php
CHANGED
@@ -26,120 +26,98 @@ if (!current_user_can('manage_options')) {
|
|
26 |
wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
|
27 |
}
|
28 |
|
29 |
-
$n_multi_set = null; //Avoid undefined variable when printed outside multiset tab
|
30 |
-
|
31 |
?>
|
32 |
|
33 |
<div class="wrap">
|
34 |
-
|
35 |
<h2>Yet Another Stars Rating: <?php _e("Settings", 'yet-another-stars-rating'); ?></h2>
|
36 |
-
|
37 |
<?php
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
-
|
40 |
-
$active_tab
|
41 |
-
} else {
|
42 |
-
$active_tab = 'general_settings';
|
43 |
-
}
|
44 |
|
45 |
-
|
46 |
-
|
47 |
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
settings_fields('yasr_general_options_group');
|
55 |
-
do_settings_sections('yasr_general_settings_tab');
|
56 |
-
submit_button(YASR_SAVE_All_SETTINGS_TEXT);
|
57 |
-
?>
|
58 |
-
</form>
|
59 |
-
</div>
|
60 |
|
61 |
-
|
62 |
-
|
63 |
-
?>
|
64 |
|
65 |
-
|
66 |
-
</div>
|
67 |
|
68 |
-
|
69 |
|
70 |
-
|
|
|
|
|
|
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
yasr_right_settings_panel();
|
76 |
-
} //End if ($active_tab=='manage_multi')
|
77 |
|
|
|
78 |
|
79 |
-
|
80 |
-
?>
|
81 |
-
<?php do_action('yasr_add_content_top_style_options_tab', $active_tab); ?>
|
82 |
|
83 |
-
|
84 |
-
|
|
|
85 |
<?php
|
86 |
-
|
87 |
-
|
88 |
-
submit_button(YASR_SAVE_All_SETTINGS_TEXT);
|
89 |
?>
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
<?php
|
94 |
-
yasr_right_settings_panel();
|
95 |
-
?>
|
96 |
-
|
97 |
-
<div class="yasr-space-settings-div">
|
98 |
-
</div>
|
99 |
-
|
100 |
-
<?php do_action('yasr_add_content_bottom_style_options_tab', $active_tab);
|
101 |
-
|
102 |
-
} //End tab style
|
103 |
|
104 |
-
if ($active_tab === 'migration_tools') {
|
105 |
-
?>
|
106 |
-
<div class="yasr-settingsdiv">
|
107 |
<?php
|
108 |
-
|
109 |
-
include(YASR_ABSOLUTE_PATH_ADMIN . '/settings/migrations/yasr-settings-migration-page.php');
|
110 |
?>
|
|
|
111 |
<div class="yasr-space-settings-div">
|
112 |
</div>
|
113 |
-
</div>
|
114 |
|
115 |
-
|
116 |
-
yasr_right_settings_panel();
|
117 |
-
?>
|
118 |
-
|
119 |
-
<div class="yasr-space-settings-div">
|
120 |
-
</div>
|
121 |
-
|
122 |
-
<?php
|
123 |
-
|
124 |
-
} //End tab migration
|
125 |
|
126 |
-
|
127 |
|
128 |
-
|
129 |
|
|
|
130 |
?>
|
131 |
-
|
132 |
<!--End div wrap-->
|
133 |
-
</div>
|
134 |
-
|
135 |
-
|
136 |
-
<script type="text/javascript">
|
137 |
-
document.addEventListener("DOMContentLoaded", function() {
|
138 |
-
var activeTab = <?php echo(json_encode("$active_tab")); ?>;
|
139 |
-
var nMultiSet = <?php echo(json_encode("$n_multi_set")); ?> ;//Null in php is different from javascript NULL
|
140 |
-
var autoInsertEnabled = <?php echo(json_encode(YASR_AUTO_INSERT_ENABLED)); ?>;
|
141 |
-
var textBeforeStars = <?php echo(json_encode(YASR_TEXT_BEFORE_STARS)); ?>;
|
142 |
-
|
143 |
-
YasrSettingsPage(activeTab, nMultiSet, autoInsertEnabled, textBeforeStars);
|
144 |
-
}); //End jquery document ready
|
145 |
-
</script>
|
26 |
wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
|
27 |
}
|
28 |
|
|
|
|
|
29 |
?>
|
30 |
|
31 |
<div class="wrap">
|
|
|
32 |
<h2>Yet Another Stars Rating: <?php _e("Settings", 'yet-another-stars-rating'); ?></h2>
|
|
|
33 |
<?php
|
34 |
+
if (isset($_GET['tab'])) {
|
35 |
+
$active_tab = $_GET['tab'];
|
36 |
+
} else {
|
37 |
+
$active_tab = 'general_settings';
|
38 |
+
}
|
39 |
|
40 |
+
//Do the settings tab
|
41 |
+
yasr_settings_tabs($active_tab);
|
|
|
|
|
|
|
42 |
|
43 |
+
if ($active_tab === 'general_settings') {
|
44 |
+
?>
|
45 |
|
46 |
+
<div class="yasr-settingsdiv">
|
47 |
+
<form action="options.php" method="post" id="yasr_settings_form">
|
48 |
+
<?php
|
49 |
+
settings_fields('yasr_general_options_group');
|
50 |
+
do_settings_sections('yasr_general_settings_tab');
|
51 |
+
submit_button(YASR_SAVE_All_SETTINGS_TEXT);
|
52 |
+
?>
|
53 |
+
</form>
|
54 |
+
</div>
|
55 |
|
56 |
+
<?php
|
57 |
+
yasr_right_settings_panel();
|
58 |
+
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
+
<div class="yasr-space-settings-div">
|
61 |
+
</div>
|
|
|
62 |
|
63 |
+
<?php
|
|
|
64 |
|
65 |
+
} //End if tab 'general_settings'
|
66 |
|
67 |
+
if ($active_tab === 'manage_multi') {
|
68 |
+
include(YASR_ABSOLUTE_PATH_ADMIN . '/settings/multiset/yasr-settings-functions-multiset-page.php');
|
69 |
+
yasr_right_settings_panel();
|
70 |
+
} //End if ($active_tab=='manage_multi')
|
71 |
|
72 |
+
if ($active_tab === 'style_options') {
|
73 |
+
?>
|
74 |
+
<?php do_action('yasr_add_content_top_style_options_tab', $active_tab); ?>
|
75 |
+
<div class="yasr-settingsdiv">
|
76 |
+
<form action="options.php" method="post" enctype='multipart/form-data' id="yasr_settings_form">
|
77 |
+
<?php
|
78 |
+
settings_fields('yasr_style_options_group');
|
79 |
+
do_settings_sections('yasr_style_tab');
|
80 |
+
submit_button(YASR_SAVE_All_SETTINGS_TEXT);
|
81 |
+
?>
|
82 |
+
</form>
|
83 |
+
</div>
|
84 |
+
|
85 |
+
<?php
|
86 |
+
yasr_right_settings_panel();
|
87 |
+
?>
|
88 |
|
89 |
+
<div class="yasr-space-settings-div">
|
90 |
+
</div>
|
|
|
|
|
91 |
|
92 |
+
<?php do_action('yasr_add_content_bottom_style_options_tab', $active_tab);
|
93 |
|
94 |
+
} //End tab style
|
|
|
|
|
95 |
|
96 |
+
if ($active_tab === 'migration_tools') {
|
97 |
+
?>
|
98 |
+
<div class="yasr-settingsdiv">
|
99 |
<?php
|
100 |
+
//include migration functions
|
101 |
+
include(YASR_ABSOLUTE_PATH_ADMIN . '/settings/migrations/yasr-settings-migration-page.php');
|
|
|
102 |
?>
|
103 |
+
<div class="yasr-space-settings-div">
|
104 |
+
</div>
|
105 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
|
|
|
|
|
|
107 |
<?php
|
108 |
+
yasr_right_settings_panel();
|
|
|
109 |
?>
|
110 |
+
|
111 |
<div class="yasr-space-settings-div">
|
112 |
</div>
|
|
|
113 |
|
114 |
+
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
|
116 |
+
} //End tab migration
|
117 |
|
118 |
+
do_action('yasr_settings_check_active_tab', $active_tab);
|
119 |
|
120 |
+
yasr_right_settings_panel('bottom');
|
121 |
?>
|
|
|
122 |
<!--End div wrap-->
|
123 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/yasr-admin-actions.php
CHANGED
@@ -4,6 +4,14 @@ if (!defined('ABSPATH')) {
|
|
4 |
exit('You\'re not allowed to see this page');
|
5 |
} // Exit if accessed directly
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
/****** Adding logs widget to the dashboard ******/
|
8 |
|
9 |
add_action('plugins_loaded', 'yasr_add_action_dashboard_widget_log');
|
4 |
exit('You\'re not allowed to see this page');
|
5 |
} // Exit if accessed directly
|
6 |
|
7 |
+
add_action('plugins_loaded', 'yasr_edit_category_form');
|
8 |
+
|
9 |
+
function yasr_edit_category_form () {
|
10 |
+
if (current_user_can('manage_options')) {
|
11 |
+
YasrEditCategory::init();
|
12 |
+
}
|
13 |
+
}
|
14 |
+
|
15 |
/****** Adding logs widget to the dashboard ******/
|
16 |
|
17 |
add_action('plugins_loaded', 'yasr_add_action_dashboard_widget_log');
|
admin/yasr-admin-functions.php
CHANGED
@@ -50,4 +50,149 @@ function yasr_on_delete_blog($tables) {
|
|
50 |
return $tables;
|
51 |
}
|
52 |
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
return $tables;
|
51 |
}
|
52 |
|
53 |
+
add_action('admin_enqueue_scripts', 'yasr_add_admin_scripts');
|
54 |
+
|
55 |
+
//$hook contain the current page in the admin side
|
56 |
+
function yasr_add_admin_scripts($hook) {
|
57 |
+
|
58 |
+
global $yasr_settings_page;
|
59 |
+
|
60 |
+
if ($hook === 'post.php' || $hook === 'post-new.php') {
|
61 |
+
wp_enqueue_script(
|
62 |
+
'yasr_classic_editor_functions',
|
63 |
+
YASR_JS_DIR_ADMIN . 'yasr-editor-screen.js',
|
64 |
+
array('jquery'),
|
65 |
+
YASR_VERSION_NUM,
|
66 |
+
true
|
67 |
+
);
|
68 |
+
}
|
69 |
+
|
70 |
+
//add this only in yasr setting page (admin.php?page=yasr_settings_page)
|
71 |
+
if ($hook === $yasr_settings_page) {
|
72 |
+
$cm_settings['codeEditor'] = wp_enqueue_code_editor(array('type' => 'text/css'));
|
73 |
+
wp_localize_script('jquery', 'yasr_cm_settings', $cm_settings);
|
74 |
+
}
|
75 |
+
|
76 |
+
if ($hook === 'index.php' || $hook === 'edit.php' || $hook === 'post.php' || $hook === 'post-new.php' ||
|
77 |
+
$hook === 'edit-comments.php' || $hook === 'term.php' || $hook === $yasr_settings_page ||
|
78 |
+
$hook === 'yet-another-stars-rating_page_yasr_stats_page'
|
79 |
+
) {
|
80 |
+
|
81 |
+
do_action('yasr_add_admin_scripts_begin');
|
82 |
+
|
83 |
+
$rater_file_to_include = 'rater-js.js';
|
84 |
+
|
85 |
+
if (is_rtl()) {
|
86 |
+
$rater_file_to_include = 'rater-js-rtl.js';
|
87 |
+
}
|
88 |
+
|
89 |
+
wp_enqueue_style(
|
90 |
+
'yasrcss',
|
91 |
+
YASR_CSS_DIR_ADMIN . 'yasr-admin.css',
|
92 |
+
false,
|
93 |
+
YASR_VERSION_NUM,
|
94 |
+
'all'
|
95 |
+
);
|
96 |
+
|
97 |
+
wp_enqueue_script(
|
98 |
+
'tippy',
|
99 |
+
YASR_JS_DIR_INCLUDES . 'tippy.all.min.js',
|
100 |
+
'',
|
101 |
+
'3.6.0',
|
102 |
+
true
|
103 |
+
);
|
104 |
+
|
105 |
+
wp_enqueue_script(
|
106 |
+
'yasradmin',
|
107 |
+
YASR_JS_DIR_ADMIN . 'yasr-admin.js',
|
108 |
+
array('jquery'),
|
109 |
+
YASR_VERSION_NUM,
|
110 |
+
true
|
111 |
+
);
|
112 |
+
|
113 |
+
wp_enqueue_script(
|
114 |
+
'rater',
|
115 |
+
YASR_JS_DIR_INCLUDES .
|
116 |
+
$rater_file_to_include,
|
117 |
+
'',
|
118 |
+
YASR_VERSION_NUM,
|
119 |
+
true
|
120 |
+
);
|
121 |
+
|
122 |
+
do_action('yasr_add_admin_scripts_end', $hook);
|
123 |
+
|
124 |
+
$yasr_loader = YASR_IMG_DIR . 'loader.gif';
|
125 |
+
|
126 |
+
wp_localize_script(
|
127 |
+
'yasradmin', 'yasrCommonDataAdmin',
|
128 |
+
array(
|
129 |
+
'loaderHtml' => $yasr_loader
|
130 |
+
)
|
131 |
+
);
|
132 |
+
|
133 |
+
}
|
134 |
+
|
135 |
+
}
|
136 |
+
|
137 |
+
/* Hook to admin_menu the yasr_add_pages function above */
|
138 |
+
add_action('admin_menu', 'yasr_add_pages');
|
139 |
+
|
140 |
+
function yasr_add_pages() {
|
141 |
+
|
142 |
+
global $yasr_settings_page;
|
143 |
+
|
144 |
+
//Add Settings Page
|
145 |
+
$yasr_settings_page = add_menu_page(
|
146 |
+
__('Yet Another Stars Rating: settings', 'yet-another-stars-rating'), //Page Title
|
147 |
+
__('Yet Another Stars Rating', 'yet-another-stars-rating'), //Menu Title
|
148 |
+
'manage_options', //capability
|
149 |
+
'yasr_settings_page', //menu slug
|
150 |
+
'yasr_settings_page_callback', //The function to be called to output the content for this page.
|
151 |
+
'dashicons-star-half'
|
152 |
+
);
|
153 |
+
|
154 |
+
add_submenu_page(
|
155 |
+
'yasr_settings_page',
|
156 |
+
'Yet Another Stars Rating: settings',
|
157 |
+
'Settings',
|
158 |
+
'manage_options',
|
159 |
+
'yasr_settings_page'
|
160 |
+
);
|
161 |
+
|
162 |
+
add_submenu_page(
|
163 |
+
'yasr_settings_page',
|
164 |
+
'Yet Another Stars Rating: All Rating',
|
165 |
+
'Stats',
|
166 |
+
'manage_options',
|
167 |
+
'yasr_stats_page',
|
168 |
+
'yasr_stats_page_callback'
|
169 |
+
);
|
170 |
+
|
171 |
+
if (yasr_fs()->is_free_plan() && !yasr_fs()->is_trial()) {
|
172 |
+
global $submenu;
|
173 |
+
$permalink = '#';
|
174 |
+
$contact_us_string = sprintf(
|
175 |
+
__('Contact Us %s', 'yet-another-stars-rating'),
|
176 |
+
'<span class="dashicons dashicons-lock" />'
|
177 |
+
);
|
178 |
+
$submenu['yasr_settings_page'][] = array($contact_us_string, 'manage_options', $permalink);
|
179 |
+
}
|
180 |
+
|
181 |
+
}
|
182 |
+
|
183 |
+
// Settings Page Content
|
184 |
+
function yasr_settings_page_callback() {
|
185 |
+
if (!current_user_can('manage_options')) {
|
186 |
+
wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
|
187 |
+
}
|
188 |
+
include(YASR_ABSOLUTE_PATH_ADMIN . '/settings/yasr-settings-page.php');
|
189 |
+
} //End yasr_settings_page_content
|
190 |
+
|
191 |
+
|
192 |
+
function yasr_stats_page_callback() {
|
193 |
+
if (!current_user_can('manage_options')) {
|
194 |
+
wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
|
195 |
+
}
|
196 |
+
|
197 |
+
include(YASR_ABSOLUTE_PATH_ADMIN . '/yasr-stats-page.php');
|
198 |
+
}
|
admin/yasr-admin-init.php
CHANGED
@@ -64,143 +64,4 @@ function yasr_autoload_admin_classes($class) {
|
|
64 |
}
|
65 |
|
66 |
//AutoLoad Yasr Shortcode Classes, only when a object is created
|
67 |
-
spl_autoload_register('yasr_autoload_admin_classes');
|
68 |
-
|
69 |
-
add_action('admin_enqueue_scripts', 'yasr_add_admin_scripts');
|
70 |
-
|
71 |
-
//$hook contain the current page in the admin side
|
72 |
-
function yasr_add_admin_scripts($hook) {
|
73 |
-
|
74 |
-
global $yasr_settings_page;
|
75 |
-
|
76 |
-
if ($hook === 'post.php' || $hook === 'post-new.php') {
|
77 |
-
wp_enqueue_script(
|
78 |
-
'yasr_classic_editor_functions',
|
79 |
-
YASR_JS_DIR_ADMIN . 'yasr-editor-screen.js',
|
80 |
-
array('jquery'),
|
81 |
-
YASR_VERSION_NUM,
|
82 |
-
true
|
83 |
-
);
|
84 |
-
}
|
85 |
-
|
86 |
-
//add this only in yasr setting page (admin.php?page=yasr_settings_page)
|
87 |
-
if ($hook === $yasr_settings_page) {
|
88 |
-
$cm_settings['codeEditor'] = wp_enqueue_code_editor(array('type' => 'text/css'));
|
89 |
-
wp_localize_script('jquery', 'yasr_cm_settings', $cm_settings);
|
90 |
-
}
|
91 |
-
|
92 |
-
if ($hook === 'index.php' || $hook === 'edit.php' || $hook === 'post.php' || $hook === 'post-new.php' ||
|
93 |
-
$hook === 'edit-comments.php' || $hook === $yasr_settings_page ||
|
94 |
-
$hook === 'yet-another-stars-rating_page_yasr_stats_page'
|
95 |
-
) {
|
96 |
-
|
97 |
-
do_action('yasr_add_admin_scripts_begin');
|
98 |
-
|
99 |
-
$rater_file_to_include = 'rater-js.js';
|
100 |
-
|
101 |
-
if (is_rtl()) {
|
102 |
-
$rater_file_to_include = 'rater-js-rtl.js';
|
103 |
-
}
|
104 |
-
|
105 |
-
wp_enqueue_style(
|
106 |
-
'yasrcss',
|
107 |
-
YASR_CSS_DIR_ADMIN . 'yasr-admin.css',
|
108 |
-
false,
|
109 |
-
YASR_VERSION_NUM,
|
110 |
-
'all'
|
111 |
-
);
|
112 |
-
|
113 |
-
wp_enqueue_script(
|
114 |
-
'yasradmin',
|
115 |
-
YASR_JS_DIR_ADMIN . 'yasr-admin.js',
|
116 |
-
array('jquery'),
|
117 |
-
YASR_VERSION_NUM,
|
118 |
-
true
|
119 |
-
);
|
120 |
-
|
121 |
-
wp_enqueue_script(
|
122 |
-
'rater',
|
123 |
-
YASR_JS_DIR_INCLUDES .
|
124 |
-
$rater_file_to_include,
|
125 |
-
'',
|
126 |
-
YASR_VERSION_NUM,
|
127 |
-
true
|
128 |
-
);
|
129 |
-
|
130 |
-
do_action('yasr_add_admin_scripts_end', $hook);
|
131 |
-
|
132 |
-
$yasr_loader = YASR_IMG_DIR . 'loader.gif';
|
133 |
-
|
134 |
-
wp_localize_script(
|
135 |
-
'yasradmin', 'yasrCommonDataAdmin',
|
136 |
-
array(
|
137 |
-
'loaderHtml' => $yasr_loader
|
138 |
-
)
|
139 |
-
);
|
140 |
-
|
141 |
-
}
|
142 |
-
|
143 |
-
}
|
144 |
-
|
145 |
-
/* Hook to admin_menu the yasr_add_pages function above */
|
146 |
-
add_action('admin_menu', 'yasr_add_pages');
|
147 |
-
|
148 |
-
function yasr_add_pages() {
|
149 |
-
|
150 |
-
global $yasr_settings_page;
|
151 |
-
|
152 |
-
//Add Settings Page
|
153 |
-
$yasr_settings_page = add_menu_page(
|
154 |
-
__('Yet Another Stars Rating: settings', 'yet-another-stars-rating'), //Page Title
|
155 |
-
__('Yet Another Stars Rating', 'yet-another-stars-rating'), //Menu Title
|
156 |
-
'manage_options', //capability
|
157 |
-
'yasr_settings_page', //menu slug
|
158 |
-
'yasr_settings_page_callback', //The function to be called to output the content for this page.
|
159 |
-
'dashicons-star-half'
|
160 |
-
);
|
161 |
-
|
162 |
-
add_submenu_page(
|
163 |
-
'yasr_settings_page',
|
164 |
-
'Yet Another Stars Rating: settings',
|
165 |
-
'Settings',
|
166 |
-
'manage_options',
|
167 |
-
'yasr_settings_page'
|
168 |
-
);
|
169 |
-
|
170 |
-
add_submenu_page(
|
171 |
-
'yasr_settings_page',
|
172 |
-
'Yet Another Stars Rating: All Rating',
|
173 |
-
'Stats',
|
174 |
-
'manage_options',
|
175 |
-
'yasr_stats_page',
|
176 |
-
'yasr_stats_page_callback'
|
177 |
-
);
|
178 |
-
|
179 |
-
if (yasr_fs()->is_free_plan() && !yasr_fs()->is_trial()) {
|
180 |
-
global $submenu;
|
181 |
-
$permalink = '#';
|
182 |
-
$contact_us_string = sprintf(
|
183 |
-
__('Contact Us %s', 'yet-another-stars-rating'),
|
184 |
-
'<span class="dashicons dashicons-lock" />'
|
185 |
-
);
|
186 |
-
$submenu['yasr_settings_page'][] = array($contact_us_string, 'manage_options', $permalink);
|
187 |
-
}
|
188 |
-
|
189 |
-
}
|
190 |
-
|
191 |
-
// Settings Page Content
|
192 |
-
function yasr_settings_page_callback() {
|
193 |
-
if (!current_user_can('manage_options')) {
|
194 |
-
wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
|
195 |
-
}
|
196 |
-
include(YASR_ABSOLUTE_PATH_ADMIN . '/settings/yasr-settings-page.php');
|
197 |
-
} //End yasr_settings_page_content
|
198 |
-
|
199 |
-
|
200 |
-
function yasr_stats_page_callback() {
|
201 |
-
if (!current_user_can('manage_options')) {
|
202 |
-
wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
|
203 |
-
}
|
204 |
-
|
205 |
-
include(YASR_ABSOLUTE_PATH_ADMIN . '/yasr-stats-page.php');
|
206 |
-
}
|
64 |
}
|
65 |
|
66 |
//AutoLoad Yasr Shortcode Classes, only when a object is created
|
67 |
+
spl_autoload_register('yasr_autoload_admin_classes');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
changelog.txt
CHANGED
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
1 |
= 2.2.1 =
|
2 |
* FIXED: MultiSet returns "undefined" in editor screen
|
3 |
* FIXED: MultiSet average always shows
|
@@ -7,19 +11,11 @@
|
|
7 |
= 2.2.0 =
|
8 |
* TWEAKED: most of code of the main shortcodes has been rewritten; YASR is faster than ever.
|
9 |
* FIXED: gutenberg shortcode preview yasr_top_ten_highest_rated shortcode
|
10 |
-
[//]: # fs_premium_only_begin
|
11 |
-
* FIXED: if user reviews are enabled on a post, rich snippet get printed even if " Create Rich Snippet for comments? "
|
12 |
-
is set to "no"
|
13 |
-
[//]: # fs_premium_only_end
|
14 |
|
15 |
= 2.1.4 =
|
16 |
* FIXED: undefined variable when saving/updating post or page
|
17 |
* TWEAKED: changed delete_post_meta with delete_metadata
|
18 |
* TWEAKED: Updated support link in settings pages
|
19 |
-
[//]: # fs_premium_only_begin
|
20 |
-
* TWEAKED: code cleanup
|
21 |
-
* FIXED: text position on yasr_pro_overall_rating_chart
|
22 |
-
[//]: # fs_premium_only_end
|
23 |
|
24 |
= 2.1.3 =
|
25 |
* FIXED: in some older (and rare) mysql or mariadb versions, the function JSON_OBJECT is not supported.
|
@@ -71,9 +67,6 @@ Many other support types will comes.
|
|
71 |
* TWEAKED: esc_html used instead of htmlspecialchars in the settings page
|
72 |
* TWEAKED: added a new filter yasr_filter_existing_schema: useful if there is the need to add new rich snippets
|
73 |
* TWEAKED: minor changes on schema function (thanks to Olivier)
|
74 |
-
[//]: # fs_premium_only_begin
|
75 |
-
* NEW FEATURE: it's now possible to add custom text after yasr_pro_average_comments_ratings
|
76 |
-
[//]: # fs_premium_only_end
|
77 |
|
78 |
= 2.0.3 =
|
79 |
* TWEAKED: some changes in settings page
|
@@ -113,11 +106,6 @@ Many other support types will comes.
|
|
113 |
= 1.9.5 =
|
114 |
* TWEAKED: settings redesigned
|
115 |
* TWEAKED: code cleanup
|
116 |
-
[//]: # fs_premium_only_begin
|
117 |
-
FIXED: if gutenberg is active, comment_review_enablad value always reset to 0
|
118 |
-
FIXED: error on yasr_pro_visitor_votes_chart shortcode
|
119 |
-
TWEAKED: code cleanup
|
120 |
-
[//]: # fs_premium_only_end
|
121 |
|
122 |
= 1.9.4 =
|
123 |
* NEW: In the settings, is now possible to customize the "you must sign in" text; two html tags are supported: < strong > and < p >
|
1 |
+
= 2.2.2 =
|
2 |
+
* FIXED: links in Recent Ratings dashboard widget (thanks to Fernando Tellado)
|
3 |
+
* Enhancement: Added REST responses. More info in the official site
|
4 |
+
|
5 |
= 2.2.1 =
|
6 |
* FIXED: MultiSet returns "undefined" in editor screen
|
7 |
* FIXED: MultiSet average always shows
|
11 |
= 2.2.0 =
|
12 |
* TWEAKED: most of code of the main shortcodes has been rewritten; YASR is faster than ever.
|
13 |
* FIXED: gutenberg shortcode preview yasr_top_ten_highest_rated shortcode
|
|
|
|
|
|
|
|
|
14 |
|
15 |
= 2.1.4 =
|
16 |
* FIXED: undefined variable when saving/updating post or page
|
17 |
* TWEAKED: changed delete_post_meta with delete_metadata
|
18 |
* TWEAKED: Updated support link in settings pages
|
|
|
|
|
|
|
|
|
19 |
|
20 |
= 2.1.3 =
|
21 |
* FIXED: in some older (and rare) mysql or mariadb versions, the function JSON_OBJECT is not supported.
|
67 |
* TWEAKED: esc_html used instead of htmlspecialchars in the settings page
|
68 |
* TWEAKED: added a new filter yasr_filter_existing_schema: useful if there is the need to add new rich snippets
|
69 |
* TWEAKED: minor changes on schema function (thanks to Olivier)
|
|
|
|
|
|
|
70 |
|
71 |
= 2.0.3 =
|
72 |
* TWEAKED: some changes in settings page
|
106 |
= 1.9.5 =
|
107 |
* TWEAKED: settings redesigned
|
108 |
* TWEAKED: code cleanup
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
= 1.9.4 =
|
111 |
* NEW: In the settings, is now possible to customize the "you must sign in" text; two html tags are supported: < strong > and < p >
|
includes/classes/YasrCustomPostTypes.php
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
/**
|
5 |
+
* @since 2.3.3
|
6 |
+
*
|
7 |
+
* Class YasrCustomPostTypes
|
8 |
+
*/
|
9 |
+
class YasrCustomPostTypes {
|
10 |
+
|
11 |
+
public static function addFilterExistingCpt() {
|
12 |
+
add_filter('register_post_type_args', 'YasrCustomPostTypes::enableRestAllCPT', 10, 2);
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @param $args
|
17 |
+
* @param $post_type
|
18 |
+
*
|
19 |
+
* @return mixed
|
20 |
+
* @since 2.3.3
|
21 |
+
*
|
22 |
+
* Filter all post types and enables rest response and rest base, only if:
|
23 |
+
* there isn't (or set to false) show_in_rest arg
|
24 |
+
* there isn't (or set to false) _builtin arg
|
25 |
+
*
|
26 |
+
* lastly, add a rest base, only if not set (or set to false)
|
27 |
+
*/
|
28 |
+
public static function enableRestAllCPT($args, $post_type) {
|
29 |
+
|
30 |
+
if (
|
31 |
+
(!isset($args['show_in_rest']) || ($args['show_in_rest'] === false))
|
32 |
+
&&
|
33 |
+
(!isset($args['_builtin']) || $args['_builtin'] === false)
|
34 |
+
) {
|
35 |
+
$args['show_in_rest'] = true;
|
36 |
+
|
37 |
+
//this if should be useless, just to be safe
|
38 |
+
if(!isset($args['rest_base']) || $args['rest_base'] === false) {
|
39 |
+
$args['rest_base'] = $post_type;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
return $args;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Return all user registered post types.
|
47 |
+
* Must be used on init or after
|
48 |
+
*
|
49 |
+
* @return bool|string[]|WP_Post_Type[]
|
50 |
+
*/
|
51 |
+
public static function getCustomPostTypes() {
|
52 |
+
$args = array(
|
53 |
+
'public' => true,
|
54 |
+
'_builtin' => false
|
55 |
+
);
|
56 |
+
|
57 |
+
$output = 'names'; // names or objects, note names is the default
|
58 |
+
$operator = 'and'; // 'and' or 'or'
|
59 |
+
|
60 |
+
//if not found, returns an empty array
|
61 |
+
$post_types = get_post_types( $args, $output, $operator );
|
62 |
+
|
63 |
+
if ($post_types) {
|
64 |
+
return ($post_types);
|
65 |
+
}
|
66 |
+
return false;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Return all post types (even post, page, etc.)
|
71 |
+
* Must be used on init or after
|
72 |
+
*
|
73 |
+
* @return string[]|WP_Post_Type[]
|
74 |
+
*/
|
75 |
+
public static function returnAllPostTypes() {
|
76 |
+
$args = array(
|
77 |
+
'public' => true,
|
78 |
+
);
|
79 |
+
|
80 |
+
$output = 'names';
|
81 |
+
$operator = 'and';
|
82 |
+
|
83 |
+
return get_post_types($args, $output, $operator);
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Return rest baseurl for all post types
|
88 |
+
* If for some reason get_post_type_object returns null,
|
89 |
+
* return 'posts'
|
90 |
+
*
|
91 |
+
* @param integer | bool $post_id
|
92 |
+
*
|
93 |
+
* @return bool|false|string
|
94 |
+
*/
|
95 |
+
public static function returnBaseUrl($post_id=false) {
|
96 |
+
if($post_id === false || !is_int($post_id)) {
|
97 |
+
$post_id = get_the_ID();
|
98 |
+
}
|
99 |
+
|
100 |
+
$post_type_object = get_post_type_object(get_post_type($post_id));
|
101 |
+
|
102 |
+
//if get_post_type_object fails for some reason, return 'posts'
|
103 |
+
if($post_type_object === null) {
|
104 |
+
return 'posts';
|
105 |
+
}
|
106 |
+
|
107 |
+
return $post_type_object->rest_base;
|
108 |
+
}
|
109 |
+
|
110 |
+
}
|
includes/js/yasr-front.js
CHANGED
@@ -192,7 +192,9 @@ function yasrVisitorVotesFront (yasrRaterVVInDom) {
|
|
192 |
//this means that attribute data-rating is not set
|
193 |
if (rating === null && readonly === null) {
|
194 |
|
195 |
-
let
|
|
|
|
|
196 |
|
197 |
fetch(yasrCommonData.restEndpoint + urlVisitorVotes).then(response => {
|
198 |
return response.json();
|
192 |
//this means that attribute data-rating is not set
|
193 |
if (rating === null && readonly === null) {
|
194 |
|
195 |
+
let cpt = yasrRaterVVInDom.item(i).getAttribute('data-cpt');
|
196 |
+
|
197 |
+
let urlVisitorVotes = 'wp/v2/'+ cpt +'/' + postId + '?_fields=yasr_visitor_votes&_wpnonce='+yasrCommonData.nonce;
|
198 |
|
199 |
fetch(yasrCommonData.restEndpoint + urlVisitorVotes).then(response => {
|
200 |
return response.json();
|
includes/rest/classes/YasrCustomFields.php
CHANGED
@@ -21,7 +21,7 @@ class YasrCustomFields extends WP_REST_Controller {
|
|
21 |
public function customFields () {
|
22 |
/**
|
23 |
* Add <yasr-visitor-votes> in
|
24 |
-
* YOURSITE.COM/wp-json/wp/v2/
|
25 |
*/
|
26 |
$this->visitorVotes();
|
27 |
$this->allItemTypes();
|
@@ -40,7 +40,7 @@ class YasrCustomFields extends WP_REST_Controller {
|
|
40 |
* }
|
41 |
*/
|
42 |
private function visitorVotes() {
|
43 |
-
$post_types =
|
44 |
$yasr_vv_schema = array(
|
45 |
'description' => 'Yasr Visitor Votes Data',
|
46 |
'type' => 'object',
|
@@ -111,7 +111,7 @@ class YasrCustomFields extends WP_REST_Controller {
|
|
111 |
* only in the editor screen
|
112 |
*/
|
113 |
private function allItemTypes() {
|
114 |
-
$post_types =
|
115 |
$yasr_itemtype_schema = array(
|
116 |
'description' => 'Yasr Supported Item Types',
|
117 |
'type' => 'object',
|
@@ -135,7 +135,7 @@ class YasrCustomFields extends WP_REST_Controller {
|
|
135 |
* only in the edit screen (for guteberg editor)
|
136 |
*/
|
137 |
private function itemTypesAdditionalFields() {
|
138 |
-
$post_types =
|
139 |
$yasr_additional_itemtype_schema = array(
|
140 |
'description' => 'Yasr Item Types Additional Info',
|
141 |
'type' => 'object',
|
21 |
public function customFields () {
|
22 |
/**
|
23 |
* Add <yasr-visitor-votes> in
|
24 |
+
* YOURSITE.COM/wp-json/wp/v2/POSTTYPE/<POSTID>?_fields=yasr_visitor_votes
|
25 |
*/
|
26 |
$this->visitorVotes();
|
27 |
$this->allItemTypes();
|
40 |
* }
|
41 |
*/
|
42 |
private function visitorVotes() {
|
43 |
+
$post_types = YasrCustomPostTypes::returnAllPostTypes();
|
44 |
$yasr_vv_schema = array(
|
45 |
'description' => 'Yasr Visitor Votes Data',
|
46 |
'type' => 'object',
|
111 |
* only in the editor screen
|
112 |
*/
|
113 |
private function allItemTypes() {
|
114 |
+
$post_types = YasrCustomPostTypes::returnAllPostTypes();
|
115 |
$yasr_itemtype_schema = array(
|
116 |
'description' => 'Yasr Supported Item Types',
|
117 |
'type' => 'object',
|
135 |
* only in the edit screen (for guteberg editor)
|
136 |
*/
|
137 |
private function itemTypesAdditionalFields() {
|
138 |
+
$post_types = YasrCustomPostTypes::returnAllPostTypes();
|
139 |
$yasr_additional_itemtype_schema = array(
|
140 |
'description' => 'Yasr Item Types Additional Info',
|
141 |
'type' => 'object',
|
includes/rest/classes/YasrPostMeta.php
CHANGED
@@ -9,7 +9,7 @@ class YasrPostMeta {
|
|
9 |
* Load in init
|
10 |
*/
|
11 |
public function init() {
|
12 |
-
add_action('init', array(
|
13 |
}
|
14 |
|
15 |
/*
|
@@ -27,7 +27,7 @@ class YasrPostMeta {
|
|
27 |
'show_in_rest' => true,
|
28 |
'single' => true,
|
29 |
'type' => 'number',
|
30 |
-
'auth_callback' => function() {
|
31 |
return current_user_can('edit_posts');
|
32 |
}
|
33 |
)
|
@@ -40,7 +40,7 @@ class YasrPostMeta {
|
|
40 |
'show_in_rest' => true,
|
41 |
'single' => true,
|
42 |
'type' => 'string',
|
43 |
-
'auth_callback' => function() {
|
44 |
return current_user_can('edit_posts');
|
45 |
}
|
46 |
)
|
@@ -53,7 +53,7 @@ class YasrPostMeta {
|
|
53 |
'show_in_rest' => true,
|
54 |
'single' => true,
|
55 |
'type' => 'string',
|
56 |
-
'auth_callback' => function() {
|
57 |
return current_user_can('edit_posts');
|
58 |
}
|
59 |
)
|
9 |
* Load in init
|
10 |
*/
|
11 |
public function init() {
|
12 |
+
add_action('init', array($this, 'registerPostMeta'));
|
13 |
}
|
14 |
|
15 |
/*
|
27 |
'show_in_rest' => true,
|
28 |
'single' => true,
|
29 |
'type' => 'number',
|
30 |
+
'auth_callback' => static function() {
|
31 |
return current_user_can('edit_posts');
|
32 |
}
|
33 |
)
|
40 |
'show_in_rest' => true,
|
41 |
'single' => true,
|
42 |
'type' => 'string',
|
43 |
+
'auth_callback' => static function() {
|
44 |
return current_user_can('edit_posts');
|
45 |
}
|
46 |
)
|
53 |
'show_in_rest' => true,
|
54 |
'single' => true,
|
55 |
'type' => 'string',
|
56 |
+
'auth_callback' => static function() {
|
57 |
return current_user_can('edit_posts');
|
58 |
}
|
59 |
)
|
includes/rest/yasr-rest.php
CHANGED
@@ -40,3 +40,6 @@ $yasr_custom_endpoint = new YasrCustomEndpoint();
|
|
40 |
$yasr_post_meta->init();
|
41 |
$yasr_custom_fields->restApiInit();
|
42 |
$yasr_custom_endpoint->restApiInit();
|
|
|
|
|
|
40 |
$yasr_post_meta->init();
|
41 |
$yasr_custom_fields->restApiInit();
|
42 |
$yasr_custom_endpoint->restApiInit();
|
43 |
+
|
44 |
+
//Filter existing CPT to work with YASR
|
45 |
+
YasrCustomPostTypes::addFilterExistingCpt();
|
includes/shortcodes/classes/YasrNoStarsRankings.php
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@tiscali.it)
|
6 |
+
|
7 |
+
This program is free software: you can redistribute it and/or modify
|
8 |
+
it under the terms of the GNU General Public License as published by
|
9 |
+
the Free Software Foundation, either version 2 of the License, or
|
10 |
+
(at your option) any later version.
|
11 |
+
|
12 |
+
This program is distributed in the hope that it will be useful,
|
13 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
+
GNU General Public License for more details.
|
16 |
+
|
17 |
+
You should have received a copy of the GNU General Public License
|
18 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>
|
19 |
+
*/
|
20 |
+
|
21 |
+
if (!defined('ABSPATH')) {
|
22 |
+
exit('You\'re not allowed to see this page');
|
23 |
+
} // Exit if accessed directly
|
24 |
+
|
25 |
+
class YasrNoStarsRankings extends YasrShortcode {
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @return string
|
29 |
+
*/
|
30 |
+
public function returnTopReviewers() {
|
31 |
+
global $wpdb;
|
32 |
+
|
33 |
+
$query_result = $wpdb->get_results(
|
34 |
+
"SELECT COUNT(pm.post_id) AS total_count,
|
35 |
+
p.post_author AS reviewer
|
36 |
+
FROM $wpdb->posts AS p,
|
37 |
+
$wpdb->postmeta AS pm
|
38 |
+
WHERE pm.post_id = p.ID
|
39 |
+
AND pm.meta_key = 'yasr_overall_rating'
|
40 |
+
AND p.post_status = 'publish'
|
41 |
+
GROUP BY reviewer
|
42 |
+
ORDER BY (total_count) DESC
|
43 |
+
LIMIT 5");
|
44 |
+
|
45 |
+
|
46 |
+
if ($query_result) {
|
47 |
+
$this->shortcode_html = '<!-- Yasr Top 5 Reviewers Shortcode-->';
|
48 |
+
|
49 |
+
$this->shortcode_html .= '<table class="yasr-table-chart">
|
50 |
+
<tr>
|
51 |
+
<th>'. __('Author', 'yet-another-stars-rating') .'</th>
|
52 |
+
<th>'. __('Reviews', 'yet-another-stars-rating') .'</th>
|
53 |
+
</tr>';
|
54 |
+
|
55 |
+
foreach ($query_result as $result) {
|
56 |
+
$user_data = get_userdata($result->reviewer);
|
57 |
+
|
58 |
+
if ($user_data) {
|
59 |
+
$user_profile = get_author_posts_url($result->reviewer);
|
60 |
+
} else {
|
61 |
+
$user_profile = '#';
|
62 |
+
$user_data = new stdClass;
|
63 |
+
$user_data->user_login = 'Anonymous';
|
64 |
+
}
|
65 |
+
|
66 |
+
$this->shortcode_html .= "<tr>
|
67 |
+
<td><a href='$user_profile'>$user_data->user_login</a></td>
|
68 |
+
<td>$result->total_count</td>
|
69 |
+
</tr>";
|
70 |
+
|
71 |
+
}
|
72 |
+
|
73 |
+
$this->shortcode_html .= '</table>';
|
74 |
+
|
75 |
+
$this->shortcode_html .= '<!-- End Yasr Top 5 Reviewers Shortcode-->';
|
76 |
+
|
77 |
+
return $this->shortcode_html;
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
return(__(
|
82 |
+
'Problem while retrieving the top 5 most active reviewers. Did you publish any review?',
|
83 |
+
'yet-another-stars-rating')
|
84 |
+
);
|
85 |
+
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* @return string
|
90 |
+
*/
|
91 |
+
public function returnTopUsers() {
|
92 |
+
global $wpdb;
|
93 |
+
$query_result = $wpdb->get_results(
|
94 |
+
"SELECT COUNT(user_id) as total_count,
|
95 |
+
user_id as user
|
96 |
+
FROM " . YASR_LOG_TABLE . ",
|
97 |
+
$wpdb->posts AS p
|
98 |
+
WHERE post_id = p.ID
|
99 |
+
AND p.post_status = 'publish'
|
100 |
+
GROUP BY user_id
|
101 |
+
ORDER BY ( total_count ) DESC
|
102 |
+
LIMIT 10");
|
103 |
+
|
104 |
+
if ($query_result) {
|
105 |
+
$shortcode_html = '<!-- Yasr Top 10 Active Users Shortcode-->';
|
106 |
+
|
107 |
+
$shortcode_html .= '<table class="yasr-table-chart">
|
108 |
+
<tr>
|
109 |
+
<th>' . __('UserName', 'yet-another-stars-rating') . '</th>
|
110 |
+
<th>' . __('Number of votes', 'yet-another-stars-rating') . '</th>
|
111 |
+
</tr>';
|
112 |
+
|
113 |
+
foreach ($query_result as $result) {
|
114 |
+
$user_data = get_userdata($result->user);
|
115 |
+
|
116 |
+
if ($user_data) {
|
117 |
+
$user_profile = get_author_posts_url($result->user);
|
118 |
+
} else {
|
119 |
+
$user_profile = '#';
|
120 |
+
$user_data = new stdClass;
|
121 |
+
$user_data->user_login = __('Anonymous', 'yet-another-stars-rating');
|
122 |
+
}
|
123 |
+
|
124 |
+
$shortcode_html .= "<tr>
|
125 |
+
<td><a href='$user_profile'>$user_data->user_login</a></td>
|
126 |
+
<td>$result->total_count</td>
|
127 |
+
</tr>";
|
128 |
+
|
129 |
+
}
|
130 |
+
|
131 |
+
$shortcode_html .= '</table>';
|
132 |
+
$shortcode_html .= '<!--End Yasr Top 10 Active Users Shortcode-->';
|
133 |
+
|
134 |
+
return $shortcode_html;
|
135 |
+
}
|
136 |
+
|
137 |
+
return (__('Problem while retrieving the top 10 active users chart. Are you sure you have votes to show?',
|
138 |
+
'yet-another-stars-rating'));
|
139 |
+
}
|
140 |
+
}
|
includes/shortcodes/classes/YasrOverallRating.php
CHANGED
@@ -63,12 +63,12 @@ class YasrOverallRating extends YasrShortcode {
|
|
63 |
if (YASR_SHOW_OVERALL_IN_LOOP === 'enabled') {
|
64 |
return $this->shortcode_html;
|
65 |
} //default
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
}
|
70 |
-
return null;
|
71 |
}
|
|
|
|
|
72 |
}
|
73 |
|
74 |
/**
|
63 |
if (YASR_SHOW_OVERALL_IN_LOOP === 'enabled') {
|
64 |
return $this->shortcode_html;
|
65 |
} //default
|
66 |
+
|
67 |
+
if (is_singular() && is_main_query()) {
|
68 |
+
return $this->shortcode_html;
|
|
|
|
|
69 |
}
|
70 |
+
|
71 |
+
return null;
|
72 |
}
|
73 |
|
74 |
/**
|
includes/shortcodes/classes/YasrShortcode.php
CHANGED
@@ -37,6 +37,7 @@ abstract class YasrShortcode {
|
|
37 |
public $set_id; //1
|
38 |
public $show_average; //null
|
39 |
public $shorcode_name;
|
|
|
40 |
|
41 |
public function __construct($atts, $shortcode_name) {
|
42 |
$this->shorcode_name = $shortcode_name;
|
@@ -64,6 +65,9 @@ abstract class YasrShortcode {
|
|
64 |
$this->set_id = (int) $atts['setid'];
|
65 |
$this->show_average = sanitize_text_field($atts['show_average']);
|
66 |
}
|
|
|
|
|
|
|
67 |
}
|
68 |
|
69 |
/**
|
37 |
public $set_id; //1
|
38 |
public $show_average; //null
|
39 |
public $shorcode_name;
|
40 |
+
public $post_type;
|
41 |
|
42 |
public function __construct($atts, $shortcode_name) {
|
43 |
$this->shorcode_name = $shortcode_name;
|
65 |
$this->set_id = (int) $atts['setid'];
|
66 |
$this->show_average = sanitize_text_field($atts['show_average']);
|
67 |
}
|
68 |
+
|
69 |
+
$this->post_type = YasrCustomPostTypes::returnBaseUrl($this->post_id);
|
70 |
+
|
71 |
}
|
72 |
|
73 |
/**
|
includes/shortcodes/classes/YasrVisitorVotes.php
CHANGED
@@ -61,6 +61,7 @@ class YasrVisitorVotes extends YasrShortcode {
|
|
61 |
data-rater-starsize='".$this->starSize()."'
|
62 |
data-rater-nonce='$this->ajax_nonce_visitor'
|
63 |
data-issingular='$this->is_singular'
|
|
|
64 |
></div>";
|
65 |
|
66 |
return $this->returnYasrVisitorVotes(false);
|
61 |
data-rater-starsize='".$this->starSize()."'
|
62 |
data-rater-nonce='$this->ajax_nonce_visitor'
|
63 |
data-issingular='$this->is_singular'
|
64 |
+
data-cpt='$this->post_type'
|
65 |
></div>";
|
66 |
|
67 |
return $this->returnYasrVisitorVotes(false);
|
includes/shortcodes/yasr-shortcode-functions.php
CHANGED
@@ -119,9 +119,8 @@ add_shortcode ('yasr_visitor_multiset', 'yasr_visitor_multiset_callback');
|
|
119 |
* @return string|void|null
|
120 |
*/
|
121 |
function yasr_visitor_multiset_callback($atts) {
|
122 |
-
$shortcode_name = 'yasr_visitor_multiset';
|
123 |
-
$multiset = new YasrVisitorMultiSet($atts, $shortcode_name);
|
124 |
|
|
|
125 |
return $multiset->printVisitorMultiSet();
|
126 |
}
|
127 |
|
@@ -157,125 +156,20 @@ function yasr_most_or_highest_rated_posts_callback () {
|
|
157 |
|
158 |
/****** Add top 5 most active reviewer ******/
|
159 |
add_shortcode ('yasr_top_5_reviewers', 'yasr_top_5_reviewers_callback');
|
160 |
-
/**
|
161 |
-
* @return string|void
|
162 |
-
*/
|
163 |
-
function yasr_top_5_reviewers_callback () {
|
164 |
-
global $wpdb;
|
165 |
-
|
166 |
-
$query_result = $wpdb->get_results("SELECT COUNT( pm.post_id ) AS total_count, p.post_author AS reviewer
|
167 |
-
FROM $wpdb->posts AS p, $wpdb->postmeta AS pm
|
168 |
-
WHERE pm.post_id = p.ID
|
169 |
-
AND pm.meta_key = 'yasr_overall_rating'
|
170 |
-
AND p.post_status = 'publish'
|
171 |
-
GROUP BY reviewer
|
172 |
-
ORDER BY (total_count) DESC
|
173 |
-
LIMIT 5");
|
174 |
-
|
175 |
-
|
176 |
-
if ($query_result) {
|
177 |
-
|
178 |
-
$shortcode_html = '
|
179 |
-
<!-- Yasr Top 5 Reviewers Shortcode-->
|
180 |
-
';
|
181 |
-
|
182 |
-
$shortcode_html .= "
|
183 |
-
<table class=\"yasr-table-chart\">
|
184 |
-
<tr>
|
185 |
-
<th>Author</th>
|
186 |
-
<th>Reviews</th>
|
187 |
-
</tr>
|
188 |
-
";
|
189 |
-
|
190 |
-
foreach ($query_result as $result) {
|
191 |
-
|
192 |
-
$user_data = get_userdata($result->reviewer);
|
193 |
-
|
194 |
-
if ($user_data) {
|
195 |
-
$user_profile = get_author_posts_url($result->reviewer);
|
196 |
-
}
|
197 |
-
|
198 |
-
else {
|
199 |
-
$user_profile = '#';
|
200 |
-
$user_data = new stdClass;
|
201 |
-
$user_data->user_login = 'Anonymous';
|
202 |
-
}
|
203 |
-
|
204 |
|
205 |
-
|
206 |
-
|
207 |
-
<td>$result->total_count</td>
|
208 |
-
</tr>";
|
209 |
-
|
210 |
-
}
|
211 |
-
|
212 |
-
$shortcode_html .= "</table>";
|
213 |
-
|
214 |
-
$shortcode_html .= '
|
215 |
-
<!-- End Yasr Top 5 Reviewers Shortcode-->
|
216 |
-
';
|
217 |
-
|
218 |
-
return $shortcode_html;
|
219 |
-
|
220 |
-
}
|
221 |
-
|
222 |
-
_e('Problem while retrieving the top 5 most active reviewers. Did you publish any review?');
|
223 |
|
|
|
224 |
} //End top 5 reviewers function
|
225 |
|
226 |
/****** Add top 10 most active user *****/
|
227 |
add_shortcode ('yasr_top_ten_active_users', 'yasr_top_ten_active_users_callback');
|
228 |
-
/**
|
229 |
-
* @return string|void
|
230 |
-
*/
|
231 |
-
function yasr_top_ten_active_users_callback () {
|
232 |
-
global $wpdb;
|
233 |
-
|
234 |
-
$query_result = $wpdb->get_results("SELECT COUNT( user_id ) as total_count, user_id as user
|
235 |
-
FROM " . YASR_LOG_TABLE . ", $wpdb->posts AS p
|
236 |
-
WHERE post_id = p.ID
|
237 |
-
AND p.post_status = 'publish'
|
238 |
-
GROUP BY user_id
|
239 |
-
ORDER BY ( total_count ) DESC
|
240 |
-
LIMIT 10");
|
241 |
-
|
242 |
-
if ($query_result) {
|
243 |
-
$shortcode_html = '<!-- Yasr Top 10 Active Users Shortcode-->';
|
244 |
-
|
245 |
-
$shortcode_html .= "
|
246 |
-
<table class=\"yasr-table-chart\">
|
247 |
-
<tr>
|
248 |
-
<th>UserName</th>
|
249 |
-
<th>Number of votes</th>
|
250 |
-
</tr>
|
251 |
-
";
|
252 |
-
|
253 |
-
foreach ($query_result as $result) {
|
254 |
-
$user_data = get_userdata($result->user);
|
255 |
-
|
256 |
-
if ($user_data) {
|
257 |
-
$user_profile = get_author_posts_url($result->user);
|
258 |
-
} else {
|
259 |
-
$user_profile = '#';
|
260 |
-
$user_data = new stdClass;
|
261 |
-
$user_data->user_login = 'Anonymous';
|
262 |
-
}
|
263 |
-
|
264 |
-
$shortcode_html .= "<tr>
|
265 |
-
<td><a href=\"$user_profile\">$user_data->user_login</a></td>
|
266 |
-
<td>$result->total_count</td>
|
267 |
-
</tr>";
|
268 |
-
|
269 |
-
}
|
270 |
-
|
271 |
-
$shortcode_html .= "</table>";
|
272 |
-
$shortcode_html .= '<!--End Yasr Top 10 Active Users Shortcode-->';
|
273 |
-
|
274 |
-
return $shortcode_html;
|
275 |
-
}
|
276 |
|
277 |
-
|
|
|
278 |
|
|
|
279 |
} //End function
|
280 |
|
281 |
|
119 |
* @return string|void|null
|
120 |
*/
|
121 |
function yasr_visitor_multiset_callback($atts) {
|
|
|
|
|
122 |
|
123 |
+
$multiset = new YasrVisitorMultiSet($atts, 'yasr_visitor_multiset');
|
124 |
return $multiset->printVisitorMultiSet();
|
125 |
}
|
126 |
|
156 |
|
157 |
/****** Add top 5 most active reviewer ******/
|
158 |
add_shortcode ('yasr_top_5_reviewers', 'yasr_top_5_reviewers_callback');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
|
160 |
+
function yasr_top_5_reviewers_callback () {
|
161 |
+
$top_5_reviewers_obj = new YasrNoStarsRankings(false, 'yasr_top_5_reviewers');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
|
163 |
+
return $top_5_reviewers_obj->returnTopReviewers();
|
164 |
} //End top 5 reviewers function
|
165 |
|
166 |
/****** Add top 10 most active user *****/
|
167 |
add_shortcode ('yasr_top_ten_active_users', 'yasr_top_ten_active_users_callback');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
|
169 |
+
function yasr_top_ten_active_users_callback () {
|
170 |
+
$most_active_users_obj = new YasrNoStarsRankings(false, 'yasr_top_ten_active_users');
|
171 |
|
172 |
+
return $most_active_users_obj->returnTopUsers();
|
173 |
} //End function
|
174 |
|
175 |
|
includes/yasr-includes-db-functions.php
CHANGED
@@ -24,17 +24,26 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
24 |
/**
|
25 |
* Return the postmeta itemType
|
26 |
*
|
|
|
|
|
27 |
* @return bool|string
|
28 |
*/
|
29 |
-
function yasr_get_itemType() {
|
30 |
$review_types = json_decode(YASR_SUPPORTED_SCHEMA_TYPES);
|
31 |
-
$post_id = get_the_ID();
|
32 |
|
33 |
-
if
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
-
|
|
|
|
|
|
|
38 |
|
39 |
if ($result) {
|
40 |
$snippet_type = trim($result);
|
@@ -48,14 +57,12 @@ function yasr_get_itemType() {
|
|
48 |
$snippet_type = 'BlogPosting';
|
49 |
}
|
50 |
|
51 |
-
if (!in_array($snippet_type, $review_types)) {
|
52 |
$snippet_type = YASR_ITEMTYPE;
|
53 |
}
|
54 |
|
55 |
} else {
|
56 |
$snippet_type = YASR_ITEMTYPE;
|
57 |
}
|
58 |
-
|
59 |
return $snippet_type;
|
60 |
-
|
61 |
}
|
24 |
/**
|
25 |
* Return the postmeta itemType
|
26 |
*
|
27 |
+
* @param bool|int $term_id
|
28 |
+
*
|
29 |
* @return bool|string
|
30 |
*/
|
31 |
+
function yasr_get_itemType($term_id=false) {
|
32 |
$review_types = json_decode(YASR_SUPPORTED_SCHEMA_TYPES);
|
|
|
33 |
|
34 |
+
//if term_id is not an int, use get_post_meta
|
35 |
+
if(!is_int($term_id)) {
|
36 |
+
$post_id = get_the_ID();
|
37 |
+
|
38 |
+
//should be useless, just to be safe
|
39 |
+
if (!$post_id) {
|
40 |
+
return false;
|
41 |
+
}
|
42 |
|
43 |
+
$result = get_post_meta($post_id, 'yasr_review_type', true);
|
44 |
+
} else {
|
45 |
+
$result = get_term_meta($term_id, 'yasr_review_type', true);
|
46 |
+
}
|
47 |
|
48 |
if ($result) {
|
49 |
$snippet_type = trim($result);
|
57 |
$snippet_type = 'BlogPosting';
|
58 |
}
|
59 |
|
60 |
+
if (!in_array($snippet_type, $review_types, true) ) {
|
61 |
$snippet_type = YASR_ITEMTYPE;
|
62 |
}
|
63 |
|
64 |
} else {
|
65 |
$snippet_type = YASR_ITEMTYPE;
|
66 |
}
|
|
|
67 |
return $snippet_type;
|
|
|
68 |
}
|
includes/yasr-includes-functions.php
CHANGED
@@ -90,31 +90,37 @@ function yasr_translate_option() {
|
|
90 |
/**
|
91 |
* Create a select menu to choose the rich snippet itemtype
|
92 |
*
|
93 |
-
* @param bool|string $html_id
|
|
|
|
|
94 |
*/
|
95 |
|
96 |
-
function yasr_select_itemtype($html_id=false) {
|
97 |
-
|
98 |
if($html_id === false) {
|
99 |
$html_id = 'yasr-choose-reviews-types-list';
|
100 |
}
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
-
$
|
103 |
|
104 |
-
|
105 |
-
|
|
|
106 |
?>
|
107 |
|
108 |
<label for="<?php echo $html_id ?>"></label>
|
109 |
<select name="yasr-review-type" id="<?php echo $html_id ?>">
|
110 |
<?php
|
111 |
-
foreach ($
|
112 |
-
$
|
113 |
-
$
|
114 |
-
|
115 |
-
echo "<option value=\"$type\" selected>$type_option</option>";
|
116 |
} else {
|
117 |
-
echo "<option value
|
118 |
}
|
119 |
}
|
120 |
?>
|
@@ -123,40 +129,6 @@ function yasr_select_itemtype($html_id=false) {
|
|
123 |
<?php
|
124 |
} //End function yasr_select_itemtype()
|
125 |
|
126 |
-
/**
|
127 |
-
* @return bool|string[]|WP_Post_Type[]
|
128 |
-
*/
|
129 |
-
function yasr_get_custom_post_type() {
|
130 |
-
|
131 |
-
$args = array(
|
132 |
-
'public' => true,
|
133 |
-
'_builtin' => false
|
134 |
-
);
|
135 |
-
|
136 |
-
$output = 'names'; // names or objects, note names is the default
|
137 |
-
$operator = 'and'; // 'and' or 'or'
|
138 |
-
|
139 |
-
//if not found, returns an empty array
|
140 |
-
$post_types = get_post_types($args, $output, $operator);
|
141 |
-
|
142 |
-
if ($post_types) {
|
143 |
-
return ($post_types);
|
144 |
-
}
|
145 |
-
|
146 |
-
return false;
|
147 |
-
}
|
148 |
-
|
149 |
-
function yasr_return_all_post_types () {
|
150 |
-
$args = array(
|
151 |
-
'public' => true,
|
152 |
-
);
|
153 |
-
|
154 |
-
$output = 'names';
|
155 |
-
$operator = 'and';
|
156 |
-
|
157 |
-
return get_post_types($args, $output, $operator);
|
158 |
-
}
|
159 |
-
|
160 |
/*** Function to set cookie, since version 0.8.3 ***/
|
161 |
function yasr_setcookie($cookiename, $data_to_save) {
|
162 |
|
90 |
/**
|
91 |
* Create a select menu to choose the rich snippet itemtype
|
92 |
*
|
93 |
+
* @param bool|string $html_id the id of the select name
|
94 |
+
* @param bool|int $term_id
|
95 |
+
* @param bool $disabled
|
96 |
*/
|
97 |
|
98 |
+
function yasr_select_itemtype($html_id=false, $term_id=false, $disabled=false) {
|
|
|
99 |
if($html_id === false) {
|
100 |
$html_id = 'yasr-choose-reviews-types-list';
|
101 |
}
|
102 |
+
$itemtypes_array = json_decode(YASR_SUPPORTED_SCHEMA_TYPES);
|
103 |
+
|
104 |
+
sort($itemtypes_array);
|
105 |
+
|
106 |
+
$review_type_choosen = yasr_get_itemType($term_id);
|
107 |
|
108 |
+
$disabled_attribute = '';
|
109 |
|
110 |
+
if($disabled === true) {
|
111 |
+
$disabled_attribute = 'disabled';
|
112 |
+
}
|
113 |
?>
|
114 |
|
115 |
<label for="<?php echo $html_id ?>"></label>
|
116 |
<select name="yasr-review-type" id="<?php echo $html_id ?>">
|
117 |
<?php
|
118 |
+
foreach ($itemtypes_array as $itemType) {
|
119 |
+
$itemType = trim($itemType);
|
120 |
+
if ($itemType === $review_type_choosen) {
|
121 |
+
echo "<option value='$itemType' selected >$itemType</option>";
|
|
|
122 |
} else {
|
123 |
+
echo "<option value='$itemType' $disabled_attribute>$itemType</option>";
|
124 |
}
|
125 |
}
|
126 |
?>
|
129 |
<?php
|
130 |
} //End function yasr_select_itemtype()
|
131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
/*** Function to set cookie, since version 0.8.3 ***/
|
133 |
function yasr_setcookie($cookiename, $data_to_save) {
|
134 |
|
includes/yasr-includes-init.php
CHANGED
@@ -29,8 +29,7 @@ define('YASR_CSS_DIR_INCLUDES', plugins_url() . '/' . YASR_RELATIVE_PATH_INCLUDE
|
|
29 |
require YASR_ABSOLUTE_PATH_INCLUDES . '/yasr-includes-functions.php';
|
30 |
require YASR_ABSOLUTE_PATH_INCLUDES . '/yasr-includes-db-functions.php';
|
31 |
require YASR_ABSOLUTE_PATH_INCLUDES . '/yasr-widgets.php';
|
32 |
-
|
33 |
-
require YASR_ABSOLUTE_PATH_INCLUDES . '/rest/yasr-rest.php';
|
34 |
|
35 |
/**
|
36 |
* Callback function for the spl_autoload_register above.
|
@@ -53,9 +52,12 @@ function yasr_autoload_includes_classes($class) {
|
|
53 |
}
|
54 |
}
|
55 |
|
56 |
-
//AutoLoad Yasr
|
57 |
spl_autoload_register('yasr_autoload_includes_classes');
|
58 |
|
|
|
|
|
|
|
59 |
/****** Getting options ******/
|
60 |
//Get general options
|
61 |
$yasr_stored_options = get_option('yasr_general_options');
|
29 |
require YASR_ABSOLUTE_PATH_INCLUDES . '/yasr-includes-functions.php';
|
30 |
require YASR_ABSOLUTE_PATH_INCLUDES . '/yasr-includes-db-functions.php';
|
31 |
require YASR_ABSOLUTE_PATH_INCLUDES . '/yasr-widgets.php';
|
32 |
+
|
|
|
33 |
|
34 |
/**
|
35 |
* Callback function for the spl_autoload_register above.
|
52 |
}
|
53 |
}
|
54 |
|
55 |
+
//AutoLoad Yasr Classes, only when a object is created
|
56 |
spl_autoload_register('yasr_autoload_includes_classes');
|
57 |
|
58 |
+
require YASR_ABSOLUTE_PATH_INCLUDES . '/shortcodes/yasr-shortcode-functions.php';
|
59 |
+
require YASR_ABSOLUTE_PATH_INCLUDES . '/rest/yasr-rest.php';
|
60 |
+
|
61 |
/****** Getting options ******/
|
62 |
//Get general options
|
63 |
$yasr_stored_options = get_option('yasr_general_options');
|
public/yasr-public-filters.php
CHANGED
@@ -95,7 +95,7 @@ function yasr_auto_insert_shortcode_callback($content) {
|
|
95 |
|
96 |
//IF auto insert must work only in custom post type
|
97 |
if (YASR_AUTO_INSERT_CUSTOM_POST_ONLY === 'yes') {
|
98 |
-
$custom_post_types =
|
99 |
//If is a post type return content and stars
|
100 |
if (is_singular($custom_post_types)) {
|
101 |
return $content_and_stars;
|
95 |
|
96 |
//IF auto insert must work only in custom post type
|
97 |
if (YASR_AUTO_INSERT_CUSTOM_POST_ONLY === 'yes') {
|
98 |
+
$custom_post_types = YasrCustomPostTypes::getCustomPostTypes();
|
99 |
//If is a post type return content and stars
|
100 |
if (is_singular($custom_post_types)) {
|
101 |
return $content_and_stars;
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Requires at least: 4.9.0
|
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 5.5
|
7 |
Requires PHP: 5.3
|
8 |
-
Stable tag: 2.3.
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
|
@@ -111,15 +111,12 @@ YASR has been tested with:
|
|
111 |
* Wp Rocket
|
112 |
|
113 |
= Why I don't see stars in google? =
|
114 |
-
[Read here](https://yetanotherstarsrating.com/docs/rich-snippet/reviewrating-and-aggregaterating/) and find out how to
|
115 |
-
|
116 |
-
You can use the [Structured Data Testing Tool](https://search.google.com/structured-data/testing-tool/u/0/) to validate
|
117 |
-
your pages.
|
118 |
Also [read this](https://webmasters.googleblog.com/2019/09/making-review-rich-results-more-helpful.html) google announcement.
|
119 |
If you set up everythings fine, in 99% of cases your stars will appear in a week.
|
120 |
If doesn't, you should work on your seo reputation.
|
121 |
|
122 |
-
|
123 |
== Screenshots ==
|
124 |
1. Example of yasr in a videogame review
|
125 |
2. Another example of a restaurant review
|
@@ -131,11 +128,17 @@ If doesn't, you should work on your seo reputation.
|
|
131 |
|
132 |
The full changelog can be found in the plugin's directory. Recent entries:
|
133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
= 2.3.2 =
|
135 |
* FIXED: Uncaught TypeError randomly shows up in the browser console
|
136 |
* TWEAKED: removed deprecated multisite function
|
137 |
* TWEAKED: in tht settings page, the "custom css" textarea is now a text editor
|
138 |
-
* TWEAKED: CSS
|
139 |
* TWEAKED: minor code cleanup
|
140 |
|
141 |
= 2.3.1 =
|
@@ -213,11 +216,6 @@ More to come in the next realeses :)
|
|
213 |
* TWEAKED: Removed transient: since version 2.2.0 are useless.
|
214 |
|
215 |
|
216 |
-
= 2.2.2 =
|
217 |
-
* FIXED: links in Recent Ratings dashboard widget (thanks to Fernando Tellado)
|
218 |
-
* Enhancement: Added REST responses. More info in the official site
|
219 |
-
|
220 |
-
|
221 |
= Additional Info =
|
222 |
External Libraries: [Rater](https://github.com/fredolss/rater-js)
|
223 |
[tippy](https://atomiks.github.io/tippyjs/)
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 5.5
|
7 |
Requires PHP: 5.3
|
8 |
+
Stable tag: 2.3.3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
|
111 |
* Wp Rocket
|
112 |
|
113 |
= Why I don't see stars in google? =
|
114 |
+
[Read here](https://yetanotherstarsrating.com/docs/rich-snippet/reviewrating-and-aggregaterating/) and find out how to set up rich snippets.
|
115 |
+
You can use the [Structured Data Testing Tool](https://search.google.com/structured-data/testing-tool/u/0/) to validate your pages.
|
|
|
|
|
116 |
Also [read this](https://webmasters.googleblog.com/2019/09/making-review-rich-results-more-helpful.html) google announcement.
|
117 |
If you set up everythings fine, in 99% of cases your stars will appear in a week.
|
118 |
If doesn't, you should work on your seo reputation.
|
119 |
|
|
|
120 |
== Screenshots ==
|
121 |
1. Example of yasr in a videogame review
|
122 |
2. Another example of a restaurant review
|
128 |
|
129 |
The full changelog can be found in the plugin's directory. Recent entries:
|
130 |
|
131 |
+
= 2.3.3 =
|
132 |
+
* FIXED: "Load results with AJAX" option works with all post types, not the "posts" one
|
133 |
+
* FIXED: CSS fix in settings pages
|
134 |
+
* FIXED: minor fix with multiSet
|
135 |
+
|
136 |
+
|
137 |
= 2.3.2 =
|
138 |
* FIXED: Uncaught TypeError randomly shows up in the browser console
|
139 |
* TWEAKED: removed deprecated multisite function
|
140 |
* TWEAKED: in tht settings page, the "custom css" textarea is now a text editor
|
141 |
+
* TWEAKED: CSS improvement in settings page
|
142 |
* TWEAKED: minor code cleanup
|
143 |
|
144 |
= 2.3.1 =
|
216 |
* TWEAKED: Removed transient: since version 2.2.0 are useless.
|
217 |
|
218 |
|
|
|
|
|
|
|
|
|
|
|
219 |
= Additional Info =
|
220 |
External Libraries: [Rater](https://github.com/fredolss/rater-js)
|
221 |
[tippy](https://atomiks.github.io/tippyjs/)
|
yet-another-stars-rating.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
|
6 |
* Description: Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and
|
7 |
* testimonials to your website posts, pages and CPT, without affecting its speed.
|
8 |
-
* Version: 2.3.
|
9 |
* Author: Dario Curvino
|
10 |
* Author URI: https://dariocurvino.it/
|
11 |
* Text Domain: yet-another-stars-rating
|
@@ -77,7 +77,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
|
|
77 |
yasr_fs();
|
78 |
// Signal that SDK was initiated.
|
79 |
do_action( 'yasr_fs_loaded' );
|
80 |
-
define( 'YASR_VERSION_NUM', '2.3.
|
81 |
//Plugin absolute path
|
82 |
//e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
|
83 |
define( 'YASR_ABSOLUTE_PATH', __DIR__ );
|
5 |
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
|
6 |
* Description: Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and
|
7 |
* testimonials to your website posts, pages and CPT, without affecting its speed.
|
8 |
+
* Version: 2.3.3
|
9 |
* Author: Dario Curvino
|
10 |
* Author URI: https://dariocurvino.it/
|
11 |
* Text Domain: yet-another-stars-rating
|
77 |
yasr_fs();
|
78 |
// Signal that SDK was initiated.
|
79 |
do_action( 'yasr_fs_loaded' );
|
80 |
+
define( 'YASR_VERSION_NUM', '2.3.3' );
|
81 |
//Plugin absolute path
|
82 |
//e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
|
83 |
define( 'YASR_ABSOLUTE_PATH', __DIR__ );
|