/home/techb158/l2hypotheques.com/wp-content/plugins/pyloncore/inc
Edit: /home/techb158/l2hypotheques.com/wp-content/plugins/pyloncore/inc/demo.php (2773B)
esc_html__( 'Pylon Import', 'pyloncore' ),
'import_file_url' => plugin_dir_url( __FILE__ ) . 'demo/demo.xml',
'import_widget_file_url' => plugin_dir_url( __FILE__ ) . 'demo/widgets.wie',
'local_import_json' => array(
array(
'file_path' => plugin_dir_path( __FILE__ ) . 'demo/theme-options.json',
'option_name' => 'pylon_theme_option',
),
),
'preview_url' => 'https://webdevcode.com/wp/pylon/live/',
),
);
}
add_filter( 'pt-ocdi/import_files', 'pylon_core_ocdi_import_files' );
// After import setup
function pylon_core_after_import_setup() {
// Set Main Menu
$main_menu = get_term_by( 'name', 'Main Menu', 'nav_menu' );
if ( $main_menu ) {
set_theme_mod( 'nav_menu_locations', array(
'main-menu' => $main_menu->term_id,
) );
}
// Set front page
$front_page = get_page_by_title( 'Home' );
if ( $front_page ) {
update_option( 'show_on_front', 'page' );
update_option( 'page_on_front', $front_page->ID );
}
// Replace old URL with current site URL in theme options JSON
$json_file_path = plugin_dir_path( __FILE__ ) . 'demo/theme-options.json';
if ( file_exists( $json_file_path ) ) {
$theme_options_json = file_get_contents( $json_file_path );
$json_options = json_decode( $theme_options_json, true );
$updated_options = pylon_core_replace_url_in_array( $json_options, 'https://webdevcode.com/wp/pylon/live', get_site_url() );
update_option( 'pylon_theme_option', $updated_options );
}
if ( did_action( 'elementor/loaded' ) ) {
update_option( 'elementor_cpt_support', ['page','pylon_service','pylon_header', 'pylon_footer'] );
}
}
add_action( 'pt-ocdi/after_import', 'pylon_core_after_import_setup' );
// Recursive function to replace URLs in array
function pylon_core_replace_url_in_array( $array, $oldUrl, $newUrl ) {
foreach ( $array as $key => $value ) {
if ( is_array( $value ) ) {
$array[ $key ] = pylon_core_replace_url_in_array( $value, $oldUrl, $newUrl );
} else {
$array[ $key ] = str_replace( $oldUrl, $newUrl, $value );
}
}
return $array;
}
// Optional: Increase AJAX timeout if large XML
add_action( 'pt-ocdi/time_for_one_ajax_call', 'pylon_core_change_time_of_single_ajax_call' );
function pylon_core_change_time_of_single_ajax_call() {
return 100; // seconds
}