PluginProbe ʕ •ᴥ•ʔ
Flex Import / 2.0
Flex Import v2.0
2.9 trunk 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8
flex-import / flex-import.php
flex-import Last commit date
assets 11 months ago includes 11 months ago templates 11 months ago templates-content 11 months ago flex-import.php 11 months ago readme.txt 11 months ago
flex-import.php
140 lines
1 <?php
2 /**
3 * Plugin Name: Flex Import
4 * Plugin URI:
5 * Description: A plugin to import demo content for Elementor templates.
6 * Version: 2.0
7 * Requires at least: 5.2
8 * Requires PHP: 7.2
9 * Author: flextheme
10 * Author URI:
11 * License: GPL v2 or later
12 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
13 * Text Domain: flex-import
14 * Requires Plugins:
15 */
16
17 if (!defined('ABSPATH')) {
18 exit; // Exit if accessed directly.
19 }
20
21 define('FLEXIMP_PLUGIN_FILE', plugin_dir_path(__FILE__));
22 define('FLEXIMP_MAIN_URL', 'https://license.flextheme.net/');
23 define('FLEXIMP_LICENSE_URL', 'https://app.flextheme.net/api/public/');
24 define('FLEXIMP_JSON_DATA_URL', 'https://license.flextheme.net/index.php/wp-json/flex-theme/v2/');
25 define('FLEXIMP_PLUGIN_URL', 'https://www.flextheme.net/');
26 define('FLEXIMP_DEMO_URL', 'https://demo.flextheme.net/');
27 define('FLEXIMP_PLUGIN_DIR_FILE', plugin_dir_url(__FILE__));
28 define('FLEXIMP_VER', '2.0');
29
30 add_filter( 'woocommerce_prevent_automatic_wizard_redirect', '__return_true' );
31
32 register_activation_hook(__FILE__, 'fleximp_check_elementor_on_activation');
33 function fleximp_check_elementor_on_activation() {
34 set_transient('fleximp_show_elementor_notice', true, 6000);
35 }
36
37
38 add_action('admin_notices', 'fleximp_elementor_admin_notice');
39 function fleximp_elementor_admin_notice() {
40 // if (!get_transient('fleximp_show_elementor_notice')) {
41 // return;
42 // }
43 delete_transient('fleximp_show_elementor_notice');
44
45 include_once(ABSPATH . 'wp-admin/includes/plugin.php');
46 if (is_plugin_active('elementor/elementor.php')) {
47 return;
48 }
49
50 $elementor_installed = file_exists(WP_PLUGIN_DIR . '/elementor/elementor.php');
51 $install_url = wp_nonce_url(
52 self_admin_url('update.php?action=install-plugin&plugin=elementor'),
53 'install-plugin_elementor'
54 );
55 $activate_url = wp_nonce_url(
56 self_admin_url('plugins.php?action=activate&plugin=elementor/elementor.php'),
57 'activate-plugin_elementor/elementor.php'
58 );
59
60 ?>
61 <div class="notice notice-warning is-dismissible">
62 <h2> Elementor is required</h2>
63 <p>The <strong>Flex Import</strong> plugin requires <strong>Elementor</strong> to function properly.</p>
64 <?php if (!$elementor_installed) : ?>
65 <p><a href="<?php echo esc_url($install_url); ?>" class="button button-primary">Install Elementor</a></p>
66 <?php else : ?>
67 <p><a href="<?php echo esc_url($activate_url); ?>" class="button button-primary">Activate Elementor</a></p>
68 <?php endif; ?>
69 </div>
70 <?php
71 }
72 //end
73
74 require_once plugin_dir_path(__FILE__) . 'includes/class-template-importer.php';
75
76 function fleximp_enqueue_dynamic_imported_css(){
77 $css_url = get_option('fleximp_dynamic_template_css');
78
79 if (!empty($css_url)) {
80 wp_enqueue_style(
81 'fleximp-dynamic-imported-css',
82 esc_url($css_url),
83 array(),
84 null
85 );
86 }
87
88 $js_url = get_option('fleximp_dynamic_template_js');
89
90 if (!empty($js_url)) {
91 wp_enqueue_script( 'fleximp-dynamic-imported-js',
92 esc_url($js_url),
93 array('jquery'),
94 FLEXIMP_VER,
95 true
96 );
97 }
98 }
99 add_action('wp_enqueue_scripts', 'fleximp_enqueue_dynamic_imported_css');
100
101
102 // Initialize the plugin
103 function fleximp_init() {
104 $importer = new FLEXIMP_Template_Importer();
105 $importer->init();
106 }
107 add_action('plugins_loaded', 'fleximp_init');
108
109
110 function fleximp_register_nav_menus() {
111 $is_premium_user = get_option('fleximp_is_premium', false);
112
113 if ($is_premium_user) {
114 register_nav_menus(array(
115 'primary-menu' => __('Primary Menu', 'flex-import'),
116 ));
117 }
118 }
119 add_action('after_setup_theme', 'fleximp_register_nav_menus');
120
121 add_action('admin_notices', 'fleximp_admin_notice_with_html');
122 function fleximp_admin_notice_with_html() {
123 ?>
124 <div class="notice is-dismissible fleximp" style="background-image: url(<?php echo esc_url( FLEXIMP_PLUGIN_DIR_FILE . 'assets/images/banner-bg.png'); ?>)">
125 <div class="fleximp-notice-banner-wrap" >
126 <div class="fleximp-left-img-wrap">
127 <img src="<?php echo esc_url(FLEXIMP_PLUGIN_DIR_FILE . 'assets/images/banner-right.png'); ?>">
128 </div>
129 <div class="fleximp-notice-heading">
130 <h1 class="fleximp-main-head"><?php echo esc_html('🎉 Upgrade to Premium Version - Flex Pro WordPress Theme!');?></h1>
131 <p class="fleximp-sub-head"><?php echo esc_html('Go beyond the basics—upgrade to Flex Pro for more customization, more templates, and a smoother, more professional website experience.');?></p>
132 <div class="fleximp-notice-btn">
133 <a class="fleximp-buy-btn fleximp-btn" target="_blank" href="<?php echo esc_url( FLEXIMP_PLUGIN_URL . 'products/flex-pro-wordpress-theme' ); ?>"><?php echo esc_html('UPGRADE PRO');?></a>
134 <a class="fleximp-buy-btn fleximp-btn" target="_blank" href="<?php echo esc_url( FLEXIMP_DEMO_URL . 'flex-multi-business-pro/' ); ?>"><?php echo esc_html('Live Demo');?></a>
135 </div>
136 </div>
137 </div>
138 </div>
139 <?php
140 }