PluginProbe ʕ •ᴥ•ʔ
Flex Import / 1.9
Flex Import v1.9
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
120 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: 1.9
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_DIR_FILE', plugin_dir_url(__FILE__));
26 define('FLEXIMP_VER', '1.9');
27
28 add_filter( 'woocommerce_prevent_automatic_wizard_redirect', '__return_true' );
29
30 register_activation_hook(__FILE__, 'fleximp_check_elementor_on_activation');
31 function fleximp_check_elementor_on_activation() {
32 set_transient('fleximp_show_elementor_notice', true, 6000);
33 }
34
35
36 add_action('admin_notices', 'fleximp_elementor_admin_notice');
37 function fleximp_elementor_admin_notice() {
38 // if (!get_transient('fleximp_show_elementor_notice')) {
39 // return;
40 // }
41 delete_transient('fleximp_show_elementor_notice');
42
43 include_once(ABSPATH . 'wp-admin/includes/plugin.php');
44 if (is_plugin_active('elementor/elementor.php')) {
45 return;
46 }
47
48 $elementor_installed = file_exists(WP_PLUGIN_DIR . '/elementor/elementor.php');
49 $install_url = wp_nonce_url(
50 self_admin_url('update.php?action=install-plugin&plugin=elementor'),
51 'install-plugin_elementor'
52 );
53 $activate_url = wp_nonce_url(
54 self_admin_url('plugins.php?action=activate&plugin=elementor/elementor.php'),
55 'activate-plugin_elementor/elementor.php'
56 );
57
58 ?>
59 <div class="notice notice-warning is-dismissible">
60 <h2> Elementor is required</h2>
61 <p>The <strong>Flex Import</strong> plugin requires <strong>Elementor</strong> to function properly.</p>
62 <?php if (!$elementor_installed) : ?>
63 <p><a href="<?php echo esc_url($install_url); ?>" class="button button-primary">Install Elementor</a></p>
64 <?php else : ?>
65 <p><a href="<?php echo esc_url($activate_url); ?>" class="button button-primary">Activate Elementor</a></p>
66 <?php endif; ?>
67 </div>
68 <?php
69 }
70 //end
71
72 require_once plugin_dir_path(__FILE__) . 'includes/class-template-importer.php';
73
74 function fleximp_enqueue_dynamic_imported_css(){
75 $css_url = get_option('fleximp_dynamic_template_css');
76
77 if (!empty($css_url)) {
78 wp_enqueue_style(
79 'fleximp-dynamic-imported-css',
80 esc_url($css_url),
81 array(),
82 null
83 );
84 }
85
86 $js_url = get_option('fleximp_dynamic_template_js');
87
88 if (!empty($js_url)) {
89 wp_enqueue_script( 'fleximp-dynamic-imported-js',
90 esc_url($js_url),
91 array('jquery'),
92 FLEXIMP_VER,
93 true
94 );
95 }
96 }
97 add_action('wp_enqueue_scripts', 'fleximp_enqueue_dynamic_imported_css');
98
99
100 // Initialize the plugin
101 function fleximp_init() {
102 $importer = new FLEXIMP_Template_Importer();
103 $importer->init();
104 }
105 add_action('plugins_loaded', 'fleximp_init');
106
107
108 function fleximp_register_nav_menus() {
109 $is_premium_user = get_option('fleximp_is_premium', false);
110
111 if ($is_premium_user) {
112 register_nav_menus(array(
113 'primary-menu' => __('Primary Menu', 'flex-import'),
114 ));
115 }
116 }
117 add_action('after_setup_theme', 'fleximp_register_nav_menus');
118
119
120