| Server IP : 213.186.33.4 / Your IP : 216.73.216.222 Web Server : Apache System : Linux webm005.cluster103.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64 User : karinebmkh ( 644538) PHP Version : 8.4.22 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/karinebmkh/www2/wp-content/plugins/glaza-import/ |
Upload File : |
<?php
/**
* Plugin Name: Glaza Import
* Plugin URI: http://themeruby.com/
* Description: one click to import demos for Glaza.
* Version: 2.0
* Author: Theme-Ruby
* Author URI: http://themeruby.com/
* @package glaza-import
* @copyright (c) 2017, Theme-Ruby
*/
// No direct access
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! function_exists( 'glaza_load_extension_loader' ) ) {
function glaza_load_extension_loader( $ReduxFramework ) {
$path = dirname( __FILE__ ) . '/extensions/';
$folders = scandir( $path, 1 );
foreach ( $folders as $folder ) {
if ( $folder === '.' or $folder === '..' or ! is_dir( $path . $folder ) ) {
continue;
}
$extension_class = 'ReduxFramework_Extension_' . $folder;
if ( ! class_exists( $extension_class ) ) {
// In case you wanted override your override, hah.
$class_file = $path . $folder . '/extension_' . $folder . '.php';
$class_file = apply_filters( 'redux/extension/' . $ReduxFramework->args['opt_name'] . '/' . $folder, $class_file );
if ( $class_file ) {
require_once( $class_file );
}
}
if ( ! isset( $ReduxFramework->extensions[ $folder ] ) ) {
$ReduxFramework->extensions[ $folder ] = new $extension_class( $ReduxFramework );
}
}
}
add_action( 'redux/extensions/glaza_theme_options/before', 'glaza_load_extension_loader', 0 );
}
if ( ! function_exists( 'glaza_imported_demo' ) ) {
function glaza_imported_demo( $demo_active_import ) {
reset( $demo_active_import );
$current_key = key( $demo_active_import );
//setup menu
$menu_array = array(
'default',
'rose',
'venus'
);
if ( isset( $demo_active_import[ $current_key ]['directory'] ) && ! empty( $demo_active_import[ $current_key ]['directory'] ) && in_array( $demo_active_import[ $current_key ]['directory'], $menu_array ) ) {
$main_menu = get_term_by( 'name', 'main', 'nav_menu' );
$footer_menu = get_term_by( 'name', 'footer', 'nav_menu' );
if ( isset( $main_menu->term_id ) ) {
set_theme_mod( 'nav_menu_locations', array(
'glaza_menu_main' => $main_menu->term_id,
'glaza_menu_offcanvas' => $main_menu->term_id,
'glaza_menu_footer' => $footer_menu->term_id,
) );
}
}
//setup homepage
$home_pages = array(
'default' => 'Home',
'rose' => 'Home Rose',
'venus' => 'Home Venus'
);
if ( isset( $demo_active_import[ $current_key ]['directory'] ) && ! empty( $demo_active_import[ $current_key ]['directory'] ) && array_key_exists( $demo_active_import[ $current_key ]['directory'], $home_pages ) ) {
if ( ! empty( $home_pages[ $demo_active_import[ $current_key ]['directory'] ] ) ) {
$page = get_page_by_title( $home_pages[ $demo_active_import[ $current_key ]['directory'] ] );
if ( ! empty( $page->ID ) ) {
//setup page
update_option( 'page_on_front', $page->ID );
update_option( 'show_on_front', 'page' );
//setup blog
$blog = get_page_by_title( 'Blog' );
if ( ! empty( $blog->ID ) ) {
update_option( 'page_for_posts', $blog->ID );
}
}
} else {
update_option( 'page_on_front', 0 );
update_option( 'show_on_front', 'posts' );
}
}
if ( class_exists( 'WC_Install' ) ) {
WC_Install::create_pages();
}
}
//setup menu
add_action( 'wbc_importer_after_content_import', 'glaza_imported_demo', 10, 2 );
}
if ( ! function_exists( 'glaza_init_before_import' ) ) {
function glaza_init_before_import() {
//default sidebars
$sidebars_widgets['glaza_sidebar_default'] = array();
$sidebars_widgets['glaza_sidebar_offcanvas'] = array();
$sidebars_widgets['glaza_sidebar_topsite'] = array();
$sidebars_widgets['glaza_sidebar_single_top'] = array();
$sidebars_widgets['glaza_sidebar_single_bottom'] = array();
$sidebars_widgets['glaza_sidebar_fw_footer'] = array();
$sidebars_widgets['glaza_sidebar_footer_1'] = array();
$sidebars_widgets['glaza_sidebar_footer_2'] = array();
$sidebars_widgets['glaza_sidebar_footer_3'] = array();
update_option( 'sidebars_widgets', $sidebars_widgets );
register_sidebar( array(
'name' => 'shop',
'id' => 'glaza_sidebar_multi_shop',
'before_widget' => '<div id="%1$s" class="widget widget-sidebar %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>'
) );
}
add_action( 'wbc_importer_before_widget_import', 'glaza_init_before_import', 10, 2 );
}