$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( 'bulk_get_actions_required', $actions ); $hide_by_click = get_option( 'bulk_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', 'bulk_reset_actions_required' ); function bulk_reset_actions_required() { delete_option( 'bulk_actions_dismiss' ); } if ( !function_exists( 'bulk_admin_scripts' ) ) : /** * Enqueue scripts for admin page only: Theme info page */ function bulk_admin_scripts( $hook ) { wp_enqueue_style( 'bulk-admin-css', get_template_directory_uri() . '/css/admin.css' ); if ( $hook === 'appearance_page_et_bulk' ) { // 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', 'bulk_admin_scripts' ); add_action( 'admin_menu', 'bulk_theme_info' ); function bulk_theme_info() { $actions = bulk_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, 'bulk' ), $number_count ); $count = "" . number_format_i18n( $number_count ) . ""; /* translators: %s: replaced with number (counter) */ $menu_title = sprintf( esc_html__( 'Bulk theme %s', 'bulk' ), $count ); } else { $menu_title = esc_html__( 'Bulk theme', 'bulk' ); } add_theme_page( esc_html__( 'Bulk dashboard', 'bulk' ), $menu_title, 'edit_theme_options', 'et_bulk', 'bulk_theme_info_page' ); } /** * Add admin notice when active theme, just show one time * * @return bool|null */ add_action( 'admin_notices', 'bulk_admin_notice' ); function bulk_admin_notice() { if ( !function_exists( 'bulk_get_actions_required' ) ) { return false; } // $actions = bulk_get_actions_required(); // $number_action = $actions['number_notice']; // if ( $number_action > 0 ) { 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' ) ) { ?>

Name ), esc_html( $theme_data->Version ) ); ?>

Welcome page', 'bulk' ), esc_html( $theme_data->Name ), esc_url( admin_url( 'themes.php?page=et_bulk' ) ) ); printf( '', '?' . esc_html( $theme_data->get( 'TextDomain' ) ) . '_notice_ignore=0' ); ?>

Name ) ) ?>

ID; /* If user clicks to ignore the notice, add that to their user meta */ if ( isset( $_GET[ esc_html( $theme_data->get( 'TextDomain' ) ) . '_notice_ignore' ] ) && '0' == $_GET[ esc_html( $theme_data->get( 'TextDomain' ) ) . '_notice_ignore' ] ) { add_user_meta( $user_id, esc_html( $theme_data->get( 'TextDomain' ) ) . '_notice_ignore', 'true', true ); } } function bulk_render_recommend_plugins( $recommend_plugins = array() ) { foreach ( $recommend_plugins as $plugin_slug => $plugin_info ) { $plugin_info = wp_parse_args( $plugin_info, array( 'name' => '', 'active_filename' => '', 'description' => '', ) ); $plugin_name = $plugin_info[ 'name' ]; $plugin_desc = $plugin_info[ 'description' ]; $status = is_dir( WP_PLUGIN_DIR . '/' . $plugin_slug ); $button_class = 'install-now button'; 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 ) ) { $button_txt = __( 'Install Now', 'bulk' ); if ( !$status ) { $install_url = wp_nonce_url( add_query_arg( array( 'action' => 'install-plugin', 'plugin' => $plugin_slug ), network_admin_url( 'update.php' ) ), 'install-plugin_' . $plugin_slug ); } else { $install_url = add_query_arg( array( 'action' => 'activate', 'plugin' => rawurlencode( $active_file_name ), 'plugin_status' => 'all', 'paged' => '1', '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $active_file_name ), ), network_admin_url( 'plugins.php' ) ); $button_class = 'activate-now button-primary'; $button_txt = __( 'Activate', 'bulk' ); } $detail_link = add_query_arg( array( 'tab' => 'plugin-information', 'plugin' => $plugin_slug, 'TB_iframe' => 'true', 'width' => '772', 'height' => '349', ), network_admin_url( 'plugin-install.php' ) ); echo '
'; echo '

'; echo esc_html( $plugin_name ); echo '

'; echo '

'; echo wp_kses_post( $plugin_desc ); echo '

'; echo '

' . esc_html( $button_txt ) . '

'; echo '' . esc_html__( 'Details', 'bulk' ) . ''; echo '
'; } } } function bulk_admin_dismiss_actions() { // Action for dismiss if ( isset( $_GET[ 'bulk_action_notice' ] ) ) { $actions_dismiss = get_option( 'bulk_actions_dismiss' ); if ( !is_array( $actions_dismiss ) ) { $actions_dismiss = array(); } $action_key = stripslashes( $_GET[ 'bulk_action_notice' ] ); if ( isset( $actions_dismiss[ $action_key ] ) && $actions_dismiss[ $action_key ] == 'hide' ) { $actions_dismiss[ $action_key ] = 'show'; } else { $actions_dismiss[ $action_key ] = 'hide'; } update_option( 'bulk_actions_dismiss', $actions_dismiss ); $url = $_SERVER[ 'REQUEST_URI' ]; $url = remove_query_arg( 'bulk_action_notice', $url ); wp_redirect( $url ); die(); } // Action for copy options if ( isset( $_POST[ 'copy_from' ] ) && isset( $_POST[ 'copy_to' ] ) ) { $from = sanitize_text_field( $_POST[ 'copy_from' ] ); $to = sanitize_text_field( $_POST[ 'copy_to' ] ); if ( $from && $to ) { $mods = get_option( "theme_mods_" . $from ); update_option( "theme_mods_" . $to, $mods ); $url = $_SERVER[ 'REQUEST_URI' ]; $url = add_query_arg( array( 'copied' => 1 ), $url ); wp_redirect( $url ); die(); } } } add_action( 'admin_init', 'bulk_admin_dismiss_actions' ); add_action( 'bulk_recommended_title', 'bulk_recommended_title_construct' ); function bulk_recommended_title_construct() { // Check for current viewing tab $tab = null; if ( isset( $_GET[ 'tab' ] ) ) { $tab = $_GET[ 'tab' ]; } else { $tab = null; } $actions_r = bulk_get_actions_required(); $number_action = $actions_r[ 'number_notice' ]; $actions = $actions_r[ 'actions' ]; ?> 0 ) ? "{$number_action}" : ''; ?>

Name ), esc_html( $theme_data->Version ) ); ?>

Description ); ?>
Theme Screenshot

Name ) ); ?>

'; $select .= ''; $select .= ''; $select .= ''; $select .=''; $select_2 = ''; echo $select . ' to ' . $select_2; ?>

0 ) { ?> '', 'page_template' ) ) ?>

' . esc_html__( 'documentation', 'bulk' ) . '' ); ?>