updated plugin Menu Icons
version 0.13.10
This commit is contained in:
parent
d033371227
commit
60de585044
@ -1,3 +1,16 @@
|
||||
##### [Version 0.13.10](https://github.com/codeinwp/wp-menu-icons/compare/v0.13.9...v0.13.10) (2024-03-26)
|
||||
|
||||
### Improvements
|
||||
- Updated internal dependencies
|
||||
- Improved readme to link to the public source files
|
||||
- Filter promotions
|
||||
|
||||
##### [Version 0.13.9](https://github.com/codeinwp/wp-menu-icons/compare/v0.13.8...v0.13.9) (2024-02-23)
|
||||
|
||||
### Fixes
|
||||
- Updated dependencies
|
||||
- Harden security
|
||||
|
||||
##### [Version 0.13.8](https://github.com/codeinwp/wp-menu-icons/compare/v0.13.7...v0.13.8) (2023-12-19)
|
||||
|
||||
- SDK Updates
|
||||
|
@ -1,13 +0,0 @@
|
||||
## Releasing
|
||||
|
||||
This repository uses conventional [changelog commit](https://github.com/Codeinwp/conventional-changelog-simple-preset) messages to trigger release
|
||||
|
||||
How to release a new version:
|
||||
|
||||
- Clone the master branch
|
||||
- Do your changes
|
||||
- Send a PR to master and merge it using the following subject message
|
||||
- `release: <release short description>` - for patch release
|
||||
- `release(minor): <release short description>` - for minor release
|
||||
- `release(major): <release short description>` - for major release
|
||||
The release notes will inherit the body of the commit message which triggered the release. For more details check the [simple-preset](https://github.com/Codeinwp/conventional-changelog-simple-preset) that we use.
|
@ -11,7 +11,7 @@
|
||||
* Plugin name: Menu Icons
|
||||
* Plugin URI: https://github.com/Codeinwp/wp-menu-icons
|
||||
* Description: Spice up your navigation menus with pretty icons, easily.
|
||||
* Version: 0.13.8
|
||||
* Version: 0.13.10
|
||||
* Author: ThemeIsle
|
||||
* Author URI: https://themeisle.com
|
||||
* License: GPLv2
|
||||
@ -29,7 +29,7 @@ final class Menu_Icons {
|
||||
|
||||
const DISMISS_NOTICE = 'menu-icons-dismiss-notice';
|
||||
|
||||
const VERSION = '0.13.8';
|
||||
const VERSION = '0.13.10';
|
||||
|
||||
/**
|
||||
* Holds plugin data
|
||||
@ -103,11 +103,16 @@ final class Menu_Icons {
|
||||
add_action( 'admin_action_menu_icon_hide_notice', array( __CLASS__, 'wp_menu_icons_dismiss_dashboard_notice' ) );
|
||||
|
||||
add_filter(
|
||||
'menu_icons_load_promotions',
|
||||
'wp_menu_icons_load_promotions',
|
||||
function() {
|
||||
return array( 'otter' );
|
||||
}
|
||||
);
|
||||
add_filter(
|
||||
'wp_menu_icons_dissallowed_promotions', function () {
|
||||
return array( 'om-editor', 'om-image-block' );
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,6 +45,10 @@ Menu icons works with most of the themes out there, especially with popular ones
|
||||
|
||||
Development of this plugin is done on [GitHub](https://github.com/codeinwp/wp-menu-icons). **Pull requests welcome**. Please see [issues reported](https://github.com/codeinwp/wp-menu-icons/issues) there before going to the plugin forum.
|
||||
|
||||
All the code and sources is publicly available on [GitHub/wp-menu-icons](https://github.com/codeinwp/wp-menu-icons) for this plugin and
|
||||
for the [SDK](https://github.com/Codeinwp/themeisle-sdk).
|
||||
|
||||
|
||||
## If you like this plugin, then consider checking out our other projects: ##
|
||||
|
||||
[CodeinWP Blog](https://www.codeinwp.com/blog/) – Designer's Guide To WordPress
|
||||
|
@ -225,6 +225,25 @@ Read [this blog post](http://kucrut.org/add-custom-image-sizes-right-way/).
|
||||
|
||||
== Changelog ==
|
||||
|
||||
##### [Version 0.13.10](https://github.com/codeinwp/wp-menu-icons/compare/v0.13.9...v0.13.10) (2024-03-26)
|
||||
|
||||
### Improvements
|
||||
- Updated internal dependencies
|
||||
- Improved readme to link to the public source files
|
||||
- Filter promotions
|
||||
|
||||
|
||||
|
||||
|
||||
##### [Version 0.13.9](https://github.com/codeinwp/wp-menu-icons/compare/v0.13.8...v0.13.9) (2024-02-23)
|
||||
|
||||
### Fixes
|
||||
- Updated dependencies
|
||||
- Harden security
|
||||
|
||||
|
||||
|
||||
|
||||
##### [Version 0.13.8](https://github.com/codeinwp/wp-menu-icons/compare/v0.13.7...v0.13.8) (2023-12-19)
|
||||
|
||||
- SDK Updates
|
||||
|
@ -1,3 +1,22 @@
|
||||
##### [Version 3.3.15](https://github.com/Codeinwp/themeisle-sdk/compare/v3.3.14...v3.3.15) (2024-03-26)
|
||||
|
||||
### Improvements
|
||||
- Add a filter to disallow promotions on specific products.
|
||||
- Update Formbricks
|
||||
|
||||
##### [Version 3.3.14](https://github.com/Codeinwp/themeisle-sdk/compare/v3.3.13...v3.3.14) (2024-02-27)
|
||||
|
||||
- Add Announcement Module
|
||||
- Add Script Loader Module
|
||||
|
||||
##### [Version 3.3.13](https://github.com/Codeinwp/themeisle-sdk/compare/v3.3.12...v3.3.13) (2024-02-01)
|
||||
|
||||
- Updated nonce check
|
||||
|
||||
##### [Version 3.3.12](https://github.com/Codeinwp/themeisle-sdk/compare/v3.3.11...v3.3.12) (2024-01-31)
|
||||
|
||||
- fix: prevent reference key set for users with no capability
|
||||
|
||||
##### [Version 3.3.11](https://github.com/Codeinwp/themeisle-sdk/compare/v3.3.10...v3.3.11) (2023-12-12)
|
||||
|
||||
- fix: cached requests for wp options
|
||||
|
519
wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/images/themeisle-logo.svg
vendored
Normal file
519
wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/images/themeisle-logo.svg
vendored
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 210 KiB |
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '7eac74bcd8abf2e43780');
|
File diff suppressed because one or more lines are too long
@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
return;
|
||||
}
|
||||
// Current SDK version and path.
|
||||
$themeisle_sdk_version = '3.3.11';
|
||||
$themeisle_sdk_version = '3.3.15';
|
||||
$themeisle_sdk_path = dirname( __FILE__ );
|
||||
|
||||
global $themeisle_sdk_max_version;
|
||||
|
@ -46,6 +46,7 @@ final class Loader {
|
||||
* @var array The modules which SDK will be using.
|
||||
*/
|
||||
private static $available_modules = [
|
||||
'script_loader',
|
||||
'dashboard_widget',
|
||||
'rollback',
|
||||
'uninstall_feedback',
|
||||
@ -59,6 +60,7 @@ final class Loader {
|
||||
'welcome',
|
||||
'compatibilities',
|
||||
'about_us',
|
||||
'announcements',
|
||||
];
|
||||
|
||||
/**
|
||||
@ -146,5 +148,4 @@ final class Loader {
|
||||
public static function get_version() {
|
||||
return self::$version;
|
||||
}
|
||||
|
||||
}
|
||||
|
379
wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Announcements.php
vendored
Normal file
379
wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Announcements.php
vendored
Normal file
@ -0,0 +1,379 @@
|
||||
<?php
|
||||
/**
|
||||
* File responsible for announcements.
|
||||
*
|
||||
* This is used to display information about limited events, such as Black Friday.
|
||||
*
|
||||
* @package ThemeIsleSDK
|
||||
* @subpackage Modules
|
||||
* @copyright Copyright (c) 2017, Marius Cristea
|
||||
* @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
|
||||
* @since 3.3.0
|
||||
*/
|
||||
namespace ThemeisleSDK\Modules;
|
||||
|
||||
use ThemeisleSDK\Common\Abstract_Module;
|
||||
use ThemeisleSDK\Loader;
|
||||
use ThemeisleSDK\Product;
|
||||
|
||||
/**
|
||||
* Announcement module for the ThemeIsle SDK.
|
||||
*/
|
||||
class Announcements extends Abstract_Module {
|
||||
|
||||
/**
|
||||
* Holds the timeline for the announcements.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $timeline = array(
|
||||
'black_friday' => array(
|
||||
'start' => '2024-11-25 00:00:00',
|
||||
'end' => '2024-12-03 23:59:59',
|
||||
'rendered' => false,
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Holds the option prefix for the announcements.
|
||||
*
|
||||
* This is used to store the dismiss date for each announcement.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $option_prefix = 'themeisle_sdk_announcement_';
|
||||
|
||||
/**
|
||||
* Holds the time for the current request.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $time = '';
|
||||
|
||||
/**
|
||||
* Check if the module can be loaded.
|
||||
*
|
||||
* @param Product $product Product data.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function can_load( $product ) {
|
||||
if ( $this->is_from_partner( $product ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the module for the selected product.
|
||||
*
|
||||
* @param Product $product Product data.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function load( $product ) {
|
||||
if ( ! current_user_can( 'install_plugins' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->product = $product;
|
||||
|
||||
add_action( 'admin_init', array( $this, 'load_announcements' ) );
|
||||
add_filter( 'themeisle_sdk_active_announcements', array( $this, 'get_active_announcements' ) );
|
||||
add_filter( 'themeisle_sdk_announcements', array( $this, 'get_announcements_for_plugins' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all valid announcements.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function load_announcements() {
|
||||
$active = $this->get_active_announcements();
|
||||
|
||||
if ( empty( $active ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( $active as $announcement ) {
|
||||
|
||||
$method = $announcement . '_notice_render';
|
||||
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
add_action( 'admin_notices', array( $this, $method ) );
|
||||
}
|
||||
}
|
||||
|
||||
// Load the ajax handler.
|
||||
add_action( 'wp_ajax_themeisle_sdk_dismiss_announcement', array( $this, 'disable_notification_ajax' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all active announcements.
|
||||
*
|
||||
* @return array List of active announcements.
|
||||
*/
|
||||
public function get_active_announcements() {
|
||||
$active = array();
|
||||
|
||||
foreach ( self::$timeline as $announcement_slug => $dates ) {
|
||||
if ( $this->is_active( $dates ) && $this->can_show( $announcement_slug, $dates ) ) {
|
||||
$active[] = $announcement_slug;
|
||||
}
|
||||
}
|
||||
|
||||
return $active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all announcements along with plugin specific data.
|
||||
*
|
||||
* @return array List of announcements.
|
||||
*/
|
||||
public function get_announcements_for_plugins() {
|
||||
|
||||
$announcements = array();
|
||||
|
||||
foreach ( self::$timeline as $announcement => $dates ) {
|
||||
$announcements[ $announcement ] = $dates;
|
||||
|
||||
if ( false !== strpos( $announcement, 'black_friday' ) ) {
|
||||
$announcements[ $announcement ]['active'] = $this->is_active( $dates );
|
||||
|
||||
// Dashboard banners URLs.
|
||||
$announcements[ $announcement ]['feedzy_dashboard_url'] = tsdk_utmify( 'https://themeisle.com/plugins/feedzy-rss-feeds/blackfriday/', 'bfcm24', 'dashboard' );
|
||||
$announcements[ $announcement ]['neve_dashboard_url'] = tsdk_utmify( 'https://themeisle.com/themes/neve/blackfriday/', 'bfcm24', 'dashboard' );
|
||||
$announcements[ $announcement ]['otter_dashboard_url'] = tsdk_utmify( 'https://themeisle.com/plugins/otter-blocks/blackfriday/', 'bfcm24', 'dashboard' );
|
||||
|
||||
// Customizer banners URLs.
|
||||
$announcements[ $announcement ]['hestia_customizer_url'] = tsdk_utmify( 'https://themeisle.com/black-friday/', 'bfcm24', 'hestiacustomizer' );
|
||||
$announcements[ $announcement ]['neve_customizer_url'] = tsdk_utmify( 'https://themeisle.com/black-friday/', 'bfcm24', 'nevecustomizer' );
|
||||
|
||||
// Banners urgency text.
|
||||
$remaining_time = $this->get_remaining_time_for_event( $dates['end'] );
|
||||
$announcements[ $announcement ]['remaining_time'] = $remaining_time;
|
||||
$announcements[ $announcement ]['urgency_text'] = ! empty( $remaining_time ) ? 'Hurry up! Only ' . $remaining_time . ' left.' : '';
|
||||
}
|
||||
}
|
||||
|
||||
return apply_filters( 'themeisle_sdk_announcements_data', $announcements );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the announcement data.
|
||||
*
|
||||
* @param string $announcement The announcement to get the data for.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_announcement_data( $announcement ) {
|
||||
return ! empty( $announcement ) && is_string( $announcement ) && isset( self::$timeline[ $announcement ] ) ? self::$timeline[ $announcement ] : array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the announcement has an active timeline.
|
||||
*
|
||||
* @param array $dates The announcement to check.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_active( $dates ) {
|
||||
|
||||
if ( empty( $this->time ) ) {
|
||||
$this->time = current_time( 'Y-m-d' );
|
||||
}
|
||||
|
||||
$start = isset( $dates['start'] ) ? $dates['start'] : null;
|
||||
$end = isset( $dates['end'] ) ? $dates['end'] : null;
|
||||
|
||||
if ( $start && $end ) {
|
||||
return $start <= $this->time && $this->time <= $end;
|
||||
} elseif ( $start ) {
|
||||
return $this->time >= $start;
|
||||
} elseif ( $end ) {
|
||||
return $this->time <= $end;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the remaining time for the event in a human readable format.
|
||||
*
|
||||
* @param string $end_date The end date for event.
|
||||
* @return string Remaining time for the event.
|
||||
*/
|
||||
public function get_remaining_time_for_event( $end_date ) {
|
||||
if ( empty( $end_date ) || ! is_string( $end_date ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
try {
|
||||
$end_date = new \DateTime( $end_date, new \DateTimeZone( 'GMT' ) );
|
||||
$current_date = new \DateTime( 'now', new \DateTimeZone( 'GMT' ) );
|
||||
$diff = $end_date->diff( $current_date );
|
||||
|
||||
if ( $diff->days > 0 ) {
|
||||
return $diff->days === 1 ? $diff->format( '%a day' ) : $diff->format( '%a days' );
|
||||
}
|
||||
|
||||
if ( $diff->h > 0 ) {
|
||||
return $diff->h === 1 ? $diff->format( '%h hour' ) : $diff->format( '%h hours' );
|
||||
}
|
||||
|
||||
if ( $diff->i > 0 ) {
|
||||
return $diff->i === 1 ? $diff->format( '%i minute' ) : $diff->format( '%i minutes' );
|
||||
}
|
||||
|
||||
return $diff->s === 1 ? $diff->format( '%s second' ) : $diff->format( '%s seconds' );
|
||||
} catch ( \Exception $e ) {
|
||||
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
|
||||
error_log( $e->getMessage() ); // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the announcement can be shown.
|
||||
*
|
||||
* @param string $announcement_slug The announcement to check.
|
||||
* @param array $dates The announcement to check.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function can_show( $announcement_slug, $dates ) {
|
||||
$dismiss_date = get_option( $this->option_prefix . $announcement_slug, false );
|
||||
|
||||
if ( false === $dismiss_date ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If the start date is after the dismiss date, show the notice.
|
||||
$start = isset( $dates['start'] ) ? $dates['start'] : null;
|
||||
if ( $start && $dismiss_date < $start ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the notification via ajax.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function disable_notification_ajax() {
|
||||
if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_key( $_POST['nonce'] ), 'dismiss_themeisle_event_notice' ) ) {
|
||||
wp_die( 'Invalid nonce! Refresh the page and try again.' );
|
||||
}
|
||||
|
||||
if ( ! isset( $_POST['announcement'] ) || ! is_string( $_POST['announcement'] ) ) {
|
||||
wp_die( 'Invalid announcement! Refresh the page and try again.' );
|
||||
}
|
||||
|
||||
$announcement = sanitize_key( $_POST['announcement'] );
|
||||
|
||||
update_option( $this->option_prefix . $announcement, current_time( 'Y-m-d' ) );
|
||||
wp_die( 'success' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the Black Friday notice.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function black_friday_notice_render() {
|
||||
|
||||
// Prevent the notice from being rendered twice.
|
||||
if ( self::$timeline['black_friday']['rendered'] ) {
|
||||
return;
|
||||
}
|
||||
self::$timeline['black_friday']['rendered'] = true;
|
||||
|
||||
$product_names = array();
|
||||
|
||||
foreach ( Loader::get_products() as $product ) {
|
||||
$slug = $product->get_slug();
|
||||
|
||||
// Do not add if the contains the string 'pro'.
|
||||
if ( strpos( $slug, 'pro' ) !== false ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$product_names[] = $product->get_name();
|
||||
}
|
||||
|
||||
// Randomize the products and get only 4.
|
||||
shuffle( $product_names );
|
||||
$product_names = array_slice( $product_names, 0, 4 );
|
||||
|
||||
?>
|
||||
<style>
|
||||
.themeisle-sale {
|
||||
display: flex;
|
||||
}
|
||||
</style>
|
||||
<div class="themeisle-sale notice notice-info is-dismissible" data-announcement="black_friday">
|
||||
<img src="<?php echo esc_url_raw( $this->get_sdk_uri() . 'assets/images/themeisle-logo.svg' ); ?>" />
|
||||
<p>
|
||||
<strong>Themeisle Black Friday Sale is Live!</strong> - Enjoy Maximum Savings on <?php echo esc_html( implode( ', ', $product_names ) ); ?>.
|
||||
<a href="<?php echo esc_url_raw( tsdk_utmify( 'https://themeisle.com/blackfriday/', 'bfcm24', 'globalnotice' ) ); ?>" target="_blank">Learn more</a>
|
||||
<span class="themeisle-sale-error"></span>
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript" data-origin="themeisle-sdk">
|
||||
window.document.addEventListener('DOMContentLoaded', () => {
|
||||
const observer = new MutationObserver((mutationsList, observer) => {
|
||||
for(let mutation of mutationsList) {
|
||||
if (mutation.type === 'childList') {
|
||||
const container = document.querySelector('.themeisle-sale.notice');
|
||||
const button = container?.querySelector('button');
|
||||
if ( button ) {
|
||||
button.addEventListener('click', e => {
|
||||
e.preventDefault();
|
||||
fetch('<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
body: new URLSearchParams({
|
||||
action: 'themeisle_sdk_dismiss_announcement',
|
||||
nonce: '<?php echo esc_attr( wp_create_nonce( 'dismiss_themeisle_event_notice' ) ); ?>',
|
||||
announcement: container.dataset.announcement
|
||||
})
|
||||
})
|
||||
.then(response => response.text())
|
||||
.then(response => {
|
||||
if (!response?.includes('success')) {
|
||||
document.querySelector('.themeisle-sale-error').innerHTML = response;
|
||||
return;
|
||||
}
|
||||
|
||||
document.querySelectorAll('.themeisle-sale.notice').forEach(el => {
|
||||
el.classList.add('hidden');
|
||||
setTimeout(() => {
|
||||
el.remove();
|
||||
}, 800);
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
document.querySelector('.themeisle-sale-error').innerHTML = error;
|
||||
});
|
||||
});
|
||||
observer.disconnect();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
@ -251,25 +251,19 @@ class Logger extends Abstract_Module {
|
||||
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,
|
||||
)
|
||||
);
|
||||
$tracking_handler = apply_filters( 'themeisle_sdk_dependency_script_handler', 'tracking' );
|
||||
if ( ! empty( $tracking_handler ) ) {
|
||||
do_action( 'themeisle_sdk_dependency_enqueue_script', 'tracking' );
|
||||
wp_localize_script(
|
||||
$tracking_handler,
|
||||
'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
|
||||
|
@ -33,6 +33,14 @@ class Promotions extends Abstract_Module {
|
||||
*/
|
||||
private $promotions = array();
|
||||
|
||||
/**
|
||||
* Holds the values of the promotions that are not allowed to be shown.
|
||||
* Can be filtered by each product.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $dissallowed_promotions = array();
|
||||
|
||||
/**
|
||||
* Option key for promos.
|
||||
*
|
||||
@ -113,6 +121,8 @@ class Promotions extends Abstract_Module {
|
||||
|
||||
$this->promotions = $this->get_promotions();
|
||||
|
||||
$this->dissallowed_promotions = apply_filters( $product->get_key() . '_dissallowed_promotions', array() );
|
||||
|
||||
foreach ( $this->promotions as $slug => $data ) {
|
||||
if ( ! in_array( $slug, $promotions_to_load, true ) ) {
|
||||
unset( $this->promotions[ $slug ] );
|
||||
@ -173,6 +183,19 @@ class Promotions extends Abstract_Module {
|
||||
* @return void
|
||||
*/
|
||||
public function register_reference() {
|
||||
if ( ! current_user_can( 'activate_plugins' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $_GET['plugin'] ) || ! isset( $_GET['_wpnonce'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$plugin = rawurldecode( $_GET['plugin'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
||||
if ( wp_verify_nonce( $_GET['_wpnonce'], 'activate-plugin_' . $plugin ) === false ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isset( $_GET['reference_key'] ) ) {
|
||||
update_option( 'otter_reference_key', sanitize_key( $_GET['reference_key'] ) );
|
||||
}
|
||||
@ -269,12 +292,12 @@ class Promotions extends Abstract_Module {
|
||||
|
||||
/**
|
||||
* 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;
|
||||
@ -493,6 +516,14 @@ class Promotions extends Abstract_Module {
|
||||
$return = array_merge( $return, $this->promotions[ $slug ] );
|
||||
}
|
||||
|
||||
$return = array_filter(
|
||||
$return,
|
||||
function ( $value, $key ) {
|
||||
return ! in_array( $key, $this->dissallowed_promotions, true );
|
||||
},
|
||||
ARRAY_FILTER_USE_BOTH
|
||||
);
|
||||
|
||||
return array_keys( $return );
|
||||
}
|
||||
|
||||
|
142
wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Script_loader.php
vendored
Normal file
142
wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Script_loader.php
vendored
Normal file
@ -0,0 +1,142 @@
|
||||
<?php
|
||||
/**
|
||||
* The dependency model class for ThemeIsle SDK
|
||||
*
|
||||
* @package ThemeIsleSDK
|
||||
* @subpackage Modules
|
||||
* @copyright Copyright (c) 2017, Marius Cristea
|
||||
* @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
|
||||
* @since 3.3
|
||||
*/
|
||||
|
||||
namespace ThemeisleSDK\Modules;
|
||||
|
||||
use ThemeisleSDK\Common\Abstract_Module;
|
||||
use ThemeisleSDK\Product;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Script loader module for ThemeIsle SDK.
|
||||
*/
|
||||
class Script_Loader extends Abstract_Module {
|
||||
/**
|
||||
* Check if we should load the module for this product.
|
||||
*
|
||||
* @param Product $product Product to load the module for.
|
||||
*
|
||||
* @return bool Should we load ?
|
||||
*/
|
||||
public function can_load( $product ) {
|
||||
if ( apply_filters( 'themeisle_sdk_ran_promos', false ) === true ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( $this->is_from_partner( $product ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load module logic.
|
||||
*
|
||||
* @param Product $product Product to load.
|
||||
*
|
||||
* @return Dependancy Module object.
|
||||
*/
|
||||
public function load( $product ) {
|
||||
$this->product = $product;
|
||||
$this->setup_actions();
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup actions.
|
||||
*/
|
||||
private function setup_actions() {
|
||||
add_filter( 'themeisle_sdk_dependency_script_handler', [ $this, 'get_script_handler' ], 10, 1 );
|
||||
add_action( 'themeisle_sdk_dependency_enqueue_script', [ $this, 'enqueue_script' ], 10, 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the script handler.
|
||||
*
|
||||
* @param string $slug The slug of the script.
|
||||
*
|
||||
* @return string The script handler. Empty if slug is not a string or not implemented.
|
||||
*/
|
||||
public function get_script_handler( $slug ) {
|
||||
if ( ! is_string( $slug ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( 'tracking' !== $slug && 'survey' !== $slug ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return apply_filters( 'themeisle_sdk_dependency_script_handler_name', 'themeisle_sdk_' . $slug . '_script', $slug );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue the script.
|
||||
*
|
||||
* @param string $slug The slug of the script.
|
||||
*/
|
||||
public function enqueue_script( $slug ) {
|
||||
$handler = apply_filters( 'themeisle_sdk_dependency_script_handler', $slug );
|
||||
if ( empty( $handler ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'tracking' === $slug ) {
|
||||
$this->load_tracking( $handler );
|
||||
} elseif ( 'survey' === $slug ) {
|
||||
$this->load_survey( $handler );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the survey script.
|
||||
*
|
||||
* @param string $handler The script handler.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function load_survey( $handler ) {
|
||||
global $themeisle_sdk_max_path;
|
||||
$asset_file = require $themeisle_sdk_max_path . '/assets/js/build/survey/survey_deps.asset.php';
|
||||
|
||||
wp_enqueue_script(
|
||||
$handler,
|
||||
$this->get_sdk_uri() . 'assets/js/build/survey/survey_deps.js',
|
||||
$asset_file['dependencies'],
|
||||
$asset_file['version'],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the tracking script.
|
||||
*
|
||||
* @param string $handler The script handler.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function load_tracking( $handler ) {
|
||||
global $themeisle_sdk_max_path;
|
||||
$asset_file = require $themeisle_sdk_max_path . '/assets/js/build/tracking/tracking.asset.php';
|
||||
|
||||
wp_enqueue_script(
|
||||
$handler,
|
||||
$this->get_sdk_uri() . 'assets/js/build/tracking/tracking.js',
|
||||
$asset_file['dependencies'],
|
||||
$asset_file['version'],
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ $files_to_load = [
|
||||
$themeisle_library_path . '/src/Common/Abstract_module.php',
|
||||
$themeisle_library_path . '/src/Common/Module_factory.php',
|
||||
|
||||
$themeisle_library_path . '/src/Modules/Script_loader.php',
|
||||
$themeisle_library_path . '/src/Modules/Dashboard_widget.php',
|
||||
$themeisle_library_path . '/src/Modules/Rollback.php',
|
||||
$themeisle_library_path . '/src/Modules/Uninstall_feedback.php',
|
||||
@ -36,6 +37,7 @@ $files_to_load = [
|
||||
$themeisle_library_path . '/src/Modules/Welcome.php',
|
||||
$themeisle_library_path . '/src/Modules/Compatibilities.php',
|
||||
$themeisle_library_path . '/src/Modules/About_us.php',
|
||||
$themeisle_library_path . '/src/Modules/Announcements.php',
|
||||
];
|
||||
|
||||
$files_to_load = array_merge( $files_to_load, apply_filters( 'themeisle_sdk_required_files', [] ) );
|
||||
|
@ -128,23 +128,23 @@
|
||||
},
|
||||
{
|
||||
"name": "codeinwp/themeisle-sdk",
|
||||
"version": "3.3.11",
|
||||
"version_normalized": "3.3.11.0",
|
||||
"version": "3.3.15",
|
||||
"version_normalized": "3.3.15.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Codeinwp/themeisle-sdk.git",
|
||||
"reference": "583c474d8b5a8d12592f4a78ab8fa335aaf42fc0"
|
||||
"reference": "eb06ae687ee39cbcc316936db1349b8b1092e32f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/583c474d8b5a8d12592f4a78ab8fa335aaf42fc0",
|
||||
"reference": "583c474d8b5a8d12592f4a78ab8fa335aaf42fc0",
|
||||
"url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/eb06ae687ee39cbcc316936db1349b8b1092e32f",
|
||||
"reference": "eb06ae687ee39cbcc316936db1349b8b1092e32f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require-dev": {
|
||||
"codeinwp/phpcs-ruleset": "dev-main"
|
||||
},
|
||||
"time": "2023-12-12T10:06:27+00:00",
|
||||
"time": "2024-03-26T09:05:18+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php return array(
|
||||
'root' => array(
|
||||
'name' => 'codeinwp/wp-menu-icons',
|
||||
'pretty_version' => 'v0.13.8',
|
||||
'version' => '0.13.8.0',
|
||||
'reference' => '3d0f5fe65015775d09b4cd6d7db74aa0367430da',
|
||||
'pretty_version' => 'v0.13.10',
|
||||
'version' => '0.13.10.0',
|
||||
'reference' => 'c952a9d2f3db0616568acf8ac3f6eba9a94024c0',
|
||||
'type' => 'wordpress-plugin',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
@ -38,18 +38,18 @@
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'codeinwp/themeisle-sdk' => array(
|
||||
'pretty_version' => '3.3.11',
|
||||
'version' => '3.3.11.0',
|
||||
'reference' => '583c474d8b5a8d12592f4a78ab8fa335aaf42fc0',
|
||||
'pretty_version' => '3.3.15',
|
||||
'version' => '3.3.15.0',
|
||||
'reference' => 'eb06ae687ee39cbcc316936db1349b8b1092e32f',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../codeinwp/themeisle-sdk',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'codeinwp/wp-menu-icons' => array(
|
||||
'pretty_version' => 'v0.13.8',
|
||||
'version' => '0.13.8.0',
|
||||
'reference' => '3d0f5fe65015775d09b4cd6d7db74aa0367430da',
|
||||
'pretty_version' => 'v0.13.10',
|
||||
'version' => '0.13.10.0',
|
||||
'reference' => 'c952a9d2f3db0616568acf8ac3f6eba9a94024c0',
|
||||
'type' => 'wordpress-plugin',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
|
Loading…
Reference in New Issue
Block a user