PluginProbe
WPInterface Add-ons / 1.0.3
WPInterface Add-ons v1.0.3
1.0.3 trunk 1.0.1 1.0.2
wpinterface-add-ons / wpinterface-add-ons.php

wpinterface-add-ons.php in WPInterface Add-ons 1.0.3, at wpinterface-add-ons.php

111 lines 4.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: WPInterface Add-ons
4 * Author: WPInterface
5 * Author URI: https://www.wpinterface.com
6 * Version: 1.0.3
7 * Description: WPInterface Add-ons enhances user-friendliness and simplifies the website-building process by allowing users to import demo data with a single click, creating a website identical to the demo effortlessly.
8 * Text Domain: wpinterface-add-ons
9 * Domain Path: /languages
10 * Requires at least: 5.6
11 * Requires PHP: 5.2
12 * Tested up to: 7.0
13 * License: GPLv2 or later
14 * License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
15 *
16 *
17 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
18 * General Public License version 2, as published by the Free Software Foundation. You may NOT assume
19 * that you can use any other version of the GPL.
20 *
21 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
22 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23 */
24 if (!defined('ABSPATH')) {
25 exit;
26 }
27
28 define('WPINTEERFACE_FILE', __FILE__);
29 define('WPINTEERFACE_ROOT', dirname(plugin_basename(WPINTEERFACE_FILE)));
30 define('WPINTEERFACE_PLUGIN_NAME', 'wpinterface-add-ons');
31 define('WPINTEERFACE_PLUGIN_SHORT_NAME', 'wpinterface-add-ons');
32 define('WPINTEERFACE_IC_URL', plugin_dir_url(__FILE__));
33 define('WPINTEERFACE_IC_DIR', plugin_dir_path(__FILE__));
34
35
36 if (!version_compare(PHP_VERSION, '5.6', '>=')) {
37 add_action('admin_notices', 'wpinterface_add_ons_php_version_check');
38 } elseif (!version_compare(get_bloginfo('version'), '4.7', '>=')) {
39 add_action('admin_notices', 'wpinterface_add_ons_wp_version_check');
40 } else {
41 if (!function_exists('is_plugin_active')) {
42 include_once(ABSPATH . 'wp-admin/includes/plugin.php');
43 }
44
45 $wpinterface_ocdi_active = is_plugin_active('one-click-demo-import/one-click-demo-import.php');
46 $wpinterface_smartocs_active = is_plugin_active('smart-one-click-setup/smart-one-click-setup.php');
47
48 // Show OCDI notice only when neither plugin is available.
49 if (!$wpinterface_ocdi_active && !$wpinterface_smartocs_active) {
50 add_action('admin_notices', 'wpinterface_add_ons_ocdi_check');
51 }
52
53 // OCDI integration.
54 if ($wpinterface_ocdi_active) {
55 require_once 'classes/class-wpintf-demo-import.php';
56 }
57
58 // SMARTOCS integration.
59 if ($wpinterface_smartocs_active) {
60 require_once 'classes/class-wpintf-smartocs-integration.php';
61 }
62 }
63
64 /**
65 *
66 * Warning when the site doesn't have the minimum required PHP version.
67 *
68 * @return void
69 * @since 1.0.0
70 *
71 */
72 function wpinterface_add_ons_php_version_check()
73 {
74 /* translators: %s: PHP version */
75 $message = sprintf(esc_html__('WPInterface Add-ons requires PHP version %s+, plugin is currently NOT RUNNING.', 'wpinterface-add-ons'), '5.6');
76 $html_message = sprintf('<div class="error">%s</div>', wpautop($message));
77 echo wp_kses_post($html_message);
78 }
79
80 /**
81 *
82 * Warning when the site doesn't have the minimum required WordPress version.
83 *
84 * @return void
85 * @since 1.0.0
86 *
87 */
88 function wpinterface_add_ons_wp_version_check()
89 {
90 /* translators: %s: WordPress version */
91 $message = sprintf(esc_html__('WPInterface Add-ons requires WordPress version %s+. Because you are using an earlier version, the plugin is currently NOT RUNNING.', 'wpinterface-add-ons'), '4.7');
92 $html_message = sprintf('<div class="error">%s</div>', wpautop($message));
93 echo wp_kses_post($html_message);
94 }
95
96 /**
97 *
98 * Warning when the site doesn't have the minimum required WordPress version.
99 *
100 * @return void
101 * @since 1.0.0
102 *
103 */
104 function wpinterface_add_ons_ocdi_check()
105 {
106 $plugin_name = '<a href="' . esc_url(admin_url('plugin-install.php?s=One%20Click%20Demo%20Import&tab=search&type=term')) . '" target="_blank">One Click Demo Import</a>';
107 /* translators: %s: One Click Demo Import plugin link */
108 $message = sprintf(esc_html__('WPInterface Add-ons is currently inactive. Please install and activate the %s plugin to proceed.', 'wpinterface-add-ons'), $plugin_name);
109 $html_message = sprintf('<div class="error">%s</div>', wpautop($message));
110 echo wp_kses_post($html_message);
111 }