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_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', 'oneline-lite' ); $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', 'oneline-lite' ); } $url = esc_url($install_url); return "{$button_txt}"; } function popup_styles() { wp_enqueue_style('oneline_lite_customizer_popup', get_template_directory_uri() . '/inc/theme-setup/customizer-popup-styles.css'); } function popup_scripts() { wp_enqueue_script( 'oneline_lite_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', 'oneline-lite' ); if ( is_plugin_active( $active_file_name ) ) { echo false; }else{ echo $install_url; } } add_action( 'wp_ajax_oneline_lite_default_home', 'oneline_lite_default_home' ); function oneline_lite_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', 'post_content' => '', 'post_name' => 'oneline-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 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 oneline_lite_tab_config($theme_data){ $config = array( 'theme_brand' => __('ThemeHunk','oneline-lite'), 'theme_brand_url' => esc_url($theme_data->get( 'AuthorURI' )), 'welcome'=>sprintf(esc_html__('Welcome to OneLine Lite - Version %1s', 'oneline-lite'), $theme_data->get( 'Version' ) ), 'welcome_desc' => esc_html__( ' Oneline is a versatile one page theme for creating beautiful websites. This theme comes with powerful features which will help you in designing a wonderful website for any type of niche (Business, Landing page, E-commerce, Local business, Personal website).', 'oneline-lite' ), 'tab_one' =>esc_html__('Get Started with OneLine Lite', 'oneline-lite' ), 'tab_two' =>esc_html__( 'Recommended Actions', 'oneline-lite' ), 'tab_three' =>esc_html__( 'Free VS Pro', 'oneline-lite' ), 'plugin_title' => esc_html__( 'Step 1 - Do recommended actions', 'oneline-lite' ), 'plugin_link' => '?page=th_oneline_lite&tab=actions_required', 'plugin_text' => sprintf(esc_html__('Firstly install recommended plugin Themehunk Customizer. It will activate homepage sections ( Like : Header, Ribbon, Service, About Us, Team, WooCommerce, Testimonial and Contact Us ).', 'oneline-lite'), $theme_data->get( 'Name' )), 'plugin_button' => esc_html__('Go To Recommended Action', 'oneline-lite'), 'docs_title' => esc_html__( 'Step 2 - Configure Homepage Layout', 'oneline-lite' ), 'video_link' => esc_url('//www.youtube.com/watch?v=pHCoxwYCZGQ'), 'docs_button' => esc_html__('Configuration Instructions (with video)', 'oneline-lite'), 'customizer_title' => esc_html__( 'Step 3 - Customize Your Website', 'oneline-lite' ), 'customizer_text' => sprintf(esc_html__('%s theme support live customizer for home page set up. Everything visible at home page can be changed through customize panel', 'oneline-lite'), $theme_data->Name), 'customizer_button' => sprintf( esc_html__('Start Customize', 'oneline-lite')), 'support_title' => esc_html__( 'Step 4 - Theme Support', 'oneline-lite' ), 'support_link' => esc_url('//www.themehunk.com/support/'), 'support_forum' => sprintf(esc_html__('Support Forum', 'oneline-lite'), $theme_data->get( 'Name' )), 'doc_link' => esc_url('//www.themehunk.com/docs/oneline-lite-theme/'), 'doc_link_text' => sprintf(esc_html__('Theme Documentation', 'oneline-lite'), $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.', 'oneline-lite'), $theme_data->get( 'Name' )), 'support_button' => sprintf( esc_html__('Create a support ticket', 'oneline-lite'), $theme_data->get( 'Name' )), ); return $config; } if ( ! function_exists( 'oneline_lite_admin_scripts' ) ) : /** * Enqueue scripts for admin page only: Theme info page */ function oneline_lite_admin_scripts( $hook ) { if ($hook === 'appearance_page_th_oneline_lite' ) { wp_enqueue_style( 'oneline-lite-admin-css', get_template_directory_uri() . '/css/admin.css' ); // 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', 'oneline_lite_admin_scripts' ); function online_lite_count_active_plugins() { $i = 3; if ( shortcode_exists( 'themehunk-customizer-oneline-lite' ) ): $i--; endif; if(class_exists( 'woocommerce' )) : $i--; endif; if ( shortcode_exists( 'lead-form' ) ): $i--; endif; return $i; } function oneline_lite_tab_count(){ $count = ''; $number_count = online_lite_count_active_plugins(); if( $number_count >0): $count = "" . number_format_i18n($number_count) . ""; endif; return $count; } /** * Menu tab */ function oneline_lite_tab() { $number_count = online_lite_count_active_plugins(); $menu_title = esc_html__('Get Started with OneLine Lite', 'oneline-lite'); if( $number_count >0): $count = "" . number_format_i18n($number_count) . ""; $menu_title = sprintf( esc_html__('Get Started with OneLine Lite %s', 'oneline-lite'), $count ); endif; add_theme_page( esc_html__( 'OneLine Lite', 'oneline-lite' ), $menu_title, 'edit_theme_options', 'th_oneline_lite', 'oneline_lite_tab_page'); } add_action('admin_menu', 'oneline_lite_tab'); function oneline_lite_pro_theme(){ ?>
free vs pro

Check Pro version for more features

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 ); $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', 'oneline-lite' ); 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', 'oneline-lite' ); } $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=='lead-form-builder'){ $detail='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.'; } elseif($plugin_slug=='themehunk-customizer'){ $detail= '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.'; } elseif($plugin_slug=='woocommerce'){ $detail='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.'; } echo '

'.$detail.'

'; echo '

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

'; echo ''.esc_html__( 'Details', 'oneline-lite' ).''; echo '
'; } } } } function oneline_lite_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 { $active_file_name = $plugin_slug . '/' . $plugin_slug . '.php'; } if ( ! is_plugin_active( $active_file_name ) ) { $actions['recommend_plugins'] = 'active'; } } } $actions = apply_filters( 'oneline_lite_get_actions_required', $actions ); $return = array( 'actions' => $actions, 'number_actions' => count( $actions ), ); return $return; }