'main.php', 'gallery-slider-for-woocommerce' => 'woo-gallery-slider.php', 'post-carousel' => 'main.php', 'easy-accordion-free' => 'plugin-main.php', 'logo-carousel-free' => 'main.php', 'location-weather' => 'main.php', 'woo-quickview' => 'woo-quick-view.php', 'wp-expand-tabs-free' => 'plugin-main.php', ); /** * Welcome pages * * @var array */ public $pages = array( 'pcp_help', ); /** * Not show this plugin list. * * @var array */ protected static $not_show_plugin_list = array( 'aitasi-coming-soon', 'latest-posts', 'widget-post-slider', 'post-carousel', 'easy-lightbox-wp' ); /** * Easy_Accordion_Free_Help construct function. */ public function __construct() { add_action( 'admin_menu', array( $this, 'help_admin_menu' ), 20 ); $page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';// @codingStandardsIgnoreLine if ( 'pcp_help' !== $page ) { return; } add_action( 'admin_print_scripts', array( $this, 'disable_admin_notices' ) ); add_action( 'spf_enqueue', array( $this, 'help_page_enqueue_scripts' ) ); } /** * Main help page Instance * * @static * @return self Main instance */ public static function instance() { if ( is_null( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Help_page_enqueue_scripts function. * * @return void */ public function help_page_enqueue_scripts() { wp_enqueue_style( 'sp-post-carousel-help', SP_PC_URL . 'admin/help-page/css/help-page.min.css', array(), SP_PC_VERSION ); wp_enqueue_style( 'sp-post-carousel-help-fontello', SP_PC_URL . 'admin/help-page/css/fontello.min.css', array(), SP_PC_VERSION ); wp_enqueue_script( 'sp-post-carousel-help', SP_PC_URL . 'admin/help-page/js/help-page.min.js', array(), SP_PC_VERSION, true ); } /** * Add admin menu. * * @return void */ public function help_admin_menu() { // add_submenu_page( // 'edit.php?post_type=sp_post_carousel', // __( 'Post Carousel', 'post-carousel' ), // 'Blocks NEW!', // 'manage_options', // 'edit.php?post_type=sp_post_carousel&page=pcp_help#blocks', // '', // 0 // ); // add_submenu_page( // 'edit.php?post_type=sp_post_carousel', // __( 'Post Carousel', 'post-carousel' ), // __( 'Saved Templates', 'post-carousel' ), // 'manage_options', // 'edit.php?post_type=sp_post_carousel&page=pcp_help#savedTemplate', // '', // 1 // ); add_submenu_page( 'edit.php?post_type=sp_post_carousel', __( 'Post Carousel', 'post-carousel' ), __( 'Settings', 'post-carousel' ), 'manage_options', 'edit.php?post_type=sp_post_carousel&page=pcp_help#settings', '', 20 ); add_submenu_page( 'edit.php?post_type=sp_post_carousel', __( 'Smart Post Show Help', 'post-carousel' ), __( 'Quick Start', 'post-carousel' ), 'manage_options', 'pcp_help', array( $this, 'help_page_callback', ), 0 ); add_submenu_page( 'edit.php?post_type=sp_post_carousel', __( 'Post Carousel', 'post-carousel' ), __( 'Lite vs Pro', 'post-carousel' ), 'manage_options', 'edit.php?post_type=sp_post_carousel&page=pcp_help#lite-vs-pro', '', 10 ); add_submenu_page( 'edit.php?post_type=sp_post_carousel', __( 'Upgrade to Pro', 'post-carousel' ), ' Upgrade to Pro ', 'manage_options', 'pcp_help', '__return_null', 80 ); } /** * Spspc_ajax_help_page function. * * @return void */ public function spspc_plugins_info_api_help_page() { $plugins_arr = get_transient( 'spspc_plugins' ); if ( false === $plugins_arr ) { $args = array( 'author' => 'shapedplugin', 'per_page' => '120', 'page' => '1', 'fields' => array( 'slug', 'name', 'version', 'downloaded', 'active_installs', 'last_updated', 'rating', 'num_ratings', 'short_description', 'author', 'icons', ), ); if ( ! function_exists( 'plugins_api' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; } $plugin_info = plugins_api( 'query_plugins', $args ); if ( ! is_wp_error( $plugin_info ) ) { $plugins_arr = array(); if ( isset( $plugin_info->plugins ) && ( count( $plugin_info->plugins ) > 0 ) ) { foreach ( $plugin_info->plugins as $pl ) { if ( ! in_array( $pl['slug'], self::$not_show_plugin_list, true ) ) { $plugins_arr[] = array( 'slug' => $pl['slug'], 'name' => $pl['name'], 'version' => $pl['version'], 'downloaded' => $pl['downloaded'], 'active_installs' => $pl['active_installs'], 'last_updated' => strtotime( $pl['last_updated'] ), 'rating' => $pl['rating'], 'num_ratings' => $pl['num_ratings'], 'short_description' => $pl['short_description'], 'icons' => $pl['icons']['2x'], ); } } } set_transient( 'spspc_plugins', $plugins_arr, 24 * HOUR_IN_SECONDS ); } } if ( is_array( $plugins_arr ) && ( count( $plugins_arr ) > 0 ) ) { $active_installs = array_column( $plugins_arr, 'active_installs' ); array_multisort( $active_installs, SORT_DESC, $plugins_arr ); foreach ( $plugins_arr as $plugin ) { $plugin_slug = $plugin['slug']; $plugin_icon = $plugin['icons']; if ( isset( self::$plugins[ $plugin_slug ] ) ) { $plugin_file = self::$plugins[ $plugin_slug ]; } else { $plugin_file = $plugin_slug . '.php'; } // Skip the plugin if it is not installed. if ( 'post-carousel' === $plugin_slug ) { continue; } $details_link = network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] . '&TB_iframe=true&width=745&height=550' ); ?>
'; if ( isset( $plugin['rating'], $plugin['num_ratings'] ) ) { ?>
$plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'], ) ); ?> ()
'; ?>
pages ) ) { // @codingStandardsIgnoreLine if ( isset( $wp_filter['user_admin_notices'] ) ) { unset( $wp_filter['user_admin_notices'] ); } if ( isset( $wp_filter['admin_notices'] ) ) { unset( $wp_filter['admin_notices'] ); } if ( isset( $wp_filter['all_admin_notices'] ) ) { unset( $wp_filter['all_admin_notices'] ); } } } /** * The Smart Post Show Help Callback. * * @return void */ public function help_page_callback() { add_thickbox(); $action = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : ''; $plugin = isset( $_GET['plugin'] ) ? sanitize_text_field( wp_unslash( $_GET['plugin'] ) ) : ''; $_wpnonce = isset( $_GET['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) : ''; if ( isset( $action, $plugin ) && ( 'activate' === $action ) && wp_verify_nonce( $_wpnonce, 'activate-plugin_' . $plugin ) && current_user_can( 'activate_plugins' ) ) { activate_plugin( $plugin, '', false, true ); } if ( isset( $action, $plugin ) && ( 'deactivate' === $action ) && wp_verify_nonce( $_wpnonce, 'deactivate-plugin_' . $plugin ) && current_user_can( 'deactivate_plugins' ) ) { deactivate_plugins( $plugin, '', false ); } ?>