set_vars( $cab_booking_config );
$this->init();
}
/**
* Set some settings
* @since 1.0.0
* @param $cab_booking_config Our config parameters
*/
public function set_vars( $cab_booking_config ) {
if( isset( $cab_booking_config['page_slug'] ) ) {
$this->page_slug = esc_attr( $cab_booking_config['page_slug'] );
}
if( isset( $cab_booking_config['page_title'] ) ) {
$this->page_title = esc_attr( $cab_booking_config['page_title'] );
}
if( isset( $cab_booking_config['steps'] ) ) {
$this->config_steps = $cab_booking_config['steps'];
}
$current_theme = wp_get_theme();
$this->theme_title = $current_theme->get( 'Name' );
$this->theme_name = strtolower( preg_replace( '#[^a-zA-Z]#', '', $current_theme->get( 'Name' ) ) );
$this->page_slug = apply_filters( $this->theme_name . '_theme_setup_wizard_page_slug', $this->theme_name . '-demoimport' );
$this->parent_slug = apply_filters( $this->theme_name . '_theme_setup_wizard_parent_slug', '' );
}
/**
* Hooks and filters
* @since 1.0.0
*/
public function init() {
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
add_action( 'admin_menu', array( $this, 'menu_page' ) );
add_action( 'wp_ajax_setup_widgets', array( $this, 'setup_widgets' ) );
}
public function enqueue_scripts() {
wp_enqueue_style( 'demo-import-style', get_template_directory_uri() . '/demo-import/assets/css/demo-import-style.css');
wp_register_script( 'demo-import-script', get_template_directory_uri() . '/demo-import/assets/js/demo-import-script.js', array( 'jquery' ), time() );
wp_localize_script(
'demo-import-script',
'cab_booking_whizzie_params',
array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'wpnonce' => wp_create_nonce( 'whizzie_nonce' ),
'verify_text' => esc_html( 'verifying', 'cab-booking' )
)
);
wp_enqueue_script( 'demo-import-script' );
}
/** Make a modal screen for the wizard **/
public function menu_page() {
add_menu_page( esc_html( $this->page_title ), esc_html( $this->page_title ), 'manage_options', $this->page_slug, array( $this, 'cab_booking_guide' ) ,'',40);
}
/** Make an interface for the wizard **/
public function wizard_page() {
/* If we arrive here, we have the filesystem */ ?>
';
// The wizard is a list with only one item visible at a time
$steps = $this->get_steps();
echo '
';
echo '';
?>
';?>
config_steps;
$steps = array(
'widgets' => array(
'id' => 'widgets',
'title' => __( 'Customizer', 'cab-booking' ),
'icon' => 'welcome-widgets-menus',
'view' => 'get_step_widgets',
'callback' => 'install_widgets',
'button_text_one' => __( 'Import Demo', 'cab-booking' ),
'can_skip' => true,
'icon_text' => 'Import Demo'
),
'done' => array(
'id' => 'done',
'title' => __( 'All Done', 'cab-booking' ),
'icon' => 'yes',
'view' => 'get_step_done',
'callback' => '',
'icon_text' => 'Done'
)
);
// Iterate through each step and replace with dev config values
if( $dev_steps ) {
// Configurable elements - these are the only ones the dev can update from config.php
$can_config = array( 'title', 'icon', 'button_text', 'can_skip' );
foreach( $dev_steps as $dev_step ) {
// We can only proceed if an ID exists and matches one of our IDs
if( isset( $dev_step['id'] ) ) {
$id = $dev_step['id'];
if( isset( $steps[$id] ) ) {
foreach( $can_config as $element ) {
if( isset( $dev_step[$element] ) ) {
$steps[$id][$element] = $dev_step[$element];
}
}
}
}
}
}
return $steps;
}
/** Print the content for the intro step **/
public function get_step_importer() { ?>
__('Home', 'cab-booking'),
'menu-item-classes' => 'home',
'menu-item-url' => home_url('/'),
'menu-item-status' => 'publish'
));
// About
$cab_booking_page_about = get_page_by_path('about');
if($cab_booking_page_about){
wp_update_nav_menu_item($cab_booking_menu_id, 0, array(
'menu-item-title' => __('About', 'cab-booking'),
'menu-item-classes' => 'about',
'menu-item-url' => get_permalink($cab_booking_page_about),
'menu-item-status' => 'publish'
));
}
// Services
$cab_booking_page_services = get_page_by_path('services');
if($cab_booking_page_services){
wp_update_nav_menu_item($cab_booking_menu_id, 0, array(
'menu-item-title' => __('Services', 'cab-booking'),
'menu-item-classes' => 'services',
'menu-item-url' => get_permalink($cab_booking_page_services),
'menu-item-status' => 'publish'
));
}
// Blog
$cab_booking_page_blog = get_page_by_path('blog');
if($cab_booking_page_blog){
wp_update_nav_menu_item($cab_booking_menu_id, 0, array(
'menu-item-title' => __('Blog', 'cab-booking'),
'menu-item-classes' => 'blog',
'menu-item-url' => get_permalink($cab_booking_page_blog),
'menu-item-status' => 'publish'
));
}
// Contact Us
$cab_booking_page_contact = get_page_by_path('contact');
if($cab_booking_page_contact){
wp_update_nav_menu_item($cab_booking_menu_id, 0, array(
'menu-item-title' => __('Contact Us', 'cab-booking'),
'menu-item-classes' => 'contact',
'menu-item-url' => get_permalink($cab_booking_page_contact),
'menu-item-status' => 'publish'
));
}
// Assign menu to location if not set
if (!has_nav_menu($cab_booking_menulocation)) {
$cab_booking_locations = get_theme_mod('nav_menu_locations');
$cab_booking_locations[$cab_booking_menulocation] = $cab_booking_menu_id; // Use $cab_booking_menu_id here
set_theme_mod('nav_menu_locations', $cab_booking_locations);
}
}
}
public function cab_booking_social_menu() {
// ------- Create Social Menu --------
$cab_booking_menuname = $cab_booking_themename . 'Social Menu';
$cab_booking_menulocation = 'social-menu';
$cab_booking_menu_exists = wp_get_nav_menu_object( $cab_booking_menuname );
if( !$cab_booking_menu_exists){
$cab_booking_menu_id = wp_create_nav_menu($cab_booking_menuname);
wp_update_nav_menu_item( $cab_booking_menu_id, 0, array(
'menu-item-title' => __( 'Facebook', 'cab-booking' ),
'menu-item-url' => 'https://www.facebook.com',
'menu-item-status' => 'publish',
) );
wp_update_nav_menu_item( $cab_booking_menu_id, 0, array(
'menu-item-title' => __( 'Pinterest', 'cab-booking' ),
'menu-item-url' => 'https://www.pinterest.com',
'menu-item-status' => 'publish',
) );
wp_update_nav_menu_item( $cab_booking_menu_id, 0, array(
'menu-item-title' => __( 'Twitter', 'cab-booking' ),
'menu-item-url' => 'https://www.twitter.com',
'menu-item-status' => 'publish',
) );
wp_update_nav_menu_item( $cab_booking_menu_id, 0, array(
'menu-item-title' => __( 'Youtube', 'cab-booking' ),
'menu-item-url' => 'https://www.youtube.com',
'menu-item-status' => 'publish',
) );
wp_update_nav_menu_item( $cab_booking_menu_id, 0, array(
'menu-item-title' => __( 'Instagram', 'cab-booking' ),
'menu-item-url' => 'https://www.instagram.com',
'menu-item-status' => 'publish',
) );
if( !has_nav_menu( $cab_booking_menulocation ) ){
$locations = get_theme_mod('nav_menu_locations');
$locations[$cab_booking_menulocation] = $cab_booking_menu_id;
set_theme_mod( 'nav_menu_locations', $locations );
}
}
}
/**
* Imports the Demo Content
* @since 1.1.0
*/
public function setup_widgets() {
//................................................. MENU PAGES .................................................//
$cab_booking_home_id='';
$cab_booking_home_content = '';
$cab_booking_home_title = 'Home';
$cab_booking_home = array(
'post_type' => 'page',
'post_title' => $cab_booking_home_title,
'post_content' => $cab_booking_home_content,
'post_status' => 'publish',
'post_author' => 1,
'post_slug' => 'home'
);
$cab_booking_home_id = wp_insert_post($cab_booking_home);
//Set the home page template
add_post_meta( $cab_booking_home_id, '_wp_page_template', 'revolution-home.php' );
//Set the static front page
$cab_booking_home = get_page_by_title( 'Home' );
update_option( 'page_on_front', $cab_booking_home->ID );
update_option( 'show_on_front', 'page' );
// Create a posts page and assign the template
$cab_booking_blog_title = 'Blog';
$cab_booking_blog_check = get_page_by_path('blog');
if (!$cab_booking_blog_check) {
$cab_booking_blog = array(
'post_type' => 'page',
'post_title' => $cab_booking_blog_title,
'post_status' => 'publish',
'post_author' => 1,
'post_name' => 'blog' // Unique slug for the blog page
);
$cab_booking_blog_id = wp_insert_post($cab_booking_blog);
// Set the posts page
if (!is_wp_error($cab_booking_blog_id)) {
update_option('page_for_posts', $cab_booking_blog_id);
}
}
// Create a Contact Us page and assign the template
$cab_booking_contact_title = 'Contact Us';
$cab_booking_contact_check = get_page_by_path('contact');
if (!$cab_booking_contact_check) {
$cab_booking_contact = array(
'post_type' => 'page',
'post_title' => $cab_booking_contact_title,
'post_status' => 'publish',
'post_author' => 1,
'post_name' => 'contact' // Unique slug for the Contact Us page
);
wp_insert_post($cab_booking_contact);
}
// Create a About page and assign the template
$cab_booking_about_title = 'About';
$cab_booking_about_check = get_page_by_path('about');
if (!$cab_booking_about_check) {
$cab_booking_about = array(
'post_type' => 'page',
'post_title' => $cab_booking_about_title,
'post_status' => 'publish',
'post_author' => 1,
'post_name' => 'about' // Unique slug for the About page
);
wp_insert_post($cab_booking_about);
}
// Create a Services page and assign the template
$cab_booking_services_title = 'Services';
$cab_booking_services_check = get_page_by_path('services');
if (!$cab_booking_services_check) {
$cab_booking_services = array(
'post_type' => 'page',
'post_title' => $cab_booking_services_title,
'post_status' => 'publish',
'post_author' => 1,
'post_name' => 'services' // Unique slug for the Services page
);
wp_insert_post($cab_booking_services);
}
// ------------------------------------------ Header -------------------------------------- //
set_theme_mod('cab_booking_phone_number','900-300-600');
// ------------------------------------------ Slider Section -------------------------------------- //
set_theme_mod('cab_booking_enable_slider',1);
set_theme_mod('cab_booking_slide_number','3');
for($i=1;$i<=3;$i++){
set_theme_mod( 'cab_booking_slider_image'.$i,get_template_directory_uri().'/revolution/assets/images/slider'.$i.'.png' );
set_theme_mod( 'cab_booking_slider_heading'.$i, '20% OFF FOR Online BOOKING' );
set_theme_mod( 'cab_booking_slider_text'.$i, 'From as low as $10 per day with limited time offer discounts' );
set_theme_mod( 'cab_booking_slider_button1_text'.$i, 'LEARN MORE' );
set_theme_mod( 'cab_booking_slider_button1_link'.$i, '#' );
}
// ------------------------------------------ Services Section -------------------------------------- //
$icon=array('fa fa-car','fa fa-wallet','fa fa-users');
$heading=array('Variety Of Cars','Best Rates','Satisfied Clients');
set_theme_mod('cab_booking_services_number','3');
for($i=1;$i<=3;$i++) {
set_theme_mod( 'cab_booking_services_icon'.$i, $icon[$i-1] );
set_theme_mod( 'cab_booking_services_heading'.$i, $heading[$i-1] );
set_theme_mod( 'cab_booking_services_text'.$i, 'Lorem ipsum dolor sit' );
}
// ------------------------------------------ Popular Cars Section -------------------------------------- //
set_theme_mod('cab_booking_popular_car_heading','Popular Cars');
set_theme_mod('cab_booking_popular_number','3');
for($i=1;$i<=3;$i++) {
set_theme_mod( 'cab_booking_popular_car_image'.$i,get_template_directory_uri().'/revolution/assets/images/cars'.$i.'.png' );
set_theme_mod( 'cab_booking_popular_car_price'.$i, '$180' );
set_theme_mod( 'cab_booking_popular_car_duration'.$i, '/Day' );
set_theme_mod( 'cab_booking_popular_car_heading'.$i, 'Mercedes Luxury Car' );
set_theme_mod( 'cab_booking_popular_car_seats'.$i, '4 Seats' );
set_theme_mod( 'cab_booking_popular_car_types'.$i, 'Automatic' );
set_theme_mod( 'cab_booking_popular_car_year'.$i, '2018' );
set_theme_mod( 'cab_booking_services_mode'.$i, 'A/C' );
set_theme_mod( 'cab_booking_popular_car_button_text'.$i, 'RENT A CAR' );
set_theme_mod( 'cab_booking_popular_car_button_link'.$i, '#' );
}
$this->cab_booking_customizer_nav_menu();
$this->cab_booking_social_menu();
}
public function cab_booking_guide() {
$display_string = '';
$return = add_query_arg( array()) ;
$theme = wp_get_theme( 'cab-booking' );
?>