active(); endif; } function active(){ if(!get_option( "thunk_customizer_disable_popup")): add_action('customize_controls_print_styles', array($this,'popup_styles')); add_action('customize_controls_print_footer_scripts',array(__CLASS__,'popup_message')); add_action( 'customize_controls_enqueue_scripts', array($this,'popup_scripts')); endif; } function active_plugin(){ $plugin_slug = 'themehunk-customizer'; $active_file_name = $plugin_slug.'/'.$plugin_slug.'.php'; $button_class = 'install-now button button-primary button-large'; $button_txt = esc_html__( 'Install Plugin & Setup Homepage', 'shopline' ); $status = is_dir( WP_PLUGIN_DIR . '/'.$plugin_slug ); 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-large'; $button_txt = esc_html__( 'Setup Homepage', 'shopline' ); } $url = esc_url($install_url); return "{$button_txt}"; } function popup_message() { require_once get_parent_theme_file_path('/inc/theme-setup/customizer-popup.php') ; } function popup_styles() { wp_enqueue_style('shopline_customizer_popup', get_template_directory_uri() . '/inc/theme-setup/customizer-popup-styles.css'); } function popup_scripts() { wp_enqueue_script( 'shopline_customizer_popup', get_template_directory_uri() . '/inc/theme-setup/customizer-popup.js', array("jquery"), '', true ); } } // home page setup function active_plugin(){ $plugin_slug = 'themehunk-customizer'; $active_file_name = $plugin_slug.'/'.$plugin_slug.'.php'; $button_class = 'install-now button button-primary button-large'; $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-large'; $button_txt = esc_html__( 'Setup Homepage', 'shopline' ); if ( is_plugin_active( $active_file_name ) ) { echo false; }else{ echo $install_url; } } add_action( 'wp_ajax_shopline_default_home', 'shopline_default_home' ); function shopline_default_home() { $pages = get_pages(array( 'meta_key' => '_wp_page_template', 'meta_value' => 'home-template.php' )); $post_id = isset($pages[0]->ID)?$pages[0]->ID:false; if(empty($pages)){ $post_id = wp_insert_post(array ( 'post_type' => 'page', 'post_title' => __('Home','shopline'), 'post_content' => '', 'post_name' => 'home', 'post_status' => 'publish', 'comment_status' => 'closed', // if you prefer 'ping_status' => 'closed', // if you prefer 'page_template' =>'home-template.php', //Sets the template for the page. )); } if($post_id){ update_option( 'page_on_front', $post_id ); update_option( 'show_on_front', 'page' ); } active_plugin(); wp_die(); // this is required to terminate immediately and return a proper response } function shopline_check_home_page(){ $pages = get_pages(array( 'meta_key' => '_wp_page_template', 'meta_value' => 'home-template.php' )); $post_id = isset($pages[0]->ID)?$pages[0]->ID:false; $front = get_option( 'page_on_front'); $true = false; if($post_id==$front && $front>0){ $true = true; } return $true; } /** * Add admin notice when active theme, just show one time * * @return bool|null */ add_action( 'admin_notices', 'shopline_admin_notice' ); function shopline_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' ) ) { ?>

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

Welcome page', 'shopline' ), esc_html( $theme_data->Name ), esc_url( admin_url( 'themes.php?page=th_shopline' ) ) ); 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 customizer_disable_popup(){ $value = intval(@$_POST['value']); update_option( "thunk_customizer_disable_popup", $value ); die(); } add_action('wp_ajax_customizer_disable_popup', 'customizer_disable_popup'); /* * online about us feature * */ function shopline_tab_config($theme_data){ $config = array( 'theme_brand' => __('ThemeHunk','shopline'), 'theme_brand_url' => esc_url($theme_data->get( 'AuthorURI' )), 'welcome'=>sprintf(esc_html__('Welcome to Shopline - Version %1s', 'shopline'), $theme_data->get( 'Version' ) ), 'welcome_desc' => esc_html__( 'Shopline is a full featured E-commerce WordPress theme build specially for WooCommerce. This theme has a clean, modern and selling oriented design which is suitable for creating any type of online store, fashion website and many more. Theme comes with one click setup, Section hide option, Section ordering (drag & drop functionality), which makes it more user-friendly.', 'shopline' ), 'tab_one' =>esc_html__('Get Started with Shopline', 'shopline' ), 'tab_two' =>esc_html__( 'Recommended Actions', 'shopline' ), 'tab_three' =>esc_html__( 'Free VS Pro', 'shopline' ), 'tab_four' =>esc_html__( 'Demo Import', 'shopline' ), 'plugin_title' => esc_html__( 'Step 1 - Do recommended actions', 'shopline' ), 'plugin_link' => '?page=th_shopline&tab=actions_required', 'plugin_text' => sprintf(esc_html__('Firstly do all recommended actions it will help you set up your site easily.', 'shopline'), $theme_data->get( 'Name' )), 'plugin_text1' => sprintf(esc_html__('Activate ThemeHunk Customizer plugin (It will enable lots of customizer option like hero header slider and activate all frontpage sections) ', 'shopline'), $theme_data->get( 'Name' )), 'plugin_button' => esc_html__('Go To Recommended Action', 'shopline'), 'docs_title' => esc_html__( 'Step 2 - Configure Homepage Layout', 'shopline' ), 'video_link' => esc_url('//www.youtube.com/watch?v=pHCoxwYCZGQ'), 'docs_button' => esc_html__('Configuration Instructions (with video)', 'shopline'), 'customizer_title' => esc_html__( 'Step 2 - Home Page Setup', 'shopline' ), 'customizer_text' => sprintf(esc_html__('%s Theme comes with one click home page setup. If you have installed all required plugins suggested in the "Recommended Actions" then click this button to set up home page.', 'shopline'), $theme_data->Name), 'customizer_button' => sprintf( esc_html__('Start Customize', 'shopline')), 'support_title' => esc_html__( 'Step 3 - Theme Support', 'shopline' ), 'support_link' => esc_url('//www.themehunk.com/support/'), 'support_forum' => sprintf(esc_html__('Support Forum', 'shopline'), $theme_data->get( 'Name' )), 'doc_link' => esc_url('//www.themehunk.com/docs/shopline-theme/'), 'doc_link_text' => sprintf(esc_html__('Theme Documentation', 'shopline'), $theme_data->get( 'Name' )), 'support_text' => sprintf(esc_html__('If you need any help you can contact to our support team, our team is always ready to help you.', 'shopline'), $theme_data->get( 'Name' )), 'support_button' => sprintf( esc_html__('Create a support ticket', 'shopline'), $theme_data->get( 'Name' )), ); return $config; } if ( ! function_exists( 'shopline_admin_scripts' ) ) : /** * Enqueue scripts for admin page only: Theme info page */ function shopline_admin_scripts( $hook ) { wp_enqueue_style( 'shopline-admin-css', get_template_directory_uri() . '/css/admin.css' ); if ($hook === 'appearance_page_th_shopline' ) { // 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', 'shopline_admin_scripts' ); function shopline_count_active_plugins() { $i = 5; if (shortcode_exists('themehunk-customizer-shopline')): $i--; endif; if(class_exists( 'woocommerce' )) : $i--; endif; if (shortcode_exists( 'lead-form' )): $i--; endif; if(shortcode_exists( 'yith_wcwl_add_to_wishlist' )) : $i--; endif; if(shortcode_exists( 'crellyslider' )) : $i--; endif; return $i; } function shopline_tab_count(){ $count = ''; $number_count = shopline_count_active_plugins(); if( $number_count >0): $count = "" . number_format_i18n($number_count) . ""; endif; return $count; } /** * Menu tab */ function shopline_tab() { $number_count = shopline_count_active_plugins(); $menu_title = esc_html__('Get Started with Shopline', 'shopline'); if( $number_count >0): $count = "" . number_format_i18n($number_count) . ""; $menu_title = sprintf( esc_html__('Get Started with Shopline %s', 'shopline'), $count ); endif; add_theme_page( esc_html__( 'Shopline', 'shopline' ), $menu_title, 'edit_theme_options', 'th_shopline', 'shopline_tab_page'); } add_action('admin_menu', 'shopline_tab'); // pro theme function shopline_pro_theme(){ ?>
free vs pro

Import Demo Data and click "Import Demo Data" button.', 'shopline' ); ?>

Name ); ?>

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

$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' => true, ) ) ); //foreach($plugin_info as $plugin_info){ $plugin_name = $plugin_info->name; $plugin_slug = $plugin_info->slug; $version = $plugin_info->version; $author = $plugin_info->author; $download_link = $plugin_info->download_link; $icons = (isset($plugin_info->icons['1x']))?$plugin_info->icons['1x']:$plugin_info->icons['default']; $status = is_dir( WP_PLUGIN_DIR . '/' . $plugin_slug ); if($plugin_slug=='yith-woocommerce-wishlist'){ $active_file_name = $plugin_slug . '/init.php'; }elseif($plugin_slug=='crelly-slider'){ $active_file_name = $plugin_slug . '/crellyslider.php'; }else{ $active_file_name = $plugin_slug . '/' . $plugin_slug . '.php'; } $button_class = 'install-now button'; if ( ! is_plugin_active( $active_file_name ) ) { $button_txt = esc_html__( 'Install Now', 'shopline' ); 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 = esc_html__( 'Active Now', 'shopline' ); } $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' ) ); $detail = ''; echo '
'; echo '

'; echo esc_html( $plugin_name ); echo '

'; echo ''; if($plugin_slug=='themehunk-customizer'){ $detail= esc_html__('ThemeHunk customizer - ThemeHunk customizer plugin will allow you to add unlimited number of columns for services, Testimonial, and Team with widget support. It will add slider section, Ribbon section, latest post, Contact us and Woocommerce section. These will be visible on front page of your site.','shopline'); } elseif($plugin_slug=='woocommerce'){ $detail= esc_html__('WooCommerce is a free eCommerce plugin that allows you to sell anything, beautifully. Built to integrate seamlessly with WordPress, WooCommerce is the eCommerce solution that gives both store owners and developers complete control.','shopline'); } elseif($plugin_slug=='yith-woocommerce-wishlist'){ $detail= esc_html__('YITH WooCommerce Wishlist allows you to add Wishlist functionality to your e-commerce.','shopline'); } elseif($plugin_slug=='lead-form-builder'){ $detail = esc_html__('Lead form builder is a contact form as well as lead generator plugin. This plugin will allow you create unlimited contact forms and to generate unlimited leads on your site.','shopline'); } elseif($plugin_slug=='crelly-slider'){ $detail = esc_html__('Crelly Slider is a Free / Open Source responsive WordPress slider that supports layers. You can add Texts, Images, YouTube/Vimeo videos using a powerful Drag & Drop Builder and animate each of them.','shopline'); } elseif($plugin_slug=='one-click-demo-import'){ $detail = esc_html__('The best feature of this plugin is, that theme authors can define import files in their themes and so all you (the user of the theme) have to do is click on the "Import Demo Data" button.','shopline'); } echo '

'.$detail.'

'; echo '

Version:'.$version.' '.$author.' '.$button_txt.'

'; echo ''.esc_html__( 'Details', 'shopline' ).''; echo '
'; } } } } function shopline_get_actions_required( ){ $actions = array(); $recommend_plugins = get_theme_support( 'recommend-plugins' ); if ( is_array( $recommend_plugins ) && isset( $recommend_plugins[0] ) ){ $recommend_plugins = $recommend_plugins[0]; } else { $recommend_plugins[] = array(); } if ( ! empty( $recommend_plugins ) ) { foreach ( $recommend_plugins as $plugin_slug => $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{ if($plugin_slug=='yith-woocommerce-wishlist'){ $active_file_name = $plugin_slug . '/init.php'; }else{ $active_file_name = $plugin_slug . '/' . $plugin_slug . '.php'; } } if ( ! is_plugin_active( $active_file_name ) ) { $actions['recommend_plugins'] = 'active'; } } } $actions = apply_filters( 'shopline_get_actions_required', $actions ); $return = array( 'actions' => $actions, 'number_actions' => count( $actions ), ); return $return; }