parent_file) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id) { return; } $plugin = 'elementor/elementor.php'; if ($this->is_elementor_installed()) { if (!current_user_can('activate_plugins')) { return; } $activation_url = wp_nonce_url('plugins.php?action=activate&plugin=' . $plugin . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $plugin); $admin_message = '

' . esc_html__('Ops! Hash Elements is not working because you need to activate the Elementor plugin first.', 'hash-elements') . '

'; $admin_message .= '

' . sprintf('%s', $activation_url, esc_html__('Activate Elementor Now', 'hash-elements')) . '

'; } else { if (!current_user_can('install_plugins')) { return; } $install_url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=elementor'), 'install-plugin_elementor'); $admin_message = '

' . esc_html__('Ops! Hash Elements is not working because you need to install the Elementor plugin', 'hash-elements') . '

'; $admin_message .= '

' . sprintf('%s', $install_url, esc_html__('Install Elementor Now', 'hash-elements')) . '

'; } echo '
' . $admin_message . '
'; } /** * Check if theme has elementor installed * * @return boolean */ public function is_elementor_installed() { $file_path = 'elementor/elementor.php'; $installed_plugins = get_plugins(); return isset($installed_plugins[$file_path]); } public function admin_notice() { add_action('admin_notices', array($this, 'admin_notice_content')); } public function admin_notice_content() { if (!$this->is_dismissed('review') && !empty(get_option('hash_elements_first_activation')) && time() > get_option('hash_elements_first_activation') + 15 * DAY_IN_SECONDS) { $this->review_notice(); } } public static function is_dismissed($notice) { $dismissed = get_option('hash_elements_dismissed_notices', array()); // Handle legacy user meta $dismissed_meta = get_user_meta(get_current_user_id(), 'hash_elements_dismissed_notices', true); if (is_array($dismissed_meta)) { if (array_diff($dismissed_meta, $dismissed)) { $dismissed = array_merge($dismissed, $dismissed_meta); update_option('hash_elements_dismissed_notices', $dismissed); } if (!is_multisite()) { // Don't delete on multisite to avoid the notices to appear in other sites. delete_user_meta(get_current_user_id(), 'hash_elements_dismissed_notices'); } } return in_array($notice, $dismissed); } public function review_notice() { ?>
dismiss_button('review'); ?>

', '', '' ); ?>

 
%s', esc_url(wp_nonce_url(add_query_arg('he-hide-notice', $name), $name, 'hash_elements_notice_nonce')), esc_html__('Dismiss this notice.', 'hash-elements')); } public function hash_elements_register_backend_assets() { wp_enqueue_style('he-admin-style', HASHELE_URL . '/assets/css/admin-styles.css', array(), HASHELE_VERSION); } } } /** * Returns instanse of the plugin class. * * @since 1.0.0 * @return object */ if (!function_exists('hash_elements')) { function hash_elements() { return Hash_Elements::get_instance(); } } hash_elements();