PluginProbe ʕ •ᴥ•ʔ
Flex Import / 1.8
Flex Import v1.8
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 1 year ago includes 1 year ago templates 1 year ago templates-content 1 year ago flex-import.php 1 year ago readme.txt 1 year ago
flex-import.php
112 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.8
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.8');
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 {
76 $css_url = get_option('fleximp_dynamic_template_css');
77
78 if (!empty($css_url)) {
79 wp_enqueue_style(
80 'fleximp-dynamic-imported-css',
81 esc_url($css_url),
82 array(),
83 null
84 );
85 }
86 }
87 add_action('wp_enqueue_scripts', 'fleximp_enqueue_dynamic_imported_css');
88
89
90 // Initialize the plugin
91 function fleximp_init()
92 {
93 $importer = new FLEXIMP_Template_Importer();
94 $importer->init();
95 }
96 add_action('plugins_loaded', 'fleximp_init');
97
98
99 function fleximp_register_nav_menus()
100 {
101 $is_premium_user = get_option('fleximp_is_premium', false);
102
103 if ($is_premium_user) {
104 register_nav_menus(array(
105 'primary-menu' => __('Primary Menu', 'flex-import'),
106 ));
107 }
108 }
109 add_action('after_setup_theme', 'fleximp_register_nav_menus');
110
111
112