__( 'About Flymag', 'flymag' ),
* // Page title.
* 'page_name' => __( 'About Flymag', 'flymag' ),
* // Main welcome title
* 'welcome_title' => sprintf( __( 'Welcome to %s! - Version ', 'flymag' ), 'FlyMag' ),
* // Main welcome content
* 'welcome_content' => sprintf( __( '%1$s is now installed and ready to use! Get ready to build something beautiful. We hope you enjoy it! We want to make sure you have the best experience using %2$s and that is why we gathered here all the necessary information for you. We hope you will enjoy using %3$s, as much as we enjoy creating great products.','flymag' ), 'FlyMag', 'FlyMag', 'FlyMag' ),
* //Tabs array.
* //
* // The key needs to be ONLY consisted from letters and underscores. If we want to define outside the class a function to render the tab,
* // the will be the name of the function which will be used to render the tab content.
* 'tabs' => array(
* 'getting_started' => __( 'Getting Started', 'flymag' ),
* 'recommended_actions' => __( 'Recommended Actions', 'flymag' ),
* 'recommended_plugins' => __( 'Recommended Plugins', 'flymag' ),
* 'child_themes' => __( 'Child themes', 'flymag' ),
* 'support' => __( 'Support', 'flymag' ),
* 'changelog' => __( 'Changelog', 'flymag' ),
* 'free_pro' => __( 'Free vs PRO', 'flymag' ),
* ),
* // Support content tab.
* 'support_content' => array(
* 'first' => array (
* 'title' => esc_html__( 'Contact Support','flymag' ),
* 'icon' => 'dashicons dashicons-sos',
* 'text' => esc_html__( 'We offer excellent support through our advanced ticketing system. Make sure to register your purchase before contacting support!','flymag' ),
* 'button_label' => esc_html__( 'Contact Support','flymag' ),
* 'button_link' => esc_url( 'https://pasal-ecommerce.com/contact/' ),
* 'is_button' => true,
* 'is_new_tab' => false
* ),
* ),
* // Getting started tab content.
* 'getting_started' => array(
* 'first_step' => array (
* 'title' => esc_html__( 'Step 1 - Implement recommended actions','flymag' ),
* 'text' => esc_html__( 'We have compiled a list of steps for you to take so we can ensure that the experience you have using one of our products is very easy to follow.','flymag' ),
* 'button_label' => esc_html__( 'Check recommended actions','flymag' ),
* 'button_link' => esc_url( admin_url( 'themes.php?page=flymag-welcome&tab=recommended_actions' ) ),
* 'is_button' => false,
* 'recommended_actions' => true
* ),
* ),
* // Child themes array.
* 'child_themes' => array(
* 'download_button_label' => 'Download',
* 'preview_button_label' => 'Live preview',
* 'content' => array(
* array(
* 'title' => 'Flymag child theme 1',
* 'image' => 'https://github.com/Codeinwp/zerif-lite/blob/production/inc/admin/welcome-screen/img/zblackbeard.jpg?raw=true',
* 'image_alt' => 'Image of the child theme',
* 'description' => 'Description',
* 'download_link' => 'Download link',
* 'preview_link' => 'Preview link',
* ),
* array(
* 'title' => 'Flymag child theme 2',
* 'image' => 'https://github.com/Codeinwp/zerif-lite/blob/production/inc/admin/welcome-screen/img/zblackbeard.jpg?raw=true',
* 'image_alt' => 'Image of the child theme',
* 'description' => 'Description',
* 'download_link' => 'Download link',
* 'preview_link' => 'Preview link',
* ),
* ),
* ),
* // Free vs PRO array.
* 'free_pro' => array(
* 'free_theme_name' => 'FlyMag',
* 'pro_theme_name' => 'FlyMag PRO',
* 'pro_theme_link' => 'https://pasal-ecommerce.com/themes/flymag-pro/',
* 'get_pro_theme_label' => sprintf( __( 'Get %s now!', 'flymag' ), 'FlyMag Pro' ),
* 'features' => array(
* array(
* 'title' => __( 'Mobile friendly', 'flymag' ),
* 'description' => __( 'Responsive layout. Works on every device.', 'flymag' ),
* 'is_in_lite' => 'true',
* 'is_in_pro' => 'true',
* ),
* array(
* 'title' => __( 'Unlimited color option', 'flymag' ),
* 'description' => __( 'You can change the colors of each section. You have unlimited options.', 'flymag' ),
* 'is_in_lite' => 'true',
* 'is_in_pro' => 'true',
* ),
* array(
* 'title' => __( 'Background image', 'flymag' ),
* 'description' => __( 'You can use any background image you want.', 'flymag' ),
* 'is_in_lite' => 'true',
* 'is_in_pro' => 'true',
* ),
* array(
* 'title' => __( 'Featured Area', 'flymag' ),
* 'description' => __( 'Have access to a new featured area.', 'flymag' ),
* 'is_in_lite' => 'false',
* 'is_in_pro' => 'true',
* ),
* array(
* 'title' => __( 'Footer credits', 'flymag' ),
* 'description' => '',
* 'is_in_lite' => 'false',
* 'is_in_pro' => 'true',
* ),
* array(
* 'title' => __( 'Extra widgets areas', 'flymag' ),
* 'description' => __( 'More widgets areas for your theme.', 'flymag' ),
* 'is_in_lite' => 'false',
* 'is_in_pro' => 'true',
* ),
* array(
* 'title' => __( 'Support', 'flymag' ),
* 'description' => __( 'You will benefit of our full support for any issues you have with the theme.', 'flymag' ),
* 'is_in_lite' => 'false',
* 'is_in_pro' => 'true',
* ),
* ),
* ),
* // Recommended plugins tab.
* 'recommended_plugins' => array(
* 'already_activated_message' => esc_html__( 'Already activated', 'flymag' ),
* 'version_label' => esc_html__( 'Version: ', 'flymag' ),
* 'install_label' => esc_html__( 'Install', 'flymag' ),
* 'activate_label' => esc_html__( 'Activate', 'flymag' ),
* 'deactivate_label' => esc_html__( 'Deactivate', 'flymag' ),
* 'content' => array(
* array(
* 'slug' => 'pirate-forms',
* ),
* array(
* 'link' => 'http://pasal-ecommerce.com/plugins/easy-content-types/',
* ),
* array(
* 'slug' => 'siteorigin-panels',
* ),
* array(
* 'slug' => 'intergeo-maps',
* ),
* ),
* ),
* // Required actions array.
* 'recommended_actions' => array(
* 'install_label' => esc_html__( 'Install', 'flymag' ),
* 'activate_label' => esc_html__( 'Activate', 'flymag' ),
* 'deactivate_label' => esc_html__( 'Deactivate', 'flymag' ),
* 'content' => array(
* 'pirate-forms' => array(
* 'title' => __( 'Pirate Forms', 'flymag' ),
* 'description' => __( 'Makes your contact page more engaging by creating a good-looking contact form on your website. The interaction with your visitors was never easier.', 'flymag' ),
* 'link_label' => __( 'Install Pirate Forms', 'flymag' ),
* 'check' => defined( 'PIRATE_FORMS_VERSION' ),
* 'id' => 'pirate-forms',
* 'plugin_slug' => 'pirate-forms'
* ),
* ),
* ),
* );
* Resortica_About_Page::init( $config );
*
* @package Pasal-ecommerce
* @since 1.0.0
*/
if ( ! class_exists( 'pasal_ecommerce_About_Page' ) ) {
// Include utils functions
/**
* Singleton class used for generating the about page of the theme.
*/
class pasal_ecommerce_About_Page {
/**
* Define the version of the class.
*
* @var string $version The Resortica_About_Page class version.
*/
private $version = '1.0.0';
/**
* Used for loading the texts and setup the actions inside the page.
*
* @var array $config The configuration array for the theme used.
*/
private $config;
/**
* Get the theme name using wp_get_theme.
*
* @var string $theme_name The theme name.
*/
private $theme_name;
/**
* Get the theme slug ( theme folder name ).
*
* @var string $theme_slug The theme slug.
*/
private $theme_slug;
/**
* The current theme object.
*
* @var WP_Theme $theme The current theme.
*/
private $theme;
/**
* Holds the theme version.
*
* @var string $theme_version The theme version.
*/
private $theme_version;
/**
* Define the menu item name for the page.
*
* @var string $menu_name The name of the menu name under Appearance settings.
*/
private $menu_name;
/**
* Define the page title name.
*
* @var string $page_name The title of the About page.
*/
private $page_name;
/**
* Define the page tabs.
*
* @var array $tabs The page tabs.
*/
private $tabs;
/**
* Define the html notification content displayed upon activation.
*
* @var string $notification The html notification content.
*/
private $notification;
/**
* The single instance of Resortica_About_Page
*
* @var Resortica_About_Page $instance The Resortica_About_Page instance.
*/
private static $instance;
/**
* The Main Resortica_About_Page instance.
*
* We make sure that only one instance of Resortica_About_Page exists in the memory at one time.
*
* @param array $config The configuration array.
*/
public static function init( $config ) {
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof pasal_ecommerce_About_Page ) ) {
self::$instance = new pasal_ecommerce_About_Page;
if ( ! empty( $config ) && is_array( $config ) ) {
self::$instance->config = $config;
self::$instance->setup_config();
self::$instance->setup_actions();
}
}
}
/**
* Setup the class props based on the config array.
*/
public function setup_config() {
$theme = wp_get_theme();
if ( is_child_theme() ) {
$this->theme_name = $theme->parent()->get( 'Name' );
$this->theme = $theme->parent();
} else {
$this->theme_name = $theme->get( 'Name' );
$this->theme = $theme->parent();
}
$this->theme_version = $theme->get( 'Version' );
$this->theme_slug = $theme->get_template();
$this->menu_name = isset( $this->config['menu_name'] ) ? $this->config['menu_name'] : 'About ' . $this->theme_name;
$this->page_name = isset( $this->config['page_name'] ) ? $this->config['page_name'] : 'About ' . $this->theme_name;
$this->notification = isset( $this->config['notification'] ) ? $this->config['notification'] : ( apply_filters( 'pasal_ecommerce_welcome_notice_filter', ( '
' . sprintf( 'Welcome! Thank you for choosing %1$s! To fully take advantage of the best our theme can offer please make sure you visit our %2$swelcome page%3$s.', $this->theme_name, '', '' ) . '
' . sprintf( 'Get started with %s', $this->theme_name ) . '
' ) ) );
$this->tabs = isset( $this->config['tabs'] ) ? $this->config['tabs'] : array();
}
/**
* Setup the actions used for this page.
*/
public function setup_actions() {
add_action( 'admin_menu', array( $this, 'register' ) );
/* activation notice */
add_action( 'load-themes.php', array( $this, 'activation_admin_notice' ) );
/* enqueue script and style for about page */
add_action( 'admin_enqueue_scripts', array( $this, 'style_and_scripts' ) );
/* ajax callback for dismissable required actions */
add_action( 'wp_ajax_acp_about_page_dismiss_required_action', array( $this, 'dismiss_required_action_callback' ) );
add_action( 'wp_ajax_nopriv_acp_about_page_dismiss_required_action', array( $this, 'dismiss_required_action_callback' ) );
}
/**
* Hide required tab if no actions present.
*
* @return bool Either hide the tab or not.
*/
public function hide_required( $value, $tab ) {
if ( $tab != 'recommended_actions' ) {
return $value;
}
$required = $this->get_required_actions();
if ( count( $required ) == 0 ) {
return false;
} else {
return true;
}
}
/**
* Register the menu page under Appearance menu.
*/
function register() {
if ( ! empty( $this->menu_name ) && ! empty( $this->page_name ) ) {
$count = 0;
$actions_count = $this->get_required_actions();
foreach ($actions_count as $a=>$r) {
$active_slug= $r['plugin_slug'];
if($active_slug == 'contact-form-7')
$active_slug='wp-contact-form-7';
if(is_plugin_active($r['plugin_slug'].'/'.$active_slug.'.php')){
unset($actions_count[$a]);
}
}
if ( ! empty( $actions_count ) ) {
$count = count( $actions_count );
}
$title = $count > 0 ? $this->page_name . '' . esc_html( $count ) . '' : $this->page_name;
add_theme_page(
$this->menu_name, $title, 'activate_plugins', $this->theme_slug . '-welcome', array(
$this,
'pasal_ecommerce_about_page_render',
)
);
}
}
/**
* Adds an admin notice upon successful activation.
*/
public function activation_admin_notice() {
global $pagenow;
if ( is_admin() && ( 'themes.php' == $pagenow ) && isset( $_GET['activated'] ) ) {
add_action( 'admin_notices', array( $this, 'pasal_ecommerce_about_page_welcome_admin_notice' ), 99 );
}
}
/**
* Display an admin notice linking to the about page
*/
public function pasal_ecommerce_about_page_welcome_admin_notice() {
if ( ! empty( $this->notification ) ) {
echo '';
echo wp_kses_post( $this->notification );
echo '
';
}
}
/**
* Render the main content page.
*/
public function pasal_ecommerce_about_page_render() {
if ( ! empty( $this->config['welcome_title'] ) ) {
$welcome_title = $this->config['welcome_title'];
}
if ( ! empty( $this->config['welcome_content'] ) ) {
$welcome_content = $this->config['welcome_content'];
}
if ( ! empty( $welcome_title ) || ! empty( $welcome_content ) || ! empty( $this->tabs ) ) {
echo '';
if ( ! empty( $welcome_title ) ) {
echo '
';
echo esc_html( $welcome_title );
if ( ! empty( $this->theme_version ) ) {
echo esc_html( $this->theme_version ) . ' ';
}
echo '![](https://codethemes.co/wp-content/uploads/2016/02/codethemes-logo.svg)
';
}
if ( ! empty( $welcome_content ) ) {
echo '
' . wp_kses_post( $welcome_content ) . '
';
}
/* Display tabs */
if ( ! empty( $this->tabs ) ) {
$active_tab = isset( $_GET['tab'] ) ? wp_unslash( $_GET['tab'] ) : 'getting_started';
echo '
';
/* Display content for current tab */
if ( method_exists( $this, $active_tab ) ) {
$this->$active_tab();
}
}// End if().
echo '
';
}// End if().
}
/**
* Call plugin api
*/
public function call_plugin_api( $slug ) {
include_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
$call_api = get_transient( 'acp_about_plugin_info_' . $slug );
if ( false === $call_api ) {
$call_api = plugins_api(
'plugin_information', array(
'slug' => $slug,
'fields' => array(
'downloaded' => false,
'rating' => false,
'description' => false,
'short_description' => true,
'donate_link' => false,
'tags' => false,
'sections' => true,
'homepage' => true,
'added' => false,
'last_updated' => false,
'compatibility' => false,
'tested' => false,
'requires' => false,
'downloadlink' => false,
'icons' => true,
),
)
);
set_transient( 'acp_about_plugin_info_' . $slug, $call_api, 30 * MINUTE_IN_SECONDS );
}
return $call_api;
}
/**
* Check if plugin is active
*
* @param plugin-slug $slug the plugin slug.
* @return array
*/
public function check_if_plugin_active( $slug ) {
if ( ( $slug == 'intergeo-maps' ) || ( $slug == 'visualizer' ) ) {
$plugin_root_file = 'index';
} elseif ( $slug == 'adblock-notify-by-bweb' ) {
$plugin_root_file = 'adblock-notify';
}
elseif ( $slug == 'contact-form-7' ) {
$plugin_root_file = 'wp-contact-form-7';
}
else {
$plugin_root_file = $slug;
}
$path = WPMU_PLUGIN_DIR . '/' . $slug . '/' . $plugin_root_file . '.php';
if ( ! file_exists( $path ) ) {
$path = WP_PLUGIN_DIR . '/' . $slug . '/' . $plugin_root_file . '.php';
if ( ! file_exists( $path ) ) {
$path = false;
}
}
if ( file_exists( $path ) ) {
include_once(ABSPATH . 'wp-admin/includes/plugin.php');
$needs = is_plugin_active( $slug . '/' . $plugin_root_file . '.php' ) ? 'deactivate' : 'activate';
return array(
'status' => is_plugin_active( $slug . '/' . $plugin_root_file . '.php' ),
'needs' => $needs,
);
}
return array(
'status' => false,
'needs' => 'install',
);
}
/**
* Get icon of wordpress.org plugin
*
* @param array $arr array of image formats.
*
* @return mixed
*/
public function get_plugin_icon( $arr ) {
if ( ! empty( $arr['svg'] ) ) {
$plugin_icon_url = $arr['svg'];
} elseif ( ! empty( $arr['2x'] ) ) {
$plugin_icon_url = $arr['2x'];
} elseif ( ! empty( $arr['1x'] ) ) {
$plugin_icon_url = $arr['1x'];
} else {
$plugin_icon_url = get_template_directory_uri() . '/information/acp-notifications/pasal/images/placeholder_plugin.png';
}
return $plugin_icon_url;
}
/**
* Check if a slug is from intergeo, visualizer or adblock and returns the correct slug for them.
*
* @param string $slug Plugin slug.
*
* @return string
*/
public function check_plugin_slug( $slug ) {
switch ( $slug ) {
case 'intergeo-maps':
case 'visualizer':
$slug = 'index';
break;
case 'adblock-notify-by-bweb':
$slug = 'adblock-notify';
break;
}
return $slug;
}
/**
* Display button for recommended actions or
*
* @param array $data Data for an item.
*/
public function display_button( $data ) {
$button_new_tab = '_self';
$button_class = '';
if ( isset( $tab_data['is_new_tab'] ) ) {
if ( $data['is_new_tab'] ) {
$button_new_tab = '_blank';
}
}
if ( $data['is_button'] ) {
$button_class = 'button button-primary';
}
echo '' . $data['button_label'] . '';
}
/**
* Getting started tab
*/
public function getting_started() {
if ( ! empty( $this->config['getting_started'] ) ) {
$getting_started = $this->config['getting_started'];
if ( ! empty( $getting_started ) ) {
?>
';
foreach ( $getting_started as $getting_started_item ) {
echo '';
if ( ! empty( $getting_started_item['title'] ) ) {
echo '
' . $getting_started_item['title'] . '
';
}
if ( ! empty( $getting_started_item['text'] ) ) {
echo '
' . $getting_started_item['text'] . '
';
}
if ( ! empty( $getting_started_item['button_link'] ) && ! empty( $getting_started_item['button_label'] ) ) {
echo '
';
$count = 0;
$actions_count = $this->get_required_actions();
if ( ! empty( $actions_count ) ) {
$count = count( $actions_count );
}
if ( $getting_started_item['recommended_actions'] && isset( $count ) ) {
if ( $count == 0 ) {
echo '';
} else {
echo '';
}
}
$this->display_button( $getting_started_item );
echo '
';
}
echo '
';
}// End foreach().
echo '';
}// End if().
}// End if().
}
/**
* Recommended Actions tab
*/
public function recommended_actions() {
$recommended_actions = isset( $this->config['recommended_actions'] ) ? $this->config['recommended_actions'] : array();
if ( ! empty( $recommended_actions ) ) {
echo '';
$actions = array();
$req_actions = isset( $this->config['recommended_actions'] ) ? $this->config['recommended_actions'] : array();
foreach ( $req_actions['content'] as $req_action ) {
$actions[] = $req_action;
}
if ( ! empty( $actions ) && is_array( $actions ) ) {
$acp_about_page_show_required_actions = get_option( $this->theme_slug . '_required_actions' );
foreach ( $actions as $action_key => $action_value ) {
$hidden = false;
if ( $acp_about_page_show_required_actions[ $action_value['id'] ] === false ) {
$hidden = true;
}
if ( $action_value['check'] ) {
continue;
}
echo '
';
$this->display_feature_title_and_description( $action_value );
if ( ! empty( $action_value['plugin_slug'] ) ) {
$active = $this->check_if_plugin_active( $action_value['plugin_slug'] );
$label = '';
$slug = $this->check_plugin_slug( $action_value['plugin_slug'] );
$network = $this->check_plugin_slug( $action_value['network'] );
$url = create_action_link( $active['needs'], $slug );
switch ( $active['needs'] ) {
case 'install':
$class = 'install-now button';
if ( ! empty( $this->config['recommended_actions']['install_label'] ) ) {
$label = $this->config['recommended_actions']['install_label'];
}
break;
case 'activate':
$class = 'activate-now button button-primary';
if ( ! empty( $this->config['recommended_actions']['activate_label'] ) ) {
$label = $this->config['recommended_actions']['activate_label'];
}
break;
case 'deactivate':
$class = 'deactivate-now button';
if ( ! empty( $this->config['recommended_actions']['deactivate_label'] ) ) {
$label = $this->config['recommended_actions']['deactivate_label'];
}
break;
}
if($network=='local' && $class=='install-now button') {
?>
';
}// End foreach().
}// End if().
echo '
';
}// End if().
}
/**
* Recommended plugins tab
*/
public function recommended_plugins() {
$recommended_plugins = $this->config['recommended_plugins'];
if ( ! empty( $recommended_plugins ) ) {
if ( ! empty( $recommended_plugins['content'] ) && is_array( $recommended_plugins['content'] ) ) {
echo '
';
foreach ( $recommended_plugins['content'] as $recommended_plugins_item ) {
if ( ! empty( $recommended_plugins_item['slug'] ) ) {
$info = $this->call_plugin_api( $recommended_plugins_item['slug'] );
if ( ! empty( $info->icons ) ) {
$icon = $this->get_plugin_icon( $info->icons );
}
$active = $this->check_if_plugin_active( $recommended_plugins_item['slug'] );
if ( ! empty( $active['needs'] ) ) {
$slug = $this->check_plugin_slug( $recommended_plugins_item['slug'] );
$url = create_action_link( $active['needs'], $slug );
}
echo '
';
if ( ! empty( $icon ) ) {
echo '
![plugin box image](' . esc_url( $icon ) . ')
';
}
if ( ! empty( $info->name ) && ! empty( $active ) ) {
echo '
';
echo '
';
echo '' . esc_html( $info->name ) . '';
echo '
';
$label = '';
switch ( $active['needs'] ) {
case 'install':
$class = 'install-now button';
if ( ! empty( $this->config['recommended_plugins']['install_label'] ) ) {
$label = $this->config['recommended_plugins']['install_label'];
}
break;
case 'activate':
$class = 'activate-now button button-primary';
if ( ! empty( $this->config['recommended_plugins']['activate_label'] ) ) {
$label = $this->config['recommended_plugins']['activate_label'];
}
break;
case 'deactivate':
$class = 'deactivate-now button';
if ( ! empty( $this->config['recommended_plugins']['deactivate_label'] ) ) {
$label = $this->config['recommended_plugins']['deactivate_label'];
}
break;
}
echo '
';
echo '' . esc_html( $label ) . '';
echo '';
echo '
';
}
if ( ! empty( $info->version ) || ! empty( $info->author ) ) {
?>
version ) ) {
echo '' . ( ! empty( $this->config['recommended_plugins']['version_label'] ) ? esc_html( $this->config['recommended_plugins']['version_label'] ) : '' ) . esc_html( $info->version ) . '';
}
if ( ! empty( $info->author ) ) {
echo ' | ' . wp_kses_post( strip_tags( $info->author ) );
}
if ( ! empty( $info->version ) || ! empty( $info->author ) ) {
?>
';
}// End if().
}// End foreach().
echo '
';
}// End if().
}// End if().
}
/**
* Child themes
*/
public function child_themes() {
echo '
';
$child_themes = isset( $this->config['child_themes'] ) ? $this->config['child_themes'] : array();
if ( ! empty( $child_themes ) ) {
if ( ! empty( $child_themes['content'] ) && is_array( $child_themes['content'] ) ) {
echo '
';
for ( $i = 0; $i < count( $child_themes['content'] ); $i ++ ) {
if ( ( $i !== 0 ) && ( $i / 3 === 0 ) ) {
echo '
';
echo '
';
}
$child = $child_themes['content'][ $i ];
if ( ! empty( $child['image'] ) ) {
echo '
';
echo '
';
echo '
![' . ( ! empty( $child['image_alt'] ) ? esc_html( $child['image_alt'] ) : '' ) . '](' . esc_url( $child['image'] ) . ')
';
if ( ! empty( $child['title'] ) ) {
echo '
';
if ( $child['title'] != $this->theme_name ) {
echo '
';
}
echo '
';
}
echo '
';
echo '
';
}// End if().
}// End for().
echo '
';
}// End if().
}// End if().
echo '
';
}
/**
* Support tab
*/
public function support() {
echo '
';
if ( ! empty( $this->config['support_content'] ) ) {
$support_steps = $this->config['support_content'];
if ( ! empty( $support_steps ) ) {
foreach ( $support_steps as $support_step ) {
echo '
';
if ( ! empty( $support_step['title'] ) ) {
echo '
';
if ( ! empty( $support_step['icon'] ) ) {
echo '';
}
echo $support_step['title'];
echo '
';
}
if ( ! empty( $support_step['text'] ) ) {
echo '
' . $support_step['text'] . '
';
}
if ( ! empty( $support_step['button_link'] ) && ! empty( $support_step['button_label'] ) ) {
echo '
';
$this->display_button( $support_step );
echo '
';
}
echo '
';
}// End foreach().
}// End if().
}// End if().
echo '
';
}
public function demo_import() {
echo '
';
echo '
![]('.esc_url(get_template_directory_uri().'/screenshot.png').')
';
printf(
wp_kses(
/* translators: 1: link to WP admin new post page. */
__( 'Need To Import Demo Click Here.', 'pasal-ecommerce' ),
array(
'a' => array(
'href' => array(),
'class' => array(),
),
)
),
esc_url( admin_url( 'themes.php?page=pt-one-click-demo-import' ) )
);
echo '
';
echo '
';
}
/**
* Changelog tab
*/
public function changelog() {
$changelog = $this->parse_changelog();
if ( ! empty( $changelog ) ) {
echo '
';
foreach ( $changelog as $release ) {
if ( ! empty( $release['title'] ) ) {
echo '
' . $release['title'] . '
';
}
if ( ! empty( $release['changes'] ) ) {
echo implode( '
', $release['changes'] );
}
}
echo '';
}
}
/**
* Return the releases changes array.
*
* @return array The releases array.
*/
private function parse_changelog() {
WP_Filesystem();
global $wp_filesystem;
$changelog = $wp_filesystem->get_contents( get_template_directory() . '/CHANGELOG.md' );
if ( is_wp_error( $changelog ) ) {
$changelog = '';
}
$changelog = explode( PHP_EOL, $changelog );
$releases = array();
foreach ( $changelog as $changelog_line ) {
if ( strpos( $changelog_line, '**Changes:**' ) !== false || empty( $changelog_line ) ) {
continue;
}
if ( substr( $changelog_line, 0, 3 ) === '###' ) {
if ( isset( $release ) ) {
$releases[] = $release;
}
$release = array(
'title' => substr( $changelog_line, 3 ),
'changes' => array(),
);
} else {
$release['changes'][] = $changelog_line;
}
}
return $releases;
}
/**
* Display feature title and description
*
* @param array $feature Feature data.
*/
public function display_feature_title_and_description( $feature ) {
if ( ! empty( $feature['title'] ) ) {
echo '
' . wp_kses_post( $feature['title'] ) . '
';
}
if ( ! empty( $feature['description'] ) ) {
echo '
' . wp_kses_post( $feature['description'] ) . '
';
}
}
/**
* Free vs PRO tab
*/
public function free_pro() {
$free_pro = isset( $this->config['free_pro'] ) ? $this->config['free_pro'] : array();
if ( ! empty( $free_pro ) ) {
if ( ! empty( $free_pro['free_theme_name'] ) && ! empty( $free_pro['pro_theme_name'] ) && ! empty( $free_pro['features'] ) && is_array( $free_pro['features'] ) ) {
echo '
';
echo '
';
echo '
';
echo '';
echo '';
echo ' | ';
echo '' . esc_html( $free_pro['free_theme_name'] ) . ' | ';
echo '' . esc_html( $free_pro['pro_theme_name'] ) . ' | ';
echo '
';
echo '';
echo '';
foreach ( $free_pro['features'] as $feature ) {
echo '';
if ( ! empty( $feature['title'] ) || ! empty( $feature['description'] ) ) {
echo '';
$this->display_feature_title_and_description( $feature );
echo ' | ';
}
if ( ! empty( $feature['is_in_lite'] ) && ( $feature['is_in_lite'] == 'true' ) ) {
echo ' | ';
} else {
echo ' | ';
}
if ( ! empty( $feature['is_in_pro'] ) && ( $feature['is_in_pro'] == 'true' ) ) {
echo ' | ';
} else {
echo ' | ';
}
echo '
';
}
if ( ! empty( $free_pro['pro_theme_link'] ) && ! empty( $free_pro['get_pro_theme_label'] ) ) {
echo '';
echo '';
if ( ! empty( $free_pro['banner_link'] ) && ! empty( $free_pro['banner_src'] ) ) {
echo ' ';
}
echo ' | ';
echo '' . wp_kses_post( $free_pro['get_pro_theme_label'] ) . ' | ';
echo '
';
}
echo '';
echo '
';
echo '
';
echo '
';
}// End if().
}// End if().
}
/**
* Load css and scripts for the about page
*/
public function style_and_scripts( $hook_suffix ) {
// this is needed on all admin pages, not just the about page, for the badge action count in the WordPress main sidebar
wp_enqueue_style( 'acp-about-page-css', get_template_directory_uri() . '/information/pasal/css/acp_about_page_css.css', array(), PASAL_ECOMMERCE_VERSION );
if ( 'appearance_page_' . $this->theme_slug . '-welcome' == $hook_suffix ) {
wp_enqueue_script( 'acp-about-page-js', get_template_directory_uri() . '/information/pasal/js/acp_about_page_scripts.js', array( 'jquery' ), PASAL_ECOMMERCE_VERSION );
wp_enqueue_style( 'plugin-install' );
wp_enqueue_script( 'plugin-install' );
wp_enqueue_script( 'updates' );
$recommended_actions = isset( $this->config['recommended_actions'] ) ? $this->config['recommended_actions'] : array();
$required_actions = $this->get_required_actions();
wp_localize_script(
'acp-about-page-js', 'tiAboutPageObject', array(
'nr_actions_required' => count( $required_actions ),
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'template_directory' => get_template_directory_uri(),
'activating_string' => esc_html__( 'Activating', 'pasal-ecommerce' ),
)
);
}
}
/**
* Return the valid array of required actions.
*
* @return array The valid array of required actions.
*/
private function get_required_actions() {
$saved_actions = get_option( $this->theme_slug . '_required_actions' );
if ( ! is_array( $saved_actions ) ) {
$saved_actions = array();
}
$req_actions = isset( $this->config['recommended_actions'] ) ? $this->config['recommended_actions'] : array();
$valid = array();
foreach ( $req_actions['content'] as $req_action ) {
if ( ( ! isset( $req_action['check'] ) || ( isset( $req_action['check'] ) && ( $req_action['check'] == false ) ) ) && ( ! isset( $saved_actions[ $req_action['id'] ] ) ) ) {
$valid[] = $req_action;
}
}
return $valid;
}
/**
* Dismiss required actions
*/
public function dismiss_required_action_callback() {
$recommended_actions = array();
$req_actions = isset( $this->config['recommended_actions'] ) ? $this->config['recommended_actions'] : array();
foreach ( $req_actions['content'] as $req_action ) {
$recommended_actions[] = $req_action;
}
$action_id = ( isset( $_GET['id'] ) && is_numeric( $_GET['id'] ) ) ? intval($_GET['id'] ) : 0;
echo esc_html( wp_unslash( $action_id ) ); /* this is needed and it's the id of the dismissable required action */
if ( ! empty( $action_id ) ) {
/* if the option exists, update the record for the specified id */
if ( get_option( $this->theme_slug . '_required_actions' ) ) {
$acp_about_page_show_required_actions = get_option( $this->theme_slug . '_required_actions' );
switch ( esc_html( $_GET['todo'] ) ) {
case 'add':
$acp_about_page_show_required_actions[ absint( $action_id ) ] = true;
break;
case 'dismiss':
$acp_about_page_show_required_actions[ absint( $action_id ) ] = false;
break;
}
update_option( $this->theme_slug . '_required_actions', $acp_about_page_show_required_actions );
/* create the new option,with false for the specified id */
} else {
$acp_about_page_show_required_actions_new = array();
if ( ! empty( $recommended_actions ) ) {
foreach ( $recommended_actions as $acp_about_page_required_action ) {
if ( $acp_about_page_required_action['id'] == $action_id ) {
$acp_about_page_show_required_actions_new[ $acp_about_page_required_action['id'] ] = false;
} else {
$acp_about_page_show_required_actions_new[ $acp_about_page_required_action['id'] ] = true;
}
}
update_option( $this->theme_slug . '_required_actions', $acp_about_page_show_required_actions_new );
}
}
}// End if().
}
}
}// End if().