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