![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/walla3t.corals.io/wp-content/plugins/apper-core/includes/demo/ |
<?php /* * @package AcmThemes * @author AcmeeDesign * @link https://acmeedesign.com * @importer import configuration for advanced import plugin https://wordpress.org/plugins/advanced-import/ * @since 1.0 */ //disable woocommerce setup wizard add_filter( 'woocommerce_enable_setup_wizard', '__return_false'); add_filter( 'ocdi/plugin_intro_text', 'apper_importer_info' ); function apper_importer_info() { $importer_info = wp_kses_post( '<div class="acmthemes-demo-info">Import demo content will take few minutes to complete. Please do not refresh the page or click the back button.</div>' ); //return the content return ''; } //prevent generating small thumbnails add_filter( 'ocdi/regenerate_thumbnails_in_content_import', '__return_false' ); add_filter( 'ocdi/plugin_page_title', 'apper_importer_page_title' ); function apper_importer_page_title() { //change page title $page_title = '<div class="acm_import-title-container"> <h1 class="acm_import-title">'. esc_html__( 'Import', 'apper' ) . ' Apper '. esc_html__( 'Demo Content', 'apper' ) . '</h1>'; $page_title .= '<div class="acmthemes-demo-info">' . esc_html__( 'Importing demo content will take a few minutes to complete. Please do not refresh the page or click the back button.', 'apper' ) . '</div>'; $page_title .= '</div>'; //show server requirements $page_title .= ( function_exists( 'acm_show_server_reqs' ) ) ? acm_show_server_reqs() : ''; //return the content return $page_title; } add_filter( 'ocdi/plugin_page_setup', 'apper_import_plugin_page_setup' ); function apper_import_plugin_page_setup() { return array( 'parent_slug' => 'themes.php', 'page_title' => esc_html__( 'Import Apper Demo Content' , 'acmthemes' ), 'menu_title' => esc_html__( 'Import Demo Data' , 'acmthemes' ), 'capability' => 'import', 'menu_slug' => 'apper-demo-import', ); } function apper_import_demo_content() { return [ [ 'import_file_name' => 'Home Default', 'import_file_url' => 'https://hostacmee.space/imports/apper/content.xml', 'import_widget_file_url' => 'https://hostacmee.space/imports/apper/apper-widgets.json', 'import_redux' => [ [ 'file_url' => 'https://hostacmee.space/imports/apper/apper_redux_options.json', 'option_name' => 'apper_settings', ], ], 'import_preview_image_url' => 'https://hostacmee.space/previews/apper-screenshot.jpg', 'preview_url' => 'https://hostacmee.space/demo/apper', ], [ 'import_file_name' => 'Home Dark Hero', 'import_file_url' => 'https://hostacmee.space/imports/apper/content.xml', 'import_widget_file_url' => 'https://hostacmee.space/imports/apper/apper-widgets.json', 'import_redux' => [ [ 'file_url' => 'https://hostacmee.space/imports/apper/apper_redux_options.json', 'option_name' => 'apper_settings', ], ], 'import_preview_image_url' => ACMBASE_IMG_DIR_URI . 'apper-home-dark-hero.jpg', 'preview_url' => 'https://hostacmee.space/demo/apper/home-dark-hero/', ], [ 'import_file_name' => 'Home Wave', 'import_file_url' => 'https://hostacmee.space/imports/apper/content.xml', 'import_widget_file_url' => 'https://hostacmee.space/imports/apper/apper-widgets.json', 'import_redux' => [ [ 'file_url' => 'https://hostacmee.space/imports/apper/apper_redux_options.json', 'option_name' => 'apper_settings', ], ], 'import_preview_image_url' => ACMBASE_IMG_DIR_URI . 'apper-home-wave.jpg', 'preview_url' => 'https://hostacmee.space/demo/apper/home-wave/', ], [ 'import_file_name' => 'Home Gradient', 'import_file_url' => 'https://hostacmee.space/imports/apper/content.xml', 'import_widget_file_url' => 'https://hostacmee.space/imports/apper/apper-widgets.json', 'import_redux' => [ [ 'file_url' => 'https://hostacmee.space/imports/apper/apper_redux_options.json', 'option_name' => 'apper_settings', ], ], 'import_preview_image_url' => ACMBASE_IMG_DIR_URI . 'apper-home-gradient.jpg', 'preview_url' => 'https://hostacmee.space/demo/apper/home-gradient/', ], [ 'import_file_name' => 'Home Video', 'import_file_url' => 'https://hostacmee.space/imports/apper/content.xml', 'import_widget_file_url' => 'https://hostacmee.space/imports/apper/apper-widgets.json', 'import_redux' => [ [ 'file_url' => 'https://hostacmee.space/imports/apper/apper_redux_options.json', 'option_name' => 'apper_settings', ], ], 'import_preview_image_url' => ACMBASE_IMG_DIR_URI . 'apper-home-video.jpg', 'preview_url' => 'https://hostacmee.space/demo/apper/home-video/', ], [ 'import_file_name' => 'Home Video 2', 'import_file_url' => 'https://hostacmee.space/imports/apper/content.xml', 'import_widget_file_url' => 'https://hostacmee.space/imports/apper/apper-widgets.json', 'import_redux' => [ [ 'file_url' => 'https://hostacmee.space/imports/apper/apper_redux_options.json', 'option_name' => 'apper_settings', ], ], 'import_preview_image_url' => ACMBASE_IMG_DIR_URI . 'apper-home-video-2.jpg', 'preview_url' => 'https://hostacmee.space/demo/apper/home-video-2/', ], [ 'import_file_name' => 'Home Startup', 'import_file_url' => 'https://hostacmee.space/imports/apper/app-business-content.xml', 'import_widget_file_url' => 'https://hostacmee.space/imports/apper/apper-business-widgets.json', 'import_redux' => [ [ 'file_url' => 'https://hostacmee.space/imports/apper/redux-options-business.json', 'option_name' => 'apper_settings', ], ], 'import_preview_image_url' => ACMBASE_IMG_DIR_URI . 'apper-home-startup-business.jpg', 'preview_url' => 'https://hostacmee.space/demo/apper-store/home-startup/', ], [ 'import_file_name' => 'Home CRM Software', 'import_file_url' => 'https://hostacmee.space/imports/apper/app-business-content.xml', 'import_widget_file_url' => 'https://hostacmee.space/imports/apper/apper-business-widgets.json', 'import_redux' => [ [ 'file_url' => 'https://hostacmee.space/imports/apper/redux-options-business.json', 'option_name' => 'apper_settings', ], ], 'import_preview_image_url' => ACMBASE_IMG_DIR_URI . 'apper-home-crm.jpg', 'preview_url' => 'https://hostacmee.space/demo/apper-store/', ] ]; } add_filter( 'ocdi/import_files', 'apper_import_demo_content' ); add_action( 'ocdi/after_import', 'ocdi_after_import_setup', 1 ); function ocdi_after_import_setup( $selected_import ) { // Assign menus to their locations. $main_menu = get_term_by( 'name', 'Main menu', 'nav_menu' ); $footer_menu = get_term_by( 'name', 'Footer', 'nav_menu' ); set_theme_mod( 'nav_menu_locations', [ 'main_menu' => $main_menu->term_id, //assigning to main_menu location 'footer_menu' => $footer_menu->term_id, //assigning to footer_menu location 'mobile_menu' => $main_menu->term_id, //assigning to mobile_menu location ] ); if( isset( $selected_import['import_file_name'] ) && ! empty( $selected_import['import_file_name'] ) ) { if( 'Home Startup' == $selected_import['import_file_name'] || 'Home CRM Software' == $selected_import['import_file_name'] ) { $topbar_menu = get_term_by( 'name', 'Topbar Menu', 'nav_menu' ); set_theme_mod( 'nav_menu_locations', [ 'topbar_menu' => $topbar_menu->term_id, //assigning to main_menu location ] ); } $page_query = new WP_Query( array( 'post_type' => 'page', 'title' => $selected_import['import_file_name'], ) ); if ( ! empty( $page_query->posts ) ) { $front_page_id = $page_query->posts[0]->ID; } else { $front_page_id = null; } } // Assign front page and posts page (blog page). $blog_page_id = get_page_by_title( 'Blog' ); update_option( 'show_on_front', 'page' ); update_option( 'page_on_front', $front_page_id ); update_option( 'page_for_posts', $blog_page_id->ID ); } //update contact page post meta add_action( 'ocdi/after_import', 'update_elementor_data', 5 ); function update_elementor_data() { //contact us page $contact_page = get_page_by_title( 'Contact' ); $contact_pageid = $contact_page->ID; $meta_data = maybe_unserialize( get_post_meta( $contact_pageid, '_elementor_data', true ) ); $meta_data = json_decode( $meta_data ); $wpforms_form_json = wpforms_form_json(); $forms = json_decode( acm_remove_utf8_bom( $wpforms_form_json ), true ); foreach ( $forms as $form ) { $new_id = wp_insert_post( [ 'post_title' => 'Apper Contact Form', 'post_status' => 'publish', 'post_type' => 'wpforms', 'post_excerpt' => '', ] ); //need to work // if ( $new_id ) { // $form['id'] = $new_id; // wp_update_post( // [ // 'ID' => $new_id, // 'post_content' => acm_forms_encode( $form ), // ] // ); // $meta_data[0]->{'elements'}[1]->{'elements'}[1]->{'settings'}->{'form_id'} = $new_id; // $meta_data = json_encode( $meta_data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_LINE_TERMINATORS | JSON_THROW_ON_ERROR ); // $meta_data = trim( preg_replace( '/\s\s+/', ' ', $meta_data ) ); // update_post_meta( $contact_pageid, '_elementor_data', addslashes($meta_data) ) ; // } } } function acm_remove_utf8_bom( $string ) { if ( strpos( bin2hex( $string ), 'efbbbf' ) === 0 ) { $string = substr( $string, 3 ); } return $string; } function acm_forms_encode( $data = false ) { if ( empty( $data ) ) { return false; } return wp_slash( wp_json_encode( $data ) ); } function wpforms_form_json() { return '[{"fields":{"0":{"id":"0","type":"name","label":"Name","format":"simple","description":"","required":"1","size":"large","simple_placeholder":"Name","simple_default":"","first_placeholder":"","first_default":"","middle_placeholder":"","middle_default":"","last_placeholder":"","last_default":"","css":"","label_hide":"1","sublabel_hide":"1"},"1":{"id":"1","type":"email","label":"Email","description":"","required":"1","size":"large","placeholder":"Email","confirmation_placeholder":"","default_value":false,"filter_type":"","allowlist":"","denylist":"","css":"","label_hide":"1"},"4":{"id":"4","type":"text","label":"Company Name","description":"","size":"large","placeholder":"Company Name","limit_count":"1","limit_mode":"characters","default_value":"","input_mask":"","css":"","label_hide":"1"},"10":{"id":"10","type":"text","label":"Phone","description":"","size":"large","placeholder":"Phone","limit_count":"1","limit_mode":"characters","default_value":"","input_mask":"","css":"","label_hide":"1"},"6":{"id":"6","type":"text","label":"Website","description":"","size":"medium","placeholder":"Website","limit_count":"1","limit_mode":"characters","default_value":"","input_mask":"","css":"","label_hide":"1"},"2":{"id":"2","type":"textarea","label":"Your Message","description":"","required":"1","size":"medium","placeholder":"","limit_count":"1","limit_mode":"characters","default_value":"","css":"","label_hide":"1"},"7":{"id":"7","type":"checkbox","label":"Checkboxes","choices":{"1":{"label":"I agree to the terms and conditions.","value":"","image":"","icon":"face-smile","icon_style":"regular"}},"choices_images_style":"modern","choices_icons_color":"#0399ed","choices_icons_size":"large","choices_icons_style":"default","description":"","required":"1","input_columns":"","choice_limit":"","dynamic_choices":"","css":"","label_hide":"1"}},"id":"1137","field_id":11,"settings":{"form_title":"Apper Contact Form","form_desc":"","submit_text":"Submit","submit_text_processing":"Sending...","form_class":"","submit_class":"","ajax_submit":"1","notification_enable":"1","notifications":{"1":{"email":"{admin_email}","subject":"New Entry: Simple Contact Form","sender_name":"Apper - App Landing and Business WordPress Theme","sender_address":"{admin_email}","replyto":"{field_id=\"1\"}","message":"{all_fields}"}},"confirmations":{"1":{"type":"message","message":"<p>Thanks for contacting us! We will be in touch with you shortly.<\/p>","message_scroll":"1","page":"999","redirect":""}},"antispam":"1","form_tags":[]},"meta":{"template":"simple-contact-form-template"}}]'; } //WPForms template if ( class_exists( 'WPForms_Template', false ) ) : /** * Apper Contact Form * Template for WPForms. */ class WPForms_Template_apper_contact_form extends WPForms_Template { /** * Primary class constructor. * * @since 1.0.0 */ public function init() { // Template name $this->name = 'Apper Contact Form'; // Template slug $this->slug = 'apper_contact_form'; // Template description $this->description = ''; // Template field and settings $this->data = array ( 'fields' => array ( 0 => array ( 'id' => '0', 'type' => 'name', 'label' => 'Name', 'format' => 'simple', 'required' => '1', 'size' => 'large', 'simple_placeholder' => 'Name', 'label_hide' => '1', 'sublabel_hide' => '1', ), 1 => array ( 'id' => '1', 'type' => 'email', 'label' => 'Email', 'required' => '1', 'size' => 'large', 'placeholder' => 'Email', 'default_value' => false, 'label_hide' => '1', ), 4 => array ( 'id' => '4', 'type' => 'text', 'label' => 'Company Name', 'size' => 'large', 'placeholder' => 'Company Name', 'limit_count' => '1', 'limit_mode' => 'characters', 'label_hide' => '1', ), 10 => array ( 'id' => '10', 'type' => 'text', 'label' => 'Phone', 'size' => 'large', 'placeholder' => 'Phone', 'limit_count' => '1', 'limit_mode' => 'characters', 'label_hide' => '1', ), 6 => array ( 'id' => '6', 'type' => 'text', 'label' => 'Website', 'size' => 'medium', 'placeholder' => 'Website', 'limit_count' => '1', 'limit_mode' => 'characters', 'label_hide' => '1', ), 2 => array ( 'id' => '2', 'type' => 'textarea', 'label' => 'Your Message', 'required' => '1', 'size' => 'medium', 'limit_count' => '1', 'limit_mode' => 'characters', 'label_hide' => '1', ), 7 => array ( 'id' => '7', 'type' => 'checkbox', 'label' => 'Checkboxes', 'choices' => array ( 1 => array ( 'label' => 'I agree to the terms and conditions.', 'icon' => 'face-smile', 'icon_style' => 'regular', ), ), 'choices_images_style' => 'modern', 'choices_icons_color' => '#0399ed', 'choices_icons_size' => 'large', 'choices_icons_style' => 'default', 'required' => '1', 'label_hide' => '1', ), ), 'field_id' => 11, 'settings' => array ( 'form_title' => 'Apper Contact Form', 'submit_text' => 'Submit', 'submit_text_processing' => 'Sending...', 'ajax_submit' => '1', 'notification_enable' => '1', 'notifications' => array ( 1 => array ( 'email' => '{admin_email}', 'subject' => 'New Entry: Simple Contact Form', 'sender_name' => 'Apper - App Landing and Business WordPress Theme', 'sender_address' => '{admin_email}', 'replyto' => '{field_id="1"}', 'message' => '{all_fields}', ), ), 'confirmations' => array ( 1 => array ( 'type' => 'message', 'message' => '<p>Thanks for contacting us! We will be in touch with you shortly.</p>', 'message_scroll' => '1', 'page' => '999', ), ), 'antispam' => '1', 'form_tags' => array ( ), ), 'meta' => array ( 'template' => 'apper_contact_form', ), ); } } new WPForms_Template_apper_contact_form(); endif;