Version Description
Download this release
Release Info
Developer | bhittani |
Plugin | kk Star Ratings |
Version | 5.2.0 |
Comparing to | |
See all releases |
Code changes from version 4.2.0 to 5.2.0
- CHANGELOG.md +65 -0
- LICENSE.txt +1 -1
- freemius.php +8 -3
- freemius/LICENSE.txt +0 -0
- freemius/assets/css/admin/common.css +1 -1
- freemius/assets/css/admin/connect.css +1 -1
- freemius/assets/js/nojquery.ba-postmessage.js +0 -0
- freemius/assets/js/nojquery.ba-postmessage.min.js +0 -0
- freemius/assets/js/postmessage.js +0 -0
- freemius/includes/class-freemius-abstract.php +0 -0
- freemius/includes/class-freemius.php +79 -41
- freemius/includes/class-fs-api.php +0 -0
- freemius/includes/class-fs-logger.php +1 -1
- freemius/includes/class-fs-plugin-updater.php +0 -0
- freemius/includes/class-fs-security.php +0 -0
- freemius/includes/entities/class-fs-entity.php +0 -0
- freemius/includes/entities/class-fs-payment.php +0 -0
- freemius/includes/entities/class-fs-plugin-info.php +0 -0
- freemius/includes/entities/class-fs-plugin-license.php +0 -0
- freemius/includes/entities/class-fs-plugin-plan.php +0 -0
- freemius/includes/entities/class-fs-plugin-tag.php +0 -0
- freemius/includes/entities/class-fs-plugin.php +0 -0
- freemius/includes/entities/class-fs-pricing.php +0 -0
- freemius/includes/entities/class-fs-scope-entity.php +0 -0
- freemius/includes/entities/class-fs-site.php +17 -0
- freemius/includes/entities/class-fs-subscription.php +0 -0
- freemius/includes/entities/class-fs-user.php +0 -17
- freemius/includes/fs-core-functions.php +0 -0
- freemius/includes/fs-plugin-info-dialog.php +0 -0
- freemius/includes/i18n.php +0 -0
- freemius/includes/managers/class-fs-cache-manager.php +0 -0
- freemius/includes/managers/class-fs-key-value-storage.php +0 -0
- freemius/includes/managers/class-fs-license-manager.php +0 -0
- freemius/includes/managers/class-fs-option-manager.php +0 -0
- freemius/includes/managers/class-fs-plan-manager.php +0 -0
- freemius/includes/managers/class-fs-plugin-manager.php +0 -0
- freemius/includes/sdk/Exceptions/ArgumentNotExistException.php +0 -0
- freemius/includes/sdk/Exceptions/EmptyArgumentException.php +0 -0
- freemius/includes/sdk/Exceptions/Exception.php +0 -0
- freemius/includes/sdk/Exceptions/InvalidArgumentException.php +0 -0
- freemius/includes/sdk/Exceptions/OAuthException.php +0 -0
- freemius/includes/sdk/FreemiusBase.php +0 -0
- freemius/includes/sdk/FreemiusWordPress.php +0 -0
- freemius/includes/sdk/LICENSE.txt +0 -0
- freemius/languages/freemius-cs_CZ.mo +0 -0
- freemius/languages/freemius-da_DK.mo +0 -0
- freemius/languages/freemius-en.mo +0 -0
- freemius/languages/freemius-es_ES.mo +0 -0
- freemius/languages/freemius-fr_FR.mo +0 -0
- freemius/languages/freemius-he_IL.mo +0 -0
- freemius/languages/freemius-hu_HU.mo +0 -0
- freemius/languages/freemius-it_IT.mo +0 -0
- freemius/languages/freemius-ja.mo +0 -0
- freemius/languages/freemius-nl_NL.mo +0 -0
- freemius/languages/freemius-ru_RU.mo +0 -0
- freemius/languages/freemius-ta.mo +0 -0
- freemius/languages/freemius-zh_CN.mo +0 -0
- freemius/languages/freemius.pot +345 -313
- freemius/package.json +1 -1
- freemius/start.php +3 -3
- freemius/templates/account.php +5 -3
- freemius/templates/add-ons.php +0 -0
- freemius/templates/checkout.php +0 -0
- freemius/templates/connect.php +49 -37
- freemius/templates/contact.php +0 -0
- freemius/templates/firewall-issues-js.php +0 -0
- freemius/templates/forms/deactivation/form.php +0 -0
- freemius/templates/forms/license-activation.php +3 -1
- freemius/templates/powered-by.php +0 -0
- freemius/templates/sticky-admin-notice-js.php +0 -0
- index.php +10 -67
- kkStarRatings.php +0 -166
- languages/index.php +6 -0
- languages/kk-star-ratings.pot +288 -103
- public/css/index.php +0 -6
- public/css/kk-star-ratings.css.php +0 -29
- public/index.php +0 -6
- public/js/index.php +0 -6
- public/js/kk-star-ratings.js +0 -67
- public/svg/active.svg +0 -3
- public/svg/inactive.svg +0 -3
- public/svg/index.php +0 -6
- public/svg/selected.svg +0 -3
- readme.txt +34 -12
- src/activate.php +0 -114
- src/admin.php +0 -175
- src/admin/appearance.php +0 -63
- src/admin/general.php +0 -212
- src/admin/rich-snippets.php +0 -60
- src/ajax.php +0 -66
- src/assets.php +0 -69
- src/classes/Migration.php +156 -0
- src/classes/Stack.php +38 -0
- src/config.php +26 -33
- src/core/actions/activate.php +30 -0
- src/{i18n.php → core/actions/admin/content.php} +4 -5
- src/core/actions/admin/index.php +107 -0
- src/core/actions/admin/save.php +22 -0
- src/core/actions/admin/save/appearance.php +35 -0
- src/core/actions/admin/save/general.php +33 -0
- src/core/actions/admin/save/index.php +15 -0
- src/core/actions/admin/save/rich_snippets.php +35 -0
- src/core/actions/admin/script.php +27 -0
- src/core/actions/admin/style.php +21 -0
- src/core/actions/admin/tabs/appearance.php +27 -0
- src/core/actions/admin/tabs/general.php +27 -0
- src/core/actions/admin/tabs/index.php +15 -0
- src/core/actions/admin/tabs/rich_snippets.php +27 -0
- src/core/actions/deactivate.php +21 -0
- src/core/actions/downgrade.php +34 -0
- src/core/actions/index.php +15 -0
- src/core/actions/init.php +27 -0
- src/core/actions/install.php +25 -0
- src/core/actions/markup.php +24 -0
- src/core/actions/metabox/content.php +28 -0
- src/core/actions/metabox/index.php +30 -0
- src/core/actions/metabox/save.php +48 -0
- src/core/actions/save.php +53 -0
- src/core/actions/script.php +46 -0
- src/core/actions/sd.php +30 -0
- src/core/actions/style.php +28 -0
- src/core/actions/upgrade.php +76 -0
- src/core/config.php +79 -0
- src/core/filters/admin/active_tab.php +26 -0
- src/core/filters/admin/index.php +15 -0
- src/core/filters/admin/tabs.php +31 -0
- src/core/filters/count.php +28 -0
- src/core/filters/fingerprint.php +26 -0
- src/core/filters/index.php +15 -0
- src/core/filters/okay.php +85 -0
- src/core/filters/payload.php +37 -0
- src/core/filters/ratings.php +28 -0
- src/core/filters/score.php +22 -0
- src/core/filters/status.php +28 -0
- src/core/filters/unique.php +28 -0
- src/core/filters/validate.php +65 -0
- src/core/functions/action.php +24 -0
- src/core/functions/calculate.php +30 -0
- src/core/functions/explode_meta_prefix.php +24 -0
- src/core/functions/explode_prefix.php +24 -0
- src/core/functions/filter.php +24 -0
- src/core/functions/get_hof.php +24 -0
- src/core/functions/get_meta_hof.php +29 -0
- src/core/functions/index.php +15 -0
- src/core/functions/meta_prefix.php +29 -0
- src/core/functions/migrate.php +44 -0
- src/core/functions/migrations.php +28 -0
- src/core/functions/option.php +30 -0
- src/core/functions/post_meta.php +31 -0
- src/core/functions/prefix.php +29 -0
- src/core/functions/response.php +52 -0
- src/core/functions/script_migrations.php +39 -0
- src/core/functions/strip_meta_prefix.php +29 -0
- src/core/functions/strip_prefix.php +29 -0
- src/core/functions/upgrade_options.php +56 -0
- src/core/functions/upgrade_posts.php +123 -0
- src/core/functions/view.php +25 -0
- src/core/functions/width.php +23 -0
- src/core/hooks.php +25 -0
- src/core/hydrate.php +29 -0
- src/core/index.php +23 -0
- src/core/migrations/index.php +15 -0
- src/core/migrations/v5.1.0/index.php +15 -0
- src/core/migrations/v5.1.0/posts.php +60 -0
- src/core/public/css/index.php +15 -0
- {public → src/core/public}/css/kk-star-ratings.css +21 -13
- src/core/public/css/kk-star-ratings.min.css +5 -0
- src/core/public/index.php +15 -0
- src/core/public/js/index.php +15 -0
- src/core/public/js/kk-star-ratings.js +112 -0
- src/core/public/js/kk-star-ratings.min.js +5 -0
- src/core/public/js/kksr-migrations.js +43 -0
- src/core/public/js/kksr-migrations.min.js +5 -0
- src/core/public/svg/active.svg +3 -0
- src/core/public/svg/inactive.svg +3 -0
- src/core/public/svg/index.php +15 -0
- src/core/public/svg/selected.svg +3 -0
- src/core/views/admin/index.php +64 -0
- {views → src/core/views}/admin/social.php +10 -4
- src/core/views/admin/tabs/appearance.php +145 -0
- src/core/views/admin/tabs/general.php +147 -0
- src/core/views/admin/tabs/index.php +15 -0
- src/core/views/admin/tabs/rich-snippets.php +57 -0
- src/core/views/index.php +15 -0
- src/core/views/markup/active-star.php +8 -0
- src/core/views/markup/active-stars.php +14 -0
- src/core/views/markup/inactive-star.php +8 -0
- src/core/views/markup/inactive-stars.php +14 -0
- src/core/views/markup/index.php +15 -0
- src/core/views/markup/legend.php +14 -0
- src/core/views/markup/star.php +8 -0
- src/core/views/markup/stars.php +11 -0
- src/core/views/metabox/content.php +39 -0
- src/core/views/metabox/index.php +8 -0
- src/core/views/notice.php +19 -0
- src/core/wp/actions/add_meta_boxes.php +62 -0
- src/core/wp/actions/admin_enqueue_scripts.php +29 -0
- src/core/wp/actions/admin_menu.php +29 -0
- src/core/wp/actions/admin_notices.php +31 -0
- src/core/wp/actions/index.php +15 -0
- src/core/wp/actions/plugins_loaded.php +30 -0
- src/core/wp/actions/save_post.php +29 -0
- src/core/wp/actions/the_post.php +73 -0
- src/core/wp/actions/upgrader_process_complete.php +31 -0
- src/core/wp/actions/wp_ajax_kk-star-ratings.php +72 -0
- src/core/wp/actions/wp_ajax_kksr-migrations.php +46 -0
- src/core/wp/actions/wp_ajax_nopriv_kk-star-ratings.php +22 -0
- src/core/wp/actions/wp_ajax_nopriv_kksr-migrations.php +22 -0
- src/core/wp/actions/wp_enqueue_scripts.php +27 -0
- src/core/wp/actions/wp_head.php +37 -0
- src/core/wp/filters/index.php +15 -0
- src/core/wp/filters/load_textdomain_mofile.php +28 -0
- src/core/wp/filters/the_content.php +58 -0
- src/core/wp/functions/activate.php +40 -0
- src/core/wp/functions/deactivate.php +24 -0
- src/core/wp/index.php +15 -0
- src/core/wp/shortcodes/index.php +15 -0
- src/core/wp/shortcodes/kk-star-ratings.php +78 -0
- src/core/wp/shortcodes/kkratings.php +23 -0
- src/core/wp/shortcodes/kkstarratings.php +23 -0
- src/functions/action.php +29 -0
- src/functions/autoload.php +127 -0
- src/functions/autoload_class.php +62 -0
- src/functions/autoload_function.php +62 -0
- src/functions/cast.php +28 -0
- src/functions/container.php +28 -0
- src/functions/dot.php +56 -0
- src/functions/dusk_attr.php +28 -0
- src/{global.php → functions/explode_prefix.php} +5 -18
- src/functions/filter.php +29 -0
- src/functions/find.php +47 -0
- src/functions/flat.php +39 -0
- src/functions/get_hof.php +30 -0
- src/functions/hook.php +38 -0
- src/functions/index.php +15 -0
- src/functions/migrations.php +24 -0
- src/functions/option.php +46 -0
- src/functions/post_meta.php +77 -0
- src/functions/prefix.php +42 -0
- src/functions/sanitize.php +51 -0
- src/functions/strip_prefix.php +42 -0
- src/functions/to_shortcode.php +41 -0
- src/functions/type_cast.php +31 -0
- src/functions/view.php +67 -0
- src/hook.php +0 -59
- src/index.php +32 -0
- src/kk_star_ratings.php +34 -0
- src/kksr.php +20 -0
- src/legacy.php +0 -99
- src/metabox.php +0 -106
- src/post.php +0 -82
- src/response.php +0 -93
- src/shortcode.php +0 -49
- src/validate.php +0 -53
- src/view.php +0 -73
- views/active-star.php +0 -1
- views/active-stars.php +0 -7
- views/admin/content.php +0 -13
- views/admin/fields/checkbox.php +0 -12
- views/admin/fields/code.php +0 -9
- views/admin/fields/number.php +0 -12
- views/admin/fields/radio.php +0 -13
- views/admin/fields/select.php +0 -17
- views/admin/fields/text.php +0 -8
- views/admin/fields/textarea.php +0 -9
- views/admin/index.php +0 -36
- views/inactive-star.php +0 -1
- views/inactive-stars.php +0 -7
- views/index.php +0 -6
- views/legend.php +0 -15
- views/markup.php +0 -7
- views/metabox/content.php +0 -36
- views/metabox/index.php +0 -10
- views/star.php +0 -1
- views/stars.php +0 -4
CHANGELOG.md
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Change Log
|
2 |
+
|
3 |
+
All notable changes to this project will be documented in this file.
|
4 |
+
|
5 |
+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
6 |
+
and this project adheres to [Semantic Versioning](http://semver.org/).
|
7 |
+
|
8 |
+
## [5.1.4] - 2021-11-01
|
9 |
+
|
10 |
+
### Updated
|
11 |
+
- Migrate 5 posts instead of 20 per batch.
|
12 |
+
|
13 |
+
### Fixed
|
14 |
+
- Migrations for the same version were duplicated.
|
15 |
+
|
16 |
+
## [5.1.3] - 2021-11-01
|
17 |
+
|
18 |
+
### Updated
|
19 |
+
- Migrate 20 posts instead of 50 per batch.
|
20 |
+
|
21 |
+
### Fixed
|
22 |
+
- Migrations were not being processed continuously due to a javascript bug.
|
23 |
+
|
24 |
+
## [5.1.2] - 2021-11-01
|
25 |
+
|
26 |
+
### Fixed
|
27 |
+
- Migrations now correctly run in the background when the frontend is open.
|
28 |
+
|
29 |
+
## [5.1.1] - 2021-11-01
|
30 |
+
|
31 |
+
### Updated
|
32 |
+
- More detailed information is now displayed in `pending migrations` notice.
|
33 |
+
|
34 |
+
## [5.1.0] - 2021-10-31
|
35 |
+
|
36 |
+
### Added
|
37 |
+
- Batched migrations. Posts are now migrated in batches in the background.
|
38 |
+
|
39 |
+
### Fixed
|
40 |
+
- Bumped template code priority.
|
41 |
+
|
42 |
+
|
43 |
+
## [5.0.3] - 2021-10-11
|
44 |
+
|
45 |
+
### Updated
|
46 |
+
- Freemius sdk upgraded to 2.4.2
|
47 |
+
|
48 |
+
### Fixed
|
49 |
+
- Enforce casting of post id to int when calculating for meta box.
|
50 |
+
- Disallowed check for regex expression when using find() in order to supress warning in PHP 8.
|
51 |
+
|
52 |
+
## [5.0.2] - 2021-10-11
|
53 |
+
|
54 |
+
### Fixed
|
55 |
+
- Force legend to the default in order to override dangling v2 legend.
|
56 |
+
|
57 |
+
## [5.0.1] - 2021-10-10
|
58 |
+
|
59 |
+
### Fixed
|
60 |
+
- Activation would not be executed when upgrading via wp org. Fixed by activating after plugin is loaded.
|
61 |
+
|
62 |
+
## [5.0.0] - 2021-10-09
|
63 |
+
|
64 |
+
### Release
|
65 |
+
- Fresh codebase
|
LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
kk Star Ratings - WordPress Plugin
|
2 |
|
3 |
-
Copyright (C) 2011-
|
4 |
|
5 |
This program is free software; you can redistribute it and/or
|
6 |
modify it under the terms of the GNU General Public License
|
1 |
kk Star Ratings - WordPress Plugin
|
2 |
|
3 |
+
Copyright (C) 2011-2021 Kamal Khan
|
4 |
|
5 |
This program is free software; you can redistribute it and/or
|
6 |
modify it under the terms of the GNU General Public License
|
freemius.php
CHANGED
@@ -1,5 +1,10 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
|
|
3 |
if ( ! function_exists( 'kksr_freemius' ) ) {
|
4 |
// Create a helper function for easy SDK access.
|
5 |
function kksr_freemius() {
|
@@ -12,16 +17,16 @@ if ( ! function_exists( 'kksr_freemius' ) ) {
|
|
12 |
$kksr_freemius = fs_dynamic_init( array(
|
13 |
'id' => '3890',
|
14 |
'slug' => 'kk-star-ratings',
|
15 |
-
'premium_slug' => '',
|
16 |
'type' => 'plugin',
|
17 |
'public_key' => 'pk_e6d3c068ac8b44274990af9fc9eeb',
|
18 |
'is_premium' => false,
|
|
|
19 |
'has_addons' => false,
|
20 |
-
'has_paid_plans' =>
|
21 |
'menu' => array(
|
22 |
'slug' => 'kk-star-ratings',
|
23 |
-
'support' => false,
|
24 |
),
|
|
|
25 |
) );
|
26 |
}
|
27 |
|
1 |
<?php
|
2 |
|
3 |
+
if (! defined('ABSPATH')) {
|
4 |
+
http_response_code(404);
|
5 |
+
exit();
|
6 |
+
}
|
7 |
+
|
8 |
if ( ! function_exists( 'kksr_freemius' ) ) {
|
9 |
// Create a helper function for easy SDK access.
|
10 |
function kksr_freemius() {
|
17 |
$kksr_freemius = fs_dynamic_init( array(
|
18 |
'id' => '3890',
|
19 |
'slug' => 'kk-star-ratings',
|
|
|
20 |
'type' => 'plugin',
|
21 |
'public_key' => 'pk_e6d3c068ac8b44274990af9fc9eeb',
|
22 |
'is_premium' => false,
|
23 |
+
'has_premium_version' => true,
|
24 |
'has_addons' => false,
|
25 |
+
'has_paid_plans' => true,
|
26 |
'menu' => array(
|
27 |
'slug' => 'kk-star-ratings',
|
|
|
28 |
),
|
29 |
+
|
30 |
) );
|
31 |
}
|
32 |
|
freemius/LICENSE.txt
CHANGED
File without changes
|
freemius/assets/css/admin/common.css
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
.fs-badge{position:absolute;top:10px;right:0;background:#71ae00;color:white;text-transform:uppercase;padding:5px 10px;-moz-border-radius:3px 0 0 3px;-webkit-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;font-weight:bold;border-right:0;-moz-box-shadow:0 2px 1px -1px rgba(0,0,0,0.3);-webkit-box-shadow:0 2px 1px -1px rgba(0,0,0,0.3);box-shadow:0 2px 1px -1px rgba(0,0,0,0.3)}.theme-browser .theme .fs-premium-theme-badge-container{position:absolute;right:0;top:0}.theme-browser .theme .fs-premium-theme-badge-container .fs-badge{position:relative;top:0;margin-top:10px;text-align:center}.theme-browser .theme .fs-premium-theme-badge-container .fs-badge.fs-premium-theme-badge{font-size:1.1em}.theme-browser .theme .fs-premium-theme-badge-container .fs-badge.fs-beta-theme-badge{background:#00a0d2}.fs-switch{position:relative;display:inline-block;color:#ccc;text-shadow:0 1px 1px rgba(255,255,255,0.8);height:18px;padding:6px 6px 5px 6px;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);background:#ececec;box-shadow:0 0 4px rgba(0,0,0,0.1),inset 0 1px 3px 0 rgba(0,0,0,0.1);cursor:pointer}.fs-switch span{display:inline-block;width:35px;text-transform:uppercase}.fs-switch .fs-toggle{position:absolute;top:1px;width:37px;height:25px;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.3);border-radius:4px;background:#fff;background-color:#fff;background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0, #ececec), color-stop(1, #fff));background-image:-webkit-linear-gradient(top, #ececec, #fff);background-image:-moz-linear-gradient(top, #ececec, #fff);background-image:-ms-linear-gradient(top, #ececec, #fff);background-image:-o-linear-gradient(top, #ececec, #fff);background-image:linear-gradient(top, bottom, #ececec, #fff);box-shadow:inset 0 1px 0 0 rgba(255,255,255,0.5);z-index:999;-moz-transition:0.4s cubic-bezier(0.54, 1.6, 0.5, 1);-o-transition:0.4s cubic-bezier(0.54, 1.6, 0.5, 1);-ms-transition:0.4s cubic-bezier(0.54, 1.6, 0.5, 1);-webkit-transition:0.4s cubic-bezier(0.54, 1.6, 0.5, 1);transition:0.4s cubic-bezier(0.54, 1.6, 0.5, 1)}.fs-switch.fs-off .fs-toggle{left:2%}.fs-switch.fs-on .fs-toggle{left:54%}.fs-switch.fs-round{top:8px;padding:4px 25px;-moz-border-radius:24px;-webkit-border-radius:24px;border-radius:24px}.fs-switch.fs-round .fs-toggle{top:0;width:24px;height:24px;-moz-border-radius:24px;-webkit-border-radius:24px;border-radius:24px}.fs-switch.fs-round.fs-off .fs-toggle{left:-1px}.fs-switch.fs-round.fs-on{background:#0085ba}.fs-switch.fs-round.fs-on .fs-toggle{left:25px}.fs-switch.fs-small.fs-round{padding:1px 19px}.fs-switch.fs-small.fs-round .fs-toggle{top:0;width:18px;height:18px;-moz-border-radius:18px;-webkit-border-radius:18px;border-radius:18px}.fs-switch.fs-small.fs-round.fs-on .fs-toggle{left:19px}.fs-switch-feedback{margin-left:10px}.fs-switch-feedback.success{color:#71ae00}.rtl .fs-switch-feedback{margin-left:0;margin-right:10px}#fs_frame{line-height:0;font-size:0}.fs-full-size-wrapper{margin:40px 0 -65px -20px}@media (max-width: 600px){.fs-full-size-wrapper{margin:0 0 -65px -10px}}
|
2 |
-
.fs-notice{position:relative}.fs-notice.fs-has-title{margin-bottom:30px !important}.fs-notice.success{color:green}.fs-notice.promotion{border-color:#00a0d2 !important;background-color:#f2fcff !important}.fs-notice .fs-notice-body{margin:.5em 0;padding:2px}.fs-notice .fs-close{cursor:pointer;color:#aaa;float:right}.fs-notice .fs-close:hover{color:#666}.fs-notice .fs-close>*{margin-top:7px;display:inline-block}.fs-notice label.fs-plugin-title{background:rgba(0,0,0,0.3);color:#fff;padding:2px 10px;position:absolute;top:100%;bottom:auto;right:auto;-moz-border-radius:0 0 3px 3px;-webkit-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;left:10px;font-size:12px;font-weight:bold;cursor:auto}div.fs-notice.updated,div.fs-notice.success,div.fs-notice.promotion{display:block !important}.rtl .fs-notice .fs-close{float:left}.fs-secure-notice{position:fixed;top:32px;left:160px;right:0;background:#ebfdeb;padding:10px 20px;color:green;z-index:9999;-moz-box-shadow:0 2px 2px rgba(6,113,6,0.3);-webkit-box-shadow:0 2px 2px rgba(6,113,6,0.3);box-shadow:0 2px 2px rgba(6,113,6,0.3);opacity:0.95;filter:alpha(opacity=95)}.fs-secure-notice:hover{opacity:1;filter:alpha(opacity=100)}.fs-secure-notice a.fs-security-proof{color:green;text-decoration:none}@media screen and (max-width: 960px){.fs-secure-notice{left:36px}}@media screen and (max-width: 600px){.fs-secure-notice{display:none}}@media screen and (max-width:
|
1 |
.fs-badge{position:absolute;top:10px;right:0;background:#71ae00;color:white;text-transform:uppercase;padding:5px 10px;-moz-border-radius:3px 0 0 3px;-webkit-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;font-weight:bold;border-right:0;-moz-box-shadow:0 2px 1px -1px rgba(0,0,0,0.3);-webkit-box-shadow:0 2px 1px -1px rgba(0,0,0,0.3);box-shadow:0 2px 1px -1px rgba(0,0,0,0.3)}.theme-browser .theme .fs-premium-theme-badge-container{position:absolute;right:0;top:0}.theme-browser .theme .fs-premium-theme-badge-container .fs-badge{position:relative;top:0;margin-top:10px;text-align:center}.theme-browser .theme .fs-premium-theme-badge-container .fs-badge.fs-premium-theme-badge{font-size:1.1em}.theme-browser .theme .fs-premium-theme-badge-container .fs-badge.fs-beta-theme-badge{background:#00a0d2}.fs-switch{position:relative;display:inline-block;color:#ccc;text-shadow:0 1px 1px rgba(255,255,255,0.8);height:18px;padding:6px 6px 5px 6px;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);background:#ececec;box-shadow:0 0 4px rgba(0,0,0,0.1),inset 0 1px 3px 0 rgba(0,0,0,0.1);cursor:pointer}.fs-switch span{display:inline-block;width:35px;text-transform:uppercase}.fs-switch .fs-toggle{position:absolute;top:1px;width:37px;height:25px;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.3);border-radius:4px;background:#fff;background-color:#fff;background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0, #ececec), color-stop(1, #fff));background-image:-webkit-linear-gradient(top, #ececec, #fff);background-image:-moz-linear-gradient(top, #ececec, #fff);background-image:-ms-linear-gradient(top, #ececec, #fff);background-image:-o-linear-gradient(top, #ececec, #fff);background-image:linear-gradient(top, bottom, #ececec, #fff);box-shadow:inset 0 1px 0 0 rgba(255,255,255,0.5);z-index:999;-moz-transition:0.4s cubic-bezier(0.54, 1.6, 0.5, 1);-o-transition:0.4s cubic-bezier(0.54, 1.6, 0.5, 1);-ms-transition:0.4s cubic-bezier(0.54, 1.6, 0.5, 1);-webkit-transition:0.4s cubic-bezier(0.54, 1.6, 0.5, 1);transition:0.4s cubic-bezier(0.54, 1.6, 0.5, 1)}.fs-switch.fs-off .fs-toggle{left:2%}.fs-switch.fs-on .fs-toggle{left:54%}.fs-switch.fs-round{top:8px;padding:4px 25px;-moz-border-radius:24px;-webkit-border-radius:24px;border-radius:24px}.fs-switch.fs-round .fs-toggle{top:0;width:24px;height:24px;-moz-border-radius:24px;-webkit-border-radius:24px;border-radius:24px}.fs-switch.fs-round.fs-off .fs-toggle{left:-1px}.fs-switch.fs-round.fs-on{background:#0085ba}.fs-switch.fs-round.fs-on .fs-toggle{left:25px}.fs-switch.fs-small.fs-round{padding:1px 19px}.fs-switch.fs-small.fs-round .fs-toggle{top:0;width:18px;height:18px;-moz-border-radius:18px;-webkit-border-radius:18px;border-radius:18px}.fs-switch.fs-small.fs-round.fs-on .fs-toggle{left:19px}.fs-switch-feedback{margin-left:10px}.fs-switch-feedback.success{color:#71ae00}.rtl .fs-switch-feedback{margin-left:0;margin-right:10px}#fs_frame{line-height:0;font-size:0}.fs-full-size-wrapper{margin:40px 0 -65px -20px}@media (max-width: 600px){.fs-full-size-wrapper{margin:0 0 -65px -10px}}
|
2 |
+
.fs-notice{position:relative}.fs-notice.fs-has-title{margin-bottom:30px !important}.fs-notice.success{color:green}.fs-notice.promotion{border-color:#00a0d2 !important;background-color:#f2fcff !important}.fs-notice .fs-notice-body{margin:.5em 0;padding:2px}.fs-notice .fs-close{cursor:pointer;color:#aaa;float:right}.fs-notice .fs-close:hover{color:#666}.fs-notice .fs-close>*{margin-top:7px;display:inline-block}.fs-notice label.fs-plugin-title{background:rgba(0,0,0,0.3);color:#fff;padding:2px 10px;position:absolute;top:100%;bottom:auto;right:auto;-moz-border-radius:0 0 3px 3px;-webkit-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;left:10px;font-size:12px;font-weight:bold;cursor:auto}div.fs-notice.updated,div.fs-notice.success,div.fs-notice.promotion{display:block !important}.rtl .fs-notice .fs-close{float:left}.fs-secure-notice{position:fixed;top:32px;left:160px;right:0;background:#ebfdeb;padding:10px 20px;color:green;z-index:9999;-moz-box-shadow:0 2px 2px rgba(6,113,6,0.3);-webkit-box-shadow:0 2px 2px rgba(6,113,6,0.3);box-shadow:0 2px 2px rgba(6,113,6,0.3);opacity:0.95;filter:alpha(opacity=95)}.fs-secure-notice:hover{opacity:1;filter:alpha(opacity=100)}.fs-secure-notice a.fs-security-proof{color:green;text-decoration:none}@media screen and (max-width: 960px){.fs-secure-notice{left:36px}}@media screen and (max-width: 600px){.fs-secure-notice{display:none}}@media screen and (max-width: 1250px){#fs_promo_tab{display:none}}@media screen and (max-width: 782px){.fs-secure-notice{left:0;top:46px;text-align:center}}span.fs-submenu-item.fs-sub:before{content:'\21B3';padding:0 5px}.rtl span.fs-submenu-item.fs-sub:before{content:'\21B2'}.fs-submenu-item.pricing.upgrade-mode{color:greenyellow}.fs-submenu-item.pricing.trial-mode{color:#83e2ff}#adminmenu .update-plugins.fs-trial{background-color:#00b9eb}.fs-ajax-spinner{border:0;width:20px;height:20px;margin-right:5px;vertical-align:sub;display:inline-block;background:url("/wp-admin/images/wpspin_light-2x.gif");background-size:contain;margin-bottom:-2px}.wrap.fs-section h2{text-align:left}.plugins p.fs-upgrade-notice{border:0;background-color:#d54e21;padding:10px;color:#f9f9f9;margin-top:10px}
|
freemius/assets/css/admin/connect.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
#fs_connect{width:480px;-moz-box-shadow:0px 1px 2px rgba(0,0,0,0.3);-webkit-box-shadow:0px 1px 2px rgba(0,0,0,0.3);box-shadow:0px 1px 2px rgba(0,0,0,0.3);margin:20px 0}@media screen and (max-width: 479px){#fs_connect{-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;width:auto;margin:0 0 0 -10px}}#fs_connect .fs-content{background:#fff;padding:15px 20px}#fs_connect .fs-content .fs-error{background:snow;color:#d3135a;border:1px solid #d3135a;-moz-box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);text-align:center;padding:5px;margin-bottom:10px}#fs_connect .fs-content p{margin:0;padding:0;font-size:1.2em}#fs_connect .fs-license-key-container{position:relative;width:280px;margin:10px auto 0 auto}#fs_connect .fs-license-key-container input{width:100%}#fs_connect .fs-license-key-container .dashicons{position:absolute;top:5px;right:5px}#fs_connect.require-license-key .fs-sites-list-container td{cursor:pointer}#fs_connect #delegate_to_site_admins{margin-right:15px;float:right;height:26px;vertical-align:middle;line-height:37px;font-weight:bold;border-bottom:1px dashed;text-decoration:none}#fs_connect #delegate_to_site_admins.rtl{margin-left:15px;margin-right:0}#fs_connect .fs-actions{padding:10px 20px;background:#C0C7CA}#fs_connect .fs-actions .button{padding:0 10px 1px;line-height:35px;height:37px;font-size:16px;margin-bottom:0}#fs_connect .fs-actions .button .dashicons{font-size:37px;margin-left:-8px;margin-right:12px}#fs_connect .fs-actions .button.button-primary{padding-right:15px;padding-left:15px}#fs_connect .fs-actions .button.button-primary:after{content:' \279C'}#fs_connect .fs-actions .button.button-primary.fs-loading:after{content:''}#fs_connect .fs-actions .button.button-secondary{float:right}#fs_connect.fs-anonymous-disabled .fs-actions .button.button-primary{width:100%}#fs_connect .fs-permissions{padding:10px 20px;background:#FEFEFE;-moz-transition:background 0.5s ease;-o-transition:background 0.5s ease;-ms-transition:background 0.5s ease;-webkit-transition:background 0.5s ease;transition:background 0.5s ease}#fs_connect .fs-permissions .fs-license-sync-disclaimer{text-align:center;margin-top:0}#fs_connect .fs-permissions
|
1 |
+
#fs_connect{width:480px;-moz-box-shadow:0px 1px 2px rgba(0,0,0,0.3);-webkit-box-shadow:0px 1px 2px rgba(0,0,0,0.3);box-shadow:0px 1px 2px rgba(0,0,0,0.3);margin:20px 0}@media screen and (max-width: 479px){#fs_connect{-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;width:auto;margin:0 0 0 -10px}}#fs_connect .fs-content{background:#fff;padding:15px 20px}#fs_connect .fs-content .fs-error{background:snow;color:#d3135a;border:1px solid #d3135a;-moz-box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);text-align:center;padding:5px;margin-bottom:10px}#fs_connect .fs-content p{margin:0;padding:0;font-size:1.2em}#fs_connect .fs-license-key-container{position:relative;width:280px;margin:10px auto 0 auto}#fs_connect .fs-license-key-container input{width:100%}#fs_connect .fs-license-key-container .dashicons{position:absolute;top:5px;right:5px}#fs_connect.require-license-key .fs-sites-list-container td{cursor:pointer}#fs_connect #delegate_to_site_admins{margin-right:15px;float:right;height:26px;vertical-align:middle;line-height:37px;font-weight:bold;border-bottom:1px dashed;text-decoration:none}#fs_connect #delegate_to_site_admins.rtl{margin-left:15px;margin-right:0}#fs_connect .fs-actions{padding:10px 20px;background:#C0C7CA}#fs_connect .fs-actions .button{padding:0 10px 1px;line-height:35px;height:37px;font-size:16px;margin-bottom:0}#fs_connect .fs-actions .button .dashicons{font-size:37px;margin-left:-8px;margin-right:12px}#fs_connect .fs-actions .button.button-primary{padding-right:15px;padding-left:15px}#fs_connect .fs-actions .button.button-primary:after{content:' \279C'}#fs_connect .fs-actions .button.button-primary.fs-loading:after{content:''}#fs_connect .fs-actions .button.button-secondary{float:right}#fs_connect.fs-anonymous-disabled .fs-actions .button.button-primary{width:100%}#fs_connect .fs-permissions{padding:10px 20px;background:#FEFEFE;-moz-transition:background 0.5s ease;-o-transition:background 0.5s ease;-ms-transition:background 0.5s ease;-webkit-transition:background 0.5s ease;transition:background 0.5s ease}#fs_connect .fs-permissions .fs-license-sync-disclaimer{text-align:center;margin-top:0}#fs_connect .fs-permissions>.fs-trigger{font-size:0.9em;text-decoration:none;text-align:center;display:block}#fs_connect .fs-permissions ul{height:0;overflow:hidden;margin:0}#fs_connect .fs-permissions ul li{margin-bottom:12px}#fs_connect .fs-permissions ul li:last-child{margin-bottom:0}#fs_connect .fs-permissions ul li>i.dashicons{float:left;font-size:40px;width:40px;height:40px}#fs_connect .fs-permissions ul li .fs-switch{float:right}#fs_connect .fs-permissions ul li .fs-permission-description{margin-left:55px}#fs_connect .fs-permissions ul li .fs-permission-description span{font-weight:bold;text-transform:uppercase;color:#23282d}#fs_connect .fs-permissions ul li .fs-permission-description p{margin:2px 0 0 0}#fs_connect .fs-permissions.fs-open{background:#fff}#fs_connect .fs-permissions.fs-open ul{overflow:initial;height:auto;margin:20px 20px 10px 20px}@media screen and (max-width: 479px){#fs_connect .fs-permissions{background:#fff}#fs_connect .fs-permissions .fs-trigger{display:none}#fs_connect .fs-permissions ul{height:auto;margin:20px}}#fs_connect .fs-freemium-licensing{padding:8px;background:#777;color:#fff}#fs_connect .fs-freemium-licensing p{text-align:center;display:block;margin:0;padding:0}#fs_connect .fs-freemium-licensing a{color:#C2EEFF;text-decoration:underline}#fs_connect .fs-visual{padding:12px;line-height:0;background:#fafafa;height:80px;position:relative}#fs_connect .fs-visual .fs-site-icon{position:absolute;left:20px;top:10px}#fs_connect .fs-visual .fs-connect-logo{position:absolute;right:20px;top:10px}#fs_connect .fs-visual .fs-plugin-icon{position:absolute;top:10px;left:50%;margin-left:-40px}#fs_connect .fs-visual .fs-plugin-icon,#fs_connect .fs-visual .fs-site-icon,#fs_connect .fs-visual img,#fs_connect .fs-visual object{width:80px;height:80px}#fs_connect .fs-visual .dashicons-wordpress{font-size:64px;background:#01749a;color:#fff;width:64px;height:64px;padding:8px}#fs_connect .fs-visual .dashicons-plus{position:absolute;top:50%;font-size:30px;margin-top:-10px;color:#bbb}#fs_connect .fs-visual .dashicons-plus.fs-first{left:28%}#fs_connect .fs-visual .dashicons-plus.fs-second{left:65%}#fs_connect .fs-visual .fs-plugin-icon,#fs_connect .fs-visual .fs-connect-logo,#fs_connect .fs-visual .fs-site-icon{border:1px solid #ccc;padding:1px;background:#fff}#fs_connect .fs-terms{text-align:center;font-size:0.85em;padding:5px;background:rgba(0,0,0,0.05)}#fs_connect .fs-terms,#fs_connect .fs-terms a{color:#999}#fs_connect .fs-terms a{text-decoration:none}.fs-multisite-options-container{margin-top:10px;border:1px solid #ccc;padding:5px}.fs-multisite-options-container a{text-decoration:none}.fs-multisite-options-container a:focus{box-shadow:none}.fs-multisite-options-container a.selected{font-weight:bold}.fs-multisite-options-container.fs-apply-on-all-sites{border:0 none;padding:0}.fs-multisite-options-container.fs-apply-on-all-sites .fs-all-sites-options{border-spacing:0}.fs-multisite-options-container.fs-apply-on-all-sites .fs-all-sites-options td:not(:first-child){display:none}.fs-multisite-options-container .fs-sites-list-container{display:none;overflow:auto}.fs-multisite-options-container .fs-sites-list-container table td{border-top:1px solid #ccc;padding:4px 2px}.fs-tooltip-trigger{position:relative}.fs-tooltip-trigger:not(a){cursor:help}.fs-tooltip-trigger .fs-tooltip{opacity:0;visibility:hidden;-moz-transition:opacity 0.3s ease-in-out;-o-transition:opacity 0.3s ease-in-out;-ms-transition:opacity 0.3s ease-in-out;-webkit-transition:opacity 0.3s ease-in-out;transition:opacity 0.3s ease-in-out;position:absolute;background:rgba(0,0,0,0.8);color:#fff !important;font-family:'arial', serif;font-size:12px;padding:10px;z-index:999999;bottom:100%;margin-bottom:5px;left:-17px;right:0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-moz-box-shadow:1px 1px 1px rgba(0,0,0,0.2);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,0.2);box-shadow:1px 1px 1px rgba(0,0,0,0.2);line-height:1.3em;font-weight:bold;text-align:left;text-transform:none !important}.rtl .fs-tooltip-trigger .fs-tooltip{text-align:right;left:auto;right:-17px}.fs-tooltip-trigger .fs-tooltip::after{content:' ';display:block;width:0;height:0;border-style:solid;border-width:5px 5px 0 5px;border-color:rgba(0,0,0,0.8) transparent transparent transparent;position:absolute;top:100%;left:21px}.rtl .fs-tooltip-trigger .fs-tooltip::after{right:21px;left:auto}.fs-tooltip-trigger:hover .fs-tooltip{visibility:visible;opacity:1}#fs_marketing_optin{display:none;margin-top:10px;border:1px solid #ccc;padding:10px;line-height:1.5em}#fs_marketing_optin .fs-message{display:block;margin-bottom:5px;font-size:1.05em;font-weight:600}#fs_marketing_optin.error{border:1px solid #d3135a;background:#fee}#fs_marketing_optin.error .fs-message{color:#d3135a}#fs_marketing_optin .fs-input-container{margin-top:5px}#fs_marketing_optin .fs-input-container label{margin-top:5px;display:block}#fs_marketing_optin .fs-input-container label input{float:left;margin:1px 0 0 0}#fs_marketing_optin .fs-input-container label:first-child{display:block;margin-bottom:2px}#fs_marketing_optin .fs-input-label{display:block;margin-left:20px}#fs_marketing_optin .fs-input-label .underlined{text-decoration:underline}.rtl #fs_marketing_optin .fs-input-container label input{float:right}.rtl #fs_marketing_optin .fs-input-label{margin-left:0;margin-right:20px}.rtl #fs_connect .fs-actions{padding:10px 20px;background:#C0C7CA}.rtl #fs_connect .fs-actions .button .dashicons{font-size:37px;margin-left:-8px;margin-right:12px}.rtl #fs_connect .fs-actions .button.button-primary:after{content:' \000bb'}.rtl #fs_connect .fs-actions .button.button-primary.fs-loading:after{content:''}.rtl #fs_connect .fs-actions .button.button-secondary{float:left}.rtl #fs_connect .fs-permissions ul li .fs-permission-description{margin-right:55px;margin-left:0}.rtl #fs_connect .fs-permissions ul li .fs-switch{float:left}.rtl #fs_connect .fs-permissions ul li i.dashicons{float:right}.rtl #fs_connect .fs-visual .fs-site-icon{right:20px;left:auto}.rtl #fs_connect .fs-visual .fs-connect-logo{right:auto;left:20px}#fs_theme_connect_wrapper{position:fixed;top:0;height:100%;width:100%;z-index:99990;background:rgba(0,0,0,0.75);text-align:center;overflow-y:auto}#fs_theme_connect_wrapper:before{content:"";display:inline-block;vertical-align:middle;height:100%}#fs_theme_connect_wrapper>button.close{color:white;cursor:pointer;height:40px;width:40px;position:absolute;right:0;border:0;background-color:transparent;top:32px}#fs_theme_connect_wrapper #fs_connect{top:0;text-align:left;display:inline-block;vertical-align:middle;margin-top:52px;margin-bottom:20px}#fs_theme_connect_wrapper #fs_connect .fs-terms{background:rgba(140,140,140,0.64)}#fs_theme_connect_wrapper #fs_connect .fs-terms,#fs_theme_connect_wrapper #fs_connect .fs-terms a{color:#c5c5c5}.wp-pointer-content #fs_connect{margin:0;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none}.fs-opt-in-pointer .wp-pointer-content{padding:0}.fs-opt-in-pointer.wp-pointer-top .wp-pointer-arrow{border-bottom-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-top .wp-pointer-arrow-inner{border-bottom-color:#fafafa}.fs-opt-in-pointer.wp-pointer-bottom .wp-pointer-arrow{border-top-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-bottom .wp-pointer-arrow-inner{border-top-color:#fafafa}.fs-opt-in-pointer.wp-pointer-left .wp-pointer-arrow{border-right-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-left .wp-pointer-arrow-inner{border-right-color:#fafafa}.fs-opt-in-pointer.wp-pointer-right .wp-pointer-arrow{border-left-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-right .wp-pointer-arrow-inner{border-left-color:#fafafa}#license_issues_link{display:block;text-align:center;font-size:0.9em;margin-top:10px}
|
freemius/assets/js/nojquery.ba-postmessage.js
CHANGED
File without changes
|
freemius/assets/js/nojquery.ba-postmessage.min.js
CHANGED
File without changes
|
freemius/assets/js/postmessage.js
CHANGED
File without changes
|
freemius/includes/class-freemius-abstract.php
CHANGED
File without changes
|
freemius/includes/class-freemius.php
CHANGED
@@ -384,6 +384,13 @@
|
|
384 |
* @var boolean|null
|
385 |
*/
|
386 |
private $_use_external_pricing = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
387 |
|
388 |
#endregion
|
389 |
|
@@ -5484,7 +5491,7 @@
|
|
5484 |
function is_extensions_tracking_allowed() {
|
5485 |
return ( true === $this->apply_filters(
|
5486 |
'is_extensions_tracking_allowed',
|
5487 |
-
$this->_storage->get( 'is_extensions_tracking_allowed',
|
5488 |
) );
|
5489 |
}
|
5490 |
|
@@ -5528,10 +5535,12 @@
|
|
5528 |
* @author Leo Fajardo (@leorw)
|
5529 |
* @since 2.3.2
|
5530 |
*
|
5531 |
-
* @param bool $is_enabled
|
5532 |
*/
|
5533 |
-
|
5534 |
-
|
|
|
|
|
5535 |
}
|
5536 |
|
5537 |
/**
|
@@ -6860,8 +6869,6 @@
|
|
6860 |
*/
|
6861 |
function _sync_cron_method( array $blog_ids, $current_blog_id = null ) {
|
6862 |
if ( $this->is_registered() ) {
|
6863 |
-
$this->sync_user_beta_mode();
|
6864 |
-
|
6865 |
if ( $this->has_paid_plan() ) {
|
6866 |
// Initiate background plan sync.
|
6867 |
$this->_sync_license( true, false, $current_blog_id );
|
@@ -7234,7 +7241,8 @@
|
|
7234 |
}
|
7235 |
|
7236 |
if ( $this->is_plugin_new_install() || $this->is_only_premium() ) {
|
7237 |
-
if ( ! $this->_anonymous_mode
|
|
|
7238 |
// Show notice for new plugin installations.
|
7239 |
$this->_admin_notices->add(
|
7240 |
sprintf(
|
@@ -7285,6 +7293,10 @@
|
|
7285 |
* @return bool
|
7286 |
*/
|
7287 |
private function should_add_sticky_optin_notice() {
|
|
|
|
|
|
|
|
|
7288 |
if ( fs_is_network_admin() ) {
|
7289 |
if ( ! $this->_is_network_active ) {
|
7290 |
return false;
|
@@ -13238,26 +13250,25 @@
|
|
13238 |
self::shoot_ajax_failure();
|
13239 |
}
|
13240 |
|
13241 |
-
$
|
13242 |
'',
|
13243 |
'put',
|
13244 |
array(
|
13245 |
-
'plugin_id' => $this->get_id(),
|
13246 |
'is_beta' => ( 'true' == $is_beta ),
|
13247 |
'fields' => 'is_beta'
|
13248 |
)
|
13249 |
);
|
13250 |
|
13251 |
-
if ( ! $this->is_api_result_entity( $
|
13252 |
self::shoot_ajax_failure(
|
13253 |
-
FS_Api::is_api_error_object( $
|
13254 |
-
$
|
13255 |
fs_text_inline( "An unknown error has occurred while trying to set the user's beta mode.", 'unknown-error-occurred', $this->get_slug() )
|
13256 |
);
|
13257 |
}
|
13258 |
|
13259 |
-
$this->
|
13260 |
-
$this->
|
13261 |
|
13262 |
self::shoot_ajax_response( array( 'success' => true ) );
|
13263 |
}
|
@@ -13292,7 +13303,7 @@
|
|
13292 |
fs_request_get( 'blog_id', null ),
|
13293 |
fs_request_get( 'module_id', null, 'post' ),
|
13294 |
fs_request_get( 'user_id', null ),
|
13295 |
-
fs_request_get_bool( 'is_extensions_tracking_allowed',
|
13296 |
);
|
13297 |
|
13298 |
if (
|
@@ -13482,7 +13493,31 @@
|
|
13482 |
* @return string
|
13483 |
*/
|
13484 |
function get_pricing_js_path() {
|
13485 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13486 |
}
|
13487 |
|
13488 |
/**
|
@@ -13527,7 +13562,7 @@
|
|
13527 |
$blog_id = null,
|
13528 |
$plugin_id = null,
|
13529 |
$license_owner_id = null,
|
13530 |
-
$is_extensions_tracking_allowed =
|
13531 |
) {
|
13532 |
$this->_logger->entrance();
|
13533 |
|
@@ -16448,19 +16483,6 @@
|
|
16448 |
);
|
16449 |
}
|
16450 |
|
16451 |
-
/**
|
16452 |
-
* @author Leo Fajardo (@leorw)
|
16453 |
-
* @since 2.3.0
|
16454 |
-
*/
|
16455 |
-
private function sync_user_beta_mode() {
|
16456 |
-
$user = $this->get_api_user_scope()->get( '/?plugin_id=' . $this->get_id() . '&fields=is_beta' );
|
16457 |
-
|
16458 |
-
if ( $this->is_api_result_entity( $user ) ) {
|
16459 |
-
$this->_user->is_beta = $user->is_beta;
|
16460 |
-
$this->_store_user();
|
16461 |
-
}
|
16462 |
-
}
|
16463 |
-
|
16464 |
/**
|
16465 |
* @author Vova Feldman (@svovaf)
|
16466 |
* @since 1.1.7.4
|
@@ -17148,9 +17170,7 @@
|
|
17148 |
$this->disable_opt_in_notice_and_lock_user();
|
17149 |
}
|
17150 |
|
17151 |
-
|
17152 |
-
$this->update_extensions_tracking_flag( $is_extensions_tracking_allowed );
|
17153 |
-
}
|
17154 |
|
17155 |
return $this->setup_account(
|
17156 |
$this->_user,
|
@@ -17195,9 +17215,7 @@
|
|
17195 |
$this->disable_opt_in_notice_and_lock_user();
|
17196 |
}
|
17197 |
|
17198 |
-
|
17199 |
-
$this->update_extensions_tracking_flag( $is_extensions_tracking_allowed );
|
17200 |
-
}
|
17201 |
|
17202 |
$sites = array();
|
17203 |
foreach ( $site_ids as $site_id ) {
|
@@ -17240,9 +17258,7 @@
|
|
17240 |
$this->disable_opt_in_notice_and_lock_user();
|
17241 |
}
|
17242 |
|
17243 |
-
|
17244 |
-
$this->update_extensions_tracking_flag( $is_extensions_tracking_allowed );
|
17245 |
-
}
|
17246 |
|
17247 |
$install_ids = array();
|
17248 |
|
@@ -17353,7 +17369,7 @@
|
|
17353 |
*/
|
17354 |
$license_key = fs_request_get( 'license_secret_key' );
|
17355 |
|
17356 |
-
$this->update_extensions_tracking_flag( fs_request_get_bool( 'is_extensions_tracking_allowed',
|
17357 |
|
17358 |
$this->install_with_current_user( $license_key );
|
17359 |
}
|
@@ -20605,6 +20621,20 @@
|
|
20605 |
}
|
20606 |
}
|
20607 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20608 |
if ( $this->is_addon() || $this->has_addons() ) {
|
20609 |
/**
|
20610 |
* Purge the valid user licenses cache so that when the "Account" or the "Add-Ons" page is loaded,
|
@@ -21298,7 +21328,7 @@
|
|
21298 |
|
21299 |
if ( $this->has_secret_key() ) {
|
21300 |
$endpoint = add_query_arg( 'type', 'all', $endpoint );
|
21301 |
-
} else if ( $this->
|
21302 |
$endpoint = add_query_arg( 'type', 'beta', $endpoint );
|
21303 |
}
|
21304 |
|
@@ -23396,6 +23426,14 @@
|
|
23396 |
return;
|
23397 |
}
|
23398 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23399 |
if ( fs_is_network_admin() ) {
|
23400 |
if ( ! $this->_is_network_active ) {
|
23401 |
// Don't add tracking links when browsing the network WP Admin and the plugin is not network active.
|
384 |
* @var boolean|null
|
385 |
*/
|
386 |
private $_use_external_pricing = null;
|
387 |
+
/**
|
388 |
+
* @author Leo Fajardo (@leorw)
|
389 |
+
* @since 2.4.2
|
390 |
+
*
|
391 |
+
* @var string|null
|
392 |
+
*/
|
393 |
+
private $_pricing_js_path = null;
|
394 |
|
395 |
#endregion
|
396 |
|
5491 |
function is_extensions_tracking_allowed() {
|
5492 |
return ( true === $this->apply_filters(
|
5493 |
'is_extensions_tracking_allowed',
|
5494 |
+
$this->_storage->get( 'is_extensions_tracking_allowed', null )
|
5495 |
) );
|
5496 |
}
|
5497 |
|
5535 |
* @author Leo Fajardo (@leorw)
|
5536 |
* @since 2.3.2
|
5537 |
*
|
5538 |
+
* @param bool|null $is_enabled
|
5539 |
*/
|
5540 |
+
function update_extensions_tracking_flag( $is_enabled ) {
|
5541 |
+
if ( is_bool( $is_enabled ) ) {
|
5542 |
+
$this->_storage->store( 'is_extensions_tracking_allowed', $is_enabled );
|
5543 |
+
}
|
5544 |
}
|
5545 |
|
5546 |
/**
|
6869 |
*/
|
6870 |
function _sync_cron_method( array $blog_ids, $current_blog_id = null ) {
|
6871 |
if ( $this->is_registered() ) {
|
|
|
|
|
6872 |
if ( $this->has_paid_plan() ) {
|
6873 |
// Initiate background plan sync.
|
6874 |
$this->_sync_license( true, false, $current_blog_id );
|
7241 |
}
|
7242 |
|
7243 |
if ( $this->is_plugin_new_install() || $this->is_only_premium() ) {
|
7244 |
+
if ( ! $this->_anonymous_mode &&
|
7245 |
+
( ! $this->is_addon() || ! $this->_parent->is_anonymous() ) ) {
|
7246 |
// Show notice for new plugin installations.
|
7247 |
$this->_admin_notices->add(
|
7248 |
sprintf(
|
7293 |
* @return bool
|
7294 |
*/
|
7295 |
private function should_add_sticky_optin_notice() {
|
7296 |
+
if ( $this->is_addon() && $this->_parent->is_anonymous() ) {
|
7297 |
+
return false;
|
7298 |
+
}
|
7299 |
+
|
7300 |
if ( fs_is_network_admin() ) {
|
7301 |
if ( ! $this->_is_network_active ) {
|
7302 |
return false;
|
13250 |
self::shoot_ajax_failure();
|
13251 |
}
|
13252 |
|
13253 |
+
$site = $this->get_api_site_scope()->call(
|
13254 |
'',
|
13255 |
'put',
|
13256 |
array(
|
|
|
13257 |
'is_beta' => ( 'true' == $is_beta ),
|
13258 |
'fields' => 'is_beta'
|
13259 |
)
|
13260 |
);
|
13261 |
|
13262 |
+
if ( ! $this->is_api_result_entity( $site ) ) {
|
13263 |
self::shoot_ajax_failure(
|
13264 |
+
FS_Api::is_api_error_object( $site ) ?
|
13265 |
+
$site->error->message :
|
13266 |
fs_text_inline( "An unknown error has occurred while trying to set the user's beta mode.", 'unknown-error-occurred', $this->get_slug() )
|
13267 |
);
|
13268 |
}
|
13269 |
|
13270 |
+
$this->_site->is_beta = $site->is_beta;
|
13271 |
+
$this->_store_site();
|
13272 |
|
13273 |
self::shoot_ajax_response( array( 'success' => true ) );
|
13274 |
}
|
13303 |
fs_request_get( 'blog_id', null ),
|
13304 |
fs_request_get( 'module_id', null, 'post' ),
|
13305 |
fs_request_get( 'user_id', null ),
|
13306 |
+
fs_request_get_bool( 'is_extensions_tracking_allowed', null )
|
13307 |
);
|
13308 |
|
13309 |
if (
|
13493 |
* @return string
|
13494 |
*/
|
13495 |
function get_pricing_js_path() {
|
13496 |
+
if ( ! isset( $this->_pricing_js_path ) ) {
|
13497 |
+
$pricing_js_path = $this->apply_filters( 'freemius_pricing_js_path', '' );
|
13498 |
+
|
13499 |
+
if ( empty( $pricing_js_path ) ) {
|
13500 |
+
global $fs_active_plugins;
|
13501 |
+
|
13502 |
+
foreach ( $fs_active_plugins->plugins as $sdk_path => $data ) {
|
13503 |
+
if ( $data->plugin_path == $this->get_plugin_basename() ) {
|
13504 |
+
$plugin_or_theme_root_dir = ( $this->is_plugin() ? WP_PLUGIN_DIR : get_theme_root( get_stylesheet() ) );
|
13505 |
+
|
13506 |
+
$pricing_js_path = $plugin_or_theme_root_dir
|
13507 |
+
. '/'
|
13508 |
+
// The basename will be `plugins`, `themes`, or the basename of a custom plugins or themes directory.
|
13509 |
+
. str_replace( '../' . basename( $plugin_or_theme_root_dir ) . '/', '', $sdk_path )
|
13510 |
+
. '/includes/freemius-pricing/freemius-pricing.js';
|
13511 |
+
|
13512 |
+
break;
|
13513 |
+
}
|
13514 |
+
}
|
13515 |
+
}
|
13516 |
+
|
13517 |
+
$this->_pricing_js_path = $pricing_js_path;
|
13518 |
+
}
|
13519 |
+
|
13520 |
+
return $this->_pricing_js_path;
|
13521 |
}
|
13522 |
|
13523 |
/**
|
13562 |
$blog_id = null,
|
13563 |
$plugin_id = null,
|
13564 |
$license_owner_id = null,
|
13565 |
+
$is_extensions_tracking_allowed = null
|
13566 |
) {
|
13567 |
$this->_logger->entrance();
|
13568 |
|
16483 |
);
|
16484 |
}
|
16485 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16486 |
/**
|
16487 |
* @author Vova Feldman (@svovaf)
|
16488 |
* @since 1.1.7.4
|
17170 |
$this->disable_opt_in_notice_and_lock_user();
|
17171 |
}
|
17172 |
|
17173 |
+
$this->update_extensions_tracking_flag( $is_extensions_tracking_allowed );
|
|
|
|
|
17174 |
|
17175 |
return $this->setup_account(
|
17176 |
$this->_user,
|
17215 |
$this->disable_opt_in_notice_and_lock_user();
|
17216 |
}
|
17217 |
|
17218 |
+
$this->update_extensions_tracking_flag( $is_extensions_tracking_allowed );
|
|
|
|
|
17219 |
|
17220 |
$sites = array();
|
17221 |
foreach ( $site_ids as $site_id ) {
|
17258 |
$this->disable_opt_in_notice_and_lock_user();
|
17259 |
}
|
17260 |
|
17261 |
+
$this->update_extensions_tracking_flag( $is_extensions_tracking_allowed );
|
|
|
|
|
17262 |
|
17263 |
$install_ids = array();
|
17264 |
|
17369 |
*/
|
17370 |
$license_key = fs_request_get( 'license_secret_key' );
|
17371 |
|
17372 |
+
$this->update_extensions_tracking_flag( fs_request_get_bool( 'is_extensions_tracking_allowed', null ) );
|
17373 |
|
17374 |
$this->install_with_current_user( $license_key );
|
17375 |
}
|
20621 |
}
|
20622 |
}
|
20623 |
|
20624 |
+
if ( ! $this->is_addon() &&
|
20625 |
+
$this->_site->is_beta() !== $site->is_beta
|
20626 |
+
) {
|
20627 |
+
// Beta flag updated.
|
20628 |
+
$this->_site = $site;
|
20629 |
+
|
20630 |
+
$this->_store_site(
|
20631 |
+
true,
|
20632 |
+
$is_site_level_sync ?
|
20633 |
+
null :
|
20634 |
+
$this->get_network_install_blog_id()
|
20635 |
+
);
|
20636 |
+
}
|
20637 |
+
|
20638 |
if ( $this->is_addon() || $this->has_addons() ) {
|
20639 |
/**
|
20640 |
* Purge the valid user licenses cache so that when the "Account" or the "Add-Ons" page is loaded,
|
21328 |
|
21329 |
if ( $this->has_secret_key() ) {
|
21330 |
$endpoint = add_query_arg( 'type', 'all', $endpoint );
|
21331 |
+
} else if ( is_object( $this->_site ) && $this->_site->is_beta() ) {
|
21332 |
$endpoint = add_query_arg( 'type', 'beta', $endpoint );
|
21333 |
}
|
21334 |
|
23426 |
return;
|
23427 |
}
|
23428 |
|
23429 |
+
if (
|
23430 |
+
$this->is_addon() &&
|
23431 |
+
! $this->is_only_premium() &&
|
23432 |
+
$this->_parent->is_anonymous()
|
23433 |
+
) {
|
23434 |
+
return;
|
23435 |
+
}
|
23436 |
+
|
23437 |
if ( fs_is_network_admin() ) {
|
23438 |
if ( ! $this->_is_network_active ) {
|
23439 |
// Don't add tracking links when browsing the network WP Admin and the plugin is not network active.
|
freemius/includes/class-fs-api.php
CHANGED
File without changes
|
freemius/includes/class-fs-logger.php
CHANGED
@@ -142,7 +142,7 @@
|
|
142 |
return $this->_file_start;
|
143 |
}
|
144 |
|
145 |
-
private function _log( &$message, $type
|
146 |
if ( ! $this->is_on() ) {
|
147 |
return;
|
148 |
}
|
142 |
return $this->_file_start;
|
143 |
}
|
144 |
|
145 |
+
private function _log( &$message, $type, $wrapper = false ) {
|
146 |
if ( ! $this->is_on() ) {
|
147 |
return;
|
148 |
}
|
freemius/includes/class-fs-plugin-updater.php
CHANGED
File without changes
|
freemius/includes/class-fs-security.php
CHANGED
File without changes
|
freemius/includes/entities/class-fs-entity.php
CHANGED
File without changes
|
freemius/includes/entities/class-fs-payment.php
CHANGED
File without changes
|
freemius/includes/entities/class-fs-plugin-info.php
CHANGED
File without changes
|
freemius/includes/entities/class-fs-plugin-license.php
CHANGED
File without changes
|
freemius/includes/entities/class-fs-plugin-plan.php
CHANGED
File without changes
|
freemius/includes/entities/class-fs-plugin-tag.php
CHANGED
File without changes
|
freemius/includes/entities/class-fs-plugin.php
CHANGED
File without changes
|
freemius/includes/entities/class-fs-pricing.php
CHANGED
File without changes
|
freemius/includes/entities/class-fs-scope-entity.php
CHANGED
File without changes
|
freemius/includes/entities/class-fs-site.php
CHANGED
@@ -102,6 +102,14 @@
|
|
102 |
* @var bool
|
103 |
*/
|
104 |
public $is_uninstalled = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
/**
|
107 |
* @param stdClass|bool $site
|
@@ -233,4 +241,13 @@
|
|
233 |
function is_tracking_prohibited() {
|
234 |
return ! $this->is_tracking_allowed();
|
235 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
}
|
102 |
* @var bool
|
103 |
*/
|
104 |
public $is_uninstalled = false;
|
105 |
+
/**
|
106 |
+
* @author Edgar Melkonyan
|
107 |
+
*
|
108 |
+
* @since 2.4.2
|
109 |
+
*
|
110 |
+
* @var bool
|
111 |
+
*/
|
112 |
+
public $is_beta;
|
113 |
|
114 |
/**
|
115 |
* @param stdClass|bool $site
|
241 |
function is_tracking_prohibited() {
|
242 |
return ! $this->is_tracking_allowed();
|
243 |
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* @author Edgar Melkonyan
|
247 |
+
*
|
248 |
+
* @return bool
|
249 |
+
*/
|
250 |
+
function is_beta() {
|
251 |
+
return ( isset( $this->is_beta ) && true === $this->is_beta );
|
252 |
+
}
|
253 |
}
|
freemius/includes/entities/class-fs-subscription.php
CHANGED
File without changes
|
freemius/includes/entities/class-fs-user.php
CHANGED
@@ -31,13 +31,6 @@
|
|
31 |
*/
|
32 |
public $is_verified;
|
33 |
/**
|
34 |
-
* @author Leo Fajardo (@leorw)
|
35 |
-
* @since 2.3.0
|
36 |
-
*
|
37 |
-
* @var bool
|
38 |
-
*/
|
39 |
-
public $is_beta;
|
40 |
-
/**
|
41 |
* @var string|null
|
42 |
*/
|
43 |
public $customer_id;
|
@@ -63,16 +56,6 @@
|
|
63 |
return ( isset( $this->is_verified ) && true === $this->is_verified );
|
64 |
}
|
65 |
|
66 |
-
/**
|
67 |
-
* @author Leo Fajardo (@leorw)
|
68 |
-
* @since 2.3.0
|
69 |
-
*
|
70 |
-
* @return bool
|
71 |
-
*/
|
72 |
-
function is_beta() {
|
73 |
-
return ( isset( $this->is_beta ) && true === $this->is_beta );
|
74 |
-
}
|
75 |
-
|
76 |
static function get_type() {
|
77 |
return 'user';
|
78 |
}
|
31 |
*/
|
32 |
public $is_verified;
|
33 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
* @var string|null
|
35 |
*/
|
36 |
public $customer_id;
|
56 |
return ( isset( $this->is_verified ) && true === $this->is_verified );
|
57 |
}
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
static function get_type() {
|
60 |
return 'user';
|
61 |
}
|
freemius/includes/fs-core-functions.php
CHANGED
File without changes
|
freemius/includes/fs-plugin-info-dialog.php
CHANGED
File without changes
|
freemius/includes/i18n.php
CHANGED
File without changes
|
freemius/includes/managers/class-fs-cache-manager.php
CHANGED
File without changes
|
freemius/includes/managers/class-fs-key-value-storage.php
CHANGED
File without changes
|
freemius/includes/managers/class-fs-license-manager.php
CHANGED
File without changes
|
freemius/includes/managers/class-fs-option-manager.php
CHANGED
File without changes
|
freemius/includes/managers/class-fs-plan-manager.php
CHANGED
File without changes
|
freemius/includes/managers/class-fs-plugin-manager.php
CHANGED
File without changes
|
freemius/includes/sdk/Exceptions/ArgumentNotExistException.php
CHANGED
File without changes
|
freemius/includes/sdk/Exceptions/EmptyArgumentException.php
CHANGED
File without changes
|
freemius/includes/sdk/Exceptions/Exception.php
CHANGED
File without changes
|
freemius/includes/sdk/Exceptions/InvalidArgumentException.php
CHANGED
File without changes
|
freemius/includes/sdk/Exceptions/OAuthException.php
CHANGED
File without changes
|
freemius/includes/sdk/FreemiusBase.php
CHANGED
File without changes
|
freemius/includes/sdk/FreemiusWordPress.php
CHANGED
File without changes
|
freemius/includes/sdk/LICENSE.txt
CHANGED
File without changes
|
freemius/languages/freemius-cs_CZ.mo
CHANGED
Binary file
|
freemius/languages/freemius-da_DK.mo
CHANGED
Binary file
|
freemius/languages/freemius-en.mo
CHANGED
Binary file
|
freemius/languages/freemius-es_ES.mo
CHANGED
Binary file
|
freemius/languages/freemius-fr_FR.mo
CHANGED
Binary file
|
freemius/languages/freemius-he_IL.mo
CHANGED
Binary file
|
freemius/languages/freemius-hu_HU.mo
CHANGED
Binary file
|
freemius/languages/freemius-it_IT.mo
CHANGED
Binary file
|
freemius/languages/freemius-ja.mo
CHANGED
Binary file
|
freemius/languages/freemius-nl_NL.mo
CHANGED
Binary file
|
freemius/languages/freemius-ru_RU.mo
CHANGED
Binary file
|
freemius/languages/freemius-ta.mo
CHANGED
Binary file
|
freemius/languages/freemius-zh_CN.mo
CHANGED
Binary file
|
freemius/languages/freemius.pot
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
# Copyright (C)
|
2 |
# This file is distributed under the same license as the freemius package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
@@ -16,795 +16,795 @@ msgstr ""
|
|
16 |
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
18 |
|
19 |
-
#: includes/class-freemius.php:
|
20 |
msgid "An update to a Beta version will replace your installed version of %s with the latest Beta release - use with caution, and not on production sites. You have been warned."
|
21 |
msgstr ""
|
22 |
|
23 |
-
#: includes/class-freemius.php:
|
24 |
msgid "Would you like to proceed with the update?"
|
25 |
msgstr ""
|
26 |
|
27 |
-
#: includes/class-freemius.php:
|
28 |
msgid "Freemius SDK couldn't find the plugin's main file. Please contact sdk@freemius.com with the current error."
|
29 |
msgstr ""
|
30 |
|
31 |
-
#: includes/class-freemius.php:
|
32 |
msgid "Error"
|
33 |
msgstr ""
|
34 |
|
35 |
-
#: includes/class-freemius.php:
|
36 |
msgid "I found a better %s"
|
37 |
msgstr ""
|
38 |
|
39 |
-
#: includes/class-freemius.php:
|
40 |
msgid "What's the %s's name?"
|
41 |
msgstr ""
|
42 |
|
43 |
-
#: includes/class-freemius.php:
|
44 |
msgid "It's a temporary %s. I'm just debugging an issue."
|
45 |
msgstr ""
|
46 |
|
47 |
-
#: includes/class-freemius.php:
|
48 |
msgid "Deactivation"
|
49 |
msgstr ""
|
50 |
|
51 |
-
#: includes/class-freemius.php:
|
52 |
msgid "Theme Switch"
|
53 |
msgstr ""
|
54 |
|
55 |
-
#: includes/class-freemius.php:
|
56 |
msgid "Other"
|
57 |
msgstr ""
|
58 |
|
59 |
-
#: includes/class-freemius.php:
|
60 |
msgid "I no longer need the %s"
|
61 |
msgstr ""
|
62 |
|
63 |
-
#: includes/class-freemius.php:
|
64 |
msgid "I only needed the %s for a short period"
|
65 |
msgstr ""
|
66 |
|
67 |
-
#: includes/class-freemius.php:
|
68 |
msgid "The %s broke my site"
|
69 |
msgstr ""
|
70 |
|
71 |
-
#: includes/class-freemius.php:
|
72 |
msgid "The %s suddenly stopped working"
|
73 |
msgstr ""
|
74 |
|
75 |
-
#: includes/class-freemius.php:
|
76 |
msgid "I can't pay for it anymore"
|
77 |
msgstr ""
|
78 |
|
79 |
-
#: includes/class-freemius.php:
|
80 |
msgid "What price would you feel comfortable paying?"
|
81 |
msgstr ""
|
82 |
|
83 |
-
#: includes/class-freemius.php:
|
84 |
msgid "I don't like to share my information with you"
|
85 |
msgstr ""
|
86 |
|
87 |
-
#: includes/class-freemius.php:
|
88 |
msgid "The %s didn't work"
|
89 |
msgstr ""
|
90 |
|
91 |
-
#: includes/class-freemius.php:
|
92 |
msgid "I couldn't understand how to make it work"
|
93 |
msgstr ""
|
94 |
|
95 |
-
#: includes/class-freemius.php:
|
96 |
msgid "The %s is great, but I need specific feature that you don't support"
|
97 |
msgstr ""
|
98 |
|
99 |
-
#: includes/class-freemius.php:
|
100 |
msgid "What feature?"
|
101 |
msgstr ""
|
102 |
|
103 |
-
#: includes/class-freemius.php:
|
104 |
msgid "The %s is not working"
|
105 |
msgstr ""
|
106 |
|
107 |
-
#: includes/class-freemius.php:
|
108 |
msgid "Kindly share what didn't work so we can fix it for future users..."
|
109 |
msgstr ""
|
110 |
|
111 |
-
#: includes/class-freemius.php:
|
112 |
msgid "It's not what I was looking for"
|
113 |
msgstr ""
|
114 |
|
115 |
-
#: includes/class-freemius.php:
|
116 |
msgid "What you've been looking for?"
|
117 |
msgstr ""
|
118 |
|
119 |
-
#: includes/class-freemius.php:
|
120 |
msgid "The %s didn't work as expected"
|
121 |
msgstr ""
|
122 |
|
123 |
-
#: includes/class-freemius.php:
|
124 |
msgid "What did you expect?"
|
125 |
msgstr ""
|
126 |
|
127 |
-
#: includes/class-freemius.php:
|
128 |
msgid "Freemius Debug"
|
129 |
msgstr ""
|
130 |
|
131 |
-
#: includes/class-freemius.php:
|
132 |
msgid "I don't know what is cURL or how to install it, help me!"
|
133 |
msgstr ""
|
134 |
|
135 |
-
#: includes/class-freemius.php:
|
136 |
msgid "We'll make sure to contact your hosting company and resolve the issue. You will get a follow-up email to %s once we have an update."
|
137 |
msgstr ""
|
138 |
|
139 |
-
#: includes/class-freemius.php:
|
140 |
msgid "Great, please install cURL and enable it in your php.ini file. In addition, search for the 'disable_functions' directive in your php.ini file and remove any disabled methods starting with 'curl_'. To make sure it was successfully activated, use 'phpinfo()'. Once activated, deactivate the %s and reactivate it back again."
|
141 |
msgstr ""
|
142 |
|
143 |
-
#: includes/class-freemius.php:
|
144 |
msgid "Yes - do your thing"
|
145 |
msgstr ""
|
146 |
|
147 |
-
#: includes/class-freemius.php:
|
148 |
msgid "No - just deactivate"
|
149 |
msgstr ""
|
150 |
|
151 |
-
#: includes/class-freemius.php:
|
152 |
msgctxt "exclamation"
|
153 |
msgid "Oops"
|
154 |
msgstr ""
|
155 |
|
156 |
-
#: includes/class-freemius.php:
|
157 |
msgid "Thank for giving us the chance to fix it! A message was just sent to our technical staff. We will get back to you as soon as we have an update to %s. Appreciate your patience."
|
158 |
msgstr ""
|
159 |
|
160 |
-
#: includes/class-freemius.php:
|
161 |
msgctxt "addonX cannot run without pluginY"
|
162 |
msgid "%s cannot run without %s."
|
163 |
msgstr ""
|
164 |
|
165 |
-
#: includes/class-freemius.php:
|
166 |
msgctxt "addonX cannot run..."
|
167 |
msgid "%s cannot run without the plugin."
|
168 |
msgstr ""
|
169 |
|
170 |
-
#: includes/class-freemius.php:
|
171 |
msgid "Unexpected API error. Please contact the %s's author with the following error."
|
172 |
msgstr ""
|
173 |
|
174 |
-
#: includes/class-freemius.php:
|
175 |
msgid "Premium %s version was successfully activated."
|
176 |
msgstr ""
|
177 |
|
178 |
-
#: includes/class-freemius.php:
|
179 |
msgctxt "Used to express elation, enthusiasm, or triumph (especially in electronic communication)."
|
180 |
msgid "W00t"
|
181 |
msgstr ""
|
182 |
|
183 |
-
#: includes/class-freemius.php:
|
184 |
msgid "You have a %s license."
|
185 |
msgstr ""
|
186 |
|
187 |
-
#: includes/class-freemius.php:
|
188 |
msgctxt "interjection expressing joy or exuberance"
|
189 |
msgid "Yee-haw"
|
190 |
msgstr ""
|
191 |
|
192 |
-
#: includes/class-freemius.php:
|
193 |
msgid "%s free trial was successfully cancelled. Since the add-on is premium only it was automatically deactivated. If you like to use it in the future, you'll have to purchase a license."
|
194 |
msgstr ""
|
195 |
|
196 |
-
#: includes/class-freemius.php:
|
197 |
msgid "%s is a premium only add-on. You have to purchase a license first before activating the plugin."
|
198 |
msgstr ""
|
199 |
|
200 |
-
#: includes/class-freemius.php:
|
201 |
msgid "More information about %s"
|
202 |
msgstr ""
|
203 |
|
204 |
-
#: includes/class-freemius.php:
|
205 |
msgid "Purchase License"
|
206 |
msgstr ""
|
207 |
|
208 |
-
#: includes/class-freemius.php:
|
209 |
msgid "You should receive an activation email for %s to your mailbox at %s. Please make sure you click the activation button in that email to %s."
|
210 |
msgstr ""
|
211 |
|
212 |
-
#: includes/class-freemius.php:
|
213 |
msgid "start the trial"
|
214 |
msgstr ""
|
215 |
|
216 |
-
#: includes/class-freemius.php:
|
217 |
msgid "complete the install"
|
218 |
msgstr ""
|
219 |
|
220 |
-
#: includes/class-freemius.php:
|
221 |
msgid "You are just one step away - %s"
|
222 |
msgstr ""
|
223 |
|
224 |
-
#: includes/class-freemius.php:
|
225 |
msgctxt "%s - plugin name. As complete \"PluginX\" activation now"
|
226 |
msgid "Complete \"%s\" Activation Now"
|
227 |
msgstr ""
|
228 |
|
229 |
-
#: includes/class-freemius.php:
|
230 |
msgid "We made a few tweaks to the %s, %s"
|
231 |
msgstr ""
|
232 |
|
233 |
-
#: includes/class-freemius.php:
|
234 |
msgid "Opt in to make \"%s\" better!"
|
235 |
msgstr ""
|
236 |
|
237 |
-
#: includes/class-freemius.php:
|
238 |
msgid "The upgrade of %s was successfully completed."
|
239 |
msgstr ""
|
240 |
|
241 |
-
#: includes/class-freemius.php:
|
242 |
msgid "Add-On"
|
243 |
msgstr ""
|
244 |
|
245 |
-
#: includes/class-freemius.php:
|
246 |
msgid "Plugin"
|
247 |
msgstr ""
|
248 |
|
249 |
-
#: includes/class-freemius.php:
|
250 |
msgid "Theme"
|
251 |
msgstr ""
|
252 |
|
253 |
-
#: includes/class-freemius.php:
|
254 |
msgid "An unknown error has occurred while trying to toggle the license's white-label mode."
|
255 |
msgstr ""
|
256 |
|
257 |
-
#: includes/class-freemius.php:
|
258 |
msgid "Your %s license was flagged as white-labeled to hide sensitive information from the WP Admin (e.g. your email, license key, prices, billing address & invoices). If you ever wish to revert it back, you can easily do it through your %s. If this was a mistake you can also %s."
|
259 |
msgstr ""
|
260 |
|
261 |
-
#: includes/class-freemius.php:
|
262 |
msgid "User Dashboard"
|
263 |
msgstr ""
|
264 |
|
265 |
-
#: includes/class-freemius.php:
|
266 |
msgid "revert it now"
|
267 |
msgstr ""
|
268 |
|
269 |
-
#: includes/class-freemius.php:
|
270 |
msgid "An unknown error has occurred while trying to set the user's beta mode."
|
271 |
msgstr ""
|
272 |
|
273 |
-
#: includes/class-freemius.php:
|
274 |
msgid "Invalid new user ID or email address."
|
275 |
msgstr ""
|
276 |
|
277 |
-
#: includes/class-freemius.php:
|
278 |
msgid "Sorry, we could not complete the email update. Another user with the same email is already registered."
|
279 |
msgstr ""
|
280 |
|
281 |
-
#: includes/class-freemius.php:
|
282 |
msgid "If you would like to give up the ownership of the %s's account to %s click the Change Ownership button."
|
283 |
msgstr ""
|
284 |
|
285 |
-
#: includes/class-freemius.php:
|
286 |
msgid "Change Ownership"
|
287 |
msgstr ""
|
288 |
|
289 |
-
#: includes/class-freemius.php:
|
290 |
msgid "Invalid site details collection."
|
291 |
msgstr ""
|
292 |
|
293 |
-
#: includes/class-freemius.php:
|
294 |
msgid "We couldn't find your email address in the system, are you sure it's the right address?"
|
295 |
msgstr ""
|
296 |
|
297 |
-
#: includes/class-freemius.php:
|
298 |
msgid "We can't see any active licenses associated with that email address, are you sure it's the right address?"
|
299 |
msgstr ""
|
300 |
|
301 |
-
#: includes/class-freemius.php:
|
302 |
msgid "Account is pending activation."
|
303 |
msgstr ""
|
304 |
|
305 |
-
#: includes/class-freemius.php:
|
306 |
msgid "Buy a license now"
|
307 |
msgstr ""
|
308 |
|
309 |
-
#: includes/class-freemius.php:
|
310 |
msgid "Renew your license now"
|
311 |
msgstr ""
|
312 |
|
313 |
-
#: includes/class-freemius.php:
|
314 |
msgid "%s to access version %s security & feature updates, and support."
|
315 |
msgstr ""
|
316 |
|
317 |
-
#: includes/class-freemius.php:
|
318 |
msgid "%s activation was successfully completed."
|
319 |
msgstr ""
|
320 |
|
321 |
-
#: includes/class-freemius.php:
|
322 |
msgid "Your account was successfully activated with the %s plan."
|
323 |
msgstr ""
|
324 |
|
325 |
-
#: includes/class-freemius.php:
|
326 |
msgid "Your trial has been successfully started."
|
327 |
msgstr ""
|
328 |
|
329 |
-
#: includes/class-freemius.php:
|
330 |
msgid "Couldn't activate %s."
|
331 |
msgstr ""
|
332 |
|
333 |
-
#: includes/class-freemius.php:
|
334 |
msgid "Please contact us with the following message:"
|
335 |
msgstr ""
|
336 |
|
337 |
-
#: includes/class-freemius.php:
|
338 |
msgid "An unknown error has occurred."
|
339 |
msgstr ""
|
340 |
|
341 |
-
#: includes/class-freemius.php:
|
342 |
msgid "Upgrade"
|
343 |
msgstr ""
|
344 |
|
345 |
-
#: includes/class-freemius.php:
|
346 |
msgid "Start Trial"
|
347 |
msgstr ""
|
348 |
|
349 |
-
#: includes/class-freemius.php:
|
350 |
msgid "Pricing"
|
351 |
msgstr ""
|
352 |
|
353 |
-
#: includes/class-freemius.php:
|
354 |
msgid "Affiliation"
|
355 |
msgstr ""
|
356 |
|
357 |
-
#: includes/class-freemius.php:
|
358 |
msgid "Account"
|
359 |
msgstr ""
|
360 |
|
361 |
-
#: includes/class-freemius.php:
|
362 |
msgid "Contact Us"
|
363 |
msgstr ""
|
364 |
|
365 |
-
#: includes/class-freemius.php:
|
366 |
msgid "Add-Ons"
|
367 |
msgstr ""
|
368 |
|
369 |
-
#: includes/class-freemius.php:
|
370 |
msgctxt "ASCII arrow left icon"
|
371 |
msgid "←"
|
372 |
msgstr ""
|
373 |
|
374 |
-
#: includes/class-freemius.php:
|
375 |
msgctxt "ASCII arrow right icon"
|
376 |
msgid "➤"
|
377 |
msgstr ""
|
378 |
|
379 |
-
#: includes/class-freemius.php:
|
380 |
msgctxt "noun"
|
381 |
msgid "Pricing"
|
382 |
msgstr ""
|
383 |
|
384 |
-
#: includes/class-freemius.php:
|
385 |
msgid "Support Forum"
|
386 |
msgstr ""
|
387 |
|
388 |
-
#: includes/class-freemius.php:
|
389 |
msgid "Your email has been successfully verified - you are AWESOME!"
|
390 |
msgstr ""
|
391 |
|
392 |
-
#: includes/class-freemius.php:
|
393 |
msgctxt "a positive response"
|
394 |
msgid "Right on"
|
395 |
msgstr ""
|
396 |
|
397 |
-
#: includes/class-freemius.php:
|
398 |
msgid "seems like the key you entered doesn't match our records."
|
399 |
msgstr ""
|
400 |
|
401 |
-
#: includes/class-freemius.php:
|
402 |
msgid "Debug mode was successfully enabled and will be automatically disabled in 60 min. You can also disable it earlier by clicking the \"Stop Debug\" link."
|
403 |
msgstr ""
|
404 |
|
405 |
-
#: includes/class-freemius.php:
|
406 |
msgid "Your %s Add-on plan was successfully upgraded."
|
407 |
msgstr ""
|
408 |
|
409 |
-
#: includes/class-freemius.php:
|
410 |
msgid "%s Add-on was successfully purchased."
|
411 |
msgstr ""
|
412 |
|
413 |
-
#: includes/class-freemius.php:
|
414 |
msgid "Download the latest version"
|
415 |
msgstr ""
|
416 |
|
417 |
-
#: includes/class-freemius.php:
|
418 |
msgid "Your server is blocking the access to Freemius' API, which is crucial for %1$s synchronization. Please contact your host to whitelist %2$s"
|
419 |
msgstr ""
|
420 |
|
421 |
-
#: includes/class-freemius.php:
|
422 |
msgid "Error received from the server:"
|
423 |
msgstr ""
|
424 |
|
425 |
-
#: includes/class-freemius.php:
|
426 |
msgid "It seems like one of the authentication parameters is wrong. Update your Public Key, Secret Key & User ID, and try again."
|
427 |
msgstr ""
|
428 |
|
429 |
-
#: includes/class-freemius.php:
|
430 |
msgctxt "something somebody says when they are thinking about what you have just said."
|
431 |
msgid "Hmm"
|
432 |
msgstr ""
|
433 |
|
434 |
-
#: includes/class-freemius.php:
|
435 |
msgid "It looks like you are still on the %s plan. If you did upgrade or change your plan, it's probably an issue on our side - sorry."
|
436 |
msgstr ""
|
437 |
|
438 |
-
#: includes/class-freemius.php:
|
439 |
msgctxt "trial period"
|
440 |
msgid "Trial"
|
441 |
msgstr ""
|
442 |
|
443 |
-
#: includes/class-freemius.php:
|
444 |
msgid "I have upgraded my account but when I try to Sync the License, the plan remains %s."
|
445 |
msgstr ""
|
446 |
|
447 |
-
#: includes/class-freemius.php:
|
448 |
msgid "Please contact us here"
|
449 |
msgstr ""
|
450 |
|
451 |
-
#: includes/class-freemius.php:
|
452 |
msgid "Your plan was successfully activated."
|
453 |
msgstr ""
|
454 |
|
455 |
-
#: includes/class-freemius.php:
|
456 |
msgid "Your plan was successfully upgraded."
|
457 |
msgstr ""
|
458 |
|
459 |
-
#: includes/class-freemius.php:
|
460 |
msgid "Your plan was successfully changed to %s."
|
461 |
msgstr ""
|
462 |
|
463 |
-
#: includes/class-freemius.php:
|
464 |
msgid "Your license has expired. You can still continue using the free %s forever."
|
465 |
msgstr ""
|
466 |
|
467 |
-
#: includes/class-freemius.php:
|
468 |
msgid "Your license has expired. %1$sUpgrade now%2$s to continue using the %3$s without interruptions."
|
469 |
msgstr ""
|
470 |
|
471 |
-
#: includes/class-freemius.php:
|
472 |
msgid "Your license has been cancelled. If you think it's a mistake, please contact support."
|
473 |
msgstr ""
|
474 |
|
475 |
-
#: includes/class-freemius.php:
|
476 |
msgid "Your license has expired. You can still continue using all the %s features, but you'll need to renew your license to continue getting updates and support."
|
477 |
msgstr ""
|
478 |
|
479 |
-
#: includes/class-freemius.php:
|
480 |
msgid "Your free trial has expired. You can still continue using all our free features."
|
481 |
msgstr ""
|
482 |
|
483 |
-
#: includes/class-freemius.php:
|
484 |
msgid "Your free trial has expired. %1$sUpgrade now%2$s to continue using the %3$s without interruptions."
|
485 |
msgstr ""
|
486 |
|
487 |
-
#: includes/class-freemius.php:
|
488 |
msgid "It looks like the license could not be activated."
|
489 |
msgstr ""
|
490 |
|
491 |
-
#: includes/class-freemius.php:
|
492 |
msgid "Your license was successfully activated."
|
493 |
msgstr ""
|
494 |
|
495 |
-
#: includes/class-freemius.php:
|
496 |
msgid "It looks like your site currently doesn't have an active license."
|
497 |
msgstr ""
|
498 |
|
499 |
-
#: includes/class-freemius.php:
|
500 |
msgid "It looks like the license deactivation failed."
|
501 |
msgstr ""
|
502 |
|
503 |
-
#: includes/class-freemius.php:
|
504 |
msgid "Your %s license was successfully deactivated."
|
505 |
msgstr ""
|
506 |
|
507 |
-
#: includes/class-freemius.php:
|
508 |
msgid "Your license was successfully deactivated, you are back to the %s plan."
|
509 |
msgstr ""
|
510 |
|
511 |
-
#: includes/class-freemius.php:
|
512 |
msgid "O.K"
|
513 |
msgstr ""
|
514 |
|
515 |
-
#: includes/class-freemius.php:
|
516 |
msgid "Seems like we are having some temporary issue with your subscription cancellation. Please try again in few minutes."
|
517 |
msgstr ""
|
518 |
|
519 |
-
#: includes/class-freemius.php:
|
520 |
msgid "Your subscription was successfully cancelled. Your %s plan license will expire in %s."
|
521 |
msgstr ""
|
522 |
|
523 |
-
#: includes/class-freemius.php:
|
524 |
msgid "You are already running the %s in a trial mode."
|
525 |
msgstr ""
|
526 |
|
527 |
-
#: includes/class-freemius.php:
|
528 |
msgid "You already utilized a trial before."
|
529 |
msgstr ""
|
530 |
|
531 |
-
#: includes/class-freemius.php:
|
532 |
msgid "Plan %s do not exist, therefore, can't start a trial."
|
533 |
msgstr ""
|
534 |
|
535 |
-
#: includes/class-freemius.php:
|
536 |
msgid "Plan %s does not support a trial period."
|
537 |
msgstr ""
|
538 |
|
539 |
-
#: includes/class-freemius.php:
|
540 |
msgid "None of the %s's plans supports a trial period."
|
541 |
msgstr ""
|
542 |
|
543 |
-
#: includes/class-freemius.php:
|
544 |
msgid "It looks like you are not in trial mode anymore so there's nothing to cancel :)"
|
545 |
msgstr ""
|
546 |
|
547 |
-
#: includes/class-freemius.php:
|
548 |
msgid "Seems like we are having some temporary issue with your trial cancellation. Please try again in few minutes."
|
549 |
msgstr ""
|
550 |
|
551 |
-
#: includes/class-freemius.php:
|
552 |
msgid "Your %s free trial was successfully cancelled."
|
553 |
msgstr ""
|
554 |
|
555 |
-
#: includes/class-freemius.php:
|
556 |
msgid "Version %s was released."
|
557 |
msgstr ""
|
558 |
|
559 |
-
#: includes/class-freemius.php:
|
560 |
msgid "Please download %s."
|
561 |
msgstr ""
|
562 |
|
563 |
-
#: includes/class-freemius.php:
|
564 |
msgid "the latest %s version here"
|
565 |
msgstr ""
|
566 |
|
567 |
-
#: includes/class-freemius.php:
|
568 |
msgid "New"
|
569 |
msgstr ""
|
570 |
|
571 |
-
#: includes/class-freemius.php:
|
572 |
msgid "Seems like you got the latest release."
|
573 |
msgstr ""
|
574 |
|
575 |
-
#: includes/class-freemius.php:
|
576 |
msgid "You are all good!"
|
577 |
msgstr ""
|
578 |
|
579 |
-
#: includes/class-freemius.php:
|
580 |
msgid "Verification mail was just sent to %s. If you can't find it after 5 min, please check your spam box."
|
581 |
msgstr ""
|
582 |
|
583 |
-
#: includes/class-freemius.php:
|
584 |
msgid "Site successfully opted in."
|
585 |
msgstr ""
|
586 |
|
587 |
-
#: includes/class-freemius.php:
|
588 |
msgid "Awesome"
|
589 |
msgstr ""
|
590 |
|
591 |
-
#: includes/class-freemius.php:
|
592 |
msgid "We appreciate your help in making the %s better by letting us track some usage data."
|
593 |
msgstr ""
|
594 |
|
595 |
-
#: includes/class-freemius.php:
|
596 |
msgid "Thank you!"
|
597 |
msgstr ""
|
598 |
|
599 |
-
#: includes/class-freemius.php:
|
600 |
msgid "We will no longer be sending any usage data of %s on %s to %s."
|
601 |
msgstr ""
|
602 |
|
603 |
-
#: includes/class-freemius.php:
|
604 |
msgid "Please check your mailbox, you should receive an email via %s to confirm the ownership change. From security reasons, you must confirm the change within the next 15 min. If you cannot find the email, please check your spam folder."
|
605 |
msgstr ""
|
606 |
|
607 |
-
#: includes/class-freemius.php:
|
608 |
msgid "Thanks for confirming the ownership change. An email was just sent to %s for final approval."
|
609 |
msgstr ""
|
610 |
|
611 |
-
#: includes/class-freemius.php:
|
612 |
msgid "%s is the new owner of the account."
|
613 |
msgstr ""
|
614 |
|
615 |
-
#: includes/class-freemius.php:
|
616 |
msgctxt "as congratulations"
|
617 |
msgid "Congrats"
|
618 |
msgstr ""
|
619 |
|
620 |
-
#: includes/class-freemius.php:
|
621 |
msgid "Your email was successfully updated. You should receive an email with confirmation instructions in few moments."
|
622 |
msgstr ""
|
623 |
|
624 |
-
#: includes/class-freemius.php:
|
625 |
msgid "Please provide your full name."
|
626 |
msgstr ""
|
627 |
|
628 |
-
#: includes/class-freemius.php:
|
629 |
msgid "Your name was successfully updated."
|
630 |
msgstr ""
|
631 |
|
632 |
-
#: includes/class-freemius.php:
|
633 |
msgid "You have successfully updated your %s."
|
634 |
msgstr ""
|
635 |
|
636 |
-
#: includes/class-freemius.php:
|
637 |
msgid "Is this your client's site? %s if you wish to hide sensitive info like your email, license key, prices, billing address & invoices from the WP Admin."
|
638 |
msgstr ""
|
639 |
|
640 |
-
#: includes/class-freemius.php:
|
641 |
msgid "Click here"
|
642 |
msgstr ""
|
643 |
|
644 |
-
#: includes/class-freemius.php:
|
645 |
msgid "Just letting you know that the add-ons information of %s is being pulled from an external server."
|
646 |
msgstr ""
|
647 |
|
648 |
-
#: includes/class-freemius.php:
|
649 |
msgctxt "advance notice of something that will need attention."
|
650 |
msgid "Heads up"
|
651 |
msgstr ""
|
652 |
|
653 |
-
#: includes/class-freemius.php:
|
654 |
msgctxt "exclamation"
|
655 |
msgid "Hey"
|
656 |
msgstr ""
|
657 |
|
658 |
-
#: includes/class-freemius.php:
|
659 |
msgid "How do you like %s so far? Test all our %s premium features with a %d-day free trial."
|
660 |
msgstr ""
|
661 |
|
662 |
-
#: includes/class-freemius.php:
|
663 |
msgid "No commitment for %s days - cancel anytime!"
|
664 |
msgstr ""
|
665 |
|
666 |
-
#: includes/class-freemius.php:
|
667 |
msgid "No credit card required"
|
668 |
msgstr ""
|
669 |
|
670 |
-
#: includes/class-freemius.php:
|
671 |
msgctxt "call to action"
|
672 |
msgid "Start free trial"
|
673 |
msgstr ""
|
674 |
|
675 |
-
#: includes/class-freemius.php:
|
676 |
msgid "Hey there, did you know that %s has an affiliate program? If you like the %s you can become our ambassador and earn some cash!"
|
677 |
msgstr ""
|
678 |
|
679 |
-
#: includes/class-freemius.php:
|
680 |
msgid "Learn more"
|
681 |
msgstr ""
|
682 |
|
683 |
-
#: includes/class-freemius.php:
|
684 |
msgid "Activate License"
|
685 |
msgstr ""
|
686 |
|
687 |
-
#: includes/class-freemius.php:
|
688 |
msgid "Change License"
|
689 |
msgstr ""
|
690 |
|
691 |
-
#: includes/class-freemius.php:
|
692 |
msgid "Opt Out"
|
693 |
msgstr ""
|
694 |
|
695 |
-
#: includes/class-freemius.php:
|
696 |
msgid "Opt In"
|
697 |
msgstr ""
|
698 |
|
699 |
-
#: includes/class-freemius.php:
|
700 |
msgid " The paid version of %1$s is already installed. Please activate it to start benefiting the %2$s features. %3$s"
|
701 |
msgstr ""
|
702 |
|
703 |
-
#: includes/class-freemius.php:
|
704 |
msgid "Activate %s features"
|
705 |
msgstr ""
|
706 |
|
707 |
-
#: includes/class-freemius.php:
|
708 |
msgid "Please follow these steps to complete the upgrade"
|
709 |
msgstr ""
|
710 |
|
711 |
-
#: includes/class-freemius.php:
|
712 |
msgid "Download the latest %s version"
|
713 |
msgstr ""
|
714 |
|
715 |
-
#: includes/class-freemius.php:
|
716 |
msgid "Upload and activate the downloaded version"
|
717 |
msgstr ""
|
718 |
|
719 |
-
#: includes/class-freemius.php:
|
720 |
msgid "How to upload and activate?"
|
721 |
msgstr ""
|
722 |
|
723 |
-
#: includes/class-freemius.php:
|
724 |
msgid "%sClick here%s to choose the sites where you'd like to activate the license on."
|
725 |
msgstr ""
|
726 |
|
727 |
-
#: includes/class-freemius.php:
|
728 |
msgid "Auto installation only works for opted-in users."
|
729 |
msgstr ""
|
730 |
|
731 |
-
#: includes/class-freemius.php:
|
732 |
msgid "Invalid module ID."
|
733 |
msgstr ""
|
734 |
|
735 |
-
#: includes/class-freemius.php:
|
736 |
msgid "Premium version already active."
|
737 |
msgstr ""
|
738 |
|
739 |
-
#: includes/class-freemius.php:
|
740 |
msgid "You do not have a valid license to access the premium version."
|
741 |
msgstr ""
|
742 |
|
743 |
-
#: includes/class-freemius.php:
|
744 |
msgid "Plugin is a \"Serviceware\" which means it does not have a premium code version."
|
745 |
msgstr ""
|
746 |
|
747 |
-
#: includes/class-freemius.php:
|
748 |
msgid "Premium add-on version already installed."
|
749 |
msgstr ""
|
750 |
|
751 |
-
#: includes/class-freemius.php:
|
752 |
msgid "View paid features"
|
753 |
msgstr ""
|
754 |
|
755 |
-
#: includes/class-freemius.php:
|
756 |
msgid "Thank you so much for using %s and its add-ons!"
|
757 |
msgstr ""
|
758 |
|
759 |
-
#: includes/class-freemius.php:
|
760 |
msgid "Thank you so much for using %s!"
|
761 |
msgstr ""
|
762 |
|
763 |
-
#: includes/class-freemius.php:
|
764 |
msgid "You've already opted-in to our usage-tracking, which helps us keep improving the %s."
|
765 |
msgstr ""
|
766 |
|
767 |
-
#: includes/class-freemius.php:
|
768 |
msgid "Thank you so much for using our products!"
|
769 |
msgstr ""
|
770 |
|
771 |
-
#: includes/class-freemius.php:
|
772 |
msgid "You've already opted-in to our usage-tracking, which helps us keep improving them."
|
773 |
msgstr ""
|
774 |
|
775 |
-
#: includes/class-freemius.php:
|
776 |
msgid "%s and its add-ons"
|
777 |
msgstr ""
|
778 |
|
779 |
-
#: includes/class-freemius.php:
|
780 |
msgid "Products"
|
781 |
msgstr ""
|
782 |
|
783 |
-
#: includes/class-freemius.php:
|
784 |
msgid "Yes"
|
785 |
msgstr ""
|
786 |
|
787 |
-
#: includes/class-freemius.php:
|
788 |
msgid "send me security & feature updates, educational content and offers."
|
789 |
msgstr ""
|
790 |
|
791 |
-
#: includes/class-freemius.php:
|
792 |
msgid "No"
|
793 |
msgstr ""
|
794 |
|
795 |
-
#: includes/class-freemius.php:
|
796 |
msgid "do %sNOT%s send me security & feature updates, educational content and offers."
|
797 |
msgstr ""
|
798 |
|
799 |
-
#: includes/class-freemius.php:
|
800 |
msgid "Due to the new %sEU General Data Protection Regulation (GDPR)%s compliance requirements it is required that you provide your explicit consent, again, confirming that you are onboard :-)"
|
801 |
msgstr ""
|
802 |
|
803 |
-
#: includes/class-freemius.php:
|
804 |
msgid "Please let us know if you'd like us to contact you for security & feature updates, educational content, and occasional offers:"
|
805 |
msgstr ""
|
806 |
|
807 |
-
#: includes/class-freemius.php:
|
808 |
msgid "License key is empty."
|
809 |
msgstr ""
|
810 |
|
@@ -832,15 +832,15 @@ msgstr ""
|
|
832 |
msgid "Important Upgrade Notice:"
|
833 |
msgstr ""
|
834 |
|
835 |
-
#: includes/class-fs-plugin-updater.php:
|
836 |
msgid "Installing plugin: %s"
|
837 |
msgstr ""
|
838 |
|
839 |
-
#: includes/class-fs-plugin-updater.php:
|
840 |
msgid "Unable to connect to the filesystem. Please confirm your credentials."
|
841 |
msgstr ""
|
842 |
|
843 |
-
#: includes/class-fs-plugin-updater.php:
|
844 |
msgid "The remote plugin package does not contain a folder with the desired slug and renaming did not work."
|
845 |
msgstr ""
|
846 |
|
@@ -861,7 +861,7 @@ msgstr ""
|
|
861 |
msgid "Install Free Version Update Now"
|
862 |
msgstr ""
|
863 |
|
864 |
-
#: includes/fs-plugin-info-dialog.php:745, templates/account.php:
|
865 |
msgid "Install Update Now"
|
866 |
msgstr ""
|
867 |
|
@@ -878,7 +878,7 @@ msgctxt "as download latest version"
|
|
878 |
msgid "Download Latest Free Version"
|
879 |
msgstr ""
|
880 |
|
881 |
-
#: includes/fs-plugin-info-dialog.php:772, templates/account.php:
|
882 |
msgctxt "as download latest version"
|
883 |
msgid "Download Latest"
|
884 |
msgstr ""
|
@@ -887,11 +887,11 @@ msgstr ""
|
|
887 |
msgid "Activate this add-on"
|
888 |
msgstr ""
|
889 |
|
890 |
-
#: includes/fs-plugin-info-dialog.php:789, templates/connect.php:
|
891 |
msgid "Activate Free Version"
|
892 |
msgstr ""
|
893 |
|
894 |
-
#: includes/fs-plugin-info-dialog.php:790, templates/account.php:
|
895 |
msgid "Activate"
|
896 |
msgstr ""
|
897 |
|
@@ -1020,7 +1020,7 @@ msgstr ""
|
|
1020 |
msgid "Details"
|
1021 |
msgstr ""
|
1022 |
|
1023 |
-
#: includes/fs-plugin-info-dialog.php:1318, templates/account.php:
|
1024 |
msgctxt "product version"
|
1025 |
msgid "Version"
|
1026 |
msgstr ""
|
@@ -1034,7 +1034,7 @@ msgstr ""
|
|
1034 |
msgid "Last Updated"
|
1035 |
msgstr ""
|
1036 |
|
1037 |
-
#: includes/fs-plugin-info-dialog.php:1337, templates/account.php:
|
1038 |
msgctxt "x-ago"
|
1039 |
msgid "%s ago"
|
1040 |
msgstr ""
|
@@ -1143,293 +1143,293 @@ msgstr ""
|
|
1143 |
msgid "Latest Free Version Installed"
|
1144 |
msgstr ""
|
1145 |
|
1146 |
-
#: templates/account.php:
|
1147 |
msgid "Downgrading your plan"
|
1148 |
msgstr ""
|
1149 |
|
1150 |
-
#: templates/account.php:
|
1151 |
msgid "Cancelling the subscription"
|
1152 |
msgstr ""
|
1153 |
|
1154 |
#. translators: %1$s: Either 'Downgrading your plan' or 'Cancelling the subscription'
|
1155 |
-
#: templates/account.php:
|
1156 |
msgid "%1$s will immediately stop all future recurring payments and your %2$s plan license will expire in %3$s."
|
1157 |
msgstr ""
|
1158 |
|
1159 |
-
#: templates/account.php:
|
1160 |
msgid "Please note that we will not be able to grandfather outdated pricing for renewals/new subscriptions after a cancellation. If you choose to renew the subscription manually in the future, after a price increase, which typically occurs once a year, you will be charged the updated price."
|
1161 |
msgstr ""
|
1162 |
|
1163 |
-
#: templates/account.php:
|
1164 |
msgid "Cancelling the trial will immediately block access to all premium features. Are you sure?"
|
1165 |
msgstr ""
|
1166 |
|
1167 |
-
#: templates/account.php:
|
1168 |
msgid "You can still enjoy all %s features but you will not have access to %s security & feature updates, nor support."
|
1169 |
msgstr ""
|
1170 |
|
1171 |
-
#: templates/account.php:
|
1172 |
msgid "Once your license expires you can still use the Free version but you will NOT have access to the %s features."
|
1173 |
msgstr ""
|
1174 |
|
1175 |
#. translators: %s: Plan title (e.g. "Professional")
|
1176 |
-
#: templates/account.php:
|
1177 |
msgid "Activate %s Plan"
|
1178 |
msgstr ""
|
1179 |
|
1180 |
#. translators: %s: Time period (e.g. Auto renews in "2 months")
|
1181 |
-
#: templates/account.php:
|
1182 |
msgid "Auto renews in %s"
|
1183 |
msgstr ""
|
1184 |
|
1185 |
#. translators: %s: Time period (e.g. Expires in "2 months")
|
1186 |
-
#: templates/account.php:
|
1187 |
msgid "Expires in %s"
|
1188 |
msgstr ""
|
1189 |
|
1190 |
-
#: templates/account.php:
|
1191 |
msgctxt "as synchronize license"
|
1192 |
msgid "Sync License"
|
1193 |
msgstr ""
|
1194 |
|
1195 |
-
#: templates/account.php:
|
1196 |
msgid "Cancel Trial"
|
1197 |
msgstr ""
|
1198 |
|
1199 |
-
#: templates/account.php:
|
1200 |
msgid "Change Plan"
|
1201 |
msgstr ""
|
1202 |
|
1203 |
-
#: templates/account.php:
|
1204 |
msgctxt "verb"
|
1205 |
msgid "Upgrade"
|
1206 |
msgstr ""
|
1207 |
|
1208 |
-
#: templates/account.php:
|
1209 |
msgctxt "verb"
|
1210 |
msgid "Downgrade"
|
1211 |
msgstr ""
|
1212 |
|
1213 |
-
#: templates/account.php:
|
1214 |
msgid "Free"
|
1215 |
msgstr ""
|
1216 |
|
1217 |
-
#: templates/account.php:
|
1218 |
msgctxt "as product pricing plan"
|
1219 |
msgid "Plan"
|
1220 |
msgstr ""
|
1221 |
|
1222 |
-
#: templates/account.php:
|
1223 |
msgid "Bundle Plan"
|
1224 |
msgstr ""
|
1225 |
|
1226 |
-
#: templates/account.php:
|
1227 |
msgid "Free Trial"
|
1228 |
msgstr ""
|
1229 |
|
1230 |
-
#: templates/account.php:
|
1231 |
msgid "Account Details"
|
1232 |
msgstr ""
|
1233 |
|
1234 |
-
#: templates/account.php:
|
1235 |
msgid "Start Debug"
|
1236 |
msgstr ""
|
1237 |
|
1238 |
-
#: templates/account.php:
|
1239 |
msgid "Stop Debug"
|
1240 |
msgstr ""
|
1241 |
|
1242 |
-
#: templates/account.php:
|
1243 |
msgid "Billing & Invoices"
|
1244 |
msgstr ""
|
1245 |
|
1246 |
-
#: templates/account.php:
|
1247 |
msgid "Deleting the account will automatically deactivate your %s plan license so you can use it on other sites. If you want to terminate the recurring payments as well, click the \"Cancel\" button, and first \"Downgrade\" your account. Are you sure you would like to continue with the deletion?"
|
1248 |
msgstr ""
|
1249 |
|
1250 |
-
#: templates/account.php:
|
1251 |
msgid "Deletion is not temporary. Only delete if you no longer want to use this %s anymore. Are you sure you would like to continue with the deletion?"
|
1252 |
msgstr ""
|
1253 |
|
1254 |
-
#: templates/account.php:
|
1255 |
msgid "Delete Account"
|
1256 |
msgstr ""
|
1257 |
|
1258 |
-
#: templates/account.php:
|
1259 |
msgid "Deactivate License"
|
1260 |
msgstr ""
|
1261 |
|
1262 |
-
#: templates/account.php:
|
1263 |
msgid "Are you sure you want to proceed?"
|
1264 |
msgstr ""
|
1265 |
|
1266 |
-
#: templates/account.php:
|
1267 |
msgid "Cancel Subscription"
|
1268 |
msgstr ""
|
1269 |
|
1270 |
-
#: templates/account.php:
|
1271 |
msgctxt "as synchronize"
|
1272 |
msgid "Sync"
|
1273 |
msgstr ""
|
1274 |
|
1275 |
-
#: templates/account.php:
|
1276 |
msgid "Name"
|
1277 |
msgstr ""
|
1278 |
|
1279 |
-
#: templates/account.php:
|
1280 |
msgid "Email"
|
1281 |
msgstr ""
|
1282 |
|
1283 |
-
#: templates/account.php:
|
1284 |
msgid "User ID"
|
1285 |
msgstr ""
|
1286 |
|
1287 |
-
#: templates/account.php:
|
1288 |
msgid "ID"
|
1289 |
msgstr ""
|
1290 |
|
1291 |
-
#: templates/account.php:
|
1292 |
msgid "Site ID"
|
1293 |
msgstr ""
|
1294 |
|
1295 |
-
#: templates/account.php:
|
1296 |
msgid "No ID"
|
1297 |
msgstr ""
|
1298 |
|
1299 |
-
#: templates/account.php:
|
1300 |
msgid "Public Key"
|
1301 |
msgstr ""
|
1302 |
|
1303 |
-
#: templates/account.php:
|
1304 |
msgid "Secret Key"
|
1305 |
msgstr ""
|
1306 |
|
1307 |
-
#: templates/account.php:
|
1308 |
msgctxt "as secret encryption key missing"
|
1309 |
msgid "No Secret"
|
1310 |
msgstr ""
|
1311 |
|
1312 |
-
#: templates/account.php:
|
1313 |
msgid "Trial"
|
1314 |
msgstr ""
|
1315 |
|
1316 |
-
#: templates/account.php:
|
1317 |
msgid "License Key"
|
1318 |
msgstr ""
|
1319 |
|
1320 |
-
#: templates/account.php:
|
1321 |
msgid "Join the Beta program"
|
1322 |
msgstr ""
|
1323 |
|
1324 |
-
#: templates/account.php:
|
1325 |
msgid "not verified"
|
1326 |
msgstr ""
|
1327 |
|
1328 |
-
#: templates/account.php:
|
1329 |
msgid "Expired"
|
1330 |
msgstr ""
|
1331 |
|
1332 |
-
#: templates/account.php:
|
1333 |
msgid "Premium version"
|
1334 |
msgstr ""
|
1335 |
|
1336 |
-
#: templates/account.php:
|
1337 |
msgid "Free version"
|
1338 |
msgstr ""
|
1339 |
|
1340 |
-
#: templates/account.php:
|
1341 |
msgid "Verify Email"
|
1342 |
msgstr ""
|
1343 |
|
1344 |
-
#: templates/account.php:
|
1345 |
msgid "Download %s Version"
|
1346 |
msgstr ""
|
1347 |
|
1348 |
-
#: templates/account.php:
|
1349 |
msgid "Download Paid Version"
|
1350 |
msgstr ""
|
1351 |
|
1352 |
-
#: templates/account.php:
|
1353 |
msgctxt "verb"
|
1354 |
msgid "Show"
|
1355 |
msgstr ""
|
1356 |
|
1357 |
-
#: templates/account.php:
|
1358 |
msgid "What is your %s?"
|
1359 |
msgstr ""
|
1360 |
|
1361 |
-
#: templates/account.php:
|
1362 |
msgctxt "verb"
|
1363 |
msgid "Edit"
|
1364 |
msgstr ""
|
1365 |
|
1366 |
-
#: templates/account.php:
|
1367 |
msgid "Change User"
|
1368 |
msgstr ""
|
1369 |
|
1370 |
-
#: templates/account.php:
|
1371 |
msgid "Sites"
|
1372 |
msgstr ""
|
1373 |
|
1374 |
-
#: templates/account.php:
|
1375 |
msgid "Search by address"
|
1376 |
msgstr ""
|
1377 |
|
1378 |
-
#: templates/account.php:
|
1379 |
msgid "Address"
|
1380 |
msgstr ""
|
1381 |
|
1382 |
-
#: templates/account.php:
|
1383 |
msgid "License"
|
1384 |
msgstr ""
|
1385 |
|
1386 |
-
#: templates/account.php:
|
1387 |
msgid "Plan"
|
1388 |
msgstr ""
|
1389 |
|
1390 |
-
#: templates/account.php:
|
1391 |
msgctxt "as software license"
|
1392 |
msgid "License"
|
1393 |
msgstr ""
|
1394 |
|
1395 |
-
#: templates/account.php:
|
1396 |
msgctxt "verb"
|
1397 |
msgid "Hide"
|
1398 |
msgstr ""
|
1399 |
|
1400 |
-
#: templates/account.php:
|
1401 |
msgid "Processing"
|
1402 |
msgstr ""
|
1403 |
|
1404 |
-
#: templates/account.php:
|
1405 |
msgid "Get updates for bleeding edge Beta versions of %s."
|
1406 |
msgstr ""
|
1407 |
|
1408 |
-
#: templates/account.php:
|
1409 |
msgid "Cancelling %s"
|
1410 |
msgstr ""
|
1411 |
|
1412 |
-
#: templates/account.php:
|
1413 |
msgid "trial"
|
1414 |
msgstr ""
|
1415 |
|
1416 |
-
#: templates/account.php:
|
1417 |
msgid "Cancelling %s..."
|
1418 |
msgstr ""
|
1419 |
|
1420 |
-
#: templates/account.php:
|
1421 |
msgid "subscription"
|
1422 |
msgstr ""
|
1423 |
|
1424 |
-
#: templates/account.php:
|
1425 |
msgid "Deactivating your license will block all premium features, but will enable activating the license on another site. Are you sure you want to proceed?"
|
1426 |
msgstr ""
|
1427 |
|
1428 |
-
#: templates/account.php:
|
1429 |
msgid "Disabling white-label mode"
|
1430 |
msgstr ""
|
1431 |
|
1432 |
-
#: templates/account.php:
|
1433 |
msgid "Enabling white-label mode"
|
1434 |
msgstr ""
|
1435 |
|
@@ -1455,7 +1455,7 @@ msgctxt "installed add-on"
|
|
1455 |
msgid "Installed"
|
1456 |
msgstr ""
|
1457 |
|
1458 |
-
#: templates/admin-notice.php:13, templates/forms/license-activation.php:
|
1459 |
msgctxt "as close a window"
|
1460 |
msgid "Dismiss"
|
1461 |
msgstr ""
|
@@ -1510,84 +1510,92 @@ msgstr ""
|
|
1510 |
msgid "Agree & Activate License"
|
1511 |
msgstr ""
|
1512 |
|
1513 |
-
#: templates/connect.php:
|
1514 |
-
msgid "
|
1515 |
msgstr ""
|
1516 |
|
1517 |
-
#: templates/connect.php:
|
1518 |
msgid "Never miss an important update - opt in to our security & feature updates notifications, educational content, offers, and non-sensitive diagnostic tracking with %4$s."
|
1519 |
msgstr ""
|
1520 |
|
1521 |
-
#: templates/connect.php:
|
1522 |
msgid "Never miss an important update - opt in to our security and feature updates notifications, and non-sensitive diagnostic tracking with %4$s."
|
1523 |
msgstr ""
|
1524 |
|
1525 |
-
#: templates/connect.php:
|
1526 |
msgid "Never miss an important update - opt in to our security & feature updates notifications, educational content, offers, and non-sensitive diagnostic tracking with %4$s. If you skip this, that's okay! %1$s will still work just fine."
|
1527 |
msgstr ""
|
1528 |
|
1529 |
-
#: templates/connect.php:
|
1530 |
msgid "Never miss an important update - opt in to our security & feature updates notifications, and non-sensitive diagnostic tracking with %4$s. If you skip this, that's okay! %1$s will still work just fine."
|
1531 |
msgstr ""
|
1532 |
|
1533 |
-
#: templates/connect.php:
|
1534 |
msgid "We're excited to introduce the Freemius network-level integration."
|
1535 |
msgstr ""
|
1536 |
|
1537 |
-
#: templates/connect.php:
|
1538 |
msgid "During the update process we detected %d site(s) that are still pending license activation."
|
1539 |
msgstr ""
|
1540 |
|
1541 |
-
#: templates/connect.php:
|
1542 |
msgid "If you'd like to use the %s on those sites, please enter your license key below and click the activation button."
|
1543 |
msgstr ""
|
1544 |
|
1545 |
-
#: templates/connect.php:
|
1546 |
msgid "%s's paid features"
|
1547 |
msgstr ""
|
1548 |
|
1549 |
-
#: templates/connect.php:
|
1550 |
msgid "Alternatively, you can skip it for now and activate the license later, in your %s's network-level Account page."
|
1551 |
msgstr ""
|
1552 |
|
1553 |
-
#: templates/connect.php:
|
1554 |
msgid "During the update process we detected %s site(s) in the network that are still pending your attention."
|
1555 |
msgstr ""
|
1556 |
|
1557 |
-
#: templates/connect.php:
|
1558 |
msgid "License key"
|
1559 |
msgstr ""
|
1560 |
|
1561 |
-
#: templates/connect.php:
|
1562 |
msgid "Can't find your license key?"
|
1563 |
msgstr ""
|
1564 |
|
1565 |
-
#: templates/connect.php:
|
1566 |
msgctxt "verb"
|
1567 |
msgid "Skip"
|
1568 |
msgstr ""
|
1569 |
|
1570 |
-
#: templates/connect.php:
|
1571 |
msgid "Delegate to Site Admins"
|
1572 |
msgstr ""
|
1573 |
|
1574 |
-
#: templates/connect.php:
|
1575 |
msgid "If you click it, this decision will be delegated to the sites administrators."
|
1576 |
msgstr ""
|
1577 |
|
1578 |
-
#: templates/connect.php:
|
|
|
|
|
|
|
|
|
1579 |
msgid "Your Profile Overview"
|
1580 |
msgstr ""
|
1581 |
|
1582 |
-
#: templates/connect.php:
|
1583 |
msgid "Name and email address"
|
1584 |
msgstr ""
|
1585 |
|
1586 |
-
#: templates/connect.php:
|
|
|
|
|
|
|
|
|
1587 |
msgid "Your Site Overview"
|
1588 |
msgstr ""
|
1589 |
|
1590 |
-
#: templates/connect.php:
|
1591 |
msgid "Site URL, WP version, PHP info"
|
1592 |
msgstr ""
|
1593 |
|
@@ -1595,64 +1603,84 @@ msgstr ""
|
|
1595 |
msgid "Admin Notices"
|
1596 |
msgstr ""
|
1597 |
|
1598 |
-
#: templates/connect.php:380, templates/connect.php:
|
1599 |
msgid "Updates, announcements, marketing, no spam"
|
1600 |
msgstr ""
|
1601 |
|
1602 |
-
#: templates/connect.php:
|
1603 |
-
msgid "
|
|
|
|
|
|
|
|
|
1604 |
msgstr ""
|
1605 |
|
1606 |
-
#: templates/connect.php:
|
1607 |
-
msgid "
|
1608 |
msgstr ""
|
1609 |
|
1610 |
-
#: templates/connect.php:
|
1611 |
msgid "Newsletter"
|
1612 |
msgstr ""
|
1613 |
|
1614 |
-
#: templates/connect.php:
|
1615 |
msgid "Plugins & Themes"
|
1616 |
msgstr ""
|
1617 |
|
1618 |
-
#: templates/connect.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1619 |
msgid "Title, slug, version, and is active"
|
1620 |
msgstr ""
|
1621 |
|
1622 |
-
#: templates/connect.php:
|
1623 |
-
msgid "The %1$s will
|
1624 |
msgstr ""
|
1625 |
|
1626 |
#: templates/connect.php:426
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1627 |
msgid "What permissions are being granted?"
|
1628 |
msgstr ""
|
1629 |
|
1630 |
-
#: templates/connect.php:
|
1631 |
msgid "Don't have a license key?"
|
1632 |
msgstr ""
|
1633 |
|
1634 |
-
#: templates/connect.php:
|
1635 |
msgid "Have a license key?"
|
1636 |
msgstr ""
|
1637 |
|
1638 |
-
#: templates/connect.php:
|
1639 |
msgid "Privacy Policy"
|
1640 |
msgstr ""
|
1641 |
|
1642 |
-
#: templates/connect.php:
|
1643 |
msgid "License Agreement"
|
1644 |
msgstr ""
|
1645 |
|
1646 |
-
#: templates/connect.php:
|
1647 |
msgid "Terms of Service"
|
1648 |
msgstr ""
|
1649 |
|
1650 |
-
#: templates/connect.php:
|
1651 |
msgctxt "as in the process of sending an email"
|
1652 |
msgid "Sending email"
|
1653 |
msgstr ""
|
1654 |
|
1655 |
-
#: templates/connect.php:
|
1656 |
msgctxt "as activating plugin"
|
1657 |
msgid "Activating"
|
1658 |
msgstr ""
|
@@ -2241,7 +2269,11 @@ msgstr ""
|
|
2241 |
msgid "Update License"
|
2242 |
msgstr ""
|
2243 |
|
2244 |
-
#: templates/forms/license-activation.php:
|
|
|
|
|
|
|
|
|
2245 |
msgid "Associate with the license owner's account."
|
2246 |
msgstr ""
|
2247 |
|
1 |
+
# Copyright (C) 2021 freemius
|
2 |
# This file is distributed under the same license as the freemius package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
16 |
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
18 |
|
19 |
+
#: includes/class-freemius.php:1919, templates/account.php:912
|
20 |
msgid "An update to a Beta version will replace your installed version of %s with the latest Beta release - use with caution, and not on production sites. You have been warned."
|
21 |
msgstr ""
|
22 |
|
23 |
+
#: includes/class-freemius.php:1926
|
24 |
msgid "Would you like to proceed with the update?"
|
25 |
msgstr ""
|
26 |
|
27 |
+
#: includes/class-freemius.php:2138
|
28 |
msgid "Freemius SDK couldn't find the plugin's main file. Please contact sdk@freemius.com with the current error."
|
29 |
msgstr ""
|
30 |
|
31 |
+
#: includes/class-freemius.php:2140
|
32 |
msgid "Error"
|
33 |
msgstr ""
|
34 |
|
35 |
+
#: includes/class-freemius.php:2540
|
36 |
msgid "I found a better %s"
|
37 |
msgstr ""
|
38 |
|
39 |
+
#: includes/class-freemius.php:2542
|
40 |
msgid "What's the %s's name?"
|
41 |
msgstr ""
|
42 |
|
43 |
+
#: includes/class-freemius.php:2548
|
44 |
msgid "It's a temporary %s. I'm just debugging an issue."
|
45 |
msgstr ""
|
46 |
|
47 |
+
#: includes/class-freemius.php:2550
|
48 |
msgid "Deactivation"
|
49 |
msgstr ""
|
50 |
|
51 |
+
#: includes/class-freemius.php:2551
|
52 |
msgid "Theme Switch"
|
53 |
msgstr ""
|
54 |
|
55 |
+
#: includes/class-freemius.php:2560, templates/forms/resend-key.php:24, templates/forms/user-change.php:29
|
56 |
msgid "Other"
|
57 |
msgstr ""
|
58 |
|
59 |
+
#: includes/class-freemius.php:2568
|
60 |
msgid "I no longer need the %s"
|
61 |
msgstr ""
|
62 |
|
63 |
+
#: includes/class-freemius.php:2575
|
64 |
msgid "I only needed the %s for a short period"
|
65 |
msgstr ""
|
66 |
|
67 |
+
#: includes/class-freemius.php:2581
|
68 |
msgid "The %s broke my site"
|
69 |
msgstr ""
|
70 |
|
71 |
+
#: includes/class-freemius.php:2588
|
72 |
msgid "The %s suddenly stopped working"
|
73 |
msgstr ""
|
74 |
|
75 |
+
#: includes/class-freemius.php:2598
|
76 |
msgid "I can't pay for it anymore"
|
77 |
msgstr ""
|
78 |
|
79 |
+
#: includes/class-freemius.php:2600
|
80 |
msgid "What price would you feel comfortable paying?"
|
81 |
msgstr ""
|
82 |
|
83 |
+
#: includes/class-freemius.php:2606
|
84 |
msgid "I don't like to share my information with you"
|
85 |
msgstr ""
|
86 |
|
87 |
+
#: includes/class-freemius.php:2627
|
88 |
msgid "The %s didn't work"
|
89 |
msgstr ""
|
90 |
|
91 |
+
#: includes/class-freemius.php:2637
|
92 |
msgid "I couldn't understand how to make it work"
|
93 |
msgstr ""
|
94 |
|
95 |
+
#: includes/class-freemius.php:2645
|
96 |
msgid "The %s is great, but I need specific feature that you don't support"
|
97 |
msgstr ""
|
98 |
|
99 |
+
#: includes/class-freemius.php:2647
|
100 |
msgid "What feature?"
|
101 |
msgstr ""
|
102 |
|
103 |
+
#: includes/class-freemius.php:2651
|
104 |
msgid "The %s is not working"
|
105 |
msgstr ""
|
106 |
|
107 |
+
#: includes/class-freemius.php:2653
|
108 |
msgid "Kindly share what didn't work so we can fix it for future users..."
|
109 |
msgstr ""
|
110 |
|
111 |
+
#: includes/class-freemius.php:2657
|
112 |
msgid "It's not what I was looking for"
|
113 |
msgstr ""
|
114 |
|
115 |
+
#: includes/class-freemius.php:2659
|
116 |
msgid "What you've been looking for?"
|
117 |
msgstr ""
|
118 |
|
119 |
+
#: includes/class-freemius.php:2663
|
120 |
msgid "The %s didn't work as expected"
|
121 |
msgstr ""
|
122 |
|
123 |
+
#: includes/class-freemius.php:2665
|
124 |
msgid "What did you expect?"
|
125 |
msgstr ""
|
126 |
|
127 |
+
#: includes/class-freemius.php:3520, templates/debug.php:20
|
128 |
msgid "Freemius Debug"
|
129 |
msgstr ""
|
130 |
|
131 |
+
#: includes/class-freemius.php:4272
|
132 |
msgid "I don't know what is cURL or how to install it, help me!"
|
133 |
msgstr ""
|
134 |
|
135 |
+
#: includes/class-freemius.php:4274
|
136 |
msgid "We'll make sure to contact your hosting company and resolve the issue. You will get a follow-up email to %s once we have an update."
|
137 |
msgstr ""
|
138 |
|
139 |
+
#: includes/class-freemius.php:4281
|
140 |
msgid "Great, please install cURL and enable it in your php.ini file. In addition, search for the 'disable_functions' directive in your php.ini file and remove any disabled methods starting with 'curl_'. To make sure it was successfully activated, use 'phpinfo()'. Once activated, deactivate the %s and reactivate it back again."
|
141 |
msgstr ""
|
142 |
|
143 |
+
#: includes/class-freemius.php:4386
|
144 |
msgid "Yes - do your thing"
|
145 |
msgstr ""
|
146 |
|
147 |
+
#: includes/class-freemius.php:4391
|
148 |
msgid "No - just deactivate"
|
149 |
msgstr ""
|
150 |
|
151 |
+
#: includes/class-freemius.php:4436, includes/class-freemius.php:4930, includes/class-freemius.php:6191, includes/class-freemius.php:13368, includes/class-freemius.php:14110, includes/class-freemius.php:17542, includes/class-freemius.php:17647, includes/class-freemius.php:17822, includes/class-freemius.php:20056, includes/class-freemius.php:20414, includes/class-freemius.php:20424, includes/class-freemius.php:21109, includes/class-freemius.php:22015, includes/class-freemius.php:22148, includes/class-freemius.php:22304, templates/add-ons.php:57
|
152 |
msgctxt "exclamation"
|
153 |
msgid "Oops"
|
154 |
msgstr ""
|
155 |
|
156 |
+
#: includes/class-freemius.php:4505
|
157 |
msgid "Thank for giving us the chance to fix it! A message was just sent to our technical staff. We will get back to you as soon as we have an update to %s. Appreciate your patience."
|
158 |
msgstr ""
|
159 |
|
160 |
+
#: includes/class-freemius.php:4927
|
161 |
msgctxt "addonX cannot run without pluginY"
|
162 |
msgid "%s cannot run without %s."
|
163 |
msgstr ""
|
164 |
|
165 |
+
#: includes/class-freemius.php:4928
|
166 |
msgctxt "addonX cannot run..."
|
167 |
msgid "%s cannot run without the plugin."
|
168 |
msgstr ""
|
169 |
|
170 |
+
#: includes/class-freemius.php:5127, includes/class-freemius.php:5152, includes/class-freemius.php:21180
|
171 |
msgid "Unexpected API error. Please contact the %s's author with the following error."
|
172 |
msgstr ""
|
173 |
|
174 |
+
#: includes/class-freemius.php:5857
|
175 |
msgid "Premium %s version was successfully activated."
|
176 |
msgstr ""
|
177 |
|
178 |
+
#: includes/class-freemius.php:5869, includes/class-freemius.php:7774
|
179 |
msgctxt "Used to express elation, enthusiasm, or triumph (especially in electronic communication)."
|
180 |
msgid "W00t"
|
181 |
msgstr ""
|
182 |
|
183 |
+
#: includes/class-freemius.php:5884
|
184 |
msgid "You have a %s license."
|
185 |
msgstr ""
|
186 |
|
187 |
+
#: includes/class-freemius.php:5888, includes/class-freemius.php:16947, includes/class-freemius.php:16958, includes/class-freemius.php:20325, includes/class-freemius.php:20689, includes/class-freemius.php:20758, includes/class-freemius.php:20930
|
188 |
msgctxt "interjection expressing joy or exuberance"
|
189 |
msgid "Yee-haw"
|
190 |
msgstr ""
|
191 |
|
192 |
+
#: includes/class-freemius.php:6174
|
193 |
msgid "%s free trial was successfully cancelled. Since the add-on is premium only it was automatically deactivated. If you like to use it in the future, you'll have to purchase a license."
|
194 |
msgstr ""
|
195 |
|
196 |
+
#: includes/class-freemius.php:6178
|
197 |
msgid "%s is a premium only add-on. You have to purchase a license first before activating the plugin."
|
198 |
msgstr ""
|
199 |
|
200 |
+
#: includes/class-freemius.php:6187, templates/add-ons.php:186, templates/account/partials/addon.php:381
|
201 |
msgid "More information about %s"
|
202 |
msgstr ""
|
203 |
|
204 |
+
#: includes/class-freemius.php:6188
|
205 |
msgid "Purchase License"
|
206 |
msgstr ""
|
207 |
|
208 |
+
#: includes/class-freemius.php:7125, templates/connect.php:171
|
209 |
msgid "You should receive an activation email for %s to your mailbox at %s. Please make sure you click the activation button in that email to %s."
|
210 |
msgstr ""
|
211 |
|
212 |
+
#: includes/class-freemius.php:7129
|
213 |
msgid "start the trial"
|
214 |
msgstr ""
|
215 |
|
216 |
+
#: includes/class-freemius.php:7130, templates/connect.php:175
|
217 |
msgid "complete the install"
|
218 |
msgstr ""
|
219 |
|
220 |
+
#: includes/class-freemius.php:7249
|
221 |
msgid "You are just one step away - %s"
|
222 |
msgstr ""
|
223 |
|
224 |
+
#: includes/class-freemius.php:7252
|
225 |
msgctxt "%s - plugin name. As complete \"PluginX\" activation now"
|
226 |
msgid "Complete \"%s\" Activation Now"
|
227 |
msgstr ""
|
228 |
|
229 |
+
#: includes/class-freemius.php:7334
|
230 |
msgid "We made a few tweaks to the %s, %s"
|
231 |
msgstr ""
|
232 |
|
233 |
+
#: includes/class-freemius.php:7338
|
234 |
msgid "Opt in to make \"%s\" better!"
|
235 |
msgstr ""
|
236 |
|
237 |
+
#: includes/class-freemius.php:7773
|
238 |
msgid "The upgrade of %s was successfully completed."
|
239 |
msgstr ""
|
240 |
|
241 |
+
#: includes/class-freemius.php:10255, includes/class-fs-plugin-updater.php:1087, includes/class-fs-plugin-updater.php:1282, includes/class-fs-plugin-updater.php:1289, templates/auto-installation.php:32
|
242 |
msgid "Add-On"
|
243 |
msgstr ""
|
244 |
|
245 |
+
#: includes/class-freemius.php:10257, templates/account.php:394, templates/account.php:402, templates/debug.php:358, templates/debug.php:549
|
246 |
msgid "Plugin"
|
247 |
msgstr ""
|
248 |
|
249 |
+
#: includes/class-freemius.php:10258, templates/account.php:395, templates/account.php:403, templates/debug.php:358, templates/debug.php:549, templates/forms/deactivation/form.php:71
|
250 |
msgid "Theme"
|
251 |
msgstr ""
|
252 |
|
253 |
+
#: includes/class-freemius.php:13188
|
254 |
msgid "An unknown error has occurred while trying to toggle the license's white-label mode."
|
255 |
msgstr ""
|
256 |
|
257 |
+
#: includes/class-freemius.php:13202
|
258 |
msgid "Your %s license was flagged as white-labeled to hide sensitive information from the WP Admin (e.g. your email, license key, prices, billing address & invoices). If you ever wish to revert it back, you can easily do it through your %s. If this was a mistake you can also %s."
|
259 |
msgstr ""
|
260 |
|
261 |
+
#: includes/class-freemius.php:13207
|
262 |
msgid "User Dashboard"
|
263 |
msgstr ""
|
264 |
|
265 |
+
#: includes/class-freemius.php:13208
|
266 |
msgid "revert it now"
|
267 |
msgstr ""
|
268 |
|
269 |
+
#: includes/class-freemius.php:13266
|
270 |
msgid "An unknown error has occurred while trying to set the user's beta mode."
|
271 |
msgstr ""
|
272 |
|
273 |
+
#: includes/class-freemius.php:13339
|
274 |
msgid "Invalid new user ID or email address."
|
275 |
msgstr ""
|
276 |
|
277 |
+
#: includes/class-freemius.php:13369, includes/class-freemius.php:22259
|
278 |
msgid "Sorry, we could not complete the email update. Another user with the same email is already registered."
|
279 |
msgstr ""
|
280 |
|
281 |
+
#: includes/class-freemius.php:13370, includes/class-freemius.php:22260
|
282 |
msgid "If you would like to give up the ownership of the %s's account to %s click the Change Ownership button."
|
283 |
msgstr ""
|
284 |
|
285 |
+
#: includes/class-freemius.php:13377, includes/class-freemius.php:22267
|
286 |
msgid "Change Ownership"
|
287 |
msgstr ""
|
288 |
|
289 |
+
#: includes/class-freemius.php:13977
|
290 |
msgid "Invalid site details collection."
|
291 |
msgstr ""
|
292 |
|
293 |
+
#: includes/class-freemius.php:14097
|
294 |
msgid "We couldn't find your email address in the system, are you sure it's the right address?"
|
295 |
msgstr ""
|
296 |
|
297 |
+
#: includes/class-freemius.php:14099
|
298 |
msgid "We can't see any active licenses associated with that email address, are you sure it's the right address?"
|
299 |
msgstr ""
|
300 |
|
301 |
+
#: includes/class-freemius.php:14373
|
302 |
msgid "Account is pending activation."
|
303 |
msgstr ""
|
304 |
|
305 |
+
#: includes/class-freemius.php:14485, templates/forms/premium-versions-upgrade-handler.php:47
|
306 |
msgid "Buy a license now"
|
307 |
msgstr ""
|
308 |
|
309 |
+
#: includes/class-freemius.php:14497, templates/forms/premium-versions-upgrade-handler.php:46
|
310 |
msgid "Renew your license now"
|
311 |
msgstr ""
|
312 |
|
313 |
+
#: includes/class-freemius.php:14501
|
314 |
msgid "%s to access version %s security & feature updates, and support."
|
315 |
msgstr ""
|
316 |
|
317 |
+
#: includes/class-freemius.php:16929
|
318 |
msgid "%s activation was successfully completed."
|
319 |
msgstr ""
|
320 |
|
321 |
+
#: includes/class-freemius.php:16943
|
322 |
msgid "Your account was successfully activated with the %s plan."
|
323 |
msgstr ""
|
324 |
|
325 |
+
#: includes/class-freemius.php:16954, includes/class-freemius.php:20754
|
326 |
msgid "Your trial has been successfully started."
|
327 |
msgstr ""
|
328 |
|
329 |
+
#: includes/class-freemius.php:17540, includes/class-freemius.php:17645, includes/class-freemius.php:17820
|
330 |
msgid "Couldn't activate %s."
|
331 |
msgstr ""
|
332 |
|
333 |
+
#: includes/class-freemius.php:17541, includes/class-freemius.php:17646, includes/class-freemius.php:17821
|
334 |
msgid "Please contact us with the following message:"
|
335 |
msgstr ""
|
336 |
|
337 |
+
#: includes/class-freemius.php:17642, templates/forms/data-debug-mode.php:162
|
338 |
msgid "An unknown error has occurred."
|
339 |
msgstr ""
|
340 |
|
341 |
+
#: includes/class-freemius.php:18178, includes/class-freemius.php:23340
|
342 |
msgid "Upgrade"
|
343 |
msgstr ""
|
344 |
|
345 |
+
#: includes/class-freemius.php:18184
|
346 |
msgid "Start Trial"
|
347 |
msgstr ""
|
348 |
|
349 |
+
#: includes/class-freemius.php:18186
|
350 |
msgid "Pricing"
|
351 |
msgstr ""
|
352 |
|
353 |
+
#: includes/class-freemius.php:18266, includes/class-freemius.php:18268
|
354 |
msgid "Affiliation"
|
355 |
msgstr ""
|
356 |
|
357 |
+
#: includes/class-freemius.php:18296, includes/class-freemius.php:18298, templates/account.php:242, templates/debug.php:324
|
358 |
msgid "Account"
|
359 |
msgstr ""
|
360 |
|
361 |
+
#: includes/class-freemius.php:18312, includes/class-freemius.php:18314, includes/customizer/class-fs-customizer-support-section.php:60
|
362 |
msgid "Contact Us"
|
363 |
msgstr ""
|
364 |
|
365 |
+
#: includes/class-freemius.php:18325, includes/class-freemius.php:18327, includes/class-freemius.php:23354, templates/account.php:121, templates/account/partials/addon.php:44
|
366 |
msgid "Add-Ons"
|
367 |
msgstr ""
|
368 |
|
369 |
+
#: includes/class-freemius.php:18361
|
370 |
msgctxt "ASCII arrow left icon"
|
371 |
msgid "←"
|
372 |
msgstr ""
|
373 |
|
374 |
+
#: includes/class-freemius.php:18361
|
375 |
msgctxt "ASCII arrow right icon"
|
376 |
msgid "➤"
|
377 |
msgstr ""
|
378 |
|
379 |
+
#: includes/class-freemius.php:18363, templates/pricing.php:109
|
380 |
msgctxt "noun"
|
381 |
msgid "Pricing"
|
382 |
msgstr ""
|
383 |
|
384 |
+
#: includes/class-freemius.php:18576, includes/customizer/class-fs-customizer-support-section.php:67
|
385 |
msgid "Support Forum"
|
386 |
msgstr ""
|
387 |
|
388 |
+
#: includes/class-freemius.php:19550
|
389 |
msgid "Your email has been successfully verified - you are AWESOME!"
|
390 |
msgstr ""
|
391 |
|
392 |
+
#: includes/class-freemius.php:19551
|
393 |
msgctxt "a positive response"
|
394 |
msgid "Right on"
|
395 |
msgstr ""
|
396 |
|
397 |
+
#: includes/class-freemius.php:20057
|
398 |
msgid "seems like the key you entered doesn't match our records."
|
399 |
msgstr ""
|
400 |
|
401 |
+
#: includes/class-freemius.php:20081
|
402 |
msgid "Debug mode was successfully enabled and will be automatically disabled in 60 min. You can also disable it earlier by clicking the \"Stop Debug\" link."
|
403 |
msgstr ""
|
404 |
|
405 |
+
#: includes/class-freemius.php:20316
|
406 |
msgid "Your %s Add-on plan was successfully upgraded."
|
407 |
msgstr ""
|
408 |
|
409 |
+
#: includes/class-freemius.php:20318
|
410 |
msgid "%s Add-on was successfully purchased."
|
411 |
msgstr ""
|
412 |
|
413 |
+
#: includes/class-freemius.php:20321
|
414 |
msgid "Download the latest version"
|
415 |
msgstr ""
|
416 |
|
417 |
+
#: includes/class-freemius.php:20407
|
418 |
msgid "Your server is blocking the access to Freemius' API, which is crucial for %1$s synchronization. Please contact your host to whitelist %2$s"
|
419 |
msgstr ""
|
420 |
|
421 |
+
#: includes/class-freemius.php:20413, includes/class-freemius.php:20423, includes/class-freemius.php:20889, includes/class-freemius.php:20978
|
422 |
msgid "Error received from the server:"
|
423 |
msgstr ""
|
424 |
|
425 |
+
#: includes/class-freemius.php:20423
|
426 |
msgid "It seems like one of the authentication parameters is wrong. Update your Public Key, Secret Key & User ID, and try again."
|
427 |
msgstr ""
|
428 |
|
429 |
+
#: includes/class-freemius.php:20651, includes/class-freemius.php:20894, includes/class-freemius.php:20949, includes/class-freemius.php:21056
|
430 |
msgctxt "something somebody says when they are thinking about what you have just said."
|
431 |
msgid "Hmm"
|
432 |
msgstr ""
|
433 |
|
434 |
+
#: includes/class-freemius.php:20664
|
435 |
msgid "It looks like you are still on the %s plan. If you did upgrade or change your plan, it's probably an issue on our side - sorry."
|
436 |
msgstr ""
|
437 |
|
438 |
+
#: includes/class-freemius.php:20665, templates/account.php:123, templates/add-ons.php:250, templates/account/partials/addon.php:46
|
439 |
msgctxt "trial period"
|
440 |
msgid "Trial"
|
441 |
msgstr ""
|
442 |
|
443 |
+
#: includes/class-freemius.php:20670
|
444 |
msgid "I have upgraded my account but when I try to Sync the License, the plan remains %s."
|
445 |
msgstr ""
|
446 |
|
447 |
+
#: includes/class-freemius.php:20674, includes/class-freemius.php:20733
|
448 |
msgid "Please contact us here"
|
449 |
msgstr ""
|
450 |
|
451 |
+
#: includes/class-freemius.php:20685
|
452 |
msgid "Your plan was successfully activated."
|
453 |
msgstr ""
|
454 |
|
455 |
+
#: includes/class-freemius.php:20686
|
456 |
msgid "Your plan was successfully upgraded."
|
457 |
msgstr ""
|
458 |
|
459 |
+
#: includes/class-freemius.php:20703
|
460 |
msgid "Your plan was successfully changed to %s."
|
461 |
msgstr ""
|
462 |
|
463 |
+
#: includes/class-freemius.php:20719
|
464 |
msgid "Your license has expired. You can still continue using the free %s forever."
|
465 |
msgstr ""
|
466 |
|
467 |
+
#: includes/class-freemius.php:20721
|
468 |
msgid "Your license has expired. %1$sUpgrade now%2$s to continue using the %3$s without interruptions."
|
469 |
msgstr ""
|
470 |
|
471 |
+
#: includes/class-freemius.php:20729
|
472 |
msgid "Your license has been cancelled. If you think it's a mistake, please contact support."
|
473 |
msgstr ""
|
474 |
|
475 |
+
#: includes/class-freemius.php:20742
|
476 |
msgid "Your license has expired. You can still continue using all the %s features, but you'll need to renew your license to continue getting updates and support."
|
477 |
msgstr ""
|
478 |
|
479 |
+
#: includes/class-freemius.php:20768
|
480 |
msgid "Your free trial has expired. You can still continue using all our free features."
|
481 |
msgstr ""
|
482 |
|
483 |
+
#: includes/class-freemius.php:20770
|
484 |
msgid "Your free trial has expired. %1$sUpgrade now%2$s to continue using the %3$s without interruptions."
|
485 |
msgstr ""
|
486 |
|
487 |
+
#: includes/class-freemius.php:20885
|
488 |
msgid "It looks like the license could not be activated."
|
489 |
msgstr ""
|
490 |
|
491 |
+
#: includes/class-freemius.php:20927
|
492 |
msgid "Your license was successfully activated."
|
493 |
msgstr ""
|
494 |
|
495 |
+
#: includes/class-freemius.php:20953
|
496 |
msgid "It looks like your site currently doesn't have an active license."
|
497 |
msgstr ""
|
498 |
|
499 |
+
#: includes/class-freemius.php:20977
|
500 |
msgid "It looks like the license deactivation failed."
|
501 |
msgstr ""
|
502 |
|
503 |
+
#: includes/class-freemius.php:21006
|
504 |
msgid "Your %s license was successfully deactivated."
|
505 |
msgstr ""
|
506 |
|
507 |
+
#: includes/class-freemius.php:21007
|
508 |
msgid "Your license was successfully deactivated, you are back to the %s plan."
|
509 |
msgstr ""
|
510 |
|
511 |
+
#: includes/class-freemius.php:21010
|
512 |
msgid "O.K"
|
513 |
msgstr ""
|
514 |
|
515 |
+
#: includes/class-freemius.php:21063
|
516 |
msgid "Seems like we are having some temporary issue with your subscription cancellation. Please try again in few minutes."
|
517 |
msgstr ""
|
518 |
|
519 |
+
#: includes/class-freemius.php:21072
|
520 |
msgid "Your subscription was successfully cancelled. Your %s plan license will expire in %s."
|
521 |
msgstr ""
|
522 |
|
523 |
+
#: includes/class-freemius.php:21114
|
524 |
msgid "You are already running the %s in a trial mode."
|
525 |
msgstr ""
|
526 |
|
527 |
+
#: includes/class-freemius.php:21125
|
528 |
msgid "You already utilized a trial before."
|
529 |
msgstr ""
|
530 |
|
531 |
+
#: includes/class-freemius.php:21139
|
532 |
msgid "Plan %s do not exist, therefore, can't start a trial."
|
533 |
msgstr ""
|
534 |
|
535 |
+
#: includes/class-freemius.php:21150
|
536 |
msgid "Plan %s does not support a trial period."
|
537 |
msgstr ""
|
538 |
|
539 |
+
#: includes/class-freemius.php:21161
|
540 |
msgid "None of the %s's plans supports a trial period."
|
541 |
msgstr ""
|
542 |
|
543 |
+
#: includes/class-freemius.php:21211
|
544 |
msgid "It looks like you are not in trial mode anymore so there's nothing to cancel :)"
|
545 |
msgstr ""
|
546 |
|
547 |
+
#: includes/class-freemius.php:21247
|
548 |
msgid "Seems like we are having some temporary issue with your trial cancellation. Please try again in few minutes."
|
549 |
msgstr ""
|
550 |
|
551 |
+
#: includes/class-freemius.php:21266
|
552 |
msgid "Your %s free trial was successfully cancelled."
|
553 |
msgstr ""
|
554 |
|
555 |
+
#: includes/class-freemius.php:21582
|
556 |
msgid "Version %s was released."
|
557 |
msgstr ""
|
558 |
|
559 |
+
#: includes/class-freemius.php:21582
|
560 |
msgid "Please download %s."
|
561 |
msgstr ""
|
562 |
|
563 |
+
#: includes/class-freemius.php:21589
|
564 |
msgid "the latest %s version here"
|
565 |
msgstr ""
|
566 |
|
567 |
+
#: includes/class-freemius.php:21594
|
568 |
msgid "New"
|
569 |
msgstr ""
|
570 |
|
571 |
+
#: includes/class-freemius.php:21599
|
572 |
msgid "Seems like you got the latest release."
|
573 |
msgstr ""
|
574 |
|
575 |
+
#: includes/class-freemius.php:21600
|
576 |
msgid "You are all good!"
|
577 |
msgstr ""
|
578 |
|
579 |
+
#: includes/class-freemius.php:21903
|
580 |
msgid "Verification mail was just sent to %s. If you can't find it after 5 min, please check your spam box."
|
581 |
msgstr ""
|
582 |
|
583 |
+
#: includes/class-freemius.php:22043
|
584 |
msgid "Site successfully opted in."
|
585 |
msgstr ""
|
586 |
|
587 |
+
#: includes/class-freemius.php:22044, includes/class-freemius.php:23050
|
588 |
msgid "Awesome"
|
589 |
msgstr ""
|
590 |
|
591 |
+
#: includes/class-freemius.php:22060, templates/forms/optout.php:41
|
592 |
msgid "We appreciate your help in making the %s better by letting us track some usage data."
|
593 |
msgstr ""
|
594 |
|
595 |
+
#: includes/class-freemius.php:22061
|
596 |
msgid "Thank you!"
|
597 |
msgstr ""
|
598 |
|
599 |
+
#: includes/class-freemius.php:22068
|
600 |
msgid "We will no longer be sending any usage data of %s on %s to %s."
|
601 |
msgstr ""
|
602 |
|
603 |
+
#: includes/class-freemius.php:22226
|
604 |
msgid "Please check your mailbox, you should receive an email via %s to confirm the ownership change. From security reasons, you must confirm the change within the next 15 min. If you cannot find the email, please check your spam folder."
|
605 |
msgstr ""
|
606 |
|
607 |
+
#: includes/class-freemius.php:22232
|
608 |
msgid "Thanks for confirming the ownership change. An email was just sent to %s for final approval."
|
609 |
msgstr ""
|
610 |
|
611 |
+
#: includes/class-freemius.php:22237
|
612 |
msgid "%s is the new owner of the account."
|
613 |
msgstr ""
|
614 |
|
615 |
+
#: includes/class-freemius.php:22239
|
616 |
msgctxt "as congratulations"
|
617 |
msgid "Congrats"
|
618 |
msgstr ""
|
619 |
|
620 |
+
#: includes/class-freemius.php:22275
|
621 |
msgid "Your email was successfully updated. You should receive an email with confirmation instructions in few moments."
|
622 |
msgstr ""
|
623 |
|
624 |
+
#: includes/class-freemius.php:22287
|
625 |
msgid "Please provide your full name."
|
626 |
msgstr ""
|
627 |
|
628 |
+
#: includes/class-freemius.php:22292
|
629 |
msgid "Your name was successfully updated."
|
630 |
msgstr ""
|
631 |
|
632 |
+
#: includes/class-freemius.php:22353
|
633 |
msgid "You have successfully updated your %s."
|
634 |
msgstr ""
|
635 |
|
636 |
+
#: includes/class-freemius.php:22412
|
637 |
msgid "Is this your client's site? %s if you wish to hide sensitive info like your email, license key, prices, billing address & invoices from the WP Admin."
|
638 |
msgstr ""
|
639 |
|
640 |
+
#: includes/class-freemius.php:22415
|
641 |
msgid "Click here"
|
642 |
msgstr ""
|
643 |
|
644 |
+
#: includes/class-freemius.php:22513
|
645 |
msgid "Just letting you know that the add-ons information of %s is being pulled from an external server."
|
646 |
msgstr ""
|
647 |
|
648 |
+
#: includes/class-freemius.php:22514
|
649 |
msgctxt "advance notice of something that will need attention."
|
650 |
msgid "Heads up"
|
651 |
msgstr ""
|
652 |
|
653 |
+
#: includes/class-freemius.php:23090
|
654 |
msgctxt "exclamation"
|
655 |
msgid "Hey"
|
656 |
msgstr ""
|
657 |
|
658 |
+
#: includes/class-freemius.php:23090
|
659 |
msgid "How do you like %s so far? Test all our %s premium features with a %d-day free trial."
|
660 |
msgstr ""
|
661 |
|
662 |
+
#: includes/class-freemius.php:23098
|
663 |
msgid "No commitment for %s days - cancel anytime!"
|
664 |
msgstr ""
|
665 |
|
666 |
+
#: includes/class-freemius.php:23099
|
667 |
msgid "No credit card required"
|
668 |
msgstr ""
|
669 |
|
670 |
+
#: includes/class-freemius.php:23106, templates/forms/trial-start.php:53
|
671 |
msgctxt "call to action"
|
672 |
msgid "Start free trial"
|
673 |
msgstr ""
|
674 |
|
675 |
+
#: includes/class-freemius.php:23183
|
676 |
msgid "Hey there, did you know that %s has an affiliate program? If you like the %s you can become our ambassador and earn some cash!"
|
677 |
msgstr ""
|
678 |
|
679 |
+
#: includes/class-freemius.php:23192
|
680 |
msgid "Learn more"
|
681 |
msgstr ""
|
682 |
|
683 |
+
#: includes/class-freemius.php:23378, templates/account.php:558, templates/account.php:708, templates/connect.php:179, templates/connect.php:461, templates/forms/license-activation.php:27, templates/account/partials/addon.php:321
|
684 |
msgid "Activate License"
|
685 |
msgstr ""
|
686 |
|
687 |
+
#: includes/class-freemius.php:23379, templates/account.php:652, templates/account.php:707, templates/account/partials/addon.php:322, templates/account/partials/site.php:271
|
688 |
msgid "Change License"
|
689 |
msgstr ""
|
690 |
|
691 |
+
#: includes/class-freemius.php:23500, templates/account/partials/site.php:169
|
692 |
msgid "Opt Out"
|
693 |
msgstr ""
|
694 |
|
695 |
+
#: includes/class-freemius.php:23502, includes/class-freemius.php:23508, templates/account/partials/site.php:49, templates/account/partials/site.php:169
|
696 |
msgid "Opt In"
|
697 |
msgstr ""
|
698 |
|
699 |
+
#: includes/class-freemius.php:23738
|
700 |
msgid " The paid version of %1$s is already installed. Please activate it to start benefiting the %2$s features. %3$s"
|
701 |
msgstr ""
|
702 |
|
703 |
+
#: includes/class-freemius.php:23746
|
704 |
msgid "Activate %s features"
|
705 |
msgstr ""
|
706 |
|
707 |
+
#: includes/class-freemius.php:23759
|
708 |
msgid "Please follow these steps to complete the upgrade"
|
709 |
msgstr ""
|
710 |
|
711 |
+
#: includes/class-freemius.php:23763
|
712 |
msgid "Download the latest %s version"
|
713 |
msgstr ""
|
714 |
|
715 |
+
#: includes/class-freemius.php:23767
|
716 |
msgid "Upload and activate the downloaded version"
|
717 |
msgstr ""
|
718 |
|
719 |
+
#: includes/class-freemius.php:23769
|
720 |
msgid "How to upload and activate?"
|
721 |
msgstr ""
|
722 |
|
723 |
+
#: includes/class-freemius.php:23903
|
724 |
msgid "%sClick here%s to choose the sites where you'd like to activate the license on."
|
725 |
msgstr ""
|
726 |
|
727 |
+
#: includes/class-freemius.php:24072
|
728 |
msgid "Auto installation only works for opted-in users."
|
729 |
msgstr ""
|
730 |
|
731 |
+
#: includes/class-freemius.php:24082, includes/class-freemius.php:24115, includes/class-fs-plugin-updater.php:1261, includes/class-fs-plugin-updater.php:1275
|
732 |
msgid "Invalid module ID."
|
733 |
msgstr ""
|
734 |
|
735 |
+
#: includes/class-freemius.php:24091, includes/class-fs-plugin-updater.php:1297
|
736 |
msgid "Premium version already active."
|
737 |
msgstr ""
|
738 |
|
739 |
+
#: includes/class-freemius.php:24098
|
740 |
msgid "You do not have a valid license to access the premium version."
|
741 |
msgstr ""
|
742 |
|
743 |
+
#: includes/class-freemius.php:24105
|
744 |
msgid "Plugin is a \"Serviceware\" which means it does not have a premium code version."
|
745 |
msgstr ""
|
746 |
|
747 |
+
#: includes/class-freemius.php:24123, includes/class-fs-plugin-updater.php:1296
|
748 |
msgid "Premium add-on version already installed."
|
749 |
msgstr ""
|
750 |
|
751 |
+
#: includes/class-freemius.php:24473
|
752 |
msgid "View paid features"
|
753 |
msgstr ""
|
754 |
|
755 |
+
#: includes/class-freemius.php:24795
|
756 |
msgid "Thank you so much for using %s and its add-ons!"
|
757 |
msgstr ""
|
758 |
|
759 |
+
#: includes/class-freemius.php:24796
|
760 |
msgid "Thank you so much for using %s!"
|
761 |
msgstr ""
|
762 |
|
763 |
+
#: includes/class-freemius.php:24802
|
764 |
msgid "You've already opted-in to our usage-tracking, which helps us keep improving the %s."
|
765 |
msgstr ""
|
766 |
|
767 |
+
#: includes/class-freemius.php:24806
|
768 |
msgid "Thank you so much for using our products!"
|
769 |
msgstr ""
|
770 |
|
771 |
+
#: includes/class-freemius.php:24807
|
772 |
msgid "You've already opted-in to our usage-tracking, which helps us keep improving them."
|
773 |
msgstr ""
|
774 |
|
775 |
+
#: includes/class-freemius.php:24826
|
776 |
msgid "%s and its add-ons"
|
777 |
msgstr ""
|
778 |
|
779 |
+
#: includes/class-freemius.php:24835
|
780 |
msgid "Products"
|
781 |
msgstr ""
|
782 |
|
783 |
+
#: includes/class-freemius.php:24842, templates/connect.php:275
|
784 |
msgid "Yes"
|
785 |
msgstr ""
|
786 |
|
787 |
+
#: includes/class-freemius.php:24843, templates/connect.php:276
|
788 |
msgid "send me security & feature updates, educational content and offers."
|
789 |
msgstr ""
|
790 |
|
791 |
+
#: includes/class-freemius.php:24844, templates/connect.php:281
|
792 |
msgid "No"
|
793 |
msgstr ""
|
794 |
|
795 |
+
#: includes/class-freemius.php:24846, templates/connect.php:283
|
796 |
msgid "do %sNOT%s send me security & feature updates, educational content and offers."
|
797 |
msgstr ""
|
798 |
|
799 |
+
#: includes/class-freemius.php:24856
|
800 |
msgid "Due to the new %sEU General Data Protection Regulation (GDPR)%s compliance requirements it is required that you provide your explicit consent, again, confirming that you are onboard :-)"
|
801 |
msgstr ""
|
802 |
|
803 |
+
#: includes/class-freemius.php:24858, templates/connect.php:290
|
804 |
msgid "Please let us know if you'd like us to contact you for security & feature updates, educational content, and occasional offers:"
|
805 |
msgstr ""
|
806 |
|
807 |
+
#: includes/class-freemius.php:25140
|
808 |
msgid "License key is empty."
|
809 |
msgstr ""
|
810 |
|
832 |
msgid "Important Upgrade Notice:"
|
833 |
msgstr ""
|
834 |
|
835 |
+
#: includes/class-fs-plugin-updater.php:1326
|
836 |
msgid "Installing plugin: %s"
|
837 |
msgstr ""
|
838 |
|
839 |
+
#: includes/class-fs-plugin-updater.php:1367
|
840 |
msgid "Unable to connect to the filesystem. Please confirm your credentials."
|
841 |
msgstr ""
|
842 |
|
843 |
+
#: includes/class-fs-plugin-updater.php:1549
|
844 |
msgid "The remote plugin package does not contain a folder with the desired slug and renaming did not work."
|
845 |
msgstr ""
|
846 |
|
861 |
msgid "Install Free Version Update Now"
|
862 |
msgstr ""
|
863 |
|
864 |
+
#: includes/fs-plugin-info-dialog.php:745, templates/account.php:641
|
865 |
msgid "Install Update Now"
|
866 |
msgstr ""
|
867 |
|
878 |
msgid "Download Latest Free Version"
|
879 |
msgstr ""
|
880 |
|
881 |
+
#: includes/fs-plugin-info-dialog.php:772, templates/account.php:101, templates/add-ons.php:37, templates/account/partials/addon.php:25
|
882 |
msgctxt "as download latest version"
|
883 |
msgid "Download Latest"
|
884 |
msgstr ""
|
887 |
msgid "Activate this add-on"
|
888 |
msgstr ""
|
889 |
|
890 |
+
#: includes/fs-plugin-info-dialog.php:789, templates/connect.php:458
|
891 |
msgid "Activate Free Version"
|
892 |
msgstr ""
|
893 |
|
894 |
+
#: includes/fs-plugin-info-dialog.php:790, templates/account.php:125, templates/add-ons.php:330, templates/account/partials/addon.php:48
|
895 |
msgid "Activate"
|
896 |
msgstr ""
|
897 |
|
1020 |
msgid "Details"
|
1021 |
msgstr ""
|
1022 |
|
1023 |
+
#: includes/fs-plugin-info-dialog.php:1318, templates/account.php:112, templates/debug.php:201, templates/debug.php:238, templates/debug.php:455, templates/account/partials/addon.php:36
|
1024 |
msgctxt "product version"
|
1025 |
msgid "Version"
|
1026 |
msgstr ""
|
1034 |
msgid "Last Updated"
|
1035 |
msgstr ""
|
1036 |
|
1037 |
+
#: includes/fs-plugin-info-dialog.php:1337, templates/account.php:527
|
1038 |
msgctxt "x-ago"
|
1039 |
msgid "%s ago"
|
1040 |
msgstr ""
|
1143 |
msgid "Latest Free Version Installed"
|
1144 |
msgstr ""
|
1145 |
|
1146 |
+
#: templates/account.php:102, templates/forms/subscription-cancellation.php:96, templates/account/partials/addon.php:26, templates/account/partials/site.php:311
|
1147 |
msgid "Downgrading your plan"
|
1148 |
msgstr ""
|
1149 |
|
1150 |
+
#: templates/account.php:103, templates/forms/subscription-cancellation.php:97, templates/account/partials/addon.php:27, templates/account/partials/site.php:312
|
1151 |
msgid "Cancelling the subscription"
|
1152 |
msgstr ""
|
1153 |
|
1154 |
#. translators: %1$s: Either 'Downgrading your plan' or 'Cancelling the subscription'
|
1155 |
+
#: templates/account.php:105, templates/forms/subscription-cancellation.php:99, templates/account/partials/site.php:314
|
1156 |
msgid "%1$s will immediately stop all future recurring payments and your %2$s plan license will expire in %3$s."
|
1157 |
msgstr ""
|
1158 |
|
1159 |
+
#: templates/account.php:106, templates/forms/subscription-cancellation.php:100, templates/account/partials/addon.php:30, templates/account/partials/site.php:315
|
1160 |
msgid "Please note that we will not be able to grandfather outdated pricing for renewals/new subscriptions after a cancellation. If you choose to renew the subscription manually in the future, after a price increase, which typically occurs once a year, you will be charged the updated price."
|
1161 |
msgstr ""
|
1162 |
|
1163 |
+
#: templates/account.php:107, templates/forms/subscription-cancellation.php:106, templates/account/partials/addon.php:31
|
1164 |
msgid "Cancelling the trial will immediately block access to all premium features. Are you sure?"
|
1165 |
msgstr ""
|
1166 |
|
1167 |
+
#: templates/account.php:108, templates/forms/subscription-cancellation.php:101, templates/account/partials/addon.php:32, templates/account/partials/site.php:316
|
1168 |
msgid "You can still enjoy all %s features but you will not have access to %s security & feature updates, nor support."
|
1169 |
msgstr ""
|
1170 |
|
1171 |
+
#: templates/account.php:109, templates/forms/subscription-cancellation.php:102, templates/account/partials/addon.php:33, templates/account/partials/site.php:317
|
1172 |
msgid "Once your license expires you can still use the Free version but you will NOT have access to the %s features."
|
1173 |
msgstr ""
|
1174 |
|
1175 |
#. translators: %s: Plan title (e.g. "Professional")
|
1176 |
+
#: templates/account.php:111, templates/account/partials/activate-license-button.php:31, templates/account/partials/addon.php:35
|
1177 |
msgid "Activate %s Plan"
|
1178 |
msgstr ""
|
1179 |
|
1180 |
#. translators: %s: Time period (e.g. Auto renews in "2 months")
|
1181 |
+
#: templates/account.php:114, templates/account/partials/addon.php:38, templates/account/partials/site.php:291
|
1182 |
msgid "Auto renews in %s"
|
1183 |
msgstr ""
|
1184 |
|
1185 |
#. translators: %s: Time period (e.g. Expires in "2 months")
|
1186 |
+
#: templates/account.php:116, templates/account/partials/addon.php:40, templates/account/partials/site.php:293
|
1187 |
msgid "Expires in %s"
|
1188 |
msgstr ""
|
1189 |
|
1190 |
+
#: templates/account.php:117
|
1191 |
msgctxt "as synchronize license"
|
1192 |
msgid "Sync License"
|
1193 |
msgstr ""
|
1194 |
|
1195 |
+
#: templates/account.php:118, templates/account/partials/addon.php:41
|
1196 |
msgid "Cancel Trial"
|
1197 |
msgstr ""
|
1198 |
|
1199 |
+
#: templates/account.php:119, templates/account/partials/addon.php:42
|
1200 |
msgid "Change Plan"
|
1201 |
msgstr ""
|
1202 |
|
1203 |
+
#: templates/account.php:120, templates/account/partials/addon.php:43
|
1204 |
msgctxt "verb"
|
1205 |
msgid "Upgrade"
|
1206 |
msgstr ""
|
1207 |
|
1208 |
+
#: templates/account.php:122, templates/account/partials/addon.php:45, templates/account/partials/site.php:318
|
1209 |
msgctxt "verb"
|
1210 |
msgid "Downgrade"
|
1211 |
msgstr ""
|
1212 |
|
1213 |
+
#: templates/account.php:124, templates/add-ons.php:246, templates/plugin-info/features.php:72, templates/account/partials/addon.php:47, templates/account/partials/site.php:33
|
1214 |
msgid "Free"
|
1215 |
msgstr ""
|
1216 |
|
1217 |
+
#: templates/account.php:126, templates/debug.php:371, includes/customizer/class-fs-customizer-upsell-control.php:110, templates/account/partials/addon.php:49
|
1218 |
msgctxt "as product pricing plan"
|
1219 |
msgid "Plan"
|
1220 |
msgstr ""
|
1221 |
|
1222 |
+
#: templates/account.php:127
|
1223 |
msgid "Bundle Plan"
|
1224 |
msgstr ""
|
1225 |
|
1226 |
+
#: templates/account.php:250
|
1227 |
msgid "Free Trial"
|
1228 |
msgstr ""
|
1229 |
|
1230 |
+
#: templates/account.php:261
|
1231 |
msgid "Account Details"
|
1232 |
msgstr ""
|
1233 |
|
1234 |
+
#: templates/account.php:268, templates/forms/data-debug-mode.php:33
|
1235 |
msgid "Start Debug"
|
1236 |
msgstr ""
|
1237 |
|
1238 |
+
#: templates/account.php:270
|
1239 |
msgid "Stop Debug"
|
1240 |
msgstr ""
|
1241 |
|
1242 |
+
#: templates/account.php:277
|
1243 |
msgid "Billing & Invoices"
|
1244 |
msgstr ""
|
1245 |
|
1246 |
+
#: templates/account.php:288
|
1247 |
msgid "Deleting the account will automatically deactivate your %s plan license so you can use it on other sites. If you want to terminate the recurring payments as well, click the \"Cancel\" button, and first \"Downgrade\" your account. Are you sure you would like to continue with the deletion?"
|
1248 |
msgstr ""
|
1249 |
|
1250 |
+
#: templates/account.php:290
|
1251 |
msgid "Deletion is not temporary. Only delete if you no longer want to use this %s anymore. Are you sure you would like to continue with the deletion?"
|
1252 |
msgstr ""
|
1253 |
|
1254 |
+
#: templates/account.php:293
|
1255 |
msgid "Delete Account"
|
1256 |
msgstr ""
|
1257 |
|
1258 |
+
#: templates/account.php:305, templates/account/partials/addon.php:231, templates/account/partials/deactivate-license-button.php:35
|
1259 |
msgid "Deactivate License"
|
1260 |
msgstr ""
|
1261 |
|
1262 |
+
#: templates/account.php:328, templates/forms/subscription-cancellation.php:125
|
1263 |
msgid "Are you sure you want to proceed?"
|
1264 |
msgstr ""
|
1265 |
|
1266 |
+
#: templates/account.php:328, templates/account/partials/addon.php:255
|
1267 |
msgid "Cancel Subscription"
|
1268 |
msgstr ""
|
1269 |
|
1270 |
+
#: templates/account.php:357, templates/account/partials/addon.php:340
|
1271 |
msgctxt "as synchronize"
|
1272 |
msgid "Sync"
|
1273 |
msgstr ""
|
1274 |
|
1275 |
+
#: templates/account.php:372, templates/debug.php:505
|
1276 |
msgid "Name"
|
1277 |
msgstr ""
|
1278 |
|
1279 |
+
#: templates/account.php:378, templates/debug.php:506
|
1280 |
msgid "Email"
|
1281 |
msgstr ""
|
1282 |
|
1283 |
+
#: templates/account.php:385, templates/debug.php:369, templates/debug.php:555
|
1284 |
msgid "User ID"
|
1285 |
msgstr ""
|
1286 |
|
1287 |
+
#: templates/account.php:403, templates/account.php:721, templates/account.php:754, templates/debug.php:236, templates/debug.php:363, templates/debug.php:452, templates/debug.php:504, templates/debug.php:553, templates/debug.php:632, templates/account/payments.php:35, templates/debug/logger.php:21
|
1288 |
msgid "ID"
|
1289 |
msgstr ""
|
1290 |
|
1291 |
+
#: templates/account.php:410
|
1292 |
msgid "Site ID"
|
1293 |
msgstr ""
|
1294 |
|
1295 |
+
#: templates/account.php:413
|
1296 |
msgid "No ID"
|
1297 |
msgstr ""
|
1298 |
|
1299 |
+
#: templates/account.php:418, templates/debug.php:243, templates/debug.php:372, templates/debug.php:456, templates/debug.php:508, templates/account/partials/site.php:227
|
1300 |
msgid "Public Key"
|
1301 |
msgstr ""
|
1302 |
|
1303 |
+
#: templates/account.php:424, templates/debug.php:373, templates/debug.php:457, templates/debug.php:509, templates/account/partials/site.php:239
|
1304 |
msgid "Secret Key"
|
1305 |
msgstr ""
|
1306 |
|
1307 |
+
#: templates/account.php:427
|
1308 |
msgctxt "as secret encryption key missing"
|
1309 |
msgid "No Secret"
|
1310 |
msgstr ""
|
1311 |
|
1312 |
+
#: templates/account.php:454, templates/account/partials/site.php:120, templates/account/partials/site.php:122
|
1313 |
msgid "Trial"
|
1314 |
msgstr ""
|
1315 |
|
1316 |
+
#: templates/account.php:481, templates/debug.php:561, templates/account/partials/site.php:260
|
1317 |
msgid "License Key"
|
1318 |
msgstr ""
|
1319 |
|
1320 |
+
#: templates/account.php:512
|
1321 |
msgid "Join the Beta program"
|
1322 |
msgstr ""
|
1323 |
|
1324 |
+
#: templates/account.php:518
|
1325 |
msgid "not verified"
|
1326 |
msgstr ""
|
1327 |
|
1328 |
+
#: templates/account.php:527, templates/account/partials/addon.php:190
|
1329 |
msgid "Expired"
|
1330 |
msgstr ""
|
1331 |
|
1332 |
+
#: templates/account.php:587
|
1333 |
msgid "Premium version"
|
1334 |
msgstr ""
|
1335 |
|
1336 |
+
#: templates/account.php:589
|
1337 |
msgid "Free version"
|
1338 |
msgstr ""
|
1339 |
|
1340 |
+
#: templates/account.php:601
|
1341 |
msgid "Verify Email"
|
1342 |
msgstr ""
|
1343 |
|
1344 |
+
#: templates/account.php:615
|
1345 |
msgid "Download %s Version"
|
1346 |
msgstr ""
|
1347 |
|
1348 |
+
#: templates/account.php:631
|
1349 |
msgid "Download Paid Version"
|
1350 |
msgstr ""
|
1351 |
|
1352 |
+
#: templates/account.php:649, templates/account.php:892, templates/account/partials/site.php:248, templates/account/partials/site.php:270
|
1353 |
msgctxt "verb"
|
1354 |
msgid "Show"
|
1355 |
msgstr ""
|
1356 |
|
1357 |
+
#: templates/account.php:664
|
1358 |
msgid "What is your %s?"
|
1359 |
msgstr ""
|
1360 |
|
1361 |
+
#: templates/account.php:672, templates/account/billing.php:21
|
1362 |
msgctxt "verb"
|
1363 |
msgid "Edit"
|
1364 |
msgstr ""
|
1365 |
|
1366 |
+
#: templates/account.php:676, templates/forms/user-change.php:27
|
1367 |
msgid "Change User"
|
1368 |
msgstr ""
|
1369 |
|
1370 |
+
#: templates/account.php:700
|
1371 |
msgid "Sites"
|
1372 |
msgstr ""
|
1373 |
|
1374 |
+
#: templates/account.php:713
|
1375 |
msgid "Search by address"
|
1376 |
msgstr ""
|
1377 |
|
1378 |
+
#: templates/account.php:722, templates/debug.php:366
|
1379 |
msgid "Address"
|
1380 |
msgstr ""
|
1381 |
|
1382 |
+
#: templates/account.php:723
|
1383 |
msgid "License"
|
1384 |
msgstr ""
|
1385 |
|
1386 |
+
#: templates/account.php:724
|
1387 |
msgid "Plan"
|
1388 |
msgstr ""
|
1389 |
|
1390 |
+
#: templates/account.php:757
|
1391 |
msgctxt "as software license"
|
1392 |
msgid "License"
|
1393 |
msgstr ""
|
1394 |
|
1395 |
+
#: templates/account.php:886
|
1396 |
msgctxt "verb"
|
1397 |
msgid "Hide"
|
1398 |
msgstr ""
|
1399 |
|
1400 |
+
#: templates/account.php:908, templates/forms/data-debug-mode.php:31
|
1401 |
msgid "Processing"
|
1402 |
msgstr ""
|
1403 |
|
1404 |
+
#: templates/account.php:911
|
1405 |
msgid "Get updates for bleeding edge Beta versions of %s."
|
1406 |
msgstr ""
|
1407 |
|
1408 |
+
#: templates/account.php:969
|
1409 |
msgid "Cancelling %s"
|
1410 |
msgstr ""
|
1411 |
|
1412 |
+
#: templates/account.php:969, templates/account.php:986, templates/forms/subscription-cancellation.php:27, templates/forms/deactivation/form.php:133
|
1413 |
msgid "trial"
|
1414 |
msgstr ""
|
1415 |
|
1416 |
+
#: templates/account.php:984, templates/forms/deactivation/form.php:150
|
1417 |
msgid "Cancelling %s..."
|
1418 |
msgstr ""
|
1419 |
|
1420 |
+
#: templates/account.php:987, templates/forms/subscription-cancellation.php:28, templates/forms/deactivation/form.php:134
|
1421 |
msgid "subscription"
|
1422 |
msgstr ""
|
1423 |
|
1424 |
+
#: templates/account.php:1001
|
1425 |
msgid "Deactivating your license will block all premium features, but will enable activating the license on another site. Are you sure you want to proceed?"
|
1426 |
msgstr ""
|
1427 |
|
1428 |
+
#: templates/account.php:1075
|
1429 |
msgid "Disabling white-label mode"
|
1430 |
msgstr ""
|
1431 |
|
1432 |
+
#: templates/account.php:1076
|
1433 |
msgid "Enabling white-label mode"
|
1434 |
msgstr ""
|
1435 |
|
1455 |
msgid "Installed"
|
1456 |
msgstr ""
|
1457 |
|
1458 |
+
#: templates/admin-notice.php:13, templates/forms/license-activation.php:222, templates/forms/resend-key.php:77
|
1459 |
msgctxt "as close a window"
|
1460 |
msgid "Dismiss"
|
1461 |
msgstr ""
|
1510 |
msgid "Agree & Activate License"
|
1511 |
msgstr ""
|
1512 |
|
1513 |
+
#: templates/connect.php:184
|
1514 |
+
msgid "Welcome to %s! To get started, please enter your license key:"
|
1515 |
msgstr ""
|
1516 |
|
1517 |
+
#: templates/connect.php:191
|
1518 |
msgid "Never miss an important update - opt in to our security & feature updates notifications, educational content, offers, and non-sensitive diagnostic tracking with %4$s."
|
1519 |
msgstr ""
|
1520 |
|
1521 |
+
#: templates/connect.php:192
|
1522 |
msgid "Never miss an important update - opt in to our security and feature updates notifications, and non-sensitive diagnostic tracking with %4$s."
|
1523 |
msgstr ""
|
1524 |
|
1525 |
+
#: templates/connect.php:198
|
1526 |
msgid "Never miss an important update - opt in to our security & feature updates notifications, educational content, offers, and non-sensitive diagnostic tracking with %4$s. If you skip this, that's okay! %1$s will still work just fine."
|
1527 |
msgstr ""
|
1528 |
|
1529 |
+
#: templates/connect.php:199
|
1530 |
msgid "Never miss an important update - opt in to our security & feature updates notifications, and non-sensitive diagnostic tracking with %4$s. If you skip this, that's okay! %1$s will still work just fine."
|
1531 |
msgstr ""
|
1532 |
|
1533 |
+
#: templates/connect.php:233
|
1534 |
msgid "We're excited to introduce the Freemius network-level integration."
|
1535 |
msgstr ""
|
1536 |
|
1537 |
+
#: templates/connect.php:236
|
1538 |
msgid "During the update process we detected %d site(s) that are still pending license activation."
|
1539 |
msgstr ""
|
1540 |
|
1541 |
+
#: templates/connect.php:238
|
1542 |
msgid "If you'd like to use the %s on those sites, please enter your license key below and click the activation button."
|
1543 |
msgstr ""
|
1544 |
|
1545 |
+
#: templates/connect.php:240
|
1546 |
msgid "%s's paid features"
|
1547 |
msgstr ""
|
1548 |
|
1549 |
+
#: templates/connect.php:245
|
1550 |
msgid "Alternatively, you can skip it for now and activate the license later, in your %s's network-level Account page."
|
1551 |
msgstr ""
|
1552 |
|
1553 |
+
#: templates/connect.php:247
|
1554 |
msgid "During the update process we detected %s site(s) in the network that are still pending your attention."
|
1555 |
msgstr ""
|
1556 |
|
1557 |
+
#: templates/connect.php:256, templates/forms/data-debug-mode.php:35, templates/forms/license-activation.php:49
|
1558 |
msgid "License key"
|
1559 |
msgstr ""
|
1560 |
|
1561 |
+
#: templates/connect.php:259, templates/forms/license-activation.php:22
|
1562 |
msgid "Can't find your license key?"
|
1563 |
msgstr ""
|
1564 |
|
1565 |
+
#: templates/connect.php:318, templates/connect.php:700, templates/forms/deactivation/retry-skip.php:20
|
1566 |
msgctxt "verb"
|
1567 |
msgid "Skip"
|
1568 |
msgstr ""
|
1569 |
|
1570 |
+
#: templates/connect.php:321
|
1571 |
msgid "Delegate to Site Admins"
|
1572 |
msgstr ""
|
1573 |
|
1574 |
+
#: templates/connect.php:321
|
1575 |
msgid "If you click it, this decision will be delegated to the sites administrators."
|
1576 |
msgstr ""
|
1577 |
|
1578 |
+
#: templates/connect.php:346
|
1579 |
+
msgid "License issues?"
|
1580 |
+
msgstr ""
|
1581 |
+
|
1582 |
+
#: templates/connect.php:362
|
1583 |
msgid "Your Profile Overview"
|
1584 |
msgstr ""
|
1585 |
|
1586 |
+
#: templates/connect.php:363
|
1587 |
msgid "Name and email address"
|
1588 |
msgstr ""
|
1589 |
|
1590 |
+
#: templates/connect.php:370
|
1591 |
+
msgid "So you can manage and control your license remotely from the User Dashboard."
|
1592 |
+
msgstr ""
|
1593 |
+
|
1594 |
+
#: templates/connect.php:371
|
1595 |
msgid "Your Site Overview"
|
1596 |
msgstr ""
|
1597 |
|
1598 |
+
#: templates/connect.php:372
|
1599 |
msgid "Site URL, WP version, PHP info"
|
1600 |
msgstr ""
|
1601 |
|
1603 |
msgid "Admin Notices"
|
1604 |
msgstr ""
|
1605 |
|
1606 |
+
#: templates/connect.php:380, templates/connect.php:398
|
1607 |
msgid "Updates, announcements, marketing, no spam"
|
1608 |
msgstr ""
|
1609 |
|
1610 |
+
#: templates/connect.php:387
|
1611 |
+
msgid "So you can reuse the license when the %s is no longer active."
|
1612 |
+
msgstr ""
|
1613 |
+
|
1614 |
+
#: templates/connect.php:388
|
1615 |
+
msgid "Current %s Status"
|
1616 |
msgstr ""
|
1617 |
|
1618 |
+
#: templates/connect.php:389
|
1619 |
+
msgid "Active, deactivated, or uninstalled"
|
1620 |
msgstr ""
|
1621 |
|
1622 |
+
#: templates/connect.php:397
|
1623 |
msgid "Newsletter"
|
1624 |
msgstr ""
|
1625 |
|
1626 |
+
#: templates/connect.php:405
|
1627 |
msgid "Plugins & Themes"
|
1628 |
msgstr ""
|
1629 |
|
1630 |
+
#: templates/connect.php:405
|
1631 |
+
msgid "optional"
|
1632 |
+
msgstr ""
|
1633 |
+
|
1634 |
+
#: templates/connect.php:406
|
1635 |
+
msgid "To help us troubleshoot any potential issues that may arise from other plugin or theme conflicts."
|
1636 |
+
msgstr ""
|
1637 |
+
|
1638 |
+
#: templates/connect.php:407
|
1639 |
msgid "Title, slug, version, and is active"
|
1640 |
msgstr ""
|
1641 |
|
1642 |
+
#: templates/connect.php:424
|
1643 |
+
msgid "The %1$s will periodically send %2$s to %3$s for security & feature updates delivery, and license management."
|
1644 |
msgstr ""
|
1645 |
|
1646 |
#: templates/connect.php:426
|
1647 |
+
msgid "diagnostic data"
|
1648 |
+
msgstr ""
|
1649 |
+
|
1650 |
+
#: templates/connect.php:427
|
1651 |
+
msgid "Freemius is our licensing and software updates engine"
|
1652 |
+
msgstr ""
|
1653 |
+
|
1654 |
+
#: templates/connect.php:430
|
1655 |
msgid "What permissions are being granted?"
|
1656 |
msgstr ""
|
1657 |
|
1658 |
+
#: templates/connect.php:457
|
1659 |
msgid "Don't have a license key?"
|
1660 |
msgstr ""
|
1661 |
|
1662 |
+
#: templates/connect.php:460
|
1663 |
msgid "Have a license key?"
|
1664 |
msgstr ""
|
1665 |
|
1666 |
+
#: templates/connect.php:468
|
1667 |
msgid "Privacy Policy"
|
1668 |
msgstr ""
|
1669 |
|
1670 |
+
#: templates/connect.php:470
|
1671 |
msgid "License Agreement"
|
1672 |
msgstr ""
|
1673 |
|
1674 |
+
#: templates/connect.php:470
|
1675 |
msgid "Terms of Service"
|
1676 |
msgstr ""
|
1677 |
|
1678 |
+
#: templates/connect.php:866
|
1679 |
msgctxt "as in the process of sending an email"
|
1680 |
msgid "Sending email"
|
1681 |
msgstr ""
|
1682 |
|
1683 |
+
#: templates/connect.php:867
|
1684 |
msgctxt "as activating plugin"
|
1685 |
msgid "Activating"
|
1686 |
msgstr ""
|
2269 |
msgid "Update License"
|
2270 |
msgstr ""
|
2271 |
|
2272 |
+
#: templates/forms/license-activation.php:41
|
2273 |
+
msgid "The %1$s will be periodically sending data to %2$s to check for security and feature updates, and verify the validity of your license."
|
2274 |
+
msgstr ""
|
2275 |
+
|
2276 |
+
#: templates/forms/license-activation.php:183
|
2277 |
msgid "Associate with the license owner's account."
|
2278 |
msgstr ""
|
2279 |
|
freemius/package.json
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
"author": "Freemius, Inc.",
|
5 |
"license": "GPL-3.0",
|
6 |
"homepage": "https://freemius.com",
|
7 |
-
"version": "2.4.
|
8 |
"main": "gulpfile.js",
|
9 |
"dependencies": {},
|
10 |
"scripts": {
|
4 |
"author": "Freemius, Inc.",
|
5 |
"license": "GPL-3.0",
|
6 |
"homepage": "https://freemius.com",
|
7 |
+
"version": "2.4.2",
|
8 |
"main": "gulpfile.js",
|
9 |
"dependencies": {},
|
10 |
"scripts": {
|
freemius/start.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
*
|
16 |
* @var string
|
17 |
*/
|
18 |
-
$this_sdk_version = '2.4.
|
19 |
|
20 |
#region SDK Selection Logic --------------------------------------------------------------------
|
21 |
|
@@ -512,7 +512,7 @@
|
|
512 |
}
|
513 |
|
514 |
/**
|
515 |
-
* @param array <string,string> $module Plugin or Theme details.
|
516 |
*
|
517 |
* @return Freemius
|
518 |
* @throws Freemius_Exception
|
@@ -527,4 +527,4 @@
|
|
527 |
function fs_dump_log() {
|
528 |
FS_Logger::dump();
|
529 |
}
|
530 |
-
}
|
15 |
*
|
16 |
* @var string
|
17 |
*/
|
18 |
+
$this_sdk_version = '2.4.2';
|
19 |
|
20 |
#region SDK Selection Logic --------------------------------------------------------------------
|
21 |
|
512 |
}
|
513 |
|
514 |
/**
|
515 |
+
* @param array <string,string|bool|array> $module Plugin or Theme details.
|
516 |
*
|
517 |
* @return Freemius
|
518 |
* @throws Freemius_Exception
|
527 |
function fs_dump_log() {
|
528 |
FS_Logger::dump();
|
529 |
}
|
530 |
+
}
|
freemius/templates/account.php
CHANGED
@@ -21,7 +21,9 @@
|
|
21 |
/**
|
22 |
* @var FS_Plugin_Tag $update
|
23 |
*/
|
24 |
-
$update = $fs->
|
|
|
|
|
25 |
|
26 |
if ( is_object($update) ) {
|
27 |
/**
|
@@ -433,11 +435,11 @@
|
|
433 |
'value' => $fs->get_plugin_version()
|
434 |
);
|
435 |
|
436 |
-
if ( $is_premium && ! $is_whitelabeled ) {
|
437 |
$profile[] = array(
|
438 |
'id' => 'beta_program',
|
439 |
'title' => '',
|
440 |
-
'value' => $
|
441 |
);
|
442 |
}
|
443 |
|
21 |
/**
|
22 |
* @var FS_Plugin_Tag $update
|
23 |
*/
|
24 |
+
$update = $fs->has_release_on_freemius() ?
|
25 |
+
$fs->get_update( false, false, WP_FS__TIME_24_HOURS_IN_SEC / 24 ) :
|
26 |
+
null;
|
27 |
|
28 |
if ( is_object($update) ) {
|
29 |
/**
|
435 |
'value' => $fs->get_plugin_version()
|
436 |
);
|
437 |
|
438 |
+
if ( ! fs_is_network_admin() && $is_premium && ! $is_whitelabeled ) {
|
439 |
$profile[] = array(
|
440 |
'id' => 'beta_program',
|
441 |
'title' => '',
|
442 |
+
'value' => $site->is_beta
|
443 |
);
|
444 |
}
|
445 |
|
freemius/templates/add-ons.php
CHANGED
File without changes
|
freemius/templates/checkout.php
CHANGED
File without changes
|
freemius/templates/connect.php
CHANGED
@@ -181,12 +181,7 @@
|
|
181 |
|
182 |
$message = $fs->apply_filters(
|
183 |
'connect-message_on-premium',
|
184 |
-
|
185 |
-
'' :
|
186 |
-
/* translators: %s: name (e.g. Hey John,) */
|
187 |
-
$hey_x_text . '<br>'
|
188 |
-
) .
|
189 |
-
sprintf( fs_text_inline( 'Thanks for purchasing %s! To get started, please enter your license key:', 'thanks-for-purchasing', $slug ), '<b>' . $fs->get_plugin_name() . '</b>' ),
|
190 |
$first_name,
|
191 |
$fs->get_plugin_name()
|
192 |
);
|
@@ -347,6 +342,9 @@
|
|
347 |
} ?>><?php echo esc_html( $button_label ) ?></button>
|
348 |
</form>
|
349 |
<?php endif ?>
|
|
|
|
|
|
|
350 |
</div><?php
|
351 |
|
352 |
// Set core permission list items.
|
@@ -367,26 +365,30 @@
|
|
367 |
);
|
368 |
}
|
369 |
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
|
|
|
|
|
|
383 |
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
|
|
390 |
|
391 |
// Add newsletter permissions if enabled.
|
392 |
if ( $is_gdpr_required || $fs->is_permission_requested( 'newsletter' ) ) {
|
@@ -398,14 +400,15 @@
|
|
398 |
);
|
399 |
}
|
400 |
|
401 |
-
|
402 |
'icon-class' => 'dashicons dashicons-menu',
|
403 |
-
'label' => $fs->get_text_inline( 'Plugins & Themes', 'permissions-extensions' ),
|
|
|
404 |
'desc' => $fs->get_text_inline( 'Title, slug, version, and is active', 'permissions-extensions_desc' ),
|
405 |
'priority' => 25,
|
406 |
'optional' => true,
|
407 |
-
'default' => $fs->apply_filters( 'permission_extensions_default',
|
408 |
-
|
409 |
|
410 |
// Allow filtering of the permissions list.
|
411 |
$permissions = $fs->apply_filters( 'permission_list', $permissions );
|
@@ -417,13 +420,15 @@
|
|
417 |
<div class="fs-permissions">
|
418 |
<?php if ( $require_license_key ) : ?>
|
419 |
<p class="fs-license-sync-disclaimer"><?php
|
420 |
-
|
421 |
-
fs_esc_html_inline( 'The %1$s will
|
422 |
$fs->get_module_label( true ),
|
423 |
-
|
|
|
424 |
) ?></p>
|
425 |
-
<?php
|
426 |
<a class="fs-trigger" href="#" tabindex="1"><?php fs_esc_html_echo_inline( 'What permissions are being granted?', 'what-permissions', $slug ) ?></a>
|
|
|
427 |
<ul><?php
|
428 |
foreach ( $permissions as $id => $permission ) : ?>
|
429 |
<li id="fs-permission-<?php echo esc_attr( $id ); ?>"
|
@@ -436,7 +441,7 @@
|
|
436 |
<?php endif ?>
|
437 |
|
438 |
<div class="fs-permission-description">
|
439 |
-
<span
|
440 |
|
441 |
<p><?php echo esc_html( $permission['desc'] ); ?></p>
|
442 |
</div>
|
@@ -702,9 +707,16 @@
|
|
702 |
var ajaxOptin = ( requireLicenseKey || isNetworkActive );
|
703 |
|
704 |
$form.on('submit', function () {
|
705 |
-
|
706 |
-
|
707 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
708 |
|
709 |
/**
|
710 |
* @author Vova Feldman (@svovaf)
|
181 |
|
182 |
$message = $fs->apply_filters(
|
183 |
'connect-message_on-premium',
|
184 |
+
sprintf( fs_text_inline( 'Welcome to %s! To get started, please enter your license key:', 'thanks-for-purchasing', $slug ), '<b>' . $fs->get_plugin_name() . '</b>' ),
|
|
|
|
|
|
|
|
|
|
|
185 |
$first_name,
|
186 |
$fs->get_plugin_name()
|
187 |
);
|
342 |
} ?>><?php echo esc_html( $button_label ) ?></button>
|
343 |
</form>
|
344 |
<?php endif ?>
|
345 |
+
<?php if ( $require_license_key ) : ?>
|
346 |
+
<a id="license_issues_link" href="<?php echo $fs->apply_filters( 'known_license_issues_url', 'https://freemius.com/help/documentation/wordpress-sdk/license-activation-issues/' ) ?>" target="_blank"><?php fs_esc_html_echo_inline( 'License issues?', 'license-issues', $slug ) ?></a>
|
347 |
+
<?php endif ?>
|
348 |
</div><?php
|
349 |
|
350 |
// Set core permission list items.
|
365 |
);
|
366 |
}
|
367 |
|
368 |
+
$permissions['site'] = array(
|
369 |
+
'icon-class' => 'dashicons dashicons-admin-settings',
|
370 |
+
'tooltip' => ( $require_license_key ? sprintf( $fs->get_text_inline( 'So you can manage and control your license remotely from the User Dashboard.', 'permissions-site_tooltip' ), $fs->get_module_type() ) : '' ),
|
371 |
+
'label' => $fs->get_text_inline( 'Your Site Overview', 'permissions-site' ),
|
372 |
+
'desc' => $fs->get_text_inline( 'Site URL, WP version, PHP info', 'permissions-site_desc' ),
|
373 |
+
'priority' => 10,
|
374 |
+
);
|
375 |
+
|
376 |
+
if ( ! $require_license_key ) {
|
377 |
+
$permissions['notices'] = array(
|
378 |
+
'icon-class' => 'dashicons dashicons-testimonial',
|
379 |
+
'label' => $fs->get_text_inline( 'Admin Notices', 'permissions-admin-notices' ),
|
380 |
+
'desc' => $fs->get_text_inline( 'Updates, announcements, marketing, no spam', 'permissions-newsletter_desc' ),
|
381 |
+
'priority' => 13,
|
382 |
+
);
|
383 |
+
}
|
384 |
|
385 |
+
$permissions['events'] = array(
|
386 |
+
'icon-class' => 'dashicons dashicons-admin-' . ( $fs->is_plugin() ? 'plugins' : 'appearance' ),
|
387 |
+
'tooltip' => ( $require_license_key ? sprintf( $fs->get_text_inline( 'So you can reuse the license when the %s is no longer active.', 'permissions-events_tooltip' ), $fs->get_module_type() ) : '' ),
|
388 |
+
'label' => sprintf( $fs->get_text_inline( 'Current %s Status', 'permissions-events' ), ucfirst( $fs->get_module_type() ) ),
|
389 |
+
'desc' => $fs->get_text_inline( 'Active, deactivated, or uninstalled', 'permissions-events_desc' ),
|
390 |
+
'priority' => 20,
|
391 |
+
);
|
392 |
|
393 |
// Add newsletter permissions if enabled.
|
394 |
if ( $is_gdpr_required || $fs->is_permission_requested( 'newsletter' ) ) {
|
400 |
);
|
401 |
}
|
402 |
|
403 |
+
$permissions['extensions'] = array(
|
404 |
'icon-class' => 'dashicons dashicons-menu',
|
405 |
+
'label' => $fs->get_text_inline( 'Plugins & Themes', 'permissions-extensions' ) . ( $require_license_key ? ' (' . $fs->get_text_inline( 'optional' ) . ')' : '' ),
|
406 |
+
'tooltip' => $fs->get_text_inline( 'To help us troubleshoot any potential issues that may arise from other plugin or theme conflicts.', 'permissions-events_tooltip' ),
|
407 |
'desc' => $fs->get_text_inline( 'Title, slug, version, and is active', 'permissions-extensions_desc' ),
|
408 |
'priority' => 25,
|
409 |
'optional' => true,
|
410 |
+
'default' => $fs->apply_filters( 'permission_extensions_default', ! $require_license_key )
|
411 |
+
);
|
412 |
|
413 |
// Allow filtering of the permissions list.
|
414 |
$permissions = $fs->apply_filters( 'permission_list', $permissions );
|
420 |
<div class="fs-permissions">
|
421 |
<?php if ( $require_license_key ) : ?>
|
422 |
<p class="fs-license-sync-disclaimer"><?php
|
423 |
+
echo sprintf(
|
424 |
+
fs_esc_html_inline( 'The %1$s will periodically send %2$s to %3$s for security & feature updates delivery, and license management.', 'license-sync-disclaimer', $slug ),
|
425 |
$fs->get_module_label( true ),
|
426 |
+
sprintf('<a class="fs-trigger" href="#" tabindex="1">%s</a>', fs_esc_html_inline('diagnostic data', 'send-data')),
|
427 |
+
'<a class="fs-tooltip-trigger' . (is_rtl() ? ' rtl' : '') . '" href="' . $freemius_site_url . '" target="_blank" rel="noopener" tabindex="1">freemius.com <i class="dashicons dashicons-editor-help" style="text-decoration: none;"><span class="fs-tooltip" style="width: 170px">' . $fs->get_text_inline( 'Freemius is our licensing and software updates engine', 'permissions-extensions_desc' ) . '</span></i></a>'
|
428 |
) ?></p>
|
429 |
+
<?php else : ?>
|
430 |
<a class="fs-trigger" href="#" tabindex="1"><?php fs_esc_html_echo_inline( 'What permissions are being granted?', 'what-permissions', $slug ) ?></a>
|
431 |
+
<?php endif ?>
|
432 |
<ul><?php
|
433 |
foreach ( $permissions as $id => $permission ) : ?>
|
434 |
<li id="fs-permission-<?php echo esc_attr( $id ); ?>"
|
441 |
<?php endif ?>
|
442 |
|
443 |
<div class="fs-permission-description">
|
444 |
+
<span<?php if ( ! empty($permission['tooltip']) ) : ?> class="fs-tooltip-trigger"<?php endif ?>><?php echo esc_html( $permission['label'] ); ?><?php if ( ! empty($permission['tooltip']) ) : ?><i class="dashicons dashicons-editor-help"><span class="fs-tooltip" style="width: 200px"><?php echo $permission['tooltip'] ?></span></i><?php endif ?></span>
|
445 |
|
446 |
<p><?php echo esc_html( $permission['desc'] ); ?></p>
|
447 |
</div>
|
707 |
var ajaxOptin = ( requireLicenseKey || isNetworkActive );
|
708 |
|
709 |
$form.on('submit', function () {
|
710 |
+
var $extensionsPermission = $('#fs-permission-extensions .fs-switch'),
|
711 |
+
isExtensionsTrackingAllowed = ($extensionsPermission.length > 0) ?
|
712 |
+
$extensionsPermission.hasClass('fs-on') :
|
713 |
+
null;
|
714 |
+
|
715 |
+
if (null === isExtensionsTrackingAllowed) {
|
716 |
+
$('input[name=is_extensions_tracking_allowed]').remove();
|
717 |
+
} else {
|
718 |
+
$('input[name=is_extensions_tracking_allowed]').val(isExtensionsTrackingAllowed ? 1 : 0);
|
719 |
+
}
|
720 |
|
721 |
/**
|
722 |
* @author Vova Feldman (@svovaf)
|
freemius/templates/contact.php
CHANGED
File without changes
|
freemius/templates/firewall-issues-js.php
CHANGED
File without changes
|
freemius/templates/forms/deactivation/form.php
CHANGED
File without changes
|
freemius/templates/forms/license-activation.php
CHANGED
@@ -115,13 +115,15 @@ HTML;
|
|
115 |
* @var FS_Plugin_License $license
|
116 |
*/
|
117 |
foreach ( $available_licenses as $license ) {
|
|
|
|
|
118 |
$label = sprintf(
|
119 |
"%s-Site %s License - %s",
|
120 |
( 1 == $license->quota ?
|
121 |
'Single' :
|
122 |
( $license->is_unlimited() ? 'Unlimited' : $license->quota )
|
123 |
),
|
124 |
-
|
125 |
$license->get_html_escaped_masked_secret_key()
|
126 |
);
|
127 |
|
115 |
* @var FS_Plugin_License $license
|
116 |
*/
|
117 |
foreach ( $available_licenses as $license ) {
|
118 |
+
$plan = $fs->_get_plan_by_id( $license->plan_id );
|
119 |
+
|
120 |
$label = sprintf(
|
121 |
"%s-Site %s License - %s",
|
122 |
( 1 == $license->quota ?
|
123 |
'Single' :
|
124 |
( $license->is_unlimited() ? 'Unlimited' : $license->quota )
|
125 |
),
|
126 |
+
( is_object( $plan ) ? $plan->title : '' ),
|
127 |
$license->get_html_escaped_masked_secret_key()
|
128 |
);
|
129 |
|
freemius/templates/powered-by.php
CHANGED
File without changes
|
freemius/templates/sticky-admin-notice-js.php
CHANGED
File without changes
|
index.php
CHANGED
@@ -10,84 +10,27 @@
|
|
10 |
* Author URI: http://bhittani.com
|
11 |
* Text Domain: kk-star-ratings
|
12 |
* Domain Path: /languages
|
13 |
-
* Version:
|
14 |
* License: GPLv2 or later
|
15 |
*/
|
16 |
|
17 |
-
namespace Bhittani\StarRating;
|
18 |
-
|
19 |
-
use kkStarRatings;
|
20 |
-
|
21 |
if (! defined('ABSPATH')) {
|
22 |
http_response_code(404);
|
23 |
-
|
24 |
}
|
25 |
|
26 |
define('KK_STAR_RATINGS', __FILE__);
|
27 |
|
28 |
-
if (file_exists($freemius = __DIR__.'/freemius.php')) {
|
29 |
-
require_once $freemius;
|
30 |
-
}
|
31 |
|
32 |
-
require_once __DIR__.'/src/config.php';
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
'
|
38 |
-
|
39 |
-
'enable' => true,
|
40 |
-
'strategies' => ['guests'],
|
41 |
-
'manual_control' => [],
|
42 |
-
'exclude_locations' => ['home', 'archives'],
|
43 |
-
'exclude_categories' => [],
|
44 |
-
'position' => 'top-left',
|
45 |
-
// Appearance
|
46 |
-
'gap' => 4,
|
47 |
-
'stars' => 5,
|
48 |
-
'size' => 24,
|
49 |
-
'greet' => 'Rate this [type]',
|
50 |
-
// Rich snippets
|
51 |
-
'grs' => true,
|
52 |
-
'sd' => <<<HTML
|
53 |
-
{
|
54 |
-
"@context": "https://schema.org/",
|
55 |
-
"@type": "CreativeWorkSeries",
|
56 |
-
"name": "[title]",
|
57 |
-
"aggregateRating": {
|
58 |
-
"@type": "AggregateRating",
|
59 |
-
"ratingValue": "[score]",
|
60 |
-
"bestRating": "[best]",
|
61 |
-
"ratingCount": "[count]"
|
62 |
}
|
63 |
-
}
|
64 |
-
HTML
|
65 |
-
],
|
66 |
-
]);
|
67 |
|
68 |
-
require_once __DIR__.'/src/
|
69 |
-
require_once __DIR__.'/src/
|
70 |
-
|
71 |
-
require_once __DIR__.'/src/ajax.php';
|
72 |
-
require_once __DIR__.'/src/view.php';
|
73 |
-
require_once __DIR__.'/src/post.php';
|
74 |
-
require_once __DIR__.'/src/response.php';
|
75 |
-
require_once __DIR__.'/src/legacy.php';
|
76 |
-
|
77 |
-
if (is_admin()) {
|
78 |
-
require_once __DIR__.'/src/activate.php';
|
79 |
-
require_once __DIR__.'/src/admin.php';
|
80 |
-
require_once __DIR__.'/src/metabox.php';
|
81 |
-
} else {
|
82 |
-
require_once __DIR__.'/src/validate.php';
|
83 |
-
require_once __DIR__.'/src/shortcode.php';
|
84 |
-
require_once __DIR__.'/src/assets.php';
|
85 |
}
|
86 |
-
|
87 |
-
require_once __DIR__.'/kkStarRatings.php';
|
88 |
-
|
89 |
-
new kkStarRatings('');
|
90 |
-
|
91 |
-
add_action('plugins_loaded', function () {
|
92 |
-
do_action(prefix('init'));
|
93 |
-
});
|
10 |
* Author URI: http://bhittani.com
|
11 |
* Text Domain: kk-star-ratings
|
12 |
* Domain Path: /languages
|
13 |
+
* Version: 5.2.0
|
14 |
* License: GPLv2 or later
|
15 |
*/
|
16 |
|
|
|
|
|
|
|
|
|
17 |
if (! defined('ABSPATH')) {
|
18 |
http_response_code(404);
|
19 |
+
exit();
|
20 |
}
|
21 |
|
22 |
define('KK_STAR_RATINGS', __FILE__);
|
23 |
|
|
|
|
|
|
|
24 |
|
|
|
25 |
|
26 |
+
if (function_exists('kksr_freemius')) {
|
27 |
+
kksr_freemius()->set_basename(true, __FILE__);
|
28 |
+
} else {
|
29 |
+
if (! function_exists( 'kksr_freemius' )) {
|
30 |
+
require_once __DIR__.'/freemius.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
|
|
|
|
|
|
|
|
32 |
|
33 |
+
require_once __DIR__.'/src/index.php';
|
34 |
+
require_once __DIR__.'/src/core/index.php';
|
35 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
kkStarRatings.php
DELETED
@@ -1,166 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of bhittani/kk-star-ratings.
|
5 |
-
*
|
6 |
-
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view
|
9 |
-
* the LICENSE file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
use function Bhittani\StarRating\prefix;
|
13 |
-
use function Bhittani\StarRating\meta_prefix;
|
14 |
-
use function Bhittani\StarRating\add_plugin_action;
|
15 |
-
use function Bhittani\StarRating\add_plugin_filter;
|
16 |
-
|
17 |
-
class kkStarRatings
|
18 |
-
{
|
19 |
-
protected $slugs = [];
|
20 |
-
|
21 |
-
public function __construct($slugs)
|
22 |
-
{
|
23 |
-
$this->slugs = (array) $slugs;
|
24 |
-
|
25 |
-
add_plugin_filter('count', [$this, 'countFilter'], 9, 3);
|
26 |
-
add_plugin_filter('score', [$this, 'scoreFilter'], 9, 4);
|
27 |
-
add_plugin_filter('greet', [$this, 'greetFilter'], 9, 3);
|
28 |
-
add_plugin_filter('validate', [$this, 'validateFilter'], 9, 3);
|
29 |
-
add_plugin_filter('can_vote', [$this, 'canVoteFilter'], 9, 3);
|
30 |
-
add_plugin_action('vote', [$this, 'voteAction'], 9, 4);
|
31 |
-
}
|
32 |
-
|
33 |
-
public function countFilter($count, $id, $slug)
|
34 |
-
{
|
35 |
-
if (! in_array($slug, $this->slugs)) {
|
36 |
-
return $count;
|
37 |
-
}
|
38 |
-
|
39 |
-
return max(0, (int) get_post_meta($id, $this->metaPrefix('casts', $slug), true));
|
40 |
-
}
|
41 |
-
|
42 |
-
public function scoreFilter($score, $best, $id, $slug)
|
43 |
-
{
|
44 |
-
if (! in_array($slug, $this->slugs)) {
|
45 |
-
return $score;
|
46 |
-
}
|
47 |
-
|
48 |
-
$count = $this->countFilter(null, $id, $slug);
|
49 |
-
|
50 |
-
if (! $count) {
|
51 |
-
return 0;
|
52 |
-
}
|
53 |
-
|
54 |
-
$counter = (float) get_post_meta($id, $this->metaPrefix('ratings', $slug), true);
|
55 |
-
$score = $counter / $count / 5 * $best;
|
56 |
-
$score = round($score, 1, PHP_ROUND_HALF_DOWN);
|
57 |
-
|
58 |
-
return min(max($score, 0), $best);
|
59 |
-
}
|
60 |
-
|
61 |
-
public function greetFilter($greet, $id, $slug)
|
62 |
-
{
|
63 |
-
if (! in_array($slug, $this->slugs)) {
|
64 |
-
return $greet;
|
65 |
-
}
|
66 |
-
|
67 |
-
$type = get_post_type($id);
|
68 |
-
|
69 |
-
if (! $type) {
|
70 |
-
return $greet;
|
71 |
-
}
|
72 |
-
|
73 |
-
return str_replace('[type]', $type, $greet);
|
74 |
-
}
|
75 |
-
|
76 |
-
public function validateFilter($bool, $id, $slug)
|
77 |
-
{
|
78 |
-
if (! in_array($slug, $this->slugs)) {
|
79 |
-
return $bool;
|
80 |
-
}
|
81 |
-
|
82 |
-
if (! $id) {
|
83 |
-
return $bool;
|
84 |
-
}
|
85 |
-
|
86 |
-
$status = get_post_meta($id, $this->metaPrefix('status', $slug), true);
|
87 |
-
|
88 |
-
if ($status == 'enable') {
|
89 |
-
return true;
|
90 |
-
}
|
91 |
-
|
92 |
-
if ($status == 'disable') {
|
93 |
-
return false;
|
94 |
-
}
|
95 |
-
|
96 |
-
$categories = array_map(function ($category) {
|
97 |
-
return $category->term_id;
|
98 |
-
}, get_the_category($id));
|
99 |
-
|
100 |
-
$excludedCategories = (array) get_option(prefix('exclude_categories'), []);
|
101 |
-
|
102 |
-
if (count($categories) !== count(array_diff($categories, $excludedCategories))) {
|
103 |
-
return false;
|
104 |
-
}
|
105 |
-
|
106 |
-
if (in_array(get_post_type($id), (array) get_option(prefix('exclude_locations')))) {
|
107 |
-
return false;
|
108 |
-
}
|
109 |
-
|
110 |
-
return $bool;
|
111 |
-
}
|
112 |
-
|
113 |
-
public function canVoteFilter($bool, $id, $slug)
|
114 |
-
{
|
115 |
-
if (! in_array($slug, $this->slugs)) {
|
116 |
-
return $bool;
|
117 |
-
}
|
118 |
-
|
119 |
-
$strategies = (array) get_option(prefix('strategies'), []);
|
120 |
-
|
121 |
-
if (is_archive() && ! in_array('archives', $strategies)) {
|
122 |
-
return false;
|
123 |
-
}
|
124 |
-
|
125 |
-
if (in_array('unique', $strategies)
|
126 |
-
&& in_array(md5($_SERVER['REMOTE_ADDR']), get_post_meta($id, $this->metaPrefix('ref', $slug)))
|
127 |
-
) {
|
128 |
-
return false;
|
129 |
-
}
|
130 |
-
|
131 |
-
return $bool;
|
132 |
-
}
|
133 |
-
|
134 |
-
public function voteAction($score, $best, $id, $slug)
|
135 |
-
{
|
136 |
-
if (! in_array($slug, $this->slugs)) {
|
137 |
-
return;
|
138 |
-
}
|
139 |
-
|
140 |
-
$count = $this->countFilter(null, $id, $slug);
|
141 |
-
$counter = (float) get_post_meta($id, $this->metaPrefix('ratings', $slug), true);
|
142 |
-
|
143 |
-
++$count;
|
144 |
-
$counter += $score / $best * 5;
|
145 |
-
|
146 |
-
update_post_meta($id, $this->metaPrefix('casts', $slug), $count);
|
147 |
-
update_post_meta($id, $this->metaPrefix('ratings', $slug), $counter);
|
148 |
-
// Legacy support.
|
149 |
-
update_post_meta($id, $this->metaPrefix('avg', $slug), $counter / $count);
|
150 |
-
|
151 |
-
$ip = md5($_SERVER['REMOTE_ADDR']);
|
152 |
-
|
153 |
-
add_post_meta($id, $this->metaPrefix('ref', $slug), $ip);
|
154 |
-
}
|
155 |
-
|
156 |
-
protected function metaPrefix($str, $slug = null)
|
157 |
-
{
|
158 |
-
$prefix = meta_prefix($str);
|
159 |
-
|
160 |
-
if ($slug) {
|
161 |
-
$prefix .= '_'.$slug;
|
162 |
-
}
|
163 |
-
|
164 |
-
return $prefix;
|
165 |
-
}
|
166 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
languages/index.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (! defined('KK_STAR_RATINGS')) {
|
3 |
+
http_response_code(404);
|
4 |
+
exit();
|
5 |
+
}
|
6 |
+
?>
|
languages/kk-star-ratings.pot
CHANGED
@@ -2,16 +2,16 @@
|
|
2 |
# This file is distributed under the same license as the kk Star Ratings plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: kk Star Ratings
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/kk-star-ratings\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"POT-Creation-Date: 2021-
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
-
"X-Generator: WP-CLI 2.
|
15 |
"X-Domain: kk-star-ratings\n"
|
16 |
|
17 |
#. Plugin Name of the plugin
|
@@ -34,220 +34,405 @@ msgstr ""
|
|
34 |
msgid "http://bhittani.com"
|
35 |
msgstr ""
|
36 |
|
37 |
-
#: src/admin/
|
38 |
-
msgid "
|
39 |
msgstr ""
|
40 |
|
41 |
-
#: src/admin/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
msgid "Text that will be displayed when no votes have been casted."
|
43 |
msgstr ""
|
44 |
|
45 |
-
#: src/admin/appearance.php:
|
46 |
-
#: src/admin/
|
|
|
47 |
msgid "The following variables are available:"
|
48 |
msgstr ""
|
49 |
|
50 |
-
#: src/admin/appearance.php:
|
51 |
-
msgid "%s Post
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
msgstr ""
|
53 |
|
54 |
-
#: src/admin/appearance.php:
|
|
|
|
|
|
|
|
|
|
|
55 |
msgid "Stars"
|
56 |
msgstr ""
|
57 |
|
58 |
-
#: src/admin/appearance.php:
|
59 |
msgid "Total number of stars."
|
60 |
msgstr ""
|
61 |
|
62 |
-
#: src/admin/appearance.php:
|
|
|
63 |
msgid "Gap"
|
64 |
msgstr ""
|
65 |
|
66 |
-
#: src/admin/appearance.php:
|
67 |
msgid "Gap between the stars."
|
68 |
msgstr ""
|
69 |
|
70 |
-
#: src/admin/appearance.php:
|
|
|
71 |
msgid "Size"
|
72 |
msgstr ""
|
73 |
|
74 |
-
#: src/admin/appearance.php:
|
75 |
msgid "Size of a single star."
|
76 |
msgstr ""
|
77 |
|
78 |
-
#: src/admin/
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
msgstr ""
|
81 |
|
82 |
-
#: src/admin/general.php:
|
83 |
-
|
|
|
84 |
msgstr ""
|
85 |
|
86 |
-
#: src/admin/general.php:
|
87 |
-
#: src/admin/rich-snippets.php:
|
88 |
-
|
89 |
msgid "Status"
|
90 |
msgstr ""
|
91 |
|
92 |
-
#: src/admin/general.php:
|
|
|
93 |
msgid "Active"
|
94 |
msgstr ""
|
95 |
|
96 |
-
#: src/admin/general.php:
|
97 |
msgid "Globally activate/deactivate the star ratings."
|
98 |
msgstr ""
|
99 |
|
100 |
-
#: src/admin/general.php:
|
|
|
101 |
msgid "Strategies"
|
102 |
msgstr ""
|
103 |
|
104 |
-
#: src/admin/general.php:
|
105 |
msgid "Select the voting strategies."
|
106 |
msgstr ""
|
107 |
|
108 |
-
#: src/admin/general.php:
|
109 |
-
|
|
|
110 |
msgstr ""
|
111 |
|
112 |
-
#: src/admin/general.php:
|
113 |
-
msgid "
|
114 |
msgstr ""
|
115 |
|
116 |
-
#: src/admin/general.php:
|
117 |
-
|
|
|
118 |
msgstr ""
|
119 |
|
120 |
-
#: src/admin/general.php:
|
121 |
-
msgid "
|
122 |
msgstr ""
|
123 |
|
124 |
-
#: src/admin/general.php:
|
125 |
-
|
|
|
126 |
msgstr ""
|
127 |
|
128 |
-
#: src/admin/general.php:
|
129 |
-
msgid "
|
130 |
msgstr ""
|
131 |
|
132 |
-
#: src/admin/
|
133 |
-
|
|
|
134 |
msgstr ""
|
135 |
|
136 |
-
#: src/admin/
|
137 |
-
msgid "
|
138 |
msgstr ""
|
139 |
|
140 |
-
#: src/admin/
|
141 |
-
|
|
|
142 |
msgstr ""
|
143 |
|
144 |
-
#: src/admin/
|
145 |
-
msgid "
|
146 |
msgstr ""
|
147 |
|
148 |
-
#: src/admin/
|
149 |
-
|
|
|
150 |
msgstr ""
|
151 |
|
152 |
-
#: src/admin/
|
153 |
-
|
|
|
154 |
msgstr ""
|
155 |
|
156 |
-
#: src/admin/
|
157 |
-
|
|
|
158 |
msgstr ""
|
159 |
|
160 |
-
#: src/admin/
|
161 |
-
|
|
|
162 |
msgstr ""
|
163 |
|
164 |
-
#: src/
|
165 |
-
|
|
|
166 |
msgstr ""
|
167 |
|
168 |
-
#: src/
|
169 |
-
|
|
|
170 |
msgstr ""
|
171 |
|
172 |
-
#: src/
|
173 |
-
|
|
|
174 |
msgstr ""
|
175 |
|
176 |
-
#: src/
|
177 |
-
|
|
|
178 |
msgstr ""
|
179 |
|
180 |
-
#: src/
|
181 |
-
|
|
|
182 |
msgstr ""
|
183 |
|
184 |
-
#: src/
|
185 |
-
|
186 |
-
msgid "Enable"
|
187 |
msgstr ""
|
188 |
|
189 |
-
#: src/
|
190 |
-
|
|
|
191 |
msgstr ""
|
192 |
|
193 |
-
#: src/
|
194 |
-
msgid "
|
195 |
msgstr ""
|
196 |
|
197 |
-
#: src/
|
198 |
-
msgid "
|
199 |
msgstr ""
|
200 |
|
201 |
-
#: src/
|
202 |
-
msgid "%
|
203 |
msgstr ""
|
204 |
|
205 |
-
#: src/admin/
|
206 |
-
|
|
|
207 |
msgstr ""
|
208 |
|
209 |
-
#: src/admin/
|
210 |
-
msgid "
|
211 |
msgstr ""
|
212 |
|
213 |
-
#: src/admin/
|
214 |
-
msgid "
|
215 |
msgstr ""
|
216 |
|
217 |
-
#: src/admin/
|
218 |
-
msgid "
|
219 |
msgstr ""
|
220 |
|
221 |
-
#: src/
|
222 |
-
|
|
|
223 |
msgstr ""
|
224 |
|
225 |
-
#: src/
|
226 |
-
|
|
|
227 |
msgstr ""
|
228 |
|
229 |
-
#: src/
|
230 |
-
|
|
|
231 |
msgstr ""
|
232 |
|
233 |
-
#: src/
|
234 |
-
|
|
|
235 |
msgstr ""
|
236 |
|
237 |
-
#:
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
msgstr
|
242 |
|
243 |
-
#:
|
244 |
-
msgid "
|
245 |
msgstr ""
|
246 |
|
247 |
-
#: views/
|
248 |
-
|
|
|
249 |
msgstr ""
|
250 |
|
251 |
-
#: views/
|
252 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
msgstr ""
|
2 |
# This file is distributed under the same license as the kk Star Ratings plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: kk Star Ratings 5.1.4\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/kk-star-ratings\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"POT-Creation-Date: 2021-11-01T17:48:38+00:00\n"
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
+
"X-Generator: WP-CLI 2.4.0\n"
|
15 |
"X-Domain: kk-star-ratings\n"
|
16 |
|
17 |
#. Plugin Name of the plugin
|
34 |
msgid "http://bhittani.com"
|
35 |
msgstr ""
|
36 |
|
37 |
+
#: src/core/actions/admin/index.php:57
|
38 |
+
msgid "You can only save the options via the admin."
|
39 |
msgstr ""
|
40 |
|
41 |
+
#: src/core/actions/admin/index.php:88
|
42 |
+
msgid "There were some errors while saving the options."
|
43 |
+
msgstr ""
|
44 |
+
|
45 |
+
#: src/core/filters/admin/tabs.php:22
|
46 |
+
msgctxt "Label"
|
47 |
+
msgid "General"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: src/core/filters/admin/tabs.php:23
|
51 |
+
msgctxt "Label"
|
52 |
+
msgid "Appearance"
|
53 |
+
msgstr ""
|
54 |
+
|
55 |
+
#: src/core/filters/admin/tabs.php:24
|
56 |
+
msgctxt "Label"
|
57 |
+
msgid "Rich Snippets"
|
58 |
+
msgstr ""
|
59 |
+
|
60 |
+
#: src/core/filters/validate.php:31
|
61 |
+
msgid "The ratings are readonly."
|
62 |
+
msgstr ""
|
63 |
+
|
64 |
+
#: src/core/filters/validate.php:35
|
65 |
+
msgid "Under maintenance."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: src/core/filters/validate.php:39
|
69 |
+
msgid "Not allowed at the moment."
|
70 |
+
msgstr ""
|
71 |
+
|
72 |
+
#: src/core/filters/validate.php:47
|
73 |
+
msgid "You can not cast a vote in archives."
|
74 |
+
msgstr ""
|
75 |
+
|
76 |
+
#: src/core/filters/validate.php:53
|
77 |
+
msgid "You need to be authenticated to cast a vote."
|
78 |
+
msgstr ""
|
79 |
+
|
80 |
+
#: src/core/filters/validate.php:61
|
81 |
+
msgid "You have already casted your vote."
|
82 |
+
msgstr ""
|
83 |
+
|
84 |
+
#: src/core/functions/response.php:45
|
85 |
+
msgid "vote"
|
86 |
+
msgid_plural "votes"
|
87 |
+
msgstr[0] ""
|
88 |
+
msgstr[1] ""
|
89 |
+
|
90 |
+
#: src/core/views/admin/index.php:19
|
91 |
+
msgid "Options saved."
|
92 |
+
msgstr ""
|
93 |
+
|
94 |
+
#: src/core/views/admin/tabs/appearance.php:15
|
95 |
+
msgctxt "Label"
|
96 |
+
msgid "Top Left"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: src/core/views/admin/tabs/appearance.php:16
|
100 |
+
msgctxt "Label"
|
101 |
+
msgid "Top Center"
|
102 |
+
msgstr ""
|
103 |
+
|
104 |
+
#: src/core/views/admin/tabs/appearance.php:17
|
105 |
+
msgctxt "Label"
|
106 |
+
msgid "Top Right"
|
107 |
+
msgstr ""
|
108 |
+
|
109 |
+
#: src/core/views/admin/tabs/appearance.php:18
|
110 |
+
msgctxt "Label"
|
111 |
+
msgid "Bottom Left"
|
112 |
+
msgstr ""
|
113 |
+
|
114 |
+
#: src/core/views/admin/tabs/appearance.php:19
|
115 |
+
msgctxt "Label"
|
116 |
+
msgid "Bottom Center"
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#: src/core/views/admin/tabs/appearance.php:20
|
120 |
+
msgctxt "Label"
|
121 |
+
msgid "Bottom Right"
|
122 |
+
msgstr ""
|
123 |
+
|
124 |
+
#: src/core/views/admin/tabs/appearance.php:30
|
125 |
+
msgctxt "Label"
|
126 |
+
msgid "Greeting"
|
127 |
+
msgstr ""
|
128 |
+
|
129 |
+
#: src/core/views/admin/tabs/appearance.php:38
|
130 |
msgid "Text that will be displayed when no votes have been casted."
|
131 |
msgstr ""
|
132 |
|
133 |
+
#: src/core/views/admin/tabs/appearance.php:40
|
134 |
+
#: src/core/views/admin/tabs/appearance.php:61
|
135 |
+
#: src/core/views/admin/tabs/rich-snippets.php:43
|
136 |
msgid "The following variables are available:"
|
137 |
msgstr ""
|
138 |
|
139 |
+
#: src/core/views/admin/tabs/appearance.php:42
|
140 |
+
msgid "%s Post Type"
|
141 |
+
msgstr ""
|
142 |
+
|
143 |
+
#: src/core/views/admin/tabs/appearance.php:51
|
144 |
+
msgctxt "Label"
|
145 |
+
msgid "Legend"
|
146 |
+
msgstr ""
|
147 |
+
|
148 |
+
#: src/core/views/admin/tabs/appearance.php:59
|
149 |
+
msgid "Text that will be displayed when votes have been casted."
|
150 |
+
msgstr ""
|
151 |
+
|
152 |
+
#: src/core/views/admin/tabs/appearance.php:63
|
153 |
+
msgid "%s Average ratings"
|
154 |
+
msgstr ""
|
155 |
+
|
156 |
+
#: src/core/views/admin/tabs/appearance.php:65
|
157 |
+
msgid "%s Number of votes casted"
|
158 |
+
msgstr ""
|
159 |
+
|
160 |
+
#: src/core/views/admin/tabs/appearance.php:67
|
161 |
+
msgid "%s Total amount of stars"
|
162 |
msgstr ""
|
163 |
|
164 |
+
#: src/core/views/admin/tabs/appearance.php:69
|
165 |
+
msgid "%s Votes"
|
166 |
+
msgstr ""
|
167 |
+
|
168 |
+
#: src/core/views/admin/tabs/appearance.php:78
|
169 |
+
msgctxt "Label"
|
170 |
msgid "Stars"
|
171 |
msgstr ""
|
172 |
|
173 |
+
#: src/core/views/admin/tabs/appearance.php:86
|
174 |
msgid "Total number of stars."
|
175 |
msgstr ""
|
176 |
|
177 |
+
#: src/core/views/admin/tabs/appearance.php:95
|
178 |
+
msgctxt "Label"
|
179 |
msgid "Gap"
|
180 |
msgstr ""
|
181 |
|
182 |
+
#: src/core/views/admin/tabs/appearance.php:103
|
183 |
msgid "Gap between the stars."
|
184 |
msgstr ""
|
185 |
|
186 |
+
#: src/core/views/admin/tabs/appearance.php:112
|
187 |
+
msgctxt "Label"
|
188 |
msgid "Size"
|
189 |
msgstr ""
|
190 |
|
191 |
+
#: src/core/views/admin/tabs/appearance.php:120
|
192 |
msgid "Size of a single star."
|
193 |
msgstr ""
|
194 |
|
195 |
+
#: src/core/views/admin/tabs/appearance.php:128
|
196 |
+
msgctxt "Label"
|
197 |
+
msgid "Default Position"
|
198 |
+
msgstr ""
|
199 |
+
|
200 |
+
#: src/core/views/admin/tabs/appearance.php:140
|
201 |
+
msgid "Choose the default position for the auto-embedded star ratings."
|
202 |
+
msgstr ""
|
203 |
+
|
204 |
+
#: src/core/views/admin/tabs/general.php:37
|
205 |
+
msgctxt "Label"
|
206 |
+
msgid "Home"
|
207 |
+
msgstr ""
|
208 |
+
|
209 |
+
#: src/core/views/admin/tabs/general.php:38
|
210 |
+
msgctxt "Label"
|
211 |
+
msgid "Archives"
|
212 |
+
msgstr ""
|
213 |
+
|
214 |
+
#: src/core/views/admin/tabs/general.php:42
|
215 |
+
msgctxt "Label"
|
216 |
+
msgid "Allow voting in archives"
|
217 |
+
msgstr ""
|
218 |
+
|
219 |
+
#: src/core/views/admin/tabs/general.php:43
|
220 |
+
msgctxt "Label"
|
221 |
+
msgid "Allow guests to vote"
|
222 |
msgstr ""
|
223 |
|
224 |
+
#: src/core/views/admin/tabs/general.php:44
|
225 |
+
msgctxt "Label"
|
226 |
+
msgid "Unique votes (based on IP Address)"
|
227 |
msgstr ""
|
228 |
|
229 |
+
#: src/core/views/admin/tabs/general.php:54
|
230 |
+
#: src/core/views/admin/tabs/rich-snippets.php:17
|
231 |
+
msgctxt "Label"
|
232 |
msgid "Status"
|
233 |
msgstr ""
|
234 |
|
235 |
+
#: src/core/views/admin/tabs/general.php:59
|
236 |
+
msgctxt "Label"
|
237 |
msgid "Active"
|
238 |
msgstr ""
|
239 |
|
240 |
+
#: src/core/views/admin/tabs/general.php:62
|
241 |
msgid "Globally activate/deactivate the star ratings."
|
242 |
msgstr ""
|
243 |
|
244 |
+
#: src/core/views/admin/tabs/general.php:70
|
245 |
+
msgctxt "Label"
|
246 |
msgid "Strategies"
|
247 |
msgstr ""
|
248 |
|
249 |
+
#: src/core/views/admin/tabs/general.php:82
|
250 |
msgid "Select the voting strategies."
|
251 |
msgstr ""
|
252 |
|
253 |
+
#: src/core/views/admin/tabs/general.php:90
|
254 |
+
msgctxt "Label"
|
255 |
+
msgid "Manual Control"
|
256 |
msgstr ""
|
257 |
|
258 |
+
#: src/core/views/admin/tabs/general.php:102
|
259 |
+
msgid "Select the post types that should not auto embed the markup and will be manually controlled by the theme. E.g. Using %s in your theme/template file(s)."
|
260 |
msgstr ""
|
261 |
|
262 |
+
#: src/core/views/admin/tabs/general.php:110
|
263 |
+
msgctxt "Label"
|
264 |
+
msgid "Locations"
|
265 |
msgstr ""
|
266 |
|
267 |
+
#: src/core/views/admin/tabs/general.php:122
|
268 |
+
msgid "Star ratings will be auto-embedded for the selected locations. You may still manually allow star ratings for unselected/other locations. E.g. Using %s in your theme/template file(s)."
|
269 |
msgstr ""
|
270 |
|
271 |
+
#: src/core/views/admin/tabs/general.php:130
|
272 |
+
msgctxt "Label"
|
273 |
+
msgid "Exclude Categories"
|
274 |
msgstr ""
|
275 |
|
276 |
+
#: src/core/views/admin/tabs/general.php:142
|
277 |
+
msgid "The posts belonging to the selected categories will not auto-embed the star ratings. You may still manually show the star ratings. E.g. Using %s in your theme/template file(s)."
|
278 |
msgstr ""
|
279 |
|
280 |
+
#: src/core/views/admin/tabs/rich-snippets.php:22
|
281 |
+
msgctxt "Label"
|
282 |
+
msgid "Enable"
|
283 |
msgstr ""
|
284 |
|
285 |
+
#: src/core/views/admin/tabs/rich-snippets.php:25
|
286 |
+
msgid "Enable/disable rich snippets."
|
287 |
msgstr ""
|
288 |
|
289 |
+
#: src/core/views/admin/tabs/rich-snippets.php:33
|
290 |
+
msgctxt "Label"
|
291 |
+
msgid "Content"
|
292 |
msgstr ""
|
293 |
|
294 |
+
#: src/core/views/admin/tabs/rich-snippets.php:41
|
295 |
+
msgid "Provide the ld+json structure."
|
296 |
msgstr ""
|
297 |
|
298 |
+
#: src/core/views/admin/tabs/rich-snippets.php:45
|
299 |
+
msgctxt "Label"
|
300 |
+
msgid "%s Post title"
|
301 |
msgstr ""
|
302 |
|
303 |
+
#: src/core/views/admin/tabs/rich-snippets.php:47
|
304 |
+
msgctxt "Label"
|
305 |
+
msgid "%s Average ratings"
|
306 |
msgstr ""
|
307 |
|
308 |
+
#: src/core/views/admin/tabs/rich-snippets.php:49
|
309 |
+
msgctxt "Label"
|
310 |
+
msgid "%s Number of votes casted"
|
311 |
msgstr ""
|
312 |
|
313 |
+
#: src/core/views/admin/tabs/rich-snippets.php:51
|
314 |
+
msgctxt "Label"
|
315 |
+
msgid "%s Total amount of stars"
|
316 |
msgstr ""
|
317 |
|
318 |
+
#: src/core/views/metabox/content.php:15
|
319 |
+
msgctxt "label"
|
320 |
+
msgid "Reset Ratings"
|
321 |
msgstr ""
|
322 |
|
323 |
+
#: src/core/views/metabox/content.php:22
|
324 |
+
msgctxt "label"
|
325 |
+
msgid "Auto Embed"
|
326 |
msgstr ""
|
327 |
|
328 |
+
#: src/core/views/metabox/content.php:28
|
329 |
+
msgctxt "label"
|
330 |
+
msgid "Global"
|
331 |
msgstr ""
|
332 |
|
333 |
+
#: src/core/views/metabox/content.php:32
|
334 |
+
msgctxt "label"
|
335 |
+
msgid "Enable"
|
336 |
msgstr ""
|
337 |
|
338 |
+
#: src/core/views/metabox/content.php:36
|
339 |
+
msgctxt "label"
|
340 |
+
msgid "Disable"
|
341 |
msgstr ""
|
342 |
|
343 |
+
#: src/core/wp/actions/admin_notices.php:26
|
344 |
+
msgid "%s has pending migrations. These migrations are running in the background and the ratings will remain disabled until the migrations have finished."
|
|
|
345 |
msgstr ""
|
346 |
|
347 |
+
#: src/core/wp/actions/wp_ajax_kk-star-ratings.php:30
|
348 |
+
#: src/core/wp/actions/wp_ajax_kksr-migrations.php:28
|
349 |
+
msgid "This action is forbidden."
|
350 |
msgstr ""
|
351 |
|
352 |
+
#: src/core/wp/actions/wp_ajax_kk-star-ratings.php:40
|
353 |
+
msgid "A rating can not be accepted at the moment."
|
354 |
msgstr ""
|
355 |
|
356 |
+
#: src/core/wp/actions/wp_ajax_kk-star-ratings.php:44
|
357 |
+
msgid "A rating is required to cast a vote."
|
358 |
msgstr ""
|
359 |
|
360 |
+
#: src/core/wp/actions/wp_ajax_kk-star-ratings.php:50
|
361 |
+
msgid "The rating value must be between %1$d and %2$d."
|
362 |
msgstr ""
|
363 |
|
364 |
+
#: src/premium/custom-stars/core/filters/admin/tabs.php:33
|
365 |
+
msgctxt "Label"
|
366 |
+
msgid "Custom Stars"
|
367 |
msgstr ""
|
368 |
|
369 |
+
#: src/premium/custom-stars/views/admin/tabs/custom-stars.php:12
|
370 |
+
msgid "This will be used for active stars."
|
371 |
msgstr ""
|
372 |
|
373 |
+
#: src/premium/custom-stars/views/admin/tabs/custom-stars.php:13
|
374 |
+
msgid "This will be used for inactive stars."
|
375 |
msgstr ""
|
376 |
|
377 |
+
#: src/premium/custom-stars/views/admin/tabs/custom-stars.php:14
|
378 |
+
msgid "This will be used for selected stars."
|
379 |
msgstr ""
|
380 |
|
381 |
+
#: src/premium/custom-stars/views/admin/tabs/custom-stars.php:17
|
382 |
+
msgctxt "Label"
|
383 |
+
msgid "Active Star"
|
384 |
msgstr ""
|
385 |
|
386 |
+
#: src/premium/custom-stars/views/admin/tabs/custom-stars.php:18
|
387 |
+
msgctxt "Label"
|
388 |
+
msgid "Inactive Star"
|
389 |
msgstr ""
|
390 |
|
391 |
+
#: src/premium/custom-stars/views/admin/tabs/custom-stars.php:19
|
392 |
+
msgctxt "Label"
|
393 |
+
msgid "Selected Star"
|
394 |
msgstr ""
|
395 |
|
396 |
+
#: src/premium/custom-stars/views/admin/tabs/custom-stars.php:56
|
397 |
+
msgctxt "Label"
|
398 |
+
msgid "Select Icon"
|
399 |
msgstr ""
|
400 |
|
401 |
+
#: src/premium/top-rated-posts/classes/TopRatedPostsWidget.php:27
|
402 |
+
#: src/premium/top-rated-posts/classes/TopRatedPostsWidget.php:66
|
403 |
+
msgctxt "label"
|
404 |
+
msgid "Top Rated Posts"
|
405 |
+
msgstr ""
|
406 |
|
407 |
+
#: src/premium/top-rated-posts/classes/TopRatedPostsWidget.php:30
|
408 |
+
msgid "Show top rated posts."
|
409 |
msgstr ""
|
410 |
|
411 |
+
#: src/premium/top-rated-posts/views/widgets/top-rated-posts/form.php:16
|
412 |
+
msgctxt "label"
|
413 |
+
msgid "Title"
|
414 |
msgstr ""
|
415 |
|
416 |
+
#: src/premium/top-rated-posts/views/widgets/top-rated-posts/form.php:25
|
417 |
+
msgctxt "label"
|
418 |
+
msgid "Slug"
|
419 |
+
msgstr ""
|
420 |
+
|
421 |
+
#: src/premium/top-rated-posts/views/widgets/top-rated-posts/form.php:34
|
422 |
+
msgctxt "label"
|
423 |
+
msgid "Category"
|
424 |
+
msgstr ""
|
425 |
+
|
426 |
+
#: src/premium/top-rated-posts/views/widgets/top-rated-posts/form.php:51
|
427 |
+
msgctxt "label"
|
428 |
+
msgid "Number of posts"
|
429 |
+
msgstr ""
|
430 |
+
|
431 |
+
#: src/premium/top-rated-posts/views/widgets/top-rated-posts/form.php:64
|
432 |
+
msgctxt "label"
|
433 |
+
msgid "Show score"
|
434 |
+
msgstr ""
|
435 |
+
|
436 |
+
#: src/premium/top-rated-posts/views/widgets/top-rated-posts/index.php:26
|
437 |
+
msgid "No posts have been rated yet."
|
438 |
msgstr ""
|
public/css/index.php
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if (! defined('ABSPATH')) {
|
4 |
-
http_response_code(404);
|
5 |
-
die();
|
6 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
public/css/kk-star-ratings.css.php
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
<?php if ($gap !== false) : ?>
|
2 |
-
.kk-star-ratings .kksr-stars .kksr-star {
|
3 |
-
margin-right: <?= $gap ?>px;
|
4 |
-
}
|
5 |
-
[dir="rtl"] .kk-star-ratings .kksr-stars .kksr-star {
|
6 |
-
margin-left: <?= $gap ?>px;
|
7 |
-
margin-right: 0;
|
8 |
-
}
|
9 |
-
<?php endif; ?>
|
10 |
-
|
11 |
-
<?php if ($stars['inactive']) : ?>
|
12 |
-
.kk-star-ratings .kksr-stars .kksr-star .kksr-icon,
|
13 |
-
.kk-star-ratings:not(.kksr-disabled) .kksr-stars .kksr-star:hover ~ .kksr-star .kksr-icon {
|
14 |
-
background-image: url("<?= $stars['inactive'] ?>");
|
15 |
-
}
|
16 |
-
<?php endif; ?>
|
17 |
-
|
18 |
-
<?php if ($stars['active']) : ?>
|
19 |
-
.kk-star-ratings .kksr-stars .kksr-stars-active .kksr-star .kksr-icon {
|
20 |
-
background-image: url("<?= $stars['active'] ?>");
|
21 |
-
}
|
22 |
-
<?php endif; ?>
|
23 |
-
|
24 |
-
<?php if ($stars['selected']) : ?>
|
25 |
-
.kk-star-ratings.kksr-disabled .kksr-stars .kksr-stars-active .kksr-star .kksr-icon,
|
26 |
-
.kk-star-ratings:not(.kksr-disabled) .kksr-stars:hover .kksr-star .kksr-icon {
|
27 |
-
background-image: url("<?= $stars['selected'] ?>");
|
28 |
-
}
|
29 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public/index.php
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if (! defined('ABSPATH')) {
|
4 |
-
http_response_code(404);
|
5 |
-
die();
|
6 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
public/js/index.php
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if (! defined('ABSPATH')) {
|
4 |
-
http_response_code(404);
|
5 |
-
die();
|
6 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
public/js/kk-star-ratings.js
DELETED
@@ -1,67 +0,0 @@
|
|
1 |
-
"use strict";
|
2 |
-
|
3 |
-
jQuery(document).ready(function ($) {
|
4 |
-
function apply ($el, options) {
|
5 |
-
var options = options || { isBusy: false };
|
6 |
-
|
7 |
-
function ajax(data, successCallback, errorCallback)
|
8 |
-
{
|
9 |
-
if (options.isBusy || $el.hasClass('kksr-disabled')) {
|
10 |
-
return;
|
11 |
-
}
|
12 |
-
|
13 |
-
options.isBusy = true;
|
14 |
-
|
15 |
-
$.ajax({
|
16 |
-
type: 'POST',
|
17 |
-
url: kk_star_ratings.endpoint,
|
18 |
-
data: Object.assign({
|
19 |
-
nonce: kk_star_ratings.nonce,
|
20 |
-
action: kk_star_ratings.action
|
21 |
-
}, data),
|
22 |
-
error: errorCallback,
|
23 |
-
success: successCallback,
|
24 |
-
complete: function () {
|
25 |
-
options.isBusy = false;
|
26 |
-
}
|
27 |
-
});
|
28 |
-
}
|
29 |
-
|
30 |
-
function onClick(e) {
|
31 |
-
var $star = $(this);
|
32 |
-
|
33 |
-
ajax({
|
34 |
-
id: $el.data('id'),
|
35 |
-
slug: $el.data('slug'),
|
36 |
-
score: $star.data('star'),
|
37 |
-
best: $('[data-star]', $el).length
|
38 |
-
}, function (response, status, xhr) {
|
39 |
-
var $newEl = $(response);
|
40 |
-
$newEl.addClass($el.attr('class'));
|
41 |
-
$el.replaceWith($newEl);
|
42 |
-
destroy();
|
43 |
-
apply($newEl, options);
|
44 |
-
}, function (xhr, status, err) {
|
45 |
-
if (xhr.responseJSON && xhr.responseJSON.error) {
|
46 |
-
console.error(xhr.responseJSON.error);
|
47 |
-
}
|
48 |
-
});
|
49 |
-
}
|
50 |
-
|
51 |
-
function destroy() {
|
52 |
-
$('[data-star]', $el).each(function () {
|
53 |
-
$(this).off('click', onClick);
|
54 |
-
});
|
55 |
-
|
56 |
-
$el.remove();
|
57 |
-
}
|
58 |
-
|
59 |
-
$('[data-star]', $el).each(function () {
|
60 |
-
$(this).on('click', onClick);
|
61 |
-
});
|
62 |
-
}
|
63 |
-
|
64 |
-
$('.kk-star-ratings').each(function () {
|
65 |
-
apply($(this))
|
66 |
-
});
|
67 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public/svg/active.svg
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
2 |
-
<path fill="#ff8c00" stroke="tomato" stroke-width=".5" d="M12 .587l3.668 7.568L24 9.306l-6.064 5.828 1.48 8.279L12 19.446l-7.417 3.967 1.481-8.279L0 9.306l8.332-1.151z"/>
|
3 |
-
</svg>
|
|
|
|
|
|
public/svg/inactive.svg
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
2 |
-
<path fill="#ebe8e8" stroke="#ddd" d="M12 .587l3.668 7.568L24 9.306l-6.064 5.828 1.48 8.279L12 19.446l-7.417 3.967 1.481-8.279L0 9.306l8.332-1.151z"/>
|
3 |
-
</svg>
|
|
|
|
|
|
public/svg/index.php
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if (! defined('ABSPATH')) {
|
4 |
-
http_response_code(404);
|
5 |
-
die();
|
6 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
public/svg/selected.svg
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
2 |
-
<path fill="#ff0" stroke="#fa8072" stroke-width=".5" d="M12 .587l3.668 7.568L24 9.306l-6.064 5.828 1.48 8.279L12 19.446l-7.417 3.967 1.481-8.279L0 9.306l8.332-1.151z"/>
|
3 |
-
</svg>
|
|
|
|
|
|
readme.txt
CHANGED
@@ -1,19 +1,22 @@
|
|
|
|
1 |
=== kk Star Ratings ===
|
2 |
Contributors: bhittani
|
3 |
Donate link: https://github.com/kamalkhan/kk-star-ratings
|
4 |
Tags: star ratings, votings, rate posts, ajax ratings, infinite stars, unlimited stars, google rich snippets, structured data, SEO, SERP
|
5 |
-
Requires at least:
|
6 |
-
Requires PHP:
|
7 |
-
Tested up to: 5.
|
8 |
-
Stable tag:
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
12 |
|
13 |
|
|
|
14 |
kk Star Ratings allows blog visitors to involve and interact more effectively with your website by rating posts.
|
15 |
|
16 |
-
This plugin has been renewed from the ground up as of
|
|
|
17 |
|
18 |
|
19 |
|
@@ -21,6 +24,7 @@ This plugin has been renewed from the ground up as of v4.
|
|
21 |
|
22 |
|
23 |
|
|
|
24 |
kk Star Ratings is a widely used star rating plugin for wordpress. Here are some highlighted features:
|
25 |
|
26 |
- User defined amount of star ratings (5 as default) in your **posts**, **pages** and publicly accesible **custom post types**.
|
@@ -47,14 +51,11 @@ kk Star Ratings is a widely used star rating plugin for wordpress. Here are some
|
|
47 |
|
48 |
- Customize position within the post content.
|
49 |
|
50 |
-
- Adjust the number of stars.
|
51 |
-
|
52 |
- Adjust the amount of stars.
|
53 |
-
|
54 |
-
- Adjust the colors of the stars.
|
55 |
|
56 |
- And much more...
|
57 |
|
|
|
58 |
== Installation ==
|
59 |
|
60 |
|
@@ -62,40 +63,55 @@ kk Star Ratings is a widely used star rating plugin for wordpress. Here are some
|
|
62 |
|
63 |
|
64 |
|
|
|
65 |
1. Extract the plugin zip file.
|
66 |
1. Upload/move the folder `kk-star-ratings` to the `wp-content/plugins` directory.
|
67 |
1. Activate the plugin via the wordpress plugins dashboard page.
|
68 |
1. Adjust the plugin options under the kk Star Ratings menu in wp-admin.
|
69 |
|
|
|
70 |
== Frequently Asked Questions ==
|
71 |
|
72 |
|
73 |
|
|
|
|
|
74 |
= What should I do if structured data do not show in search result pages. =
|
75 |
|
76 |
|
|
|
77 |
Please have patience as we have no control over how google or any search engine indexes your pages. It might take some days or even weeks for the robots to crawl the ratings.
|
78 |
|
79 |
-
|
|
|
80 |
|
81 |
|
82 |
-
|
|
|
|
|
83 |
|
84 |
= I found a bug or want to contribute. =
|
85 |
|
86 |
|
|
|
87 |
The source of this plugin is located at [Github](https://github.com/kamalkhan/kk-star-ratings). Feel free to post an issue or submit a pull request.
|
88 |
|
|
|
89 |
== Screenshots ==
|
90 |
|
91 |
1. Appearance
|
92 |
|
|
|
|
|
93 |
== Changelog ==
|
94 |
|
95 |
-
=
|
96 |
|
97 |
- [View Changelog](https://github.com/kamalkhan/kk-star-ratings/blob/master/CHANGELOG.md)
|
98 |
|
|
|
|
|
|
|
99 |
= 3.x =
|
100 |
[Archived](https://github.com/kamalkhan/kk-star-ratings/blob/master/.github/CHANGELOG-v3.md)
|
101 |
|
@@ -105,8 +121,13 @@ The source of this plugin is located at [Github](https://github.com/kamalkhan/kk
|
|
105 |
= 1.x =
|
106 |
[Archived](https://github.com/kamalkhan/kk-star-ratings/blob/master/.github/CHANGELOG-v1.md)
|
107 |
|
|
|
|
|
108 |
== Upgrade Notice ==
|
109 |
|
|
|
|
|
|
|
110 |
= 4.x =
|
111 |
It is seamless to upgrade from v3 to v4.
|
112 |
|
@@ -114,3 +135,4 @@ It is seamless to upgrade from v3 to v4.
|
|
114 |
All previous ratings and options will be preserved. However, since v3 has been renewed from scratch, we do not support downgrading to v2 after moving from v2 to v3.
|
115 |
|
116 |
|
|
1 |
+
|
2 |
=== kk Star Ratings ===
|
3 |
Contributors: bhittani
|
4 |
Donate link: https://github.com/kamalkhan/kk-star-ratings
|
5 |
Tags: star ratings, votings, rate posts, ajax ratings, infinite stars, unlimited stars, google rich snippets, structured data, SEO, SERP
|
6 |
+
Requires at least: 5.0
|
7 |
+
Requires PHP: 7.2
|
8 |
+
Tested up to: 5.8.1
|
9 |
+
Stable tag: 5.2.0
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
13 |
|
14 |
|
15 |
+
|
16 |
kk Star Ratings allows blog visitors to involve and interact more effectively with your website by rating posts.
|
17 |
|
18 |
+
This plugin has been renewed from the ground up as of v5.
|
19 |
+
|
20 |
|
21 |
|
22 |
|
24 |
|
25 |
|
26 |
|
27 |
+
|
28 |
kk Star Ratings is a widely used star rating plugin for wordpress. Here are some highlighted features:
|
29 |
|
30 |
- User defined amount of star ratings (5 as default) in your **posts**, **pages** and publicly accesible **custom post types**.
|
51 |
|
52 |
- Customize position within the post content.
|
53 |
|
|
|
|
|
54 |
- Adjust the amount of stars.
|
|
|
|
|
55 |
|
56 |
- And much more...
|
57 |
|
58 |
+
|
59 |
== Installation ==
|
60 |
|
61 |
|
63 |
|
64 |
|
65 |
|
66 |
+
|
67 |
1. Extract the plugin zip file.
|
68 |
1. Upload/move the folder `kk-star-ratings` to the `wp-content/plugins` directory.
|
69 |
1. Activate the plugin via the wordpress plugins dashboard page.
|
70 |
1. Adjust the plugin options under the kk Star Ratings menu in wp-admin.
|
71 |
|
72 |
+
|
73 |
== Frequently Asked Questions ==
|
74 |
|
75 |
|
76 |
|
77 |
+
|
78 |
+
|
79 |
= What should I do if structured data do not show in search result pages. =
|
80 |
|
81 |
|
82 |
+
|
83 |
Please have patience as we have no control over how google or any search engine indexes your pages. It might take some days or even weeks for the robots to crawl the ratings.
|
84 |
|
85 |
+
|
86 |
+
= I have been using a version of this plugin prior to v5. Is it safe for me to update? =
|
87 |
|
88 |
|
89 |
+
|
90 |
+
All previous ratings and options will be preserved. However, since v5 has been renewed from scratch, we do not support downgrading after upgrading to v5.
|
91 |
+
|
92 |
|
93 |
= I found a bug or want to contribute. =
|
94 |
|
95 |
|
96 |
+
|
97 |
The source of this plugin is located at [Github](https://github.com/kamalkhan/kk-star-ratings). Feel free to post an issue or submit a pull request.
|
98 |
|
99 |
+
|
100 |
== Screenshots ==
|
101 |
|
102 |
1. Appearance
|
103 |
|
104 |
+
|
105 |
+
|
106 |
== Changelog ==
|
107 |
|
108 |
+
= 5.x =
|
109 |
|
110 |
- [View Changelog](https://github.com/kamalkhan/kk-star-ratings/blob/master/CHANGELOG.md)
|
111 |
|
112 |
+
= 4.x =
|
113 |
+
[Archived](https://github.com/kamalkhan/kk-star-ratings/blob/master/.github/CHANGELOG-v4.md)
|
114 |
+
|
115 |
= 3.x =
|
116 |
[Archived](https://github.com/kamalkhan/kk-star-ratings/blob/master/.github/CHANGELOG-v3.md)
|
117 |
|
121 |
= 1.x =
|
122 |
[Archived](https://github.com/kamalkhan/kk-star-ratings/blob/master/.github/CHANGELOG-v1.md)
|
123 |
|
124 |
+
|
125 |
+
|
126 |
== Upgrade Notice ==
|
127 |
|
128 |
+
= 5.x =
|
129 |
+
All previous ratings and options will be preserved. However, since v5 has been renewed from scratch, we do not support downgrading.
|
130 |
+
|
131 |
= 4.x =
|
132 |
It is seamless to upgrade from v3 to v4.
|
133 |
|
135 |
All previous ratings and options will be preserved. However, since v3 has been renewed from scratch, we do not support downgrading to v2 after moving from v2 to v3.
|
136 |
|
137 |
|
138 |
+
|
src/activate.php
DELETED
@@ -1,114 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of bhittani/kk-star-ratings.
|
5 |
-
*
|
6 |
-
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view
|
9 |
-
* the LICENSE file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Bhittani\StarRating;
|
13 |
-
|
14 |
-
if (! defined('ABSPATH')) {
|
15 |
-
http_response_code(404);
|
16 |
-
exit();
|
17 |
-
}
|
18 |
-
|
19 |
-
register_activation_hook(config('file'), __NAMESPACE__.'\activation');
|
20 |
-
function activation()
|
21 |
-
{
|
22 |
-
$version = config('version');
|
23 |
-
$previous = get_option(prefix('ver'));
|
24 |
-
|
25 |
-
if (! $previous) {
|
26 |
-
do_plugin_action('install', $version);
|
27 |
-
} elseif (version_compare($previous, '3.0.0', '>')) {
|
28 |
-
do_plugin_action('activate', $version, $previous);
|
29 |
-
} else {
|
30 |
-
do_plugin_action('upgrade', $version, $previous);
|
31 |
-
}
|
32 |
-
|
33 |
-
update_option(prefix('ver'), $version);
|
34 |
-
}
|
35 |
-
|
36 |
-
add_plugin_action('install', __NAMESPACE__.'\save_options', 9);
|
37 |
-
function save_options($version)
|
38 |
-
{
|
39 |
-
foreach (config('options') as $key => $value) {
|
40 |
-
update_option(prefix($key), $value);
|
41 |
-
}
|
42 |
-
}
|
43 |
-
|
44 |
-
add_plugin_action('activate', __NAMESPACE__.'\sync_options', 9, 2);
|
45 |
-
function sync_options($version, $previous)
|
46 |
-
{
|
47 |
-
foreach (config('options') as $k => $v) {
|
48 |
-
$value = get_option(prefix($k));
|
49 |
-
|
50 |
-
if (! $value && ! is_bool($v)) {
|
51 |
-
$value = $v;
|
52 |
-
}
|
53 |
-
|
54 |
-
update_option(prefix($k), $value);
|
55 |
-
}
|
56 |
-
}
|
57 |
-
|
58 |
-
add_plugin_action('upgrade', __NAMESPACE__.'\upgrade_options', 9, 2);
|
59 |
-
function upgrade_options($version, $previous)
|
60 |
-
{
|
61 |
-
$options = [
|
62 |
-
'strategies' => get_option(prefix('strategies'), array_filter([
|
63 |
-
'guests',
|
64 |
-
get_option(prefix('unique')) ? 'unique' : null,
|
65 |
-
get_option(prefix('disable_in_archives'), true) ? null : 'archives',
|
66 |
-
])),
|
67 |
-
'exclude_locations' => get_option(prefix('exclude_locations'), array_filter([
|
68 |
-
get_option(prefix('show_in_home'), true) ? null : 'home',
|
69 |
-
get_option(prefix('show_in_posts'), true) ? null : 'post',
|
70 |
-
get_option(prefix('show_in_pages'), true) ? null : 'page',
|
71 |
-
get_option(prefix('show_in_archives'), true) ? null : 'archives',
|
72 |
-
])),
|
73 |
-
'exclude_categories' => is_array($exludedCategories = get_option(prefix('exclude_categories'), []))
|
74 |
-
? $exludedCategories : array_map('trim', explode(',', $exludedCategories)),
|
75 |
-
];
|
76 |
-
|
77 |
-
foreach ($options as $key => $value) {
|
78 |
-
update_option(prefix($key), $value);
|
79 |
-
}
|
80 |
-
}
|
81 |
-
|
82 |
-
add_plugin_action('upgrade', __NAMESPACE__.'\upgrade_posts', 9, 2);
|
83 |
-
function upgrade_posts($version, $previous)
|
84 |
-
{
|
85 |
-
global $wpdb;
|
86 |
-
|
87 |
-
// Truncate IP addresses.
|
88 |
-
$wpdb->delete($wpdb->postmeta, ['meta_key' => meta_prefix('ips')]);
|
89 |
-
|
90 |
-
// Normalize post ratings.
|
91 |
-
|
92 |
-
$rows = $wpdb->get_results("
|
93 |
-
SELECT posts.ID, postmeta_avg.meta_value as avg, postmeta_casts.meta_value as casts
|
94 |
-
FROM {$wpdb->posts} posts
|
95 |
-
JOIN {$wpdb->postmeta} postmeta_avg ON posts.ID = postmeta_avg.post_id
|
96 |
-
JOIN {$wpdb->postmeta} postmeta_casts ON posts.ID = postmeta_casts.post_id
|
97 |
-
WHERE postmeta_avg.meta_key = '_kksr_avg' AND postmeta_casts.meta_key = '_kksr_casts'
|
98 |
-
");
|
99 |
-
|
100 |
-
$stars = get_option(prefix('stars'));
|
101 |
-
$stars = max((int) $stars, 1);
|
102 |
-
|
103 |
-
foreach ($rows as $row) {
|
104 |
-
$count = max((int) $row->casts, 0);
|
105 |
-
$score = min(max($row->avg, 0), $stars);
|
106 |
-
$ratings = $score * $count / $stars * 5;
|
107 |
-
|
108 |
-
update_post_meta(
|
109 |
-
$row->ID,
|
110 |
-
meta_prefix('ratings'),
|
111 |
-
round($ratings, 0, PHP_ROUND_HALF_DOWN)
|
112 |
-
);
|
113 |
-
}
|
114 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/admin.php
DELETED
@@ -1,175 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of bhittani/kk-star-ratings.
|
5 |
-
*
|
6 |
-
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view
|
9 |
-
* the LICENSE file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Bhittani\StarRating;
|
13 |
-
|
14 |
-
if (! defined('ABSPATH')) {
|
15 |
-
http_response_code(404);
|
16 |
-
exit();
|
17 |
-
}
|
18 |
-
|
19 |
-
use RuntimeException;
|
20 |
-
|
21 |
-
function get_admin_tabs()
|
22 |
-
{
|
23 |
-
$tabs = apply_plugin_filters('admin_tabs', []);
|
24 |
-
$keys = array_keys($tabs);
|
25 |
-
$tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : reset($keys);
|
26 |
-
$active = apply_plugin_filters('active_admin_tab', $tab);
|
27 |
-
|
28 |
-
return [$tabs, $active];
|
29 |
-
}
|
30 |
-
|
31 |
-
add_action('admin_menu', __NAMESPACE__.'\admin');
|
32 |
-
function admin()
|
33 |
-
{
|
34 |
-
add_menu_page(
|
35 |
-
config('name'),
|
36 |
-
config('name'),
|
37 |
-
'manage_options',
|
38 |
-
config('slug'),
|
39 |
-
__NAMESPACE__.'\admin_callback',
|
40 |
-
'dashicons-star-filled'
|
41 |
-
);
|
42 |
-
}
|
43 |
-
|
44 |
-
function admin_callback()
|
45 |
-
{
|
46 |
-
list($tabs, $active) = get_admin_tabs();
|
47 |
-
|
48 |
-
$content = apply_plugin_filters('admin_content', '', $active);
|
49 |
-
|
50 |
-
if ($active) {
|
51 |
-
$content = apply_plugin_filters('admin_content.'.$active, $content);
|
52 |
-
}
|
53 |
-
|
54 |
-
echo view('admin.index', [
|
55 |
-
'label' => config('name'),
|
56 |
-
'version' => config('version'),
|
57 |
-
'tabs' => $tabs,
|
58 |
-
'active' => $active,
|
59 |
-
'content' => $content,
|
60 |
-
]);
|
61 |
-
}
|
62 |
-
|
63 |
-
add_plugin_filter('admin_tabs', __NAMESPACE__.'\admin_tabs', 9);
|
64 |
-
function admin_tabs($tabs)
|
65 |
-
{
|
66 |
-
return $tabs + [
|
67 |
-
'general' => 'General',
|
68 |
-
'appearance' => 'Appearance',
|
69 |
-
'rich-snippets' => 'Rich Snippets',
|
70 |
-
];
|
71 |
-
}
|
72 |
-
|
73 |
-
add_plugin_filter('admin_content', __NAMESPACE__.'\admin_content', 9, 2);
|
74 |
-
function admin_content($content, $active)
|
75 |
-
{
|
76 |
-
if (! $active) {
|
77 |
-
return $content;
|
78 |
-
}
|
79 |
-
|
80 |
-
$slug = config('slug');
|
81 |
-
|
82 |
-
return view(["admin.tabs.{$active}", 'admin.content'], compact('active', 'slug'));
|
83 |
-
}
|
84 |
-
|
85 |
-
add_action('admin_init', __NAMESPACE__.'\settings_callback');
|
86 |
-
function settings_callback()
|
87 |
-
{
|
88 |
-
list($tabs, $active) = get_admin_tabs();
|
89 |
-
|
90 |
-
if (! $active) {
|
91 |
-
return;
|
92 |
-
}
|
93 |
-
|
94 |
-
$slug = config('slug');
|
95 |
-
|
96 |
-
add_settings_section('default', null, null, $slug);
|
97 |
-
|
98 |
-
$fields = apply_plugin_filters('setting_fields', [], $active);
|
99 |
-
$fields = apply_plugin_filters('setting_fields.'.$active, $fields);
|
100 |
-
|
101 |
-
foreach ($fields as $field) {
|
102 |
-
register_setting(
|
103 |
-
$slug,
|
104 |
-
$field['name'],
|
105 |
-
[
|
106 |
-
'sanitize_callback' => isset($field['filter']) ? $field['filter'] : null,
|
107 |
-
]
|
108 |
-
);
|
109 |
-
|
110 |
-
add_settings_field(
|
111 |
-
$field['name'],
|
112 |
-
$field['title'],
|
113 |
-
__NAMESPACE__.'\setting_field_callback',
|
114 |
-
$slug,
|
115 |
-
'default',
|
116 |
-
$field
|
117 |
-
);
|
118 |
-
}
|
119 |
-
}
|
120 |
-
|
121 |
-
function setting_field_callback($field)
|
122 |
-
{
|
123 |
-
if (isset($field['fields'])) {
|
124 |
-
$input = apply_plugin_filters('setting_field', '', $field);
|
125 |
-
|
126 |
-
foreach ($field['fields'] as $field) {
|
127 |
-
setting_field_callback($field);
|
128 |
-
echo '<br><br>';
|
129 |
-
}
|
130 |
-
|
131 |
-
echo $input;
|
132 |
-
} else {
|
133 |
-
$input = apply_plugin_filters('setting_field', '', $field);
|
134 |
-
|
135 |
-
if (isset($field['type']) && $field['type']) {
|
136 |
-
echo apply_plugin_filters('setting_field.'.$field['type'], $input, $field);
|
137 |
-
} else {
|
138 |
-
echo $input;
|
139 |
-
}
|
140 |
-
}
|
141 |
-
}
|
142 |
-
|
143 |
-
add_plugin_filter('setting_fields', __NAMESPACE__.'\setting_fields', 9, 2);
|
144 |
-
function setting_fields($fields, $active)
|
145 |
-
{
|
146 |
-
if (is_file($file = __DIR__.'/admin/'.$active.'.php')) {
|
147 |
-
return array_merge($fields, (array) require $file);
|
148 |
-
}
|
149 |
-
|
150 |
-
return $fields;
|
151 |
-
}
|
152 |
-
|
153 |
-
add_plugin_filter('setting_field', __NAMESPACE__.'\setting_field', 9, 2);
|
154 |
-
function setting_field($input, $payload)
|
155 |
-
{
|
156 |
-
if ($input || ! isset($payload['type']) || ! $payload['type']) {
|
157 |
-
return $input;
|
158 |
-
}
|
159 |
-
|
160 |
-
try {
|
161 |
-
return view('admin.fields.'.$payload['type'], $payload);
|
162 |
-
} catch (RuntimeException $e) {
|
163 |
-
return $input;
|
164 |
-
}
|
165 |
-
}
|
166 |
-
|
167 |
-
add_plugin_filter('setting_field', __NAMESPACE__.'\setting_field_help', 11, 2);
|
168 |
-
function setting_field_help($input, $payload)
|
169 |
-
{
|
170 |
-
if (! isset($payload['help']) || ! $payload['help']) {
|
171 |
-
return $input;
|
172 |
-
}
|
173 |
-
|
174 |
-
return $input.'<p class="description">'.$payload['help'].'</p>';
|
175 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/admin/appearance.php
DELETED
@@ -1,63 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of bhittani/kk-star-ratings.
|
5 |
-
*
|
6 |
-
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view
|
9 |
-
* the LICENSE file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Bhittani\StarRating;
|
13 |
-
|
14 |
-
if (! defined('ABSPATH')) {
|
15 |
-
http_response_code(404);
|
16 |
-
exit();
|
17 |
-
}
|
18 |
-
|
19 |
-
$gap = [prefix('gap'), get_option(prefix('gap'))];
|
20 |
-
$size = [prefix('size'), get_option(prefix('size'))];
|
21 |
-
$stars = [prefix('stars'), get_option(prefix('stars'))];
|
22 |
-
$greet = [prefix('greet'), get_option(prefix('greet'))];
|
23 |
-
|
24 |
-
return [
|
25 |
-
[
|
26 |
-
'type' => 'text',
|
27 |
-
'title' => __('Greeting text', 'kk-star-ratings'),
|
28 |
-
'name' => $greet[0],
|
29 |
-
'value' => $greet[1],
|
30 |
-
'help' => implode('<br>', [
|
31 |
-
__('Text that will be displayed when no votes have been casted.', 'kk-star-ratings').'<br>',
|
32 |
-
__('The following variables are available:', 'kk-star-ratings').'<br>',
|
33 |
-
sprintf(__('%s Post type.', 'kk-star-ratings'), '<code>[type]</code>'),
|
34 |
-
]),
|
35 |
-
],
|
36 |
-
|
37 |
-
[
|
38 |
-
'type' => 'number',
|
39 |
-
'title' => __('Stars', 'kk-star-ratings'),
|
40 |
-
'name' => $stars[0],
|
41 |
-
'value' => $stars[1],
|
42 |
-
'min' => 1,
|
43 |
-
'help' => __('Total number of stars.', 'kk-star-ratings'),
|
44 |
-
],
|
45 |
-
|
46 |
-
[
|
47 |
-
'type' => 'number',
|
48 |
-
'title' => __('Gap', 'kk-star-ratings'),
|
49 |
-
'name' => $gap[0],
|
50 |
-
'value' => $gap[1],
|
51 |
-
'min' => 0,
|
52 |
-
'help' => __('Gap between the stars.', 'kk-star-ratings'),
|
53 |
-
],
|
54 |
-
|
55 |
-
[
|
56 |
-
'type' => 'number',
|
57 |
-
'title' => __('Size', 'kk-star-ratings'),
|
58 |
-
'name' => $size[0],
|
59 |
-
'value' => $size[1],
|
60 |
-
'min' => 1,
|
61 |
-
'help' => __('Size of a single star.', 'kk-star-ratings'),
|
62 |
-
],
|
63 |
-
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/admin/general.php
DELETED
@@ -1,212 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of bhittani/kk-star-ratings.
|
5 |
-
*
|
6 |
-
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view
|
9 |
-
* the LICENSE file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Bhittani\StarRating;
|
13 |
-
|
14 |
-
if (! defined('ABSPATH')) {
|
15 |
-
http_response_code(404);
|
16 |
-
exit();
|
17 |
-
}
|
18 |
-
|
19 |
-
$enable = [prefix('enable'), get_option(prefix('enable'))];
|
20 |
-
$position = [prefix('position'), get_option(prefix('position'))];
|
21 |
-
$strategies = [prefix('strategies'), (array) get_option(prefix('strategies'), [])];
|
22 |
-
$manuallyControlled = [prefix('manual_control'), (array) get_option(prefix('manual_control'), [])];
|
23 |
-
$excludedLocations = [prefix('exclude_locations'), (array) get_option(prefix('exclude_locations'), [])];
|
24 |
-
$excludedCategories = [prefix('exclude_categories'), (array) get_option(prefix('exclude_categories'), [])];
|
25 |
-
|
26 |
-
$postTypes = [
|
27 |
-
['value' => 'post', 'label' => __('Posts', 'kk-star-ratings')],
|
28 |
-
['value' => 'page', 'label' => __('Pages', 'kk-star-ratings')],
|
29 |
-
];
|
30 |
-
|
31 |
-
foreach (get_post_types([
|
32 |
-
'publicly_queryable' => true,
|
33 |
-
'_builtin' => false,
|
34 |
-
], 'objects') as $postType) {
|
35 |
-
$postTypes[] = [
|
36 |
-
'value' => $postType->name,
|
37 |
-
'label' => $postType->labels->name,
|
38 |
-
];
|
39 |
-
}
|
40 |
-
|
41 |
-
$categories = get_terms([
|
42 |
-
'taxonomy' => 'category',
|
43 |
-
'hide_empty' => false,
|
44 |
-
'parent' => 0,
|
45 |
-
]);
|
46 |
-
|
47 |
-
return [
|
48 |
-
[
|
49 |
-
'type' => 'checkbox',
|
50 |
-
'title' => __('Status', 'kk-star-ratings'),
|
51 |
-
'label' => __('Active', 'kk-star-ratings'),
|
52 |
-
'name' => $enable[0],
|
53 |
-
'value' => true,
|
54 |
-
'filter' => function ($bool) {
|
55 |
-
return (string) $bool;
|
56 |
-
},
|
57 |
-
'checked' => checked($enable[1], '1', false),
|
58 |
-
'help' => __('Globally activate/deactivate the star ratings.', 'kk-star-ratings'),
|
59 |
-
],
|
60 |
-
|
61 |
-
// Strategies
|
62 |
-
|
63 |
-
[
|
64 |
-
'title' => __('Strategies', 'kk-star-ratings'),
|
65 |
-
'name' => $strategies[0],
|
66 |
-
'help' => __('Select the voting strategies.', 'kk-star-ratings'),
|
67 |
-
'filter' => function ($values) {
|
68 |
-
return (array) $values;
|
69 |
-
},
|
70 |
-
'fields' => [
|
71 |
-
[
|
72 |
-
'type' => 'checkbox',
|
73 |
-
'label' => __('Allow voting in archives', 'kk-star-ratings'),
|
74 |
-
'name' => $strategies[0].'[]',
|
75 |
-
'value' => 'archives',
|
76 |
-
'checked' => in_array('archives', $strategies[1]),
|
77 |
-
],
|
78 |
-
[
|
79 |
-
'type' => 'checkbox',
|
80 |
-
'label' => __('Allow guests to vote', 'kk-star-ratings'),
|
81 |
-
'name' => $strategies[0].'[]',
|
82 |
-
'value' => 'guests',
|
83 |
-
'checked' => in_array('guests', $strategies[1]),
|
84 |
-
],
|
85 |
-
[
|
86 |
-
'type' => 'checkbox',
|
87 |
-
'label' => __('Unique votes (based on IP Address)', 'kk-star-ratings'),
|
88 |
-
'name' => $strategies[0].'[]',
|
89 |
-
'value' => 'unique',
|
90 |
-
'checked' => in_array('unique', $strategies[1]),
|
91 |
-
],
|
92 |
-
],
|
93 |
-
],
|
94 |
-
|
95 |
-
// Manual Control
|
96 |
-
|
97 |
-
[
|
98 |
-
'title' => __('Manual Control', 'kk-star-ratings'),
|
99 |
-
'name' => $manuallyControlled[0],
|
100 |
-
'help' => sprintf(__('Select the post types that should not auto embed the<br>markup and will be manually controlled by the theme.<br>E.g. Using %s in your template.', 'kk-star-ratings'), '<code>echo kk_star_ratings();</code>'),
|
101 |
-
'filter' => function ($values) {
|
102 |
-
return (array) $values;
|
103 |
-
},
|
104 |
-
'fields' => array_map(function ($field) use ($manuallyControlled) {
|
105 |
-
$field['type'] = 'checkbox';
|
106 |
-
$field['name'] = $manuallyControlled[0].'[]';
|
107 |
-
$field['checked'] = in_array($field['value'], $manuallyControlled[1]);
|
108 |
-
|
109 |
-
return $field;
|
110 |
-
}, $postTypes),
|
111 |
-
],
|
112 |
-
|
113 |
-
// Locations
|
114 |
-
|
115 |
-
[
|
116 |
-
'title' => __('Disable Locations', 'kk-star-ratings'),
|
117 |
-
'name' => $excludedLocations[0],
|
118 |
-
'help' => __('Select the locations where the star ratings should be excluded.', 'kk-star-ratings'),
|
119 |
-
'filter' => function ($values) {
|
120 |
-
return (array) $values;
|
121 |
-
},
|
122 |
-
'fields' => array_map(function ($field) use ($excludedLocations) {
|
123 |
-
$field['type'] = 'checkbox';
|
124 |
-
$field['name'] = $excludedLocations[0].'[]';
|
125 |
-
$field['checked'] = in_array($field['value'], $excludedLocations[1]);
|
126 |
-
|
127 |
-
return $field;
|
128 |
-
}, array_merge([
|
129 |
-
[
|
130 |
-
'label' => __('Home page', 'kk-star-ratings'),
|
131 |
-
'value' => 'home',
|
132 |
-
],
|
133 |
-
[
|
134 |
-
'label' => __('Archives', 'kk-star-ratings'),
|
135 |
-
'value' => 'archives',
|
136 |
-
],
|
137 |
-
], $postTypes)
|
138 |
-
),
|
139 |
-
],
|
140 |
-
|
141 |
-
// Categories
|
142 |
-
|
143 |
-
[
|
144 |
-
'type' => 'select',
|
145 |
-
'multiple' => true,
|
146 |
-
'title' => __('Disable Categories', 'kk-star-ratings'),
|
147 |
-
'name' => $excludedCategories[0],
|
148 |
-
'filter' => function ($values) {
|
149 |
-
return (array) $values;
|
150 |
-
},
|
151 |
-
'options' => array_map(function ($category) use ($excludedCategories) {
|
152 |
-
return [
|
153 |
-
'label' => $category->name,
|
154 |
-
'value' => $category->term_id,
|
155 |
-
'selected' => in_array($category->term_id, $excludedCategories[1]),
|
156 |
-
];
|
157 |
-
}, $categories),
|
158 |
-
'help' => __('Exclude star ratings from posts belonging to the selected categories.<br>Use <strong>cmd/ctrl + click</strong> to select/deselect multiple categories.', 'kk-star-ratings'),
|
159 |
-
],
|
160 |
-
|
161 |
-
// Position
|
162 |
-
|
163 |
-
[
|
164 |
-
'title' => __('Default Position', 'kk-star-ratings'),
|
165 |
-
'name' => $position[0],
|
166 |
-
'help' => __('Choose a default position.', 'kk-star-ratings'),
|
167 |
-
'fields' => [
|
168 |
-
[
|
169 |
-
'type' => 'radio',
|
170 |
-
'label' => __('Top Left', 'kk-star-ratings'),
|
171 |
-
'name' => $position[0],
|
172 |
-
'value' => 'top-left',
|
173 |
-
'checked' => checked($position[1], 'top-left', false),
|
174 |
-
],
|
175 |
-
[
|
176 |
-
'type' => 'radio',
|
177 |
-
'label' => __('Top Center', 'kk-star-ratings'),
|
178 |
-
'name' => $position[0],
|
179 |
-
'value' => 'top-center',
|
180 |
-
'checked' => checked($position[1], 'top-center', false),
|
181 |
-
],
|
182 |
-
[
|
183 |
-
'type' => 'radio',
|
184 |
-
'label' => __('Top Right', 'kk-star-ratings'),
|
185 |
-
'name' => $position[0],
|
186 |
-
'value' => 'top-right',
|
187 |
-
'checked' => checked($position[1], 'top-right', false),
|
188 |
-
],
|
189 |
-
[
|
190 |
-
'type' => 'radio',
|
191 |
-
'label' => __('Bottom Left', 'kk-star-ratings'),
|
192 |
-
'name' => $position[0],
|
193 |
-
'value' => 'bottom-left',
|
194 |
-
'checked' => checked($position[1], 'bottom-left', false),
|
195 |
-
],
|
196 |
-
[
|
197 |
-
'type' => 'radio',
|
198 |
-
'label' => __('Bottom Center', 'kk-star-ratings'),
|
199 |
-
'name' => $position[0],
|
200 |
-
'value' => 'bottom-center',
|
201 |
-
'checked' => checked($position[1], 'bottom-center', false),
|
202 |
-
],
|
203 |
-
[
|
204 |
-
'type' => 'radio',
|
205 |
-
'label' => __('Bottom Right', 'kk-star-ratings'),
|
206 |
-
'name' => $position[0],
|
207 |
-
'value' => 'bottom-right',
|
208 |
-
'checked' => checked($position[1], 'bottom-right', false),
|
209 |
-
],
|
210 |
-
],
|
211 |
-
],
|
212 |
-
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/admin/rich-snippets.php
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of bhittani/kk-star-ratings.
|
5 |
-
*
|
6 |
-
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view
|
9 |
-
* the LICENSE file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Bhittani\StarRating;
|
13 |
-
|
14 |
-
if (! defined('ABSPATH')) {
|
15 |
-
http_response_code(404);
|
16 |
-
exit();
|
17 |
-
}
|
18 |
-
|
19 |
-
$grs = [prefix('grs'), get_option(prefix('grs'))];
|
20 |
-
$sd = [prefix('sd'), get_option(prefix('sd'))];
|
21 |
-
|
22 |
-
$snippet = str_replace('[title]', 'Post title', $sd[1]);
|
23 |
-
$snippet = str_replace('[best]', '5', $snippet);
|
24 |
-
$snippet = str_replace('[score]', '4.3', $snippet);
|
25 |
-
$snippet = str_replace('[count]', '20', $snippet);
|
26 |
-
|
27 |
-
return [
|
28 |
-
[
|
29 |
-
'type' => 'checkbox',
|
30 |
-
'title' => __('Status', 'kk-star-ratings'),
|
31 |
-
'label' => __('Enable', 'kk-star-ratings'),
|
32 |
-
'name' => $grs[0],
|
33 |
-
'value' => true,
|
34 |
-
'filter' => function ($bool) {
|
35 |
-
return (string) $bool;
|
36 |
-
},
|
37 |
-
'checked' => checked($grs[1], '1', false),
|
38 |
-
'help' => __('Enable/disable rich snippets.', 'kk-star-ratings'),
|
39 |
-
],
|
40 |
-
|
41 |
-
[
|
42 |
-
'type' => 'code',
|
43 |
-
'title' => __('Content', 'kk-star-ratings'),
|
44 |
-
'name' => $sd[0],
|
45 |
-
'value' => $sd[1],
|
46 |
-
'help' => implode('<br>', [
|
47 |
-
sprintf(__('Provide the %s structure.', 'kk-star-ratings'), '<code>ld+json</code>').'<br>',
|
48 |
-
__('The following variables are available:', 'kk-star-ratings').'<br>',
|
49 |
-
sprintf(__('%s Post title.', 'kk-star-ratings'), '<code>[title]</code>'),
|
50 |
-
sprintf(__('%s Average post ratings.', 'kk-star-ratings'), '<code>[score]</code>'),
|
51 |
-
sprintf(__('%s Number of votes casted.', 'kk-star-ratings'), '<code>[count]</code>'),
|
52 |
-
sprintf(__('%s Total amount of stars.', 'kk-star-ratings'), '<code>[best]</code>'),
|
53 |
-
'<br>'.sprintf(
|
54 |
-
__('You may <a href="%s" target="_blank">test the snippet here</a>.', 'kk-star-ratings'),
|
55 |
-
'https://search.google.com/structured-data/testing-tool?'
|
56 |
-
.http_build_query(['code' => $snippet])
|
57 |
-
),
|
58 |
-
]),
|
59 |
-
],
|
60 |
-
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/ajax.php
DELETED
@@ -1,66 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of bhittani/kk-star-ratings.
|
5 |
-
*
|
6 |
-
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view
|
9 |
-
* the LICENSE file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Bhittani\StarRating;
|
13 |
-
|
14 |
-
if (! defined('ABSPATH')) {
|
15 |
-
http_response_code(404);
|
16 |
-
exit();
|
17 |
-
}
|
18 |
-
|
19 |
-
add_action('wp_ajax_'.config('slug'), __NAMESPACE__.'\ajax');
|
20 |
-
add_action('wp_ajax_nopriv_'.config('slug'), __NAMESPACE__.'\ajax');
|
21 |
-
function ajax()
|
22 |
-
{
|
23 |
-
if (! check_ajax_referer(config('slug').'-ajax', 'nonce', false)) {
|
24 |
-
header('Content-Type: application/json; charset=utf-8', true, 403);
|
25 |
-
|
26 |
-
return wp_die(json_encode([
|
27 |
-
'error' => __('This action is forbidden.', 'kk-star-ratings'),
|
28 |
-
]));
|
29 |
-
}
|
30 |
-
|
31 |
-
if (! isset($_POST['id'])) {
|
32 |
-
header('Content-Type: application/json; charset=utf-8', true, 406);
|
33 |
-
|
34 |
-
return wp_die(json_encode([
|
35 |
-
'error' => __('An id is required to vote.', 'kk-star-ratings'),
|
36 |
-
]));
|
37 |
-
}
|
38 |
-
|
39 |
-
$id = sanitize_text_field($_POST['id']);
|
40 |
-
$slug = sanitize_text_field($_POST['slug']);
|
41 |
-
|
42 |
-
if (! apply_plugin_filters('can_vote', true, $id, $slug)) {
|
43 |
-
header('Content-Type: application/json; charset=utf-8', true, 401);
|
44 |
-
|
45 |
-
return wp_die(json_encode([
|
46 |
-
'error' => __('You are not allowed to vote.', 'kk-star-ratings'),
|
47 |
-
]));
|
48 |
-
}
|
49 |
-
|
50 |
-
if (! isset($_POST['score'])) {
|
51 |
-
header('Content-Type: application/json; charset=utf-8', true, 406);
|
52 |
-
|
53 |
-
return wp_die(json_encode([
|
54 |
-
'error' => __('A rating is required to vote.', 'kk-star-ratings'),
|
55 |
-
]));
|
56 |
-
}
|
57 |
-
|
58 |
-
$best = isset($_POST['best']) ? sanitize_text_field($_POST['best']) : get_option(prefix('stars'));
|
59 |
-
$best = max((int) $best, 1);
|
60 |
-
$score = sanitize_text_field($_POST['score']);
|
61 |
-
$score = min(max((int) $score, 1), $best);
|
62 |
-
|
63 |
-
do_plugin_action('vote', $score, $best, $id, $slug);
|
64 |
-
|
65 |
-
wp_die(response(compact('id', 'slug', 'best'), false), 201);
|
66 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets.php
DELETED
@@ -1,69 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of bhittani/kk-star-ratings.
|
5 |
-
*
|
6 |
-
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view
|
9 |
-
* the LICENSE file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Bhittani\StarRating;
|
13 |
-
|
14 |
-
if (! defined('ABSPATH')) {
|
15 |
-
http_response_code(404);
|
16 |
-
exit();
|
17 |
-
}
|
18 |
-
|
19 |
-
add_action('wp_enqueue_scripts', __NAMESPACE__.'\styles');
|
20 |
-
function styles($hook)
|
21 |
-
{
|
22 |
-
if (! get_option(prefix('enable'))) {
|
23 |
-
return;
|
24 |
-
}
|
25 |
-
|
26 |
-
wp_enqueue_style(
|
27 |
-
config('slug'),
|
28 |
-
config('url').'public/css/kk-star-ratings.css',
|
29 |
-
[],
|
30 |
-
config('version')
|
31 |
-
);
|
32 |
-
|
33 |
-
wp_add_inline_style(config('slug'), trim(get_view(config('path').'public/css/kk-star-ratings.css.php', [
|
34 |
-
'stars' => [
|
35 |
-
'active' => get_option(prefix('active_star')),
|
36 |
-
'inactive' => get_option(prefix('inactive_star')),
|
37 |
-
'selected' => get_option(prefix('selected_star')),
|
38 |
-
],
|
39 |
-
'gap' => max((int) get_option(prefix('gap')), 0),
|
40 |
-
])));
|
41 |
-
}
|
42 |
-
|
43 |
-
add_action('wp_enqueue_scripts', __NAMESPACE__.'\scripts');
|
44 |
-
function scripts($hook)
|
45 |
-
{
|
46 |
-
if (! get_option(prefix('enable'))) {
|
47 |
-
return;
|
48 |
-
}
|
49 |
-
|
50 |
-
wp_enqueue_script(
|
51 |
-
config('slug'),
|
52 |
-
config('url').'public/js/kk-star-ratings.js',
|
53 |
-
['jquery'],
|
54 |
-
config('version'),
|
55 |
-
true
|
56 |
-
);
|
57 |
-
|
58 |
-
wp_localize_script(
|
59 |
-
config('slug'),
|
60 |
-
str_replace('-', '_', config('slug')),
|
61 |
-
[
|
62 |
-
'action' => config('slug'),
|
63 |
-
'endpoint' => admin_url('admin-ajax.php'),
|
64 |
-
'nonce' => wp_create_nonce(config('slug').'-ajax'),
|
65 |
-
]
|
66 |
-
);
|
67 |
-
|
68 |
-
// wp_add_inline_script(config('slug'), '');
|
69 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/classes/Migration.php
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\classes;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\functions\autoload_class;
|
15 |
+
|
16 |
+
autoload_class(Stack::class);
|
17 |
+
|
18 |
+
class Migration extends Stack
|
19 |
+
{
|
20 |
+
/** @var callable */
|
21 |
+
protected $cron;
|
22 |
+
|
23 |
+
public function cron(callable $cron): self
|
24 |
+
{
|
25 |
+
$this->cron = $cron;
|
26 |
+
|
27 |
+
return $this;
|
28 |
+
}
|
29 |
+
|
30 |
+
public function isBusy(): bool
|
31 |
+
{
|
32 |
+
return ! $this->isEmpty()
|
33 |
+
&& $this->bottom()['status'] == 'working';
|
34 |
+
}
|
35 |
+
|
36 |
+
public function isPending(): bool
|
37 |
+
{
|
38 |
+
return ! ($this->isEmpty() || $this->isBusy());
|
39 |
+
}
|
40 |
+
|
41 |
+
public function create(string $tag, $payload): self
|
42 |
+
{
|
43 |
+
$this->push([
|
44 |
+
'payload' => $payload,
|
45 |
+
'status' => 'pending',
|
46 |
+
'tag' => $tag,
|
47 |
+
'times' => 0,
|
48 |
+
'timestamp' => time(),
|
49 |
+
]);
|
50 |
+
|
51 |
+
return $this;
|
52 |
+
}
|
53 |
+
|
54 |
+
public function replace($migration): self
|
55 |
+
{
|
56 |
+
$this->shift();
|
57 |
+
$this->unshift($migration);
|
58 |
+
|
59 |
+
return $this;
|
60 |
+
}
|
61 |
+
|
62 |
+
public function remove(): self
|
63 |
+
{
|
64 |
+
$this->shift();
|
65 |
+
|
66 |
+
return $this;
|
67 |
+
}
|
68 |
+
|
69 |
+
public function scheduleOnce(int $seconds = 5, bool $force = false): self
|
70 |
+
{
|
71 |
+
// $this->unschedule(true);
|
72 |
+
|
73 |
+
if ($this->cron
|
74 |
+
&& (! $this->isEmpty() || $force)
|
75 |
+
&& ! wp_next_scheduled($this->cron)
|
76 |
+
) {
|
77 |
+
wp_schedule_single_event(time() + $seconds, $this->cron, [], true);
|
78 |
+
}
|
79 |
+
|
80 |
+
return $this;
|
81 |
+
}
|
82 |
+
|
83 |
+
public function schedule(bool $force = false): self
|
84 |
+
{
|
85 |
+
if ($this->cron
|
86 |
+
&& (! $this->isEmpty() || $force)
|
87 |
+
&& ! wp_next_scheduled($this->cron)) {
|
88 |
+
wp_schedule_event(time(), 'one_minute', $this->cron);
|
89 |
+
}
|
90 |
+
|
91 |
+
return $this;
|
92 |
+
}
|
93 |
+
|
94 |
+
public function unschedule(bool $force = false): self
|
95 |
+
{
|
96 |
+
if ($this->cron
|
97 |
+
&& ($this->isEmpty() || $force)
|
98 |
+
) {
|
99 |
+
$timestamp = wp_next_scheduled($this->cron);
|
100 |
+
wp_unschedule_event($timestamp, $this->cron);
|
101 |
+
}
|
102 |
+
|
103 |
+
return $this;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* @return int
|
108 |
+
* 1 -> The migration was processed and completed.
|
109 |
+
* 2 -> The migration was processed but still pending.
|
110 |
+
* 4 -> There are no migrations available.
|
111 |
+
* 8 -> The migration is already being processed.
|
112 |
+
* 16 -> The migration is not current.
|
113 |
+
*/
|
114 |
+
public function migrate(string $tag, callable $fn): int
|
115 |
+
{
|
116 |
+
if ($this->isEmpty()) {
|
117 |
+
return 4;
|
118 |
+
}
|
119 |
+
|
120 |
+
$migration = $this->bottom();
|
121 |
+
|
122 |
+
if ($migration['tag'] !== $tag) {
|
123 |
+
return 16;
|
124 |
+
}
|
125 |
+
|
126 |
+
if ($migration['status'] == 'working') {
|
127 |
+
$seconds = time() - $migration['timestamp'];
|
128 |
+
|
129 |
+
if ($seconds <= 60) {
|
130 |
+
return 8;
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
$migration['status'] = 'working';
|
135 |
+
$migration['timestamp'] = time();
|
136 |
+
|
137 |
+
$this->replace($migration)->persist();
|
138 |
+
|
139 |
+
$value = $fn($migration['payload']);
|
140 |
+
|
141 |
+
if (is_null($value)) {
|
142 |
+
$this->remove()->persist();
|
143 |
+
|
144 |
+
return 1;
|
145 |
+
}
|
146 |
+
|
147 |
+
$migration['payload'] = $value;
|
148 |
+
$migration['status'] = 'pending';
|
149 |
+
$migration['timestamp'] = time();
|
150 |
+
$migration['times'] = $migration['times'] + 1;
|
151 |
+
|
152 |
+
$this->replace($migration)->persist();
|
153 |
+
|
154 |
+
return 2;
|
155 |
+
}
|
156 |
+
}
|
src/classes/Stack.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\classes;
|
13 |
+
|
14 |
+
use SplStack;
|
15 |
+
|
16 |
+
class Stack extends SplStack
|
17 |
+
{
|
18 |
+
/** @var callable */
|
19 |
+
protected $store;
|
20 |
+
|
21 |
+
/** @var string */
|
22 |
+
protected $storeKey;
|
23 |
+
|
24 |
+
public function __construct(callable $store, string $storeKey)
|
25 |
+
{
|
26 |
+
$this->store = $store;
|
27 |
+
$this->storeKey = $storeKey;
|
28 |
+
|
29 |
+
if ($serialized = $store($storeKey)) {
|
30 |
+
$this->unserialize(base64_decode($serialized));
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
public function persist(): void
|
35 |
+
{
|
36 |
+
($this->store)([$this->storeKey => base64_encode($this->serialize())]);
|
37 |
+
}
|
38 |
+
}
|
src/config.php
CHANGED
@@ -9,41 +9,34 @@
|
|
9 |
* the LICENSE file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
|
13 |
|
14 |
-
if (! defined('
|
15 |
http_response_code(404);
|
16 |
exit();
|
17 |
}
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
if (is_null($keyOrValues)) {
|
45 |
-
return $config;
|
46 |
-
}
|
47 |
-
|
48 |
-
return isset($config[$keyOrValues]) ? $config[$keyOrValues] : $default;
|
49 |
-
}
|
9 |
* the LICENSE file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
use function Bhittani\StarRating\functions\autoload;
|
13 |
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
http_response_code(404);
|
16 |
exit();
|
17 |
}
|
18 |
|
19 |
+
$ns = 'Bhittani\StarRating\\';
|
20 |
+
$path = plugin_dir_path(KK_STAR_RATINGS);
|
21 |
+
$src = $path.'src/';
|
22 |
+
|
23 |
+
return [
|
24 |
+
// Manifest
|
25 |
+
'file' => KK_STAR_RATINGS,
|
26 |
+
'namespace' => rtrim($ns, '\\'),
|
27 |
+
'path' => $path,
|
28 |
+
'signature' => plugin_basename(KK_STAR_RATINGS),
|
29 |
+
'url' => plugin_dir_url(KK_STAR_RATINGS),
|
30 |
+
] + get_file_data(KK_STAR_RATINGS, [
|
31 |
+
// Metadata
|
32 |
+
'author' => 'Author',
|
33 |
+
'author_url' => 'Author URI',
|
34 |
+
'domain' => 'Text Domain',
|
35 |
+
'name' => 'Plugin Name',
|
36 |
+
'nick' => 'Plugin Nick',
|
37 |
+
'slug' => 'Plugin Slug',
|
38 |
+
'version' => 'Version',
|
39 |
+
]) + [
|
40 |
+
'classes' => autoload($ns.'classes', $src.'classes'),
|
41 |
+
'functions' => autoload($ns.'functions', $src.'functions'),
|
42 |
+
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/core/actions/activate.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\option;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function activate(string $version, ?string $previous): void
|
22 |
+
{
|
23 |
+
$options = [];
|
24 |
+
|
25 |
+
foreach (array_keys(kksr('core.options')) as $key) {
|
26 |
+
$options[$key] = option($key);
|
27 |
+
}
|
28 |
+
|
29 |
+
option($options);
|
30 |
+
}
|
src/{i18n.php → core/actions/admin/content.php}
RENAMED
@@ -9,15 +9,14 @@
|
|
9 |
* the LICENSE file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Bhittani\StarRating;
|
13 |
|
14 |
-
if (! defined('
|
15 |
http_response_code(404);
|
16 |
exit();
|
17 |
}
|
18 |
|
19 |
-
|
20 |
-
function load_textdomain()
|
21 |
{
|
22 |
-
|
23 |
}
|
9 |
* the LICENSE file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Bhittani\StarRating\core\actions\admin;
|
13 |
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
http_response_code(404);
|
16 |
exit();
|
17 |
}
|
18 |
|
19 |
+
function content(?array $old, string $tab): void
|
|
|
20 |
{
|
21 |
+
// echo ...
|
22 |
}
|
src/core/actions/admin/index.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions\admin;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\action;
|
15 |
+
use function Bhittani\StarRating\core\functions\filter;
|
16 |
+
use function Bhittani\StarRating\core\functions\view;
|
17 |
+
use InvalidArgumentException;
|
18 |
+
|
19 |
+
if (! defined('KK_STAR_RATINGS')) {
|
20 |
+
http_response_code(404);
|
21 |
+
exit();
|
22 |
+
}
|
23 |
+
|
24 |
+
function index(): void
|
25 |
+
{
|
26 |
+
$tabs = filter('admin/tabs', []);
|
27 |
+
reset($tabs);
|
28 |
+
$active = filter('admin/active_tab', key($tabs) ?: 'general');
|
29 |
+
|
30 |
+
foreach ($tabs as $slug => &$tab) {
|
31 |
+
if (! is_array($tab)) {
|
32 |
+
$tab = ['name' => $tab];
|
33 |
+
}
|
34 |
+
|
35 |
+
$tab = [
|
36 |
+
'is_active' => $slug == $active,
|
37 |
+
] + $tab + [
|
38 |
+
'is_active' => false,
|
39 |
+
'is_addon' => false,
|
40 |
+
'is_disabled' => false,
|
41 |
+
];
|
42 |
+
}
|
43 |
+
|
44 |
+
$errors = [];
|
45 |
+
$payload = [];
|
46 |
+
$processed = false;
|
47 |
+
$nonce = __FUNCTION__;
|
48 |
+
$filename = preg_replace(['/ +/', '/[^a-z0-9_]+/'], ['_', ''], strtolower($active));
|
49 |
+
|
50 |
+
if (isset($_POST['submit'])) {
|
51 |
+
$processed = true;
|
52 |
+
$payload = $_POST;
|
53 |
+
unset($payload['_wpnonce'], $payload['_wp_http_referer'], $payload['submit']);
|
54 |
+
|
55 |
+
try {
|
56 |
+
if (wp_verify_nonce($_POST['_wpnonce'] ?? null, $nonce) === false) {
|
57 |
+
throw new InvalidArgumentException(__('You can only save the options via the admin.', 'kk-star-ratings'));
|
58 |
+
}
|
59 |
+
|
60 |
+
if ($filename) {
|
61 |
+
action('admin/save/'.$filename, $payload, $active);
|
62 |
+
}
|
63 |
+
|
64 |
+
action('admin/save', $payload, $active);
|
65 |
+
} catch (InvalidArgumentException $e) {
|
66 |
+
if (is_string($name = $e->getCode())) {
|
67 |
+
$errors[$name] = array_merge($errors[$name] ?? [], [$e->getMessage()]);
|
68 |
+
} else {
|
69 |
+
$errors[0] = array_merge($errors[0] ?? [], [$e->getMessage()]);
|
70 |
+
}
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
ob_start();
|
75 |
+
action('admin/content', $errors ? $payload : null, $active);
|
76 |
+
$content = ob_get_clean();
|
77 |
+
|
78 |
+
if ($filename) {
|
79 |
+
ob_start();
|
80 |
+
action('admin/tabs/'.$filename, $errors ? $payload : null, $active);
|
81 |
+
$content .= ob_get_clean();
|
82 |
+
}
|
83 |
+
|
84 |
+
$globalErrors = [];
|
85 |
+
|
86 |
+
if ($errors) {
|
87 |
+
$processed = false;
|
88 |
+
$globalErrors[] = __('There were some errors while saving the options.', 'kk-star-ratings');
|
89 |
+
}
|
90 |
+
|
91 |
+
$globalErrors = array_merge($globalErrors, $errors[0] ?? []);
|
92 |
+
|
93 |
+
echo view('admin/index.php', [
|
94 |
+
'active' => $active,
|
95 |
+
'author' => kksr('author'),
|
96 |
+
'authorUrl' => kksr('author_url'),
|
97 |
+
'content' => $content,
|
98 |
+
'errors' => $errors,
|
99 |
+
'globalErrors' => $globalErrors,
|
100 |
+
'label' => kksr('name'),
|
101 |
+
'nonce' => $nonce,
|
102 |
+
'processed' => $processed,
|
103 |
+
'slug' => kksr('slug'),
|
104 |
+
'tabs' => $tabs,
|
105 |
+
'version' => kksr('version'),
|
106 |
+
]);
|
107 |
+
}
|
src/core/actions/admin/save.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions\admin;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function save(array $payload, string $tab): void
|
20 |
+
{
|
21 |
+
// print_r(compact('tab', 'payload'));
|
22 |
+
}
|
src/core/actions/admin/save/appearance.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions\admin\save;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\option;
|
15 |
+
use function Bhittani\StarRating\core\functions\strip_prefix;
|
16 |
+
use function Bhittani\StarRating\functions\sanitize;
|
17 |
+
|
18 |
+
if (! defined('KK_STAR_RATINGS')) {
|
19 |
+
http_response_code(404);
|
20 |
+
exit();
|
21 |
+
}
|
22 |
+
|
23 |
+
function appearance(array $payload, string $tab): void
|
24 |
+
{
|
25 |
+
$payload = shortcode_atts(array_fill_keys([
|
26 |
+
'gap',
|
27 |
+
'greet',
|
28 |
+
'legend',
|
29 |
+
'position',
|
30 |
+
'size',
|
31 |
+
'stars',
|
32 |
+
], null), strip_prefix($payload));
|
33 |
+
|
34 |
+
option(sanitize($payload));
|
35 |
+
}
|
src/core/actions/admin/save/general.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions\admin\save;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\option;
|
15 |
+
use function Bhittani\StarRating\core\functions\strip_prefix;
|
16 |
+
use function Bhittani\StarRating\functions\sanitize;
|
17 |
+
|
18 |
+
if (! defined('KK_STAR_RATINGS')) {
|
19 |
+
http_response_code(404);
|
20 |
+
exit();
|
21 |
+
}
|
22 |
+
|
23 |
+
function general(array $payload, string $tab): void
|
24 |
+
{
|
25 |
+
$payload = shortcode_atts(array_fill_keys([
|
26 |
+
'enable',
|
27 |
+
'exclude_categories',
|
28 |
+
'locations',
|
29 |
+
'strategies',
|
30 |
+
], null), strip_prefix($payload));
|
31 |
+
|
32 |
+
option(sanitize($payload));
|
33 |
+
}
|
src/core/actions/admin/save/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if (! defined('KK_STAR_RATINGS')) {
|
13 |
+
http_response_code(404);
|
14 |
+
exit();
|
15 |
+
}
|
src/core/actions/admin/save/rich_snippets.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions\admin\save;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\option;
|
15 |
+
use function Bhittani\StarRating\core\functions\strip_prefix;
|
16 |
+
use function Bhittani\StarRating\functions\sanitize;
|
17 |
+
|
18 |
+
if (! defined('KK_STAR_RATINGS')) {
|
19 |
+
http_response_code(404);
|
20 |
+
exit();
|
21 |
+
}
|
22 |
+
|
23 |
+
function rich_snippets(array $payload, string $tab): void
|
24 |
+
{
|
25 |
+
$payload = shortcode_atts(array_fill_keys([
|
26 |
+
'grs',
|
27 |
+
'sd',
|
28 |
+
], null), strip_prefix($payload));
|
29 |
+
|
30 |
+
option(sanitize($payload, [
|
31 |
+
'sd' => function ($value) {
|
32 |
+
return wp_unslash(sanitize_textarea_field($value));
|
33 |
+
},
|
34 |
+
]));
|
35 |
+
}
|
src/core/actions/admin/script.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions\admin;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\migrations;
|
15 |
+
use function Bhittani\StarRating\core\functions\script_migrations;
|
16 |
+
|
17 |
+
if (! defined('KK_STAR_RATINGS')) {
|
18 |
+
http_response_code(404);
|
19 |
+
exit();
|
20 |
+
}
|
21 |
+
|
22 |
+
function script(bool $isDebugMode = false): void
|
23 |
+
{
|
24 |
+
// if (! migrations()->isEmpty()) {
|
25 |
+
// script_migrations($isDebugMode);
|
26 |
+
// }
|
27 |
+
}
|
src/core/actions/admin/style.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions\admin;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function style(bool $isDebugMode = false): void
|
20 |
+
{
|
21 |
+
}
|
src/core/actions/admin/tabs/appearance.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions\admin\tabs;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\get_hof;
|
15 |
+
use function Bhittani\StarRating\core\functions\view;
|
16 |
+
|
17 |
+
if (! defined('KK_STAR_RATINGS')) {
|
18 |
+
http_response_code(404);
|
19 |
+
exit();
|
20 |
+
}
|
21 |
+
|
22 |
+
function appearance(?array $old, string $tab): void
|
23 |
+
{
|
24 |
+
$get = get_hof($old);
|
25 |
+
|
26 |
+
echo view('admin/tabs/appearance.php', compact('old', 'tab', 'get'));
|
27 |
+
}
|
src/core/actions/admin/tabs/general.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions\admin\tabs;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\get_hof;
|
15 |
+
use function Bhittani\StarRating\core\functions\view;
|
16 |
+
|
17 |
+
if (! defined('KK_STAR_RATINGS')) {
|
18 |
+
http_response_code(404);
|
19 |
+
exit();
|
20 |
+
}
|
21 |
+
|
22 |
+
function general(?array $old, string $tab): void
|
23 |
+
{
|
24 |
+
$get = get_hof($old);
|
25 |
+
|
26 |
+
echo view('admin/tabs/general.php', compact('old', 'tab', 'get'));
|
27 |
+
}
|
src/core/actions/admin/tabs/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if (! defined('KK_STAR_RATINGS')) {
|
13 |
+
http_response_code(404);
|
14 |
+
exit();
|
15 |
+
}
|
src/core/actions/admin/tabs/rich_snippets.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions\admin\tabs;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\get_hof;
|
15 |
+
use function Bhittani\StarRating\core\functions\view;
|
16 |
+
|
17 |
+
if (! defined('KK_STAR_RATINGS')) {
|
18 |
+
http_response_code(404);
|
19 |
+
exit();
|
20 |
+
}
|
21 |
+
|
22 |
+
function rich_snippets(?array $old, string $tab): void
|
23 |
+
{
|
24 |
+
$get = get_hof($old);
|
25 |
+
|
26 |
+
echo view('admin/tabs/rich-snippets.php', compact('old', 'tab', 'get'));
|
27 |
+
}
|
src/core/actions/deactivate.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function deactivate(string $version): void
|
20 |
+
{
|
21 |
+
}
|
src/core/actions/downgrade.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\migrations;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function downgrade(string $version, string $previous): void
|
22 |
+
{
|
23 |
+
$migrations = migrations();
|
24 |
+
|
25 |
+
while (! $migrations->isEmpty()
|
26 |
+
// Pop until version matches.
|
27 |
+
&& (substr($tag = $migrations->top()['tag'], 0, 1) === 'v')
|
28 |
+
&& ($mtag = substr(explode('/', $tag, 2)[0], 1))
|
29 |
+
&& version_compare($mtag, $version, '!=')) {
|
30 |
+
$migrations->pop();
|
31 |
+
}
|
32 |
+
|
33 |
+
$migrations->persist();
|
34 |
+
}
|
src/core/actions/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if (! defined('KK_STAR_RATINGS')) {
|
13 |
+
http_response_code(404);
|
14 |
+
exit();
|
15 |
+
}
|
src/core/actions/init.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\migrate;
|
15 |
+
use function Bhittani\StarRating\core\functions\migrations;
|
16 |
+
|
17 |
+
if (! defined('KK_STAR_RATINGS')) {
|
18 |
+
http_response_code(404);
|
19 |
+
exit();
|
20 |
+
}
|
21 |
+
|
22 |
+
function init(array $config): void
|
23 |
+
{
|
24 |
+
// if (migrations()->isPending()) {
|
25 |
+
// migrate();
|
26 |
+
// }
|
27 |
+
}
|
src/core/actions/install.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function install(string $version): void
|
20 |
+
{
|
21 |
+
// v3 and v4 did not save its version due to a bug
|
22 |
+
// so we enforce a previous installation.
|
23 |
+
// Hence, lets upgrade!
|
24 |
+
upgrade($version, '5.0.0-alpha');
|
25 |
+
}
|
src/core/actions/markup.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\view;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function markup(array $payload): void
|
22 |
+
{
|
23 |
+
echo view('markup/index.php', $payload);
|
24 |
+
}
|
src/core/actions/metabox/content.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions\metabox;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\get_meta_hof;
|
15 |
+
use function Bhittani\StarRating\core\functions\view;
|
16 |
+
use WP_Post;
|
17 |
+
|
18 |
+
if (! defined('KK_STAR_RATINGS')) {
|
19 |
+
http_response_code(404);
|
20 |
+
exit();
|
21 |
+
}
|
22 |
+
|
23 |
+
function content(?string $type, WP_Post $post = null): void
|
24 |
+
{
|
25 |
+
$get = get_meta_hof(null, $post ? $post->ID : 0);
|
26 |
+
|
27 |
+
echo view('metabox/content.php', compact('get', 'type', 'post'));
|
28 |
+
}
|
src/core/actions/metabox/index.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions\metabox;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\action;
|
15 |
+
use function Bhittani\StarRating\core\functions\view;
|
16 |
+
use WP_Post;
|
17 |
+
|
18 |
+
if (! defined('KK_STAR_RATINGS')) {
|
19 |
+
http_response_code(404);
|
20 |
+
exit();
|
21 |
+
}
|
22 |
+
|
23 |
+
function index(?string $type, WP_Post $post = null): void
|
24 |
+
{
|
25 |
+
ob_start();
|
26 |
+
action('metabox/content', $type, $post);
|
27 |
+
$content = ob_get_clean();
|
28 |
+
|
29 |
+
echo view('metabox/index.php', compact('content'));
|
30 |
+
}
|
src/core/actions/metabox/save.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions\metabox;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\explode_meta_prefix;
|
15 |
+
use function Bhittani\StarRating\core\functions\post_meta;
|
16 |
+
use function Bhittani\StarRating\functions\sanitize;
|
17 |
+
|
18 |
+
if (! defined('KK_STAR_RATINGS')) {
|
19 |
+
http_response_code(404);
|
20 |
+
exit();
|
21 |
+
}
|
22 |
+
|
23 |
+
function save($id, array $payload): void
|
24 |
+
{
|
25 |
+
[$statusPrefix, $statusFieldName] = explode_meta_prefix('status_default');
|
26 |
+
$statusField = $statusPrefix.$statusFieldName;
|
27 |
+
|
28 |
+
if (isset($payload[$statusField])) {
|
29 |
+
post_meta($id, [
|
30 |
+
$statusFieldName => sanitize($payload[$statusField]),
|
31 |
+
]);
|
32 |
+
}
|
33 |
+
|
34 |
+
[$resetPrefix, $resetFieldName] = explode_meta_prefix('reset');
|
35 |
+
$resetField = $resetPrefix.$resetFieldName;
|
36 |
+
|
37 |
+
if ($payload[$resetField] ?? false) {
|
38 |
+
delete_post_meta($id, implode('', explode_meta_prefix('count_default')));
|
39 |
+
delete_post_meta($id, implode('', explode_meta_prefix('ratings_default')));
|
40 |
+
delete_post_meta($id, implode('', explode_meta_prefix('fingerprint_default')));
|
41 |
+
|
42 |
+
// Legacy support
|
43 |
+
delete_post_meta($id, implode('', explode_meta_prefix('casts'))); // < v5
|
44 |
+
delete_post_meta($id, implode('', explode_meta_prefix('ratings'))); // < v5
|
45 |
+
delete_post_meta($id, implode('', explode_meta_prefix('ref'))); // v3, v4
|
46 |
+
delete_post_meta($id, implode('', explode_meta_prefix('avg'))); // < v3
|
47 |
+
}
|
48 |
+
}
|
src/core/actions/save.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\filter;
|
15 |
+
use function Bhittani\StarRating\core\functions\post_meta;
|
16 |
+
|
17 |
+
if (! defined('KK_STAR_RATINGS')) {
|
18 |
+
http_response_code(404);
|
19 |
+
exit();
|
20 |
+
}
|
21 |
+
|
22 |
+
function save(float $outOf5, int $id, string $slug, array $payload): void
|
23 |
+
{
|
24 |
+
$count = (int) filter('count', null, $id, $slug);
|
25 |
+
$ratings = (float) filter('ratings', null, $id, $slug);
|
26 |
+
|
27 |
+
// For safe keeping, ensure we have not already casted this vote.
|
28 |
+
if ($count == ((int) $payload['count'] ?? 0)
|
29 |
+
&& $ratings == ((float) $payload['ratings'] ?? 0)
|
30 |
+
) {
|
31 |
+
$newCount = $count + 1;
|
32 |
+
$newRatings = $ratings + $outOf5;
|
33 |
+
|
34 |
+
$fingerprint = filter('fingerprint', null, $id, $slug);
|
35 |
+
|
36 |
+
post_meta($id, [
|
37 |
+
"count_{$slug}" => $newCount,
|
38 |
+
"ratings_{$slug}" => $newRatings,
|
39 |
+
"avg_{$slug}" => $newRatings / $newCount,
|
40 |
+
"fingerprint_{$slug}[]" => $fingerprint,
|
41 |
+
]);
|
42 |
+
|
43 |
+
// Legacy support...
|
44 |
+
$legacySlug = $slug == 'default' ? '' : "_{$slug}";
|
45 |
+
|
46 |
+
post_meta($id, [
|
47 |
+
"casts{$legacySlug}" => $newCount, // < v5
|
48 |
+
"ratings{$legacySlug}" => $newRatings, // < v5
|
49 |
+
"ref{$legacySlug}[]" => $fingerprint, // v3, v4
|
50 |
+
"avg{$legacySlug}" => $newRatings / $newCount, // < v3
|
51 |
+
]);
|
52 |
+
}
|
53 |
+
}
|
src/core/actions/script.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\migrations;
|
15 |
+
use function Bhittani\StarRating\core\functions\script_migrations;
|
16 |
+
|
17 |
+
if (! defined('KK_STAR_RATINGS')) {
|
18 |
+
http_response_code(404);
|
19 |
+
exit();
|
20 |
+
}
|
21 |
+
|
22 |
+
function script(bool $isDebugMode = false): void
|
23 |
+
{
|
24 |
+
// if (! migrations()->isEmpty()) {
|
25 |
+
// script_migrations($isDebugMode);
|
26 |
+
// }
|
27 |
+
|
28 |
+
wp_enqueue_script(
|
29 |
+
kksr('slug'),
|
30 |
+
kksr('core.url').'public/js/kk-star-ratings'
|
31 |
+
.($isDebugMode ? '' : '.min').'.js',
|
32 |
+
['jquery'],
|
33 |
+
kksr('version'),
|
34 |
+
true
|
35 |
+
);
|
36 |
+
|
37 |
+
wp_localize_script(
|
38 |
+
kksr('slug'),
|
39 |
+
str_replace('-', '_', kksr('slug')),
|
40 |
+
[
|
41 |
+
'action' => kksr('slug'),
|
42 |
+
'endpoint' => admin_url('admin-ajax.php'),
|
43 |
+
'nonce' => wp_create_nonce(kksr('core.wp.actions.wp_ajax_'.kksr('slug'))),
|
44 |
+
]
|
45 |
+
);
|
46 |
+
}
|
src/core/actions/sd.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\option;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function sd(array $payload): void
|
22 |
+
{
|
23 |
+
$sd = '<script type="application/ld+json">'.trim(option('sd')).'</script>';
|
24 |
+
$sd = str_replace('{best}', $payload['best'], $sd);
|
25 |
+
$sd = str_replace('{count}', $payload['count'], $sd);
|
26 |
+
$sd = str_replace('{score}', $payload['score'], $sd);
|
27 |
+
$sd = str_replace('{title}', $payload['title'], $sd);
|
28 |
+
|
29 |
+
echo $sd;
|
30 |
+
}
|
src/core/actions/style.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function style(bool $isDebugMode = false): void
|
20 |
+
{
|
21 |
+
wp_enqueue_style(
|
22 |
+
kksr('slug'),
|
23 |
+
kksr('core.url').'public/css/kk-star-ratings'
|
24 |
+
.($isDebugMode ? '' : '.min').'.css',
|
25 |
+
[],
|
26 |
+
kksr('version')
|
27 |
+
);
|
28 |
+
}
|
src/core/actions/upgrade.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\actions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\migrations;
|
15 |
+
use function Bhittani\StarRating\core\functions\upgrade_options;
|
16 |
+
|
17 |
+
if (! defined('KK_STAR_RATINGS')) {
|
18 |
+
http_response_code(404);
|
19 |
+
exit();
|
20 |
+
}
|
21 |
+
|
22 |
+
function upgrade(string $version, string $previous): void
|
23 |
+
{
|
24 |
+
if (version_compare($previous, '5.0.2', '<')) {
|
25 |
+
upgrade_options();
|
26 |
+
}
|
27 |
+
|
28 |
+
if (version_compare($previous, '5.1.4', '<')) {
|
29 |
+
$migrations = migrations();
|
30 |
+
|
31 |
+
if (! $migrations->isEmpty()
|
32 |
+
&& ($migration = $migrations->bottom())
|
33 |
+
&& $migration['tag'] == 'v5.1.0/posts'
|
34 |
+
) {
|
35 |
+
$migration['payload']['paged'] = 1;
|
36 |
+
$migration['payload']['posts_per_page'] = 5;
|
37 |
+
$migrations->replace($migration)->persist();
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
$migrations = migrations();
|
42 |
+
|
43 |
+
$pendingMigrations = [];
|
44 |
+
|
45 |
+
foreach (kksr('core.migrations') as $tag => $options) {
|
46 |
+
$mtag = (string) substr(explode('/', $tag, 2)[0], 1);
|
47 |
+
|
48 |
+
if (version_compare($mtag, $previous, '>')
|
49 |
+
&& version_compare($mtag, $version, '<=')
|
50 |
+
&& ($migrations->isEmpty()
|
51 |
+
|| (
|
52 |
+
($ttag = (string) substr(explode('/', $migrations->top()['tag'], 2)[0], 1))
|
53 |
+
&& version_compare($mtag, $ttag, '>')
|
54 |
+
)
|
55 |
+
)
|
56 |
+
) {
|
57 |
+
$pendingMigrations[] = compact('tag', 'options') + ['version' => $mtag];
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
// Will already be sorted, but lets be damn sure!
|
62 |
+
usort($pendingMigrations, function ($a, $b) {
|
63 |
+
return version_compare($a['version'], $b['version']);
|
64 |
+
});
|
65 |
+
|
66 |
+
foreach ($pendingMigrations as $pendingMigration) {
|
67 |
+
[$_, $payloadFn] = $pendingMigration['options']();
|
68 |
+
|
69 |
+
$migrations->create(
|
70 |
+
$pendingMigration['tag'],
|
71 |
+
$payloadFn($version, $previous)
|
72 |
+
);
|
73 |
+
}
|
74 |
+
|
75 |
+
$migrations->persist();
|
76 |
+
}
|
src/core/config.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
use function Bhittani\StarRating\functions\autoload;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
$ns = 'Bhittani\StarRating\core\\';
|
20 |
+
$url = plugin_dir_url(KK_STAR_RATINGS).'src/core/';
|
21 |
+
$path = plugin_dir_path(KK_STAR_RATINGS).'src/core/';
|
22 |
+
|
23 |
+
return [
|
24 |
+
// Manifest
|
25 |
+
'namespace' => rtrim($ns, '\\'),
|
26 |
+
'path' => $path,
|
27 |
+
'url' => $url,
|
28 |
+
'views' => $path.'views/',
|
29 |
+
] + [
|
30 |
+
// Source
|
31 |
+
'actions' => autoload($ns.'actions', $path.'actions'),
|
32 |
+
'filters' => autoload($ns.'filters', $path.'filters'),
|
33 |
+
'functions' => autoload($ns.'functions', $path.'functions'),
|
34 |
+
'migrations' => autoload($ns.'migrations', $path.'migrations'),
|
35 |
+
'wp' => [
|
36 |
+
'actions' => autoload($ns.'wp\actions', $path.'wp/actions'),
|
37 |
+
'filters' => autoload($ns.'wp\filters', $path.'wp/filters'),
|
38 |
+
'functions' => autoload($ns.'wp\functions', $path.'wp/functions'),
|
39 |
+
'shortcodes' => autoload($ns.'wp\shortcodes', $path.'wp/shortcodes'),
|
40 |
+
],
|
41 |
+
] + [
|
42 |
+
// Config
|
43 |
+
'post_meta' => [
|
44 |
+
'avg_*' => 0.0,
|
45 |
+
'count_*' => 0,
|
46 |
+
'fingerprint_*[]' => '',
|
47 |
+
'ratings_*' => 0.0,
|
48 |
+
'status_*' => '',
|
49 |
+
],
|
50 |
+
'options' => [
|
51 |
+
// General
|
52 |
+
'enable' => true,
|
53 |
+
'exclude_categories' => [],
|
54 |
+
'locations' => ['post'],
|
55 |
+
'strategies' => ['archives', 'guests'],
|
56 |
+
// Appearance
|
57 |
+
'gap' => 5,
|
58 |
+
'greet' => 'Rate this {type}',
|
59 |
+
'legend' => '{score}/{best} - ({count} {votes})',
|
60 |
+
'position' => 'top-left',
|
61 |
+
'size' => 24,
|
62 |
+
'stars' => 5,
|
63 |
+
// Rich snippets
|
64 |
+
'grs' => true,
|
65 |
+
'sd' => '
|
66 |
+
{
|
67 |
+
"@context": "https://schema.org/",
|
68 |
+
"@type": "CreativeWorkSeries",
|
69 |
+
"name": "{title}",
|
70 |
+
"aggregateRating": {
|
71 |
+
"@type": "AggregateRating",
|
72 |
+
"ratingValue": "{score}",
|
73 |
+
"bestRating": "{best}",
|
74 |
+
"ratingCount": "{count}"
|
75 |
+
}
|
76 |
+
}
|
77 |
+
',
|
78 |
+
],
|
79 |
+
];
|
src/core/filters/admin/active_tab.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\filters\admin;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function active_tab(string $active): string
|
20 |
+
{
|
21 |
+
if (! ($_GET['tab'] ?? false)) {
|
22 |
+
return $active;
|
23 |
+
}
|
24 |
+
|
25 |
+
return sanitize_text_field($_GET['tab']);
|
26 |
+
}
|
src/core/filters/admin/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if (! defined('KK_STAR_RATINGS')) {
|
13 |
+
http_response_code(404);
|
14 |
+
exit();
|
15 |
+
}
|
src/core/filters/admin/tabs.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\filters\admin;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function tabs(array $tabs): array
|
20 |
+
{
|
21 |
+
return $tabs + [
|
22 |
+
'general' => _x('General', 'Label', 'kk-star-ratings'),
|
23 |
+
'appearance' => _x('Appearance', 'Label', 'kk-star-ratings'),
|
24 |
+
'rich_snippets' => _x('Rich Snippets', 'Label', 'kk-star-ratings'),
|
25 |
+
// 'tab' => [
|
26 |
+
// 'name' => _x('Name', 'Label', 'kk-star-ratings'),
|
27 |
+
// 'is_disabled' => true,
|
28 |
+
// 'is_addon' => false,
|
29 |
+
// ],
|
30 |
+
];
|
31 |
+
}
|
src/core/filters/count.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\filters;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\post_meta;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function count(?int $count, int $id, string $slug): int
|
22 |
+
{
|
23 |
+
if (! is_null($count)) {
|
24 |
+
return $count;
|
25 |
+
}
|
26 |
+
|
27 |
+
return (int) post_meta($id, "count_{$slug}");
|
28 |
+
}
|
src/core/filters/fingerprint.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\filters;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function fingerprint(?string $fingerprint, int $id, string $slug): string
|
20 |
+
{
|
21 |
+
if (! is_null($fingerprint)) {
|
22 |
+
return $fingerprint;
|
23 |
+
}
|
24 |
+
|
25 |
+
return md5($_SERVER['REMOTE_ADDR']);
|
26 |
+
}
|
src/core/filters/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if (! defined('KK_STAR_RATINGS')) {
|
13 |
+
http_response_code(404);
|
14 |
+
exit();
|
15 |
+
}
|
src/core/filters/okay.php
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\filters;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\filter;
|
15 |
+
use function Bhittani\StarRating\core\functions\migrations;
|
16 |
+
use function Bhittani\StarRating\core\functions\option;
|
17 |
+
use function count;
|
18 |
+
|
19 |
+
if (! defined('KK_STAR_RATINGS')) {
|
20 |
+
http_response_code(404);
|
21 |
+
exit();
|
22 |
+
}
|
23 |
+
|
24 |
+
function okay(?bool $okay, int $id, string $slug, array $payload): bool
|
25 |
+
{
|
26 |
+
if (! is_null($okay)) {
|
27 |
+
return $okay;
|
28 |
+
}
|
29 |
+
|
30 |
+
// if (! migrations()->isEmpty()) {
|
31 |
+
// return false;
|
32 |
+
// }
|
33 |
+
|
34 |
+
if (! option('enable')) {
|
35 |
+
return false;
|
36 |
+
}
|
37 |
+
|
38 |
+
$reference = $payload['reference'] ?? null;
|
39 |
+
|
40 |
+
if ($reference == 'template') {
|
41 |
+
return true;
|
42 |
+
}
|
43 |
+
|
44 |
+
$locations = (array) option('locations');
|
45 |
+
|
46 |
+
if ((is_front_page() || is_home()) && ! in_array('home', $locations)) {
|
47 |
+
return false;
|
48 |
+
}
|
49 |
+
|
50 |
+
if (is_archive() && ! in_array('archives', $locations)) {
|
51 |
+
return false;
|
52 |
+
}
|
53 |
+
|
54 |
+
if ($reference == 'shortcode') {
|
55 |
+
return true;
|
56 |
+
}
|
57 |
+
|
58 |
+
$status = filter('status', null, $id, $slug);
|
59 |
+
|
60 |
+
if ($status == 'disable') {
|
61 |
+
return false;
|
62 |
+
}
|
63 |
+
|
64 |
+
if ($status == 'enable') {
|
65 |
+
return true;
|
66 |
+
}
|
67 |
+
|
68 |
+
$type = get_post_type($id);
|
69 |
+
|
70 |
+
if (! in_array($type, $locations)) {
|
71 |
+
return false;
|
72 |
+
}
|
73 |
+
|
74 |
+
$categories = array_map(function ($category) {
|
75 |
+
return $category->term_id;
|
76 |
+
}, get_the_category($id));
|
77 |
+
|
78 |
+
$excludedCategories = (array) option('exclude_categories');
|
79 |
+
|
80 |
+
if (count($categories) != count(array_diff($categories, $excludedCategories))) {
|
81 |
+
return false;
|
82 |
+
}
|
83 |
+
|
84 |
+
return true;
|
85 |
+
}
|
src/core/filters/payload.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\filters;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\calculate;
|
15 |
+
use function Bhittani\StarRating\core\functions\width;
|
16 |
+
|
17 |
+
if (! defined('KK_STAR_RATINGS')) {
|
18 |
+
http_response_code(404);
|
19 |
+
exit();
|
20 |
+
}
|
21 |
+
|
22 |
+
function payload(array $payload): array
|
23 |
+
{
|
24 |
+
[$count, $score] = calculate($payload['id'], $payload['slug'], $payload['best']);
|
25 |
+
|
26 |
+
if (! (is_numeric($payload['count']) || $payload['count'])) {
|
27 |
+
$payload['count'] = $count;
|
28 |
+
}
|
29 |
+
|
30 |
+
if (! (is_numeric($payload['score']) || $payload['score'])) {
|
31 |
+
$payload['score'] = $score;
|
32 |
+
}
|
33 |
+
|
34 |
+
$payload['width'] = width($payload['score'], $payload['size'], $payload['gap']);
|
35 |
+
|
36 |
+
return $payload;
|
37 |
+
}
|
src/core/filters/ratings.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\filters;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\post_meta;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function ratings(?float $ratings, int $id, string $slug): float
|
22 |
+
{
|
23 |
+
if (! is_null($ratings)) {
|
24 |
+
return $ratings;
|
25 |
+
}
|
26 |
+
|
27 |
+
return (float) post_meta($id, "ratings_{$slug}");
|
28 |
+
}
|
src/core/filters/score.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\filters;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function score(float $score): float
|
20 |
+
{
|
21 |
+
return round($score, 1, PHP_ROUND_HALF_DOWN);
|
22 |
+
}
|
src/core/filters/status.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\filters;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\post_meta;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function status(?string $status, int $id, string $slug): string
|
22 |
+
{
|
23 |
+
if (! is_null($status)) {
|
24 |
+
return $status;
|
25 |
+
}
|
26 |
+
|
27 |
+
return post_meta($id, "status_{$slug}");
|
28 |
+
}
|
src/core/filters/unique.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\filters;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\post_meta;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function unique(?bool $bool, string $fingerprint, int $id, string $slug): bool
|
22 |
+
{
|
23 |
+
if (! is_null($bool)) {
|
24 |
+
return $bool;
|
25 |
+
}
|
26 |
+
|
27 |
+
return ! in_array($fingerprint, post_meta($id, "fingerprint_{$slug}[]"));
|
28 |
+
}
|
src/core/filters/validate.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\filters;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\filter;
|
15 |
+
use function Bhittani\StarRating\core\functions\migrations;
|
16 |
+
use function Bhittani\StarRating\core\functions\option;
|
17 |
+
use Exception;
|
18 |
+
|
19 |
+
if (! defined('KK_STAR_RATINGS')) {
|
20 |
+
http_response_code(404);
|
21 |
+
exit();
|
22 |
+
}
|
23 |
+
|
24 |
+
function validate(?bool $valid, int $id, string $slug, array $payload): bool
|
25 |
+
{
|
26 |
+
if (! is_null($valid)) {
|
27 |
+
return $valid;
|
28 |
+
}
|
29 |
+
|
30 |
+
if ($payload['readonly'] ?? false) {
|
31 |
+
throw new Exception(__('The ratings are readonly.', 'kk-star-ratings'));
|
32 |
+
}
|
33 |
+
|
34 |
+
// if (! migrations()->isEmpty()) {
|
35 |
+
// throw new Exception(__('Under maintenance.', 'kk-star-ratings'));
|
36 |
+
// }
|
37 |
+
|
38 |
+
if (! option('enable')) {
|
39 |
+
throw new Exception(__('Not allowed at the moment.', 'kk-star-ratings'));
|
40 |
+
}
|
41 |
+
|
42 |
+
$strategies = (array) option('strategies');
|
43 |
+
|
44 |
+
if (is_archive()
|
45 |
+
&& ! in_array('archives', $strategies)
|
46 |
+
) {
|
47 |
+
throw new Exception(__('You can not cast a vote in archives.', 'kk-star-ratings'));
|
48 |
+
}
|
49 |
+
|
50 |
+
if (! (is_user_logged_in()
|
51 |
+
|| in_array('guests', $strategies)
|
52 |
+
)) {
|
53 |
+
throw new Exception(__('You need to be authenticated to cast a vote.', 'kk-star-ratings'), 401);
|
54 |
+
}
|
55 |
+
|
56 |
+
$fingerprint = filter('fingerprint', null, $id, $slug);
|
57 |
+
|
58 |
+
if (in_array('unique', $strategies)
|
59 |
+
&& ! filter('unique', null, $fingerprint, $id, $slug)
|
60 |
+
) {
|
61 |
+
throw new Exception(__('You have already casted your vote.', 'kk-star-ratings'), 403);
|
62 |
+
}
|
63 |
+
|
64 |
+
return true;
|
65 |
+
}
|
src/core/functions/action.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\functions\action as base_action;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function action(string $tag, ...$args): void
|
22 |
+
{
|
23 |
+
base_action('Bhittani\StarRating\core\actions', $tag, ...$args);
|
24 |
+
}
|
src/core/functions/calculate.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\functions\cast;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function calculate(int $id, string $slug, int $best = 5): array
|
22 |
+
{
|
23 |
+
$count = (int) filter('count', null, $id, $slug);
|
24 |
+
$ratings = (float) filter('ratings', null, $id, $slug);
|
25 |
+
$score = $count ? ($ratings / $count) : 0;
|
26 |
+
$score = (float) min(max(0, cast($score, $best)), $best);
|
27 |
+
$score = filter('score', $score);
|
28 |
+
|
29 |
+
return [$count, $score];
|
30 |
+
}
|
src/core/functions/explode_meta_prefix.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\functions\explode_prefix;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function explode_meta_prefix(string $key): array
|
22 |
+
{
|
23 |
+
return explode_prefix($key, '_'.kksr('nick').'_');
|
24 |
+
}
|
src/core/functions/explode_prefix.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\functions\explode_prefix as base_explode_prefix;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function explode_prefix(string $key): array
|
22 |
+
{
|
23 |
+
return base_explode_prefix($key, kksr('nick').'_');
|
24 |
+
}
|
src/core/functions/filter.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\functions\filter as base_filter;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function filter(string $tag, ...$args)
|
22 |
+
{
|
23 |
+
return base_filter('Bhittani\StarRating\core\filters', $tag, ...$args);
|
24 |
+
}
|
src/core/functions/get_hof.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\functions\get_hof as base_get_hof;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function get_hof(?array $payload): callable
|
22 |
+
{
|
23 |
+
return base_get_hof($payload, kksr('core.functions.option'), kksr('nick').'_', array_map('gettype', kksr('core.options')));
|
24 |
+
}
|
src/core/functions/get_meta_hof.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\functions\get_hof;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
/** @param int|string $id */
|
22 |
+
function get_meta_hof(?array $payload, $id): callable
|
23 |
+
{
|
24 |
+
$delegate = function (string $key, $default = null) use ($id) {
|
25 |
+
return post_meta($id, $key, $default);
|
26 |
+
};
|
27 |
+
|
28 |
+
return get_hof($payload, $delegate, '_'.kksr('nick').'_', array_map('gettype', kksr('core.post_meta')));
|
29 |
+
}
|
src/core/functions/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if (! defined('KK_STAR_RATINGS')) {
|
13 |
+
http_response_code(404);
|
14 |
+
exit();
|
15 |
+
}
|
src/core/functions/meta_prefix.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\functions\prefix;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @param string|array $strOrPayload
|
23 |
+
*
|
24 |
+
* @return string|array
|
25 |
+
*/
|
26 |
+
function meta_prefix($strOrPayload)
|
27 |
+
{
|
28 |
+
return prefix($strOrPayload, '_'.kksr('nick').'_');
|
29 |
+
}
|
src/core/functions/migrate.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @return int
|
21 |
+
* 0 -> Could not process any migration.
|
22 |
+
* 1 -> The migration was processed and completed.
|
23 |
+
* 2 -> The migration was processed but still pending.
|
24 |
+
* 4 -> There are no migrations available.
|
25 |
+
* 8 -> The migration is already being processed.
|
26 |
+
* 16 -> The migration is not current.
|
27 |
+
*/
|
28 |
+
function migrate(): int
|
29 |
+
{
|
30 |
+
if (migrations()->isEmpty()) {
|
31 |
+
return 4;
|
32 |
+
}
|
33 |
+
|
34 |
+
foreach (kksr('core.migrations') as $tag => $options) {
|
35 |
+
[$fn] = $options();
|
36 |
+
$code = migrations()->migrate($tag, $fn);
|
37 |
+
|
38 |
+
if (in_array($code, [1, 2, 4, 8])) {
|
39 |
+
return $code;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
return isset($code) ? $code : 0;
|
44 |
+
}
|
src/core/functions/migrations.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
use Bhittani\StarRating\classes\Migration;
|
15 |
+
use function Bhittani\StarRating\functions\migrations as base_migrations;
|
16 |
+
|
17 |
+
if (! defined('KK_STAR_RATINGS')) {
|
18 |
+
http_response_code(404);
|
19 |
+
exit();
|
20 |
+
}
|
21 |
+
|
22 |
+
function migrations(): Migration
|
23 |
+
{
|
24 |
+
static $migrations;
|
25 |
+
|
26 |
+
return $migrations = $migrations
|
27 |
+
?: base_migrations(kksr('core.functions.option'));
|
28 |
+
}
|
src/core/functions/option.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\functions\option as base_option;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Get or update options.
|
23 |
+
*
|
24 |
+
* @param array|string $keyOrOptions
|
25 |
+
* @param mixed|null $default
|
26 |
+
*/
|
27 |
+
function option($keyOrOptions, $default = null)
|
28 |
+
{
|
29 |
+
return base_option($keyOrOptions, $default, kksr('nick').'_', kksr('core.options'));
|
30 |
+
}
|
src/core/functions/post_meta.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\functions\post_meta as base_post_meta;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Get or update post meta.
|
23 |
+
*
|
24 |
+
* @param int|string $id
|
25 |
+
* @param array|string $keyOrMeta
|
26 |
+
* @param mixed|null $default
|
27 |
+
*/
|
28 |
+
function post_meta($id, $keyOrMeta, $default = null)
|
29 |
+
{
|
30 |
+
return base_post_meta($id, $keyOrMeta, $default, meta_prefix(''), kksr('core.post_meta'));
|
31 |
+
}
|
src/core/functions/prefix.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\functions\prefix as base_prefix;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @param string|array $strOrPayload
|
23 |
+
*
|
24 |
+
* @return string|array
|
25 |
+
*/
|
26 |
+
function prefix($strOrPayload)
|
27 |
+
{
|
28 |
+
return base_prefix($strOrPayload, kksr('nick').'_');
|
29 |
+
}
|
src/core/functions/response.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function response(array $payload): string
|
20 |
+
{
|
21 |
+
$payload += array_fill_keys([
|
22 |
+
'align', 'count', 'id', 'readonly',
|
23 |
+
'score', 'slug', 'valign',
|
24 |
+
], '') + [
|
25 |
+
'best' => option('stars'),
|
26 |
+
'gap' => option('gap'),
|
27 |
+
'greet' => option('greet'),
|
28 |
+
'legend' => option('legend'),
|
29 |
+
'size' => option('size'),
|
30 |
+
];
|
31 |
+
|
32 |
+
$payload['best'] = (int) $payload['best'];
|
33 |
+
$payload['gap'] = (int) $payload['gap'];
|
34 |
+
$payload['id'] = (int) $payload['id'];
|
35 |
+
$payload['readonly'] = (bool) $payload['readonly'];
|
36 |
+
$payload['size'] = (int) $payload['size'];
|
37 |
+
|
38 |
+
$payload = filter('payload', $payload);
|
39 |
+
|
40 |
+
$payload['greet'] = str_replace('{type}', get_post_type($payload['id']) ?: 'post', $payload['greet']);
|
41 |
+
$payload['_legend'] = $payload['legend'];
|
42 |
+
$payload['legend'] = str_replace('{best}', $payload['best'], $payload['legend']);
|
43 |
+
$payload['legend'] = str_replace('{count}', $payload['count'], $payload['legend']);
|
44 |
+
$payload['legend'] = str_replace('{score}', $payload['score'], $payload['legend']);
|
45 |
+
$payload['legend'] = str_replace('{votes}', _n('vote', 'votes', $payload['count'], 'kk-star-ratings'), $payload['legend']);
|
46 |
+
|
47 |
+
ob_start();
|
48 |
+
|
49 |
+
action('markup', $payload);
|
50 |
+
|
51 |
+
return ob_get_clean();
|
52 |
+
}
|
src/core/functions/script_migrations.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function script_migrations(bool $isDebugMode = false): void
|
20 |
+
{
|
21 |
+
wp_enqueue_script(
|
22 |
+
kksr('nick').'-migrations',
|
23 |
+
kksr('core.url').'public/js/kksr-migrations'
|
24 |
+
.($isDebugMode ? '' : '.min').'.js',
|
25 |
+
['jquery'],
|
26 |
+
kksr('version'),
|
27 |
+
true
|
28 |
+
);
|
29 |
+
|
30 |
+
wp_localize_script(
|
31 |
+
kksr('nick').'-migrations',
|
32 |
+
str_replace('-', '_', kksr('nick')).'_migrations',
|
33 |
+
[
|
34 |
+
'action' => kksr('nick').'-migrations',
|
35 |
+
'endpoint' => admin_url('admin-ajax.php'),
|
36 |
+
'nonce' => wp_create_nonce(kksr('core.wp.actions.wp_ajax_'.kksr('nick').'-migrations')),
|
37 |
+
]
|
38 |
+
);
|
39 |
+
}
|
src/core/functions/strip_meta_prefix.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\functions\strip_prefix;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @param string|array $strOrPayload
|
23 |
+
*
|
24 |
+
* @return string|array
|
25 |
+
*/
|
26 |
+
function strip_meta_prefix($strOrPayload)
|
27 |
+
{
|
28 |
+
return strip_prefix($strOrPayload, '_'.kksr('nick').'_');
|
29 |
+
}
|
src/core/functions/strip_prefix.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\functions\strip_prefix as base_strip_prefix;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @param string|array $strOrPayload
|
23 |
+
*
|
24 |
+
* @return string|array
|
25 |
+
*/
|
26 |
+
function strip_prefix($strOrPayload)
|
27 |
+
{
|
28 |
+
return base_strip_prefix($strOrPayload, kksr('nick').'_');
|
29 |
+
}
|
src/core/functions/upgrade_options.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
use stdClass;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function upgrade_options(): bool
|
22 |
+
{
|
23 |
+
// v2
|
24 |
+
|
25 |
+
if (option('grs', $fn = new stdClass) === $fn) {
|
26 |
+
option([
|
27 |
+
'strategies' => array_filter([
|
28 |
+
'guests',
|
29 |
+
option('unique') ? 'unique' : null,
|
30 |
+
option('disable_in_archives', true) ? null : 'archives',
|
31 |
+
]),
|
32 |
+
'exclude_locations' => array_filter([
|
33 |
+
option('show_in_home', true) ? null : 'home',
|
34 |
+
option('show_in_posts', true) ? null : 'post',
|
35 |
+
option('show_in_pages', true) ? null : 'page',
|
36 |
+
option('show_in_archives', true) ? null : 'archives',
|
37 |
+
]),
|
38 |
+
'exclude_categories' => is_array($exludeCategories = option('exclude_categories', []))
|
39 |
+
? $exludeCategories : array_map('trim', explode(',', $exludeCategories)),
|
40 |
+
]);
|
41 |
+
}
|
42 |
+
|
43 |
+
// > v2
|
44 |
+
|
45 |
+
$varRegex = '/\[([a-zA-Z0-9_-]+?)\]/';
|
46 |
+
$varReplacement = '{$1}';
|
47 |
+
|
48 |
+
option(array_filter([
|
49 |
+
'greet' => preg_replace($varRegex, $varReplacement, option('greet')),
|
50 |
+
'sd' => preg_replace($varRegex, $varReplacement, option('sd')),
|
51 |
+
// This was used in v2 but not afterwards, hence, force to default.
|
52 |
+
'legend' => kksr('core.options.legend'),
|
53 |
+
]));
|
54 |
+
|
55 |
+
return true;
|
56 |
+
}
|
src/core/functions/upgrade_posts.php
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\functions\cast;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function upgrade_posts(array $args = []): array
|
22 |
+
{
|
23 |
+
$minId = $args['min_id'] ?? 0;
|
24 |
+
$maxId = $args['max_id'] ?? null;
|
25 |
+
unset($args['min_id'], $args['max_id']);
|
26 |
+
|
27 |
+
$whereMaxIdClause = function ($where) use ($minId, $maxId) {
|
28 |
+
global $wpdb;
|
29 |
+
|
30 |
+
if ($minId) {
|
31 |
+
$where .= $wpdb->prepare(" AND {$wpdb->posts}.ID >= %d", $minId);
|
32 |
+
}
|
33 |
+
|
34 |
+
if ($maxId) {
|
35 |
+
$where .= $wpdb->prepare(" AND {$wpdb->posts}.ID <= %d", $maxId);
|
36 |
+
}
|
37 |
+
|
38 |
+
return $where;
|
39 |
+
};
|
40 |
+
|
41 |
+
$args = array_replace_recursive([
|
42 |
+
'cache_results' => false,
|
43 |
+
'update_post_meta_cache' => false,
|
44 |
+
'update_post_term_cache' => false,
|
45 |
+
'suppress_filters' => false,
|
46 |
+
'fields' => 'ids',
|
47 |
+
'order' => 'ASC',
|
48 |
+
'orderby' => 'ID',
|
49 |
+
'post_type' => 'any',
|
50 |
+
'post_status' => 'any',
|
51 |
+
'posts_per_page' => -1,
|
52 |
+
'meta_query' => [
|
53 |
+
'relation' => 'OR',
|
54 |
+
[
|
55 |
+
'key' => meta_prefix('avg'),
|
56 |
+
'compare' => 'EXISTS',
|
57 |
+
],
|
58 |
+
[
|
59 |
+
'key' => meta_prefix('ratings'),
|
60 |
+
'compare' => 'EXISTS',
|
61 |
+
],
|
62 |
+
[
|
63 |
+
'key' => meta_prefix('ratings_default'),
|
64 |
+
'compare' => 'EXISTS',
|
65 |
+
],
|
66 |
+
],
|
67 |
+
], $args);
|
68 |
+
|
69 |
+
add_filter('posts_where', $whereMaxIdClause);
|
70 |
+
$ids = get_posts($args);
|
71 |
+
remove_filter('posts_where', $whereMaxIdClause);
|
72 |
+
|
73 |
+
if (! $ids) {
|
74 |
+
return [];
|
75 |
+
}
|
76 |
+
|
77 |
+
foreach ($ids as $id) {
|
78 |
+
unset($avg, $count, $ratings);
|
79 |
+
|
80 |
+
// v5
|
81 |
+
if (metadata_exists('post', $id, meta_prefix('count_default'))) {
|
82 |
+
$count = max((int) post_meta($id, 'count_default'), 0);
|
83 |
+
}
|
84 |
+
|
85 |
+
// v5
|
86 |
+
if (metadata_exists('post', $id, meta_prefix('ratings_default'))) {
|
87 |
+
$ratings = max((float) post_meta($id, 'ratings_default'), 0);
|
88 |
+
}
|
89 |
+
|
90 |
+
// < v5
|
91 |
+
if (! isset($count)) {
|
92 |
+
$count = max((int) post_meta($id, 'casts'), 0);
|
93 |
+
}
|
94 |
+
|
95 |
+
// v3, v4
|
96 |
+
if (! isset($ratings) && metadata_exists('post', $id, meta_prefix('ratings'))) {
|
97 |
+
$ratings = max((float) post_meta($id, 'ratings'), 0);
|
98 |
+
}
|
99 |
+
|
100 |
+
// < v3
|
101 |
+
if (! isset($ratings)) {
|
102 |
+
$stars = max((int) option('stars', 5), 1);
|
103 |
+
$avg = min(max((float) post_meta($id, 'avg'), 0), $stars);
|
104 |
+
// 4 * 3 / 5 * 5 => 12
|
105 |
+
// 8 * 3 / 10 * 5 => 12
|
106 |
+
$ratings = cast($avg, 5, $stars) * $count; // Reset to base 5.
|
107 |
+
// $ratings = $avg * $count / $stars * 5; // Reset to base 5.
|
108 |
+
}
|
109 |
+
|
110 |
+
// Calculate fresh average.
|
111 |
+
$avg = $count ? ($ratings / $count) : 0;
|
112 |
+
|
113 |
+
post_meta($id, [
|
114 |
+
'avg' => $avg,
|
115 |
+
'casts' => $count,
|
116 |
+
'avg_default' => $avg,
|
117 |
+
'count_default' => $count,
|
118 |
+
'ratings_default' => $ratings,
|
119 |
+
]);
|
120 |
+
}
|
121 |
+
|
122 |
+
return $ids;
|
123 |
+
}
|
src/core/functions/view.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\functions\view as base_view;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
/** @throws InvalidArgumentException If the template is not found */
|
22 |
+
function view(string $path, array $payload = []): string
|
23 |
+
{
|
24 |
+
return base_view(kksr('core.views'), $path, $payload);
|
25 |
+
}
|
src/core/functions/width.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\functions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
/** Calculate the width, providing a gap */
|
20 |
+
function width(float $score, float $size, float $gap = 0): float
|
21 |
+
{
|
22 |
+
return max(0, $score * $size + $score * $gap - $gap / 2);
|
23 |
+
}
|
src/core/hooks.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
use function Bhittani\StarRating\functions\hook;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
foreach (kksr('core.actions') as $fn) {
|
20 |
+
hook('action', $fn, $fn, 9);
|
21 |
+
}
|
22 |
+
|
23 |
+
foreach (kksr('core.filters') as $fn) {
|
24 |
+
hook('filter', $fn, $fn, 9);
|
25 |
+
}
|
src/core/hydrate.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
use function Bhittani\StarRating\functions\hook;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
foreach (kksr('core.wp.actions') as $tag => $fn) {
|
20 |
+
hook('action', $tag, $fn);
|
21 |
+
}
|
22 |
+
|
23 |
+
foreach (kksr('core.wp.filters') as $tag => $fn) {
|
24 |
+
hook('filter', $tag, $fn);
|
25 |
+
}
|
26 |
+
|
27 |
+
foreach (kksr('core.wp.shortcodes') as $tag => $fn) {
|
28 |
+
add_shortcode($tag, $fn);
|
29 |
+
}
|
src/core/index.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if (! defined('KK_STAR_RATINGS')) {
|
13 |
+
http_response_code(404);
|
14 |
+
exit();
|
15 |
+
}
|
16 |
+
|
17 |
+
kksr(['core' => require __DIR__.'/config.php']);
|
18 |
+
|
19 |
+
require_once __DIR__.'/hooks.php';
|
20 |
+
require_once __DIR__.'/hydrate.php';
|
21 |
+
|
22 |
+
register_activation_hook(KK_STAR_RATINGS, kksr('core.wp.functions.activate'));
|
23 |
+
register_deactivation_hook(KK_STAR_RATINGS, kksr('core.wp.functions.deactivate'));
|
src/core/migrations/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if (! defined('KK_STAR_RATINGS')) {
|
13 |
+
http_response_code(404);
|
14 |
+
exit();
|
15 |
+
}
|
src/core/migrations/v5.1.0/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if (! defined('KK_STAR_RATINGS')) {
|
13 |
+
http_response_code(404);
|
14 |
+
exit();
|
15 |
+
}
|
src/core/migrations/v5.1.0/posts.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\migrations\v5_1_0;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\upgrade_posts;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function posts(): array
|
22 |
+
{
|
23 |
+
return [
|
24 |
+
// Migration callback.
|
25 |
+
function (array $payload) {
|
26 |
+
if (($ids = upgrade_posts($payload))
|
27 |
+
&& count($ids) >= 5
|
28 |
+
) {
|
29 |
+
++$payload['paged'];
|
30 |
+
|
31 |
+
return $payload;
|
32 |
+
}
|
33 |
+
},
|
34 |
+
// Initial payload.
|
35 |
+
function (string $version, string $previous) {
|
36 |
+
global $wpdb;
|
37 |
+
|
38 |
+
$maxIdRow = $wpdb->get_row("
|
39 |
+
SELECT ID
|
40 |
+
FROM {$wpdb->posts}
|
41 |
+
ORDER BY ID DESC
|
42 |
+
LIMIT 0,1
|
43 |
+
");
|
44 |
+
|
45 |
+
return [
|
46 |
+
'max_id' => (int) ($maxIdRow ? $maxIdRow->ID : null),
|
47 |
+
'paged' => 1,
|
48 |
+
'posts_per_page' => 5,
|
49 |
+
];
|
50 |
+
},
|
51 |
+
// Progress. [<total>, <current>]
|
52 |
+
// TODO: Work in progress!
|
53 |
+
// function (array $payload) {
|
54 |
+
// return [
|
55 |
+
// $payload['max_id'],
|
56 |
+
// $payload['posts_per_page'] * $payload['paged'],
|
57 |
+
// ];
|
58 |
+
// },
|
59 |
+
];
|
60 |
+
}
|
src/core/public/css/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if (! defined('KK_STAR_RATINGS')) {
|
13 |
+
http_response_code(404);
|
14 |
+
exit();
|
15 |
+
}
|
{public → src/core/public}/css/kk-star-ratings.css
RENAMED
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
.kk-star-ratings {
|
2 |
display: -webkit-inline-box !important;
|
3 |
display: -webkit-inline-flex !important;
|
@@ -7,7 +12,7 @@
|
|
7 |
-webkit-align-items: center;
|
8 |
-ms-flex-align: center;
|
9 |
align-items: center;
|
10 |
-
vertical-align: text-top;
|
11 |
}
|
12 |
|
13 |
.kk-star-ratings.kksr-valign-top {
|
@@ -52,7 +57,6 @@
|
|
52 |
}
|
53 |
|
54 |
.kk-star-ratings .kksr-stars {
|
55 |
-
/* display: flex; */
|
56 |
position: relative;
|
57 |
}
|
58 |
|
@@ -69,18 +73,20 @@
|
|
69 |
}
|
70 |
|
71 |
.kk-star-ratings .kksr-stars .kksr-star {
|
72 |
-
/* display: inline-flex; */
|
73 |
cursor: pointer;
|
74 |
-
|
75 |
}
|
76 |
|
77 |
.kk-star-ratings.kksr-disabled .kksr-stars .kksr-star {
|
78 |
cursor: default;
|
79 |
}
|
80 |
|
|
|
|
|
|
|
|
|
|
|
81 |
.kk-star-ratings .kksr-stars .kksr-star .kksr-icon {
|
82 |
-
/* fill: currentColor;
|
83 |
-
stroke: currentColor; */
|
84 |
transition: .3s all;
|
85 |
}
|
86 |
|
@@ -104,12 +110,14 @@
|
|
104 |
background-image: url("../svg/selected.svg");
|
105 |
}
|
106 |
|
|
|
|
|
107 |
.kk-star-ratings .kksr-legend {
|
108 |
margin-left: .75rem;
|
109 |
margin-right: .75rem;
|
110 |
-
font-size: 90%;
|
111 |
-
opacity: .8;
|
112 |
-
line-height: 1;
|
113 |
}
|
114 |
|
115 |
/* RTL */
|
@@ -119,7 +127,7 @@
|
|
119 |
right: 0;
|
120 |
}
|
121 |
|
122 |
-
[dir="rtl"] .kk-star-ratings .kksr-stars .kksr-star
|
123 |
-
|
124 |
-
|
125 |
-
}
|
1 |
+
/**
|
2 |
+
* kk Star Ratings
|
3 |
+
* @see https://github.com/kamalkhan/kk-star-ratings
|
4 |
+
*/
|
5 |
+
|
6 |
.kk-star-ratings {
|
7 |
display: -webkit-inline-box !important;
|
8 |
display: -webkit-inline-flex !important;
|
12 |
-webkit-align-items: center;
|
13 |
-ms-flex-align: center;
|
14 |
align-items: center;
|
15 |
+
/* vertical-align: text-top; */
|
16 |
}
|
17 |
|
18 |
.kk-star-ratings.kksr-valign-top {
|
57 |
}
|
58 |
|
59 |
.kk-star-ratings .kksr-stars {
|
|
|
60 |
position: relative;
|
61 |
}
|
62 |
|
73 |
}
|
74 |
|
75 |
.kk-star-ratings .kksr-stars .kksr-star {
|
|
|
76 |
cursor: pointer;
|
77 |
+
padding-right: 0px;
|
78 |
}
|
79 |
|
80 |
.kk-star-ratings.kksr-disabled .kksr-stars .kksr-star {
|
81 |
cursor: default;
|
82 |
}
|
83 |
|
84 |
+
/* .kk-star-ratings .kksr-stars .kksr-stars-active .kksr-star:last-child,
|
85 |
+
.kk-star-ratings .kksr-stars .kksr-stars-inactive .kksr-star:last-child {
|
86 |
+
padding-right: 0px !important;
|
87 |
+
} */
|
88 |
+
|
89 |
.kk-star-ratings .kksr-stars .kksr-star .kksr-icon {
|
|
|
|
|
90 |
transition: .3s all;
|
91 |
}
|
92 |
|
110 |
background-image: url("../svg/selected.svg");
|
111 |
}
|
112 |
|
113 |
+
/* Legend */
|
114 |
+
|
115 |
.kk-star-ratings .kksr-legend {
|
116 |
margin-left: .75rem;
|
117 |
margin-right: .75rem;
|
118 |
+
/* font-size: 90%; */
|
119 |
+
/* opacity: .8; */
|
120 |
+
/* line-height: 1; */
|
121 |
}
|
122 |
|
123 |
/* RTL */
|
127 |
right: 0;
|
128 |
}
|
129 |
|
130 |
+
/* [dir="rtl"] .kk-star-ratings .kksr-stars .kksr-stars-active .kksr-star:last-child,
|
131 |
+
[dir="rtl"] .kk-star-ratings .kksr-stars .kksr-stars-inactive .kksr-star:last-child {
|
132 |
+
padding-left: 0px !important;
|
133 |
+
} */
|
src/core/public/css/kk-star-ratings.min.css
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* kk Star Ratings
|
3 |
+
* @see https://github.com/kamalkhan/kk-star-ratings
|
4 |
+
*/
|
5 |
+
.kk-star-ratings{display:-webkit-inline-box!important;display:-webkit-inline-flex!important;display:-ms-inline-flexbox!important;display:inline-flex!important;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}.kk-star-ratings.kksr-valign-top{margin-bottom:2rem;display:-webkit-box!important;display:-webkit-flex!important;display:-ms-flexbox!important;display:flex!important}.kk-star-ratings.kksr-valign-bottom{margin-top:2rem;display:-webkit-box!important;display:-webkit-flex!important;display:-ms-flexbox!important;display:flex!important}.kk-star-ratings.kksr-align-left{-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-ms-flex-pack:flex-start;justify-content:flex-start}.kk-star-ratings.kksr-align-center{-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center}.kk-star-ratings.kksr-align-right{-webkit-box-pack:flex-end;-webkit-justify-content:flex-end;-ms-flex-pack:flex-end;justify-content:flex-end}.kk-star-ratings .kksr-muted{opacity:.5}.kk-star-ratings .kksr-stars{position:relative}.kk-star-ratings .kksr-stars .kksr-stars-active,.kk-star-ratings .kksr-stars .kksr-stars-inactive{display:flex}.kk-star-ratings .kksr-stars .kksr-stars-active{overflow:hidden;position:absolute;top:0;left:0}.kk-star-ratings .kksr-stars .kksr-star{cursor:pointer;padding-right:0}.kk-star-ratings.kksr-disabled .kksr-stars .kksr-star{cursor:default}.kk-star-ratings .kksr-stars .kksr-star .kksr-icon{transition:.3s all}.kk-star-ratings:not(.kksr-disabled) .kksr-stars:hover .kksr-stars-active{width:0!important}.kk-star-ratings .kksr-stars .kksr-star .kksr-icon,.kk-star-ratings:not(.kksr-disabled) .kksr-stars .kksr-star:hover~.kksr-star .kksr-icon{background-image:url(../svg/inactive.svg)}.kk-star-ratings .kksr-stars .kksr-stars-active .kksr-star .kksr-icon{background-image:url(../svg/active.svg)}.kk-star-ratings.kksr-disabled .kksr-stars .kksr-stars-active .kksr-star .kksr-icon,.kk-star-ratings:not(.kksr-disabled) .kksr-stars:hover .kksr-star .kksr-icon{background-image:url(../svg/selected.svg)}.kk-star-ratings .kksr-legend{margin-left:.75rem;margin-right:.75rem}[dir=rtl] .kk-star-ratings .kksr-stars .kksr-stars-active{left:auto;right:0}
|
src/core/public/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if (! defined('KK_STAR_RATINGS')) {
|
13 |
+
http_response_code(404);
|
14 |
+
exit();
|
15 |
+
}
|
src/core/public/js/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if (! defined('KK_STAR_RATINGS')) {
|
13 |
+
http_response_code(404);
|
14 |
+
exit();
|
15 |
+
}
|
src/core/public/js/kk-star-ratings.js
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* kk Star Ratings
|
3 |
+
* @see https://github.com/kamalkhan/kk-star-ratings
|
4 |
+
*/
|
5 |
+
|
6 |
+
"use strict";
|
7 |
+
|
8 |
+
// (function (fn) {
|
9 |
+
// if (document.readyState != 'loading'){
|
10 |
+
// return fn();
|
11 |
+
// }
|
12 |
+
|
13 |
+
// document.addEventListener('DOMContentLoaded', fn);
|
14 |
+
// })(function kkStarRatings() {
|
15 |
+
// console.log('ready!');
|
16 |
+
|
17 |
+
// function onClick(e) {
|
18 |
+
// e.preventDefault();
|
19 |
+
// var $el = e.currentTarget;
|
20 |
+
// console.log($el);
|
21 |
+
// //
|
22 |
+
// }
|
23 |
+
|
24 |
+
// var $els = document.querySelectorAll('.kk-star-ratings');
|
25 |
+
// for (var i = 0; i < $els.length; i++) {
|
26 |
+
// var $el = $els[i];
|
27 |
+
// console.log($el);
|
28 |
+
// var $stars = document.querySelectorAll('[data-star]', $el);
|
29 |
+
// for (var j = 0; j < $stars.length; j++) {
|
30 |
+
// var $star = $stars[j];
|
31 |
+
// console.log($star);
|
32 |
+
// $star.addEventListener('click', onClick);
|
33 |
+
// }
|
34 |
+
// }
|
35 |
+
// });
|
36 |
+
|
37 |
+
jQuery(document).ready(function ($) {
|
38 |
+
function apply($el, options) {
|
39 |
+
var options = options || { isBusy: false };
|
40 |
+
|
41 |
+
function ajax(data, successCallback, errorCallback) {
|
42 |
+
if (options.isBusy || $el.hasClass("kksr-disabled")) {
|
43 |
+
return;
|
44 |
+
}
|
45 |
+
|
46 |
+
options.isBusy = true;
|
47 |
+
|
48 |
+
$.ajax({
|
49 |
+
type: "POST",
|
50 |
+
url: kk_star_ratings.endpoint,
|
51 |
+
data: Object.assign(
|
52 |
+
{
|
53 |
+
nonce: kk_star_ratings.nonce,
|
54 |
+
action: kk_star_ratings.action,
|
55 |
+
},
|
56 |
+
data
|
57 |
+
),
|
58 |
+
error: errorCallback,
|
59 |
+
success: successCallback,
|
60 |
+
complete: function () {
|
61 |
+
options.isBusy = false;
|
62 |
+
},
|
63 |
+
});
|
64 |
+
}
|
65 |
+
|
66 |
+
function onClick(e) {
|
67 |
+
var $star = $(this);
|
68 |
+
|
69 |
+
// var payload = {
|
70 |
+
// id: $el.data('id'),
|
71 |
+
// slug: $el.data('slug'),
|
72 |
+
// score: $star.data('star'),
|
73 |
+
// best: $('[data-star]', $el).length
|
74 |
+
// };
|
75 |
+
|
76 |
+
ajax(
|
77 |
+
{
|
78 |
+
rating: $star.data("star"),
|
79 |
+
payload: $el.data("payload"),
|
80 |
+
},
|
81 |
+
function (response, status, xhr) {
|
82 |
+
var $newEl = $(response);
|
83 |
+
$newEl.addClass($el.attr("class"));
|
84 |
+
$el.replaceWith($newEl);
|
85 |
+
destroy();
|
86 |
+
apply($newEl, options);
|
87 |
+
},
|
88 |
+
function (xhr, status, err) {
|
89 |
+
if (xhr.responseJSON && xhr.responseJSON.error) {
|
90 |
+
console.error(xhr.responseJSON.error);
|
91 |
+
}
|
92 |
+
}
|
93 |
+
);
|
94 |
+
}
|
95 |
+
|
96 |
+
function destroy() {
|
97 |
+
$("[data-star]", $el).each(function () {
|
98 |
+
$(this).off("click", onClick);
|
99 |
+
});
|
100 |
+
|
101 |
+
$el.remove();
|
102 |
+
}
|
103 |
+
|
104 |
+
$("[data-star]", $el).each(function () {
|
105 |
+
$(this).on("click", onClick);
|
106 |
+
});
|
107 |
+
}
|
108 |
+
|
109 |
+
$(".kk-star-ratings").each(function () {
|
110 |
+
apply($(this));
|
111 |
+
});
|
112 |
+
});
|
src/core/public/js/kk-star-ratings.min.js
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* kk Star Ratings
|
3 |
+
* @see https://github.com/kamalkhan/kk-star-ratings
|
4 |
+
*/
|
5 |
+
"use strict";jQuery(document).ready(function(s){function a(t,n){n=n||{isBusy:!1};function r(e){var i,o,c,u=s(this);i={rating:u.data("star"),payload:t.data("payload")},o=function(e,i,o){var c=s(e);c.addClass(t.attr("class")),t.replaceWith(c),s("[data-star]",t).each(function(){s(this).off("click",r)}),t.remove(),a(c,n)},c=function(s,a,t){s.responseJSON&&s.responseJSON.error&&console.error(s.responseJSON.error)},n.isBusy||t.hasClass("kksr-disabled")||(n.isBusy=!0,s.ajax({type:"POST",url:kk_star_ratings.endpoint,data:Object.assign({nonce:kk_star_ratings.nonce,action:kk_star_ratings.action},i),error:c,success:o,complete:function(){n.isBusy=!1}}))}s("[data-star]",t).each(function(){s(this).on("click",r)})}s(".kk-star-ratings").each(function(){a(s(this))})});
|
src/core/public/js/kksr-migrations.js
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* kk Star Ratings
|
3 |
+
* @see https://github.com/kamalkhan/kk-star-ratings
|
4 |
+
*/
|
5 |
+
|
6 |
+
"use strict";
|
7 |
+
|
8 |
+
jQuery(document).ready(function ($) {
|
9 |
+
function ajax(successCallback, errorCallback) {
|
10 |
+
$.ajax({
|
11 |
+
type: "POST",
|
12 |
+
url: kksr_migrations.endpoint,
|
13 |
+
data: {
|
14 |
+
nonce: kksr_migrations.nonce,
|
15 |
+
action: kksr_migrations.action,
|
16 |
+
},
|
17 |
+
error: errorCallback,
|
18 |
+
success: successCallback,
|
19 |
+
});
|
20 |
+
}
|
21 |
+
|
22 |
+
function migrate() {
|
23 |
+
ajax(
|
24 |
+
function (response, status, xhr) {
|
25 |
+
if (response && response.data) {
|
26 |
+
if (response.data.status == "pending") {
|
27 |
+
migrate();
|
28 |
+
} else if (response.data.status == "busy") {
|
29 |
+
setTimeout(migrate, 5000);
|
30 |
+
}
|
31 |
+
}
|
32 |
+
},
|
33 |
+
function (xhr, status, err) {
|
34 |
+
if (xhr.responseJSON && xhr.responseJSON.error) {
|
35 |
+
console.error(xhr.responseJSON.error);
|
36 |
+
setTimeout(migrate, 5000);
|
37 |
+
}
|
38 |
+
}
|
39 |
+
);
|
40 |
+
}
|
41 |
+
|
42 |
+
migrate();
|
43 |
+
});
|
src/core/public/js/kksr-migrations.min.js
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* kk Star Ratings
|
3 |
+
* @see https://github.com/kamalkhan/kk-star-ratings
|
4 |
+
*/
|
5 |
+
"use strict";jQuery(document).ready(function(e){!function n(){var r,t;r=function(e,r,t){e&&e.data&&("pending"==e.data.status?n():"busy"==e.data.status&&setTimeout(n,5e3))},t=function(e,r,t){e.responseJSON&&e.responseJSON.error&&(console.error(e.responseJSON.error),setTimeout(n,5e3))},e.ajax({type:"POST",url:kksr_migrations.endpoint,data:{nonce:kksr_migrations.nonce,action:kksr_migrations.action},error:t,success:r})}()});
|
src/core/public/svg/active.svg
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
2 |
+
<path fill="orange" stroke="darkorange" stroke-width=".5" d="M12 .587l3.668 7.568L24 9.306l-6.064 5.828 1.48 8.279L12 19.446l-7.417 3.967 1.481-8.279L0 9.306l8.332-1.151z"/>
|
3 |
+
</svg>
|
src/core/public/svg/inactive.svg
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
2 |
+
<path fill="#fff" stroke="#777" stroke-width=".5" d="M12 .587l3.668 7.568L24 9.306l-6.064 5.828 1.48 8.279L12 19.446l-7.417 3.967 1.481-8.279L0 9.306l8.332-1.151z"/>
|
3 |
+
</svg>
|
src/core/public/svg/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if (! defined('KK_STAR_RATINGS')) {
|
13 |
+
http_response_code(404);
|
14 |
+
exit();
|
15 |
+
}
|
src/core/public/svg/selected.svg
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
2 |
+
<path fill="yellow" stroke="orange" stroke-width=".5" d="M12 .587l3.668 7.568L24 9.306l-6.064 5.828 1.48 8.279L12 19.446l-7.417 3.967 1.481-8.279L0 9.306l8.332-1.151z"/>
|
3 |
+
</svg>
|
src/core/views/admin/index.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (! defined('KK_STAR_RATINGS')) {
|
3 |
+
http_response_code(404);
|
4 |
+
exit();
|
5 |
+
}
|
6 |
+
?>
|
7 |
+
|
8 |
+
<div class="wrap">
|
9 |
+
<?php if ($globalErrors) {
|
10 |
+
foreach ($globalErrors as $error) { ?>
|
11 |
+
<div class="notice notice-error">
|
12 |
+
<p><?php echo esc_html($error); ?></p>
|
13 |
+
</div>
|
14 |
+
<?php }
|
15 |
+
} ?>
|
16 |
+
|
17 |
+
<?php if ($processed) { ?>
|
18 |
+
<div class="notice notice-success is-dismissible">
|
19 |
+
<p><?php echo esc_html(__('Options saved.', 'kk-star-ratings')); ?></p>
|
20 |
+
</div>
|
21 |
+
<?php } ?>
|
22 |
+
|
23 |
+
<h1>
|
24 |
+
<?php echo esc_html($label); ?>
|
25 |
+
<small style="
|
26 |
+
color: gray;
|
27 |
+
margin-left: .5rem;
|
28 |
+
letter-spacing: -2px;
|
29 |
+
font-family: monospace;">
|
30 |
+
<?php echo esc_html($version); ?>
|
31 |
+
</small>
|
32 |
+
<small>
|
33 |
+
by
|
34 |
+
<a href="<?php echo esc_attr($authorUrl); ?>" target="_blank">
|
35 |
+
<?php echo esc_html($author); ?>
|
36 |
+
</a>
|
37 |
+
</small>
|
38 |
+
</h1>
|
39 |
+
|
40 |
+
<h2 class="nav-tab-wrapper">
|
41 |
+
<?php foreach ($tabs as $tab => $tabMeta) { ?>
|
42 |
+
<a class="nav-tab <?php echo ($tabMeta['is_active'] ?? false) ? 'nav-tab-active' : ''; ?>"
|
43 |
+
style="position: relative; border-radius: 4px 4px 0 0; <?php echo ($tabMeta['is_disabled'] ?? false) ? 'opacity: 50%; pointer-events: none;' : ''; ?> <?php echo ($tabMeta['is_addon'] ?? false) ? (($tabMeta['is_active'] ?? false) ? 'background-color: auto; border-color: auto;' : 'background-color: #f6efc7; border-color: #ead2ae;') : ''; ?>"
|
44 |
+
href="<?php echo esc_url(add_query_arg(['page' => $_GET['page'] ?? '', 'tab' => $tab], admin_url('admin.php'))); ?>"
|
45 |
+
<?php ($tabMeta['is_disabled'] ?? false) ? 'onclick="return false;"' : ''; ?>>
|
46 |
+
<?php echo esc_html($tabMeta['name'] ?? 'Untitled'); ?>
|
47 |
+
<?php if ($tabMeta['is_addon'] ?? false) { ?>
|
48 |
+
<span style="position: absolute; z-index: 10; top: -9px; right: -9px; display: flex; align-items: center; justify-content: center; width: 21px; height: 21px; font-weight: 600; background-color: inherit; border-radius: 50%;">
|
49 |
+
$
|
50 |
+
</span>
|
51 |
+
<?php } ?>
|
52 |
+
</a>
|
53 |
+
<?php } ?>
|
54 |
+
<div style="float: left; margin-left: 10px;">
|
55 |
+
<?php echo $__view('admin/social.php'); ?>
|
56 |
+
</div>
|
57 |
+
</h2>
|
58 |
+
|
59 |
+
<form method="POST" style="margin: 2rem;">
|
60 |
+
<?php wp_nonce_field($nonce); ?>
|
61 |
+
<?php echo $content; ?>
|
62 |
+
<?php submit_button(); ?>
|
63 |
+
</form>
|
64 |
+
</div>
|
{views → src/core/views}/admin/social.php
RENAMED
@@ -1,11 +1,18 @@
|
|
1 |
<?php
|
2 |
-
if (! defined('
|
3 |
http_response_code(404);
|
4 |
-
|
5 |
}
|
6 |
?>
|
7 |
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
<!-- Github -->
|
10 |
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
11 |
|
@@ -46,7 +53,6 @@
|
|
46 |
data-text="kk Star Ratings is awesome."
|
47 |
data-url="https://github.com/kamalkhan/kk-star-ratings"
|
48 |
href="https://twitter.com/intent/tweet">
|
49 |
-
Tweet
|
50 |
</a>
|
51 |
</div>
|
52 |
|
1 |
<?php
|
2 |
+
if (! defined('KK_STAR_RATINGS')) {
|
3 |
http_response_code(404);
|
4 |
+
exit();
|
5 |
}
|
6 |
?>
|
7 |
|
8 |
+
<?php
|
9 |
+
if (! defined('KK_STAR_RATINGS')) {
|
10 |
+
http_response_code(404);
|
11 |
+
exit();
|
12 |
+
}
|
13 |
+
?>
|
14 |
+
|
15 |
+
<div>
|
16 |
<!-- Github -->
|
17 |
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
18 |
|
53 |
data-text="kk Star Ratings is awesome."
|
54 |
data-url="https://github.com/kamalkhan/kk-star-ratings"
|
55 |
href="https://twitter.com/intent/tweet">
|
|
|
56 |
</a>
|
57 |
</div>
|
58 |
|
src/core/views/admin/tabs/appearance.php
ADDED
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (! defined('KK_STAR_RATINGS')) {
|
3 |
+
http_response_code(404);
|
4 |
+
exit();
|
5 |
+
}
|
6 |
+
|
7 |
+
$gap = $get('gap');
|
8 |
+
$greet = $get('greet');
|
9 |
+
$legend = $get('legend');
|
10 |
+
$position = $get('position');
|
11 |
+
$size = $get('size');
|
12 |
+
$stars = $get('stars');
|
13 |
+
|
14 |
+
$positions = [
|
15 |
+
'top-left' => _x('Top Left', 'Label', 'kk-star-ratings'),
|
16 |
+
'top-center' => _x('Top Center', 'Label', 'kk-star-ratings'),
|
17 |
+
'top-right' => _x('Top Right', 'Label', 'kk-star-ratings'),
|
18 |
+
'bottom-left' => _x('Bottom Left', 'Label', 'kk-star-ratings'),
|
19 |
+
'bottom-center' => _x('Bottom Center', 'Label', 'kk-star-ratings'),
|
20 |
+
'bottom-right' => _x('Bottom Right', 'Label', 'kk-star-ratings'),
|
21 |
+
];
|
22 |
+
?>
|
23 |
+
|
24 |
+
<table class="form-table" role="presentation">
|
25 |
+
<tbody>
|
26 |
+
<!-- Greet -->
|
27 |
+
<tr>
|
28 |
+
<th scope="row" valign="top">
|
29 |
+
<label for="<?php echo esc_attr($greet[0]); ?>">
|
30 |
+
<?php echo esc_html_x('Greeting', 'Label', 'kk-star-ratings'); ?>
|
31 |
+
</label>
|
32 |
+
</th>
|
33 |
+
<td>
|
34 |
+
<p>
|
35 |
+
<input type="text" name="<?php echo esc_attr($greet[0]); ?>" id="<?php echo esc_attr($greet[0]); ?>" value="<?php echo esc_attr($greet[1]); ?>" placeholder="Rate this {type}" class="regular-text" style="font-family: monospace;">
|
36 |
+
</p>
|
37 |
+
<p class="description" style="max-width: 22rem; margin-top: .75rem;">
|
38 |
+
<?php echo esc_html__('Text that will be displayed when no votes have been casted.', 'kk-star-ratings'); ?>
|
39 |
+
<br><br>
|
40 |
+
<?php echo esc_html__('The following variables are available:', 'kk-star-ratings'); ?>
|
41 |
+
<br>
|
42 |
+
<?php echo sprintf(esc_html__('%s Post Type', 'kk-star-ratings'), '<code>{type}</code>'); ?>
|
43 |
+
</p>
|
44 |
+
</td>
|
45 |
+
</tr>
|
46 |
+
|
47 |
+
<!-- Legend -->
|
48 |
+
<tr>
|
49 |
+
<th scope="row" valign="top">
|
50 |
+
<label for="<?php echo esc_attr($legend[0]); ?>">
|
51 |
+
<?php echo esc_html_x('Legend', 'Label', 'kk-star-ratings'); ?>
|
52 |
+
</label>
|
53 |
+
</th>
|
54 |
+
<td>
|
55 |
+
<p>
|
56 |
+
<input type="text" name="<?php echo esc_attr($legend[0]); ?>" id="<?php echo esc_attr($legend[0]); ?>" value="<?php echo esc_attr($legend[1]); ?>" placeholder="{score}/{best} - ({count} {votes})" class="regular-text" style="font-family: monospace;">
|
57 |
+
</p>
|
58 |
+
<p class="description" style="max-width: 22rem; margin-top: .75rem;">
|
59 |
+
<?php echo esc_html__('Text that will be displayed when votes have been casted.', 'kk-star-ratings'); ?>
|
60 |
+
<br><br>
|
61 |
+
<?php echo esc_html__('The following variables are available:', 'kk-star-ratings'); ?>
|
62 |
+
<br>
|
63 |
+
<?php echo sprintf(esc_html__('%s Average ratings', 'kk-star-ratings'), '<code>{score}</code>'); ?>
|
64 |
+
<br>
|
65 |
+
<?php echo sprintf(esc_html__('%s Number of votes casted', 'kk-star-ratings'), '<code>{count}</code>'); ?>
|
66 |
+
<br>
|
67 |
+
<?php echo sprintf(esc_html__('%s Total amount of stars', 'kk-star-ratings'), '<code>{best} </code>'); ?>
|
68 |
+
<br>
|
69 |
+
<?php echo sprintf(esc_html__('%s Votes', 'kk-star-ratings'), '<code>{votes}</code>'); ?>
|
70 |
+
</p>
|
71 |
+
</td>
|
72 |
+
</tr>
|
73 |
+
|
74 |
+
<!-- Stars -->
|
75 |
+
<tr>
|
76 |
+
<th scope="row" valign="top">
|
77 |
+
<label for="<?php echo esc_attr($stars[0]); ?>">
|
78 |
+
<?php echo esc_html_x('Stars', 'Label', 'kk-star-ratings'); ?>
|
79 |
+
</label>
|
80 |
+
</th>
|
81 |
+
<td>
|
82 |
+
<p>
|
83 |
+
<input type="number" name="<?php echo esc_attr($stars[0]); ?>" id="<?php echo esc_attr($stars[0]); ?>" value="<?php echo esc_attr($stars[1]); ?>" class="regular-text" style="max-width: 4rem; padding-right: 0;">
|
84 |
+
</p>
|
85 |
+
<p class="description" style="max-width: 22rem; margin-top: .75rem;">
|
86 |
+
<?php echo esc_html__('Total number of stars.', 'kk-star-ratings'); ?>
|
87 |
+
</p>
|
88 |
+
</td>
|
89 |
+
</tr>
|
90 |
+
|
91 |
+
<!-- Gap -->
|
92 |
+
<tr>
|
93 |
+
<th scope="row" valign="top">
|
94 |
+
<label for="<?php echo $gap[0]; ?>">
|
95 |
+
<?php echo esc_html_x('Gap', 'Label', 'kk-star-ratings'); ?>
|
96 |
+
</label>
|
97 |
+
</th>
|
98 |
+
<td>
|
99 |
+
<p>
|
100 |
+
<input type="number" name="<?php echo esc_attr($gap[0]); ?>" id="<?php echo esc_attr($gap[0]); ?>" value="<?php echo esc_attr($gap[1]); ?>" class="regular-text" style="max-width: 4rem; padding-right: 0;">
|
101 |
+
</p>
|
102 |
+
<p class="description" style="max-width: 22rem; margin-top: .75rem;">
|
103 |
+
<?php echo esc_html__('Gap between the stars.', 'kk-star-ratings'); ?>
|
104 |
+
</p>
|
105 |
+
</td>
|
106 |
+
</tr>
|
107 |
+
|
108 |
+
<!-- Size -->
|
109 |
+
<tr>
|
110 |
+
<th scope="row" valign="top">
|
111 |
+
<label for="<?php echo $size[0]; ?>">
|
112 |
+
<?php echo esc_html_x('Size', 'Label', 'kk-star-ratings'); ?>
|
113 |
+
</label>
|
114 |
+
</th>
|
115 |
+
<td>
|
116 |
+
<p>
|
117 |
+
<input type="number" name="<?php echo esc_attr($size[0]); ?>" id="<?php echo esc_attr($size[0]); ?>" value="<?php echo esc_attr($size[1]); ?>" class="regular-text" style="max-width: 4rem; padding-right: 0;">
|
118 |
+
</p>
|
119 |
+
<p class="description" style="max-width: 22rem; margin-top: .75rem;">
|
120 |
+
<?php echo esc_html__('Size of a single star.', 'kk-star-ratings'); ?>
|
121 |
+
</p>
|
122 |
+
</td>
|
123 |
+
</tr>
|
124 |
+
|
125 |
+
<!-- Position -->
|
126 |
+
<tr>
|
127 |
+
<th scope="row" valign="top">
|
128 |
+
<?php echo esc_html_x('Default Position', 'Label', 'kk-star-ratings'); ?>
|
129 |
+
</th>
|
130 |
+
<td>
|
131 |
+
<?php foreach ($positions as $value => $label) { ?>
|
132 |
+
<p>
|
133 |
+
<label>
|
134 |
+
<input type="radio" name="<?php echo esc_attr($position[0]); ?>" value="<?php echo esc_attr($value); ?>"<?php echo ($value == $position[1]) ? ' checked="checked"' : ''; ?>>
|
135 |
+
<?php echo esc_html($label); ?>
|
136 |
+
</label>
|
137 |
+
</p>
|
138 |
+
<?php } ?>
|
139 |
+
<p class="description" style="max-width: 22rem; margin-top: .75rem;">
|
140 |
+
<?php echo esc_html__('Choose the default position for the auto-embedded star ratings.', 'kk-star-ratings'); ?>
|
141 |
+
</p>
|
142 |
+
</td>
|
143 |
+
</tr>
|
144 |
+
</tbody>
|
145 |
+
</table>
|
src/core/views/admin/tabs/general.php
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if (! defined('KK_STAR_RATINGS')) {
|
4 |
+
http_response_code(404);
|
5 |
+
exit();
|
6 |
+
}
|
7 |
+
|
8 |
+
$enable = $get('enable');
|
9 |
+
$excludeCategories = $get('exclude_categories');
|
10 |
+
$locations = $get('locations');
|
11 |
+
$manualControl = $get('manual_control');
|
12 |
+
$strategies = $get('strategies');
|
13 |
+
|
14 |
+
$postTypes = [
|
15 |
+
'post' => 'Posts',
|
16 |
+
'page' => 'Pages',
|
17 |
+
] + array_reduce(get_post_types([
|
18 |
+
'publicly_queryable' => true,
|
19 |
+
'_builtin' => false,
|
20 |
+
], 'objects'), function ($postTypes, $postType) {
|
21 |
+
$postTypes[$postType->name] = $postType->labels->name;
|
22 |
+
|
23 |
+
return $postTypes;
|
24 |
+
}, []);
|
25 |
+
|
26 |
+
$postCategories = array_reduce(get_terms([
|
27 |
+
'taxonomy' => 'category',
|
28 |
+
'hide_empty' => false,
|
29 |
+
'parent' => 0,
|
30 |
+
]), function ($categories, $category) {
|
31 |
+
$categories[$category->term_id] = $category->name;
|
32 |
+
|
33 |
+
return $categories;
|
34 |
+
}, []);
|
35 |
+
|
36 |
+
$availableLocations = [
|
37 |
+
'home' => _x('Home', 'Label', 'kk-star-ratings'),
|
38 |
+
'archives' => _x('Archives', 'Label', 'kk-star-ratings'),
|
39 |
+
] + $postTypes;
|
40 |
+
|
41 |
+
$availableStrategies = [
|
42 |
+
'archives' => _x('Allow voting in archives', 'Label', 'kk-star-ratings'),
|
43 |
+
'guests' => _x('Allow guests to vote', 'Label', 'kk-star-ratings'),
|
44 |
+
'unique' => _x('Unique votes (based on IP Address)', 'Label', 'kk-star-ratings'),
|
45 |
+
];
|
46 |
+
?>
|
47 |
+
|
48 |
+
<table class="form-table" role="presentation">
|
49 |
+
<tbody>
|
50 |
+
|
51 |
+
<!-- Status -->
|
52 |
+
<tr>
|
53 |
+
<th scope="row" valign="top">
|
54 |
+
<label for="<?php echo esc_attr($enable[0]); ?>"><?php echo esc_html_x('Status', 'Label', 'kk-star-ratings'); ?></label>
|
55 |
+
</th>
|
56 |
+
<td>
|
57 |
+
<label>
|
58 |
+
<input type="checkbox" name="<?php echo esc_attr($enable[0]); ?>" id="<?php echo esc_attr($enable[0]); ?>" value="1"<?php echo $enable[1] ? ' checked="checked"' : ''; ?>>
|
59 |
+
<?php echo esc_html_x('Active', 'Label', 'kk-star-ratings'); ?>
|
60 |
+
</label>
|
61 |
+
<p class="description" style="max-width: 22rem; margin-top: .75rem;">
|
62 |
+
<?php echo esc_html__('Globally activate/deactivate the star ratings.', 'kk-star-ratings'); ?>
|
63 |
+
</p>
|
64 |
+
</td>
|
65 |
+
</tr>
|
66 |
+
|
67 |
+
<!-- Strategies -->
|
68 |
+
<tr>
|
69 |
+
<th scope="row" valign="top">
|
70 |
+
<?php echo esc_html_x('Strategies', 'Label', 'kk-star-ratings'); ?>
|
71 |
+
</th>
|
72 |
+
<td>
|
73 |
+
<?php foreach ($availableStrategies as $value => $label) { ?>
|
74 |
+
<p>
|
75 |
+
<label>
|
76 |
+
<input type="checkbox" name="<?php echo esc_attr($strategies[0]); ?>[]" value="<?php echo esc_attr($value); ?>"<?php echo (in_array($value, $strategies[1])) ? ' checked="checked"' : ''; ?>>
|
77 |
+
<?php echo esc_html($label); ?>
|
78 |
+
</label>
|
79 |
+
</p>
|
80 |
+
<?php } ?>
|
81 |
+
<p class="description" style="max-width: 22rem; margin-top: .75rem;">
|
82 |
+
<?php echo esc_html__('Select the voting strategies.', 'kk-star-ratings'); ?>
|
83 |
+
</p>
|
84 |
+
</td>
|
85 |
+
</tr>
|
86 |
+
|
87 |
+
<!-- Manual Control -->
|
88 |
+
<!-- <tr>
|
89 |
+
<th scope="row" valign="top">
|
90 |
+
<?php echo esc_html_x('Manual Control', 'Label', 'kk-star-ratings'); ?>
|
91 |
+
</th>
|
92 |
+
<td>
|
93 |
+
<?php foreach ($postTypes as $type => $label) { ?>
|
94 |
+
<p>
|
95 |
+
<label>
|
96 |
+
<input type="checkbox" name="<?php echo esc_attr($manualControl[0]); ?>[]" value="<?php echo esc_attr($type); ?>"<?php echo (in_array($type, $manualControl[1])) ? ' checked="checked"' : ''; ?>>
|
97 |
+
<?php echo esc_html($label); ?>
|
98 |
+
</label>
|
99 |
+
</p>
|
100 |
+
<?php } ?>
|
101 |
+
<p class="description" style="max-width: 22rem; margin-top: .75rem;">
|
102 |
+
<?php echo sprintf(esc_html__('Select the post types that should not auto embed the markup and will be manually controlled by the theme. E.g. Using %s in your theme/template file(s).', 'kk-star-ratings'), '<code>echo kk_star_ratings();</code>'); ?>
|
103 |
+
</p>
|
104 |
+
</td>
|
105 |
+
</tr> -->
|
106 |
+
|
107 |
+
<!-- Locations -->
|
108 |
+
<tr>
|
109 |
+
<th scope="row" valign="top">
|
110 |
+
<?php echo esc_html_x('Locations', 'Label', 'kk-star-ratings'); ?>
|
111 |
+
</th>
|
112 |
+
<td>
|
113 |
+
<?php foreach ($availableLocations as $type => $label) { ?>
|
114 |
+
<p>
|
115 |
+
<label>
|
116 |
+
<input type="checkbox" name="<?php echo esc_attr($locations[0]); ?>[]" value="<?php echo esc_attr($type); ?>"<?php echo (in_array($type, $locations[1])) ? ' checked="checked"' : ''; ?>>
|
117 |
+
<?php echo esc_html($label); ?>
|
118 |
+
</label>
|
119 |
+
</p>
|
120 |
+
<?php } ?>
|
121 |
+
<p class="description" style="max-width: 22rem; margin-top: .75rem;">
|
122 |
+
<?php echo sprintf(esc_html__('Star ratings will be auto-embedded for the selected locations. You may still manually allow star ratings for unselected/other locations. E.g. Using %s in your theme/template file(s).', 'kk-star-ratings'), '<code>echo kk_star_ratings();</code>'); ?>
|
123 |
+
</p>
|
124 |
+
</td>
|
125 |
+
</tr>
|
126 |
+
|
127 |
+
<!-- Exclude Categories -->
|
128 |
+
<tr>
|
129 |
+
<th scope="row" valign="top">
|
130 |
+
<?php echo esc_html_x('Exclude Categories', 'Label', 'kk-star-ratings'); ?>
|
131 |
+
</th>
|
132 |
+
<td>
|
133 |
+
<?php foreach ($postCategories as $value => $label) { ?>
|
134 |
+
<p>
|
135 |
+
<label>
|
136 |
+
<input type="checkbox" name="<?php echo esc_attr($excludeCategories[0]); ?>[]" value="<?php echo esc_attr($value); ?>"<?php echo (in_array($value, $excludeCategories[1])) ? ' checked="checked"' : ''; ?>>
|
137 |
+
<?php echo esc_html($label); ?>
|
138 |
+
</label>
|
139 |
+
</p>
|
140 |
+
<?php } ?>
|
141 |
+
<p class="description" style="max-width: 22rem; margin-top: .75rem;">
|
142 |
+
<?php echo sprintf(esc_html__('The posts belonging to the selected categories will not auto-embed the star ratings. You may still manually show the star ratings. E.g. Using %s in your theme/template file(s).', 'kk-star-ratings'), '<code>echo kk_star_ratings();</code>'); ?>
|
143 |
+
</p>
|
144 |
+
</td>
|
145 |
+
</tr>
|
146 |
+
</tbody>
|
147 |
+
</table>
|
src/core/views/admin/tabs/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if (! defined('KK_STAR_RATINGS')) {
|
13 |
+
http_response_code(404);
|
14 |
+
exit();
|
15 |
+
}
|
src/core/views/admin/tabs/rich-snippets.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (! defined('KK_STAR_RATINGS')) {
|
3 |
+
http_response_code(404);
|
4 |
+
exit();
|
5 |
+
}
|
6 |
+
|
7 |
+
$grs = $get('grs');
|
8 |
+
$sd = $get('sd');
|
9 |
+
?>
|
10 |
+
|
11 |
+
<table class="form-table" role="presentation">
|
12 |
+
<tbody>
|
13 |
+
|
14 |
+
<!-- Status -->
|
15 |
+
<tr>
|
16 |
+
<th scope="row" valign="top">
|
17 |
+
<label for="<?php echo esc_attr($grs[0]); ?>"><?php echo esc_html_x('Status', 'Label', 'kk-star-ratings'); ?></label>
|
18 |
+
</th>
|
19 |
+
<td>
|
20 |
+
<label>
|
21 |
+
<input type="checkbox" name="<?php echo esc_attr($grs[0]); ?>" id="<?php echo esc_attr($grs[0]); ?>" value="1"<?php echo $grs[1] ? ' checked="checked"' : ''; ?>>
|
22 |
+
<?php echo esc_html_x('Enable', 'Label', 'kk-star-ratings'); ?>
|
23 |
+
</label>
|
24 |
+
<p class="description" style="max-width: 22rem; margin-top: .75rem;">
|
25 |
+
<?php echo esc_html__('Enable/disable rich snippets.', 'kk-star-ratings'); ?>
|
26 |
+
</p>
|
27 |
+
</td>
|
28 |
+
</tr>
|
29 |
+
|
30 |
+
<!-- Structured Data -->
|
31 |
+
<tr>
|
32 |
+
<th scope="row" valign="top">
|
33 |
+
<label for="<?php echo esc_attr($sd[0]); ?>"><?php echo esc_html_x('Content', 'Label', 'kk-star-ratings'); ?></label>
|
34 |
+
</th>
|
35 |
+
<td>
|
36 |
+
<p>
|
37 |
+
<textarea type="text" name="<?php echo esc_attr($sd[0]); ?>" id="<?php echo esc_attr($sd[0]); ?>" rows="12" placeholder="ld+json" class="regular-text" style="font-family: monospace;"
|
38 |
+
><?php echo esc_textarea($sd[1]); ?></textarea>
|
39 |
+
</p>
|
40 |
+
<p class="description" style="max-width: 22rem; margin-top: .75rem;">
|
41 |
+
<?php echo esc_html__('Provide the ld+json structure.', 'kk-star-ratings'); ?>
|
42 |
+
<br><br>
|
43 |
+
<?php echo esc_html__('The following variables are available:', 'kk-star-ratings'); ?>
|
44 |
+
<br>
|
45 |
+
<?php echo sprintf(esc_html_x('%s Post title', 'Label', 'kk-star-ratings'), '<code>{title}</code>'); ?>
|
46 |
+
<br>
|
47 |
+
<?php echo sprintf(esc_html_x('%s Average ratings', 'Label', 'kk-star-ratings'), '<code>{score}</code>'); ?>
|
48 |
+
<br>
|
49 |
+
<?php echo sprintf(esc_html_x('%s Number of votes casted', 'Label', 'kk-star-ratings'), '<code>{count}</code>'); ?>
|
50 |
+
<br>
|
51 |
+
<?php echo sprintf(esc_html_x('%s Total amount of stars', 'Label', 'kk-star-ratings'), '<code>{best} </code>'); ?>
|
52 |
+
</p>
|
53 |
+
</td>
|
54 |
+
</tr>
|
55 |
+
|
56 |
+
</tbody>
|
57 |
+
</table>
|
src/core/views/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if (! defined('KK_STAR_RATINGS')) {
|
13 |
+
http_response_code(404);
|
14 |
+
exit();
|
15 |
+
}
|
src/core/views/markup/active-star.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (! defined('KK_STAR_RATINGS')) {
|
3 |
+
http_response_code(404);
|
4 |
+
exit();
|
5 |
+
}
|
6 |
+
?>
|
7 |
+
|
8 |
+
<?php echo $__view('markup/star.php'); ?>
|
src/core/views/markup/active-stars.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (! defined('KK_STAR_RATINGS')) {
|
3 |
+
http_response_code(404);
|
4 |
+
exit();
|
5 |
+
}
|
6 |
+
?>
|
7 |
+
|
8 |
+
<div class="kksr-stars-active" style="width: <?php echo esc_attr($width); ?>px;">
|
9 |
+
<?php for ($i = 1; $i <= $best; ++$i) { ?>
|
10 |
+
<div class="kksr-star" <?php echo isset($gap) ? ('style="padding-'.(is_rtl() ? 'left' : 'right').': '.esc_attr($gap).'px"') : ''; ?>>
|
11 |
+
<?php echo $__view('markup/active-star.php'); ?>
|
12 |
+
</div>
|
13 |
+
<?php } ?>
|
14 |
+
</div>
|
src/core/views/markup/inactive-star.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (! defined('KK_STAR_RATINGS')) {
|
3 |
+
http_response_code(404);
|
4 |
+
exit();
|
5 |
+
}
|
6 |
+
?>
|
7 |
+
|
8 |
+
<?php echo $__view('markup/star.php'); ?>
|
src/core/views/markup/inactive-stars.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (! defined('KK_STAR_RATINGS')) {
|
3 |
+
http_response_code(404);
|
4 |
+
exit();
|
5 |
+
}
|
6 |
+
?>
|
7 |
+
|
8 |
+
<div class="kksr-stars-inactive">
|
9 |
+
<?php for ($i = 1; $i <= $best; ++$i) { ?>
|
10 |
+
<div class="kksr-star" data-star="<?php echo esc_attr($i); ?>" <?php echo isset($gap) ? ('style="padding-'.(is_rtl() ? 'left' : 'right').': '.esc_attr($gap).'px"') : ''; ?>>
|
11 |
+
<?php echo $__view('markup/inactive-star.php'); ?>
|
12 |
+
</div>
|
13 |
+
<?php } ?>
|
14 |
+
</div>
|
src/core/views/markup/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (! defined('KK_STAR_RATINGS')) {
|
3 |
+
http_response_code(404);
|
4 |
+
exit();
|
5 |
+
}
|
6 |
+
?>
|
7 |
+
|
8 |
+
<div class="kk-star-ratings
|
9 |
+
<?php echo $valign ? (' kksr-valign-'.esc_attr($valign)) : ''; ?>
|
10 |
+
<?php echo $align ? (' kksr-align-'.esc_attr($align)) : ''; ?>
|
11 |
+
<?php echo $readonly ? ' kksr-disabled' : ''; ?>"
|
12 |
+
data-payload="<?php echo esc_attr(json_encode(array_map('esc_attr', $__payload))); ?>">
|
13 |
+
<?php echo $__view('markup/stars.php'); ?>
|
14 |
+
<?php echo $__view('markup/legend.php'); ?>
|
15 |
+
</div>
|
src/core/views/markup/legend.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (! defined('KK_STAR_RATINGS')) {
|
3 |
+
http_response_code(404);
|
4 |
+
exit();
|
5 |
+
}
|
6 |
+
?>
|
7 |
+
|
8 |
+
<div class="kksr-legend">
|
9 |
+
<?php if ($count) { ?>
|
10 |
+
<?php echo esc_html($legend); ?>
|
11 |
+
<?php } else { ?>
|
12 |
+
<span class="kksr-muted"><?php echo esc_html($greet); ?></span>
|
13 |
+
<?php } ?>
|
14 |
+
</div>
|
src/core/views/markup/star.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (! defined('KK_STAR_RATINGS')) {
|
3 |
+
http_response_code(404);
|
4 |
+
exit();
|
5 |
+
}
|
6 |
+
?>
|
7 |
+
|
8 |
+
<div class="kksr-icon" style="width: <?php echo esc_attr($size); ?>px; height: <?php echo esc_attr($size); ?>px;"></div>
|
src/core/views/markup/stars.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (! defined('KK_STAR_RATINGS')) {
|
3 |
+
http_response_code(404);
|
4 |
+
exit();
|
5 |
+
}
|
6 |
+
?>
|
7 |
+
|
8 |
+
<div class="kksr-stars">
|
9 |
+
<?php echo $__view('markup/inactive-stars.php'); ?>
|
10 |
+
<?php echo $__view('markup/active-stars.php'); ?>
|
11 |
+
</div>
|
src/core/views/metabox/content.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (! defined('KK_STAR_RATINGS')) {
|
3 |
+
http_response_code(404);
|
4 |
+
exit();
|
5 |
+
}
|
6 |
+
|
7 |
+
$reset = $get('reset');
|
8 |
+
$status = $get('status_default');
|
9 |
+
?>
|
10 |
+
|
11 |
+
<div class="components-base-control__field">
|
12 |
+
<div style="margin-top: 1rem;">
|
13 |
+
<label class="components-base-control__label" style="margin-top: .5rem; margin-bottom: .25rem;">
|
14 |
+
<input type="checkbox" name="<?php echo esc_attr($reset[0]); ?>" value="1" <?php echo checked($reset[1], '1', false); ?>>
|
15 |
+
<?php echo esc_html_x('Reset Ratings', 'label', 'kk-star-ratings'); ?>
|
16 |
+
</label>
|
17 |
+
</div>
|
18 |
+
</div>
|
19 |
+
|
20 |
+
<div class="components-base-control__field" style="margin-top: 1rem">
|
21 |
+
<label class="components-base-control__label" style="margin-top: .75rem; margin-bottom: .25rem;">
|
22 |
+
<strong><?php echo esc_html_x('Auto Embed', 'label', 'kk-star-ratings'); ?></strong>
|
23 |
+
</label>
|
24 |
+
|
25 |
+
<div style="margin-top: 1rem;">
|
26 |
+
<label class="components-base-control__label" style="margin-top: .5rem; margin-bottom: .25rem;">
|
27 |
+
<input type="radio" name="<?php echo esc_attr($status[0]); ?>" value="" <?php echo checked($status[1], '', false); ?>>
|
28 |
+
<?php echo esc_html_x('Global', 'label', 'kk-star-ratings'); ?>
|
29 |
+
</label>
|
30 |
+
<label class="components-base-control__label" style="margin-top: .5rem; margin-bottom: .25rem; margin-left: .5rem;">
|
31 |
+
<input type="radio" name="<?php echo esc_attr($status[0]); ?>" value="enable" <?php echo checked($status[1], 'enable', false); ?>>
|
32 |
+
<?php echo esc_html_x('Enable', 'label', 'kk-star-ratings'); ?>
|
33 |
+
</label>
|
34 |
+
<label class="components-base-control__label" style="margin-top: .5rem; margin-bottom: .25rem; margin-left: .5rem;">
|
35 |
+
<input type="radio" name="<?php echo esc_attr($status[0]); ?>" value="disable" <?php echo checked($status[1], 'disable', false); ?>>
|
36 |
+
<?php echo esc_html_x('Disable', 'label', 'kk-star-ratings'); ?>
|
37 |
+
</label>
|
38 |
+
</div>
|
39 |
+
</div>
|
src/core/views/metabox/index.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (! defined('KK_STAR_RATINGS')) {
|
3 |
+
http_response_code(404);
|
4 |
+
exit();
|
5 |
+
}
|
6 |
+
?>
|
7 |
+
|
8 |
+
<?php echo $content; ?>
|
src/core/views/notice.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (! defined('KK_STAR_RATINGS')) {
|
3 |
+
http_response_code(404);
|
4 |
+
exit();
|
5 |
+
}
|
6 |
+
|
7 |
+
$icon = $icon ?? null;
|
8 |
+
$type = $type ?? 'info';
|
9 |
+
$dismissible = (bool) ($dismissible ?? false);
|
10 |
+
?>
|
11 |
+
|
12 |
+
<div class="update-nag inline notice notice-<?php echo esc_attr($type); ?>"<?php echo $dismissible ? ' is-dismissible' : ''; ?>
|
13 |
+
style="display: flex; align-items: center; font-weight: 600;">
|
14 |
+
<?php if ($icon) { ?>
|
15 |
+
<img src="<?php echo esc_url($icon); ?>" alt="Spinning icon" style="margin-right: .75rem;">
|
16 |
+
<?php } ?>
|
17 |
+
|
18 |
+
<?php echo esc_html($message); ?>
|
19 |
+
</div>
|
src/core/wp/actions/add_meta_boxes.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\actions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\action;
|
15 |
+
use function Bhittani\StarRating\core\functions\calculate;
|
16 |
+
use function Bhittani\StarRating\core\functions\option;
|
17 |
+
|
18 |
+
if (! defined('KK_STAR_RATINGS')) {
|
19 |
+
http_response_code(404);
|
20 |
+
exit();
|
21 |
+
}
|
22 |
+
|
23 |
+
function add_meta_boxes($type, $post): void
|
24 |
+
{
|
25 |
+
$icon = $legend = '';
|
26 |
+
|
27 |
+
if ($post) {
|
28 |
+
$best = option('stars');
|
29 |
+
[$count, $score] = calculate((int) $post->ID, 'default', $best);
|
30 |
+
// $icon = '<span class="dashicons dashicons-star-half" style="margin-right: .25rem; font-size: 18px;"></span>';
|
31 |
+
$legend = '';
|
32 |
+
|
33 |
+
if ($score) {
|
34 |
+
$legend = "
|
35 |
+
<span style=\"margin-left: 10px;color:#666;\">
|
36 |
+
{$score}
|
37 |
+
<span style=\"font-weight:normal;color:#ddd;\">/</span>
|
38 |
+
{$best}
|
39 |
+
<span style=\"font-weight:normal;color:#aaa;\">({$count})</span>
|
40 |
+
</span>
|
41 |
+
";
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
$postTypes = array_merge(
|
46 |
+
['post', 'page'],
|
47 |
+
get_post_types(['publicly_queryable' => true, '_builtin' => false], 'names')
|
48 |
+
);
|
49 |
+
|
50 |
+
$title = '<span class="components-button components-panel__body-toggle" style="margin: -15px;">'.$icon.kksr('name').$legend.'</span>';
|
51 |
+
|
52 |
+
add_meta_box(
|
53 |
+
kksr('slug'),
|
54 |
+
$title,
|
55 |
+
function () use ($type, $post) {
|
56 |
+
wp_nonce_field(kksr('core.wp.actions.save_post'), kksr('slug').'-metabox');
|
57 |
+
action('metabox/index', $type, $post);
|
58 |
+
},
|
59 |
+
$postTypes,
|
60 |
+
'side'
|
61 |
+
);
|
62 |
+
}
|
src/core/wp/actions/admin_enqueue_scripts.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\actions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\action;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function admin_enqueue_scripts($hook): void
|
22 |
+
{
|
23 |
+
if ($hook == ('toplevel_page_'.kksr('slug'))) {
|
24 |
+
$isDebugMode = defined('WP_DEBUG') && WP_DEBUG;
|
25 |
+
|
26 |
+
action('admin/style', $isDebugMode);
|
27 |
+
action('admin/script', $isDebugMode);
|
28 |
+
}
|
29 |
+
}
|
src/core/wp/actions/admin_menu.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\actions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function admin_menu(): void
|
20 |
+
{
|
21 |
+
add_menu_page(
|
22 |
+
kksr('name'),
|
23 |
+
kksr('name'),
|
24 |
+
'manage_options',
|
25 |
+
kksr('slug'),
|
26 |
+
kksr('core.actions.admin/index'),
|
27 |
+
'dashicons-star-filled'
|
28 |
+
);
|
29 |
+
}
|
src/core/wp/actions/admin_notices.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\actions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\migrations;
|
15 |
+
use function Bhittani\StarRating\core\functions\view;
|
16 |
+
|
17 |
+
if (! defined('KK_STAR_RATINGS')) {
|
18 |
+
http_response_code(404);
|
19 |
+
exit();
|
20 |
+
}
|
21 |
+
|
22 |
+
function admin_notices(): void
|
23 |
+
{
|
24 |
+
// if (! migrations()->isEmpty()) {
|
25 |
+
// $icon = get_admin_url(null, 'images/wpspin_light.gif');
|
26 |
+
// $message = sprintf(__('%s has pending migrations. These migrations are running in the background and the ratings will remain disabled until the migrations have finished.', 'kk-star-ratings'), kksr('name'));
|
27 |
+
// $type = 'warning';
|
28 |
+
|
29 |
+
// echo view('notice.php', compact('icon', 'message', 'type'));
|
30 |
+
// }
|
31 |
+
}
|
src/core/wp/actions/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if (! defined('KK_STAR_RATINGS')) {
|
13 |
+
http_response_code(404);
|
14 |
+
exit();
|
15 |
+
}
|
src/core/wp/actions/plugins_loaded.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\actions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\action;
|
15 |
+
use function Bhittani\StarRating\core\functions\option;
|
16 |
+
use function Bhittani\StarRating\core\wp\functions\activate;
|
17 |
+
|
18 |
+
if (! defined('KK_STAR_RATINGS')) {
|
19 |
+
http_response_code(404);
|
20 |
+
exit();
|
21 |
+
}
|
22 |
+
|
23 |
+
function plugins_loaded()
|
24 |
+
{
|
25 |
+
if (version_compare(kksr('version'), option('ver'), '!=')) {
|
26 |
+
activate();
|
27 |
+
}
|
28 |
+
|
29 |
+
action('init', kksr());
|
30 |
+
}
|
src/core/wp/actions/save_post.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\actions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\action;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function save_post($id): void
|
22 |
+
{
|
23 |
+
if (wp_verify_nonce($_POST[kksr('slug').'-metabox'] ?? '', __FUNCTION__)
|
24 |
+
&& ! (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
|
25 |
+
&& current_user_can('edit_post', $id)
|
26 |
+
) {
|
27 |
+
action('metabox/save', $id, $_POST);
|
28 |
+
}
|
29 |
+
}
|
src/core/wp/actions/the_post.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\actions;
|
13 |
+
|
14 |
+
use WP_Post;
|
15 |
+
use WP_Query;
|
16 |
+
|
17 |
+
use function Bhittani\StarRating\core\functions\meta_prefix;
|
18 |
+
use function Bhittani\StarRating\core\functions\option;
|
19 |
+
use function Bhittani\StarRating\core\functions\post_meta;
|
20 |
+
use function Bhittani\StarRating\functions\cast;
|
21 |
+
|
22 |
+
if (! defined('KK_STAR_RATINGS')) {
|
23 |
+
http_response_code(404);
|
24 |
+
exit();
|
25 |
+
}
|
26 |
+
|
27 |
+
function the_post(WP_Post $post, WP_Query $query): void
|
28 |
+
{
|
29 |
+
$id = $post->ID;
|
30 |
+
|
31 |
+
if (metadata_exists('post', $id, meta_prefix('avg'))) {
|
32 |
+
// v5
|
33 |
+
// if (metadata_exists('post', $id, meta_prefix('count_default'))) {
|
34 |
+
// $count = max((int) post_meta($id, 'count_default'), 0);
|
35 |
+
// }
|
36 |
+
|
37 |
+
// // v5
|
38 |
+
// if (metadata_exists('post', $id, meta_prefix('ratings_default'))) {
|
39 |
+
// $ratings = max((float) post_meta($id, 'ratings_default'), 0);
|
40 |
+
// }
|
41 |
+
|
42 |
+
// < v5
|
43 |
+
// if (! isset($count)) {
|
44 |
+
$count = max((int) post_meta($id, 'casts'), 0);
|
45 |
+
// }
|
46 |
+
|
47 |
+
// v3, v4
|
48 |
+
if (/*! isset($ratings) && */metadata_exists('post', $id, meta_prefix('ratings'))) {
|
49 |
+
$ratings = max((float) post_meta($id, 'ratings'), 0);
|
50 |
+
}
|
51 |
+
|
52 |
+
// < v3
|
53 |
+
if (! isset($ratings)) {
|
54 |
+
$stars = max((int) option('stars', 5), 1);
|
55 |
+
$avg = min(max((float) post_meta($id, 'avg'), 0), $stars);
|
56 |
+
// 4 * 3 / 5 * 5 => 12
|
57 |
+
// 8 * 3 / 10 * 5 => 12
|
58 |
+
$ratings = cast($avg, 5, $stars) * $count; // Reset to base 5.
|
59 |
+
// $ratings = $avg * $count / $stars * 5; // Reset to base 5.
|
60 |
+
}
|
61 |
+
|
62 |
+
// Calculate fresh average.
|
63 |
+
$avg = $count ? ($ratings / $count) : 0;
|
64 |
+
|
65 |
+
post_meta($id, [
|
66 |
+
'avg' => $avg,
|
67 |
+
'casts' => $count,
|
68 |
+
'avg_default' => $avg,
|
69 |
+
'count_default' => $count,
|
70 |
+
'ratings_default' => $ratings,
|
71 |
+
]);
|
72 |
+
}
|
73 |
+
}
|
src/core/wp/actions/upgrader_process_complete.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\actions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\wp\functions\deactivate;
|
15 |
+
use WP_Upgrader;
|
16 |
+
|
17 |
+
if (! defined('KK_STAR_RATINGS')) {
|
18 |
+
http_response_code(404);
|
19 |
+
exit();
|
20 |
+
}
|
21 |
+
|
22 |
+
function upgrader_process_complete(WP_Upgrader $upgrader, array $options): void
|
23 |
+
{
|
24 |
+
if ($options['action'] == 'update'
|
25 |
+
&& $options['type'] == 'plugin'
|
26 |
+
&& isset($options['plugin'])
|
27 |
+
&& in_array(kksr('signature'), $options['plugins'])
|
28 |
+
) {
|
29 |
+
deactivate();
|
30 |
+
}
|
31 |
+
}
|
src/core/wp/actions/wp_ajax_kk-star-ratings.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\actions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\action;
|
15 |
+
use function Bhittani\StarRating\core\functions\filter;
|
16 |
+
use function Bhittani\StarRating\functions\cast;
|
17 |
+
use function Bhittani\StarRating\functions\sanitize;
|
18 |
+
use function Bhittani\StarRating\functions\to_shortcode;
|
19 |
+
use Exception;
|
20 |
+
|
21 |
+
if (! defined('KK_STAR_RATINGS')) {
|
22 |
+
http_response_code(404);
|
23 |
+
exit();
|
24 |
+
}
|
25 |
+
|
26 |
+
function wp_ajax_kk_star_ratings()
|
27 |
+
{
|
28 |
+
try {
|
29 |
+
if (! check_ajax_referer(__FUNCTION__, 'nonce', false)) {
|
30 |
+
throw new Exception(__('This action is forbidden.', 'kk-star-ratings'), 403);
|
31 |
+
}
|
32 |
+
|
33 |
+
$payload = sanitize($_POST['payload'] ?? []);
|
34 |
+
|
35 |
+
$id = intval($payload['id'] ?? 0);
|
36 |
+
$slug = $payload['slug'] ?? 'default';
|
37 |
+
$best = intval($payload['best'] ?? 5);
|
38 |
+
|
39 |
+
if (filter('validate', null, $payload['id'], $payload['slug'], $payload) === false) {
|
40 |
+
throw new Exception(__('A rating can not be accepted at the moment.', 'kk-star-ratings'));
|
41 |
+
}
|
42 |
+
|
43 |
+
if (! isset($_POST['rating'])) {
|
44 |
+
throw new Exception(__('A rating is required to cast a vote.', 'kk-star-ratings'));
|
45 |
+
}
|
46 |
+
|
47 |
+
$rating = intval($_POST['rating'] ?? 0);
|
48 |
+
|
49 |
+
if ($rating < 1 || $rating > $best) {
|
50 |
+
throw new Exception(sprintf(__('The rating value must be between %1$d and %2$d.', 'kk-star-ratings'), 1, $best));
|
51 |
+
}
|
52 |
+
|
53 |
+
$outOf5 = cast($rating, 5, $best);
|
54 |
+
|
55 |
+
action('save', $outOf5, $id, $slug, [
|
56 |
+
'count' => (int) filter('count', null, $id, $slug),
|
57 |
+
'ratings' => (float) filter('ratings', null, $id, $slug),
|
58 |
+
] + $payload);
|
59 |
+
|
60 |
+
$payload['legend'] = $payload['_legend'];
|
61 |
+
|
62 |
+
unset($payload['count'], $payload['score']);
|
63 |
+
|
64 |
+
$html = do_shortcode(to_shortcode(kksr('slug'), $payload));
|
65 |
+
|
66 |
+
wp_die($html, 201);
|
67 |
+
} catch (Exception $e) {
|
68 |
+
header('Content-Type: application/json; charset=utf-8');
|
69 |
+
|
70 |
+
wp_die(json_encode(['error' => $e->getMessage()]), $e->getCode() ?: 406);
|
71 |
+
}
|
72 |
+
}
|
src/core/wp/actions/wp_ajax_kksr-migrations.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\actions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\migrate;
|
15 |
+
use Exception;
|
16 |
+
|
17 |
+
if (! defined('KK_STAR_RATINGS')) {
|
18 |
+
http_response_code(404);
|
19 |
+
exit();
|
20 |
+
}
|
21 |
+
|
22 |
+
function wp_ajax_kksr_migrations()
|
23 |
+
{
|
24 |
+
header('Content-Type: application/json; charset=utf-8');
|
25 |
+
|
26 |
+
try {
|
27 |
+
if (! check_ajax_referer(__FUNCTION__, 'nonce', false)) {
|
28 |
+
throw new Exception(__('This action is forbidden.', 'kk-star-ratings'), 403);
|
29 |
+
}
|
30 |
+
|
31 |
+
$code = migrate();
|
32 |
+
|
33 |
+
if ($code == 4) {
|
34 |
+
wp_send_json_success(['status' => 'complete']);
|
35 |
+
}
|
36 |
+
|
37 |
+
if ($code == 8) {
|
38 |
+
wp_send_json_success(['status' => 'busy']);
|
39 |
+
}
|
40 |
+
|
41 |
+
// 0, 1, 2, 16
|
42 |
+
wp_send_json_success(['status' => 'pending']);
|
43 |
+
} catch (Exception $e) {
|
44 |
+
wp_send_json_error(['error' => $e->getMessage()], $e->getCode() ?: 406);
|
45 |
+
}
|
46 |
+
}
|
src/core/wp/actions/wp_ajax_nopriv_kk-star-ratings.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\actions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function wp_ajax_nopriv_kk_star_ratings()
|
20 |
+
{
|
21 |
+
wp_ajax_kk_star_ratings();
|
22 |
+
}
|
src/core/wp/actions/wp_ajax_nopriv_kksr-migrations.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\actions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function wp_ajax_nopriv_kksr_migrations()
|
20 |
+
{
|
21 |
+
wp_ajax_kksr_migrations();
|
22 |
+
}
|
src/core/wp/actions/wp_enqueue_scripts.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\actions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\action;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function wp_enqueue_scripts(): void
|
22 |
+
{
|
23 |
+
$isDebugMode = defined('WP_DEBUG') && WP_DEBUG;
|
24 |
+
|
25 |
+
action('style', $isDebugMode);
|
26 |
+
action('script', $isDebugMode);
|
27 |
+
}
|
src/core/wp/actions/wp_head.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\actions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\action;
|
15 |
+
use function Bhittani\StarRating\core\functions\calculate;
|
16 |
+
use function Bhittani\StarRating\core\functions\option;
|
17 |
+
|
18 |
+
if (! defined('KK_STAR_RATINGS')) {
|
19 |
+
http_response_code(404);
|
20 |
+
exit();
|
21 |
+
}
|
22 |
+
|
23 |
+
function wp_head(): void
|
24 |
+
{
|
25 |
+
if (option('enable') && option('grs') && is_singular()) {
|
26 |
+
$best = option('stars');
|
27 |
+
$id = get_post_field('ID');
|
28 |
+
$title = esc_html(get_post_field('post_title'));
|
29 |
+
[$count, $score] = calculate($id, 'default', $best);
|
30 |
+
|
31 |
+
if ($count && $score) {
|
32 |
+
ob_start();
|
33 |
+
action('sd', compact('id', 'best', 'title', 'count', 'score'));
|
34 |
+
echo ob_get_clean();
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
src/core/wp/filters/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if (! defined('KK_STAR_RATINGS')) {
|
13 |
+
http_response_code(404);
|
14 |
+
exit();
|
15 |
+
}
|
src/core/wp/filters/load_textdomain_mofile.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\filters;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function load_textdomain_mofile($mofile, $domain): string
|
20 |
+
{
|
21 |
+
if ($domain !== kksr('domain') || strpos($mofile, WP_LANG_DIR.'/plugins/') !== false) {
|
22 |
+
return $mofile;
|
23 |
+
}
|
24 |
+
|
25 |
+
$locale = apply_filters('plugin_locale', determine_locale(), $domain);
|
26 |
+
|
27 |
+
return kksr('path').'languages/'.$domain.'-'.$locale.'.mo';
|
28 |
+
}
|
src/core/wp/filters/the_content.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\filters;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\option;
|
15 |
+
use function Bhittani\StarRating\functions\to_shortcode;
|
16 |
+
|
17 |
+
if (! defined('KK_STAR_RATINGS')) {
|
18 |
+
http_response_code(404);
|
19 |
+
exit();
|
20 |
+
}
|
21 |
+
|
22 |
+
function the_content(string $content): string
|
23 |
+
{
|
24 |
+
foreach ([
|
25 |
+
kksr('slug'),
|
26 |
+
// Legacy...
|
27 |
+
'kkratings', // < v3
|
28 |
+
'kkstarratings', // v3, v4
|
29 |
+
] as $tag) {
|
30 |
+
if (has_shortcode($content, $tag)) {
|
31 |
+
return $content;
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
$align = 'left';
|
36 |
+
$reference = 'auto';
|
37 |
+
$valign = 'top';
|
38 |
+
|
39 |
+
$position = option('position');
|
40 |
+
|
41 |
+
if (strpos($position, 'top-') === 0) {
|
42 |
+
$align = substr($position, 4);
|
43 |
+
$valign = 'top';
|
44 |
+
}
|
45 |
+
|
46 |
+
if (strpos($position, 'bottom-') === 0) {
|
47 |
+
$align = substr($position, 7);
|
48 |
+
$valign = 'bottom';
|
49 |
+
}
|
50 |
+
|
51 |
+
$starRatings = to_shortcode(kksr('slug'), compact('align', 'reference', 'valign'));
|
52 |
+
|
53 |
+
if ($valign == 'top') {
|
54 |
+
return $starRatings.$content;
|
55 |
+
}
|
56 |
+
|
57 |
+
return $content.$starRatings;
|
58 |
+
}
|
src/core/wp/functions/activate.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\functions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\action;
|
15 |
+
use function Bhittani\StarRating\core\functions\option;
|
16 |
+
|
17 |
+
if (! defined('KK_STAR_RATINGS')) {
|
18 |
+
http_response_code(404);
|
19 |
+
exit();
|
20 |
+
}
|
21 |
+
|
22 |
+
function activate(): void
|
23 |
+
{
|
24 |
+
$version = kksr('version');
|
25 |
+
$previous = option('ver');
|
26 |
+
|
27 |
+
if (! $previous) {
|
28 |
+
action('install', $version);
|
29 |
+
} elseif (version_compare($version, $previous, '<')) {
|
30 |
+
action('downgrade', $version, $previous);
|
31 |
+
} elseif (version_compare($version, $previous, '>')) {
|
32 |
+
action('upgrade', $version, $previous);
|
33 |
+
}
|
34 |
+
|
35 |
+
if (version_compare($version, $previous, '!=')) {
|
36 |
+
action('activate', $version, $previous);
|
37 |
+
}
|
38 |
+
|
39 |
+
option(['ver' => $version]);
|
40 |
+
}
|
src/core/wp/functions/deactivate.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\functions;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\action;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function deactivate(): void
|
22 |
+
{
|
23 |
+
action('deactivate', kksr('version'));
|
24 |
+
}
|
src/core/wp/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if (! defined('KK_STAR_RATINGS')) {
|
13 |
+
http_response_code(404);
|
14 |
+
exit();
|
15 |
+
}
|
src/core/wp/shortcodes/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if (! defined('KK_STAR_RATINGS')) {
|
13 |
+
http_response_code(404);
|
14 |
+
exit();
|
15 |
+
}
|
src/core/wp/shortcodes/kk-star-ratings.php
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\shortcodes;
|
13 |
+
|
14 |
+
use function Bhittani\StarRating\core\functions\filter;
|
15 |
+
use function Bhittani\StarRating\core\functions\response;
|
16 |
+
use Exception;
|
17 |
+
|
18 |
+
if (! defined('KK_STAR_RATINGS')) {
|
19 |
+
http_response_code(404);
|
20 |
+
exit();
|
21 |
+
}
|
22 |
+
|
23 |
+
/** @param string|array $attrs */
|
24 |
+
function kk_star_ratings($attrs, string $contents, string $tag): string
|
25 |
+
{
|
26 |
+
$defaults = array_fill_keys([
|
27 |
+
'align', 'best', 'count', 'gap', 'greet', 'id',
|
28 |
+
'legend', 'readonly', 'score', 'size', 'slug', 'valign',
|
29 |
+
], '') + [
|
30 |
+
'reference' => 'shortcode',
|
31 |
+
];
|
32 |
+
|
33 |
+
$attrs = (array) $attrs;
|
34 |
+
|
35 |
+
foreach ($attrs as $key => &$value) {
|
36 |
+
if (is_numeric($key)) {
|
37 |
+
$attrs[$value] = true;
|
38 |
+
unset($attrs[$key]);
|
39 |
+
}
|
40 |
+
if ($value === 'false') {
|
41 |
+
$value = false;
|
42 |
+
}
|
43 |
+
if ($value === 'true') {
|
44 |
+
$value = true;
|
45 |
+
}
|
46 |
+
if ($value === 'null') {
|
47 |
+
$value = null;
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
$payload = shortcode_atts($defaults, $attrs + ['legend' => $contents], $tag);
|
52 |
+
|
53 |
+
if (! $payload['id']) {
|
54 |
+
$payload['id'] = (int) get_the_ID();
|
55 |
+
}
|
56 |
+
|
57 |
+
if (! $payload['slug']) {
|
58 |
+
$payload['slug'] = 'default';
|
59 |
+
}
|
60 |
+
|
61 |
+
if (! filter('okay', null, $payload['id'], $payload['slug'], $payload)) {
|
62 |
+
return '';
|
63 |
+
}
|
64 |
+
|
65 |
+
if ($payload['readonly'] === '') {
|
66 |
+
try {
|
67 |
+
if (filter('validate', null, $payload['id'], $payload['slug'], $payload) === false) {
|
68 |
+
throw new Exception;
|
69 |
+
}
|
70 |
+
} catch (Exception $e) {
|
71 |
+
$payload['readonly'] = true;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
return response(array_filter($payload, function ($value) {
|
76 |
+
return $value !== '';
|
77 |
+
}));
|
78 |
+
}
|
src/core/wp/shortcodes/kkratings.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\shortcodes;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
/** @param string|array $attrs */
|
20 |
+
function kkratings($attrs, string $contents, string $tag): string
|
21 |
+
{
|
22 |
+
return kk_star_ratings($attrs, $contents, $tag);
|
23 |
+
}
|
src/core/wp/shortcodes/kkstarratings.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\core\wp\shortcodes;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
/** @param string|array $attrs */
|
20 |
+
function kkstarratings($attrs, string $contents, string $tag): string
|
21 |
+
{
|
22 |
+
return kk_star_ratings($attrs, $contents, $tag);
|
23 |
+
}
|
src/functions/action.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function action(string $namespace, string $tag, ...$args): void
|
20 |
+
{
|
21 |
+
$tag = strpos($tag, '/') === 0
|
22 |
+
? substr($tag, 1)
|
23 |
+
: prefix(
|
24 |
+
str_replace('/', '\\', $tag),
|
25 |
+
rtrim($namespace, '\\').'\\'
|
26 |
+
);
|
27 |
+
|
28 |
+
do_action($tag, ...$args);
|
29 |
+
}
|
src/functions/autoload.php
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
use RecursiveDirectoryIterator;
|
15 |
+
use RecursiveIteratorIterator;
|
16 |
+
use RegexIterator;
|
17 |
+
|
18 |
+
if (! defined('KK_STAR_RATINGS')) {
|
19 |
+
http_response_code(404);
|
20 |
+
exit();
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @param string|array $namespace
|
25 |
+
*
|
26 |
+
* @return bool|array
|
27 |
+
*/
|
28 |
+
function autoload($namespace, string $path = null, array $excludes = [], int $depth = -1)
|
29 |
+
{
|
30 |
+
if (is_null($path)) {
|
31 |
+
if (! is_array($namespace)) {
|
32 |
+
return autoload_function($namespace);
|
33 |
+
}
|
34 |
+
|
35 |
+
return array_map(function ($ns) {
|
36 |
+
return autoload_function($ns);
|
37 |
+
}, $namespace);
|
38 |
+
}
|
39 |
+
|
40 |
+
$path = rtrim($path, '\/');
|
41 |
+
|
42 |
+
if (! is_dir($path)) {
|
43 |
+
return [];
|
44 |
+
}
|
45 |
+
|
46 |
+
$cutoffLength = strlen($path) + 1;
|
47 |
+
$namespace = rtrim($namespace, '\\');
|
48 |
+
|
49 |
+
$recursiveIterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
|
50 |
+
$recursiveIterator->setMaxDepth($depth);
|
51 |
+
$iterator = new RegexIterator($recursiveIterator, '/\.php$/');
|
52 |
+
|
53 |
+
// $autoload = function (string $fn, string $fqfn = null) use (&$autoload) {
|
54 |
+
// $fqfn = $fqfn ?: $fn;
|
55 |
+
|
56 |
+
// $parts = explode('\\', $fn, 2);
|
57 |
+
// $head = array_shift($parts);
|
58 |
+
// $tail = array_shift($parts);
|
59 |
+
|
60 |
+
// if (! $tail) {
|
61 |
+
// return [$head => $fqfn];
|
62 |
+
// }
|
63 |
+
|
64 |
+
// return [$head => $autoload($tail, $fqfn)];
|
65 |
+
// };
|
66 |
+
|
67 |
+
// $autoloads = [];
|
68 |
+
|
69 |
+
// foreach (iterator_to_array($iterator) as $splFileInfo) {
|
70 |
+
// $filepath = (string) $splFileInfo;
|
71 |
+
// $filename = substr($filepath, $cutoffLength);
|
72 |
+
|
73 |
+
// if (in_array($filename, $excludes)) {
|
74 |
+
// continue;
|
75 |
+
// }
|
76 |
+
|
77 |
+
// $name = substr($filename, 0, -4);
|
78 |
+
// $name = preg_replace('/[\/\\\]/', '/', $name);
|
79 |
+
// $fn = preg_replace('/\//', '\\', $name);
|
80 |
+
// $fn = preg_replace('/([^a-zA-Z0-9\\\]+?)/', '_', $fn);
|
81 |
+
// $fqfn = $namespace.'\\'.$fn;
|
82 |
+
|
83 |
+
// if (! function_exists($fqfn)) {
|
84 |
+
// require_once $filepath;
|
85 |
+
// }
|
86 |
+
|
87 |
+
// $autoloads = array_replace_recursive($autoloads, $autoload($fn, $fqfn));
|
88 |
+
// }
|
89 |
+
|
90 |
+
// return $autoloads;
|
91 |
+
|
92 |
+
$autoloads = [];
|
93 |
+
|
94 |
+
foreach (iterator_to_array($iterator) as $splFileInfo) {
|
95 |
+
$filepath = (string) $splFileInfo;
|
96 |
+
$filename = substr($filepath, $cutoffLength);
|
97 |
+
|
98 |
+
if (in_array($filename, $excludes)) {
|
99 |
+
continue;
|
100 |
+
}
|
101 |
+
|
102 |
+
$name = substr($filename, 0, -4);
|
103 |
+
$name = preg_replace('/[\/\\\]/', '/', $name);
|
104 |
+
$fn = preg_replace('/\//', '\\', $name);
|
105 |
+
$fn = preg_replace('/([^a-zA-Z0-9\\\]+?)/', '_', $fn);
|
106 |
+
$fqFnOrCn = $namespace.'\\'.$fn;
|
107 |
+
|
108 |
+
$parts = explode('\\', $name);
|
109 |
+
$last = array_pop($parts);
|
110 |
+
|
111 |
+
$exists = 'function_exists';
|
112 |
+
|
113 |
+
if (preg_match('/^\p{Lu}/u', $last)) {
|
114 |
+
$exists = 'class_exists';
|
115 |
+
}
|
116 |
+
|
117 |
+
if (! $exists($fqFnOrCn)) {
|
118 |
+
require_once $filepath;
|
119 |
+
}
|
120 |
+
|
121 |
+
if ($exists($fqFnOrCn)) {
|
122 |
+
$autoloads = [$name => $fqFnOrCn] + $autoloads;
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
return $autoloads;
|
127 |
+
}
|
src/functions/autoload_class.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
use RuntimeException;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
/** @throws RuntimeException if the class can not be autoloaded. */
|
22 |
+
function autoload_class(string $fqcn): bool
|
23 |
+
{
|
24 |
+
if (class_exists($fqcn)) {
|
25 |
+
return false;
|
26 |
+
}
|
27 |
+
|
28 |
+
$name = $fqcn;
|
29 |
+
$prefix = 'Bhittani\StarRating\\';
|
30 |
+
|
31 |
+
if (strpos($fqcn, '\\') !== 0
|
32 |
+
&& strpos($fqcn, $prefix) !== 0
|
33 |
+
) {
|
34 |
+
$fqcn = $prefix.$fqcn;
|
35 |
+
}
|
36 |
+
|
37 |
+
if (strpos($fqcn, $prefix) === 0) {
|
38 |
+
$name = substr($fqcn, strlen($prefix));
|
39 |
+
}
|
40 |
+
|
41 |
+
$fqcn = trim($fqcn, '\\');
|
42 |
+
$name = trim($name, '\\');
|
43 |
+
|
44 |
+
// kebab-Case
|
45 |
+
$parts = array_map(function (string $part) {
|
46 |
+
return preg_replace(['/([a-z\d])([A-Z])/', '/([^-_])([A-Z][a-z])/'], '$1-$2', $part);
|
47 |
+
}, explode('\\', $name));
|
48 |
+
|
49 |
+
$filepath = dirname(KK_STAR_RATINGS).'/src/'.implode('/', $parts).'.php';
|
50 |
+
|
51 |
+
if (! is_file($filepath)) {
|
52 |
+
throw new RuntimeException("Failed to autoload class '{$fqcn}` because the file `{$filepath}` does not exist");
|
53 |
+
}
|
54 |
+
|
55 |
+
require_once $filepath;
|
56 |
+
|
57 |
+
if (! class_exists($fqcn)) {
|
58 |
+
throw new RuntimeException("Failed to autoload class '{$fqcn}` because the file `{$filepath}` does not contain the class `${fqcn}`");
|
59 |
+
}
|
60 |
+
|
61 |
+
return true;
|
62 |
+
}
|
src/functions/autoload_function.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
use RuntimeException;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
/** @throws RuntimeException if the function can not be autoloaded. */
|
22 |
+
function autoload_function(string $fqfn): bool
|
23 |
+
{
|
24 |
+
if (function_exists($fqfn)) {
|
25 |
+
return false;
|
26 |
+
}
|
27 |
+
|
28 |
+
$name = $fqfn;
|
29 |
+
$prefix = 'Bhittani\StarRating\\';
|
30 |
+
|
31 |
+
if (strpos($fqfn, '\\') !== 0
|
32 |
+
&& strpos($fqfn, $prefix) !== 0
|
33 |
+
) {
|
34 |
+
$fqfn = $prefix.$fqfn;
|
35 |
+
}
|
36 |
+
|
37 |
+
if (strpos($fqfn, $prefix) === 0) {
|
38 |
+
$name = substr($fqfn, strlen($prefix));
|
39 |
+
}
|
40 |
+
|
41 |
+
$fqfn = trim($fqfn, '\\');
|
42 |
+
$name = trim($name, '\\');
|
43 |
+
|
44 |
+
// kebab-Case
|
45 |
+
$parts = array_map(function (string $part) {
|
46 |
+
return preg_replace(['/([a-z\d])([A-Z])/', '/([^-_])([A-Z][a-z])/'], '$1-$2', $part);
|
47 |
+
}, explode('\\', $name));
|
48 |
+
|
49 |
+
$filepath = dirname(KK_STAR_RATINGS).'/src/'.implode('/', $parts).'.php';
|
50 |
+
|
51 |
+
if (! is_file($filepath)) {
|
52 |
+
throw new RuntimeException("Failed to autoload function '{$fqfn}` because the file `{$filepath}` does not exist");
|
53 |
+
}
|
54 |
+
|
55 |
+
require_once $filepath;
|
56 |
+
|
57 |
+
if (! function_exists($fqfn)) {
|
58 |
+
throw new RuntimeException("Failed to autoload function '{$fqfn}` because the file `{$filepath}` does not contain the function `${fqfn}`");
|
59 |
+
}
|
60 |
+
|
61 |
+
return true;
|
62 |
+
}
|
src/functions/cast.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
/** Cast an integer to a base */
|
20 |
+
function cast(float $value, int $to = 5, int $from = 5): float
|
21 |
+
{
|
22 |
+
// 4 * 5 / 5 = 4 * 1 = 4
|
23 |
+
// 4 * 10 / 5 = 4 * 2 = 8
|
24 |
+
// 8 * 5 / 10 = 8 / 2 = 4
|
25 |
+
// 4 * 8 / 6 = 4 * 4 / 3 = 5.33
|
26 |
+
|
27 |
+
return $value * $to / $from;
|
28 |
+
}
|
src/functions/container.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
/** @param string|array|null $keyOrItems */
|
15 |
+
function container(array &$container, $keyOrItems = null, $default = null)
|
16 |
+
{
|
17 |
+
if (is_null($keyOrItems)) {
|
18 |
+
return $container;
|
19 |
+
}
|
20 |
+
|
21 |
+
$dot = dot($container, $keyOrItems, $default);
|
22 |
+
|
23 |
+
if (is_array($keyOrItems)) {
|
24 |
+
$container = $dot;
|
25 |
+
}
|
26 |
+
|
27 |
+
return $dot;
|
28 |
+
}
|
src/functions/dot.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Get or set items using dot notation.
|
21 |
+
*
|
22 |
+
* @param int|string|array $keyOrItems
|
23 |
+
* @param mixed|null $default
|
24 |
+
*/
|
25 |
+
function dot(array $items, $keyOrItems, $default = null)
|
26 |
+
{
|
27 |
+
if (is_array($keyOrItems)) {
|
28 |
+
foreach ($keyOrItems as $key => $value) {
|
29 |
+
$parts = explode('.', $key, 2);
|
30 |
+
$head = array_shift($parts);
|
31 |
+
$tail = array_shift($parts);
|
32 |
+
|
33 |
+
if (! $tail) {
|
34 |
+
$items[$head] = $value;
|
35 |
+
|
36 |
+
continue;
|
37 |
+
}
|
38 |
+
|
39 |
+
$items[$head] = dot((array) ($items[$head] ?? []), [$tail => $value]);
|
40 |
+
}
|
41 |
+
|
42 |
+
return $items;
|
43 |
+
}
|
44 |
+
|
45 |
+
$key = $keyOrItems;
|
46 |
+
|
47 |
+
$parts = explode('.', $key, 2);
|
48 |
+
$head = array_shift($parts);
|
49 |
+
$tail = array_shift($parts);
|
50 |
+
|
51 |
+
if (! $tail) {
|
52 |
+
return $items[$head] ?? $default;
|
53 |
+
}
|
54 |
+
|
55 |
+
return dot((array) ($items[$head] ?? []), $tail, $default);
|
56 |
+
}
|
src/functions/dusk_attr.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function dusk_attr(string $name): string
|
20 |
+
{
|
21 |
+
if (! (defined('WP_DEBUG') && WP_DEBUG)) {
|
22 |
+
return '';
|
23 |
+
}
|
24 |
+
|
25 |
+
$name = esc_attr($name);
|
26 |
+
|
27 |
+
return " dusk=\"${name}\"";
|
28 |
+
}
|
src/{global.php → functions/explode_prefix.php}
RENAMED
@@ -9,31 +9,18 @@
|
|
9 |
* the LICENSE file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Bhittani\StarRating;
|
13 |
|
14 |
-
if (! defined('
|
15 |
http_response_code(404);
|
16 |
exit();
|
17 |
}
|
18 |
|
19 |
-
function
|
20 |
{
|
21 |
-
$prefix = config('nick').'_';
|
22 |
-
|
23 |
-
if (strpos($str, $prefix) === 0) {
|
24 |
-
return $str;
|
25 |
-
}
|
26 |
-
|
27 |
-
return $prefix.$str;
|
28 |
-
}
|
29 |
-
|
30 |
-
function meta_prefix($str)
|
31 |
-
{
|
32 |
-
$prefix = '_'.config('nick').'_';
|
33 |
-
|
34 |
if (strpos($str, $prefix) === 0) {
|
35 |
-
|
36 |
}
|
37 |
|
38 |
-
return $prefix
|
39 |
}
|
9 |
* the LICENSE file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
http_response_code(404);
|
16 |
exit();
|
17 |
}
|
18 |
|
19 |
+
function explode_prefix(string $str, string $prefix): array
|
20 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
if (strpos($str, $prefix) === 0) {
|
22 |
+
$str = substr($str, strlen($prefix));
|
23 |
}
|
24 |
|
25 |
+
return [$prefix, $str];
|
26 |
}
|
src/functions/filter.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function filter(string $namespace, string $tag, ...$args)
|
20 |
+
{
|
21 |
+
$tag = strpos($tag, '/') === 0
|
22 |
+
? substr($tag, 1)
|
23 |
+
: prefix(
|
24 |
+
str_replace('/', '\\', $tag),
|
25 |
+
rtrim($namespace, '\\').'\\'
|
26 |
+
);
|
27 |
+
|
28 |
+
return apply_filters($tag, ...$args);
|
29 |
+
}
|
src/functions/find.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
/** Find items with * support */
|
20 |
+
function find(array $items, string $key, $default = null)
|
21 |
+
{
|
22 |
+
$isRegex = function (string $s) {
|
23 |
+
// Spits warning in php 8.
|
24 |
+
// return @preg_match($s, '') !== false;
|
25 |
+
|
26 |
+
return false;
|
27 |
+
};
|
28 |
+
|
29 |
+
foreach ($items as $k => $v) {
|
30 |
+
if ($isRegex($k)) {
|
31 |
+
if (preg_match($k, $key)) {
|
32 |
+
return $v;
|
33 |
+
}
|
34 |
+
|
35 |
+
continue;
|
36 |
+
}
|
37 |
+
|
38 |
+
$rq = preg_quote($k, '/');
|
39 |
+
$rs = preg_replace('/(?<!\\\)\\\\\*/', '.+?', $rq);
|
40 |
+
|
41 |
+
if (preg_match('/'.$rs.'/', str_replace('*', '\*', $key))) {
|
42 |
+
return $v;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
return $default;
|
47 |
+
}
|
src/functions/flat.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
/** Flatten items into dot notation. */
|
20 |
+
function flat(array $items, int $depth = -1): array
|
21 |
+
{
|
22 |
+
$flat = [];
|
23 |
+
|
24 |
+
foreach ($items as $key => $value) {
|
25 |
+
if (! is_array($value)
|
26 |
+
|| $depth == 0
|
27 |
+
) {
|
28 |
+
$flat[$key] = $value;
|
29 |
+
|
30 |
+
continue;
|
31 |
+
}
|
32 |
+
|
33 |
+
foreach (flat($value, $depth - 1) as $_key => $_value) {
|
34 |
+
$flat[$key.'.'.$_key] = $_value;
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
return $flat;
|
39 |
+
}
|
src/functions/get_hof.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function get_hof(?array $payload, callable $delegate, string $prefix = null, array $types = []): callable
|
20 |
+
{
|
21 |
+
return function (string $key, $default = null) use ($payload, $delegate, $prefix, $types) {
|
22 |
+
$key = strip_prefix($key, $prefix);
|
23 |
+
|
24 |
+
$value = is_array($payload)
|
25 |
+
? ($payload[$prefix.$key] ?? null)
|
26 |
+
: $delegate($key, $default);
|
27 |
+
|
28 |
+
return [$prefix.$key, type_cast($value, $types[$key] ?? '')];
|
29 |
+
};
|
30 |
+
}
|
src/functions/hook.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
use ReflectionFunction;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function hook(string $type, string $tag, string $fn, int $priority = 10): bool
|
22 |
+
{
|
23 |
+
if (! function_exists($fn)) {
|
24 |
+
return false;
|
25 |
+
}
|
26 |
+
|
27 |
+
$params = [$tag, $fn, $priority, (new ReflectionFunction($fn))->getNumberOfParameters()];
|
28 |
+
|
29 |
+
if ($type == 'action') {
|
30 |
+
return add_action(...$params);
|
31 |
+
}
|
32 |
+
|
33 |
+
if ($type == 'filter') {
|
34 |
+
return add_filter(...$params);
|
35 |
+
}
|
36 |
+
|
37 |
+
return false;
|
38 |
+
}
|
src/functions/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if (! defined('KK_STAR_RATINGS')) {
|
13 |
+
http_response_code(404);
|
14 |
+
exit();
|
15 |
+
}
|
src/functions/migrations.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
use Bhittani\StarRating\classes\Migration;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function migrations(callable $store, string $key = 'migrations'): Migration
|
22 |
+
{
|
23 |
+
return new Migration($store, $key);
|
24 |
+
}
|
src/functions/option.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Get or update options.
|
21 |
+
*
|
22 |
+
* @param array|string $keyOrOptions
|
23 |
+
* @param mixed|null $default
|
24 |
+
*/
|
25 |
+
function option($keyOrOptions, $default = null, string $prefix = null, array $fallback = null)
|
26 |
+
{
|
27 |
+
$prefix = (string) $prefix;
|
28 |
+
$fallback = (array) $fallback;
|
29 |
+
|
30 |
+
if (is_array($keyOrOptions)) {
|
31 |
+
foreach ($keyOrOptions as $key => &$value) {
|
32 |
+
$key = strip_prefix($key, $prefix);
|
33 |
+
$type = gettype(find($fallback, $key));
|
34 |
+
$value = type_cast($value, $type == 'boolean' ? 'integer' : $type);
|
35 |
+
update_option($prefix.$key, $value);
|
36 |
+
}
|
37 |
+
|
38 |
+
return $keyOrOptions;
|
39 |
+
}
|
40 |
+
|
41 |
+
$key = strip_prefix($keyOrOptions, $prefix);
|
42 |
+
$fallbackValue = find($fallback, $key);
|
43 |
+
$value = get_option($prefix.$key, $default ?? $fallbackValue);
|
44 |
+
|
45 |
+
return type_cast($value, gettype($fallbackValue));
|
46 |
+
}
|
src/functions/post_meta.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Get or update post meta.
|
21 |
+
*
|
22 |
+
* @param int|string $id
|
23 |
+
* @param array|string $keyOrMeta
|
24 |
+
* @param mixed|null $default
|
25 |
+
*/
|
26 |
+
function post_meta($id, $keyOrMeta, $default = null, string $prefix = null, array $fallback = null)
|
27 |
+
{
|
28 |
+
$prefix = (string) $prefix;
|
29 |
+
$fallback = (array) $fallback;
|
30 |
+
|
31 |
+
$explodeSingle = function ($key) {
|
32 |
+
if (strpos($key, '[]') === (strlen($key) - 2)) {
|
33 |
+
return [substr($key, 0, -2), false];
|
34 |
+
}
|
35 |
+
|
36 |
+
return [$key, true];
|
37 |
+
};
|
38 |
+
|
39 |
+
if (is_array($keyOrMeta)) {
|
40 |
+
foreach ($keyOrMeta as $key => &$value) {
|
41 |
+
$key = strip_prefix($key, $prefix);
|
42 |
+
[$key, $isSingle] = $explodeSingle($key);
|
43 |
+
$type = gettype(find($fallback, $key));
|
44 |
+
$value = type_cast($value, $type == 'boolean' ? 'integer' : $type);
|
45 |
+
|
46 |
+
if ($isSingle) {
|
47 |
+
update_post_meta($id, $prefix.$key, $value);
|
48 |
+
|
49 |
+
continue;
|
50 |
+
}
|
51 |
+
|
52 |
+
add_post_meta($id, $prefix.$key, $value, true);
|
53 |
+
}
|
54 |
+
|
55 |
+
return $keyOrMeta;
|
56 |
+
}
|
57 |
+
|
58 |
+
$key = strip_prefix($keyOrMeta, $prefix);
|
59 |
+
$fallbackValue = find($fallback, $key);
|
60 |
+
[$key, $isSingle] = $explodeSingle($key);
|
61 |
+
|
62 |
+
if (is_null($default)) {
|
63 |
+
$default = $fallbackValue;
|
64 |
+
}
|
65 |
+
|
66 |
+
$value = $default;
|
67 |
+
|
68 |
+
if (metadata_exists('post', $id, $prefix.$key)) {
|
69 |
+
$value = get_post_meta($id, $prefix.$key, $isSingle);
|
70 |
+
}
|
71 |
+
|
72 |
+
if (! $isSingle) {
|
73 |
+
return (array) ($value ?: null);
|
74 |
+
}
|
75 |
+
|
76 |
+
return type_cast($value, gettype($fallbackValue));
|
77 |
+
}
|
src/functions/prefix.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @param string|array $strOrPayload
|
21 |
+
*
|
22 |
+
* @return string|array
|
23 |
+
*/
|
24 |
+
function prefix($strOrPayload, string $prefix)
|
25 |
+
{
|
26 |
+
if (is_array($strOrPayload)) {
|
27 |
+
return array_combine(
|
28 |
+
array_map(function ($str) use ($prefix) {
|
29 |
+
return prefix($str, $prefix);
|
30 |
+
}, array_keys($strOrPayload)),
|
31 |
+
array_values($strOrPayload)
|
32 |
+
);
|
33 |
+
}
|
34 |
+
|
35 |
+
$str = $strOrPayload;
|
36 |
+
|
37 |
+
if (strpos($str, $prefix) !== 0) {
|
38 |
+
return $prefix.$str;
|
39 |
+
}
|
40 |
+
|
41 |
+
return substr($str, strlen($prefix));
|
42 |
+
}
|
src/functions/sanitize.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
/** @param callable|array|null $sanitizers */
|
20 |
+
function sanitize($values, $sanitizers = null)
|
21 |
+
{
|
22 |
+
$defaultSanitizer = 'sanitize_text_field';
|
23 |
+
|
24 |
+
if (! $sanitizers) {
|
25 |
+
$sanitizers = $defaultSanitizer;
|
26 |
+
}
|
27 |
+
|
28 |
+
if (! is_array($values)) {
|
29 |
+
$sanitizer = $sanitizers;
|
30 |
+
|
31 |
+
if (is_array($sanitizer)) {
|
32 |
+
$sanitizer = $defaultSanitizer;
|
33 |
+
}
|
34 |
+
|
35 |
+
return $sanitizer($values);
|
36 |
+
}
|
37 |
+
|
38 |
+
$sanitized = [];
|
39 |
+
|
40 |
+
foreach ($values as $key => $value) {
|
41 |
+
$sanitizer = $sanitizers;
|
42 |
+
|
43 |
+
if (is_array($sanitizers)) {
|
44 |
+
$sanitizer = $sanitizers[$key] ?? $sanitizer;
|
45 |
+
}
|
46 |
+
|
47 |
+
$sanitized[sanitize_text_field($key)] = sanitize($value, $sanitizer);
|
48 |
+
}
|
49 |
+
|
50 |
+
return $sanitized;
|
51 |
+
}
|
src/functions/strip_prefix.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @param string|array $strOrPayload
|
21 |
+
*
|
22 |
+
* @return string|array
|
23 |
+
*/
|
24 |
+
function strip_prefix($strOrPayload, string $prefix)
|
25 |
+
{
|
26 |
+
if (is_array($strOrPayload)) {
|
27 |
+
return array_combine(
|
28 |
+
array_map(function ($str) use ($prefix) {
|
29 |
+
return strip_prefix($str, $prefix);
|
30 |
+
}, array_keys($strOrPayload)),
|
31 |
+
array_values($strOrPayload)
|
32 |
+
);
|
33 |
+
}
|
34 |
+
|
35 |
+
$str = $strOrPayload;
|
36 |
+
|
37 |
+
if (strpos($str, $prefix) !== 0) {
|
38 |
+
return $str;
|
39 |
+
}
|
40 |
+
|
41 |
+
return substr($str, strlen($prefix));
|
42 |
+
}
|
src/functions/to_shortcode.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function to_shortcode(string $tag, array $payload = [], string $contents = ''): string
|
20 |
+
{
|
21 |
+
$fragments = [];
|
22 |
+
$fragments[] = "[{$tag}";
|
23 |
+
|
24 |
+
$attrs = array_map(function ($key, $value) {
|
25 |
+
return "{$key}=\"{$value}\"";
|
26 |
+
}, array_keys($payload), array_values($payload));
|
27 |
+
|
28 |
+
if ($attrs) {
|
29 |
+
$fragments[] = ' ';
|
30 |
+
}
|
31 |
+
|
32 |
+
$fragments[] = implode(' ', $attrs);
|
33 |
+
$fragments[] = ']';
|
34 |
+
|
35 |
+
if ($contents) {
|
36 |
+
$fragments[] = $contents;
|
37 |
+
$fragments[] = "[/{$tag}]";
|
38 |
+
}
|
39 |
+
|
40 |
+
return implode('', $fragments);
|
41 |
+
}
|
src/functions/type_cast.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
function type_cast($value, string $type)
|
20 |
+
{
|
21 |
+
switch ($type) {
|
22 |
+
case 'array': return (array) $value;
|
23 |
+
case 'boolean': return (bool) $value;
|
24 |
+
case 'double': return (float) $value;
|
25 |
+
case 'float': return (float) $value;
|
26 |
+
case 'integer': return (int) $value;
|
27 |
+
case 'string': return (string) $value;
|
28 |
+
}
|
29 |
+
|
30 |
+
return $value;
|
31 |
+
}
|
src/functions/view.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Bhittani\StarRating\functions;
|
13 |
+
|
14 |
+
use InvalidArgumentException;
|
15 |
+
|
16 |
+
if (! defined('KK_STAR_RATINGS')) {
|
17 |
+
http_response_code(404);
|
18 |
+
exit();
|
19 |
+
}
|
20 |
+
|
21 |
+
function view(string $__base, string $__path, array $__payload = []): string
|
22 |
+
{
|
23 |
+
$resolve = function (string $base, string $path): string {
|
24 |
+
if (is_file($path)) {
|
25 |
+
return $path;
|
26 |
+
}
|
27 |
+
|
28 |
+
$path = ltrim($path, '\/');
|
29 |
+
$directory = kksr('slug').'/'.basename(dirname($base));
|
30 |
+
$parentTheme = get_template_directory().'/'.$directory.'/'.$path;
|
31 |
+
$childTheme = get_stylesheet_directory().'/'.$directory.'/'.$path;
|
32 |
+
|
33 |
+
if (is_file($childTheme)) {
|
34 |
+
return $childTheme;
|
35 |
+
}
|
36 |
+
|
37 |
+
if (is_file($parentTheme)) {
|
38 |
+
return $parentTheme;
|
39 |
+
}
|
40 |
+
|
41 |
+
$template = $base.'/'.$path;
|
42 |
+
|
43 |
+
if (is_file($template)) {
|
44 |
+
return $template;
|
45 |
+
}
|
46 |
+
|
47 |
+
throw new InvalidArgumentException("The template '{$path}' could not be located at '{$template}'");
|
48 |
+
};
|
49 |
+
|
50 |
+
$__view = function (string $path, array $payload = []) use ($__payload, $__base) {
|
51 |
+
return view($__base, $path, array_merge($__payload, $payload));
|
52 |
+
};
|
53 |
+
$__kksr = 'kksr';
|
54 |
+
$__base = rtrim($__base, '\/');
|
55 |
+
$__dusk = kksr('functions.dusk_attr');
|
56 |
+
$__template = $resolve($__base, $__path);
|
57 |
+
|
58 |
+
unset($resolve);
|
59 |
+
|
60 |
+
extract($__payload);
|
61 |
+
|
62 |
+
ob_start();
|
63 |
+
|
64 |
+
require $__template;
|
65 |
+
|
66 |
+
return ob_get_clean();
|
67 |
+
}
|
src/hook.php
DELETED
@@ -1,59 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of bhittani/kk-star-ratings.
|
5 |
-
*
|
6 |
-
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view
|
9 |
-
* the LICENSE file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Bhittani\StarRating;
|
13 |
-
|
14 |
-
if (! defined('ABSPATH')) {
|
15 |
-
http_response_code(404);
|
16 |
-
exit();
|
17 |
-
}
|
18 |
-
|
19 |
-
function add_plugin_filter($tag, callable $callback, $priority = 10, $acceptedArgs = 1)
|
20 |
-
{
|
21 |
-
$tag = config('nick').'::filter.'.$tag;
|
22 |
-
|
23 |
-
return add_filter($tag, $callback, $priority, $acceptedArgs);
|
24 |
-
}
|
25 |
-
|
26 |
-
function apply_plugin_filters($tag, ...$arguments)
|
27 |
-
{
|
28 |
-
$tag = config('nick').'::filter.'.$tag;
|
29 |
-
|
30 |
-
return apply_filters($tag, ...$arguments);
|
31 |
-
}
|
32 |
-
|
33 |
-
function remove_plugin_filter($tag, callable $callback, $priority = 10)
|
34 |
-
{
|
35 |
-
$tag = config('nick').'::filter.'.$tag;
|
36 |
-
|
37 |
-
return remove_filter($tag, $callback, $priority);
|
38 |
-
}
|
39 |
-
|
40 |
-
function add_plugin_action($tag, callable $callback, $priority = 10, $acceptedArgs = 1)
|
41 |
-
{
|
42 |
-
$tag = config('nick').'::action.'.$tag;
|
43 |
-
|
44 |
-
return add_action($tag, $callback, $priority, $acceptedArgs);
|
45 |
-
}
|
46 |
-
|
47 |
-
function do_plugin_action($tag, ...$arguments)
|
48 |
-
{
|
49 |
-
$tag = config('nick').'::action.'.$tag;
|
50 |
-
|
51 |
-
return do_action($tag, ...$arguments);
|
52 |
-
}
|
53 |
-
|
54 |
-
function remove_plugin_action($tag, callable $callback, $priority = 10)
|
55 |
-
{
|
56 |
-
$tag = config('nick').'::action.'.$tag;
|
57 |
-
|
58 |
-
return remove_action($tag, $callback, $priority);
|
59 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/index.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
use function Bhittani\StarRating\functions\autoload;
|
13 |
+
|
14 |
+
if (! defined('KK_STAR_RATINGS')) {
|
15 |
+
http_response_code(404);
|
16 |
+
exit();
|
17 |
+
}
|
18 |
+
|
19 |
+
foreach ([
|
20 |
+
'functions/autoload',
|
21 |
+
'functions/autoload_class',
|
22 |
+
'functions/autoload_function',
|
23 |
+
'functions/dot',
|
24 |
+
'functions/container',
|
25 |
+
'kksr',
|
26 |
+
] as $filename) {
|
27 |
+
require_once __DIR__.'/'.ltrim($filename, '\/').'.php';
|
28 |
+
}
|
29 |
+
|
30 |
+
kksr(require __DIR__.'/config.php');
|
31 |
+
|
32 |
+
autoload('\kk_star_ratings');
|
src/kk_star_ratings.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
use function Bhittani\StarRating\functions\to_shortcode;
|
13 |
+
|
14 |
+
/** @param int|string|array|object|WP_POST|null $idOrPostOrPayload */
|
15 |
+
function kk_star_ratings($idOrPostOrPayload = null): string
|
16 |
+
{
|
17 |
+
$payload = [];
|
18 |
+
|
19 |
+
if (is_array($idOrPostOrPayload)) {
|
20 |
+
$payload = $idOrPostOrPayload;
|
21 |
+
}
|
22 |
+
|
23 |
+
if (is_object($idOrPostOrPayload)) {
|
24 |
+
$payload['id'] = $idOrPostOrPayload->ID;
|
25 |
+
}
|
26 |
+
|
27 |
+
if ($idOrPostOrPayload) {
|
28 |
+
$payload['id'] = $idOrPostOrPayload;
|
29 |
+
}
|
30 |
+
|
31 |
+
$payload['reference'] = 'template';
|
32 |
+
|
33 |
+
return do_shortcode(to_shortcode(kksr('slug'), $payload));
|
34 |
+
}
|
src/kksr.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of bhittani/kk-star-ratings.
|
5 |
+
*
|
6 |
+
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view
|
9 |
+
* the LICENSE file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
use function Bhittani\StarRating\functions\container;
|
13 |
+
|
14 |
+
/** @param string|array|null $keyOrItems */
|
15 |
+
function kksr($keyOrItems = null, $default = null)
|
16 |
+
{
|
17 |
+
static $config = [];
|
18 |
+
|
19 |
+
return container($config, $keyOrItems, $default);
|
20 |
+
}
|
src/legacy.php
DELETED
@@ -1,99 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of bhittani/kk-star-ratings.
|
5 |
-
*
|
6 |
-
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view
|
9 |
-
* the LICENSE file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
if (! defined('ABSPATH')) {
|
13 |
-
http_response_code(404);
|
14 |
-
exit();
|
15 |
-
}
|
16 |
-
|
17 |
-
if (! function_exists('kk_star_ratings')) {
|
18 |
-
function kk_star_ratings($idOrPost = null)
|
19 |
-
{
|
20 |
-
$id = null;
|
21 |
-
|
22 |
-
if ($idOrPost) {
|
23 |
-
$id = is_object($idOrPost) ? $idOrPost->ID : $idOrPost;
|
24 |
-
}
|
25 |
-
|
26 |
-
return Bhittani\StarRating\response(compact('id'), false);
|
27 |
-
}
|
28 |
-
}
|
29 |
-
|
30 |
-
if (! function_exists('kk_star_ratings_get')) {
|
31 |
-
function kk_star_ratings_get($limit = 5, $taxonomyId = null, $offset = 0)
|
32 |
-
{
|
33 |
-
global $wpdb;
|
34 |
-
$postsTable = $wpdb->posts;
|
35 |
-
$postMetaTable = $wpdb->prefix.'postmeta';
|
36 |
-
|
37 |
-
$queryJoins = "
|
38 |
-
JOIN {$postMetaTable} postmeta_ratings
|
39 |
-
ON posts.ID = postmeta_ratings.post_id
|
40 |
-
JOIN {$postMetaTable} postmeta_casts
|
41 |
-
ON posts.ID = postmeta_casts.post_id
|
42 |
-
";
|
43 |
-
|
44 |
-
$querySelect = "
|
45 |
-
SELECT
|
46 |
-
posts.ID,
|
47 |
-
postmeta_ratings.meta_value AS ratings,
|
48 |
-
postmeta_casts.meta_value AS casts,
|
49 |
-
ROUND(CAST(postmeta_ratings.meta_value AS FLOAT) / CAST(postmeta_casts.meta_value AS DOUBLE), 1) AS score
|
50 |
-
FROM {$postsTable} posts
|
51 |
-
";
|
52 |
-
|
53 |
-
$queryConditions = "
|
54 |
-
WHERE
|
55 |
-
posts.post_status = 'publish'
|
56 |
-
AND CAST(postmeta_casts.meta_value AS UNSIGNED) != 0
|
57 |
-
AND postmeta_casts.meta_key = '_kksr_casts'
|
58 |
-
AND postmeta_ratings.meta_key = '_kksr_ratings'
|
59 |
-
";
|
60 |
-
|
61 |
-
$queryOrder = '
|
62 |
-
ORDER BY
|
63 |
-
score DESC,
|
64 |
-
CAST(postmeta_casts.meta_value AS UNSIGNED) DESC
|
65 |
-
';
|
66 |
-
|
67 |
-
$queryLimit = 'LIMIT %d, %d';
|
68 |
-
|
69 |
-
$queryArgs = [$offset, $limit];
|
70 |
-
|
71 |
-
if ($taxonomyId) {
|
72 |
-
$termTaxonomyTable = $wpdb->prefix.'term_taxonomy';
|
73 |
-
$termRelationshipsTable = $wpdb->prefix.'term_relationships';
|
74 |
-
|
75 |
-
$queryJoins .= "
|
76 |
-
JOIN {$termRelationshipsTable} term_relations
|
77 |
-
ON posts.ID = term_relations.object_id
|
78 |
-
JOIN {$termTaxonomyTable} term_taxonomies
|
79 |
-
ON term_relations.term_taxonomy_id = term_taxonomies.term_taxonomy_id
|
80 |
-
";
|
81 |
-
|
82 |
-
$queryConditions .= '
|
83 |
-
AND term_taxonomies.term_id=%d
|
84 |
-
';
|
85 |
-
|
86 |
-
$queryArgs = [$taxonomyId, $offset, $limit];
|
87 |
-
}
|
88 |
-
|
89 |
-
$query = $querySelect
|
90 |
-
.PHP_EOL.$queryJoins
|
91 |
-
.PHP_EOL.$queryConditions
|
92 |
-
.PHP_EOL.$queryOrder
|
93 |
-
.PHP_EOL.$queryLimit;
|
94 |
-
|
95 |
-
$preparedQuery = $wpdb->prepare($query, ...$queryArgs);
|
96 |
-
|
97 |
-
return $wpdb->get_results($preparedQuery);
|
98 |
-
}
|
99 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/metabox.php
DELETED
@@ -1,106 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of bhittani/kk-star-ratings.
|
5 |
-
*
|
6 |
-
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view
|
9 |
-
* the LICENSE file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Bhittani\StarRating;
|
13 |
-
|
14 |
-
if (! defined('ABSPATH')) {
|
15 |
-
http_response_code(404);
|
16 |
-
exit();
|
17 |
-
}
|
18 |
-
|
19 |
-
add_action('add_meta_boxes', __NAMESPACE__.'\metabox', 10, 2);
|
20 |
-
function metabox($type, $post)
|
21 |
-
{
|
22 |
-
$icon = $legend = '';
|
23 |
-
|
24 |
-
if ($post) {
|
25 |
-
$best = max((int) get_option(prefix('stars')), 1);
|
26 |
-
$count = apply_plugin_filters('count', null, $post->ID, null);
|
27 |
-
$score = apply_plugin_filters('score', null, $best, $post->ID, null);
|
28 |
-
|
29 |
-
$icon = '<span class="dashicons dashicons-star-empty" style="margin-right: .25rem; font-size: 18px;"></span>';
|
30 |
-
|
31 |
-
$legend = '';
|
32 |
-
|
33 |
-
if ($score) {
|
34 |
-
$legend = "
|
35 |
-
<span style=\"float:right;color:#666;\">
|
36 |
-
{$score}
|
37 |
-
<span style=\"font-weight:normal;color:#ddd;\">/</span>
|
38 |
-
<span style=\"font-weight:normal;color:#aaa;\">{$count}</span>
|
39 |
-
</span>
|
40 |
-
";
|
41 |
-
}
|
42 |
-
}
|
43 |
-
|
44 |
-
$customPostTypes = get_post_types(['publicly_queryable' => true, '_builtin' => false], 'names');
|
45 |
-
$postTypes = array_merge(['post', 'page'], $customPostTypes);
|
46 |
-
|
47 |
-
add_meta_box(
|
48 |
-
config('slug'),
|
49 |
-
$icon.config('name').$legend,
|
50 |
-
__NAMESPACE__.'\metabox_callback',
|
51 |
-
$postTypes,
|
52 |
-
'side'
|
53 |
-
);
|
54 |
-
}
|
55 |
-
|
56 |
-
function metabox_callback($post)
|
57 |
-
{
|
58 |
-
wp_nonce_field(basename(__FILE__), config('slug').'-metabox');
|
59 |
-
|
60 |
-
$content = apply_plugin_filters('metabox', '', $post);
|
61 |
-
|
62 |
-
echo view('metabox.index', compact('content'));
|
63 |
-
}
|
64 |
-
|
65 |
-
add_action('save_post', __NAMESPACE__.'\save_metabox');
|
66 |
-
function save_metabox($id)
|
67 |
-
{
|
68 |
-
if ((! isset($_POST[config('slug').'-metabox']))
|
69 |
-
|| (! wp_verify_nonce($_POST[config('slug').'-metabox'], basename(__FILE__)))
|
70 |
-
|| (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
|
71 |
-
|| (! current_user_can('edit_post', $id))
|
72 |
-
// || (is_multisite() && ms_is_switched())
|
73 |
-
// || (! (isset( $_POST['post_type'] ) && 'page' === $_POST['post_type']))
|
74 |
-
) {
|
75 |
-
return;
|
76 |
-
}
|
77 |
-
|
78 |
-
do_plugin_action('save_metabox', $id);
|
79 |
-
}
|
80 |
-
|
81 |
-
add_plugin_filter('metabox', __NAMESPACE__.'\metabox_content', 9, 2);
|
82 |
-
function metabox_content($content, $post)
|
83 |
-
{
|
84 |
-
$resetFieldName = meta_prefix('reset');
|
85 |
-
$statusFieldName = meta_prefix('status');
|
86 |
-
$status = get_post_meta($post->ID, $statusFieldName, true);
|
87 |
-
|
88 |
-
return $content.view('metabox.content', compact('status', 'statusFieldName', 'resetFieldName'));
|
89 |
-
}
|
90 |
-
|
91 |
-
add_plugin_action('save_metabox', __NAMESPACE__.'\save_default_metabox', 9);
|
92 |
-
function save_default_metabox($id)
|
93 |
-
{
|
94 |
-
if (isset($_POST[meta_prefix('status')])) {
|
95 |
-
update_post_meta($id, meta_prefix('status'), sanitize_text_field($_POST[meta_prefix('status')]));
|
96 |
-
}
|
97 |
-
|
98 |
-
if (isset($_POST[meta_prefix('reset')])
|
99 |
-
&& checked($_POST[meta_prefix('reset')], '1', false)
|
100 |
-
) {
|
101 |
-
delete_post_meta($id, meta_prefix('ref'));
|
102 |
-
delete_post_meta($id, meta_prefix('avg'));
|
103 |
-
delete_post_meta($id, meta_prefix('casts'));
|
104 |
-
delete_post_meta($id, meta_prefix('ratings'));
|
105 |
-
}
|
106 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/post.php
DELETED
@@ -1,82 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of bhittani/kk-star-ratings.
|
5 |
-
*
|
6 |
-
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view
|
9 |
-
* the LICENSE file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Bhittani\StarRating;
|
13 |
-
|
14 |
-
if (! defined('ABSPATH')) {
|
15 |
-
http_response_code(404);
|
16 |
-
exit();
|
17 |
-
}
|
18 |
-
|
19 |
-
add_filter('the_content', __NAMESPACE__.'\content_filter', 10);
|
20 |
-
function content_filter($content)
|
21 |
-
{
|
22 |
-
$shortcode = config('shortcode');
|
23 |
-
|
24 |
-
if (has_shortcode($content, $shortcode)
|
25 |
-
// Legacy support
|
26 |
-
|| has_shortcode($content, 'kkratings')
|
27 |
-
) {
|
28 |
-
return $content;
|
29 |
-
}
|
30 |
-
|
31 |
-
// if (! validate()) {
|
32 |
-
// return $content;
|
33 |
-
// }
|
34 |
-
|
35 |
-
if (in_array(get_post_type(), (array) get_option(prefix('manual_control'), []))) {
|
36 |
-
return $content;
|
37 |
-
}
|
38 |
-
|
39 |
-
$align = 'left';
|
40 |
-
$valign = 'top';
|
41 |
-
|
42 |
-
$position = get_option(prefix('position'));
|
43 |
-
|
44 |
-
if (strpos($position, 'top-') === 0) {
|
45 |
-
$valign = 'top';
|
46 |
-
$align = substr($position, 4);
|
47 |
-
} elseif (strpos($position, 'bottom-') === 0) {
|
48 |
-
$valign = 'bottom';
|
49 |
-
$align = substr($position, 7);
|
50 |
-
}
|
51 |
-
|
52 |
-
$shortcode = "[{$shortcode} force=\"false\" valign=\"{$valign}\" align=\"{$align}\"]";
|
53 |
-
|
54 |
-
return $valign == 'top' ? ($shortcode.$content) : ($content.$shortcode);
|
55 |
-
}
|
56 |
-
|
57 |
-
add_action('wp_head', __NAMESPACE__.'\structured_data');
|
58 |
-
function structured_data()
|
59 |
-
{
|
60 |
-
if (! get_option(prefix('enable'))) {
|
61 |
-
return;
|
62 |
-
}
|
63 |
-
|
64 |
-
if (get_option(prefix('grs')) && (is_singular())) {
|
65 |
-
$id = get_post_field('ID');
|
66 |
-
$title = htmlentities(get_post_field('post_title'));
|
67 |
-
$best = max((int) get_option(prefix('stars')), 1);
|
68 |
-
$count = apply_plugin_filters('count', null, $id, null);
|
69 |
-
$score = apply_plugin_filters('score', null, $best, $id, null);
|
70 |
-
|
71 |
-
if ($score) {
|
72 |
-
echo '<script type="application/ld+json">';
|
73 |
-
$sd = get_option(prefix('sd'));
|
74 |
-
$sd = str_replace('[title]', $title, $sd);
|
75 |
-
$sd = str_replace('[best]', $best, $sd);
|
76 |
-
$sd = str_replace('[count]', $count, $sd);
|
77 |
-
$sd = str_replace('[score]', $score, $sd);
|
78 |
-
echo $sd;
|
79 |
-
echo '</script>';
|
80 |
-
}
|
81 |
-
}
|
82 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/response.php
DELETED
@@ -1,93 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of bhittani/kk-star-ratings.
|
5 |
-
*
|
6 |
-
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view
|
9 |
-
* the LICENSE file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Bhittani\StarRating;
|
13 |
-
|
14 |
-
if (! defined('ABSPATH')) {
|
15 |
-
http_response_code(404);
|
16 |
-
exit();
|
17 |
-
}
|
18 |
-
|
19 |
-
function response(array $payload = [], $validate = true)
|
20 |
-
{
|
21 |
-
$payload = array_merge([
|
22 |
-
'id' => null,
|
23 |
-
'slug' => null,
|
24 |
-
'score' => null,
|
25 |
-
'count' => null,
|
26 |
-
'align' => null,
|
27 |
-
'valign' => null,
|
28 |
-
'force' => true,
|
29 |
-
'disabled' => false,
|
30 |
-
'size' => get_option(prefix('size') ?: config('options')['size']),
|
31 |
-
'best' => get_option(prefix('stars') ?: config('options')['stars']),
|
32 |
-
'greet' => get_option(prefix('greet') ?: config('options')['greet']),
|
33 |
-
], array_filter($payload, function ($value) {
|
34 |
-
return ! is_null($value);
|
35 |
-
}));
|
36 |
-
|
37 |
-
if (! get_option(prefix('enable'))) {
|
38 |
-
return '';
|
39 |
-
}
|
40 |
-
|
41 |
-
if (! $payload['id']/* && ! $payload['slug']*/) {
|
42 |
-
$payload['id'] = get_post_field('ID');
|
43 |
-
}
|
44 |
-
|
45 |
-
$force = $payload['force'] ?: (! $validate);
|
46 |
-
|
47 |
-
if (! $force
|
48 |
-
&& ! validate(true, $payload['id'], $payload['slug'])
|
49 |
-
) {
|
50 |
-
return;
|
51 |
-
}
|
52 |
-
|
53 |
-
if (! $payload['id']) {
|
54 |
-
$payload['disabled'] = true;
|
55 |
-
}
|
56 |
-
|
57 |
-
if ($payload['score']) {
|
58 |
-
$payload['disabled'] = true;
|
59 |
-
} elseif ($payload['id']) {
|
60 |
-
$payload['score'] = apply_plugin_filters('score', $payload['score'], $payload['best'], $payload['id'], $payload['slug']);
|
61 |
-
}
|
62 |
-
|
63 |
-
if ($payload['count']) {
|
64 |
-
$payload['disabled'] = true;
|
65 |
-
} elseif ($payload['id']) {
|
66 |
-
$payload['count'] = apply_plugin_filters('count', $payload['count'], $payload['id'], $payload['slug']);
|
67 |
-
}
|
68 |
-
|
69 |
-
if (! $payload['disabled']) {
|
70 |
-
$payload['disabled'] = ! apply_plugin_filters('can_vote', ! $payload['disabled'], $payload['id'], $payload['slug']);
|
71 |
-
}
|
72 |
-
|
73 |
-
if (! $payload['id'] || $payload['disabled']) {
|
74 |
-
$payload['greet'] = '';
|
75 |
-
}
|
76 |
-
|
77 |
-
if ($payload['id'] && ! $payload['disabled']) {
|
78 |
-
$payload['greet'] = apply_plugin_filters('greet', $payload['greet'], $payload['id'], $payload['slug']);
|
79 |
-
}
|
80 |
-
|
81 |
-
$payload['best'] = max((int) $payload['best'], 1);
|
82 |
-
$payload['count'] = max((int) $payload['count'], 0);
|
83 |
-
$payload['score'] = min(max($payload['score'], 0), $payload['best']);
|
84 |
-
|
85 |
-
$percentage = $payload['score'] / $payload['best'] * 100;
|
86 |
-
$percentage = round($percentage, 2, PHP_ROUND_HALF_DOWN);
|
87 |
-
$payload['percentage'] = min(max($percentage, 0), 100);
|
88 |
-
|
89 |
-
$payload['gap'] = max((int) get_option(prefix('gap')), 0);
|
90 |
-
$payload['width'] = $payload['score'] * $payload['size'] + $payload['gap'] * (int) $payload['score'];
|
91 |
-
|
92 |
-
return view('markup', $payload);
|
93 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/shortcode.php
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of bhittani/kk-star-ratings.
|
5 |
-
*
|
6 |
-
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view
|
9 |
-
* the LICENSE file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Bhittani\StarRating;
|
13 |
-
|
14 |
-
if (! defined('ABSPATH')) {
|
15 |
-
http_response_code(404);
|
16 |
-
exit();
|
17 |
-
}
|
18 |
-
|
19 |
-
add_shortcode(config('shortcode'), __NAMESPACE__.'\shortcode');
|
20 |
-
// Legacy support.
|
21 |
-
add_shortcode('kkratings', __NAMESPACE__.'\shortcode');
|
22 |
-
function shortcode($attrs, $content, $tag)
|
23 |
-
{
|
24 |
-
$attrs = (array) $attrs;
|
25 |
-
|
26 |
-
foreach ($attrs as $key => &$value) {
|
27 |
-
if (is_numeric($key)) {
|
28 |
-
$attrs[$value] = true;
|
29 |
-
unset($attrs[$key]);
|
30 |
-
}
|
31 |
-
if ($value === 'false') {
|
32 |
-
$value = false;
|
33 |
-
}
|
34 |
-
if ($value === 'true') {
|
35 |
-
$value = true;
|
36 |
-
}
|
37 |
-
if ($value === 'null') {
|
38 |
-
$value = null;
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
$attrs = shortcode_atts(array_fill_keys([
|
43 |
-
'id', 'slug', 'score', 'count', 'best',
|
44 |
-
'size', 'align', 'valign', 'disabled',
|
45 |
-
'greet', 'force',
|
46 |
-
], null), $attrs, $tag);
|
47 |
-
|
48 |
-
return response($attrs);
|
49 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/validate.php
DELETED
@@ -1,53 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of bhittani/kk-star-ratings.
|
5 |
-
*
|
6 |
-
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view
|
9 |
-
* the LICENSE file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Bhittani\StarRating;
|
13 |
-
|
14 |
-
if (! defined('ABSPATH')) {
|
15 |
-
http_response_code(404);
|
16 |
-
exit();
|
17 |
-
}
|
18 |
-
|
19 |
-
function validate($default = true, $id = null, $slug = null)
|
20 |
-
{
|
21 |
-
return (bool) apply_plugin_filters('validate', $default, $id, $slug);
|
22 |
-
}
|
23 |
-
|
24 |
-
add_plugin_filter('validate', __NAMESPACE__.'\validate_request', 9, 3);
|
25 |
-
function validate_request($bool, $id, $slug)
|
26 |
-
{
|
27 |
-
$excludedLocations = (array) get_option(prefix('exclude_locations'), []);
|
28 |
-
|
29 |
-
if ((is_front_page() || is_home())
|
30 |
-
&& in_array('home', $excludedLocations)
|
31 |
-
) {
|
32 |
-
return false;
|
33 |
-
}
|
34 |
-
|
35 |
-
if (is_archive()
|
36 |
-
&& in_array('archives', $excludedLocations)
|
37 |
-
) {
|
38 |
-
return false;
|
39 |
-
}
|
40 |
-
|
41 |
-
return $bool;
|
42 |
-
}
|
43 |
-
|
44 |
-
add_plugin_filter('can_vote', __NAMESPACE__.'\can_vote', 9, 3);
|
45 |
-
function can_vote($bool, $id, $slug)
|
46 |
-
{
|
47 |
-
if (! is_user_logged_in()
|
48 |
-
&& ! in_array('guests', (array) get_option(prefix('strategies'), []))) {
|
49 |
-
return false;
|
50 |
-
}
|
51 |
-
|
52 |
-
return $bool;
|
53 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/view.php
DELETED
@@ -1,73 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of bhittani/kk-star-ratings.
|
5 |
-
*
|
6 |
-
* (c) Kamal Khan <shout@bhittani.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view
|
9 |
-
* the LICENSE file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Bhittani\StarRating;
|
13 |
-
|
14 |
-
use SplStack;
|
15 |
-
use RuntimeException;
|
16 |
-
|
17 |
-
if (! defined('ABSPATH')) {
|
18 |
-
http_response_code(404);
|
19 |
-
exit();
|
20 |
-
}
|
21 |
-
|
22 |
-
function view($templates, array $payload = [])
|
23 |
-
{
|
24 |
-
foreach ((array) $templates as $template) {
|
25 |
-
$template = str_replace('.', '/', $template);
|
26 |
-
|
27 |
-
if (strpos($template, '/php') === strlen($template) - 4) {
|
28 |
-
$template = substr($template, 0, -4);
|
29 |
-
}
|
30 |
-
|
31 |
-
$filename = $template.'.php';
|
32 |
-
|
33 |
-
$filepath = config('views').ltrim($filename, '\/');
|
34 |
-
|
35 |
-
if (is_file($filepath)) {
|
36 |
-
$name = str_replace('/', '.', $template);
|
37 |
-
|
38 |
-
$content = get_view($filepath, $payload);
|
39 |
-
|
40 |
-
$content = apply_plugin_filters('view', $content, $name);
|
41 |
-
|
42 |
-
return apply_plugin_filters('view:'.$name, $content);
|
43 |
-
}
|
44 |
-
}
|
45 |
-
|
46 |
-
throw new RuntimeException('None of the templates exist');
|
47 |
-
}
|
48 |
-
|
49 |
-
function get_view($__file__, array $__payload__ = [])
|
50 |
-
{
|
51 |
-
static $__cascade__;
|
52 |
-
|
53 |
-
if (! is_file($__file__)) {
|
54 |
-
throw new RuntimeException("View {$__file__} does not exist");
|
55 |
-
}
|
56 |
-
|
57 |
-
$__cascade__ = $__cascade__ ?: new SplStack();
|
58 |
-
|
59 |
-
$__cascade__->push(array_merge(
|
60 |
-
$__cascade__->isEmpty() ? [] : $__cascade__->top(),
|
61 |
-
$__payload__
|
62 |
-
));
|
63 |
-
|
64 |
-
extract($__cascade__->top());
|
65 |
-
|
66 |
-
ob_start();
|
67 |
-
|
68 |
-
include $__file__;
|
69 |
-
|
70 |
-
$__cascade__->pop();
|
71 |
-
|
72 |
-
return ob_get_clean();
|
73 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/active-star.php
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<?= \Bhittani\StarRating\view('star') ?>
|
|
views/active-stars.php
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
<div class="kksr-stars-active" style="width: <?= esc_attr($width) ?>px;">
|
2 |
-
<?php for ($i = 1; $i <= $best; $i++) : ?>
|
3 |
-
<div class="kksr-star">
|
4 |
-
<?= \Bhittani\StarRating\view('active-star') ?>
|
5 |
-
</div>
|
6 |
-
<?php endfor; ?>
|
7 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/admin/content.php
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (! defined('ABSPATH')) {
|
3 |
-
http_response_code(404);
|
4 |
-
die();
|
5 |
-
}
|
6 |
-
?>
|
7 |
-
|
8 |
-
<form method="POST" action="options.php?tab=<?= esc_attr($active); ?>" style="margin: 2rem;">
|
9 |
-
<?php submit_button(); ?>
|
10 |
-
<?php settings_fields($slug); ?>
|
11 |
-
<?php do_settings_sections($slug); ?>
|
12 |
-
<?php submit_button(); ?>
|
13 |
-
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/admin/fields/checkbox.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (! defined('ABSPATH')) {
|
3 |
-
http_response_code(404);
|
4 |
-
die();
|
5 |
-
}
|
6 |
-
?>
|
7 |
-
|
8 |
-
<label>
|
9 |
-
<input type="checkbox" name="<?= esc_attr($name) ?>" value="<?= esc_attr($value) ?>"
|
10 |
-
<?= $checked ? 'checked="checked"' : '' ?>>
|
11 |
-
<?= esc_html($label) ?>
|
12 |
-
</label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/admin/fields/code.php
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (! defined('ABSPATH')) {
|
3 |
-
http_response_code(404);
|
4 |
-
die();
|
5 |
-
}
|
6 |
-
?>
|
7 |
-
|
8 |
-
<textarea rows="15" cols="50" name="<?= esc_attr($name) ?>"
|
9 |
-
style="font-family: monospace; padding: .5rem;"><?= esc_textarea($value) ?></textarea>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/admin/fields/number.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (! defined('ABSPATH')) {
|
3 |
-
http_response_code(404);
|
4 |
-
die();
|
5 |
-
}
|
6 |
-
?>
|
7 |
-
|
8 |
-
<input type="number" name="<?= esc_attr($name) ?>" value="<?= esc_attr($value) ?>"
|
9 |
-
<?= isset($min) ? ('min="'. esc_attr($min).'"') : '' ?>
|
10 |
-
<?= isset($max) ? ('max="'. esc_attr($max).'"') : '' ?>
|
11 |
-
<?= isset($step) ? ('step="'. esc_attr($step).'"') : '' ?>
|
12 |
-
style="width: 5rem; padding-right: 0;">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/admin/fields/radio.php
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (! defined('ABSPATH')) {
|
3 |
-
http_response_code(404);
|
4 |
-
die();
|
5 |
-
}
|
6 |
-
?>
|
7 |
-
|
8 |
-
<label>
|
9 |
-
<input type="radio" name="<?= esc_attr($name) ?>" value="<?= esc_attr($value) ?>"
|
10 |
-
<?= $checked ? 'checked="checked"' : '' ?>>
|
11 |
-
|
12 |
-
<?= esc_html($label) ?>
|
13 |
-
</label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/admin/fields/select.php
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (! defined('ABSPATH')) {
|
3 |
-
http_response_code(404);
|
4 |
-
die();
|
5 |
-
}
|
6 |
-
?>
|
7 |
-
|
8 |
-
<select name="<?= esc_attr($name) ?><?= (isset($multiple) && $multiple) ? '[]' : '' ?>"
|
9 |
-
style="min-width: 15rem; padding: .5rem;"
|
10 |
-
<?= (isset($multiple) && $multiple) ? 'multiple="multiple"' : '' ?>>
|
11 |
-
<?php foreach ($options as $option) : ?>
|
12 |
-
<option value="<?= esc_attr($option['value']) ?>"
|
13 |
-
<?= $option['selected'] ? 'selected="selected"' : '' ?>>
|
14 |
-
<?= esc_html($option['label']) ?>
|
15 |
-
</option>
|
16 |
-
<?php endforeach; ?>
|
17 |
-
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/admin/fields/text.php
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (!defined('ABSPATH')) {
|
3 |
-
http_response_code(404);
|
4 |
-
die();
|
5 |
-
}
|
6 |
-
?>
|
7 |
-
|
8 |
-
<input type="text" name="<?= esc_attr($name) ?>" value="<?= esc_attr($value) ?>" class="regular-text">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/admin/fields/textarea.php
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (! defined('ABSPATH')) {
|
3 |
-
http_response_code(404);
|
4 |
-
die();
|
5 |
-
}
|
6 |
-
?>
|
7 |
-
|
8 |
-
<textarea rows="15" cols="50" name="<?= esc_attr($name) ?>"
|
9 |
-
style="padding: .5rem;"><?= esc_textarea($value) ?></textarea>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/admin/index.php
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (! defined('ABSPATH')) {
|
3 |
-
http_response_code(404);
|
4 |
-
die();
|
5 |
-
}
|
6 |
-
?>
|
7 |
-
|
8 |
-
<div class="wrap">
|
9 |
-
<?php settings_errors(); ?>
|
10 |
-
|
11 |
-
<h1>
|
12 |
-
<?= esc_html($label); ?>
|
13 |
-
<small style="
|
14 |
-
color: gray;
|
15 |
-
font-size: 80%;
|
16 |
-
margin-left: .5rem;
|
17 |
-
letter-spacing: -2px;
|
18 |
-
font-family: monospace;">
|
19 |
-
<?= esc_html($version); ?>
|
20 |
-
</small>
|
21 |
-
</h1>
|
22 |
-
|
23 |
-
<h2 class="nav-tab-wrapper">
|
24 |
-
<?php foreach ($tabs as $tab => $label) : ?>
|
25 |
-
<a class="nav-tab <?= $tab === $active ? 'nav-tab-active' : ''; ?>"
|
26 |
-
href="<?= admin_url('admin.php?page='.esc_attr($_GET['page']).'&tab='. esc_attr($tab)); ?>">
|
27 |
-
<?= esc_html($label); ?>
|
28 |
-
</a>
|
29 |
-
<?php endforeach; ?>
|
30 |
-
<div style="float: left; margin-left: 10px;">
|
31 |
-
<?= \Bhittani\StarRating\view('admin.social') ?>
|
32 |
-
</div>
|
33 |
-
</h2>
|
34 |
-
|
35 |
-
<?= $content ?>
|
36 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/inactive-star.php
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<?= \Bhittani\StarRating\view('star') ?>
|
|
views/inactive-stars.php
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
<div class="kksr-stars-inactive">
|
2 |
-
<?php for ($i = 1; $i <= $best; $i++) : ?>
|
3 |
-
<div class="kksr-star" data-star="<?= esc_attr($i) ?>">
|
4 |
-
<?= \Bhittani\StarRating\view('inactive-star') ?>
|
5 |
-
</div>
|
6 |
-
<?php endfor; ?>
|
7 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/index.php
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if (! defined('ABSPATH')) {
|
4 |
-
http_response_code(404);
|
5 |
-
die();
|
6 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
views/legend.php
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
<div class="kksr-legend">
|
2 |
-
<?php if ($count) : ?>
|
3 |
-
<strong class="kksr-score"><?= esc_html($score) ?></strong>
|
4 |
-
<span class="kksr-muted">/</span>
|
5 |
-
<strong><?= esc_html($best) ?></strong>
|
6 |
-
<span class="kksr-muted">(</span>
|
7 |
-
<strong class="kksr-count"><?= esc_html($count) ?></strong>
|
8 |
-
<span class="kksr-muted">
|
9 |
-
<?= _n('vote', 'votes', esc_html($count), 'kk-star-ratings') ?>
|
10 |
-
</span>
|
11 |
-
<span class="kksr-muted">)</span>
|
12 |
-
<?php else : ?>
|
13 |
-
<span class="kksr-muted"><?= esc_html($greet) ?></span>
|
14 |
-
<?php endif; ?>
|
15 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/markup.php
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
<div style="display: none;"
|
2 |
-
class="kk-star-ratings <?= $valign ? ('kksr-valign-'. esc_attr($valign)) : '' ?> <?= $align ? ('kksr-align-'. esc_attr($align)) : '' ?> <?= $disabled ? 'kksr-disabled' : '' ?>"
|
3 |
-
data-id="<?= esc_attr($id) ?>"
|
4 |
-
data-slug="<?= esc_attr($slug) ?>">
|
5 |
-
<?= \Bhittani\StarRating\view('stars') ?>
|
6 |
-
<?= \Bhittani\StarRating\view('legend') ?>
|
7 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/metabox/content.php
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (! defined('ABSPATH')) {
|
3 |
-
http_response_code(404);
|
4 |
-
die();
|
5 |
-
}
|
6 |
-
?>
|
7 |
-
|
8 |
-
<div class='components-base-control__field'>
|
9 |
-
<div style="margin-top: 1rem;">
|
10 |
-
<label class="components-base-control__label" style="margin-top: .75rem; margin-bottom: .25rem;">
|
11 |
-
<input type="checkbox" name="<?= esc_attr($resetFieldName) ?>" value="1">
|
12 |
-
<?php _e('Reset Ratings', 'kk-star-ratings'); ?>
|
13 |
-
</label>
|
14 |
-
</div>
|
15 |
-
</div>
|
16 |
-
|
17 |
-
<div class='components-base-control__field'>
|
18 |
-
<label class="components-base-control__label" style="margin-top: .75rem; margin-bottom: .25rem;">
|
19 |
-
<strong><?php _e('Status', 'kk-star-ratings'); ?></strong>
|
20 |
-
</label>
|
21 |
-
|
22 |
-
<div style="margin-top: 1rem;">
|
23 |
-
<label class="components-base-control__label" style="margin-top: .5rem; margin-bottom: .25rem;">
|
24 |
-
<input type="radio" name="<?= esc_attr($statusFieldName) ?>" value="" <?php checked($status, ''); ?>>
|
25 |
-
<?php _e('Auto', 'kk-star-ratings'); ?>
|
26 |
-
</label>
|
27 |
-
<label class="components-base-control__label" style="margin-top: .5rem; margin-bottom: .25rem;">
|
28 |
-
<input type="radio" name="<?= esc_attr($statusFieldName) ?>" value="enable" <?php checked($status, 'enable'); ?>>
|
29 |
-
<?php _e('Enable', 'kk-star-ratings'); ?>
|
30 |
-
</label>
|
31 |
-
<label class="components-base-control__label" style="margin-top: .5rem; margin-bottom: .25rem;">
|
32 |
-
<input type="radio" name="<?= esc_attr($statusFieldName) ?>" value="disable" <?php checked($status, 'disable'); ?>>
|
33 |
-
<?php _e('Disable', 'kk-star-ratings'); ?>
|
34 |
-
</label>
|
35 |
-
</div>
|
36 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/metabox/index.php
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (! defined('ABSPATH')) {
|
3 |
-
http_response_code(404);
|
4 |
-
die();
|
5 |
-
}
|
6 |
-
?>
|
7 |
-
|
8 |
-
<div class="components-base-control">
|
9 |
-
<?= $content ?>
|
10 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/star.php
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<div class="kksr-icon" style="width: <?= esc_attr($size) ?>px; height: <?= esc_attr($size) ?>px;"></div>
|
|
views/stars.php
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
<div class="kksr-stars">
|
2 |
-
<?= \Bhittani\StarRating\view('inactive-stars') ?>
|
3 |
-
<?= \Bhittani\StarRating\view('active-stars') ?>
|
4 |
-
</div>
|
|
|
|
|
|
|
|