$plugin_info) { $plugin_info = wp_parse_args($plugin_info, array( 'name' => '', 'active_filename' => '', )); if ($plugin_info['active_filename']) { $active_file_name = $plugin_info['active_filename']; } else { $active_file_name = $plugin_slug . '/' . $plugin_slug . '.php'; } if (!is_plugin_active($active_file_name)) { $actions['recommend_plugins'] = 'active'; } } } $actions = apply_filters('envo_extra_get_actions_required', $actions); $hide_by_click = get_option('envo_extra_actions_dismiss'); if (!is_array($hide_by_click)) { $hide_by_click = array(); } $n_active = $n_dismiss = 0; $number_notice = 0; foreach ($actions as $k => $v) { if (!isset($hide_by_click[$k])) { $hide_by_click[$k] = false; } if ($v == 'active') { $n_active ++; $number_notice ++; if ($hide_by_click[$k]) { if ($hide_by_click[$k] == 'hide') { $number_notice --; } } } else if ($v == 'dismiss') { $n_dismiss ++; } } $return = array( 'actions' => $actions, 'number_actions' => count($actions), 'number_active' => $n_active, 'number_dismiss' => $n_dismiss, 'hide_by_click' => $hide_by_click, 'number_notice' => $number_notice, ); if ($return['number_notice'] < 0) { $return['number_notice'] = 0; } return $return; } endif; add_action('switch_theme', 'envo_extra_reset_actions_required'); function envo_extra_reset_actions_required() { delete_option('envo_extra_actions_dismiss'); } if (!function_exists('envo_extra_admin_scripts')) : /** * Enqueue scripts for admin page only: Theme info page */ function envo_extra_admin_scripts($hook) { wp_enqueue_style('enwoo-admin-css', ENVO_EXTRA_PLUGIN_URL . '/css/admin/admin.css'); if ($hook === 'appearance_page_et_enwoo') { // Add recommend plugin css wp_enqueue_style('plugin-install'); wp_enqueue_script('plugin-install'); wp_enqueue_script('updates'); add_thickbox(); } } endif; add_action('admin_enqueue_scripts', 'envo_extra_admin_scripts'); add_action('admin_menu', 'envo_extra_theme_info'); function envo_extra_theme_info() { $actions = envo_extra_get_actions_required(); $number_count = $actions['number_notice']; if ($number_count > 0) { /* translators: %1$s: replaced with number (counter) */ $update_label = sprintf(_n('%1$s action required', '%1$s actions required', $number_count, 'envo-extra'), $number_count); $count = "" . number_format_i18n($number_count) . ""; /* translators: %s: replaced with number (counter) */ $menu_title = sprintf(esc_html__('Enwoo theme %s', 'envo-extra'), $count); } else { $menu_title = esc_html__('Enwoo theme', 'envo-extra'); } add_theme_page(esc_html__('Enwoo dashboard', 'envo-extra'), $menu_title, 'edit_theme_options', 'et_enwoo', 'envo_extra_theme_info_page'); } /** * Add admin notice when active theme, just show one time * * @return bool|null */ add_action('admin_notices', 'envo_extra_admin_notice'); function envo_extra_admin_notice() { global $current_user; $user_id = $current_user->ID; $theme_data = wp_get_theme(); if (!get_user_meta($user_id, esc_html($theme_data->get('TextDomain')) . '_notice_ignore')) { ?>
Welcome page', 'envo-extra'), esc_html($theme_data->Name), esc_url(admin_url('themes.php?page=et_enwoo'))); printf('', '?' . esc_html($theme_data->get('TextDomain')) . '_notice_ignore=0'); ?>
'; echo wp_kses_post($plugin_desc); echo '
'; echo ''; echo '' . esc_html__('Details', 'envo-extra') . ''; echo '