updated plugin Menu Icons
version 0.13.0
This commit is contained in:
@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInite86229ff9ba735012afe266068a3adea::getLoader();
|
||||
return ComposerAutoloaderInitc174f46a75555c6eef9a3e0706b0c0ab::getLoader();
|
||||
|
@ -1,3 +1,34 @@
|
||||
##### [Version 3.2.27](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.26...v3.2.27) (2022-08-23)
|
||||
|
||||
- Add Promotion Module
|
||||
Add the Promotion module for free plugins
|
||||
|
||||
##### [Version 3.2.26](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.25...v3.2.26) (2022-05-12)
|
||||
|
||||
- [Fix] Solve rollback sometimes not available
|
||||
|
||||
##### [Version 3.2.25](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.24...v3.2.25) (2022-03-28)
|
||||
|
||||
- Force update request after rollback
|
||||
|
||||
##### [Version 3.2.24](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.23...v3.2.24) (2022-02-09)
|
||||
|
||||
Fix edge case issue on dismiss
|
||||
Avoid issues with open_basedir restrictions
|
||||
|
||||
##### [Version 3.2.23](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.22...v3.2.23) (2022-02-02)
|
||||
|
||||
Fix php 8.1 issues
|
||||
Fix edge case when update_themes site transient was empty and a fatal error was thrown
|
||||
|
||||
##### [Version 3.2.22](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.21...v3.2.22) (2021-10-27)
|
||||
|
||||
Fix edge case when reset failed checks was not working properly
|
||||
|
||||
##### [Version 3.2.21](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.20...v3.2.21) (2021-06-30)
|
||||
|
||||
review and improve compatibility with auto-updates on custom updates endpoint
|
||||
|
||||
##### [Version 3.2.20](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.19...v3.2.20) (2021-03-30)
|
||||
|
||||
add wp-config support
|
||||
|
BIN
wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/images/animation.jpg
vendored
Normal file
BIN
wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/images/animation.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
BIN
wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/images/conditions.jpg
vendored
Normal file
BIN
wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/images/conditions.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
BIN
wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/images/css.jpg
vendored
Normal file
BIN
wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/images/css.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.7 KiB |
1
wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/js/build/index.asset.php
vendored
Normal file
1
wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/js/build/index.asset.php
vendored
Normal file
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('wp-api', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => 'a1e161cc7b075bdd9250');
|
1
wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/js/build/index.js
vendored
Normal file
1
wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/js/build/index.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
(()=>{"use strict";var e={n:t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return e.d(o,{a:o}),o},d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.element,o=window.wp.i18n,n=window.wp.blockEditor,s=window.wp.components,i=window.wp.compose,r=window.wp.data,a=window.wp.hooks,l=window.wp.api;var c=e.n(l);const d={button:{display:"flex",justifyContent:"center",width:"100%"},image:{padding:"20px 0"},skip:{container:{display:"flex",flexDirection:"column",alignItems:"center"},button:{fontSize:"9px"},poweredby:{fontSize:"9px",textTransform:"uppercase"}}},m={"blocks-css":{title:(0,o.__)("Custom CSS","otter-blocks"),description:(0,o.__)("Enable Otter and add your Custom CSS for this block."),image:"css.jpg"},"blocks-animation":{title:(0,o.__)("Animations","otter-blocks"),description:(0,o.__)("Enable Otter to add Animations to this block."),image:"animation.jpg"},"blocks-conditions":{title:(0,o.__)("Visibility Conditions","otter-blocks"),description:(0,o.__)("Enable Otter to add Visibility Conditions to this block."),image:"conditions.jpg"}},w=e=>{let{onClick:n}=e;return(0,t.createElement)("div",{style:d.skip.container},(0,t.createElement)(s.Button,{style:d.skip.button,variant:"tertiary",onClick:n},(0,o.__)("Skip for now")),(0,t.createElement)("span",{style:d.skip.poweredby},(0,o.__)("Recommended by ")+window.themeisleSDKPromotions.product))},p=(0,i.createHigherOrderComponent)((e=>i=>{if(i.isSelected&&Boolean(window.themeisleSDKPromotions.showPromotion)){const[a,l]=(0,t.useState)(!1),[p,u]=(0,t.useState)("default"),[b,_]=(0,t.useState)(!1),[k,y,h]=(()=>{const{createNotice:e}=(0,r.dispatch)("core/notices"),[n,s]=(0,t.useState)({}),[i,a]=(0,t.useState)("loading"),l=()=>{c().loadPromise.then((async()=>{try{const e=new(c().models.Settings),t=await e.fetch();s(t)}catch(e){a("error")}finally{a("loaded")}}))};return(0,t.useEffect)((()=>{l()}),[]),[e=>null==n?void 0:n[e],function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(0,o.__)("Settings saved.","textdomain");a("saving");const i=new(c().models.Settings)({[t]:n}).save();i.success(((t,n)=>{"success"===n&&(a("loaded"),e("success",s,{isDismissible:!0,type:"snackbar"})),"error"===n&&(a("error"),e("error",(0,o.__)("An unknown error occurred.","textdomain"),{isDismissible:!0,type:"snackbar"})),l()})),i.error((t=>{a("error"),e("error",t.responseJSON.message?t.responseJSON.message:(0,o.__)("An unknown error occurred.","textdomain"),{isDismissible:!0,type:"snackbar"})}))},i]})(),g=async()=>{var e;l(!0),await("otter-blocks",new Promise((e=>{wp.updates.ajax("install-plugin",{slug:"otter-blocks",success:()=>{e({success:!0})},error:t=>{e({success:!1,code:t.errorCode})}})}))),await(e=window.themeisleSDKPromotions.activationUrl,new Promise((t=>{jQuery.get(e).done((()=>{t({success:!0})})).fail((()=>{t({success:!1})}))}))),l(!1),u("installed")},S=()=>"installed"===p?(0,t.createElement)("p",null,(0,o.__)("Awesome! Refresh the page to see Otter in action.")):(0,t.createElement)(s.Button,{variant:"secondary",onClick:g,isBusy:a,style:d.button},(0,o.__)("Install & Activate Otter")),f=()=>{const e=JSON.parse(window.themeisleSDKPromotions.promotions_otter);e[window.themeisleSDKPromotions.showPromotion]=(new Date).getTime()/1e3|0,y("themeisle_sdk_promotions_otter",JSON.stringify(e)),window.themeisleSDKPromotions.showPromotion=!1};return(0,t.useEffect)((()=>{b&&f()}),[b]),b?(0,t.createElement)(e,i):(0,t.createElement)(t.Fragment,null,(0,t.createElement)(e,i),(0,t.createElement)(n.InspectorControls,null,Object.keys(m).map((e=>{if(e===window.themeisleSDKPromotions.showPromotion){const o=m[e];return(0,t.createElement)(s.PanelBody,{title:o.title,initialOpen:!1},(0,t.createElement)("p",null,o.description),(0,t.createElement)(S,null),(0,t.createElement)("img",{style:d.image,src:window.themeisleSDKPromotions.assets+o.image}),(0,t.createElement)(w,{onClick:()=>_(!0)}))}}))))}return(0,t.createElement)(e,i)}),"withInspectorControl");(0,r.select)("core/edit-site")||(0,a.addFilter)("editor.BlockEdit","themeisle-sdk/with-inspector-controls",p)})();
|
@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
return;
|
||||
}
|
||||
// Current SDK version and path.
|
||||
$themeisle_sdk_version = '3.2.20';
|
||||
$themeisle_sdk_version = '3.2.27';
|
||||
$themeisle_sdk_path = dirname( __FILE__ );
|
||||
|
||||
global $themeisle_sdk_max_version;
|
||||
@ -24,16 +24,17 @@ global $themeisle_sdk_max_path;
|
||||
$themeisle_sdk_relative_licenser_path = '/src/Modules/Licenser.php';
|
||||
|
||||
global $themeisle_sdk_abs_licenser_path;
|
||||
if ( ! is_file( $themeisle_sdk_path . $themeisle_sdk_relative_licenser_path ) && is_file( $themeisle_sdk_max_path . $themeisle_sdk_relative_licenser_path ) ) {
|
||||
if ( ! is_file( $themeisle_sdk_path . $themeisle_sdk_relative_licenser_path ) && ! empty( $themeisle_sdk_max_path ) && is_file( $themeisle_sdk_max_path . $themeisle_sdk_relative_licenser_path ) ) {
|
||||
$themeisle_sdk_abs_licenser_path = $themeisle_sdk_max_path . $themeisle_sdk_relative_licenser_path;
|
||||
add_filter( 'themeisle_sdk_required_files', 'themeisle_sdk_load_licenser_if_present' );
|
||||
}
|
||||
if ( version_compare( $themeisle_sdk_version, $themeisle_sdk_max_path ) == 0 &&
|
||||
|
||||
if ( ( is_null( $themeisle_sdk_max_path ) || version_compare( $themeisle_sdk_version, $themeisle_sdk_max_path ) == 0 ) &&
|
||||
apply_filters( 'themeisle_sdk_should_overwrite_path', false, $themeisle_sdk_path, $themeisle_sdk_max_path ) ) {
|
||||
$themeisle_sdk_max_path = $themeisle_sdk_path;
|
||||
}
|
||||
|
||||
if ( version_compare( $themeisle_sdk_version, $themeisle_sdk_max_version ) > 0 ) {
|
||||
if ( is_null( $themeisle_sdk_max_version ) || version_compare( $themeisle_sdk_version, $themeisle_sdk_max_version ) > 0 ) {
|
||||
$themeisle_sdk_max_version = $themeisle_sdk_version;
|
||||
$themeisle_sdk_max_path = $themeisle_sdk_path;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ final class Loader {
|
||||
'review',
|
||||
'recommendation',
|
||||
'notification',
|
||||
|
||||
'promotions',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -30,7 +30,7 @@ class Licenser extends Abstract_Module {
|
||||
*
|
||||
* @var int $max_failed Maximum failed checks allowed before show the notice
|
||||
*/
|
||||
private static $max_failed = 5;
|
||||
private static $max_failed = 2;
|
||||
/**
|
||||
* License key string.
|
||||
*
|
||||
@ -244,7 +244,7 @@ class Licenser extends Abstract_Module {
|
||||
*/
|
||||
public function get_distributor_name() {
|
||||
if ( $this->is_from_partner( $this->product ) ) {
|
||||
return 'ThemeIsle';
|
||||
return 'Themeisle';
|
||||
}
|
||||
|
||||
return $this->product->get_store_name();
|
||||
@ -281,7 +281,7 @@ class Licenser extends Abstract_Module {
|
||||
$status = $this->get_license_status( true );
|
||||
$no_activations_string = apply_filters( $this->product->get_key() . '_lc_no_activations_string', 'No more activations left for %s. You need to upgrade your plan in order to use %s on more websites. If you need assistance, please get in touch with %s staff.' );
|
||||
$no_valid_string = apply_filters( $this->product->get_key() . '_lc_no_valid_string', 'In order to benefit from updates and support for %s, please add your license code from your <a href="%s" target="_blank">purchase history</a> and validate it <a href="%s">here</a>. ' );
|
||||
$expired_license_string = apply_filters( $this->product->get_key() . '_lc_expired_string', 'Your %s License Key has expired. In order to continue receiving support and software updates you must <a href="%s" target="_blank">renew</a> your license key.' );
|
||||
$expired_license_string = apply_filters( $this->product->get_key() . '_lc_expired_string', 'Your %s\'s License Key has expired. In order to continue receiving support and software updates you must <a href="%s" target="_blank">renew</a> your license key.' );
|
||||
// No activations left for this license.
|
||||
if ( 'valid' != $status && $this->check_activation() ) {
|
||||
?>
|
||||
@ -413,26 +413,22 @@ class Licenser extends Abstract_Module {
|
||||
|
||||
if ( is_wp_error( $response ) ) {
|
||||
$license_data = new \stdClass();
|
||||
$license_data->license = 'valid';
|
||||
$license_data->license = 'invalid';
|
||||
} else {
|
||||
$license_data = $response;
|
||||
}
|
||||
|
||||
$license_old = get_option( $this->product->get_key() . '_license_data', '' );
|
||||
|
||||
if ( 'valid' === $license_old->license && ( $license_data->license !== $license_old->license ) ) {
|
||||
if ( 'valid' === $license_old->license && ( $license_data->license !== $license_old->license ) && $this->failed_checks <= self::$max_failed ) {
|
||||
$this->increment_failed_checks();
|
||||
} else {
|
||||
$this->reset_failed_checks();
|
||||
}
|
||||
|
||||
if ( $this->failed_checks <= self::$max_failed ) {
|
||||
return $license_old;
|
||||
}
|
||||
|
||||
if ( ! isset( $license_data->key ) ) {
|
||||
$license_data->key = isset( $license_old->key ) ? $license_old->key : '';
|
||||
}
|
||||
$this->reset_failed_checks();
|
||||
|
||||
return $license_data;
|
||||
|
||||
@ -526,6 +522,10 @@ class Licenser extends Abstract_Module {
|
||||
return new \WP_Error( 'themeisle-license-invalid', 'ERROR: Invalid license provided.' );
|
||||
}
|
||||
|
||||
// Remove the versions transient upon activation so that newer version for rollback can be acquired.
|
||||
$versions_cache = $this->product->get_cache_key();
|
||||
delete_transient( $versions_cache );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -633,10 +633,19 @@ class Licenser extends Abstract_Module {
|
||||
*/
|
||||
public function theme_update_transient( $value ) {
|
||||
$update_data = $this->check_for_update();
|
||||
if ( $update_data ) {
|
||||
$value->response[ $this->product->get_slug() ] = $update_data;
|
||||
if ( empty( $value ) ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
if ( ! isset( $value->response ) ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
if ( ! $update_data ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
$value->response[ $this->product->get_slug() ] = $update_data;
|
||||
return $value;
|
||||
}
|
||||
|
||||
@ -739,6 +748,9 @@ class Licenser extends Abstract_Module {
|
||||
}
|
||||
$api_response = $this->api_request();
|
||||
if ( false !== $api_response && is_object( $api_response ) && isset( $api_response->new_version ) ) {
|
||||
if ( ! isset( $api_response->plugin ) ) {
|
||||
$api_response->plugin = $this->product->get_slug() . '/' . $this->product->get_file();
|
||||
}
|
||||
if ( version_compare( $this->product->get_version(), $api_response->new_version, '<' ) ) {
|
||||
$_transient_data->response[ $this->product->get_slug() . '/' . $this->product->get_file() ] = $api_response;
|
||||
} else {
|
||||
|
@ -269,8 +269,9 @@ class Notification extends Abstract_Module {
|
||||
],
|
||||
];
|
||||
$notification_details = wp_parse_args( $notification_details, $default );
|
||||
|
||||
$notification_html = '<div class="notice notice-success is-dismissible themeisle-sdk-notice" data-notification-id="' . esc_attr( $notification_details['id'] ) . '" id="' . esc_attr( $notification_details['id'] ) . '-notification"> <div class="themeisle-sdk-notification-box">';
|
||||
global $pagenow;
|
||||
$notification_details['ctas']['cancel']['link'] = wp_nonce_url( add_query_arg( [ 'nid' => $notification_details['id'] ], admin_url( $pagenow ) ), $notification_details['id'], 'tsdk_dismiss_nonce' );
|
||||
$notification_html = '<div class="notice notice-success is-dismissible themeisle-sdk-notice" data-notification-id="' . esc_attr( $notification_details['id'] ) . '" id="' . esc_attr( $notification_details['id'] ) . '-notification"> <div class="themeisle-sdk-notification-box">';
|
||||
|
||||
if ( ! empty( $notification_details['heading'] ) ) {
|
||||
$notification_html .= sprintf( '<h4>%s</h4>', wp_kses_post( $notification_details['heading'] ) );
|
||||
@ -343,16 +344,18 @@ class Notification extends Abstract_Module {
|
||||
'nonce': '<?php echo esc_attr( wp_create_nonce( (string) __CLASS__ ) ); ?>',
|
||||
'action': 'themeisle_sdk_dismiss_notice',
|
||||
'id': notification_id,
|
||||
'confirm': confirm
|
||||
}
|
||||
);
|
||||
'confirm': confirm,
|
||||
},
|
||||
).fail(function() {
|
||||
location.href = encodeURI(link.attr('href'));
|
||||
});
|
||||
if (confirm === 'yes') {
|
||||
$(this).trigger('themeisle-sdk:confirmed');
|
||||
} else {
|
||||
$(this).trigger('themeisle-sdk:canceled');
|
||||
}
|
||||
container.hide();
|
||||
if (link.attr('href') === '#') {
|
||||
if (confirm === 'no' || link.attr('href') === '#') {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@ -383,6 +386,31 @@ class Notification extends Abstract_Module {
|
||||
do_action( $id . '_process_confirm', $confirm );
|
||||
wp_send_json( [] );
|
||||
}
|
||||
/**
|
||||
* Dismiss the notification.
|
||||
*/
|
||||
public static function dismiss_get() {
|
||||
$is_nonce_dismiss = sanitize_text_field( isset( $_GET['tsdk_dismiss_nonce'] ) ? $_GET['tsdk_dismiss_nonce'] : '' );
|
||||
if ( strlen( $is_nonce_dismiss ) < 5 ) {
|
||||
return;
|
||||
}
|
||||
$id = sanitize_text_field( isset( $_GET['nid'] ) ? $_GET['nid'] : '' );
|
||||
if ( empty( $id ) ) {
|
||||
return;
|
||||
}
|
||||
$nonce = wp_verify_nonce( sanitize_text_field( $_GET['tsdk_dismiss_nonce'] ), $id );
|
||||
if ( $nonce !== 1 ) {
|
||||
return;
|
||||
}
|
||||
$ids = wp_list_pluck( self::$notifications, 'id' );
|
||||
if ( ! in_array( $id, $ids, true ) ) {
|
||||
return;
|
||||
}
|
||||
$confirm = 'no';
|
||||
self::set_last_active_notification_timestamp();
|
||||
update_option( $id, $confirm );
|
||||
do_action( $id . '_process_confirm', $confirm );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we should load the notification module.
|
||||
@ -456,6 +484,7 @@ class Notification extends Abstract_Module {
|
||||
self::$notifications = $notifications;
|
||||
add_action( 'admin_notices', array( __CLASS__, 'show_notification' ) );
|
||||
add_action( 'wp_ajax_themeisle_sdk_dismiss_notice', array( __CLASS__, 'dismiss' ) );
|
||||
add_action( 'admin_head', array( __CLASS__, 'dismiss_get' ) );
|
||||
add_action( 'admin_head', array( __CLASS__, 'setup_notifications' ) );
|
||||
|
||||
return $this;
|
||||
|
192
wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Promotions.php
vendored
Normal file
192
wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Promotions.php
vendored
Normal file
@ -0,0 +1,192 @@
|
||||
<?php
|
||||
/**
|
||||
* The promotions model class for ThemeIsle SDK
|
||||
*
|
||||
* Here's how to hook it in your plugin: add_filter( 'menu_icons_load_promotions', function() { return array( 'otter' ); } );
|
||||
*
|
||||
* @package ThemeIsleSDK
|
||||
* @subpackage Modules
|
||||
* @copyright Copyright (c) 2017, Marius Cristea
|
||||
* @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace ThemeisleSDK\Modules;
|
||||
|
||||
use ThemeisleSDK\Common\Abstract_Module;
|
||||
use ThemeisleSDK\Product;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Promotions module for ThemeIsle SDK.
|
||||
*/
|
||||
class Promotions extends Abstract_Module {
|
||||
/**
|
||||
* Fetched feeds items.
|
||||
*
|
||||
* @var array Feed items.
|
||||
*/
|
||||
private $promotions_to_load = array();
|
||||
|
||||
/**
|
||||
* Should we load this module.
|
||||
*
|
||||
* @param Product $product Product object.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function can_load( $product ) {
|
||||
if ( $this->is_from_partner( $product ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->promotions_to_load = apply_filters( $product->get_key() . '_load_promotions', array() );
|
||||
|
||||
if ( 0 === count( $this->promotions_to_load ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the hooks.
|
||||
*
|
||||
* @param Product $product Product to load.
|
||||
*
|
||||
* @return Promotions Module instance.
|
||||
*/
|
||||
public function load( $product ) {
|
||||
if ( 0 === count( $this->promotions_to_load ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->product = $product;
|
||||
|
||||
if ( in_array( 'otter', $this->promotions_to_load ) && false === apply_filters( 'themeisle_sdk_load_promotions_otter', false ) && ! ( defined( 'OTTER_BLOCKS_VERSION' ) || $this->is_otter_installed() ) && version_compare( get_bloginfo( 'version' ), '5.8', '>=' ) ) {
|
||||
add_filter( 'themeisle_sdk_load_promotions_otter', '__return_true' );
|
||||
add_action( 'init', array( $this, 'register_settings' ), 99 );
|
||||
|
||||
if ( false !== $this->show_otter_promotion() ) {
|
||||
add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_editor_assets' ) );
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register Settings
|
||||
*
|
||||
* @since 1.2.0
|
||||
* @access public
|
||||
*/
|
||||
public function register_settings() {
|
||||
register_setting(
|
||||
'themeisle_sdk_settings',
|
||||
'themeisle_sdk_promotions_otter',
|
||||
array(
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'show_in_rest' => true,
|
||||
'default' => '{}',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Otter Blocks plugin status.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function is_otter_installed() {
|
||||
$status = false;
|
||||
|
||||
if ( file_exists( ABSPATH . 'wp-content/plugins/otter-blocks/otter-blocks.php' ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status of Otter promotion message.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function show_otter_promotion() {
|
||||
$promotions = array(
|
||||
'blocks_css',
|
||||
'blocks_animation',
|
||||
'blocks_conditions',
|
||||
);
|
||||
|
||||
$option = json_decode( get_option( 'themeisle_sdk_promotions_otter', '{}' ), true );
|
||||
|
||||
if ( 0 === count( $option ) ) {
|
||||
return 'blocks-css';
|
||||
}
|
||||
|
||||
if ( isset( $option['blocks-css'] ) && ! isset( $option['blocks-animation'] ) && $option['blocks-css'] < strtotime( '-7 days' ) ) {
|
||||
return 'blocks-animation';
|
||||
}
|
||||
|
||||
if ( isset( $option['blocks-animation'] ) && ! isset( $option['blocks-conditions'] ) && $option['blocks-animation'] < strtotime( '-7 days' ) ) {
|
||||
return 'blocks-conditions';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Gutenberg editor assets.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function enqueue_editor_assets() {
|
||||
global $themeisle_sdk_max_path;
|
||||
|
||||
$themeisle_sdk_path = dirname( $themeisle_sdk_max_path );
|
||||
$themeisle_sdk_src = plugins_url( '/', $themeisle_sdk_max_path );
|
||||
|
||||
$asset_file = include $themeisle_sdk_path . '/themeisle-sdk/assets/js/build/index.asset.php';
|
||||
|
||||
wp_enqueue_script(
|
||||
'themeisle-sdk-otter-promotions',
|
||||
$themeisle_sdk_src . 'themeisle-sdk/assets/js/build/index.js',
|
||||
array_merge( $asset_file['dependencies'], [ 'updates' ] ),
|
||||
$asset_file['version'],
|
||||
true
|
||||
);
|
||||
|
||||
$option = get_option( 'themeisle_sdk_promotions_otter', '{}' );
|
||||
|
||||
wp_localize_script(
|
||||
'themeisle-sdk-otter-promotions',
|
||||
'themeisleSDKPromotions',
|
||||
array(
|
||||
'product' => $this->product->get_name(),
|
||||
'assets' => $themeisle_sdk_src . 'themeisle-sdk/assets/images/',
|
||||
'showPromotion' => $this->show_otter_promotion(),
|
||||
'promotions_otter' => $option,
|
||||
'activationUrl' => esc_url(
|
||||
add_query_arg(
|
||||
array(
|
||||
'plugin_status' => 'all',
|
||||
'paged' => '1',
|
||||
'action' => 'activate',
|
||||
'plugin' => rawurlencode( 'otter-blocks/otter-blocks.php' ),
|
||||
'_wpnonce' => wp_create_nonce( 'activate-plugin_otter-blocks/otter-blocks.php' ),
|
||||
),
|
||||
admin_url( 'plugins.php' )
|
||||
)
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@ -98,7 +98,7 @@ class Rollback extends Abstract_Module {
|
||||
*/
|
||||
private function get_api_versions() {
|
||||
|
||||
$cache_key = $this->product->get_key() . '_' . preg_replace( '/[^0-9a-zA-Z ]/m', '', $this->product->get_version() ) . 'versions';
|
||||
$cache_key = $this->product->get_cache_key();
|
||||
$cache_versions = get_transient( $cache_key );
|
||||
if ( false === $cache_versions ) {
|
||||
$versions = $this->get_remote_versions();
|
||||
@ -374,11 +374,27 @@ class Rollback extends Abstract_Module {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires after the option has been updated.
|
||||
*
|
||||
* @param mixed $old_value The old option value.
|
||||
* @param mixed $value The new option value.
|
||||
* @param string $option Option name.
|
||||
*/
|
||||
public function update_active_plugins_action( $old_value, $value, $option ) {
|
||||
delete_site_transient( 'update_plugins' );
|
||||
wp_cache_delete( 'plugins', 'plugins' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the rollback hook. Strangely, this does not work if placed in the ThemeIsle_SDK_Rollback class, so it is being called from there instead.
|
||||
*/
|
||||
public function add_hooks() {
|
||||
add_action( 'admin_post_' . $this->product->get_key() . '_rollback', array( $this, 'start_rollback' ) );
|
||||
add_action( 'admin_footer', array( $this, 'add_footer' ) );
|
||||
|
||||
// This hook will be invoked after the plugin activation.
|
||||
// We use this to force an update of the cache so that Update is present immediate after a rollback.
|
||||
add_action( 'update_option_active_plugins', array( $this, 'update_active_plugins_action' ), 10, 3 );
|
||||
}
|
||||
}
|
||||
|
@ -322,6 +322,15 @@ class Product {
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the product version cache key.
|
||||
*
|
||||
* @return string The product version cache key.
|
||||
*/
|
||||
public function get_cache_key() {
|
||||
return $this->get_key() . '_' . preg_replace( '/[^0-9a-zA-Z ]/m', '', $this->get_version() ) . 'versions';
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for product name.
|
||||
*
|
||||
|
@ -32,6 +32,7 @@ $files_to_load = [
|
||||
$themeisle_library_path . '/src/Modules/Translate.php',
|
||||
$themeisle_library_path . '/src/Modules/Review.php',
|
||||
$themeisle_library_path . '/src/Modules/Recommendation.php',
|
||||
$themeisle_library_path . '/src/Modules/Promotions.php',
|
||||
];
|
||||
|
||||
$files_to_load = array_merge( $files_to_load, apply_filters( 'themeisle_sdk_required_files', [] ) );
|
||||
|
@ -28,7 +28,7 @@ class InstalledVersions
|
||||
{
|
||||
/**
|
||||
* @var mixed[]|null
|
||||
* @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
|
||||
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
|
||||
*/
|
||||
private static $installed;
|
||||
|
||||
@ -39,7 +39,7 @@ class InstalledVersions
|
||||
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
|
||||
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||
*/
|
||||
private static $installedByVendor = array();
|
||||
|
||||
@ -243,7 +243,7 @@ class InstalledVersions
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
|
||||
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
|
||||
*/
|
||||
public static function getRootPackage()
|
||||
{
|
||||
@ -257,7 +257,7 @@ class InstalledVersions
|
||||
*
|
||||
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
|
||||
* @return array[]
|
||||
* @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
|
||||
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
|
||||
*/
|
||||
public static function getRawData()
|
||||
{
|
||||
@ -280,7 +280,7 @@ class InstalledVersions
|
||||
* Returns the raw data of all installed.php which are currently loaded for custom implementations
|
||||
*
|
||||
* @return array[]
|
||||
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
|
||||
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||
*/
|
||||
public static function getAllRawData()
|
||||
{
|
||||
@ -303,7 +303,7 @@ class InstalledVersions
|
||||
* @param array[] $data A vendor/composer/installed.php data set
|
||||
* @return void
|
||||
*
|
||||
* @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
|
||||
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
|
||||
*/
|
||||
public static function reload($data)
|
||||
{
|
||||
@ -313,7 +313,7 @@ class InstalledVersions
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
|
||||
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||
*/
|
||||
private static function getInstalled()
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInite86229ff9ba735012afe266068a3adea
|
||||
class ComposerAutoloaderInitc174f46a75555c6eef9a3e0706b0c0ab
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,18 +22,18 @@ class ComposerAutoloaderInite86229ff9ba735012afe266068a3adea
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInite86229ff9ba735012afe266068a3adea', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitc174f46a75555c6eef9a3e0706b0c0ab', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInite86229ff9ba735012afe266068a3adea', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitc174f46a75555c6eef9a3e0706b0c0ab', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInite86229ff9ba735012afe266068a3adea::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitc174f46a75555c6eef9a3e0706b0c0ab::getInitializer($loader));
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInite86229ff9ba735012afe266068a3adea::$files;
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInitc174f46a75555c6eef9a3e0706b0c0ab::$files;
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequiree86229ff9ba735012afe266068a3adea($fileIdentifier, $file);
|
||||
composerRequirec174f46a75555c6eef9a3e0706b0c0ab($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
@ -45,7 +45,7 @@ class ComposerAutoloaderInite86229ff9ba735012afe266068a3adea
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequiree86229ff9ba735012afe266068a3adea($fileIdentifier, $file)
|
||||
function composerRequirec174f46a75555c6eef9a3e0706b0c0ab($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInite86229ff9ba735012afe266068a3adea
|
||||
class ComposerStaticInitc174f46a75555c6eef9a3e0706b0c0ab
|
||||
{
|
||||
public static $files = array (
|
||||
'2c2d2fe92db4cd03403dbb108ac263b7' => __DIR__ . '/..' . '/codeinwp/gutenberg-menu-icons/load.php',
|
||||
@ -20,7 +20,7 @@ class ComposerStaticInite86229ff9ba735012afe266068a3adea
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->classMap = ComposerStaticInite86229ff9ba735012afe266068a3adea::$classMap;
|
||||
$loader->classMap = ComposerStaticInitc174f46a75555c6eef9a3e0706b0c0ab::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
@ -144,18 +144,18 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Codeinwp/themeisle-sdk.git",
|
||||
"reference": "24668ab249d8fb6596cc908c323205648aad0ed8"
|
||||
"reference": "bab0314e1f6e2f811116a2da7736b94cbe6af90f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/24668ab249d8fb6596cc908c323205648aad0ed8",
|
||||
"reference": "24668ab249d8fb6596cc908c323205648aad0ed8",
|
||||
"url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/bab0314e1f6e2f811116a2da7736b94cbe6af90f",
|
||||
"reference": "bab0314e1f6e2f811116a2da7736b94cbe6af90f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require-dev": {
|
||||
"codeinwp/phpcs-ruleset": "dev-main"
|
||||
},
|
||||
"time": "2021-05-05T17:45:51+00:00",
|
||||
"time": "2022-08-23T13:09:40+00:00",
|
||||
"default-branch": true,
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
@ -177,7 +177,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Codeinwp/themeisle-sdk/issues",
|
||||
"source": "https://github.com/Codeinwp/themeisle-sdk/tree/master"
|
||||
"source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.2.27"
|
||||
},
|
||||
"install-path": "../codeinwp/themeisle-sdk"
|
||||
}
|
||||
|
@ -1,64 +1,64 @@
|
||||
<?php return array(
|
||||
'root' => array(
|
||||
'pretty_version' => 'v0.12.12',
|
||||
'version' => '0.12.12.0',
|
||||
'name' => 'codeinwp/wp-menu-icons',
|
||||
'pretty_version' => 'v0.13.0',
|
||||
'version' => '0.13.0.0',
|
||||
'reference' => '789aafe06b2183d940c0bdc43f6f81a49f84abc0',
|
||||
'type' => 'wordpress-plugin',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'reference' => '67d06d108844f32ccddfddb7420e7de9ee47bdb9',
|
||||
'name' => 'codeinwp/wp-menu-icons',
|
||||
'dev' => false,
|
||||
),
|
||||
'versions' => array(
|
||||
'codeinwp/gutenberg-menu-icons' => array(
|
||||
'pretty_version' => '1.0.4',
|
||||
'version' => '1.0.4.0',
|
||||
'reference' => '121ef82c57a556301265cbd1032d28619235e488',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../codeinwp/gutenberg-menu-icons',
|
||||
'aliases' => array(),
|
||||
'reference' => '121ef82c57a556301265cbd1032d28619235e488',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'codeinwp/icon-picker' => array(
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'reference' => '0c60ce3a41653e41a20e710c4d5a6a2104c85020',
|
||||
'type' => 'wordpress-plugin',
|
||||
'install_path' => __DIR__ . '/../codeinwp/icon-picker',
|
||||
'aliases' => array(
|
||||
0 => '9999999-dev',
|
||||
),
|
||||
'reference' => '0c60ce3a41653e41a20e710c4d5a6a2104c85020',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'codeinwp/menu-item-custom-fields' => array(
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'reference' => 'f491fcfa873e92006e3d92a4ede8775e9cf53bae',
|
||||
'type' => 'wordpress-plugin',
|
||||
'install_path' => __DIR__ . '/../codeinwp/menu-item-custom-fields',
|
||||
'aliases' => array(
|
||||
0 => '9999999-dev',
|
||||
),
|
||||
'reference' => 'f491fcfa873e92006e3d92a4ede8775e9cf53bae',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'codeinwp/themeisle-sdk' => array(
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'reference' => 'bab0314e1f6e2f811116a2da7736b94cbe6af90f',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../codeinwp/themeisle-sdk',
|
||||
'aliases' => array(
|
||||
0 => '9999999-dev',
|
||||
),
|
||||
'reference' => '24668ab249d8fb6596cc908c323205648aad0ed8',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'codeinwp/wp-menu-icons' => array(
|
||||
'pretty_version' => 'v0.12.12',
|
||||
'version' => '0.12.12.0',
|
||||
'pretty_version' => 'v0.13.0',
|
||||
'version' => '0.13.0.0',
|
||||
'reference' => '789aafe06b2183d940c0bdc43f6f81a49f84abc0',
|
||||
'type' => 'wordpress-plugin',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'reference' => '67d06d108844f32ccddfddb7420e7de9ee47bdb9',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'composer/installers' => array(
|
||||
|
Reference in New Issue
Block a user