function gdlr_get_masterslider_list() { if (!function_exists('get_masterslider_names')) { return; } return get_masterslider_names(true); }
/** * Specifies the classname and description, instantiates the widget, */ public function __construct() { $this->fields['1']['options'] = get_masterslider_names(); parent::__construct('master-slider-main-widget', __('Master Slider Widget', MSWP_TEXT_DOMAIN), array('classname' => 'master-slider-main-widget', 'description' => __('Display a Master Slider', MSWP_TEXT_DOMAIN))); }
<?php /*----------------------------------------------------------------------------* * Compatibility for Visual Composer Plugin *----------------------------------------------------------------------------*/ if (defined('WPB_VC_VERSION')) { wpb_map(array('name' => __('Master Slider', MSWP_TEXT_DOMAIN), 'base' => 'masterslider_pb', 'class' => '', 'controls' => 'full', 'icon' => 'icon-vc-msslider-el', 'category' => __('Content', MSWP_TEXT_DOMAIN), 'description' => __('Add Master Slider', MSWP_TEXT_DOMAIN), 'params' => array(array('type' => 'textfield', 'heading' => __('Title ', MSWP_TEXT_DOMAIN), 'param_name' => 'title', 'value' => '', 'description' => __('What text use as slider title. Leave blank if no title is needed', MSWP_TEXT_DOMAIN)), array('type' => 'dropdown', 'heading' => __('Master Slider', MSWP_TEXT_DOMAIN), 'param_name' => 'id', 'value' => get_masterslider_names(false), 'description' => __('Select slider from list', MSWP_TEXT_DOMAIN)), array('type' => 'textfield', 'heading' => __('Extra CSS Class Name', MSWP_TEXT_DOMAIN), 'param_name' => 'class', 'value' => '', 'description' => __('If you wish to style particular element differently, then use this field to add a class name and then refer to it in your css file.', MSWP_TEXT_DOMAIN))))); } /*----------------------------------------------------------------------------*/
public function __construct($name, $default, $properties = array()) { parent::__construct($name, $default, $properties); $type_options = array('' => __('None', 'everything'), 'empty' => __('Empty space', 'everything'), 'image' => __('Image', 'everything'), 'thumbnail' => __('Featured image', 'everything'), 'slider' => __('Slider', 'everything'), 'map' => __('Map', 'everything'), 'page' => __('Page', 'everything'), 'embed' => __('Embeding code', 'everything'), 'custom' => __('Custom HTML', 'everything')); if (!isset($this->slider)) { unset($type_options['slider']); } if (!isset($this->map)) { unset($type_options['map']); } $this->type->options = $type_options; $this->height->unit = 'px'; $this->height->min = 0; $this->height->indent = true; $this->height->owner = $this->type; $this->height->owner_value = 'empty'; $this->image->indent = true; $this->image->owner = $this->type; $this->image->owner_value = 'image'; if (isset($this->slider)) { $this->slider->required = false; $this->slider->options = function ($option) { $options = array(); if (\Everything::isPluginActive('layerslider')) { foreach (\lsSliders() as $slider) { $options['layerslider-' . $slider['id']] = $slider['name']; $option->groups['LayerSlider WP'][] = 'layerslider-' . $slider['id']; } } if (\Everything::isPluginActive('masterslider')) { foreach (get_masterslider_names() as $id => $name) { $options['masterslider-' . $id] = $name; $option->groups['Master Slider WP'][] = 'masterslider-' . $id; } } if (\Everything::isPluginActive('revslider')) { $revslider = new \RevSlider(); foreach ($revslider->getArrSliders() as $slider) { $options['revslider-' . $slider->getID()] = $slider->getTitle(); $option->groups['Revolution Slider'][] = 'revslider-' . $slider->getID(); } } return $options; }; $this->slider->indent = true; $this->slider->owner = $this->type; $this->slider->owner_value = 'slider'; } if (isset($this->map)) { $this->map->required = false; $this->map->options = function ($option) { $options = array(); if (\Everything::isPluginActive('wild-googlemap')) { $maps = \WiLD_BackendGooglemapManager::getInstance()->get_maps(); foreach ($maps as $map) { $options['wild-googlemap-' . $map->id] = $map->name; $option->groups['WiLD Googlemap'][] = 'wild-googlemap-' . $map->id; } } if (\Everything::isPluginActive('wp-google-map-plugin')) { $maps = $GLOBALS['wpdb']->get_results("SELECT map_id, map_title FROM {$GLOBALS['wpdb']->prefix}create_map ORDER BY map_id ASC", ARRAY_A); foreach ($maps as $map) { $options['wp-google-map-plugin-' . $map['map_id']] = $map['map_title']; $option->groups['WP Google Map Plugin'][] = 'wp-google-map-plugin-' . $map['map_id']; } } return $options; }; $this->map->indent = true; $this->map->owner = $this->type; $this->map->owner_value = 'map'; } $this->page->required = false; $this->page->options = function () { return \Drone\Func::wpPostsList(array('numberposts' => -1, 'post_type' => 'page')); }; $this->page->indent = true; $this->page->owner = $this->type; $this->page->owner_value = 'page'; $this->embed->description = __('Embeding code from YouTube, Vimeo, Google Maps or other.', 'everything'); $this->embed->indent = true; $this->embed->owner = $this->type; $this->embed->owner_value = 'embed'; $this->custom->indent = true; $this->custom->owner = $this->type; $this->custom->owner_value = 'custom'; }
/** * Flush and re-cache all slideres if slider cache is enabled * * @return bool True if the cache is flushed and false otherwise */ function msp_flush_all_sliders_cache() { $is_cache_enabled = 'on' == msp_get_setting('_enable_cache', 'msp_general_setting', 'off'); if (!$is_cache_enabled) { return false; } $all_sliders = get_masterslider_names(); foreach ($all_sliders as $slider_id => $slider_name) { msp_generate_slider_output($slider_id, true); } return true; }
function pvt_wordpress_content_importer() { $theme_dir = get_template_directory(); if (is_admin() && isset($_GET['importcontent'])) { if (!defined('WP_LOAD_IMPORTERS')) { define('WP_LOAD_IMPORTERS', true); } if (!class_exists('WP_Importer')) { $class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php'; if (file_exists($class_wp_importer)) { include $class_wp_importer; } } if (!class_exists('pvt_WP_Import')) { $class_wp_import = $theme_dir . '/inc/importer/wordpress-importer.php'; if (file_exists($class_wp_import)) { include $class_wp_import; } } if (class_exists('WP_Importer') && class_exists('pvt_WP_Import')) { $importer = new pvt_WP_Import(); $files_to_import = array(); // Live Composer has links to images hard-coded, so before importing // media we need to check that the Settings > Media > // 'Organize my uploads into month- and year-based folders' unchecked // as on demo server. After import is done we set back original state // of this setting. $setting_original_useyearmonthfolders = get_option('uploads_use_yearmonth_folders'); update_option('uploads_use_yearmonth_folders', 0); if ($_GET['importcontent'] == 'basic-templates') { $import_path = $theme_dir . '/design/basic-config/'; $files_to_import[] = $import_path . 'seowp-templates.xml.gz'; $files_to_import[] = $import_path . 'seowp-themefooters.xml.gz'; $files_to_import[] = $import_path . 'seowp-systempagetemplates.xml.gz'; $files_to_import[] = $import_path . 'seowp-livecomposer-tutorials.xml.gz'; } if ($_GET['importcontent'] == 'alldemocontent') { $import_path = $theme_dir . '/design/demo-content/'; $files_array = array(array('seowp-homepages.xml.gz', 'seowp-predesignedpages-1.xml.gz'), array('seowp-predesignedpages-2.xml.gz', 'seowp-predesignedpages-3.xml.gz'), array('seowp-predesignedpages-4.xml.gz', 'seowp-predesignedpages-5.xml.gz'), array('seowp-predesignedpages-6.xml.gz', 'seowp-predesignedpages-7.xml.gz'), array('seowp-predesignedpages-8.xml.gz', 'seowp-predesignedpages-9.xml.gz'), array('seowp-predesignedpages-10.xml.gz', 'seowp-predesignedpages-11.xml.gz'), array('seowp-downloads.xml.gz', 'seowp-partners.xml.gz'), array('seowp-staff.xml.gz', 'seowp-testimonials.xml.gz'), array('seowp-posts.xml.gz', 'seowp-projects.xml.gz'), array('seowp-media-homepage.xml.gz'), array('seowp-media-menuimages.xml.gz'), array('seowp-media-sliderimages.xml.gz'), array('seowp-media-clientlogos.xml.gz'), array('seowp-media-blogpostthumbs.xml.gz'), array('seowp-media-footerimages.xml.gz'), array('seowp-media-staffavatars.xml.gz'), array('seowp-media-servicepage.xml.gz'), array('seowp-media-sectionbackgrounds.xml.gz'), array('seowp-media-ebookcovers.xml.gz'), array('seowp-media-projectthumbs.xml.gz')); if (isset($_GET['importcontent_part'])) { foreach ($files_array[$_GET['importcontent_part']] as $file_name) { $files_to_import[] = $import_path . $file_name; } if (isset($files_array[$_GET['importcontent_part'] + 1])) { echo '<input type="hidden" name="importcontent_part" id="importcontent_part" value="' . ($_GET['importcontent_part'] + 1) . '" />'; } } } // Start Import if (file_exists($class_wp_importer)) { // Import included images $importer->fetch_attachments = true; foreach ($files_to_import as $import_file) { if (is_file($import_file)) { ob_start(); $importer->import($import_file); $log = ob_get_contents(); ob_end_clean(); // output log in the hidden div echo '<div class="ajax-log">'; echo $log; echo '</div>'; if (stristr($log, 'error') || !stristr($log, 'All done.')) { // Set marker div that will be fildered by ajax request echo '<div class="ajax-request-error"></div>'; // output log in the div echo '<div class="ajax-error-log">'; echo $log; echo '</div>'; } } else { // Set marker div that will be fildered by ajax request echo '<div class="ajax-request-error"></div>'; // output log in the div echo '<div class="ajax-error-log">'; echo "Can't open file: " . $import_file . "</ br>"; echo '</div>'; } } } else { // Set marker div that will be fildered by ajax request echo '<div class="ajax-request-error"></div>'; // output log in the div echo '<div class="ajax-error-log">'; echo "Failed to load: " . $class_wp_import . "</ br>"; echo '</div>'; } // Set 'Organize my uploads into month- and year-based folders' setting // to its original state update_option('uploads_use_yearmonth_folders', $setting_original_useyearmonthfolders); } /** * ---------------------------------------------------------------------- * Basic configuration: * Post import actions */ if ($_GET['importcontent'] == 'basic-templates') { // 1. Import Menus // 2. Activate Mega Main Menu for menu locations // 3. Import Widgets // 4. Demo description for author // 5. Tutorial Pages for LiveComposer // 6. Newsletter Sign-Up Plugin Settings // 7. Rotating Tweets Default Options Setup // 8. Regenerate Custom CSS // Path to the folder with basic import files $import_path_basic_config = $theme_dir . '/design/basic-config/'; // 1: // Import Top Bar menu // if no menu set for 'topbar' location if (!has_nav_menu('topbar')) { if (is_plugin_active('wpfw_menus_management/wpfw_menus_management.php')) { wpfw_import_menu($import_path_basic_config . 'seowp-menu-topbar.txt', 'topbar'); } } // Import Mega Main Menu menu // if no menu set for 'header-menu' location if (!has_nav_menu('header-menu')) { if (is_plugin_active('wpfw_menus_management/wpfw_menus_management.php')) { wpfw_import_menu($import_path_basic_config . 'seowp-menu-megamainmenu.txt', 'header-menu'); } } $locations = get_nav_menu_locations(); set_theme_mod('nav_menu_locations', $locations); // Import Mobile Off-Canvas Menu if (is_plugin_active('wpfw_menus_management/wpfw_menus_management.php')) { wpfw_import_menu($import_path_basic_config . 'seowp-menu-mobile-offcanvas.txt'); } // 2: Activate Mega Main Menu for 'topbar' and 'header-menu' locations // See /inc/plugins-integration/megamainmenu.php for function source if (is_plugin_active('mega_main_menu/mega_main_menu.php')) { lbmn_activate_mainmegamenu_locations(); } // Predefine Custom Sidebars in LiveComposer // First set new sidebars in options table update_option('dslc_plugin_options_widgets_m', array('sidebars' => 'Sidebar,404 Page Widgets,Comment Form Area,')); // Define default Archive and Search options with System Templates // 404 Page Template $current_lc_archive_options = get_option('dslc_plugin_options_archives'); $current_lc_archive_options['404_page'] = lbmn_get_page_by_title(LBMN_SYSTEMPAGE_404_DEFAULT, 'lbmn_archive'); // Archive Page Template $new_archive_listing_id = lbmn_get_page_by_title(LBMN_SYSTEMPAGE_ARCHIVE_DEFAULT, 'lbmn_archive'); $current_lc_archive_options['post'] = $new_archive_listing_id; $current_lc_archive_options['dslc_projects'] = $new_archive_listing_id; $current_lc_archive_options['dslc_galleries'] = $new_archive_listing_id; $current_lc_archive_options['dslc_downloads'] = $new_archive_listing_id; $current_lc_archive_options['dslc_staff'] = $new_archive_listing_id; $current_lc_archive_options['dslc_partners'] = $new_archive_listing_id; $current_lc_archive_options['author'] = $new_archive_listing_id; // Search Results $new_search_listing_id = lbmn_get_page_by_title(LBMN_SYSTEMPAGE_SEARCHRESULTS_DEFAULT, 'lbmn_archive'); $current_lc_archive_options['search_results'] = $new_search_listing_id; update_option('dslc_plugin_options_archives', $current_lc_archive_options); // Then run LiveComposer function that creates sidebars dynamically dslc_sidebars(); // 3: Import widgets $files_with_widgets_to_import = array(); $files_with_widgets_to_import[] = $import_path_basic_config . 'seowp-widgets.wie'; // Remove default widgets from 'mobile-offcanvas' widget area $sidebars_widgets = get_option('sidebars_widgets'); if (is_array($sidebars_widgets['mobile-offcanvas'])) { $sidebars_widgets['mobile-offcanvas'] = NULL; } update_option('sidebars_widgets', $sidebars_widgets); // There are dynamic values in 'seowp-widgets.wie' that needs to be replaced // before import processing global $widget_strings_replace; $widget_strings_replace = array('TOREPLACE_OFFCANVAS_MENUID' => lbmn_get_menuid_by_menutitle('Mobile Off-canvas Menu')); foreach ($files_with_widgets_to_import as $file) { pvt_import_data($file); } // 4: Put some demo description into current user info field // that used in the blog user boxes $user_ID = get_current_user_id(); $user_info = get_userdata($user_ID); if (!$user_info->description) { update_user_meta($user_ID, 'description', 'This is author biographical info, ' . 'that can be used to tell more about you, your iterests, ' . 'background and experience. ' . 'You can change it on <a href="/wp-admin/profile.php">Admin > Users > Your Profile > Biographical Info</a> page."'); } // 5: Predefine Tutorial Pages in LiveComposer update_option('dslc_plugin_options_tuts', array('lc_tut_chapter_one' => lbmn_get_page_by_slug('live-composer-tutorials/chapter-1'), 'lc_tut_chapter_two' => lbmn_get_page_by_slug('live-composer-tutorials/chapter-2'), 'lc_tut_chapter_three' => lbmn_get_page_by_slug('live-composer-tutorials/chapter-3'), 'lc_tut_chapter_four' => lbmn_get_page_by_slug('live-composer-tutorials/chapter-4'))); // 6: Newsletter Sign-Up Plugin Form Elements update_option('nsu_form', array('email_label' => '', 'email_default_value' => 'Your email address...', 'email_label' => '', 'redirect_to' => get_site_url() . '/index.php?pagename=/lbmn_archive/thanks-for-signing-up/')); // Add custom Mega Main Menu options $mmm_options = get_option('mega_main_menu_options'); // Add custom Additional Mega Menu styles $mmm_options['additional_styles_presets'] = array('1' => array('style_name' => "Call to action item", 'text_color' => "rgba(255,255,255,1)", 'font' => array("font_size" => "15", "font_weight" => "600"), 'icon' => array("font_size" => "16"), 'bg_gradient' => array("color1" => "#A1C627", "start" => "0", "color2" => "#A1C627", "end" => "100", "orientation" => "top"), "text_color_hover" => "rgba(255,255,255,1)", "bg_gradient_hover" => array("color1" => "#56AEE3", "start" => "0", "color2" => "#56AEE3", "end" => "100", "orientation" => "top")), '2' => array('style_name' => "Dropdown Heading", 'text_color' => "rgba(0,0,0,1)", 'font' => array("font_size" => "15", "font_weight" => "400"), 'icon' => array("font_size" => "15"), 'bg_gradient' => array("color1" => "", "start" => "0", "color2" => "", "end" => "100", "orientation" => "top"), "text_color_hover" => "rgba(0,0,0,1)", "bg_gradient_hover" => array("color1" => "", "start" => "0", "color2" => "", "end" => "100", "orientation" => "top")), '3' => array('style_name' => "Dropdown Menu Text", 'text_color' => "rgba(0,0,0,1)", 'icon' => array("font_size" => "21"), 'font' => array("font_size" => "21", "font_weight" => "300"), 'bg_gradient' => array("color1" => "", "start" => "0", "color2" => "", "end" => "100", "orientation" => "top"), "text_color_hover" => "rgba(0,0,0,1)", "bg_gradient_hover" => array("color1" => "", "start" => "0", "color2" => "", "end" => "100", "orientation" => "top"))); // Add custom icons $mmm_options['set_of_custom_icons'] = array('1' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-spain.png')), '2' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-italy.png')), '3' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-france.png')), '4' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-uk.png')), '5' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-us.png')), '6' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-austria.png')), '7' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-belgium.png')), '8' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-germany.png')), '9' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-netherlands.png')), '10' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-poland.png')), '11' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-portugal.png')), '12' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-romania.png')), '13' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-russia.png')), '14' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-ukraine.png'))); // Put Mega Main Menu options back update_option('mega_main_menu_options', $mmm_options); // 8: Regenerate Custom CSS lbmn_customized_css_cache_reset(false); // refresh custom css without printig css (false) if (is_plugin_active('mega_main_menu/mega_main_menu.php')) { // call the function that normaly starts only in Theme Customizer lbmn_mainmegamenu_customizer_integration(); } } // if $_GET['importcontent'] /** * ---------------------------------------------------------------------- * Demo Content: Full */ if ($_GET['importcontent'] == 'alldemocontent' && $_GET['importcontent_part'] == 16) { $import_path_demo_content = $theme_dir . '/design/demo-content/'; // Import Demo Ninja Forms lbmn_ninjaforms_import(); lbmn_debug_console('Import Demo Mega Menu'); // Import Demo Mega Menu menu if (is_plugin_active('wpfw_menus_management/wpfw_menus_management.php')) { wpfw_import_menu($import_path_demo_content . 'seowp-demomegamenu.txt', 'header-menu'); } $locations = get_nav_menu_locations(); set_theme_mod('nav_menu_locations', $locations); // Activate Mega Main Menu for 'header-menu' locations // See /inc/plugins-integration/megamainmenu.php for function source if (is_plugin_active('mega_main_menu/mega_main_menu.php')) { lbmn_activate_mainmegamenu_locations(); } // Import pre-designed MasterSlider Slides // Check if MasterSlider is active // http://support.averta.net/envato/support/ticket/regenerate-custom-css-programatically/#post-16478 if (defined('MSWP_AVERTA_VERSION')) { $current_sliders = get_masterslider_names('title-id'); $slider_already_imported = false; foreach ($current_sliders as $slider => $slider_id) { if (stristr($slider, 'Flat Design Style')) { $slider_already_imported = true; } } if (!$slider_already_imported) { global $ms_importer; if (is_null($ms_importer)) { $ms_importer = new MSP_Importer(); } // * @return bool true on success and false on failure $slider_import_state = $ms_importer->import_data(file_get_contents($import_path_demo_content . 'seowp-masterslider.json')); } // Force Master Slider Custom CSS regeneration include_once MSWP_AVERTA_ADMIN_DIR . '/includes/msp-admin-functions.php'; if (function_exists('msp_save_custom_styles')) { msp_update_preset_css(); // Presets re-generation msp_save_custom_styles(); // Save sliders custom css } } // Use a static front page $home_page = get_page_by_title(LBMN_HOME_TITLE); update_option('page_on_front', $home_page->ID); update_option('show_on_front', 'page'); // Set the blog page (not needed) // $blog = get_page_by_title( LBMN_BLOG_TITLE ); // update_option( 'page_for_posts', $blog->ID ); lbmn_debug_console('lbmn_customized_css_cache_reset'); // Regenerate Custom CSS lbmn_customized_css_cache_reset(false); // refresh custom css without printig css (false) if (is_plugin_active('mega_main_menu/mega_main_menu.php')) { // call the function that normally starts only in Theme Customizer lbmn_mainmegamenu_customizer_integration(); } // lbmn_debug_console( 'Search & Replace image URLS' ); // Search & Replace image URLS // lbmn_lcsearchreplace(); not needed any more } // if $_GET['importcontent'] } // is isset($_GET['importcontent']) }
$shortcode_definitions['image'] = array('since' => '1.0', 'vc_plugin' => array('name' => $this->prefix_shortcode_name . __('Image', 'webman-amplifier'), 'base' => $this->prefix_shortcode . 'image', 'class' => 'wm-shortcode-vc-image', 'icon' => 'icon-wpb-single-image', 'category' => __('Media', 'webman-amplifier'), 'params' => array(10 => array('heading' => __('Image to display', 'webman-amplifier'), 'description' => '', 'type' => 'attach_image', 'param_name' => 'src', 'value' => '', 'holder' => 'hidden', 'class' => ''), 20 => array('heading' => __('Image link URL', 'webman-amplifier'), 'type' => 'textfield', 'param_name' => 'link', 'value' => '', 'holder' => 'hidden', 'class' => ''), 30 => array('heading' => __('Target', 'webman-amplifier'), 'description' => '', 'type' => 'dropdown', 'param_name' => 'target', 'value' => array(__('Open in same window', 'webman-amplifier') => '', __('Open in new window / tab', 'webman-amplifier') => '_blank'), 'holder' => 'hidden', 'class' => '', 'dependency' => array('element' => 'link', 'not_empty' => true)), 40 => array('heading' => __('CSS class', 'webman-amplifier'), 'description' => __('Optional CSS additional classes', 'webman-amplifier'), 'type' => 'textfield', 'param_name' => 'class', 'value' => '', 'holder' => 'hidden', 'class' => ''), 50 => array('heading' => __('Image width HTML attribute', 'webman-amplifier'), 'description' => '', 'type' => 'textfield', 'param_name' => 'width', 'value' => '', 'holder' => 'hidden', 'class' => '', 'group' => __('Styling', 'webman-amplifier')), 60 => array('heading' => __('Image height HTML attribute', 'webman-amplifier'), 'description' => '', 'type' => 'textfield', 'param_name' => 'height', 'value' => '', 'holder' => 'hidden', 'class' => '', 'group' => __('Styling', 'webman-amplifier')), 70 => array('heading' => __('Margin', 'webman-amplifier'), 'description' => sprintf(__('Set a <a%s>CSS value</a>, such as <code>60px 0 60px 0</code>', 'webman-amplifier'), ' href="http://www.w3schools.com/cssref/pr_margin.asp" target="_blank"'), 'type' => 'textfield', 'param_name' => 'margin', 'value' => '', 'holder' => 'hidden', 'class' => '', 'group' => __('Styling', 'webman-amplifier'))))); /** * Soliloquy * * @since 1.0 */ if (post_type_exists('soliloquy')) { $shortcode_definitions['soliloquy'] = array('since' => '1.0', 'vc_plugin' => array('name' => __('Soliloquy Slider', 'webman-amplifier'), 'base' => 'soliloquy', 'class' => 'wm-shortcode-vc-soliloquy', 'icon' => 'icon-wpb-images-carousel', 'category' => __('Media', 'webman-amplifier'), 'params' => array(10 => array('heading' => __('Choose a Soliloquy slider', 'webman-amplifier'), 'description' => '', 'type' => 'dropdown', 'param_name' => 'id', 'value' => array_flip(wma_posts_array('post_name', 'soliloquy')), 'holder' => 'hidden', 'class' => '')))); } /** * Master Slider * * @since 1.0.9 */ if (function_exists('get_masterslider_names')) { $shortcode_definitions['masterslider'] = array('since' => '1.0.9', 'vc_plugin' => array('name' => __('Master Slider', 'webman-amplifier'), 'base' => 'masterslider', 'class' => 'wm-shortcode-vc-masterslider', 'icon' => 'icon-wpb-images-carousel', 'category' => __('Media', 'webman-amplifier'), 'params' => array(10 => array('heading' => __('Choose a slider', 'webman-amplifier'), 'description' => '', 'type' => 'dropdown', 'param_name' => 'id', 'value' => $empty + get_masterslider_names(false), 'holder' => 'hidden', 'class' => '')))); } /** * Render certain VC shortcodes even when the plugin is disabled * * @since 1.0 */ if (!wma_is_active_vc()) { /** * vc_row */ $shortcode_definitions['vc_row'] = array('since' => '1.0', 'custom_prefix' => '', 'renderer' => array('alias' => 'row')); /** * vc_row_inner */ $shortcode_definitions['vc_row_inner'] = array('since' => '1.0', 'custom_prefix' => '', 'renderer' => array('alias' => 'row'));
/** * Register and enqueue admin-specific JavaScript & Stylesheet globally. * */ public function enqueue_admin_scripts() { // define admin ajax address and master slider page wp_localize_script('jquery', '__MS_EDITOR', array('sliders' => get_masterslider_names('alias-title'))); }
function lbmn_wordpress_content_importer() { $theme_dir = get_template_directory(); if (is_admin() && isset($_GET['importcontent'])) { if (!defined('WP_LOAD_IMPORTERS')) { define('WP_LOAD_IMPORTERS', true); } if (!class_exists('WP_Importer')) { $class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php'; if (file_exists($class_wp_importer)) { include $class_wp_importer; } } if (!class_exists('lbmn_WP_Import')) { $class_wp_import = $theme_dir . '/inc/importer/wordpress-importer.php'; if (file_exists($class_wp_import)) { include $class_wp_import; } } if (class_exists('WP_Importer') && class_exists('lbmn_WP_Import')) { $importer = new lbmn_WP_Import(); $files_to_import = array(); // Live Composer has links to images hard-coded, so before importing // media we need to check that the Settings > Media > // 'Organize my uploads into month- and year-based folders' unchecked // as on demo server. After import is done we set back original state // of this setting. $setting_original_useyearmonthfolders = get_option('uploads_use_yearmonth_folders'); update_option('uploads_use_yearmonth_folders', 0); if ($_GET['importcontent'] == 'basic-templates') { $import_path = $theme_dir . '/design/basic-config/'; $files_array = array('start' => array(), 'templates' => array('files' => array('seowp-templates.xml.gz'), 'description' => __('Importing: Post Templates...', 'lbmn')), 'templates-system' => array('files' => array('seowp-systempagetemplates.xml.gz'), 'description' => __('Importing: System Templates...', 'lbmn')), 'menu-topbar' => array('files' => array('seowp-topbar.xml.gz'), 'description' => __('Importing: Top Bar Menu...', 'lbmn')), 'menu-topbar-config' => array('description' => __('Configuring Top Bar...', 'lbmn')), 'menu-basic' => array('files' => array('seowp-basicmenu.xml.gz'), 'description' => __('Importing: Basic Main Menu...', 'lbmn')), 'menu-basic-config' => array('description' => __('Configuring Basic Menu...', 'lbmn')), 'footer-basic' => array('files' => array('seowp-footer-default.xml.gz'), 'description' => __('Importing: Basic Footer...', 'lbmn')), 'basic-config' => array('description' => __('Final touches...', 'lbmn')), 'finish-basic-templates' => array('description' => __('Finishing...', 'lbmn'))); // $files_to_import[] = $import_path . 'seowp-livecomposer-tutorials.xml.gz'; } if ($_GET['importcontent'] == 'alldemocontent') { $import_path = $theme_dir . '/design/demo-content/'; $files_array = array('start' => array(), 'home' => array('files' => array('seowp-homepages.xml.gz', 'seowp-predesignedpages-1.xml.gz'), 'description' => __('Importing: Home Page...', 'lbmn')), 'predesigned-1' => array('files' => array('seowp-predesignedpages-2.xml.gz', 'seowp-predesignedpages-3.xml.gz'), 'description' => __('Importing: Inner Pages – part 1...', 'lbmn')), 'predesigned-2' => array('files' => array('seowp-predesignedpages-4.xml.gz', 'seowp-predesignedpages-5.xml.gz'), 'description' => __('Importing: Inner Pages – part 2...', 'lbmn')), 'predesigned-3' => array('files' => array('seowp-predesignedpages-6.xml.gz', 'seowp-predesignedpages-7.xml.gz'), 'description' => __('Importing: Inner Pages – part 3...', 'lbmn')), 'predesigned-4' => array('files' => array('seowp-predesignedpages-8.xml.gz', 'seowp-predesignedpages-9.xml.gz'), 'description' => __('Importing: Inner Pages – part 4...', 'lbmn')), 'predesigned-5' => array('files' => array('seowp-predesignedpages-10.xml.gz', 'seowp-predesignedpages-11.xml.gz'), 'description' => __('Importing: Inner Pages – part 5...', 'lbmn')), 'downloads' => array('files' => array('seowp-downloads.xml.gz', 'seowp-partners.xml.gz'), 'description' => __('Importing: Resources & Partners...', 'lbmn')), 'staff' => array('files' => array('seowp-staff.xml.gz', 'seowp-testimonials.xml.gz'), 'description' => __('Importing: Staff & Testimonials...', 'lbmn')), 'posts' => array('files' => array('seowp-posts.xml.gz', 'seowp-projects.xml.gz'), 'description' => __('Importing: Posts & Projects...', 'lbmn')), 'media-home' => array('files' => array('seowp-media-homepage.xml.gz'), 'description' => __('Importing: Home Page – Images...', 'lbmn')), 'media-menu' => array('files' => array('seowp-media-menuimages.xml.gz'), 'description' => __('Importing: Menu – Images...', 'lbmn')), 'media-slider' => array('files' => array('seowp-media-sliderimages.xml.gz'), 'description' => __('Importing: Slider - Images...', 'lbmn')), 'media-clinentlogos' => array('files' => array('seowp-media-clientlogos.xml.gz'), 'description' => __('Importing: ClientLogos – Images...', 'lbmn')), 'media-blogthumbs' => array('files' => array('seowp-media-blogpostthumbs.xml.gz'), 'description' => __('Importing: Posts – Images...', 'lbmn')), 'media-footer' => array('files' => array('seowp-media-footerimages.xml.gz'), 'description' => __('Importing: Footer – Images...', 'lbmn')), 'media-staff' => array('files' => array('seowp-media-staffavatars.xml.gz'), 'description' => __('Importing: Staff – Images...', 'lbmn')), 'media-servicepage' => array('files' => array('seowp-media-servicepage.xml.gz'), 'description' => __('Importing: Services – Images...', 'lbmn')), 'media-bg' => array('files' => array('seowp-media-sectionbackgrounds.xml.gz'), 'description' => __('Importing: Background Images...', 'lbmn')), 'media-ebooks' => array('files' => array('seowp-media-ebookcovers.xml.gz'), 'description' => __('Importing E-book Covers...', 'lbmn')), 'media-projectthumbs' => array('files' => array('seowp-media-projectthumbs.xml.gz'), 'description' => __('Importing: Project – Images...', 'lbmn')), 'mainmenu' => array('files' => array('seowp-mainmenu.xml.gz'), 'description' => __('Importing: Main Menu...', 'lbmn')), 'menu-config' => array('description' => __('Configuring: Menus...', 'lbmn')), 'ninjaforms' => array('description' => __('Importing: Ninja Forms...', 'lbmn')), 'masterslider' => array('description' => __('Importing: Master Slider...', 'lbmn')), 'footers' => array('files' => array('seowp-themefooters.xml.gz'), 'description' => __('Importing: Theme Footers...', 'lbmn')), 'finish-maincontent' => array('description' => __('Finishing...', 'lbmn'))); } if (isset($_GET['importcontent_step_current_id'])) { $content_part_id = sanitize_key($_GET['importcontent_step_current_id']); if (!$content_part_id) { $content_part_id = 'start'; } lbmn_debug_console($content_part_id); // Get array internal pointer to the poistion needed reset($files_array); while (key($files_array) !== $content_part_id && key($files_array) !== null) { next($files_array); } if (key($files_array) === null) { end($files_array); } $files_current = current($files_array); $files_current_id = key($files_array); $files_current_pos = array_search($files_current_id, array_keys($files_array)); if (isset($files_array[$files_current_id]['files'])) { // Prepare array of the files to import during the current step foreach ($files_array[$files_current_id]['files'] as $file_name) { $files_to_import[] = $import_path . $file_name; } } // Transmit to the JS number of the current step and how many steps in total // to make possible to update the progress bar echo '<input type="hidden" name="importcontent_steps_total" id="importcontent_steps_total" value="' . count($files_array) . '" />'; echo '<input type="hidden" name="importcontent_step_current_no" id="importcontent_step_current_no" value="' . $files_current_pos . '" />'; echo '<input type="hidden" name="importcontent_step_current_descr" id="importcontent_step_current_descr" value="' . $files_array[$files_current_id]['description'] . '" />'; // Set internal array pointer to the next position $files_next = next($files_array); $files_next_id = key($files_array); if (key($files_array) !== null) { echo '<input type="hidden" name="importcontent_step_next_id" id="importcontent_step_next_id" value="' . $files_next_id . '" />'; } } // Start Import if (file_exists($class_wp_importer)) { // Import included images $importer->fetch_attachments = true; foreach ($files_to_import as $import_file) { if (is_file($import_file)) { ob_start(); $importer->import($import_file); $log = ob_get_contents(); ob_end_clean(); // output log in the hidden div echo '<div class="ajax-log">'; echo $log; echo '</div>'; if (stristr($log, 'error') || !stristr($log, 'All done.')) { // Set marker div that will be fildered by ajax request echo '<div class="ajax-request-error"></div>'; // output log in the div echo '<div class="ajax-error-log">'; echo $log; echo '</div>'; } } else { // Set marker div that will be fildered by ajax request echo '<div class="ajax-request-error"></div>'; // output log in the div echo '<div class="ajax-error-log">'; echo "Can't open file: " . $import_file . "</ br>"; echo '</div>'; } } } else { // Set marker div that will be fildered by ajax request echo '<div class="ajax-request-error"></div>'; // output log in the div echo '<div class="ajax-error-log">'; echo "Failed to load: " . $class_wp_import . "</ br>"; echo '</div>'; } // Set 'Organize my uploads into month- and year-based folders' setting // to its original state update_option('uploads_use_yearmonth_folders', $setting_original_useyearmonthfolders); } if (isset($_GET['importcontent_step_current_id']) && $_GET['importcontent_step_current_id'] == 'menu-topbar-config') { // Asign 'Demo Mega Menu' to the 'Header Menu' location $menu_object = wp_get_nav_menu_object('top-bar-menu'); $menu_object_id = $menu_object->term_id; $locations = get_nav_menu_locations(); $locations['topbar'] = $menu_object_id; set_theme_mod('nav_menu_locations', $locations); // Activate Mega Main Menu functionality for the 'header-menu' locations // See /inc/plugins-integration/megamainmenu.php for function source if (is_plugin_active('mega_main_menu/mega_main_menu.php')) { lbmn_activate_mainmegamenu_locations(); } } if (isset($_GET['importcontent_step_current_id']) && $_GET['importcontent_step_current_id'] == 'menu-basic-config') { // Asign 'Demo Mega Menu' to the 'Header Menu' location $menu_object = wp_get_nav_menu_object('basic-main-menu'); $menu_object_id = $menu_object->term_id; $locations = get_nav_menu_locations(); $locations['header-menu'] = $menu_object_id; set_theme_mod('nav_menu_locations', $locations); } if (isset($_GET['importcontent_step_current_id']) && $_GET['importcontent_step_current_id'] == 'menu-config') { // Asign 'Demo Mega Menu' to the 'Header Menu' location $menu_object = wp_get_nav_menu_object('mega-main-menu'); $menu_object_id = $menu_object->term_id; $locations = get_nav_menu_locations(); $locations['header-menu'] = $menu_object_id; set_theme_mod('nav_menu_locations', $locations); // Activate Mega Main Menu functionality for the 'header-menu' locations // See /inc/plugins-integration/megamainmenu.php for function source if (is_plugin_active('mega_main_menu/mega_main_menu.php')) { lbmn_activate_mainmegamenu_locations(); } } if (isset($_GET['importcontent_step_current_id']) && $_GET['importcontent_step_current_id'] == 'ninjaforms') { // Import Demo Ninja Forms lbmn_ninjaforms_import(); } if (isset($_GET['importcontent_step_current_id']) && $_GET['importcontent_step_current_id'] == 'masterslider') { $import_path_demo_content = $theme_dir . '/design/demo-content/'; // Import pre-designed MasterSlider Slides // Check if MasterSlider is active // http://support.averta.net/envato/support/ticket/regenerate-custom-css-programatically/#post-16478 if (defined('MSWP_AVERTA_VERSION')) { $current_sliders = get_masterslider_names('title-id'); $slider_already_imported = false; foreach ($current_sliders as $slider => $slider_id) { if (stristr($slider, 'Flat Design Style')) { $slider_already_imported = true; } } if (!$slider_already_imported) { global $ms_importer; if (is_null($ms_importer)) { $ms_importer = new MSP_Importer(); } // * @return bool true on success and false on failure $slider_import_state = $ms_importer->import_data(file_get_contents($import_path_demo_content . 'seowp-masterslider.json')); } // Force Master Slider Custom CSS regeneration include_once MSWP_AVERTA_ADMIN_DIR . '/includes/msp-admin-functions.php'; if (function_exists('msp_save_custom_styles')) { msp_update_preset_css(); // Presets re-generation msp_save_custom_styles(); // Save sliders custom css } } } if (isset($_GET['importcontent_step_current_id']) && $_GET['importcontent_step_current_id'] == 'finish-maincontent') { // Use a static front page $home_page = get_page_by_title(LBMN_HOME_TITLE); update_option('page_on_front', $home_page->ID); update_option('show_on_front', 'page'); // Set the blog page (not needed) // $blog = get_page_by_title( LBMN_BLOG_TITLE ); // update_option( 'page_for_posts', $blog->ID ); lbmn_debug_console('lbmn_customized_css_cache_reset'); // Regenerate Custom CSS lbmn_customized_css_cache_reset(false); // refresh custom css without printig css (false) if (is_plugin_active('mega_main_menu/mega_main_menu.php')) { // call the function that normally starts only in Theme Customizer lbmn_mainmegamenu_customizer_integration(); } } /** * ---------------------------------------------------------------------- * Basic configuration: * Post import actions */ if (isset($_GET['importcontent_step_current_id']) && $_GET['importcontent_step_current_id'] == 'basic-config') { // 1. Import Menus // 2. Activate Mega Main Menu for menu locations // 3. Import Widgets // 4. Demo description for author // 5. Tutorial Pages for LiveComposer // 6. Newsletter Sign-Up Plugin Settings // 7. Rotating Tweets Default Options Setup // 8. Regenerate Custom CSS // Path to the folder with basic import files $import_path_basic_config = $theme_dir . '/design/basic-config/'; // $locations = get_nav_menu_locations(); // set_theme_mod('nav_menu_locations', $locations); // 2: Activate Mega Main Menu for 'topbar' and 'header-menu' locations // See /inc/plugins-integration/megamainmenu.php for function source if (is_plugin_active('mega_main_menu/mega_main_menu.php')) { lbmn_activate_mainmegamenu_locations(); } // Predefine Custom Sidebars in LiveComposer // First set new sidebars in options table update_option('dslc_plugin_options_widgets_m', array('sidebars' => 'Sidebar,404 Page Widgets,Comment Form Area,')); // Define default Archive and Search options with System Templates // 404 Page Template $current_lc_archive_options = get_option('dslc_plugin_options_archives'); $current_lc_archive_options['404_page'] = lbmn_get_page_by_title(LBMN_SYSTEMPAGE_404_DEFAULT, 'lbmn_archive'); // Archive Page Template $new_archive_listing_id = lbmn_get_page_by_title(LBMN_SYSTEMPAGE_ARCHIVE_DEFAULT, 'lbmn_archive'); $current_lc_archive_options['post'] = $new_archive_listing_id; $current_lc_archive_options['dslc_projects'] = $new_archive_listing_id; $current_lc_archive_options['dslc_galleries'] = $new_archive_listing_id; $current_lc_archive_options['dslc_downloads'] = $new_archive_listing_id; $current_lc_archive_options['dslc_staff'] = $new_archive_listing_id; $current_lc_archive_options['dslc_partners'] = $new_archive_listing_id; $current_lc_archive_options['author'] = $new_archive_listing_id; // Search Results $new_search_listing_id = lbmn_get_page_by_title(LBMN_SYSTEMPAGE_SEARCHRESULTS_DEFAULT, 'lbmn_archive'); $current_lc_archive_options['search_results'] = $new_search_listing_id; update_option('dslc_plugin_options_archives', $current_lc_archive_options); // Then run LiveComposer function that creates sidebars dynamically dslc_sidebars(); // 3: Import widgets $files_with_widgets_to_import = array(); $files_with_widgets_to_import[] = $import_path_basic_config . 'seowp-widgets.wie'; // Remove default widgets from 'mobile-offcanvas' widget area $sidebars_widgets = get_option('sidebars_widgets'); if (is_array($sidebars_widgets['mobile-offcanvas'])) { $sidebars_widgets['mobile-offcanvas'] = NULL; } update_option('sidebars_widgets', $sidebars_widgets); // There are dynamic values in 'seowp-widgets.wie' that needs to be replaced // before import processing global $widget_strings_replace; $widget_strings_replace = array('TOREPLACE_OFFCANVAS_MENUID' => lbmn_get_menuid_by_menutitle('Basic Main Menu')); foreach ($files_with_widgets_to_import as $file) { lbmn_import_data($file); } // 4: Put some demo description into current user info field // that used in the blog user boxes $user_ID = get_current_user_id(); $user_info = get_userdata($user_ID); if (!$user_info->description) { update_user_meta($user_ID, 'description', 'This is author biographical info, ' . 'that can be used to tell more about you, your iterests, ' . 'background and experience. ' . 'You can change it on <a href="/wp-admin/profile.php">Admin > Users > Your Profile > Biographical Info</a> page."'); } // Add custom Mega Main Menu options $mmm_options = get_option('mega_main_menu_options'); // Add custom Additional Mega Menu styles $mmm_options['additional_styles_presets'] = array('1' => array('style_name' => "Call to action item", 'text_color' => "rgba(255,255,255,1)", 'font' => array("font_size" => "15", "font_weight" => "600"), 'icon' => array("font_size" => "16"), 'bg_gradient' => array("color1" => "#A1C627", "start" => "0", "color2" => "#A1C627", "end" => "100", "orientation" => "top"), "text_color_hover" => "rgba(255,255,255,1)", "bg_gradient_hover" => array("color1" => "#56AEE3", "start" => "0", "color2" => "#56AEE3", "end" => "100", "orientation" => "top")), '2' => array('style_name' => "Dropdown Heading", 'text_color' => "rgba(0,0,0,1)", 'font' => array("font_size" => "15", "font_weight" => "400"), 'icon' => array("font_size" => "15"), 'bg_gradient' => array("color1" => "", "start" => "0", "color2" => "", "end" => "100", "orientation" => "top"), "text_color_hover" => "rgba(0,0,0,1)", "bg_gradient_hover" => array("color1" => "", "start" => "0", "color2" => "", "end" => "100", "orientation" => "top")), '3' => array('style_name' => "Dropdown Menu Text", 'text_color' => "rgba(0,0,0,1)", 'icon' => array("font_size" => "21"), 'font' => array("font_size" => "21", "font_weight" => "300"), 'bg_gradient' => array("color1" => "", "start" => "0", "color2" => "", "end" => "100", "orientation" => "top"), "text_color_hover" => "rgba(0,0,0,1)", "bg_gradient_hover" => array("color1" => "", "start" => "0", "color2" => "", "end" => "100", "orientation" => "top"))); // Add custom icons $mmm_options['set_of_custom_icons'] = array('1' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-spain.png')), '2' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-italy.png')), '3' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-france.png')), '4' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-uk.png')), '5' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-us.png')), '6' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-austria.png')), '7' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-belgium.png')), '8' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-germany.png')), '9' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-netherlands.png')), '10' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-poland.png')), '11' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-portugal.png')), '12' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-romania.png')), '13' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-russia.png')), '14' => array('custom_icon' => esc_url_raw(get_template_directory_uri() . '/images/flag-ukraine.png'))); // Put Mega Main Menu options back update_option('mega_main_menu_options', $mmm_options); // 8: Regenerate Custom CSS lbmn_customized_css_cache_reset(false); // refresh custom css without printig css (false) if (is_plugin_active('mega_main_menu/mega_main_menu.php')) { // call the function that normaly starts only in Theme Customizer lbmn_mainmegamenu_customizer_integration(); } } // if $_GET['importcontent'] // Update theme option '_basic_config_done' if (isset($_GET['importcontent_step_current_id']) && $_GET['importcontent_step_current_id'] == 'finish-basic-templates') { update_option(LBMN_THEME_NAME . '_basic_config_done', true); define('LBMN_THEME_CONFUGRATED', true); } // Update theme option '_basic_config_done' if (isset($_GET['importcontent_step_current_id']) && $_GET['importcontent_step_current_id'] == 'finish-maincontent') { update_option(LBMN_THEME_NAME . '_democontent_imported', true); } } // is isset($_GET['importcontent']) }
function porto_import() { global $wpdb, $porto_settings; if (current_user_can('manage_options') && isset($_GET['page']) && $_GET['page'] == 'porto_settings') { if (isset($_GET['import_sample_content'])) { if (!defined('WP_LOAD_IMPORTERS')) { define('WP_LOAD_IMPORTERS', true); } // we are loading importers if (!class_exists('WP_Importer')) { // if main importer class doesn't exist $wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php'; include $wp_importer; } if (!class_exists('WP_Import')) { // if WP importer doesn't exist $wp_import = porto_plugins . '/importer/wordpress-importer.php'; include $wp_import; } if (class_exists('WP_Importer') && class_exists('WP_Import')) { // check for main import class and wp import class // update visual composer content types update_option('wpb_js_content_types', array('post', 'page', 'block', 'faq', 'member', 'portfolio')); $importer = new WP_Import(); // update woocommerce image sizes $catalog = array('width' => '300', 'height' => '400', 'crop' => 1); $single = array('width' => '500', 'height' => '666', 'crop' => 1); $thumbnail = array('width' => '90', 'height' => '90', 'crop' => 1); // Image sizes add_image_size('shop_thumbnail', $thumbnail['width'], $thumbnail['height'], $thumbnail['crop']); add_image_size('shop_catalog', $catalog['width'], $catalog['height'], $catalog['crop']); add_image_size('shop_single', $single['width'], $single['height'], $single['crop']); $theme_xml = porto_plugins . '/importer/data/dummy_data.xml'; $importer->fetch_attachments = true; ob_start(); $importer->import($theme_xml); ob_end_clean(); // Set woocommerce pages $woopages = array('woocommerce_shop_page_id' => 'Shop', 'woocommerce_cart_page_id' => 'Cart', 'woocommerce_checkout_page_id' => 'Checkout', 'woocommerce_myaccount_page_id' => 'My Account'); foreach ($woopages as $woo_page_name => $woo_page_title) { $woopage = get_page_by_title($woo_page_title); if (isset($woopage) && $woopage->ID) { update_option($woo_page_name, $woopage->ID); // Front Page } } // We no longer need to install pages $notices = array_diff(get_option('woocommerce_admin_notices', array()), array('install', 'update')); update_option('woocommerce_admin_notices', $notices); delete_option('_wc_needs_pages'); delete_transient('_wc_activation_redirect'); // Set imported menus to registered theme locations $locations = get_theme_mod('nav_menu_locations'); // registered menu locations in theme $menus = wp_get_nav_menus(); // registered menus if ($menus) { foreach ($menus as $menu) { // assign menus to theme locations if ($menu->name == 'Main Menu') { $locations['main_menu'] = $menu->term_id; } else { if ($menu->name == 'Top Navigation') { $locations['top_nav'] = $menu->term_id; } else { if ($menu->name == 'View Switcher') { $locations['view_switcher'] = $menu->term_id; } else { if ($menu->name == 'Currency Switcher') { $locations['currency_switcher'] = $menu->term_id; } } } } } } set_theme_mod('nav_menu_locations', $locations); // set menus to locations // Set reading options $homepage = get_page_by_title('Home'); $posts_page = get_page_by_title('Blog'); if ($homepage && $homepage->ID || $posts_page && $posts_page->ID) { update_option('show_on_front', 'page'); if ($homepage && $homepage->ID) { update_option('page_on_front', $homepage->ID); // Front Page } if ($posts_page && $posts_page->ID) { update_option('page_for_posts', $posts_page->ID); // Blog Page } } // Add sidebar widget areas $sidebars = array('Shortcodes' => 'Shortcodes'); update_option('sbg_sidebars', $sidebars); flush_rewrite_rules(); // finally redirect to success page wp_redirect(admin_url('admin.php?page=porto_settings&import_success=true')); } } if (isset($_GET['import_masterslider'])) { // Import master sliders if (class_exists('MSP_Importer')) { $slider_alias = get_masterslider_names('alias'); for ($i = 1; $i < PORTO_MASTERSLIDER_COUNT; $i++) { if (isset($slider_alias['ms-' . $i]) && $slider_alias['ms-' . $i]) { } else { ob_start(); include porto_plugins . '/importer/data/master_slider_' . $i . '.json'; $master_slider_data = ob_get_clean(); $master_slider_importer = new MSP_Importer(); ob_start(); $master_slider_importer->import_data($master_slider_data); ob_end_clean(); } } } flush_rewrite_rules(); // finally redirect to success page wp_redirect(admin_url('admin.php?page=porto_settings&import_masterslider_success=true')); } if (isset($_GET['import_font'])) { if (get_option('smile_fonts', false)) { // Import Simple Line Icon Font $paths = wp_upload_dir(); $paths['fonts'] = 'smile_fonts'; $paths['temp'] = trailingslashit($paths['fonts']) . 'smile_temp'; $paths['fontdir'] = trailingslashit($paths['basedir']) . $paths['fonts']; $paths['tempdir'] = trailingslashit($paths['basedir']) . $paths['temp']; $paths['fonturl'] = set_url_scheme(trailingslashit($paths['baseurl']) . $paths['fonts']); $paths['tempurl'] = trailingslashit($paths['baseurl']) . trailingslashit($paths['temp']); $paths['config'] = 'charmap.php'; $sli_fonts = trailingslashit($paths['basedir']) . $paths['fonts'] . '/Simple-Line-Icons'; $sli_fonts_dir = porto_plugins . '/importer/data/Simple-Line-Icons/'; // Make destination directory if (!is_dir($sli_fonts)) { wp_mkdir_p($sli_fonts); } @chmod($sli_fonts, 0777); foreach (glob($sli_fonts_dir . '*') as $file) { $new_file = basename($file); @copy($file, $sli_fonts . '/' . $new_file); } $fonts = get_option('smile_fonts'); if (empty($fonts)) { $fonts = array(); } $fonts['Simple-Line-Icons'] = array('include' => trailingslashit($paths['fonts']) . 'Simple-Line-Icons', 'folder' => trailingslashit($paths['fonts']) . 'Simple-Line-Icons', 'style' => 'Simple-Line-Icons' . '/' . 'Simple-Line-Icons' . '.css', 'config' => $paths['config']); update_option('smile_fonts', $fonts); flush_rewrite_rules(); // finally redirect to success page wp_redirect(admin_url('admin.php?page=porto_settings&import_font_success=true')); } else { flush_rewrite_rules(); // finally redirect to success page wp_redirect(admin_url('admin.php?page=porto_settings&import_font_success=false')); } } if (isset($_GET['import_widget'])) { // Import widgets ob_start(); include porto_plugins . '/importer/data/widget_data.json'; $widget_data = ob_get_clean(); porto_import_widget_data($widget_data); flush_rewrite_rules(); // finally redirect to success page wp_redirect(admin_url('admin.php?page=porto_settings&import_widget_success=true')); } if (isset($_GET['import_theme_options'])) { $demo = $_GET['import_theme_options']; ob_start(); include porto_plugins . '/importer/data/theme_options' . $demo . '.php'; $theme_options = ob_get_clean(); $options = json_decode($theme_options, true); $redux = ReduxFrameworkInstances::get_instance('porto_settings'); $redux->set_options($options); porto_compile_css(true); porto_save_theme_settings(); // Set reading options if (!$demo) { $page_title = 'Home'; } else { if ($demo == '_rtl') { $page_title = 'Home RTL Version'; } else { $page_title = 'Home Version ' . str_replace('_', '', $demo); } } $homepage = get_page_by_title($page_title); $posts_page = get_page_by_title('Blog'); if ($homepage && $homepage->ID || $posts_page && $posts_page->ID) { update_option('show_on_front', 'page'); if ($homepage && $homepage->ID) { update_option('page_on_front', $homepage->ID); // Front Page } if ($posts_page && $posts_page->ID) { update_option('page_for_posts', $posts_page->ID); // Blog Page } } flush_rewrite_rules(); // finally redirect to success page wp_redirect(admin_url('admin.php?page=porto_settings&import_options_success=true')); } } }