| Server IP : 104.26.4.103 / Your IP : 216.73.216.4 Web Server : nginx/1.27.1 System : Linux in-5 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64 User : arabianexpress ( 1872) PHP Version : 8.0.30 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /storage/v9321/blueoceanprod/public_html/wp-content/plugins/techkit-core/ |
Upload File : |
<?php
/**
* @author RadiusTheme
* @since 1.0
* @version 1.0
*/
namespace radiustheme\Techkit_Core;
use \FW_Ext_Backups_Demo;
use \WPCF7_ContactFormTemplate;
if ( ! defined( 'ABSPATH' ) ) exit;
class Demo_Importer {
public function __construct() {
add_filter( 'plugin_action_links_rt-demo-importer/rt-demo-importer.php', array( $this, 'add_action_links' ) ); // Link from plugins page
add_filter( 'rt_demo_installer_warning', array( $this, 'data_loss_warning' ) );
add_filter( 'fw:ext:backups-demo:demos', array( $this, 'demo_config' ) );
add_action( 'fw:ext:backups:tasks:success:id:demo-content-install', array( $this, 'after_demo_install' ) );
}
public function add_action_links( $links ) {
$mylinks = array(
'<a href="' . esc_url( admin_url( 'tools.php?page=fw-backups-demo-content' ) ) . '">'.__( 'Install Demo Contents', 'techkit-core' ).'</a>',
);
return array_merge( $links, $mylinks );
}
public function data_loss_warning( $links ) {
$html = '<div style="margin-top:20px;color:#f00;font-size:20px;line-height:1.3;font-weight:600;margin-bottom:40px;border-color: #f00;border-style: dashed;border-width: 1px 0;padding:10px 0;">';
$html .= __( 'Warning: All your old data will be lost if you install One Click demo data from here, so it is suitable only for a new website.', 'techkit-core');
$html .= __( ' ( If one click demo import does not work please try manual demo import <a href="https://radiustheme.com/demo/wordpress/themes/techkit/docs/#section-4-2" target="__blank" style="text-decoration:none; color:#0554f2;">check documentation</a> )', 'techkit-core' );
$html .= '</div>';
return $html;
}
public function demo_config( $demos ) {
$demos_array = array(
'demo1' => array(
'title' => __( 'Home 1', 'techkit-core' ),
'screenshot' => plugins_url( 'screenshots/screenshot1.jpg', __FILE__ ),
'preview_link' => 'https://radiustheme.com/demo/wordpress/themes/techkit/',
),
'demo2' => array(
'title' => __( 'Home 2', 'techkit-core' ),
'screenshot' => plugins_url( 'screenshots/screenshot2.jpg', __FILE__ ),
'preview_link' => 'https://radiustheme.com/demo/wordpress/themes/techkit/home-2/',
),
'demo3' => array(
'title' => __( 'Home 3', 'techkit-core' ),
'screenshot' => plugins_url( 'screenshots/screenshot3.jpg', __FILE__ ),
'preview_link' => 'https://radiustheme.com/demo/wordpress/themes/techkit/home-3/',
),
'demo4' => array(
'title' => __( 'Home 4', 'techkit-core' ),
'screenshot' => plugins_url( 'screenshots/screenshot4.jpg', __FILE__ ),
'preview_link' => 'https://radiustheme.com/demo/wordpress/themes/techkit/home-4/',
),
'demo5' => array(
'title' => __( 'Home 5', 'techkit-core' ),
'screenshot' => plugins_url( 'screenshots/screenshot5.jpg', __FILE__ ),
'preview_link' => 'https://radiustheme.com/demo/wordpress/themes/techkit/home-5/',
),
'demo6' => array(
'title' => __( 'Home 6', 'techkit-core' ),
'screenshot' => plugins_url( 'screenshots/screenshot6.jpg', __FILE__ ),
'preview_link' => 'https://radiustheme.com/demo/wordpress/themes/techkit/home-6/',
),
'demo7' => array(
'title' => __( 'Home 7', 'techkit-core' ),
'screenshot' => plugins_url( 'screenshots/screenshot7.jpg', __FILE__ ),
'preview_link' => 'https://radiustheme.com/demo/wordpress/themes/techkit/home-7/',
),
);
$download_url = 'http://demo.radiustheme.com/wordpress/demo-content/techkit/';
foreach ($demos_array as $id => $data) {
$demo = new FW_Ext_Backups_Demo($id, 'piecemeal', array(
'url' => $download_url,
'file_id' => $id,
));
$demo->set_title($data['title']);
$demo->set_screenshot($data['screenshot']);
$demo->set_preview_link($data['preview_link']);
$demos[ $demo->get_id() ] = $demo;
unset($demo);
}
return $demos;
}
public function after_demo_install( $collection ){
// Update front page id
$demos = array(
'demo1' => 55,
'demo2' => 176,
'demo3' => 177,
'demo4' => 178,
'demo5' => 4531,
'demo6' => 7112,
'demo7' => 7253,
);
$data = $collection->to_array();
foreach( $data['tasks'] as $task ) {
if( $task['id'] == 'demo:demo-download' ){
$demo_id = $task['args']['demo_id'];
$page_id = $demos[$demo_id];
update_option( 'page_on_front', $page_id );
flush_rewrite_rules();
break;
}
}
// Update contact form 7 email
$cf7ids = array( 95, 1788, 2141 );
foreach ( $cf7ids as $cf7id ) {
$mail = get_post_meta( $cf7id, '_mail', true );
$mail['recipient'] = get_option( 'admin_email' );
if ( class_exists( 'WPCF7_ContactFormTemplate' ) ) {
$pattern = "/<[^@\s]*@[^@\s]*\.[^@\s]*>/"; // <email@email.com>
$replacement = '<'. WPCF7_ContactFormTemplate::from_email().'>';
$mail['sender'] = preg_replace($pattern, $replacement, $mail['sender']);
}
update_post_meta( $cf7id, '_mail', $mail );
}
// Update WooCommerce emails
$admin_email = get_option( 'admin_email' );
}
}
new Demo_Importer;