updated plugin Menu Icons
version 0.13.8
This commit is contained in:
@ -175,20 +175,19 @@ class About_Us extends Abstract_Module {
|
||||
private function get_about_localization_data() {
|
||||
$links = isset( $this->about_data['page_menu'] ) ? $this->about_data['page_menu'] : [];
|
||||
$product_pages = isset( $this->about_data['product_pages'] ) ? $this->about_data['product_pages'] : [];
|
||||
|
||||
return [
|
||||
'links' => $links,
|
||||
'logoUrl' => $this->about_data['logo'],
|
||||
'productPages' => $this->get_product_pages_data( $product_pages ),
|
||||
'products' => $this->get_other_products_data(),
|
||||
'homeUrl' => esc_url( home_url() ),
|
||||
'pageSlug' => $this->get_about_page_slug(),
|
||||
'currentProduct' => [
|
||||
'links' => $links,
|
||||
'logoUrl' => $this->about_data['logo'],
|
||||
'productPages' => $this->get_product_pages_data( $product_pages ),
|
||||
'products' => $this->get_other_products_data(),
|
||||
'homeUrl' => esc_url( home_url() ),
|
||||
'pageSlug' => $this->get_about_page_slug(),
|
||||
'currentProduct' => [
|
||||
'slug' => $this->product->get_key(),
|
||||
'name' => $this->product->get_name(),
|
||||
],
|
||||
'teamImage' => $this->get_sdk_uri() . 'assets/images/team.jpg',
|
||||
'strings' => [
|
||||
'teamImage' => $this->get_sdk_uri() . 'assets/images/team.jpg',
|
||||
'strings' => [
|
||||
'aboutUs' => __( 'About us', 'textdomain' ),
|
||||
'heroHeader' => __( 'Our Story', 'textdomain' ),
|
||||
'heroTextFirst' => __( 'Themeisle was founded in 2012 by a group of passionate developers who wanted to create beautiful and functional WordPress themes and plugins. Since then, we have grown into a team of over 20 dedicated professionals who are committed to delivering the best possible products to our customers.', 'textdomain' ),
|
||||
@ -204,6 +203,8 @@ class About_Us extends Abstract_Module {
|
||||
'notInstalled' => __( 'Not Installed', 'textdomain' ),
|
||||
'active' => __( 'Active', 'textdomain' ),
|
||||
],
|
||||
'canInstallPlugins' => current_user_can( 'install_plugins' ),
|
||||
'canActivatePlugins' => current_user_can( 'activate_plugins' ),
|
||||
];
|
||||
}
|
||||
|
||||
@ -286,8 +287,8 @@ class About_Us extends Abstract_Module {
|
||||
$pages,
|
||||
function ( $page_data, $page_key ) use ( $product_pages ) {
|
||||
return in_array( $page_key, $product_pages, true ) &&
|
||||
isset( $page_data['plugin']['status'] ) &&
|
||||
$page_data['plugin']['status'] === 'not-installed';
|
||||
isset( $page_data['plugin']['status'] ) &&
|
||||
$page_data['plugin']['status'] === 'not-installed';
|
||||
},
|
||||
ARRAY_FILTER_USE_BOTH
|
||||
);
|
||||
@ -345,8 +346,8 @@ class About_Us extends Abstract_Module {
|
||||
'condition' => class_exists( 'WooCommerce', false ),
|
||||
],
|
||||
'templates-patterns-collection' => [
|
||||
'name' => 'Template Cloud',
|
||||
'description' => __( 'Ultimate Free Templates Cloud for WordPress, for blocks, patters of full pages.', 'textdomain' ),
|
||||
'name' => 'Templates Cloud',
|
||||
'description' => __( 'Design, save, and revisit your templates anytime with your personal vault on Templates Cloud.', 'textdomain' ),
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -313,8 +313,35 @@ class Dashboard_Widget extends Abstract_Module {
|
||||
*/
|
||||
private function setup_feeds() {
|
||||
if ( false === ( $items_normalized = get_transient( 'themeisle_sdk_feed_items' ) ) ) { //phpcs:ignore Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure
|
||||
// Do not force the feed for the items in the sdk feeds list.
|
||||
// this prevents showing notices if another plugin will force all SimplePie feeds to load, instead it will
|
||||
// use the regular SimplePie validation and abort early if the feed is not valid.
|
||||
$sdk_feeds = $this->feeds;
|
||||
add_action(
|
||||
'wp_feed_options',
|
||||
function ( $feed, $url ) use ( $sdk_feeds ) {
|
||||
if ( defined( 'TI_SDK_PHPUNIT' ) && true === TI_SDK_PHPUNIT ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! is_string( $url ) && in_array( $url, $sdk_feeds, true ) ) {
|
||||
$feed->force_feed( false );
|
||||
return;
|
||||
}
|
||||
if ( is_array( $url ) ) {
|
||||
foreach ( $url as $feed_url ) {
|
||||
if ( in_array( $feed_url, $sdk_feeds, true ) ) {
|
||||
$feed->force_feed( false );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
PHP_INT_MAX,
|
||||
2
|
||||
);
|
||||
// Load SimplePie Instance.
|
||||
$feed = fetch_feed( $this->feeds );
|
||||
$feed = fetch_feed( $sdk_feeds );
|
||||
// TODO report error when is an error loading the feed.
|
||||
if ( is_wp_error( $feed ) ) {
|
||||
return;
|
||||
@ -322,6 +349,9 @@ class Dashboard_Widget extends Abstract_Module {
|
||||
|
||||
$items = $feed->get_items( 0, 5 );
|
||||
$items = is_array( $items ) ? $items : [];
|
||||
|
||||
$items_normalized = [];
|
||||
|
||||
foreach ( $items as $item ) {
|
||||
$items_normalized[] = array(
|
||||
'title' => $item->get_title(),
|
||||
|
@ -264,6 +264,23 @@ class Licenser extends Abstract_Module {
|
||||
return isset( $license_data->license ) ? $license_data : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get license hash.
|
||||
*
|
||||
* @param string $key Product key.
|
||||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
public static function create_license_hash( $key ) {
|
||||
$data = self::get_license_data( $key );
|
||||
|
||||
if ( ! $data ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isset( $data->key ) ? wp_hash( $data->key ) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if license is valid.
|
||||
*
|
||||
|
@ -29,6 +29,11 @@ class Logger extends Abstract_Module {
|
||||
*/
|
||||
const TRACKING_ENDPOINT = 'https://api.themeisle.com/tracking/log';
|
||||
|
||||
/**
|
||||
* Endpoint where to collect telemetry.
|
||||
*/
|
||||
const TELEMETRY_ENDPOINT = 'https://api.themeisle.com/tracking/events';
|
||||
|
||||
|
||||
/**
|
||||
* Check if we should load the module for this product.
|
||||
@ -38,7 +43,6 @@ class Logger extends Abstract_Module {
|
||||
* @return bool Should we load ?
|
||||
*/
|
||||
public function can_load( $product ) {
|
||||
|
||||
return apply_filters( $product->get_slug() . '_sdk_enable_logger', true );
|
||||
}
|
||||
|
||||
@ -53,7 +57,6 @@ class Logger extends Abstract_Module {
|
||||
$this->product = $product;
|
||||
$this->setup_notification();
|
||||
$this->setup_actions();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -76,12 +79,18 @@ class Logger extends Abstract_Module {
|
||||
if ( ! $this->is_logger_active() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$can_load_telemetry = apply_filters( 'themeisle_sdk_enable_telemetry', false );
|
||||
|
||||
if ( $can_load_telemetry ) {
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'load_telemetry' ) );
|
||||
}
|
||||
|
||||
$action_key = $this->product->get_key() . '_log_activity';
|
||||
if ( ! wp_next_scheduled( $action_key ) ) {
|
||||
wp_schedule_single_event( time() + ( wp_rand( 1, 24 ) * 3600 ), $action_key );
|
||||
}
|
||||
add_action( $action_key, array( $this, 'send_log' ) );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -176,4 +185,101 @@ class Logger extends Abstract_Module {
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load telemetry.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function load_telemetry() {
|
||||
// See which products have telemetry enabled.
|
||||
try {
|
||||
$products_with_telemetry = array();
|
||||
$all_products = Loader::get_products();
|
||||
$all_products[ $this->product->get_slug() ] = $this->product; // Add current product to the list of products to check for telemetry.
|
||||
|
||||
foreach ( $all_products as $product_slug => $product ) {
|
||||
|
||||
// Ignore pro products.
|
||||
if ( false !== strstr( $product_slug, 'pro' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$default = 'no';
|
||||
|
||||
if ( ! $product->is_wordpress_available() ) {
|
||||
$default = 'yes';
|
||||
} else {
|
||||
$pro_slug = $product->get_pro_slug();
|
||||
|
||||
if ( ! empty( $pro_slug ) && isset( $all_products[ $pro_slug ] ) ) {
|
||||
$default = 'yes';
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'yes' === get_option( $product->get_key() . '_logger_flag', $default ) ) {
|
||||
|
||||
$main_slug = explode( '-', $product_slug );
|
||||
$main_slug = $main_slug[0];
|
||||
$pro_slug = $product->get_pro_slug();
|
||||
$track_hash = Licenser::create_license_hash( str_replace( '-', '_', ! empty( $pro_slug ) ? $pro_slug : $product_slug ) );
|
||||
|
||||
// Check if product was already tracked.
|
||||
$active_telemetry = false;
|
||||
foreach ( $products_with_telemetry as &$product_with_telemetry ) {
|
||||
if ( $product_with_telemetry['slug'] === $main_slug ) {
|
||||
$active_telemetry = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $active_telemetry ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$products_with_telemetry[] = array(
|
||||
'slug' => $main_slug,
|
||||
'trackHash' => $track_hash ? $track_hash : 'free',
|
||||
'consent' => true,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$products_with_telemetry = apply_filters( 'themeisle_sdk_telemetry_products', $products_with_telemetry );
|
||||
|
||||
if ( 0 === count( $products_with_telemetry ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $themeisle_sdk_max_path;
|
||||
$asset_file = require $themeisle_sdk_max_path . '/assets/js/build/tracking/tracking.asset.php';
|
||||
|
||||
wp_enqueue_script(
|
||||
'themeisle_sdk_telemetry_script',
|
||||
$this->get_sdk_uri() . 'assets/js/build/tracking/tracking.js',
|
||||
$asset_file['dependencies'],
|
||||
$asset_file['version'],
|
||||
true
|
||||
);
|
||||
|
||||
wp_localize_script(
|
||||
'themeisle_sdk_telemetry_script',
|
||||
'tiTelemetry',
|
||||
array(
|
||||
'products' => $products_with_telemetry,
|
||||
'endpoint' => self::TELEMETRY_ENDPOINT,
|
||||
)
|
||||
);
|
||||
} catch ( \Exception $e ) {
|
||||
if ( defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
|
||||
error_log( $e->getMessage() ); // phpcs:ignore
|
||||
}
|
||||
} catch ( \Error $e ) {
|
||||
if ( defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
|
||||
error_log( $e->getMessage() ); // phpcs:ignore
|
||||
}
|
||||
} finally {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -159,7 +159,6 @@ class Promotions extends Abstract_Module {
|
||||
*/
|
||||
public function load_available() {
|
||||
$this->promotions = $this->filter_by_screen_and_merge();
|
||||
|
||||
if ( empty( $this->promotions ) ) {
|
||||
return;
|
||||
}
|
||||
@ -268,6 +267,22 @@ class Promotions extends Abstract_Module {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Third-party compatibility.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private function has_conflicts() {
|
||||
global $pagenow;
|
||||
|
||||
// Editor notices aren't compatible with Enfold theme.
|
||||
if ( defined( 'AV_FRAMEWORK_VERSION' ) && in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get promotions.
|
||||
*
|
||||
@ -285,6 +300,8 @@ class Promotions extends Abstract_Module {
|
||||
$has_ppom = defined( 'PPOM_VERSION' ) || $this->is_plugin_installed( 'woocommerce-product-addon' );
|
||||
$is_min_req_v = version_compare( get_bloginfo( 'version' ), '5.8', '>=' );
|
||||
$is_min_fse_v = version_compare( get_bloginfo( 'version' ), '6.2', '>=' );
|
||||
$current_theme = wp_get_theme();
|
||||
$has_neve_fse = $current_theme->template === 'neve-fse' || $current_theme->parent() === 'neve-fse';
|
||||
$has_enough_attachments = $this->has_min_media_attachments();
|
||||
$has_enough_old_posts = $this->has_old_posts();
|
||||
|
||||
@ -351,7 +368,7 @@ class Promotions extends Abstract_Module {
|
||||
],
|
||||
'neve-fse' => [
|
||||
'neve-fse-themes-popular' => [
|
||||
'env' => $is_min_fse_v,
|
||||
'env' => ! $has_neve_fse && $is_min_fse_v,
|
||||
'screen' => 'themes-install-popular',
|
||||
],
|
||||
],
|
||||
@ -359,7 +376,7 @@ class Promotions extends Abstract_Module {
|
||||
|
||||
foreach ( $all as $slug => $data ) {
|
||||
foreach ( $data as $key => $conditions ) {
|
||||
if ( ! $conditions['env'] ) {
|
||||
if ( ! $conditions['env'] || $this->has_conflicts() ) {
|
||||
unset( $all[ $slug ][ $key ] );
|
||||
|
||||
continue;
|
||||
@ -530,6 +547,12 @@ class Promotions extends Abstract_Module {
|
||||
$this->load_woo_promos();
|
||||
break;
|
||||
case 'neve-fse-themes-popular':
|
||||
// Remove any other notifications if Neve FSE promotion is showing
|
||||
remove_action( 'admin_notices', array( 'ThemeisleSDK\Modules\Notification', 'show_notification' ) );
|
||||
remove_action( 'wp_ajax_themeisle_sdk_dismiss_notice', array( 'ThemeisleSDK\Modules\Notification', 'dismiss' ) );
|
||||
remove_action( 'admin_head', array( 'ThemeisleSDK\Modules\Notification', 'dismiss_get' ) );
|
||||
remove_action( 'admin_head', array( 'ThemeisleSDK\Modules\Notification', 'setup_notifications' ) );
|
||||
// Add required actions to display this notification
|
||||
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue' ] );
|
||||
add_action( 'admin_notices', [ $this, 'render_neve_fse_themes_notice' ] );
|
||||
break;
|
||||
@ -784,7 +807,7 @@ class Promotions extends Abstract_Module {
|
||||
);
|
||||
|
||||
return $tabs;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
add_action( 'woocommerce_product_data_panels', array( $this, 'woocommerce_tab_content' ) );
|
||||
@ -800,7 +823,7 @@ class Promotions extends Abstract_Module {
|
||||
function( $key ) {
|
||||
return in_array( $key, $this->promotions, true );
|
||||
},
|
||||
ARRAY_FILTER_USE_KEY
|
||||
ARRAY_FILTER_USE_KEY
|
||||
);
|
||||
|
||||
// Display CSS
|
||||
|
Reference in New Issue
Block a user