Yasr – Yet Another Stars Rating - Version 1.6.7

Version Description

  • Css fix for gutenberg compatibility
Download this release

Release Info

Developer Dudo
Plugin Icon 128x128 Yasr – Yet Another Stars Rating
Version 1.6.7
Comparing to
See all releases

Code changes from version 1.6.6 to 1.6.7

css/yasr-admin.css CHANGED
@@ -264,9 +264,18 @@ div.bigstars .rateit-selected
264
transition: margin 0.3s ease-in 0s;
265
}
266
.yasr-onoffswitch-inner:before, .yasr-onoffswitch-inner:after {
267
- display: block; float: left; width: 50%; height: 30px; padding: 0; line-height: 30px;
268
- font-size: 18px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
269
- box-sizing: border-box;
270
}
271
.yasr-onoffswitch-inner:before {
272
content: "YES";
@@ -280,12 +289,14 @@ div.bigstars .rateit-selected
280
text-align: right;
281
}
282
.yasr-onoffswitch-switch {
283
- display: block; width: 30px; margin: 0px;
284
background: #A1A1A1;
285
position: absolute; top: 0; bottom: 0;
286
right: 51px;
287
border: 2px solid #FFFFFF; border-radius: 35px;
288
- transition: all 0.3s ease-in 0s;
289
}
290
291
.yasr-onoffswitch-checkbox:checked + .yasr-onoffswitch-label .yasr-onoffswitch-inner {
264
transition: margin 0.3s ease-in 0s;
265
}
266
.yasr-onoffswitch-inner:before, .yasr-onoffswitch-inner:after {
267
+ display: block;
268
+ float: left;
269
+ width: 50%;
270
+ height: 30px;
271
+ padding: 0;
272
+ line-height: 30px;
273
+ font-size: 18px;
274
+ color: white;
275
+ font-family: Trebuchet, Arial, sans-serif;
276
+ font-weight: bold;
277
+ box-sizing: border-box !important; /*important for Gutenberg compatibility*/
278
+
279
}
280
.yasr-onoffswitch-inner:before {
281
content: "YES";
289
text-align: right;
290
}
291
.yasr-onoffswitch-switch {
292
+ display: block;
293
+ width: 30px;
294
+ margin: 0px;
295
background: #A1A1A1;
296
position: absolute; top: 0; bottom: 0;
297
right: 51px;
298
border: 2px solid #FFFFFF; border-radius: 35px;
299
+ transition: all 0.1s ease-in 0s;
300
}
301
302
.yasr-onoffswitch-checkbox:checked + .yasr-onoffswitch-label .yasr-onoffswitch-inner {
freemius/assets/css/admin/common.css CHANGED
@@ -1,2 +1,2 @@
1
.theme-browser .theme .fs-premium-theme-badge{position:absolute;top:10px;right:0;background:#71ae00;color:#fff;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);font-size:1.1em}#iframe{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: 500px){#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}.wrap.fs-section h2{text-align:left}
1
.theme-browser .theme .fs-premium-theme-badge{position:absolute;top:10px;right:0;background:#71ae00;color:#fff;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);font-size:1.1em}#iframe{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: 500px){#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}.wrap.fs-section h2{text-align:left}
freemius/assets/scss/admin/common.scss CHANGED
@@ -207,7 +207,7 @@ span.fs-submenu-item.fs-sub:before
207
margin-right: 5px;
208
vertical-align: sub;
209
display: inline-block;
210
- background: url('../../../../../../../wp-admin/images/wpspin_light-2x.gif');
211
background-size: contain;
212
}
213
207
margin-right: 5px;
208
vertical-align: sub;
209
display: inline-block;
210
+ background: url('/wp-admin/images/wpspin_light-2x.gif');
211
background-size: contain;
212
}
213
freemius/includes/class-freemius.php CHANGED
@@ -1348,7 +1348,10 @@
1348
add_action( 'make_ham_blog', array( &$this, '_after_site_reactivated_callback' ) );
1349
}
1350
1351
- if ( $this->is_theme() && self::is_customizer() ) {
1352
// Register customizer upsell.
1353
add_action( 'customize_register', array( &$this, '_customizer_register' ) );
1354
}
@@ -1488,13 +1491,6 @@
1488
array( &$this, '_submit_uninstall_reason_action' )
1489
);
1490
1491
- if ( $this->is_theme() && $this->is_premium() && ! $this->has_active_valid_license() ) {
1492
- $this->add_ajax_action(
1493
- 'delete_theme_update_data',
1494
- array( &$this, '_delete_theme_update_data_action' )
1495
- );
1496
- }
1497
-
1498
if ( ! $this->is_addon() || $this->is_parent_plugin_installed() ) {
1499
if ( ( $this->is_plugin() && self::is_plugins_page() ) ||
1500
( $this->is_theme() && self::is_themes_page() )
@@ -2634,26 +2630,28 @@
2634
self::$_accounts = FS_Options::instance( WP_FS__ACCOUNTS_OPTION_NAME, true );
2635
2636
if ( is_multisite() ) {
2637
/**
2638
- * If the id_slug_type_path_map exists on the site level but doesn't exist on the
2639
* network level storage, it means that we need to process the storage with migration.
2640
*
2641
- * The code in this `if` scope will only be executed once and only for the first site that will execute it because once we migrate the storage data, id_slug_type_path_map will be already set in the network level storage.
2642
*
2643
* @author Vova Feldman (@svovaf)
2644
* @since 2.0.0
2645
*/
2646
- if ( null === self::$_accounts->get_option( 'id_slug_type_path_map', null, true ) &&
2647
- null !== self::$_accounts->get_option( 'id_slug_type_path_map', null, false )
2648
) {
2649
- self::migrate_accounts_to_network();
2650
-
2651
- // Migrate API options from site level to network level.
2652
- $api_network_options = FS_Option_Manager::get_manager( WP_FS__OPTIONS_OPTION_NAME, true, true );
2653
- $api_network_options->migrate_to_network();
2654
-
2655
- // Migrate API cache to network level storage.
2656
- FS_Cache_Manager::get_manager( WP_FS__API_CACHE_OPTION_NAME )->migrate_to_network();
2657
}
2658
}
2659
@@ -2683,6 +2681,24 @@
2683
self::$_statics_loaded = true;
2684
}
2685
2686
#----------------------------------------------------------------------------------
2687
#region Localization
2688
#----------------------------------------------------------------------------------
@@ -2909,6 +2925,10 @@
2909
}
2910
2911
fs_redirect( $download_url );
2912
}
2913
}
2914
@@ -3961,6 +3981,13 @@
3961
3962
$this->parse_settings( $plugin_info );
3963
3964
if ( ! self::is_ajax() ) {
3965
if ( ! $this->is_addon() || $this->is_only_premium() ) {
3966
add_action(
@@ -5984,7 +6011,7 @@
5984
* @param int $except_blog_id Since 2.0.0 when running in a multisite network environment, the cron execution is consolidated. This param allows excluding excluded specified blog ID from being the cron executor.
5985
*/
5986
private function schedule_install_sync( $except_blog_id = 0 ) {
5987
- $this->schedule_cron( 'install_sync', 'install_sync', 'single', 0, false, $except_blog_id );
5988
}
5989
5990
/**
@@ -6192,19 +6219,21 @@
6192
}
6193
6194
if ( $this->is_plugin_new_install() || $this->is_only_premium() ) {
6195
- // Show notice for new plugin installations.
6196
- $this->_admin_notices->add(
6197
- sprintf(
6198
- $this->get_text_inline( 'You are just one step away - %s', 'you-are-step-away' ),
6199
- sprintf( '<b><a href="%s">%s</a></b>',
6200
- $this->get_activation_url( array(), ! $this->is_delegated_connection() ),
6201
- sprintf( $this->get_text_x_inline( 'Complete "%s" Activation Now',
6202
- '%s - plugin name. As complete "PluginX" activation now', 'activate-x-now' ), $this->get_plugin_name() )
6203
- )
6204
- ),
6205
- '',
6206
- 'update-nag'
6207
- );
6208
} else {
6209
if ( $this->should_add_sticky_optin_notice() ) {
6210
$this->add_sticky_optin_admin_notice();
@@ -10569,7 +10598,7 @@
10569
return;
10570
}
10571
10572
- if ( ! $this->is_premium() || $this->has_active_valid_license() ) {
10573
// This is relevant only to the free versions and premium versions without an active license.
10574
return;
10575
}
@@ -14756,13 +14785,15 @@
14756
private function add_submenu_items() {
14757
$this->_logger->entrance();
14758
14759
if ( $this->is_addon() ) {
14760
// No submenu items for add-ons.
14761
$add_submenu_items = false;
14762
} else if ( $this->is_free_wp_org_theme() && ! fs_is_network_admin() ) {
14763
// Also add submenu items when running in a free .org theme so the tabs will be visible.
14764
$add_submenu_items = true;
14765
- } else if ( $this->is_activation_mode() && ! $this->is_free_wp_org_theme() ) {
14766
$add_submenu_items = false;
14767
} else if ( fs_is_network_admin() ) {
14768
/**
@@ -14793,7 +14824,15 @@
14793
$this->is_submenu_item_visible( 'affiliation' )
14794
);
14795
}
14796
14797
if ( ! WP_FS__DEMO_MODE && $this->is_registered() ) {
14798
$show_account = (
14799
$this->is_submenu_item_visible( 'account' ) &&
@@ -14812,10 +14851,12 @@
14812
'account',
14813
array( &$this, '_account_page_load' ),
14814
WP_FS__DEFAULT_PRIORITY,
14815
- $show_account
14816
);
14817
}
14818
14819
// Add contact page.
14820
$this->add_submenu_item(
14821
$this->get_text_inline( 'Contact Us', 'contact-us' ),
@@ -14840,7 +14881,11 @@
14840
$this->is_submenu_item_visible( 'addons' )
14841
);
14842
}
14843
14844
if ( ! WP_FS__DEMO_MODE ) {
14845
$show_pricing = (
14846
$this->is_submenu_item_visible( 'pricing' ) &&
@@ -14862,14 +14907,14 @@
14862
14863
// Add upgrade/pricing page.
14864
$this->add_submenu_item(
14865
- $pricing_cta_text . '&nbsp;&nbsp;' . ( is_rtl() ? '&#x2190;' : '&#x27a4;' ),
14866
array( &$this, '_pricing_page_render' ),
14867
$this->get_plugin_name() . ' &ndash; ' . $this->get_text_x_inline( 'Pricing', 'noun', 'pricing' ),
14868
'manage_options',
14869
'pricing',
14870
'Freemius::_clean_admin_content_section',
14871
WP_FS__LOWEST_PRIORITY,
14872
- $show_pricing,
14873
$pricing_class
14874
);
14875
}
@@ -15569,7 +15614,8 @@
15569
return;
15570
}
15571
15572
- $encrypted_site = clone ( is_object( $site ) ? $site : $this->_site );
15573
15574
$sites = self::get_all_sites( $this->_module_type, $network_level_or_blog_id );
15575
@@ -15937,7 +15983,7 @@
15937
/**
15938
* @since 1.2.3 When running in DEV mode, retrieve pending plans as well.
15939
*/
15940
- $result = $api->get( "/plugins/{$this->_module_id}/plans.json?show_pending=" . ( $this->has_secret_key() ? 'true' : 'false' ), true );
15941
15942
if ( $this->is_api_result_object( $result, 'plans' ) && is_array( $result->plans ) ) {
15943
for ( $i = 0, $len = count( $result->plans ); $i < $len; $i ++ ) {
@@ -16267,14 +16313,62 @@
16267
* @since 1.2.1
16268
*/
16269
function has_active_valid_license() {
16270
return (
16271
- is_object( $this->_license ) &&
16272
- is_numeric( $this->_license->id ) &&
16273
- $this->_license->is_active() &&
16274
- $this->_license->is_valid()
16275
);
16276
}
16277
16278
/**
16279
* Check if site assigned with license with enabled features.
16280
*
@@ -16405,7 +16499,7 @@
16405
$this->_update_licenses( $licenses, $addon->id );
16406
16407
if ( ! $this->is_addon_installed( $addon->id ) && FS_License_Manager::has_premium_license( $licenses ) ) {
16408
- $plans_result = $this->get_api_site_or_plugin_scope()->get( "/addons/{$addon_id}/plans.json" );
16409
16410
if ( ! isset( $plans_result->error ) ) {
16411
$plans = array();
@@ -16733,6 +16827,7 @@
16733
'trial_promotion',
16734
'trial_expired',
16735
'activation_complete',
16736
) );
16737
break;
16738
case 'changed':
@@ -17267,7 +17362,7 @@
17267
* @return bool
17268
*/
17269
private function _can_download_premium() {
17270
- return $this->has_active_valid_license() ||
17271
( $this->is_trial() && ! $this->get_trial_plan()->is_free() );
17272
}
17273
@@ -17570,19 +17665,21 @@
17570
17571
$api = $this->get_api_site_or_plugin_scope();
17572
17573
/**
17574
* @since 1.2.1
17575
*
17576
* If there's a cached version of the add-ons and not asking
17577
* for a flush, just use the currently stored add-ons.
17578
*/
17579
- if ( ! $flush && $api->is_cached( '/addons.json?enriched=true' ) ) {
17580
$addons = self::get_all_addons();
17581
17582
return $addons[ $this->_plugin->id ];
17583
}
17584
17585
- $result = $api->get( '/addons.json?enriched=true', $flush );
17586
17587
$addons = array();
17588
if ( $this->is_api_result_object( $result, 'plugins' ) &&
@@ -18398,9 +18495,9 @@
18398
$vars = array( 'id' => $this->_module_id );
18399
18400
if ( 'true' === fs_request_get( 'checkout', false ) ) {
18401
- fs_require_once_template( 'checkout.php', $vars );
18402
} else {
18403
- fs_require_once_template( 'pricing.php', $vars );
18404
}
18405
}
18406
@@ -18418,7 +18515,15 @@
18418
$this->_logger->entrance();
18419
18420
$vars = array( 'id' => $this->_module_id );
18421
- fs_require_once_template( 'contact.php', $vars );
18422
}
18423
18424
#endregion ------------------------------------------------------------------------
@@ -18515,7 +18620,9 @@
18515
* @return FS_Api
18516
*/
18517
private function get_current_or_network_user_api_scope( $flush = false ) {
18518
- if ( ! $this->_is_network_active || isset( $this->_user ) ) {
18519
return $this->get_api_user_scope( $flush );
18520
}
18521
@@ -18603,9 +18710,19 @@
18603
* @author Vova Feldman (@svovaf)
18604
* @since 1.0.9
18605
*
18606
- * @param $plans
18607
*/
18608
function _check_for_trial_plans( $plans ) {
18609
$this->_storage->has_trial_plan = FS_Plan_Manager::instance()->has_trial_plan( $plans );
18610
}
18611
@@ -18712,14 +18829,14 @@
18712
18713
// Show promotion if never shown before and 24 hours after initial activation with FS.
18714
if ( ! $was_promotion_shown_before &&
18715
- $this->_storage->install_timestamp > ( time() - WP_FS__TIME_24_HOURS_IN_SEC )
18716
) {
18717
return false;
18718
}
18719
18720
// OR if promotion was shown before, try showing it every 30 days.
18721
if ( $was_promotion_shown_before &&
18722
- 30 * WP_FS__TIME_24_HOURS_IN_SEC > time() - $last_time_trial_promotion_shown
18723
) {
18724
return false;
18725
}
@@ -19344,14 +19461,16 @@
19344
* @param array $request
19345
* @param int $success_cache_expiration
19346
* @param int $failure_cache_expiration
19347
*
19348
* @return WP_Error|array
19349
*/
19350
- private static function safe_remote_post(
19351
&$url,
19352
$request,
19353
$success_cache_expiration = 0,
19354
- $failure_cache_expiration = 0
19355
) {
19356
$should_cache = ($success_cache_expiration + $failure_cache_expiration > 0);
19357
@@ -19362,7 +19481,9 @@
19362
false;
19363
19364
if ( false === $response ) {
19365
- self::enrich_request_for_debug( $url, $request );
19366
19367
$response = wp_remote_post( $url, $request );
19368
@@ -20117,6 +20238,10 @@
20117
$icon_found = false;
20118
$local_path = fs_normalize_path( "{$img_dir}/{$this->_slug}.png" );
20119
20120
$have_write_permissions = ( 'direct' === get_filesystem_method( array(), fs_normalize_path( $img_dir ) ) );
20121
20122
/**
@@ -20633,9 +20758,7 @@
20633
* @since 2.1.0
20634
*/
20635
function _maybe_add_gdpr_optin_ajax_handler() {
20636
- if ( $this->is_activation_mode() ) {
20637
- $this->add_ajax_action( 'fetch_is_marketing_required_flag_value', array( &$this, '_fetch_is_marketing_required_flag_value_ajax_action' ) );
20638
- }
20639
20640
if ( FS_GDPR_Manager::instance()->is_opt_in_notice_shown() ) {
20641
$this->add_gdpr_optin_ajax_handler_and_style();
@@ -20819,4 +20942,28 @@
20819
}
20820
20821
#endregion
20822
}
1348
add_action( 'make_ham_blog', array( &$this, '_after_site_reactivated_callback' ) );
1349
}
1350
1351
+ if ( $this->is_theme() &&
1352
+ self::is_customizer() &&
1353
+ $this->apply_filters( 'show_customizer_upsell', true )
1354
+ ) {
1355
// Register customizer upsell.
1356
add_action( 'customize_register', array( &$this, '_customizer_register' ) );
1357
}
1491
array( &$this, '_submit_uninstall_reason_action' )
1492
);
1493
1494
if ( ! $this->is_addon() || $this->is_parent_plugin_installed() ) {
1495
if ( ( $this->is_plugin() && self::is_plugins_page() ) ||
1496
( $this->is_theme() && self::is_themes_page() )
2630
self::$_accounts = FS_Options::instance( WP_FS__ACCOUNTS_OPTION_NAME, true );
2631
2632
if ( is_multisite() ) {
2633
+ $has_skipped_migration = (
2634
+ // 'id_slug_type_path_map' - was never stored on older versions, therefore, not exists on the site level.
2635
+ null === self::$_accounts->get_option( 'id_slug_type_path_map', null, false ) &&
2636
+ // 'file_slug_map' stored on the site level, so it was running an SDK version before it was integrated with MS-network.
2637
+ null !== self::$_accounts->get_option( 'file_slug_map', null, false )
2638
+ );
2639
+
2640
/**
2641
+ * If the file_slug_map exists on the site level but doesn't exist on the
2642
* network level storage, it means that we need to process the storage with migration.
2643
*
2644
+ * The code in this `if` scope will only be executed once and only for the first site that will execute it because once we migrate the storage data, file_slug_map will be already set in the network level storage.
2645
*
2646
* @author Vova Feldman (@svovaf)
2647
* @since 2.0.0
2648
*/
2649
+ if (
2650
+ ( $has_skipped_migration && true !== self::$_accounts->get_option( 'ms_migration_complete', false, true ) ) ||
2651
+ ( null === self::$_accounts->get_option( 'file_slug_map', null, true ) &&
2652
+ null !== self::$_accounts->get_option( 'file_slug_map', null, false ) )
2653
) {
2654
+ self::migrate_options_to_network();
2655
}
2656
}
2657
2681
self::$_statics_loaded = true;
2682
}
2683
2684
+ /**
2685
+ * @author Leo Fajardo (@leorw)
2686
+ *
2687
+ * @since 2.1.3
2688
+ */
2689
+ private static function migrate_options_to_network() {
2690
+ self::migrate_accounts_to_network();
2691
+
2692
+ // Migrate API options from site level to network level.
2693
+ $api_network_options = FS_Option_Manager::get_manager( WP_FS__OPTIONS_OPTION_NAME, true, true );
2694
+ $api_network_options->migrate_to_network();
2695
+
2696
+ // Migrate API cache to network level storage.
2697
+ FS_Cache_Manager::get_manager( WP_FS__API_CACHE_OPTION_NAME )->migrate_to_network();
2698
+
2699
+ self::$_accounts->set_option( 'ms_migration_complete', true, true );
2700
+ }
2701
+
2702
#----------------------------------------------------------------------------------
2703
#region Localization
2704
#----------------------------------------------------------------------------------
2925
}
2926
2927
fs_redirect( $download_url );
2928
+ } else if ( fs_request_is_action( 'migrate_options_to_network' ) ) {
2929
+ check_admin_referer( 'migrate_options_to_network' );
2930
+
2931
+ self::migrate_options_to_network();
2932
}
2933
}
2934
3981
3982
$this->parse_settings( $plugin_info );
3983
3984
+ if ( is_admin() && $this->is_theme() && $this->is_premium() && ! $this->has_active_valid_license() ) {
3985
+ $this->add_ajax_action(
3986
+ 'delete_theme_update_data',
3987
+ array( &$this, '_delete_theme_update_data_action' )
3988
+ );
3989
+ }
3990
+
3991
if ( ! self::is_ajax() ) {
3992
if ( ! $this->is_addon() || $this->is_only_premium() ) {
3993
add_action(
6011
* @param int $except_blog_id Since 2.0.0 when running in a multisite network environment, the cron execution is consolidated. This param allows excluding excluded specified blog ID from being the cron executor.
6012
*/
6013
private function schedule_install_sync( $except_blog_id = 0 ) {
6014
+ $this->schedule_cron( 'install_sync', 'install_sync', 'single', WP_FS__SCRIPT_START_TIME, false, $except_blog_id );
6015
}
6016
6017
/**
6219
}
6220
6221
if ( $this->is_plugin_new_install() || $this->is_only_premium() ) {
6222
+ if ( ! $this->_anonymous_mode ) {
6223
+ // Show notice for new plugin installations.
6224
+ $this->_admin_notices->add(
6225
+ sprintf(
6226
+ $this->get_text_inline( 'You are just one step away - %s', 'you-are-step-away' ),
6227
+ sprintf( '<b><a href="%s">%s</a></b>',
6228
+ $this->get_activation_url( array(), ! $this->is_delegated_connection() ),
6229
+ sprintf( $this->get_text_x_inline( 'Complete "%s" Activation Now',
6230
+ '%s - plugin name. As complete "PluginX" activation now', 'activate-x-now' ), $this->get_plugin_name() )
6231
+ )
6232
+ ),
6233
+ '',
6234
+ 'update-nag'
6235
+ );
6236
+ }
6237
} else {
6238
if ( $this->should_add_sticky_optin_notice() ) {
6239
$this->add_sticky_optin_admin_notice();
10598
return;
10599
}
10600
10601
+ if ( ! $this->is_premium() || $this->has_any_active_valid_license() ) {
10602
// This is relevant only to the free versions and premium versions without an active license.
10603
return;
10604
}
14785
private function add_submenu_items() {
14786
$this->_logger->entrance();
14787
14788
+ $is_activation_mode = $this->is_activation_mode();
14789
+
14790
if ( $this->is_addon() ) {
14791
// No submenu items for add-ons.
14792
$add_submenu_items = false;
14793
} else if ( $this->is_free_wp_org_theme() && ! fs_is_network_admin() ) {
14794
// Also add submenu items when running in a free .org theme so the tabs will be visible.
14795
$add_submenu_items = true;
14796
+ } else if ( $is_activation_mode && ! $this->is_free_wp_org_theme() ) {
14797
$add_submenu_items = false;
14798
} else if ( fs_is_network_admin() ) {
14799
/**
14824
$this->is_submenu_item_visible( 'affiliation' )
14825
);
14826
}
14827
+ }
14828
14829
+ if ( $add_submenu_items ||
14830
+ ( $is_activation_mode &&
14831
+ $this->is_only_premium() &&
14832
+ $this->is_admin_page( 'account' ) &&
14833
+ fs_request_is_action( $this->get_unique_affix() . '_sync_license' )
14834
+ )
14835
+ ) {
14836
if ( ! WP_FS__DEMO_MODE && $this->is_registered() ) {
14837
$show_account = (
14838
$this->is_submenu_item_visible( 'account' ) &&
14851
'account',
14852
array( &$this, '_account_page_load' ),
14853
WP_FS__DEFAULT_PRIORITY,
14854
+ ( $add_submenu_items && $show_account )
14855
);
14856
}
14857
+ }
14858
14859
+ if ( $add_submenu_items ) {
14860
// Add contact page.
14861
$this->add_submenu_item(
14862
$this->get_text_inline( 'Contact Us', 'contact-us' ),
14881
$this->is_submenu_item_visible( 'addons' )
14882
);
14883
}
14884
+ }
14885
14886
+ if ( $add_submenu_items ||
14887
+ ( $is_activation_mode && $this->is_only_premium() && $this->is_admin_page( 'pricing' ) )
14888
+ ) {
14889
if ( ! WP_FS__DEMO_MODE ) {
14890
$show_pricing = (
14891
$this->is_submenu_item_visible( 'pricing' ) &&
14907
14908
// Add upgrade/pricing page.
14909
$this->add_submenu_item(
14910
+ $pricing_cta_text . '&nbsp;&nbsp;' . ( is_rtl() ? $this->get_text_x_inline( '&#x2190;', 'ASCII arrow left icon', 'symbol_arrow-left' ) : $this->get_text_x_inline( '&#x27a4;', 'ASCII arrow right icon', 'symbol_arrow-right' ) ),
14911
array( &$this, '_pricing_page_render' ),
14912
$this->get_plugin_name() . ' &ndash; ' . $this->get_text_x_inline( 'Pricing', 'noun', 'pricing' ),
14913
'manage_options',
14914
'pricing',
14915
'Freemius::_clean_admin_content_section',
14916
WP_FS__LOWEST_PRIORITY,
14917
+ ( $add_submenu_items && $show_pricing ),
14918
$pricing_class
14919
);
14920
}
15614
return;
15615
}
15616
15617
+ $site_clone = is_object( $site ) ? $site : $this->_site;
15618
+ $encrypted_site = clone $site_clone;
15619
15620
$sites = self::get_all_sites( $this->_module_type, $network_level_or_blog_id );
15621
15983
/**
15984
* @since 1.2.3 When running in DEV mode, retrieve pending plans as well.
15985
*/
15986
+ $result = $api->get( $this->add_show_pending( "/plugins/{$this->_module_id}/plans.json" ), true );
15987
15988
if ( $this->is_api_result_object( $result, 'plans' ) && is_array( $result->plans ) ) {
15989
for ( $i = 0, $len = count( $result->plans ); $i < $len; $i ++ ) {
16313
* @since 1.2.1
16314
*/
16315
function has_active_valid_license() {
16316
+ return self::is_active_valid_license( $this->_license );
16317
+ }
16318
+
16319
+ /**
16320
+ * Check if a given license is active & valid (not expired).
16321
+ *
16322
+ * @author Vova Feldman (@svovaf)
16323
+ * @since 2.1.3
16324
+ *
16325
+ * @param FS_Plugin_License $license
16326
+ *
16327
+ * @return bool
16328
+ */
16329
+ private static function is_active_valid_license( $license ) {
16330
return (
16331
+ is_object( $license ) &&
16332
+ FS_Plugin_License::is_valid_id( $license->id ) &&
16333
+ $license->is_active() &&
16334
+ $license->is_valid()
16335
);
16336
}
16337
16338
+ /**
16339
+ * Checks if there's any site that is associated with an active & valid license.
16340
+ * This logic is used to determine if the admin can download the premium code base from a network level admin.
16341
+ *
16342
+ * @author Vova Feldman (@svovaf)
16343
+ * @since 2.1.3
16344
+ *
16345
+ * @return bool
16346
+ */
16347
+ function has_any_active_valid_license() {
16348
+ if ( ! fs_is_network_admin() ) {
16349
+ return $this->has_active_valid_license();
16350
+ }
16351
+
16352
+ $installs = $this->get_blog_install_map();
16353
+ $all_plugin_licenses = self::get_all_licenses( $this->_module_id );
16354
+
16355
+ foreach ( $installs as $blog_id => $install ) {
16356
+ if ( ! FS_Plugin_License::is_valid_id( $install->license_id ) ) {
16357
+ continue;
16358
+ }
16359
+
16360
+ foreach ( $all_plugin_licenses as $license ) {
16361
+ if ( $license->id == $install->license_id ) {
16362
+ if ( self::is_active_valid_license( $license ) ) {
16363
+ return true;
16364
+ }
16365
+ }
16366
+ }
16367
+ }
16368
+
16369
+ return false;
16370
+ }
16371
+
16372
/**
16373
* Check if site assigned with license with enabled features.
16374
*
16499
$this->_update_licenses( $licenses, $addon->id );
16500
16501
if ( ! $this->is_addon_installed( $addon->id ) && FS_License_Manager::has_premium_license( $licenses ) ) {
16502
+ $plans_result = $this->get_api_site_or_plugin_scope()->get( $this->add_show_pending( "/addons/{$addon_id}/plans.json" ) );
16503
16504
if ( ! isset( $plans_result->error ) ) {
16505
$plans = array();
16827
'trial_promotion',
16828
'trial_expired',
16829
'activation_complete',
16830
+ 'license_expired',
16831
) );
16832
break;
16833
case 'changed':
17362
* @return bool
17363
*/
17364
private function _can_download_premium() {
17365
+ return $this->has_any_active_valid_license() ||
17366
( $this->is_trial() && ! $this->get_trial_plan()->is_free() );
17367
}
17368
17665
17666
$api = $this->get_api_site_or_plugin_scope();
17667
17668
+ $path = $this->add_show_pending( '/addons.json?enriched=true' );
17669
+
17670
/**
17671
* @since 1.2.1
17672
*
17673
* If there's a cached version of the add-ons and not asking
17674
* for a flush, just use the currently stored add-ons.
17675
*/
17676
+ if ( ! $flush && $api->is_cached( $path ) ) {
17677
$addons = self::get_all_addons();
17678
17679
return $addons[ $this->_plugin->id ];
17680
}
17681
17682
+ $result = $api->get( $path, $flush );
17683
17684
$addons = array();
17685
if ( $this->is_api_result_object( $result, 'plugins' ) &&
18495
$vars = array( 'id' => $this->_module_id );
18496
18497
if ( 'true' === fs_request_get( 'checkout', false ) ) {
18498
+ echo $this->apply_filters( 'templates/checkout.php', fs_get_template( 'checkout.php', $vars ) );
18499
} else {
18500
+ echo $this->apply_filters( 'templates/pricing.php', fs_get_template( 'pricing.php', $vars ) );
18501
}
18502
}
18503
18515
$this->_logger->entrance();
18516
18517
$vars = array( 'id' => $this->_module_id );
18518
+
18519
+ /**
18520
+ * Added filter to the template to allow developers wrapping the template
18521
+ * in custom HTML (e.g. within a wizard/tabs).
18522
+ *
18523
+ * @author Vova Feldman (@svovaf)
18524
+ * @since 2.1.3
18525
+ */
18526
+ echo $this->apply_filters( 'templates/contact.php', fs_get_template( 'contact.php', $vars ) );
18527
}
18528
18529
#endregion ------------------------------------------------------------------------
18620
* @return FS_Api
18621
*/
18622
private function get_current_or_network_user_api_scope( $flush = false ) {
18623
+ if ( ! $this->_is_network_active ||
18624
+ ( isset( $this->_user ) && $this->_user instanceof FS_User )
18625
+ ) {
18626
return $this->get_api_user_scope( $flush );
18627
}
18628
18710
* @author Vova Feldman (@svovaf)
18711
* @since 1.0.9
18712
*
18713
+ * @param FS_Plugin_Plan[] $plans
18714
*/
18715
function _check_for_trial_plans( $plans ) {
18716
+ /**
18717
+ * For some reason core's do_action() flattens arrays when it has a single object item. Therefore, we need to restructure the array as expected.
18718
+ *
18719
+ * @author Vova Feldman (@svovaf)
18720
+ * @since 2.1.2
18721
+ */
18722
+ if ( ! is_array( $plans ) && is_object( $plans ) ) {
18723
+ $plans = array( $plans );
18724
+ }
18725
+
18726
$this->_storage->has_trial_plan = FS_Plan_Manager::instance()->has_trial_plan( $plans );
18727
}
18728
18829
18830
// Show promotion if never shown before and 24 hours after initial activation with FS.
18831
if ( ! $was_promotion_shown_before &&
18832
+ $this->_storage->install_timestamp > ( time() - $this->apply_filters( 'show_first_trial_after_n_sec', WP_FS__TIME_24_HOURS_IN_SEC ) )
18833
) {
18834
return false;
18835
}
18836
18837
// OR if promotion was shown before, try showing it every 30 days.
18838
if ( $was_promotion_shown_before &&
18839
+ $this->apply_filters( 'reshow_trial_after_every_n_sec', 30 * WP_FS__TIME_24_HOURS_IN_SEC ) > time() - $last_time_trial_promotion_shown
18840
) {
18841
return false;
18842
}
19461
* @param array $request
19462
* @param int $success_cache_expiration
19463
* @param int $failure_cache_expiration
19464
+ * @param bool $maybe_enrich_request_for_debug
19465
*
19466
* @return WP_Error|array
19467
*/
19468
+ static function safe_remote_post(
19469
&$url,
19470
$request,
19471
$success_cache_expiration = 0,
19472
+ $failure_cache_expiration = 0,
19473
+ $maybe_enrich_request_for_debug = true
19474
) {
19475
$should_cache = ($success_cache_expiration + $failure_cache_expiration > 0);
19476
19481
false;
19482
19483
if ( false === $response ) {
19484
+ if ( $maybe_enrich_request_for_debug ) {
19485
+ self::enrich_request_for_debug( $url, $request );
19486
+ }
19487
19488
$response = wp_remote_post( $url, $request );
19489
20238
$icon_found = false;
20239
$local_path = fs_normalize_path( "{$img_dir}/{$this->_slug}.png" );
20240
20241
+ if ( ! function_exists( 'get_filesystem_method' ) ) {
20242
+ require_once ABSPATH . 'wp-admin/includes/file.php';
20243
+ }
20244
+
20245
$have_write_permissions = ( 'direct' === get_filesystem_method( array(), fs_normalize_path( $img_dir ) ) );
20246
20247
/**
20758
* @since 2.1.0
20759
*/
20760
function _maybe_add_gdpr_optin_ajax_handler() {
20761
+ $this->add_ajax_action( 'fetch_is_marketing_required_flag_value', array( &$this, '_fetch_is_marketing_required_flag_value_ajax_action' ) );
20762
20763
if ( FS_GDPR_Manager::instance()->is_opt_in_notice_shown() ) {
20764
$this->add_gdpr_optin_ajax_handler_and_style();
20942
}
20943
20944
#endregion
20945
+
20946
+ #----------------------------------------------------------------------------------
20947
+ #region Helper
20948
+ #----------------------------------------------------------------------------------
20949
+
20950
+ /**
20951
+ * If running with a secret key, assume it's the developer and show pending plans as well.
20952
+ *
20953
+ * @author Vova Feldman (@svovaf)
20954
+ * @since 2.1.2
20955
+ *
20956
+ * @param string $path
20957
+ *
20958
+ * @return string
20959
+ */
20960
+ function add_show_pending( $path ) {
20961
+ if ( ! $this->has_secret_key() ) {
20962
+ return $path;
20963
+ }
20964
+
20965
+ return $path . ( false !== strpos( $path, '?' ) ? '&' : '?' ) . 'show_pending=true';
20966
+ }
20967
+
20968
+ #endregion
20969
}
freemius/includes/class-fs-plugin-updater.php CHANGED
@@ -29,6 +29,11 @@
29
* @since 1.1.8.1
30
*/
31
private $_update_details;
32
33
#--------------------------------------------------------------------------------
34
#region Singleton
@@ -77,7 +82,7 @@
77
78
$this->add_transient_filters();
79
80
- if ( ! $this->_fs->has_active_valid_license() ) {
81
/**
82
* If user has the premium plugin's code but do NOT have an active license,
83
* encourage him to upgrade by showing that there's a new release, but instead
@@ -109,7 +114,7 @@
109
add_filter( 'upgrader_post_install', array( &$this, '_maybe_update_folder_name' ), 10, 3 );
110
}
111
112
- if ( ! $this->_fs->has_active_valid_license() ) {
113
add_filter( 'wp_prepare_themes_for_js', array( &$this, 'change_theme_update_info_html' ), 10, 1 );
114
}
115
}
@@ -324,6 +329,46 @@
324
(array) $this->_update_details;
325
}
326
327
return $transient_data;
328
}
329
@@ -508,6 +553,138 @@
508
return $res;
509
}
510
511
/**
512
* Updates information on the "View version x.x details" page with custom data.
513
*
29
* @since 1.1.8.1
30
*/
31
private $_update_details;
32
+ /**
33
+ * @var array
34
+ * @since 2.1.2
35
+ */
36
+ private $_translation_updates;
37
38
#--------------------------------------------------------------------------------
39
#region Singleton
82
83
$this->add_transient_filters();
84
85
+ if ( ! $this->_fs->has_any_active_valid_license() ) {
86
/**
87
* If user has the premium plugin's code but do NOT have an active license,
88
* encourage him to upgrade by showing that there's a new release, but instead
114
add_filter( 'upgrader_post_install', array( &$this, '_maybe_update_folder_name' ), 10, 3 );
115
}
116
117
+ if ( ! $this->_fs->has_any_active_valid_license() ) {
118
add_filter( 'wp_prepare_themes_for_js', array( &$this, 'change_theme_update_info_html' ), 10, 1 );
119
}
120
}
329
(array) $this->_update_details;
330
}
331
332
+ $slug = $this->_fs->get_slug();
333
+
334
+ if ( $this->_fs->is_org_repo_compliant() && $this->_fs->is_freemium() ) {
335
+ if ( ! isset( $this->_translation_updates ) ) {
336
+ $this->_translation_updates = array();
337
+
338
+ if ( current_user_can( 'update_languages' ) ) {
339
+ $translation_updates = $this->fetch_wp_org_module_translation_updates( $module_type, $slug );
340
+ if ( ! empty( $translation_updates ) ) {
341
+ $this->_translation_updates = $translation_updates;
342
+ }
343
+ }
344
+ }
345
+
346
+ if ( ! empty( $this->_translation_updates ) ) {
347
+ $all_translation_updates = ( isset( $transient_data->translations ) && is_array( $transient_data->translations ) ) ?
348
+ $transient_data->translations :
349
+ array();
350
+
351
+ $current_plugin_translation_updates_map = array();
352
+ foreach ( $all_translation_updates as $key => $translation_update ) {
353
+ if ( $module_type === ( $translation_update['type'] . 's' ) && $slug === $translation_update['slug'] ) {
354
+ $current_plugin_translation_updates_map[ $translation_update['language'] ] = $translation_update;
355
+ unset( $all_translation_updates[ $key ] );
356
+ }
357
+ }
358
+
359
+ foreach ( $this->_translation_updates as $translation_update ) {
360
+ $lang = $translation_update['language'];
361
+ if ( ! isset( $current_plugin_translation_updates_map[ $lang ] ) ||
362
+ version_compare( $translation_update['version'], $current_plugin_translation_updates_map[ $lang ]['version'], '>' )
363
+ ) {
364
+ $current_plugin_translation_updates_map[ $lang ] = $translation_update;
365
+ }
366
+ }
367
+
368
+ $transient_data->translations = array_merge( $all_translation_updates, array_values( $current_plugin_translation_updates_map ) );
369
+ }
370
+ }
371
+
372
return $transient_data;
373
}
374
553
return $res;
554
}
555
556
+ /**
557
+ * Fetches module translation updates from wordpress.org.
558
+ *
559
+ * @author Leo Fajardo (@leorw)
560
+ * @since 2.1.2
561
+ *
562
+ * @param string $module_type
563
+ * @param string $slug
564
+ *
565
+ * @return array|null
566
+ */
567
+ private function fetch_wp_org_module_translation_updates( $module_type, $slug ) {
568
+ $plugin_data = $this->_fs->get_plugin_data();
569
+
570
+ $locales = array_values( get_available_languages() );
571
+ $locales = apply_filters( "{$module_type}_update_check_locales", $locales );
572
+ $locales = array_unique( $locales );
573
+
574
+ $plugin_basename = $this->_fs->get_plugin_basename();
575
+ if ( 'themes' === $module_type ) {
576
+ $plugin_basename = str_replace( '-premium', '', $plugin_basename );
577
+ }
578
+
579
+ global $wp_version;
580
+
581
+ $request_args = array(
582
+ 'timeout' => 15,
583
+ 'body' => array(
584
+ "{$module_type}" => json_encode(
585
+ array(
586
+ "{$module_type}" => array(
587
+ $plugin_basename => array(
588
+ 'Name' => trim( str_replace( '(Premium)', '', $plugin_data['Name'] ) ),
589
+ 'Author' => $plugin_data['Author'],
590
+ )
591
+ )
592
+ )
593
+ ),
594
+ 'translations' => json_encode( $this->get_installed_translations( $module_type, $slug ) ),
595
+ 'locale' => json_encode( $locales )
596
+ ),
597
+ 'user-agent' => ( 'WordPress/' . $wp_version . '; ' . home_url( '/' ) )
598
+ );
599
+
600
+ $url = "http://api.wordpress.org/{$module_type}/update-check/1.1/";
601
+ if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) {
602
+ $url = set_url_scheme( $url, 'https' );
603
+ }
604
+
605
+ $raw_response = Freemius::safe_remote_post(
606
+ $url,
607
+ $request_args,
608
+ WP_FS__TIME_24_HOURS_IN_SEC,
609
+ WP_FS__TIME_12_HOURS_IN_SEC,
610
+ false
611
+ );
612
+
613
+ if ( is_wp_error( $raw_response ) ) {
614
+ return null;
615
+ }
616
+
617
+ $response = json_decode( wp_remote_retrieve_body( $raw_response ), true );
618
+
619
+ if ( ! is_array( $response ) ) {
620
+ return null;
621
+ }
622
+
623
+ if ( ! isset( $response['translations'] ) || empty( $response['translations'] ) ) {
624
+ return null;
625
+ }
626
+
627
+ return $response['translations'];
628
+ }
629
+
630
+ /**
631
+ * @author Leo Fajardo (@leorw)
632
+ * @since 2.1.2
633
+ *
634
+ * @param string $module_type
635
+ * @param string $slug
636
+ *
637
+ * @return array
638
+ */
639
+ private function get_installed_translations( $module_type, $slug ) {
640
+ if ( function_exists( 'wp_get_installed_translations' ) ) {
641
+ return wp_get_installed_translations( $module_type );
642
+ }
643
+
644
+ $dir = "/{$module_type}";
645
+
646
+ if ( ! is_dir( WP_LANG_DIR . $dir ) )
647
+ return array();
648
+
649
+ $files = scandir( WP_LANG_DIR . $dir );
650
+ if ( ! $files )
651
+ return array();
652
+
653
+ $language_data = array();
654
+
655
+ foreach ( $files as $file ) {
656
+ if ( 0 !== strpos( $file, $slug ) ) {
657
+ continue;
658
+ }
659
+
660
+ if ( '.' === $file[0] || is_dir( WP_LANG_DIR . "{$dir}/{$file}" ) ) {
661
+ continue;
662
+ }
663
+
664
+ if ( substr( $file, -3 ) !== '.po' ) {
665
+ continue;
666
+ }
667
+
668
+ if ( ! preg_match( '/(?:(.+)-)?([a-z]{2,3}(?:_[A-Z]{2})?(?:_[a-z0-9]+)?).po/', $file, $match ) ) {
669
+ continue;
670
+ }
671
+
672
+ if ( ! in_array( substr( $file, 0, -3 ) . '.mo', $files ) ) {
673
+ continue;
674
+ }
675
+
676
+ list( , $textdomain, $language ) = $match;
677
+
678
+ if ( '' === $textdomain ) {
679
+ $textdomain = 'default';
680
+ }
681
+
682
+ $language_data[ $textdomain ][ $language ] = wp_get_pomo_file_data( WP_LANG_DIR . "{$dir}/{$file}" );
683
+ }
684
+
685
+ return $language_data;
686
+ }
687
+
688
/**
689
* Updates information on the "View version x.x details" page with custom data.
690
*
freemius/includes/customizer/class-fs-customizer-upsell-control.php CHANGED
@@ -59,7 +59,7 @@
59
$this->fs->get_upgrade_url();
60
61
// Load features.
62
- $pricing = $this->fs->get_api_plugin_scope()->get( 'pricing.json' );
63
64
if ( $this->fs->is_api_result_object( $pricing, 'plans' ) ) {
65
// Add support features.
59
$this->fs->get_upgrade_url();
60
61
// Load features.
62
+ $pricing = $this->fs->get_api_plugin_scope()->get( $this->fs->add_show_pending( "pricing.json" ) );
63
64
if ( $this->fs->is_api_result_object( $pricing, 'plans' ) ) {
65
// Add support features.
freemius/includes/entities/class-fs-site.php CHANGED
@@ -150,6 +150,7 @@
150
fs_starts_with( $subdomain, 'local.' ) ||
151
fs_starts_with( $subdomain, 'dev.' ) ||
152
fs_starts_with( $subdomain, 'test.' ) ||
153
fs_starts_with( $subdomain, 'staging.' ) ||
154
155
// Ends with.
@@ -171,7 +172,9 @@
171
( fs_ends_with($subdomain, 'pantheonsite.io') &&
172
(fs_starts_with($subdomain, 'test-') || fs_starts_with($subdomain, 'dev-'))) ||
173
// Cloudways
174
- fs_ends_with( $subdomain, '.cloudwaysapps.com' )
175
);
176
}
177
150
fs_starts_with( $subdomain, 'local.' ) ||
151
fs_starts_with( $subdomain, 'dev.' ) ||
152
fs_starts_with( $subdomain, 'test.' ) ||
153
+ fs_starts_with( $subdomain, 'stage.' ) ||
154
fs_starts_with( $subdomain, 'staging.' ) ||
155
156
// Ends with.
172
( fs_ends_with($subdomain, 'pantheonsite.io') &&
173
(fs_starts_with($subdomain, 'test-') || fs_starts_with($subdomain, 'dev-'))) ||
174
// Cloudways
175
+ fs_ends_with( $subdomain, '.cloudwaysapps.com' ) ||
176
+ // Kinsta
177
+ (fs_ends_with($subdomain, '.kinsta.com') && fs_starts_with($subdomain, 'staging-'))
178
);
179
}
180
freemius/includes/fs-plugin-info-dialog.php CHANGED
@@ -101,7 +101,7 @@
101
$has_features = false;
102
$plans = false;
103
104
- $result = $this->_fs->get_api_plugin_scope()->get( "/addons/{$selected_addon->id}/pricing.json?type=visible" );
105
106
if ( ! isset( $result->error ) ) {
107
$plans = $result->plans;
@@ -165,6 +165,8 @@
165
// Plugin is missing, not on Freemius nor WP.org.
166
$data->wp_org_missing = true;
167
}
168
} else {
169
$data->wp_org_missing = false;
170
@@ -183,12 +185,7 @@
183
184
// Fetch as much as possible info from local files.
185
$plugin_local_data = $this->_fs->get_plugin_data();
186
- $data->name = $selected_addon->title;
187
$data->author = $plugin_local_data['Author'];
188
- $view_vars = array( 'plugin' => $selected_addon );
189
- $data->sections = array(
190
- 'description' => fs_get_template( '/plugin-info/description.php', $view_vars ),
191
- );
192
193
if ( ! empty( $selected_addon->info->banner_url ) ) {
194
$data->banners = array(
@@ -206,7 +203,7 @@
206
207
if ( is_object( $latest ) ) {
208
$data->version = $latest->version;
209
- $data->last_updated = ! is_null( $latest->updated ) ? $latest->updated : $latest->created;
210
$data->requires = $latest->requires_platform_version;
211
$data->tested = $latest->tested_up_to_version;
212
} else {
@@ -217,6 +214,12 @@
217
}
218
}
219
220
if ( $has_pricing ) {
221
// Add plans to data.
222
$data->plans = $plans;
@@ -950,7 +953,7 @@
950
</li>
951
<?php
952
}
953
- if ( ! empty( $api->slug ) && empty( $api->is_wp_org_compliant ) ) {
954
?>
955
<li><a target="_blank"
956
href="https://wordpress.org/plugins/<?php echo $api->slug; ?>/"><?php fs_esc_html_echo_inline( 'WordPress.org Plugin Page', 'wp-org-plugin-page', $api->slug ) ?>
@@ -1094,7 +1097,7 @@
1094
echo "</div>\n"; // #plugin-information-scrollable
1095
echo "<div id='$tab-footer'>\n";
1096
1097
- if ( ! empty( $api->checkout_link ) ) {
1098
echo $this->get_checkout_cta( $api );
1099
}
1100
101
$has_features = false;
102
$plans = false;
103
104
+ $result = $this->_fs->get_api_plugin_scope()->get( $this->_fs->add_show_pending( "/addons/{$selected_addon->id}/pricing.json?type=visible" ) );
105
106
if ( ! isset( $result->error ) ) {
107
$plans = $result->plans;
165
// Plugin is missing, not on Freemius nor WP.org.
166
$data->wp_org_missing = true;
167
}
168
+
169
+ $data->fs_missing = ( ! $has_free_plan || $data->wp_org_missing );
170
} else {
171
$data->wp_org_missing = false;
172
185
186
// Fetch as much as possible info from local files.
187
$plugin_local_data = $this->_fs->get_plugin_data();
188
$data->author = $plugin_local_data['Author'];
189
190
if ( ! empty( $selected_addon->info->banner_url ) ) {
191
$data->banners = array(
203
204
if ( is_object( $latest ) ) {
205
$data->version = $latest->version;
206
+ $data->last_updated = $latest->created;
207
$data->requires = $latest->requires_platform_version;
208
$data->tested = $latest->tested_up_to_version;
209
} else {
214
}
215
}
216
217
+ $data->name = $selected_addon->title;
218
+ $view_vars = array( 'plugin' => $selected_addon );
219
+ $data->sections = array(
220
+ 'description' => fs_get_template( '/plugin-info/description.php', $view_vars ),
221
+ );
222
+
223
if ( $has_pricing ) {
224
// Add plans to data.
225
$data->plans = $plans;
953
</li>
954
<?php
955
}
956
+ if ( ! empty( $api->slug ) && true == $api->is_wp_org_compliant ) {
957
?>
958
<li><a target="_blank"
959
href="https://wordpress.org/plugins/<?php echo $api->slug; ?>/"><?php fs_esc_html_echo_inline( 'WordPress.org Plugin Page', 'wp-org-plugin-page', $api->slug ) ?>
1097
echo "</div>\n"; // #plugin-information-scrollable
1098
echo "<div id='$tab-footer'>\n";
1099
1100
+ if ( $api->has_paid_plan && ! empty( $api->checkout_link ) ) {
1101
echo $this->get_checkout_cta( $api );
1102
}
1103
freemius/package.json CHANGED
@@ -4,7 +4,7 @@
4
"author": "Freemius, Inc.",
5
"license": "GPL-3.0",
6
"homepage": "https://freemius.com",
7
- "version": "1.2.3",
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.1.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.1.1';
19
20
#region SDK Selection Logic --------------------------------------------------------------------
21
15
*
16
* @var string
17
*/
18
+ $this_sdk_version = '2.1.3';
19
20
#region SDK Selection Logic --------------------------------------------------------------------
21
freemius/templates/account/partials/addon.php CHANGED
@@ -61,7 +61,7 @@
61
$plan = $fs_addon->get_plan();
62
$is_active_subscription = ( is_object( $subscription ) && $subscription->is_active() );
63
$is_paid_trial = $fs_addon->is_paid_trial();
64
- $show_upgrade = ( ! $is_paying && ! $is_paid_trial && ! $fs_addon->_has_premium_license() );
65
$is_current_license_expired = is_object( $license ) && $license->is_expired();
66
}
67
?>
@@ -220,7 +220,7 @@
220
}
221
222
if ( 0 == count( $buttons ) ) {
223
- if ( $fs_addon->is_premium() ) {
224
$fs_addon->_add_license_activation_dialog_box();
225
226
$buttons[] = fs_ui_get_action_button(
61
$plan = $fs_addon->get_plan();
62
$is_active_subscription = ( is_object( $subscription ) && $subscription->is_active() );
63
$is_paid_trial = $fs_addon->is_paid_trial();
64
+ $show_upgrade = ( $fs_addon->has_paid_plan() && ! $is_paying && ! $is_paid_trial && ! $fs_addon->_has_premium_license() );
65
$is_current_license_expired = is_object( $license ) && $license->is_expired();
66
}
67
?>
220
}
221
222
if ( 0 == count( $buttons ) ) {
223
+ if ( $show_upgrade && $fs_addon->is_premium() ) {
224
$fs_addon->_add_license_activation_dialog_box();
225
226
$buttons[] = fs_ui_get_action_button(
freemius/templates/add-ons.php CHANGED
@@ -55,7 +55,7 @@
55
$has_free_plan = false;
56
$has_paid_plan = false;
57
58
- $result = $fs->get_api_plugin_scope()->get( "/addons/{$addon->id}/pricing.json?type=visible" );
59
if ( ! isset( $result->error ) ) {
60
$plans = $result->plans;
61
@@ -89,6 +89,10 @@
89
90
}
91
}
92
}
93
?>
94
<li class="fs-card fs-addon" data-slug="<?php echo $addon->slug ?>">
55
$has_free_plan = false;
56
$has_paid_plan = false;
57
58
+ $result = $fs->get_api_plugin_scope()->get( $fs->add_show_pending( "/addons/{$addon->id}/pricing.json?type=visible" ) );
59
if ( ! isset( $result->error ) ) {
60
$plans = $result->plans;
61
89
90
}
91
}
92
+
93
+ if ( ! $has_paid_plan && ! $has_free_plan ) {
94
+ continue;
95
+ }
96
}
97
?>
98
<li class="fs-card fs-addon" data-slug="<?php echo $addon->slug ?>">
freemius/templates/checkout.php CHANGED
@@ -121,7 +121,7 @@
121
122
$fs_user = Freemius::_get_user_by_email( $current_user->user_email );
123
124
- if ( is_object( $fs_user ) ) {
125
$context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
126
$fs_user,
127
$timestamp,
@@ -233,7 +233,7 @@
233
// passed via query string or hard coded into the child page, it depends on your needs).
234
src = base_url + '/?<?php echo http_build_query( $query_params ) ?>#' + encodeURIComponent(document.location.href),
235
// Append the i-frame into the DOM.
236
- frame = $('<i' + 'frame " src="' + src + '" width="100%" height="' + frame_height + 'px" scrolling="no" frameborder="0" style="background: transparent;"><\/i' + 'frame>')
237
.appendTo('#frame');
238
239
FS.PostMessage.init(base_url, [frame[0]]);
121
122
$fs_user = Freemius::_get_user_by_email( $current_user->user_email );
123
124
+ if ( is_object( $fs_user ) && $fs_user->is_verified() ) {
125
$context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
126
$fs_user,
127
$timestamp,
233
// passed via query string or hard coded into the child page, it depends on your needs).
234
src = base_url + '/?<?php echo http_build_query( $query_params ) ?>#' + encodeURIComponent(document.location.href),
235
// Append the i-frame into the DOM.
236
+ frame = $('<i' + 'frame " src="' + src + '" width="100%" height="' + frame_height + 'px" scrolling="no" frameborder="0" style="background: transparent; width: 1px; min-width: 100%;"><\/i' + 'frame>')
237
.appendTo('#frame');
238
239
FS.PostMessage.init(base_url, [frame[0]]);
freemius/templates/connect.php CHANGED
@@ -253,6 +253,17 @@
253
<a class="show-license-resend-modal show-license-resend-modal-<?php echo $fs->get_unique_affix() ?>"
254
href="#"><?php fs_esc_html_echo_inline( "Can't find your license key?", 'cant-find-license-key', $slug ); ?></a>
255
</div>
256
<?php
257
$send_updates_text = sprintf(
258
'%s<span class="action-description"> - %s</span>',
@@ -718,11 +729,14 @@
718
// Redirect to the "Account" page and sync the license.
719
window.location.href = resultObj.next_page;
720
} else {
721
// Show error.
722
$('.fs-content').prepend('<p class="fs-error">' + (resultObj.error.message ? resultObj.error.message : resultObj.error) + '</p>');
723
-
724
- resetLoadingMode();
725
}
726
}
727
});
728
253
<a class="show-license-resend-modal show-license-resend-modal-<?php echo $fs->get_unique_affix() ?>"
254
href="#"><?php fs_esc_html_echo_inline( "Can't find your license key?", 'cant-find-license-key', $slug ); ?></a>
255
</div>
256
+
257
+ <?php
258
+ /**
259
+ * Allows developers to include custom HTML after the license input container.
260
+ *
261
+ * @author Vova Feldman
262
+ * @since 2.1.2
263
+ */
264
+ $fs->do_action( 'connect/after_license_input' );
265
+ ?>
266
+
267
<?php
268
$send_updates_text = sprintf(
269
'%s<span class="action-description"> - %s</span>',
729
// Redirect to the "Account" page and sync the license.
730
window.location.href = resultObj.next_page;
731
} else {
732
+ resetLoadingMode();
733
+
734
// Show error.
735
$('.fs-content').prepend('<p class="fs-error">' + (resultObj.error.message ? resultObj.error.message : resultObj.error) + '</p>');
736
}
737
+ },
738
+ error: function () {
739
+ resetLoadingMode();
740
}
741
});
742
freemius/templates/contact.php CHANGED
@@ -98,7 +98,7 @@
98
src = base_url + '/contact/?<?php echo http_build_query($query_params) ?>#' + encodeURIComponent(document.location.href),
99
100
// Append the i-frame into the DOM.
101
- frame = $('<i' + 'frame " src="' + src + '" width="100%" height="' + frame_height + 'px" scrolling="no" frameborder="0" style="background: transparent;"><\/i' + 'frame>')
102
.appendTo('#frame');
103
104
FS.PostMessage.init(base_url);
98
src = base_url + '/contact/?<?php echo http_build_query($query_params) ?>#' + encodeURIComponent(document.location.href),
99
100
// Append the i-frame into the DOM.
101
+ frame = $('<i' + 'frame " src="' + src + '" width="100%" height="' + frame_height + 'px" scrolling="no" frameborder="0" style="background: transparent; width: 1px; min-width: 100%;"><\/i' + 'frame>')
102
.appendTo('#frame');
103
104
FS.PostMessage.init(base_url);
freemius/templates/debug.php CHANGED
@@ -86,6 +86,16 @@
86
<button class="button button-primary"><?php fs_esc_html_echo_inline( 'Sync Data From Server' ) ?></button>
87
</form>
88
</td>
89
<td>
90
<button id="fs_load_db_option" class="button"><?php fs_esc_html_echo_inline( 'Load DB Option' ) ?></button>
91
</td>
86
<button class="button button-primary"><?php fs_esc_html_echo_inline( 'Sync Data From Server' ) ?></button>
87
</form>
88
</td>
89
+ <?php if ( fs_is_network_admin() && true !== $fs_options->get_option( 'ms_migration_complete', false, true ) ) : ?>
90
+ <td>
91
+ <!-- Migrate Options to Network -->
92
+ <form action="" method="POST">
93
+ <input type="hidden" name="fs_action" value="migrate_options_to_network">
94
+ <?php wp_nonce_field( 'migrate_options_to_network' ) ?>
95
+ <button class="button button-primary"><?php fs_esc_html_echo_inline( 'Migrate Options to Network' ) ?></button>
96
+ </form>
97
+ </td>
98
+ <?php endif ?>
99
<td>
100
<button id="fs_load_db_option" class="button"><?php fs_esc_html_echo_inline( 'Load DB Option' ) ?></button>
101
</td>
freemius/templates/forms/deactivation/form.php CHANGED
@@ -94,7 +94,7 @@ HTML;
94
isAnonymous = <?php echo ( $is_anonymous ? 'true' : 'false' ); ?>,
95
otherReasonID = <?php echo Freemius::REASON_OTHER; ?>,
96
dontShareDataReasonID = <?php echo Freemius::REASON_DONT_LIKE_TO_SHARE_MY_INFORMATION; ?>,
97
- deleteThemeUpdateData = <?php echo $fs->is_theme() && $fs->is_premium() && ! $fs->has_active_valid_license() ? 'true' : 'false' ?>;
98
99
$modal.appendTo($('body'));
100
94
isAnonymous = <?php echo ( $is_anonymous ? 'true' : 'false' ); ?>,
95
otherReasonID = <?php echo Freemius::REASON_OTHER; ?>,
96
dontShareDataReasonID = <?php echo Freemius::REASON_DONT_LIKE_TO_SHARE_MY_INFORMATION; ?>,
97
+ deleteThemeUpdateData = <?php echo $fs->is_theme() && $fs->is_premium() && ! $fs->has_any_active_valid_license() ? 'true' : 'false' ?>;
98
99
$modal.appendTo($('body'));
100
freemius/templates/pricing.php CHANGED
@@ -127,7 +127,7 @@
127
src = base_url + '/pricing/?<?php echo http_build_query( $query_params ) ?>#' + encodeURIComponent(document.location.href),
128
129
// Append the I-frame into the DOM.
130
- frame = $('<i' + 'frame " src="' + src + '" width="100%" height="' + frame_height + 'px" scrolling="no" frameborder="0" style="background: transparent;"><\/i' + 'frame>')
131
.appendTo('#frame');
132
133
FS.PostMessage.init(base_url, [frame[0]]);
127
src = base_url + '/pricing/?<?php echo http_build_query( $query_params ) ?>#' + encodeURIComponent(document.location.href),
128
129
// Append the I-frame into the DOM.
130
+ frame = $('<i' + 'frame " src="' + src + '" width="100%" height="' + frame_height + 'px" scrolling="no" frameborder="0" style="background: transparent; width: 1px; min-width: 100%;"><\/i' + 'frame>')
131
.appendTo('#frame');
132
133
FS.PostMessage.init(base_url, [frame[0]]);
freemius/templates/tabs.php CHANGED
@@ -26,7 +26,11 @@
26
foreach ( $menu_items as $priority => $items ) {
27
foreach ( $items as $item ) {
28
if ( ! $item['show_submenu'] ) {
29
- if ( ! $is_free_wp_org_theme || ! $fs->is_submenu_item_visible( $item['menu_slug'], true ) ) {
30
continue;
31
}
32
}
26
foreach ( $menu_items as $priority => $items ) {
27
foreach ( $items as $item ) {
28
if ( ! $item['show_submenu'] ) {
29
+ $submenu_name = ('wp-support-forum' === $item['menu_slug']) ?
30
+ 'support' :
31
+ $item['menu_slug'];
32
+
33
+ if ( ! $is_free_wp_org_theme || ! $fs->is_submenu_item_visible( $submenu_name, true ) ) {
34
continue;
35
}
36
}
readme.txt CHANGED
@@ -4,7 +4,8 @@ Tags: ratings, rating, postrating, google rating, 5 star, review, reviews, star
4
Requires at least: 4.3.0
5
Contributors: Dudo
6
Tested up to: 5.0
7
- Stable tag: 1.6.6
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
10
Boost the way people interact with your website, e-commerce or blog with an easy and intuitive WordPress rating system!
@@ -107,11 +108,14 @@ Of course not: you can easily add it on the visual editor just by clicking the "
107
108
The full changelog can be found in the plugin's directory. Recent entries:
109
110
= 1.6.6 =
111
* Minor changes
112
113
= 1.6.5 =
114
- * NEW FEATURE: is it possible to use YASR without jquery: vanilla javascript use the library [rater-js](https://github.com/fredolss/rater-js) by Fredrik Olsson
115
This functionality is still in beta and for now and works only with yasr_overall_rating and yasr_visitor_votes shortcode.
116
You can enable/disable this in every moment in the settings
117
4
Requires at least: 4.3.0
5
Contributors: Dudo
6
Tested up to: 5.0
7
+ Requires PHP: 5.4
8
+ Stable tag: 1.6.7
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
11
Boost the way people interact with your website, e-commerce or blog with an easy and intuitive WordPress rating system!
108
109
The full changelog can be found in the plugin's directory. Recent entries:
110
111
+ = 1.6.7 =
112
+ * Css fix for gutenberg compatibility
113
+
114
= 1.6.6 =
115
* Minor changes
116
117
= 1.6.5 =
118
+ * NEW FEATURE: is it possible to use YASR without jquery (so it will work on ANP pages!!).
119
This functionality is still in beta and for now and works only with yasr_overall_rating and yasr_visitor_votes shortcode.
120
You can enable/disable this in every moment in the settings
121
yet-another-stars-rating.php CHANGED
@@ -4,7 +4,7 @@
4
* Plugin Name: Yet Another Stars Rating
5
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
6
* Description: Yet Another Stars Rating turn your WordPress into a complete review website.
7
- * Version: 1.6.6
8
* Author: Dario Curvino
9
* Author URI: https://yetanotherstarsrating.com/
10
* Text Domain: yet-another-stars-rating
@@ -74,7 +74,7 @@ function yasr_fs()
74
yasr_fs();
75
// Signal that SDK was initiated.
76
do_action( 'yasr_fs_loaded' );
77
- define( 'YASR_VERSION_NUM', '1.6.6' );
78
//Plugin relative path
79
define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
80
//Plugin RELATIVE PATH without slashes (just the directory's name)
4
* Plugin Name: Yet Another Stars Rating
5
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
6
* Description: Yet Another Stars Rating turn your WordPress into a complete review website.
7
+ * Version: 1.6.7
8
* Author: Dario Curvino
9
* Author URI: https://yetanotherstarsrating.com/
10
* Text Domain: yet-another-stars-rating
74
yasr_fs();
75
// Signal that SDK was initiated.
76
do_action( 'yasr_fs_loaded' );
77
+ define( 'YASR_VERSION_NUM', '1.6.7' );
78
//Plugin relative path
79
define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
80
//Plugin RELATIVE PATH without slashes (just the directory's name)