array(
'label' => __( 'Welcome', 'top-store' ),
'show' => ! is_network_admin(),
),
);
self::$view_actions = apply_filters( 'top_store_menu_options', $actions );
}
return self::$view_actions;
}
/**
* Save All admin settings here
*/
static public function save_settings() {
// Only admins can save settings.
if ( ! current_user_can( 'manage_options' ) ){
return;
}
// Let extensions hook into saving.
do_action( 'top_store_admin_settings_save' );
}
/**
* Enqueues the needed CSS/JS for the builder's admin settings page.
*
*/
static public function styles_scripts(){
// Styles.
wp_enqueue_style( 'top-store-admin-settings', TOP_STORE_THEME_URI . 'lib/theme-option/assets/css/top-store-admin-menu-settings.css', array(), TOP_STORE_THEME_VERSION );
// Script.
wp_enqueue_script( 'top-store-admin-settings', TOP_STORE_THEME_URI . 'lib/theme-option/assets/js/top-store-admin-menu-settings.js', array( 'jquery', 'wp-util', 'updates' ), TOP_STORE_THEME_VERSION );
$localize = array(
'ajaxUrl' => esc_url(admin_url( 'admin-ajax.php' )),
'btnActivating' => __( 'Activating Importer Plugin ', 'top-store' ) . '…',
'topstoreSitesLink' => esc_url(admin_url( 'themes.php?page=pt-one-click-demo-import' )),
'topstoreSitesLinkTitle' => __( 'See Library', 'top-store' ),
);
wp_localize_script( 'top-store-admin-settings', 'topstore', apply_filters( 'top_store_theme_js_localize', $localize ) );
}
/**
* Enqueues the needed CSS/JS for Backend.
*
*/
static public function top_store_admin_style(){
// Styles.
wp_register_style( 'top-store-admin-css', TOP_STORE_THEME_URI . 'lib/theme-option/assets/css/top-store-admin.css', false, TOP_STORE_THEME_VERSION );
wp_enqueue_style( 'top-store-admin-css' );
}
/**
* Add main menu
*
*/
static public function add_admin_menu(){
$parent_page = self::$default_menu_position;
$page_title = self::$menu_page_title;
$capability = 'manage_options';
$page_menu_slug = self::$plugin_slug;
$page_menu_func = __CLASS__ . '::menu_callback';
if ( apply_filters( 'top_store_dashboard_admin_menu', true ) ) {
add_theme_page( $page_title, $page_title, $capability, $page_menu_slug, $page_menu_func );
} else {
do_action( 'top_store_register_admin_menu', $parent_page, $page_title, $capability, $page_menu_slug, $page_menu_func );
}
}
/**
* Menu callback
*
*/
static public function menu_callback() {
$current_slug = isset( $_GET['action'] ) ? esc_attr( $_GET['action'] ) : self::$current_slug;
$active_tab = str_replace( '_', '-', $current_slug );
$current_slug = str_replace( '-', '_', $current_slug );
$top_store_icon = apply_filters( 'top_store_page_top_icon', true );
$almshp_wrapper_class = apply_filters( 'top_store_welcome_wrapper_class', array( $current_slug ) );
$my_theme = wp_get_theme();
$top_store_theme_version = $my_theme->get( 'Version' );
?>
'.esc_html($button_text) .'');
}
?>
' . esc_html( $top_store_knowledge_base_doc_link_text ) . '' :
esc_html( $top_store_knowledge_base_doc_link_text )
);
?>
' . esc_html( $top_store_community_group_link_text ) . '' :
esc_html( $top_store_community_group_link_text )
);
?>
' . esc_html( $top_store_support_link_text ) . '' :
esc_html( $top_store_support_link_text )
);
?>
' . esc_html( $top_store_pro_link_text ) . '' :
esc_html( $top_store_pro_link_text )
);
?>
$plugin){
$plugin_info = plugins_api( 'plugin_information', array(
'slug' => $slug,
'fields' => array(
'downloaded' => false,
'sections' => true,
'homepage' => true,
'added' => false,
'compatibility' => false,
'requires' => false,
'downloadlink' => false,
'icons' => false,
)
) );
$plugin_name = $plugin_info->name;
$plugin_slug = $plugin_info->slug;
$version = $plugin_info->version;
$author = $plugin_info->author;
$download_link = $plugin_info->download_link;
$status = is_dir( WP_PLUGIN_DIR . '/' . $plugin_slug );
if($plugin_slug=='yith-woocommerce-wishlist' || $plugin_slug=='yith-woocommerce-compare'){
$active_file_name = $plugin_slug . '/init.php';
}
elseif($plugin_slug=='themehunk-megamenu-plus'){
$active_file_name = $plugin_slug . '/themehunk-megamenu.php';
}
else{
$active_file_name = $plugin_slug . '/' . $plugin_slug . '.php';
}
$button_class = 'install-now button '.$plugin_slug;
if ( is_plugin_active( $active_file_name ) ) {
$button_class = 'button disabled '.$plugin_slug;
$button_txt = esc_html__( 'Plugin Activated', 'top-store' );
$detail_link = $install_url = '';
}
if ( ! is_plugin_active( $active_file_name ) ){
$button_txt = esc_html__( 'Install Now', 'top-store' );
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 '.$plugin_slug;
$button_txt = esc_html__( 'Activate Now', 'top-store' );
}
}
$detail = '';
$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 ' ';
if($plugin_slug=='lead-form-builder'){
echo'
';
$detail='Lead form builder is a contact form as well as lead generator plugin.';
}elseif($plugin_slug=='wp-popup-builder'){
echo'
';
$detail='WP Popup Builder is a powerfull tool to create amazing popup form for your site.';
}elseif($plugin_slug=='hunk-companion'){
echo'
';
$detail= 'Hunk Companion contain all features which are required to create a complete website. Main motive behind this plugin is to boost up functionality of ThemeHunk themes.';
}elseif($plugin_slug=='themehunk-megamenu-plus'){
echo'
';
$detail= 'ThemeHunk Megamenu ThemeHunk Megamenu is a free, fast and most user friendly plugin available for WordPress.';
}elseif($plugin_slug=='woocommerce'){
echo'
';
$detail='WooCommerce is a free eCommerce plugin that allows you to sell anything, beautifully.';
}elseif($plugin_slug=='yith-woocommerce-wishlist'){
echo'
';
$detail='YITH WooCommerce Wishlist allows you to add Wishlist functionality to your e-commerce.';
}elseif($plugin_slug=='yith-woocommerce-compare'){
echo'
';
$detail='YITH WooCommerce Compare plugin is an extension of WooCommerce plugin that allow your users to compare some products of your shop.';
}elseif($plugin_slug=='one-click-demo-import'){
echo'
';
$detail= 'Import your demo content, widgets and theme settings with one click. Theme authors! Enable simple demo import for your theme demo data.';
}
echo '
'.esc_html($detail).'
';
echo '
Version:'.esc_html($version).'
'.$author.'
| '.esc_html__( 'Details', 'top-store' ).'
';
echo'
'.esc_html($button_txt).' ';
echo '
';
}
}
}
/**
* Update Admin Title.
*
* @since 1.0.19
*
* @param string $admin_title Admin Title.
* @param string $title Title.
* @return string
*/
static public function top_store_admin_title( $admin_title, $title ){
$screen = get_current_screen();
if ( 'appearance_page_top_store' == $screen->id ) {
$view_actions = self::get_view_actions();
$current_slug = isset( $_GET['action'] ) ? esc_attr( $_GET['action'] ) : self::$current_slug;
$active_tab = str_replace( '_', '-', $current_slug );
if ( 'general' != $active_tab && isset( $view_actions[ $active_tab ]['label'] ) ) {
$admin_title = str_replace( $title, $view_actions[ $active_tab ]['label'], $admin_title );
}
}
return $admin_title;
}
/**
* top store Header Right Section Links
*
* @since 1.2.4
*/
static public function top_header_right_section(){
$top_links = apply_filters(
'top_store_header_top_links',
array(
'top-store-theme-info' => array(
'title' => __( 'Easy to use, Fully Customizable, Unique options', 'top-store' ),
),
)
);
if ( ! empty( $top_links ) ) {
?>
$info ) {
/* translators: %1$s: Top Link URL wrapper, %2$s: Top Link URL, %3$s: Top Link URL target attribute */
printf(
'<%1$s %2$s %3$s > %4$s %1$s>',
isset( $info['url'] ) ? 'a' : 'span',
isset( $info['url'] ) ? 'href="' . esc_url( $info['url'] ) . '"' : '',
isset( $info['url'] ) ? 'target="_blank" rel="noopener"' : '',
esc_html( $info['title'] )
);
}
?>
false,
'message' => __( 'No plugin specified', 'top-store' ),
)
);
}
$plugin_init = ( isset( $_POST['init'] ) ) ? esc_attr( $_POST['init'] ) : '';
$plugin_init1 = ( isset( $_POST['init1'] ) ) ? esc_attr( $_POST['init1'] ) : '';
$activate = activate_plugin( $plugin_init, '', false, true );
$activate1 = activate_plugin( $plugin_init1, '', false, true );
if ( is_wp_error( $activate ) ) {
wp_send_json_error(
array(
'success' => false,
'message' => $activate->get_error_message(),
)
);
}
if ( is_wp_error( $activate1 ) ) {
wp_send_json_error(
array(
'success' => false,
'message' => $activate1->get_error_message(),
)
);
}
wp_send_json_success(
array(
'success' => true,
'message' => __( 'Plugin Successfully Activated', 'top-store' ),
)
);
}
}
new Top_Store_Admin_Settings;
}