Version Description
- 6th March 2020 =
- Added - Secured Ajax requests and restructured code
Download this release
Release Info
Developer | cyberchimps |
Plugin | Responsive Add Ons |
Version | 2.2.6 |
Comparing to | |
See all releases |
Code changes from version 2.2.5 to 2.2.6
- admin/js/install-responsive-theme.js +3 -1
- admin/rollback/class-loader.php +4 -4
- admin/rollback/class-rollback.php +2 -2
- admin/rollback/common/class-module-factory.php +2 -2
- admin/rollback/start.php +3 -3
- admin/templates/responsive-addons-go-pro.php +11 -11
- includes/class-responsive-add-ons-activator.php +32 -0
- includes/class-responsive-add-ons-deactivator.php +33 -0
- includes/class-responsive-add-ons.php +839 -0
- includes/importers/batch-processing/class-responsive-ready-sites-batch-processing-menu.php +55 -57
- includes/importers/class-responsive-ready-sites-importer.php +4 -0
- includes/importers/class-responsive-ready-sites-options-importer.php +2 -2
- includes/importers/wxr-importer/class-responsive-ready-sites-wxr-importer.php +9 -3
- readme.txt +4 -1
- responsive-add-ons.php +40 -998
admin/js/install-responsive-theme.js
CHANGED
@@ -48,7 +48,8 @@
|
|
48 |
url: ResponsiveInstallThemeVars.ajaxurl,
|
49 |
type: 'POST',
|
50 |
data: {
|
51 |
-
'action' : 'responsive-ready-sites-activate-theme'
|
|
|
52 |
},
|
53 |
})
|
54 |
.done(function (result) {
|
@@ -115,6 +116,7 @@
|
|
115 |
data: {
|
116 |
action : 'responsive-notice-dismiss',
|
117 |
notice_id : notice_id,
|
|
|
118 |
},
|
119 |
});
|
120 |
|
48 |
url: ResponsiveInstallThemeVars.ajaxurl,
|
49 |
type: 'POST',
|
50 |
data: {
|
51 |
+
'action' : 'responsive-ready-sites-activate-theme',
|
52 |
+
'_ajax_nonce' : ResponsiveInstallThemeVars._ajax_nonce,
|
53 |
},
|
54 |
})
|
55 |
.done(function (result) {
|
116 |
data: {
|
117 |
action : 'responsive-notice-dismiss',
|
118 |
notice_id : notice_id,
|
119 |
+
_ajax_nonce : ResponsiveInstallThemeVars._ajax_nonce,
|
120 |
},
|
121 |
});
|
122 |
|
admin/rollback/class-loader.php
CHANGED
@@ -36,16 +36,16 @@ final class Loader {
|
|
36 |
*
|
37 |
* @var array The products which use the SDK.
|
38 |
*/
|
39 |
-
private static $products =
|
40 |
/**
|
41 |
* Holds available modules to load.
|
42 |
*
|
43 |
* @var array The modules which SDK will be using.
|
44 |
*/
|
45 |
-
private static $available_modules =
|
46 |
'rollback',
|
47 |
|
48 |
-
|
49 |
|
50 |
/**
|
51 |
* Initialize the sdk logic.
|
@@ -53,7 +53,7 @@ final class Loader {
|
|
53 |
public static function init() {
|
54 |
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Loader ) ) {
|
55 |
self::$instance = new Loader();
|
56 |
-
$modules = array_merge( self::$available_modules, apply_filters( 'responsive_sdk_modules',
|
57 |
self::$available_modules = $modules;
|
58 |
}
|
59 |
}
|
36 |
*
|
37 |
* @var array The products which use the SDK.
|
38 |
*/
|
39 |
+
private static $products = array();
|
40 |
/**
|
41 |
* Holds available modules to load.
|
42 |
*
|
43 |
* @var array The modules which SDK will be using.
|
44 |
*/
|
45 |
+
private static $available_modules = array(
|
46 |
'rollback',
|
47 |
|
48 |
+
);
|
49 |
|
50 |
/**
|
51 |
* Initialize the sdk logic.
|
53 |
public static function init() {
|
54 |
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Loader ) ) {
|
55 |
self::$instance = new Loader();
|
56 |
+
$modules = array_merge( self::$available_modules, apply_filters( 'responsive_sdk_modules', array() ) );
|
57 |
self::$available_modules = $modules;
|
58 |
}
|
59 |
}
|
admin/rollback/class-rollback.php
CHANGED
@@ -114,7 +114,7 @@ class Rollback extends Abstract_Module {
|
|
114 |
$url = $this->get_versions_api_url();
|
115 |
|
116 |
if ( empty( $url ) ) {
|
117 |
-
return
|
118 |
}
|
119 |
$response = wp_remote_get( $url );
|
120 |
if ( is_wp_error( $response ) ) {
|
@@ -194,7 +194,7 @@ class Rollback extends Abstract_Module {
|
|
194 |
|
195 |
if ( false === $transient ) {
|
196 |
set_transient( $this->product->get_key() . '_warning_rollback', 'in progress', 30 );
|
197 |
-
require_once
|
198 |
$title = sprintf( apply_filters( $this->product->get_key() . '_rollback_message', 'Rolling back %s to v%s' ), $this->product->get_name(), $version );
|
199 |
$theme = $folder . '/style.css';
|
200 |
$nonce = 'upgrade-theme_' . $theme;
|
114 |
$url = $this->get_versions_api_url();
|
115 |
|
116 |
if ( empty( $url ) ) {
|
117 |
+
return array();
|
118 |
}
|
119 |
$response = wp_remote_get( $url );
|
120 |
if ( is_wp_error( $response ) ) {
|
194 |
|
195 |
if ( false === $transient ) {
|
196 |
set_transient( $this->product->get_key() . '_warning_rollback', 'in progress', 30 );
|
197 |
+
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
198 |
$title = sprintf( apply_filters( $this->product->get_key() . '_rollback_message', 'Rolling back %s to v%s' ), $this->product->get_name(), $version );
|
199 |
$theme = $folder . '/style.css';
|
200 |
$nonce = 'upgrade-theme_' . $theme;
|
admin/rollback/common/class-module-factory.php
CHANGED
@@ -25,7 +25,7 @@ class Module_Factory {
|
|
25 |
*
|
26 |
* @var array Mapping array.
|
27 |
*/
|
28 |
-
private static $modules_attached =
|
29 |
|
30 |
/**
|
31 |
* Load availabe modules for the selected product.
|
@@ -36,7 +36,7 @@ class Module_Factory {
|
|
36 |
public static function attach( $product, $modules ) {
|
37 |
|
38 |
if ( ! isset( self::$modules_attached[ $product->get_slug() ] ) ) {
|
39 |
-
self::$modules_attached[ $product->get_slug() ] =
|
40 |
}
|
41 |
|
42 |
foreach ( $modules as $module ) {
|
25 |
*
|
26 |
* @var array Mapping array.
|
27 |
*/
|
28 |
+
private static $modules_attached = array();
|
29 |
|
30 |
/**
|
31 |
* Load availabe modules for the selected product.
|
36 |
public static function attach( $product, $modules ) {
|
37 |
|
38 |
if ( ! isset( self::$modules_attached[ $product->get_slug() ] ) ) {
|
39 |
+
self::$modules_attached[ $product->get_slug() ] = array();
|
40 |
}
|
41 |
|
42 |
foreach ( $modules as $module ) {
|
admin/rollback/start.php
CHANGED
@@ -16,14 +16,14 @@ if ( ! class_exists( 'Responsive_Plugin_Install_Helper' ) ) {
|
|
16 |
}
|
17 |
$products = apply_filters( 'responsive_sdk_products', array() );
|
18 |
$diretory_path = dirname( __FILE__ );
|
19 |
-
$files_to_load =
|
20 |
$diretory_path . '/class-loader.php',
|
21 |
$diretory_path . '/class-product.php',
|
22 |
$diretory_path . '/common/class-abstract-module.php',
|
23 |
$diretory_path . '/common/class-module-factory.php',
|
24 |
$diretory_path . '/class-rollback.php',
|
25 |
-
|
26 |
-
$files_to_load = array_merge( $files_to_load, apply_filters( 'responsive_sdk_required_files',
|
27 |
|
28 |
foreach ( $files_to_load as $file ) {
|
29 |
if ( is_file( $file ) ) {
|
16 |
}
|
17 |
$products = apply_filters( 'responsive_sdk_products', array() );
|
18 |
$diretory_path = dirname( __FILE__ );
|
19 |
+
$files_to_load = array(
|
20 |
$diretory_path . '/class-loader.php',
|
21 |
$diretory_path . '/class-product.php',
|
22 |
$diretory_path . '/common/class-abstract-module.php',
|
23 |
$diretory_path . '/common/class-module-factory.php',
|
24 |
$diretory_path . '/class-rollback.php',
|
25 |
+
);
|
26 |
+
$files_to_load = array_merge( $files_to_load, apply_filters( 'responsive_sdk_required_files', array() ) );
|
27 |
|
28 |
foreach ( $files_to_load as $file ) {
|
29 |
if ( is_file( $file ) ) {
|
admin/templates/responsive-addons-go-pro.php
CHANGED
@@ -18,53 +18,53 @@
|
|
18 |
<thead>
|
19 |
<tr>
|
20 |
<th></th>
|
21 |
-
<th
|
22 |
-
<th
|
23 |
</tr>
|
24 |
</thead>
|
25 |
<tbody>
|
26 |
<tr>
|
27 |
-
<td class="feature"
|
28 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
29 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
30 |
</tr>
|
31 |
<tr>
|
32 |
-
<td class="feature"
|
33 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
34 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
35 |
</tr>
|
36 |
<tr>
|
37 |
-
<td class="feature"
|
38 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
39 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
40 |
</tr>
|
41 |
<tr>
|
42 |
-
<td class="feature"
|
43 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
44 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
45 |
</tr>
|
46 |
<tr>
|
47 |
-
<td class="feature"
|
48 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
49 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
50 |
</tr>
|
51 |
<tr>
|
52 |
-
<td class="feature"
|
53 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
54 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
55 |
</tr>
|
56 |
<tr>
|
57 |
-
<td class="feature"
|
58 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
59 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
60 |
</tr>
|
61 |
<tr>
|
62 |
-
<td class="feature"
|
63 |
<td class="featureno">-</td>
|
64 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
65 |
</tr>
|
66 |
<tr>
|
67 |
-
<td class="feature"
|
68 |
<td class="featureno">-</td>
|
69 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
70 |
</tr>
|
18 |
<thead>
|
19 |
<tr>
|
20 |
<th></th>
|
21 |
+
<th><?php esc_html_e( 'Free', 'responsive-addons' ); ?></th>
|
22 |
+
<th><?php esc_html_e( 'Pro', 'responsive-addons' ); ?></th>
|
23 |
</tr>
|
24 |
</thead>
|
25 |
<tbody>
|
26 |
<tr>
|
27 |
+
<td class="feature"><?php esc_html_e( 'Ready Sites', 'responsive-addons' ); ?></td>
|
28 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
29 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
30 |
</tr>
|
31 |
<tr>
|
32 |
+
<td class="feature"><?php esc_html_e( 'Compatible with Elementor Page Builder', 'responsive-addons' ); ?></td>
|
33 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
34 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
35 |
</tr>
|
36 |
<tr>
|
37 |
+
<td class="feature"><?php esc_html_e( 'Mobile Friendly', 'responsive-addons' ); ?></td>
|
38 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
39 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
40 |
</tr>
|
41 |
<tr>
|
42 |
+
<td class="feature"><?php esc_html_e( 'WooCommerce Compatible', 'responsive-addons' ); ?></td>
|
43 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
44 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
45 |
</tr>
|
46 |
<tr>
|
47 |
+
<td class="feature"><?php esc_html_e( 'Layout Customizer', 'responsive-addons' ); ?></td>
|
48 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
49 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
50 |
</tr>
|
51 |
<tr>
|
52 |
+
<td class="feature"><?php esc_html_e( 'Color Customizer', 'responsive-addons' ); ?></td>
|
53 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
54 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
55 |
</tr>
|
56 |
<tr>
|
57 |
+
<td class="feature"><?php esc_html_e( 'Typography Customizer', 'responsive-addons' ); ?></td>
|
58 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
59 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
60 |
</tr>
|
61 |
<tr>
|
62 |
+
<td class="feature"><?php esc_html_e( 'Premium Support', 'responsive-addons' ); ?></td>
|
63 |
<td class="featureno">-</td>
|
64 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
65 |
</tr>
|
66 |
<tr>
|
67 |
+
<td class="feature"><?php esc_html_e( 'Pro Ready Sites', 'responsive-addons' ); ?></td>
|
68 |
<td class="featureno">-</td>
|
69 |
<td class="featureyes"><span class='dashicons-before dashicons-yes'></span></td>
|
70 |
</tr>
|
includes/class-responsive-add-ons-activator.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Fired during plugin activation
|
4 |
+
*
|
5 |
+
* @link https://www.cyberchimps.com
|
6 |
+
* @since 1.0.0
|
7 |
+
*
|
8 |
+
* @package Responsive_Add_Ons
|
9 |
+
* @subpackage Responsive_Add_Ons/includes
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Fired during plugin activation.
|
14 |
+
*
|
15 |
+
* This class defines all code necessary to run during the plugin's activation.
|
16 |
+
*
|
17 |
+
* @since 1.0.0
|
18 |
+
* @package Responsive_Add_Ons
|
19 |
+
* @subpackage Responsive_Add_Ons/includes
|
20 |
+
* @author CyberChimps <support@cyberchimps.com>
|
21 |
+
*/
|
22 |
+
class Responsive_Add_Ons_Activator {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Short Description.
|
26 |
+
*
|
27 |
+
* Long Description.
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
*/
|
31 |
+
public static function activate() {}
|
32 |
+
}
|
includes/class-responsive-add-ons-deactivator.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Fired during plugin deactivation
|
4 |
+
*
|
5 |
+
* @link https://www.cyberchimps.com
|
6 |
+
* @since 1.0.0
|
7 |
+
*
|
8 |
+
* @package Responsive_Add_Ons
|
9 |
+
* @subpackage Responsive_Add_Ons/includes
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Fired during plugin deactivation.
|
14 |
+
*
|
15 |
+
* This class defines all code necessary to run during the plugin's deactivation.
|
16 |
+
*
|
17 |
+
* @since 1.0.0
|
18 |
+
* @package Responsive_Add_Ons
|
19 |
+
* @subpackage Responsive_Add_Ons/includes
|
20 |
+
* @author CyberChimps <support@cyberchimps.com>
|
21 |
+
*/
|
22 |
+
class Responsive_Add_Ons_Deactivator {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Short Description.
|
26 |
+
*
|
27 |
+
* Long Description.
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
*/
|
31 |
+
public static function deactivate() {}
|
32 |
+
|
33 |
+
}
|
includes/class-responsive-add-ons.php
ADDED
@@ -0,0 +1,839 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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Addons
|
6 |
+
* @since 1.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
defined( 'ABSPATH' ) || exit;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Main Responsive_Add_Ons Class.
|
13 |
+
*
|
14 |
+
* @class Responsive_Add_Ons
|
15 |
+
*/
|
16 |
+
class Responsive_Add_Ons {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Options
|
20 |
+
*
|
21 |
+
* @since 1.0.0
|
22 |
+
* @var array Options
|
23 |
+
*/
|
24 |
+
public $options;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Options
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
* @var array Plugin Options
|
31 |
+
*/
|
32 |
+
public $plugin_options;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* API Url
|
36 |
+
*
|
37 |
+
* @since 2.0.0
|
38 |
+
* @var string API Url
|
39 |
+
*/
|
40 |
+
public static $api_url;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Constructor.
|
44 |
+
*
|
45 |
+
* @since 1.0.0
|
46 |
+
*/
|
47 |
+
public function __construct() {
|
48 |
+
|
49 |
+
add_action( 'admin_init', array( &$this, 'admin_init' ) );
|
50 |
+
add_action( 'admin_notices', array( &$this, 'add_theme_installation_notice' ), 1 );
|
51 |
+
add_action( 'wp_head', array( &$this, 'responsive_head' ) );
|
52 |
+
add_action( 'plugins_loaded', array( &$this, 'responsive_addons_translations' ) );
|
53 |
+
$plugin = plugin_basename( __FILE__ );
|
54 |
+
add_filter( "plugin_action_links_$plugin", array( &$this, 'plugin_settings_link' ) );
|
55 |
+
|
56 |
+
// Responsive Ready Site Importer Menu.
|
57 |
+
add_action( 'admin_enqueue_scripts', array( &$this, 'responsive_ready_sites_admin_enqueue_scripts' ) );
|
58 |
+
|
59 |
+
add_action( 'admin_enqueue_scripts', array( &$this, 'responsive_ready_sites_admin_enqueue_styles' ) );
|
60 |
+
|
61 |
+
if ( is_admin() ) {
|
62 |
+
add_action( 'wp_ajax_responsive-ready-sites-activate-theme', array( $this, 'activate_theme' ) );
|
63 |
+
add_action( 'wp_ajax_responsive-ready-sites-required-plugins', array( &$this, 'required_plugin' ) );
|
64 |
+
add_action( 'wp_ajax_responsive-ready-sites-required-plugin-activate', array( &$this, 'required_plugin_activate' ) );
|
65 |
+
add_action( 'wp_ajax_responsive-ready-sites-set-reset-data', array( &$this, 'set_reset_data' ) );
|
66 |
+
add_action( 'wp_ajax_responsive-ready-sites-backup-settings', array( &$this, 'backup_settings' ) );
|
67 |
+
add_action( 'wp_ajax_responsive-is-theme-active', array( &$this, 'check_responsive_theme_active' ) );
|
68 |
+
// Dismiss admin notice.
|
69 |
+
add_action( 'wp_ajax_responsive-notice-dismiss', array( &$this, 'dismiss_notice' ) );
|
70 |
+
// Check if Responsive Addons pro plugin is active.
|
71 |
+
add_action( 'wp_ajax_check-responsive-add-ons-pro-installed', array( $this, 'is_responsive_pro_is_installed' ) );
|
72 |
+
|
73 |
+
// Check if Responsive Addons pro license is active.
|
74 |
+
add_action( 'wp_ajax_check-responsive-add-ons-pro-license-active', array( $this, 'is_responsive_pro_license_is_active' ) );
|
75 |
+
}
|
76 |
+
|
77 |
+
// Responsive Addons Page.
|
78 |
+
add_action( 'admin_menu', array( $this, 'responsive_addons_admin_page' ), 100 );
|
79 |
+
|
80 |
+
$this->options = get_option( 'responsive_theme_options' );
|
81 |
+
$this->plugin_options = get_option( 'responsive_addons_options' );
|
82 |
+
|
83 |
+
$this->load_responsive_sites_importer();
|
84 |
+
|
85 |
+
add_action( 'responsive_addons_importer_page', array( $this, 'menu_callback' ) );
|
86 |
+
|
87 |
+
// Add rating links to the Responsive Addons Admin Page.
|
88 |
+
add_filter( 'admin_footer_text', array( $this, 'responsive_addons_admin_rate_us' ) );
|
89 |
+
|
90 |
+
add_action( 'init', array( $this, 'app_output_buffer' ) );
|
91 |
+
self::set_api_url();
|
92 |
+
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Admin notice - install responsive theme
|
97 |
+
*/
|
98 |
+
public function add_theme_installation_notice() {
|
99 |
+
|
100 |
+
$theme = wp_get_theme();
|
101 |
+
|
102 |
+
if ( 'Responsive' === $theme->name || 'Responsive' === $theme->parent_theme || $this->is_activation_theme_notice_expired() || is_plugin_active( 'responsive-addons-pro/responsive-addons-pro.php' ) ) {
|
103 |
+
return;
|
104 |
+
}
|
105 |
+
|
106 |
+
$class = 'responsive-notice notice notice-error';
|
107 |
+
|
108 |
+
$theme_status = 'responsive-sites-theme-' . $this->get_theme_status();
|
109 |
+
|
110 |
+
$image_path = RESPONSIVE_ADDONS_URI . 'admin/images/responsive-thumbnail.jpg';
|
111 |
+
?>
|
112 |
+
<div id="responsive-theme-activation" class="<?php echo $class; ?>">
|
113 |
+
<div class="responsive-addons-message-inner">
|
114 |
+
<div class="responsive-addons-message-icon">
|
115 |
+
<div class="">
|
116 |
+
<img src="<?php echo $image_path; ?>" alt="Responsive Ready Sites Importer">
|
117 |
+
</div>
|
118 |
+
</div>
|
119 |
+
<div class="responsive-addons-message-content">
|
120 |
+
<p><?php echo esc_html( 'Responsive theme needs to be active to use the Responsive Ready Sites Importer plugin.' ); ?> </p>
|
121 |
+
<p class="responsive-addons-message-actions">
|
122 |
+
<a href="#" class="<?php echo $theme_status; ?> button button-primary" data-theme-slug="responsive">Install & Activate Now</a>
|
123 |
+
</p>
|
124 |
+
</div>
|
125 |
+
</div>
|
126 |
+
</div>
|
127 |
+
<?php
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Is notice expired?
|
132 |
+
*
|
133 |
+
* @since 2.0.3
|
134 |
+
*
|
135 |
+
* @return boolean
|
136 |
+
*/
|
137 |
+
public static function is_activation_theme_notice_expired() {
|
138 |
+
|
139 |
+
// Check the user meta status if current notice is dismissed.
|
140 |
+
$meta_status = get_user_meta( get_current_user_id(), 'responsive-theme-activation', true );
|
141 |
+
|
142 |
+
if ( empty( $meta_status ) ) {
|
143 |
+
return false;
|
144 |
+
}
|
145 |
+
|
146 |
+
return true;
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Dismiss Notice.
|
151 |
+
*
|
152 |
+
* @since 2.0.3
|
153 |
+
* @return void
|
154 |
+
*/
|
155 |
+
public function dismiss_notice() {
|
156 |
+
check_ajax_referer( 'responsive-addons', '_ajax_nonce' );
|
157 |
+
|
158 |
+
if ( ! current_user_can( 'install_plugins' ) ) {
|
159 |
+
wp_send_json_error( __( 'You are not allowed to activate the Theme', 'responsive-addons' ) );
|
160 |
+
}
|
161 |
+
|
162 |
+
$notice_id = ( isset( $_POST['notice_id'] ) ) ? sanitize_key( $_POST['notice_id'] ) : '';
|
163 |
+
|
164 |
+
// check for Valid input.
|
165 |
+
if ( ! empty( $notice_id ) ) {
|
166 |
+
update_user_meta( get_current_user_id(), $notice_id, 'notice-dismissed' );
|
167 |
+
wp_send_json_success();
|
168 |
+
}
|
169 |
+
|
170 |
+
wp_send_json_error();
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Activate theme
|
175 |
+
*
|
176 |
+
* @since 2.0.3
|
177 |
+
* @return void
|
178 |
+
*/
|
179 |
+
public function activate_theme() {
|
180 |
+
|
181 |
+
check_ajax_referer( 'responsive-addons', '_ajax_nonce' );
|
182 |
+
|
183 |
+
if ( ! current_user_can( 'switch_themes' ) ) {
|
184 |
+
wp_send_json_error( __( 'You are not allowed to activate the Theme', 'responsive-addons' ) );
|
185 |
+
}
|
186 |
+
|
187 |
+
switch_theme( 'responsive' );
|
188 |
+
|
189 |
+
wp_send_json_success(
|
190 |
+
array(
|
191 |
+
'success' => true,
|
192 |
+
'message' => __( 'Theme Activated', 'responsive-addons' ),
|
193 |
+
)
|
194 |
+
);
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Get theme install, active or inactive status.
|
199 |
+
*
|
200 |
+
* @since 1.3.2
|
201 |
+
*
|
202 |
+
* @return string Theme status
|
203 |
+
*/
|
204 |
+
public function get_theme_status() {
|
205 |
+
|
206 |
+
$theme = wp_get_theme();
|
207 |
+
|
208 |
+
// Theme installed and activate.
|
209 |
+
if ( 'Responsive' === $theme->name || 'Responsive' === $theme->parent_theme ) {
|
210 |
+
return 'installed-and-active';
|
211 |
+
}
|
212 |
+
|
213 |
+
// Theme installed but not activate.
|
214 |
+
foreach ( (array) wp_get_themes() as $theme_dir => $theme ) {
|
215 |
+
if ( 'Responsive' === $theme->name || 'Responsive' === $theme->parent_theme ) {
|
216 |
+
return 'installed-but-inactive';
|
217 |
+
}
|
218 |
+
}
|
219 |
+
|
220 |
+
return 'not-installed';
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Stuff to do when you activate
|
225 |
+
*/
|
226 |
+
public static function activate() {
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Clean up after Deactivation
|
231 |
+
*/
|
232 |
+
public static function deactivate() {
|
233 |
+
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
* Setter for $api_url
|
237 |
+
*
|
238 |
+
* @since 1.0.0
|
239 |
+
*/
|
240 |
+
public static function set_api_url() {
|
241 |
+
self::$api_url = apply_filters( 'responsive_ready_sites_api_url', 'https://ccreadysites.cyberchimps.com/wp-json/wp/v2/' );
|
242 |
+
}
|
243 |
+
|
244 |
+
/**
|
245 |
+
* Hook into WP admin_init
|
246 |
+
* Responsive 1.x settings
|
247 |
+
*
|
248 |
+
* @param array $options Options.
|
249 |
+
*/
|
250 |
+
public function admin_init( $options ) {
|
251 |
+
$this->init_settings();
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Create plugin translations
|
256 |
+
*/
|
257 |
+
public function responsive_addons_translations() {
|
258 |
+
// Load the text domain for translations.
|
259 |
+
load_plugin_textdomain( 'responsive-addons', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
260 |
+
}
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Settings
|
264 |
+
*/
|
265 |
+
public function init_settings() {
|
266 |
+
register_setting(
|
267 |
+
'responsive_addons',
|
268 |
+
'responsive_addons_options',
|
269 |
+
array( &$this, 'responsive_addons_sanitize' )
|
270 |
+
);
|
271 |
+
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Test to see if the current theme is Responsive
|
276 |
+
*
|
277 |
+
* @return bool
|
278 |
+
*/
|
279 |
+
public static function is_responsive() {
|
280 |
+
$theme = wp_get_theme();
|
281 |
+
|
282 |
+
if ( 'Responsive' == $theme->Name || 'responsive' == $theme->Template || 'Responsive Pro' == $theme->Name || 'responsivepro' == $theme->Template ) {
|
283 |
+
return true;
|
284 |
+
} else {
|
285 |
+
return false;
|
286 |
+
}
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Add to wp head
|
291 |
+
*/
|
292 |
+
public function responsive_head() {
|
293 |
+
|
294 |
+
// Test if using Responsive theme. If yes load from responsive options else load from plugin options.
|
295 |
+
$responsive_options = ( $this->is_responsive() ) ? $this->options : $this->plugin_options;
|
296 |
+
|
297 |
+
if ( ! empty( $responsive_options['google_site_verification'] ) ) {
|
298 |
+
echo '<meta name="google-site-verification" content="' . esc_attr( $responsive_options['google_site_verification'] ) . '" />' . "\n";
|
299 |
+
}
|
300 |
+
|
301 |
+
if ( ! empty( $responsive_options['bing_site_verification'] ) ) {
|
302 |
+
echo '<meta name="msvalidate.01" content="' . esc_attr( $responsive_options['bing_site_verification'] ) . '" />' . "\n";
|
303 |
+
}
|
304 |
+
|
305 |
+
if ( ! empty( $responsive_options['yahoo_site_verification'] ) ) {
|
306 |
+
echo '<meta name="y_key" content="' . esc_attr( $responsive_options['yahoo_site_verification'] ) . '" />' . "\n";
|
307 |
+
}
|
308 |
+
|
309 |
+
if ( ! empty( $responsive_options['site_statistics_tracker'] ) ) {
|
310 |
+
echo $responsive_options['site_statistics_tracker'];
|
311 |
+
}
|
312 |
+
}
|
313 |
+
|
314 |
+
/**
|
315 |
+
* Responsive Addons Sanitize
|
316 |
+
*
|
317 |
+
* @since 2.0.3
|
318 |
+
*
|
319 |
+
* @param string $input Input.
|
320 |
+
*
|
321 |
+
* @return string
|
322 |
+
*/
|
323 |
+
public function responsive_addons_sanitize( $input ) {
|
324 |
+
|
325 |
+
$output = array();
|
326 |
+
|
327 |
+
foreach ( $input as $key => $test ) {
|
328 |
+
switch ( $key ) {
|
329 |
+
case 'google_site_verification':
|
330 |
+
$output[ $key ] = wp_filter_post_kses( $test );
|
331 |
+
break;
|
332 |
+
case 'yahoo_site_verification':
|
333 |
+
$output[ $key ] = wp_filter_post_kses( $test );
|
334 |
+
break;
|
335 |
+
case 'bing_site_verification':
|
336 |
+
$output[ $key ] = wp_filter_post_kses( $test );
|
337 |
+
break;
|
338 |
+
case 'site_statistics_tracker':
|
339 |
+
$output[ $key ] = wp_kses_stripslashes( $test );
|
340 |
+
break;
|
341 |
+
|
342 |
+
}
|
343 |
+
}
|
344 |
+
|
345 |
+
return $output;
|
346 |
+
}
|
347 |
+
|
348 |
+
/**
|
349 |
+
* Add settings link to plugin activate page
|
350 |
+
*
|
351 |
+
* @param array $links Links.
|
352 |
+
*
|
353 |
+
* @return mixed
|
354 |
+
*/
|
355 |
+
public function plugin_settings_link( $links ) {
|
356 |
+
$settings_link = '<a href="themes.php?page=responsive-add-ons">' . __( 'Settings', 'responsive-addons' ) . '</a>';
|
357 |
+
array_unshift( $links, $settings_link );
|
358 |
+
|
359 |
+
return $links;
|
360 |
+
}
|
361 |
+
|
362 |
+
/**
|
363 |
+
* Menu callback
|
364 |
+
*
|
365 |
+
* @since 2.0.0
|
366 |
+
*/
|
367 |
+
public function menu_callback() {
|
368 |
+
?>
|
369 |
+
<div class="responsive-sites-menu-page-wrapper">
|
370 |
+
<?php require_once RESPONSIVE_ADDONS_DIR . 'admin/partials/responsive-ready-sites-admin-display.php'; ?>
|
371 |
+
</div>
|
372 |
+
<?php
|
373 |
+
}
|
374 |
+
|
375 |
+
/**
|
376 |
+
* Load Responsive Ready Sites Importer
|
377 |
+
*
|
378 |
+
* @since 2.0.0
|
379 |
+
*/
|
380 |
+
public function load_responsive_sites_importer() {
|
381 |
+
require_once RESPONSIVE_ADDONS_DIR . 'includes/importers/class-responsive-ready-sites-importer.php';
|
382 |
+
}
|
383 |
+
|
384 |
+
/**
|
385 |
+
* Include Admin JS
|
386 |
+
*
|
387 |
+
* @param string $hook Hook.
|
388 |
+
*
|
389 |
+
* @since 2.0.0
|
390 |
+
*/
|
391 |
+
public function responsive_ready_sites_admin_enqueue_scripts( $hook ) {
|
392 |
+
|
393 |
+
wp_enqueue_script( 'install-responsive-theme', RESPONSIVE_ADDONS_URI . 'admin/js/install-responsive-theme.js', array( 'jquery', 'updates' ), '2.0.3', true );
|
394 |
+
wp_enqueue_style( 'install-responsive-theme', RESPONSIVE_ADDONS_URI . 'admin/css/install-responsive-theme.css', null, '2.0.3', 'all' );
|
395 |
+
$data = apply_filters(
|
396 |
+
'responsive_sites_install_theme_localize_vars',
|
397 |
+
array(
|
398 |
+
'installed' => __( 'Installed! Activating..', 'responsive-addons' ),
|
399 |
+
'activating' => __( 'Activating..', 'responsive-addons' ),
|
400 |
+
'activated' => __( 'Activated! Reloading..', 'responsive-addons' ),
|
401 |
+
'installing' => __( 'Installing..', 'responsive-addons' ),
|
402 |
+
'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
|
403 |
+
'_ajax_nonce' => wp_create_nonce( 'responsive-addons' ),
|
404 |
+
)
|
405 |
+
);
|
406 |
+
wp_localize_script( 'install-responsive-theme', 'ResponsiveInstallThemeVars', $data );
|
407 |
+
|
408 |
+
if ( 'appearance_page_responsive-add-ons' === $hook && empty( $_GET['action'] ) ) {
|
409 |
+
|
410 |
+
wp_enqueue_script( 'responsive-ready-sites-fetch', RESPONSIVE_ADDONS_URI . 'admin/js/fetch.umd.js', array( 'jquery' ), '2.0.0', true );
|
411 |
+
|
412 |
+
wp_enqueue_script( 'responsive-ready-sites-api', RESPONSIVE_ADDONS_URI . 'admin/js/responsive-ready-sites-api.js', array( 'jquery', 'responsive-ready-sites-fetch' ), '2.0.0', true );
|
413 |
+
|
414 |
+
wp_enqueue_script( 'responsive-ready-sites-admin-js', RESPONSIVE_ADDONS_URI . 'admin/js/responsive-ready-sites-admin.js', array( 'jquery', 'wp-util', 'updates' ), '2.0.0', true );
|
415 |
+
|
416 |
+
wp_enqueue_script( 'render-responsive-ready-sites', RESPONSIVE_ADDONS_URI . 'admin/js/render-responsive-ready-sites.js', array( 'wp-util', 'responsive-ready-sites-api', 'jquery' ), '2.0.0', true );
|
417 |
+
|
418 |
+
$data = apply_filters(
|
419 |
+
'responsive_sites_localize_vars',
|
420 |
+
array(
|
421 |
+
'debug' => ((defined('WP_DEBUG') && WP_DEBUG) || isset($_GET['debug'])) ? true : false, //phpcs:ignore
|
422 |
+
'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
|
423 |
+
'siteURL' => site_url(),
|
424 |
+
'_ajax_nonce' => wp_create_nonce( 'responsive-addons' ),
|
425 |
+
'XMLReaderDisabled' => ! class_exists( 'XMLReader' ) ? true : false,
|
426 |
+
'required_plugins' => array(),
|
427 |
+
'ApiURL' => self::$api_url,
|
428 |
+
)
|
429 |
+
);
|
430 |
+
|
431 |
+
wp_localize_script( 'responsive-ready-sites-admin-js', 'responsiveSitesAdmin', $data );
|
432 |
+
|
433 |
+
$data = apply_filters(
|
434 |
+
'responsive_sites_localize_vars',
|
435 |
+
array(
|
436 |
+
'ApiURL' => self::$api_url,
|
437 |
+
)
|
438 |
+
);
|
439 |
+
|
440 |
+
// Use this for premium demos.
|
441 |
+
$request_params = apply_filters(
|
442 |
+
'responsive_sites_api_params',
|
443 |
+
array(
|
444 |
+
'site_url' => '',
|
445 |
+
'per_page' => 15,
|
446 |
+
)
|
447 |
+
);
|
448 |
+
|
449 |
+
wp_localize_script( 'responsive-ready-sites-api', 'responsiveSitesApi', $data );
|
450 |
+
$data = apply_filters(
|
451 |
+
'responsive_sites_render_localize_vars',
|
452 |
+
array(
|
453 |
+
'sites' => $request_params,
|
454 |
+
'settings' => array(),
|
455 |
+
'active_site_data' => $this->get_active_site_data(),
|
456 |
+
)
|
457 |
+
);
|
458 |
+
|
459 |
+
wp_localize_script( 'render-responsive-ready-sites', 'responsiveSitesRender', $data );
|
460 |
+
}
|
461 |
+
}
|
462 |
+
|
463 |
+
/**
|
464 |
+
* Include Admin css
|
465 |
+
*
|
466 |
+
* @since 2.0.0
|
467 |
+
*/
|
468 |
+
public function responsive_ready_sites_admin_enqueue_styles() {
|
469 |
+
// Responsive Ready Sites admin styles.
|
470 |
+
wp_register_style( 'responsive-ready-sites-admin', RESPONSIVE_ADDONS_URI . 'admin/css/responsive-ready-sites-admin.css', false, '1.0.0' );
|
471 |
+
wp_enqueue_style( 'responsive-ready-sites-admin' );
|
472 |
+
}
|
473 |
+
|
474 |
+
/**
|
475 |
+
* Backup existing settings.
|
476 |
+
*/
|
477 |
+
public function backup_settings() {
|
478 |
+
check_ajax_referer( 'responsive-addons', '_ajax_nonce' );
|
479 |
+
|
480 |
+
if ( ! current_user_can( 'install_plugins' ) ) {
|
481 |
+
wp_send_json_error( __( 'User does not have permission!', 'responsive-addons' ) );
|
482 |
+
}
|
483 |
+
|
484 |
+
$file_name = 'responsive-ready-sites-backup-' . date( 'd-M-Y-h-i-s' ) . '.json';
|
485 |
+
$old_settings = get_option( 'responsive_theme_options', array() );
|
486 |
+
|
487 |
+
$upload_dir = Responsive_Ready_Sites_Importer_Log::get_instance()->log_dir();
|
488 |
+
$upload_path = trailingslashit( $upload_dir['path'] );
|
489 |
+
$log_file = $upload_path . $file_name;
|
490 |
+
$file_system = Responsive_Ready_Sites_Importer_Log::get_instance()->get_filesystem();
|
491 |
+
|
492 |
+
// If file Write fails.
|
493 |
+
if ( false === $file_system->put_contents( $log_file, wp_json_encode( $old_settings ), FS_CHMOD_FILE ) ) {
|
494 |
+
update_option( 'responsive_ready_sites_' . $file_name, $old_settings );
|
495 |
+
}
|
496 |
+
|
497 |
+
wp_send_json_success();
|
498 |
+
}
|
499 |
+
|
500 |
+
/**
|
501 |
+
* Get Active site data
|
502 |
+
*/
|
503 |
+
public function get_active_site_data() {
|
504 |
+
$current_active_site = get_option( 'responsive_current_active_site' );
|
505 |
+
return $current_active_site;
|
506 |
+
}
|
507 |
+
|
508 |
+
/**
|
509 |
+
* Set reset data
|
510 |
+
*/
|
511 |
+
public function set_reset_data() {
|
512 |
+
check_ajax_referer( 'responsive-addons', '_ajax_nonce' );
|
513 |
+
if ( ! current_user_can( 'install_plugins' ) ) {
|
514 |
+
return;
|
515 |
+
}
|
516 |
+
|
517 |
+
global $wpdb;
|
518 |
+
|
519 |
+
$post_ids = $wpdb->get_col( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_responsive_ready_sites_imported_post'" );
|
520 |
+
$form_ids = $wpdb->get_col( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_responsive_ready_sites_imported_wp_forms'" );
|
521 |
+
$term_ids = $wpdb->get_col( "SELECT term_id FROM {$wpdb->termmeta} WHERE meta_key='_responsive_ready_sites_imported_term'" );
|
522 |
+
|
523 |
+
wp_send_json_success(
|
524 |
+
array(
|
525 |
+
'reset_posts' => $post_ids,
|
526 |
+
'reset_wp_forms' => $form_ids,
|
527 |
+
'reset_terms' => $term_ids,
|
528 |
+
)
|
529 |
+
);
|
530 |
+
}
|
531 |
+
|
532 |
+
/**
|
533 |
+
* Required Plugin
|
534 |
+
*
|
535 |
+
* @since 1.0.0
|
536 |
+
* @return void
|
537 |
+
*/
|
538 |
+
public function required_plugin() {
|
539 |
+
|
540 |
+
// Verify Nonce.
|
541 |
+
check_ajax_referer( 'responsive-addons', '_ajax_nonce' );
|
542 |
+
|
543 |
+
$response = array(
|
544 |
+
'active' => array(),
|
545 |
+
'inactive' => array(),
|
546 |
+
'notinstalled' => array(),
|
547 |
+
);
|
548 |
+
|
549 |
+
if ( ! current_user_can( 'install_plugins' ) ) {
|
550 |
+
wp_send_json_error( $response );
|
551 |
+
}
|
552 |
+
|
553 |
+
$required_plugins = ( isset( $_POST['required_plugins'] ) ) ? $_POST['required_plugins'] : array();
|
554 |
+
|
555 |
+
if ( count( $required_plugins ) > 0 ) {
|
556 |
+
foreach ( $required_plugins as $key => $plugin ) {
|
557 |
+
|
558 |
+
if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin['init'] ) && is_plugin_inactive( $plugin['init'] ) ) {
|
559 |
+
|
560 |
+
$response['inactive'][] = $plugin;
|
561 |
+
|
562 |
+
} elseif ( ! file_exists( WP_PLUGIN_DIR . '/' . $plugin['init'] ) ) {
|
563 |
+
|
564 |
+
$response['notinstalled'][] = $plugin;
|
565 |
+
|
566 |
+
} else {
|
567 |
+
$response['active'][] = $plugin;
|
568 |
+
}
|
569 |
+
}
|
570 |
+
}
|
571 |
+
|
572 |
+
// Send response.
|
573 |
+
wp_send_json_success(
|
574 |
+
array(
|
575 |
+
'required_plugins' => $response,
|
576 |
+
)
|
577 |
+
);
|
578 |
+
}
|
579 |
+
|
580 |
+
|
581 |
+
/**
|
582 |
+
* Required Plugin Activate
|
583 |
+
*
|
584 |
+
* @since 1.0.0
|
585 |
+
*/
|
586 |
+
public function required_plugin_activate() {
|
587 |
+
|
588 |
+
check_ajax_referer( 'responsive-addons', '_ajax_nonce' );
|
589 |
+
|
590 |
+
if ( ! current_user_can( 'activate_plugins' ) ) {
|
591 |
+
wp_send_json_error(
|
592 |
+
array(
|
593 |
+
'success' => false,
|
594 |
+
'message' => __( 'Error: You don\'t have the required permissions to install plugins.', 'responsive-addons' ),
|
595 |
+
)
|
596 |
+
);
|
597 |
+
}
|
598 |
+
|
599 |
+
if ( ! isset( $_POST['init'] ) || ! $_POST['init'] ) {
|
600 |
+
wp_send_json_error(
|
601 |
+
array(
|
602 |
+
'success' => false,
|
603 |
+
'message' => __( 'Plugins data is missing.', 'responsive-addons' ),
|
604 |
+
)
|
605 |
+
);
|
606 |
+
}
|
607 |
+
|
608 |
+
$data = array();
|
609 |
+
$plugin_init = ( isset( $_POST['init'] ) ) ? esc_attr( $_POST['init'] ) : '';
|
610 |
+
|
611 |
+
$activate = activate_plugin( $plugin_init, '', false, true );
|
612 |
+
|
613 |
+
if ( is_wp_error( $activate ) ) {
|
614 |
+
wp_send_json_error(
|
615 |
+
array(
|
616 |
+
'success' => false,
|
617 |
+
'message' => $activate->get_error_message(),
|
618 |
+
)
|
619 |
+
);
|
620 |
+
}
|
621 |
+
|
622 |
+
wp_send_json_success(
|
623 |
+
array(
|
624 |
+
'success' => true,
|
625 |
+
'message' => __( 'Plugin Activated', 'responsive-addons' ),
|
626 |
+
)
|
627 |
+
);
|
628 |
+
|
629 |
+
}
|
630 |
+
|
631 |
+
/**
|
632 |
+
* Check if Responsive Addons Pro is installed.
|
633 |
+
*/
|
634 |
+
public function is_responsive_pro_is_installed() {
|
635 |
+
$responsive_pro_slug = 'responsive-addons-pro/responsive-addons-pro.php';
|
636 |
+
if ( ! function_exists( 'get_plugins' ) ) {
|
637 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
638 |
+
}
|
639 |
+
$all_plugins = get_plugins();
|
640 |
+
|
641 |
+
if ( ! empty( $all_plugins[ $responsive_pro_slug ] ) ) {
|
642 |
+
wp_send_json_success();
|
643 |
+
} else {
|
644 |
+
wp_send_json_error();
|
645 |
+
}
|
646 |
+
}
|
647 |
+
|
648 |
+
/**
|
649 |
+
* Check if Responsive Addons Pro License is Active.
|
650 |
+
*/
|
651 |
+
public function is_responsive_pro_license_is_active() {
|
652 |
+
global $wcam_lib;
|
653 |
+
if ( is_null( $wcam_lib ) ) {
|
654 |
+
wp_send_json_error();
|
655 |
+
}
|
656 |
+
$license_status = $wcam_lib->license_key_status();
|
657 |
+
|
658 |
+
if ( ! empty( $license_status['data']['activated'] ) && $license_status['data']['activated'] ) {
|
659 |
+
wp_send_json_success();
|
660 |
+
} else {
|
661 |
+
wp_send_json_error();
|
662 |
+
}
|
663 |
+
}
|
664 |
+
|
665 |
+
/**
|
666 |
+
* Check if Responsive Addons Pro License is Active.
|
667 |
+
*/
|
668 |
+
public function responsive_pro_license_is_active() {
|
669 |
+
global $wcam_lib;
|
670 |
+
if ( is_null( $wcam_lib ) ) {
|
671 |
+
return false;
|
672 |
+
}
|
673 |
+
$license_status = $wcam_lib->license_key_status();
|
674 |
+
|
675 |
+
if ( ! empty( $license_status['data']['activated'] ) && $license_status['data']['activated'] ) {
|
676 |
+
return true;
|
677 |
+
} else {
|
678 |
+
return false;
|
679 |
+
}
|
680 |
+
}
|
681 |
+
|
682 |
+
/**
|
683 |
+
* Adding the theme menu page
|
684 |
+
*/
|
685 |
+
public function responsive_addons_admin_page() {
|
686 |
+
|
687 |
+
if ( $this->is_responsive() ) {
|
688 |
+
$menu_title = 'Ready Sites';
|
689 |
+
} else {
|
690 |
+
$menu_title = 'Responsive Ready Sites';
|
691 |
+
}
|
692 |
+
|
693 |
+
add_theme_page(
|
694 |
+
'Responsive Ready Sites Importer',
|
695 |
+
$menu_title,
|
696 |
+
'administrator',
|
697 |
+
'responsive-add-ons',
|
698 |
+
array( $this, 'responsive_add_ons' )
|
699 |
+
);
|
700 |
+
}
|
701 |
+
|
702 |
+
/**
|
703 |
+
* Responsive Addons Admin Page
|
704 |
+
*/
|
705 |
+
public function responsive_add_ons() {
|
706 |
+
|
707 |
+
if ( $this->is_responsive_addons_pro_is_active() && ! $this->responsive_pro_license_is_active() ) {
|
708 |
+
wp_redirect( admin_url( '/options-general.php?page=wc_am_client_responsive_addons_pro_dashboard' ) );
|
709 |
+
exit();
|
710 |
+
}
|
711 |
+
|
712 |
+
$responsive_addon_dir = plugin_dir_path( __FILE__ );
|
713 |
+
$responsive_addons_go_pro_screen = ( isset( $_GET['action'] ) && 'go_pro' === $_GET['action'] ) ? true : false; //phpcs:ignore
|
714 |
+
|
715 |
+
$responsive_addon_license_screen = ( isset( $_GET['action'] ) && 'license' === $_GET['action'] ) ? true : false; //phpcs:ignore
|
716 |
+
$responsive_addon_pro_support_screen = ( isset( $_GET['action'] ) && 'pro_support' === $_GET['action'] ) ? true : false; //phpcs:ignore?>
|
717 |
+
<div class="wrap">
|
718 |
+
<h1><?php esc_html_e( 'Responsive Ready Sites Importer' ); ?></h1>
|
719 |
+
<h2 class="nav-tab-wrapper">
|
720 |
+
<a href="<?php echo esc_url( admin_url( 'admin.php?page=responsive-add-ons' ) ); ?>" class="nav-tab
|
721 |
+
<?php
|
722 |
+
if ( ! isset( $_GET['action'] ) || isset( $_GET['action'] ) && 'go_pro' != $_GET['action'] && 'license' != $_GET['action'] && 'pro_support' != $_GET['action'] ) {
|
723 |
+
echo ' nav-tab-active';}
|
724 |
+
?>
|
725 |
+
"><?php esc_html_e( 'Ready Sites Importer' ); ?></a>
|
726 |
+
<?php
|
727 |
+
if ( ! $this->is_responsive_addons_pro_is_active() ) {
|
728 |
+
?>
|
729 |
+
|
730 |
+
<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'go_pro' ), admin_url( 'themes.php?page=responsive-add-ons' ) ) ); ?>" class="nav-tab
|
731 |
+
<?php
|
732 |
+
if ( $responsive_addons_go_pro_screen ) {
|
733 |
+
echo ' nav-tab-active';}
|
734 |
+
?>
|
735 |
+
"><?php esc_html_e( 'Go Pro' ); ?></a>
|
736 |
+
|
737 |
+
<?php } ?>
|
738 |
+
<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'pro_support' ), admin_url( 'themes.php?page=responsive-add-ons' ) ) ); ?>" class="nav-tab
|
739 |
+
<?php
|
740 |
+
if ( $responsive_addon_pro_support_screen ) {
|
741 |
+
echo ' nav-tab-active';}
|
742 |
+
?>
|
743 |
+
"><?php esc_html_e( 'Support' ); ?></a>
|
744 |
+
</h2>
|
745 |
+
<?php
|
746 |
+
if ( $responsive_addons_go_pro_screen ) {
|
747 |
+
|
748 |
+
require_once $responsive_addon_dir . 'admin/templates/responsive-addons-go-pro.php';
|
749 |
+
|
750 |
+
} elseif ( $responsive_addon_license_screen ) {
|
751 |
+
|
752 |
+
do_action( 'responsive_addons_pro_license_page' );
|
753 |
+
} elseif ( $responsive_addon_pro_support_screen ) {
|
754 |
+
|
755 |
+
require_once $responsive_addon_dir . 'admin/templates/responsive-addons-support.php';
|
756 |
+
} else {
|
757 |
+
|
758 |
+
do_action( 'responsive_addons_importer_page' );
|
759 |
+
}
|
760 |
+
?>
|
761 |
+
</div>
|
762 |
+
|
763 |
+
<?php
|
764 |
+
}
|
765 |
+
|
766 |
+
/**
|
767 |
+
* Check if Responsive Addons Pro is installed.
|
768 |
+
*/
|
769 |
+
public function is_responsive_addons_pro_is_active() {
|
770 |
+
$responsive_pro_slug = 'responsive-addons-pro/responsive-addons-pro.php';
|
771 |
+
if ( ! function_exists( 'get_plugins' ) ) {
|
772 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
773 |
+
}
|
774 |
+
|
775 |
+
if ( is_plugin_active( $responsive_pro_slug ) ) {
|
776 |
+
return true;
|
777 |
+
} else {
|
778 |
+
return false;
|
779 |
+
}
|
780 |
+
}
|
781 |
+
|
782 |
+
/**
|
783 |
+
* Add rating links to the Responsive Addons Admin Page
|
784 |
+
*
|
785 |
+
* @param string $footer_text The existing footer text.
|
786 |
+
*
|
787 |
+
* @return string
|
788 |
+
* @since 2.0.6
|
789 |
+
* @global string $typenow
|
790 |
+
*/
|
791 |
+
public function responsive_addons_admin_rate_us( $footer_text ) {
|
792 |
+
$page = isset( $_GET['page'] ) ? $_GET['page'] : '';
|
793 |
+
$show_footer = array( 'responsive-add-ons' );
|
794 |
+
|
795 |
+
if ( in_array( $page, $show_footer ) ) {
|
796 |
+
$rate_text = sprintf(
|
797 |
+
/* translators: %s: Link to 5 star rating */
|
798 |
+
__( 'If you like the <strong>Responsive Ready Sites Importer</strong> plugin please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'responsive-add-ons' ),
|
799 |
+
'<a href="https://wordpress.org/support/view/plugin-reviews/responsive-add-ons?filter=5#postform" target="_blank" class="responsive-rating-link" style="text-decoration:none;" data-rated="' . esc_attr__( 'Thanks :)', 'responsive-add-ons' ) . '">★★★★★</a>'
|
800 |
+
);
|
801 |
+
|
802 |
+
return $rate_text;
|
803 |
+
} else {
|
804 |
+
return $footer_text;
|
805 |
+
}
|
806 |
+
}
|
807 |
+
|
808 |
+
/**
|
809 |
+
* Output buffer
|
810 |
+
*/
|
811 |
+
public function app_output_buffer() {
|
812 |
+
ob_start();
|
813 |
+
}
|
814 |
+
|
815 |
+
/**
|
816 |
+
* Check if Responsive theme or Child theme of Responsive is Active
|
817 |
+
*
|
818 |
+
* @since 2.1.1
|
819 |
+
*/
|
820 |
+
public function check_responsive_theme_active() {
|
821 |
+
|
822 |
+
check_ajax_referer( 'responsive-addons', '_ajax_nonce' );
|
823 |
+
|
824 |
+
if ( ! current_user_can( 'switch_themes' ) ) {
|
825 |
+
wp_send_json_error( __( 'User does not have permission!', 'responsive-addons' ) );
|
826 |
+
}
|
827 |
+
|
828 |
+
$current_theme = wp_get_theme();
|
829 |
+
if ( ( 'Responsive' === $current_theme->get( 'Name' ) ) || ( is_child_theme() && 'Responsive' === $current_theme->parent()->get( 'Name' ) ) ) {
|
830 |
+
wp_send_json_success(
|
831 |
+
array( 'success' => true )
|
832 |
+
);
|
833 |
+
} else {
|
834 |
+
wp_send_json_error(
|
835 |
+
array( 'success' => false )
|
836 |
+
);
|
837 |
+
}
|
838 |
+
}
|
839 |
+
}
|
includes/importers/batch-processing/class-responsive-ready-sites-batch-processing-menu.php
CHANGED
@@ -8,70 +8,68 @@
|
|
8 |
|
9 |
if ( ! class_exists( 'Responsive_Ready_Sites_Batch_Processing_Menu' ) ) :
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
|
56 |
-
|
57 |
-
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
}
|
71 |
-
}
|
72 |
|
73 |
-
|
74 |
|
75 |
-
|
76 |
|
77 |
-
endif;
|
8 |
|
9 |
if ( ! class_exists( 'Responsive_Ready_Sites_Batch_Processing_Menu' ) ) :
|
10 |
|
11 |
+
/**
|
12 |
+
* Responsive_Ready_Sites_Batch_Processing_Menu
|
13 |
+
*
|
14 |
+
* @since 2.0.3
|
15 |
+
*/
|
16 |
+
class Responsive_Ready_Sites_Batch_Processing_Menu {
|
17 |
|
18 |
+
/**
|
19 |
+
* Instance
|
20 |
+
*
|
21 |
+
* @since 2.0.3
|
22 |
+
* @access private
|
23 |
+
* @var object Class object.
|
24 |
+
*/
|
25 |
+
private static $instance;
|
26 |
|
27 |
+
/**
|
28 |
+
* Initiator
|
29 |
+
*
|
30 |
+
* @since 2.0.3
|
31 |
+
* @return object initialized object of class.
|
32 |
+
*/
|
33 |
+
public static function get_instance() {
|
34 |
|
35 |
+
if ( ! isset( self::$instance ) ) {
|
36 |
+
self::$instance = new self();
|
37 |
+
}
|
38 |
+
return self::$instance;
|
39 |
+
}
|
40 |
|
41 |
+
/**
|
42 |
+
* Constructor
|
43 |
+
*
|
44 |
+
* @since 2.0.3
|
45 |
+
*/
|
46 |
+
public function __construct() {}
|
47 |
|
48 |
+
/**
|
49 |
+
* Import
|
50 |
+
*
|
51 |
+
* @since 2.0.3
|
52 |
+
* @return void
|
53 |
+
*/
|
54 |
+
public function import() {
|
55 |
|
56 |
+
self::fix_nav_menus();
|
57 |
+
}
|
58 |
|
59 |
+
/**
|
60 |
+
* Import Module Images.
|
61 |
+
*/
|
62 |
+
public static function fix_nav_menus() {
|
63 |
+
$term_id_menu = term_exists( 'menu1' );
|
64 |
+
if ( $term_id_menu ) {
|
65 |
+
$theme_nav_menu_locations = get_theme_mod( 'nav_menu_locations' );
|
66 |
+
$theme_nav_menu_locations['header-menu'] = $term_id_menu;
|
67 |
+
set_theme_mod( 'nav_menu_locations', $theme_nav_menu_locations );
|
68 |
+
}
|
69 |
+
}
|
|
|
|
|
70 |
|
71 |
+
}
|
72 |
|
73 |
+
Responsive_Ready_Sites_Batch_Processing_Menu::get_instance();
|
74 |
|
75 |
+
endif;
|
includes/importers/class-responsive-ready-sites-importer.php
CHANGED
@@ -160,6 +160,10 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Importer' ) ) :
|
|
160 |
|
161 |
check_ajax_referer( 'responsive-addons', '_ajax_nonce' );
|
162 |
|
|
|
|
|
|
|
|
|
163 |
$demo_api_uri = isset( $_POST['api_url'] ) ? esc_url( $_POST['api_url'] ) : ''; //phpcs:ignore
|
164 |
|
165 |
if ( ! empty( $demo_api_uri ) ) {
|
160 |
|
161 |
check_ajax_referer( 'responsive-addons', '_ajax_nonce' );
|
162 |
|
163 |
+
if ( ! current_user_can( 'install_plugins' ) ) {
|
164 |
+
wp_send_json_error( __( 'User does not have permission!', 'responsive-addons' ) );
|
165 |
+
}
|
166 |
+
|
167 |
$demo_api_uri = isset( $_POST['api_url'] ) ? esc_url( $_POST['api_url'] ) : ''; //phpcs:ignore
|
168 |
|
169 |
if ( ! empty( $demo_api_uri ) ) {
|
includes/importers/class-responsive-ready-sites-options-importer.php
CHANGED
@@ -93,7 +93,7 @@ class Responsive_Ready_Sites_Options_Importer {
|
|
93 |
// Categories.
|
94 |
'woocommerce_product_cat',
|
95 |
|
96 |
-
// Plugin: EventOn
|
97 |
'evcal_options_evcal_1',
|
98 |
);
|
99 |
}
|
@@ -319,7 +319,7 @@ class Responsive_Ready_Sites_Options_Importer {
|
|
319 |
|
320 |
if ( ! empty( $cat['slug'] ) && ! empty( $cat['thumbnail_src'] ) ) {
|
321 |
|
322 |
-
$image = (object) self::
|
323 |
|
324 |
if ( ! is_wp_error( $image ) ) {
|
325 |
|
93 |
// Categories.
|
94 |
'woocommerce_product_cat',
|
95 |
|
96 |
+
// Plugin: EventOn.
|
97 |
'evcal_options_evcal_1',
|
98 |
);
|
99 |
}
|
319 |
|
320 |
if ( ! empty( $cat['slug'] ) && ! empty( $cat['thumbnail_src'] ) ) {
|
321 |
|
322 |
+
$image = (object) self::sideload_image( $cat['thumbnail_src'] );
|
323 |
|
324 |
if ( ! is_wp_error( $image ) ) {
|
325 |
|
includes/importers/wxr-importer/class-responsive-ready-sites-wxr-importer.php
CHANGED
@@ -127,6 +127,11 @@ if ( ! class_exists( 'Responsive_Ready_Sites_WXR_Importer' ) ) :
|
|
127 |
*/
|
128 |
public function stream_import() {
|
129 |
|
|
|
|
|
|
|
|
|
|
|
130 |
// Start the event stream.
|
131 |
header( 'Content-Type: text/event-stream, charset=UTF-8' );
|
132 |
|
@@ -227,9 +232,10 @@ if ( ! class_exists( 'Responsive_Ready_Sites_WXR_Importer' ) ) :
|
|
227 |
public function get_xml_data( $path ) {
|
228 |
|
229 |
$args = array(
|
230 |
-
'action'
|
231 |
-
'id'
|
232 |
-
'xml_path'
|
|
|
233 |
);
|
234 |
$url = add_query_arg( urlencode_deep( $args ), admin_url( 'admin-ajax.php' ) );
|
235 |
|
127 |
*/
|
128 |
public function stream_import() {
|
129 |
|
130 |
+
check_ajax_referer( 'responsive-addons', '_ajax_nonce' );
|
131 |
+
|
132 |
+
if ( ! current_user_can( 'install_plugins' ) ) {
|
133 |
+
wp_send_json_error( __( 'User does not have permission!', 'responsive-addons' ) );
|
134 |
+
}
|
135 |
// Start the event stream.
|
136 |
header( 'Content-Type: text/event-stream, charset=UTF-8' );
|
137 |
|
232 |
public function get_xml_data( $path ) {
|
233 |
|
234 |
$args = array(
|
235 |
+
'action' => 'responsive-wxr-import',
|
236 |
+
'id' => '1',
|
237 |
+
'xml_path' => $path,
|
238 |
+
'_ajax_nonce' => wp_create_nonce( 'responsive-addons' ),
|
239 |
);
|
240 |
$url = add_query_arg( urlencode_deep( $args ), admin_url( 'admin-ajax.php' ) );
|
241 |
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: one click demo import, gutenberg, elementor, templates
|
|
5 |
Requires at least: 5.0
|
6 |
Tested up to: 5.3
|
7 |
Requires PHP: 5.3
|
8 |
-
Stable tag: 2.2.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -106,6 +106,9 @@ Absolutely not! Once you install the plugin, it will take care of all other depe
|
|
106 |
4. Your website is ready
|
107 |
|
108 |
== Changelog ==
|
|
|
|
|
|
|
109 |
= 2.2.5 - 4th March 2020 =
|
110 |
* Added - Secured Ajax requests
|
111 |
|
5 |
Requires at least: 5.0
|
6 |
Tested up to: 5.3
|
7 |
Requires PHP: 5.3
|
8 |
+
Stable tag: 2.2.6
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
106 |
4. Your website is ready
|
107 |
|
108 |
== Changelog ==
|
109 |
+
= 2.2.6 - 6th March 2020 =
|
110 |
+
* Added - Secured Ajax requests and restructured code
|
111 |
+
|
112 |
= 2.2.5 - 4th March 2020 =
|
113 |
* Added - Secured Ajax requests
|
114 |
|
responsive-add-ons.php
CHANGED
@@ -3,9 +3,11 @@
|
|
3 |
* Plugin Name: Responsive Ready Sites Importer
|
4 |
* Plugin URI: http://wordpress.org/plugins/responsive-add-ons/
|
5 |
* Description: Import Responsive Ready Sites that help you launch your website quickly. Just import, update & hit the launch button.
|
6 |
-
* Version: 2.2.
|
7 |
* Author: CyberChimps
|
8 |
-
*
|
|
|
|
|
9 |
*/
|
10 |
|
11 |
/*
|
@@ -25,13 +27,17 @@ along with this program; if not, write to the Free Software
|
|
25 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
|
28 |
-
// Set Constants
|
29 |
if ( ! defined( 'RESPONSIVE_ADDONS_FILE' ) ) {
|
30 |
define( 'RESPONSIVE_ADDONS_FILE', __FILE__ );
|
31 |
}
|
32 |
|
33 |
if ( ! defined( 'RESPONSIVE_ADDONS_DIR' ) ) {
|
34 |
-
define( 'RESPONSIVE_ADDONS_DIR',
|
|
|
|
|
|
|
|
|
35 |
}
|
36 |
|
37 |
if ( ! defined( 'RESPONSIVE_ADDONS_URI' ) ) {
|
@@ -39,11 +45,13 @@ if ( ! defined( 'RESPONSIVE_ADDONS_URI' ) ) {
|
|
39 |
}
|
40 |
|
41 |
if ( ! defined( 'RESPONSIVE_ADDONS_VER' ) ) {
|
42 |
-
define( 'RESPONSIVE_ADDONS_VER', '2.2.
|
43 |
}
|
44 |
|
45 |
if ( ! function_exists( 'ra_fs' ) ) {
|
46 |
-
|
|
|
|
|
47 |
function ra_fs() {
|
48 |
global $rao_fs;
|
49 |
|
@@ -57,9 +65,9 @@ if ( ! function_exists( 'ra_fs' ) ) {
|
|
57 |
'slug' => 'responsive-add-ons',
|
58 |
'product_name' => 'Responsive Ready Sites Importer',
|
59 |
'module_type' => 'plugin',
|
60 |
-
'version' => '2.2.
|
61 |
'plugin_basename' => 'responsive-add-ons/responsive-add-ons.php',
|
62 |
-
'plugin_url' =>
|
63 |
)
|
64 |
);
|
65 |
}
|
@@ -73,1004 +81,38 @@ if ( ! function_exists( 'ra_fs' ) ) {
|
|
73 |
do_action( 'ra_fs_loaded' );
|
74 |
}
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
public $plugin_options;
|
83 |
-
|
84 |
-
public static $api_url;
|
85 |
-
|
86 |
-
public function __construct() {
|
87 |
-
|
88 |
-
add_action( 'admin_init', array( &$this, 'admin_init' ) );
|
89 |
-
add_action( 'admin_notices', array( &$this, 'add_theme_installation_notice' ), 1 );
|
90 |
-
add_action( 'after_setup_theme', array( &$this, 'after_setup_theme' ) );
|
91 |
-
add_action( 'wp_head', array( &$this, 'responsive_head' ) );
|
92 |
-
add_action( 'plugins_loaded', array( &$this, 'responsive_addons_translations' ) );
|
93 |
-
$plugin = plugin_basename( __FILE__ );
|
94 |
-
add_filter( "plugin_action_links_$plugin", array( &$this, 'plugin_settings_link' ) );
|
95 |
-
|
96 |
-
// Responsive Ready Site Importer Menu
|
97 |
-
add_action( 'admin_enqueue_scripts', array( &$this, 'responsive_ready_sites_admin_enqueue_scripts' ) );
|
98 |
-
|
99 |
-
add_action( 'admin_enqueue_scripts', array( &$this, 'responsive_ready_sites_admin_enqueue_styles' ) );
|
100 |
-
|
101 |
-
if ( is_admin() ) {
|
102 |
-
add_action( 'wp_ajax_responsive-ready-sites-activate-theme', array( $this, 'activate_theme' ) );
|
103 |
-
add_action( 'wp_ajax_responsive-ready-sites-required-plugins', array( &$this, 'required_plugin' ) );
|
104 |
-
add_action( 'wp_ajax_responsive-ready-sites-required-plugin-activate', array( &$this, 'required_plugin_activate' ) );
|
105 |
-
add_action( 'wp_ajax_responsive-ready-sites-set-reset-data', array( &$this, 'set_reset_data' ) );
|
106 |
-
add_action( 'wp_ajax_responsive-ready-sites-backup-settings', array( &$this, 'backup_settings' ) );
|
107 |
-
add_action( 'wp_ajax_responsive-is-theme-active', array( &$this, 'check_responsive_theme_active' ) );
|
108 |
-
// Dismiss admin notice
|
109 |
-
add_action( 'wp_ajax_responsive-notice-dismiss', array( &$this, 'dismiss_notice' ) );
|
110 |
-
// Check if Responsive Addons pro plugin is active
|
111 |
-
add_action( 'wp_ajax_check-responsive-add-ons-pro-installed', array( $this, 'is_responsive_pro_is_installed' ) );
|
112 |
-
|
113 |
-
// Check if Responsive Addons pro license is active
|
114 |
-
add_action( 'wp_ajax_check-responsive-add-ons-pro-license-active', array( $this, 'is_responsive_pro_license_is_active' ) );
|
115 |
-
}
|
116 |
-
|
117 |
-
// Responsive Addons Page
|
118 |
-
add_action( 'admin_menu', array( $this, 'responsive_addons_admin_page' ), 100 );
|
119 |
-
|
120 |
-
$this->options = get_option( 'responsive_theme_options' );
|
121 |
-
$this->plugin_options = get_option( 'responsive_addons_options' );
|
122 |
-
|
123 |
-
$this->load_responsive_sites_importer();
|
124 |
-
|
125 |
-
add_action( 'responsive_addons_importer_page', array( $this, 'menu_callback' ) );
|
126 |
-
|
127 |
-
// Add rating links to the Responsive Addons Admin Page
|
128 |
-
add_filter( 'admin_footer_text', array( $this, 'responsive_addons_admin_rate_us' ) );
|
129 |
-
|
130 |
-
add_action( 'init', array( $this, 'app_output_buffer' ) );
|
131 |
-
self::set_api_url();
|
132 |
-
|
133 |
-
}
|
134 |
-
|
135 |
-
/**
|
136 |
-
* Add Admin Notice.
|
137 |
-
*/
|
138 |
-
function add_theme_installation_notice() {
|
139 |
-
|
140 |
-
$theme = wp_get_theme();
|
141 |
-
|
142 |
-
if ( 'Responsive' === $theme->name || 'Responsive' === $theme->parent_theme || $this->is_activation_theme_notice_expired() || is_plugin_active( 'responsive-addons-pro/responsive-addons-pro.php' ) ) {
|
143 |
-
return;
|
144 |
-
}
|
145 |
-
|
146 |
-
$class = 'responsive-notice notice notice-error';
|
147 |
-
|
148 |
-
$theme_status = 'responsive-sites-theme-' . $this->get_theme_status();
|
149 |
-
|
150 |
-
$image_path = RESPONSIVE_ADDONS_URI . 'admin/images/responsive-thumbnail.jpg';
|
151 |
-
?>
|
152 |
-
<div id="responsive-theme-activation" class="<?php echo $class; ?>">
|
153 |
-
<div class="responsive-addons-message-inner">
|
154 |
-
<div class="responsive-addons-message-icon">
|
155 |
-
<div class="">
|
156 |
-
<img src="<?php echo $image_path; ?>" alt="Responsive Ready Sites Importer">
|
157 |
-
</div>
|
158 |
-
</div>
|
159 |
-
<div class="responsive-addons-message-content">
|
160 |
-
<p><?php echo esc_html( 'Responsive theme needs to be active to use the Responsive Ready Sites Importer plugin.' ); ?> </p>
|
161 |
-
<p class="responsive-addons-message-actions">
|
162 |
-
<a href="#" class="<?php echo $theme_status; ?> button button-primary" data-theme-slug="responsive">Install & Activate Now</a>
|
163 |
-
</p>
|
164 |
-
</div>
|
165 |
-
</div>
|
166 |
-
</div>
|
167 |
-
<?php
|
168 |
-
}
|
169 |
-
|
170 |
-
/**
|
171 |
-
* Is notice expired?
|
172 |
-
*
|
173 |
-
* @since 2.0.3
|
174 |
-
*
|
175 |
-
* @return boolean
|
176 |
-
*/
|
177 |
-
public static function is_activation_theme_notice_expired() {
|
178 |
-
|
179 |
-
// Check the user meta status if current notice is dismissed.
|
180 |
-
$meta_status = get_user_meta( get_current_user_id(), 'responsive-theme-activation', true );
|
181 |
-
|
182 |
-
if ( empty( $meta_status ) ) {
|
183 |
-
return false;
|
184 |
-
}
|
185 |
-
|
186 |
-
return true;
|
187 |
-
}
|
188 |
-
|
189 |
-
/**
|
190 |
-
* Dismiss Notice.
|
191 |
-
*
|
192 |
-
* @since 2.0.3
|
193 |
-
* @return void
|
194 |
-
*/
|
195 |
-
public function dismiss_notice() {
|
196 |
-
$notice_id = ( isset( $_POST['notice_id'] ) ) ? sanitize_key( $_POST['notice_id'] ) : '';
|
197 |
-
|
198 |
-
// check for Valid input
|
199 |
-
if ( ! empty( $notice_id ) ) {
|
200 |
-
update_user_meta( get_current_user_id(), $notice_id, 'notice-dismissed' );
|
201 |
-
wp_send_json_success();
|
202 |
-
}
|
203 |
-
|
204 |
-
wp_send_json_error();
|
205 |
-
}
|
206 |
-
|
207 |
-
|
208 |
-
/**
|
209 |
-
* Activate theme
|
210 |
-
*
|
211 |
-
* @since 2.0.3
|
212 |
-
* @return void
|
213 |
-
*/
|
214 |
-
function activate_theme() {
|
215 |
-
|
216 |
-
check_ajax_referer( 'responsive-addons', '_ajax_nonce' );
|
217 |
-
|
218 |
-
if ( ! current_user_can( 'switch_themes' ) ) {
|
219 |
-
wp_send_json_error( __( 'You are not allowed to activate the Theme', 'responsive-addons' ) );
|
220 |
-
}
|
221 |
-
|
222 |
-
switch_theme( 'responsive' );
|
223 |
-
|
224 |
-
wp_send_json_success(
|
225 |
-
array(
|
226 |
-
'success' => true,
|
227 |
-
'message' => __( 'Theme Activated', 'responsive-addons' ),
|
228 |
-
)
|
229 |
-
);
|
230 |
-
}
|
231 |
-
|
232 |
-
/**
|
233 |
-
* Get theme install, active or inactive status.
|
234 |
-
*
|
235 |
-
* @since 1.3.2
|
236 |
-
*
|
237 |
-
* @return string Theme status
|
238 |
-
*/
|
239 |
-
function get_theme_status() {
|
240 |
-
|
241 |
-
$theme = wp_get_theme();
|
242 |
-
|
243 |
-
// Theme installed and activate.
|
244 |
-
if ( 'Responsive' === $theme->name || 'Responsive' === $theme->parent_theme ) {
|
245 |
-
return 'installed-and-active';
|
246 |
-
}
|
247 |
-
|
248 |
-
// Theme installed but not activate.
|
249 |
-
foreach ( (array) wp_get_themes() as $theme_dir => $theme ) {
|
250 |
-
if ( 'Responsive' === $theme->name || 'Responsive' === $theme->parent_theme ) {
|
251 |
-
return 'installed-but-inactive';
|
252 |
-
}
|
253 |
-
}
|
254 |
-
|
255 |
-
return 'not-installed';
|
256 |
-
}
|
257 |
-
|
258 |
-
/**
|
259 |
-
* Stuff to do when you activate
|
260 |
-
*/
|
261 |
-
public static function activate() {
|
262 |
-
}
|
263 |
-
|
264 |
-
/**
|
265 |
-
* Clean up after Deactivation
|
266 |
-
*/
|
267 |
-
public static function deactivate() {
|
268 |
-
}
|
269 |
-
|
270 |
-
/**
|
271 |
-
* Setter for $api_url
|
272 |
-
*
|
273 |
-
* @since 1.0.0
|
274 |
-
*/
|
275 |
-
public static function set_api_url() {
|
276 |
-
self::$api_url = apply_filters( 'responsive_ready_sites_api_url', 'https://ccreadysites.cyberchimps.com/wp-json/wp/v2/' );
|
277 |
-
}
|
278 |
-
|
279 |
-
/**
|
280 |
-
* Hook into WP admin_init
|
281 |
-
* Responsive 1.x settings
|
282 |
-
*/
|
283 |
-
public function admin_init( $options ) {
|
284 |
-
|
285 |
-
// Check if the theme being used is Responsive. If True then add settings to Responsive settings, else set up a settings page
|
286 |
-
if ( $this->is_responsive() ) {
|
287 |
-
add_filter( 'responsive_option_sections_filter', array( &$this, 'responsive_option_sections' ), 10, 1 );
|
288 |
-
add_filter( 'responsive_options_filter', array( &$this, 'responsive_options' ), 10, 1 );
|
289 |
-
|
290 |
-
/*
|
291 |
-
$stop_responsive2 = isset( $this->options['stop_responsive2'] ) ? $this->options['stop_responsive2'] : '';
|
292 |
-
|
293 |
-
// Check if stop_responsive2 toggle is on, if on then include update class from wp-updates.com
|
294 |
-
if( 1 == $stop_responsive2 ) {
|
295 |
-
// Notify user of theme update on "Updates" page in Dashboard.
|
296 |
-
require_once( plugin_dir_path( __FILE__ ) . '/responsive-theme/wp-updates-theme.php' );
|
297 |
-
new WPUpdatesThemeUpdater_797( 'http://wp-updates.com/api/2/theme', 'responsive' );
|
298 |
-
}*/
|
299 |
-
|
300 |
-
} else {
|
301 |
-
$this->init_settings();
|
302 |
-
}
|
303 |
-
}
|
304 |
-
|
305 |
-
/**
|
306 |
-
* Hook into WP after_setup_theme
|
307 |
-
* Responsive 2.x settings
|
308 |
-
*/
|
309 |
-
public function after_setup_theme() {
|
310 |
-
|
311 |
-
// Check if the theme being used is Responsive. If True then add settings to Responsive settings, else set up a settings page
|
312 |
-
if ( $this->is_responsive() ) {
|
313 |
-
|
314 |
-
add_filter( 'responsive_option_options_filter', array( $this, 'responsive_theme_options_set' ) );
|
315 |
-
|
316 |
-
}
|
317 |
-
}
|
318 |
-
|
319 |
-
/**
|
320 |
-
* Create plugin translations
|
321 |
-
*/
|
322 |
-
public function responsive_addons_translations() {
|
323 |
-
// Load the text domain for translations
|
324 |
-
load_plugin_textdomain( 'responsive-addons', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
325 |
-
}
|
326 |
-
|
327 |
-
/**
|
328 |
-
* Settings
|
329 |
-
*/
|
330 |
-
public function init_settings() {
|
331 |
-
register_setting(
|
332 |
-
'responsive_addons',
|
333 |
-
'responsive_addons_options',
|
334 |
-
array( &$this, 'responsive_addons_sanitize' )
|
335 |
-
);
|
336 |
-
|
337 |
-
}
|
338 |
-
|
339 |
-
function responsive_blocks_getting_started_page() {
|
340 |
-
$pages_dir = trailingslashit( dirname( __FILE__ ) ) . 'templates/';
|
341 |
-
|
342 |
-
include $pages_dir . 'getting-started.php';
|
343 |
-
}
|
344 |
-
|
345 |
-
/**
|
346 |
-
* The settings page
|
347 |
-
*/
|
348 |
-
public function plugin_settings_page() {
|
349 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
350 |
-
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
|
351 |
-
}
|
352 |
-
// Render the settings template
|
353 |
-
include sprintf( '%s/templates/settings.php', dirname( __FILE__ ) );
|
354 |
-
}
|
355 |
-
|
356 |
-
/**
|
357 |
-
* Test to see if the current theme is Responsive
|
358 |
-
*
|
359 |
-
* @return bool
|
360 |
-
*/
|
361 |
-
public static function is_responsive() {
|
362 |
-
$theme = wp_get_theme();
|
363 |
-
|
364 |
-
if ( $theme->Name == 'Responsive' || $theme->Template == 'responsive' || $theme->Name == 'Responsive Pro' || $theme->Template == 'responsivepro' ) {
|
365 |
-
return true;
|
366 |
-
} else {
|
367 |
-
return false;
|
368 |
-
}
|
369 |
-
}
|
370 |
-
|
371 |
-
public function responsive_option_sections( $sections ) {
|
372 |
-
|
373 |
-
$new_sections = array(
|
374 |
-
array(
|
375 |
-
'title' => __( 'Webmaster Tools', 'responsive-addons' ),
|
376 |
-
'id' => 'webmaster',
|
377 |
-
),
|
378 |
-
);
|
379 |
-
|
380 |
-
$new = array_merge( $sections, $new_sections );
|
381 |
-
|
382 |
-
return $new;
|
383 |
-
}
|
384 |
-
|
385 |
-
/*
|
386 |
-
* Responsive 1.x Settings
|
387 |
-
*/
|
388 |
-
public function responsive_options( $options ) {
|
389 |
-
|
390 |
-
$new_options = array(
|
391 |
-
'webmaster' => array(
|
392 |
-
array(
|
393 |
-
'title' => __( 'Google Site Verification', 'responsive-addons' ),
|
394 |
-
'subtitle' => '',
|
395 |
-
'heading' => '',
|
396 |
-
'type' => 'text',
|
397 |
-
'id' => 'google_site_verification',
|
398 |
-
'description' => __( 'Enter your Google ID number only', 'responsive-addons' ),
|
399 |
-
'placeholder' => '',
|
400 |
-
),
|
401 |
-
array(
|
402 |
-
'title' => __( 'Bing Site Verification', 'responsive-addons' ),
|
403 |
-
'subtitle' => '',
|
404 |
-
'heading' => '',
|
405 |
-
'type' => 'text',
|
406 |
-
'id' => 'bing_site_verification',
|
407 |
-
'description' => __( 'Enter your Bing ID number only', 'responsive-addons' ),
|
408 |
-
'placeholder' => '',
|
409 |
-
),
|
410 |
-
array(
|
411 |
-
'title' => __( 'Yahoo Site Verification', 'responsive-addons' ),
|
412 |
-
'subtitle' => '',
|
413 |
-
'heading' => '',
|
414 |
-
'type' => 'text',
|
415 |
-
'id' => 'yahoo_site_verification',
|
416 |
-
'description' => __( 'Enter your Yahoo ID number only', 'responsive-addons' ),
|
417 |
-
'placeholder' => '',
|
418 |
-
),
|
419 |
-
array(
|
420 |
-
'title' => __( 'Site Statistics Tracker', 'responsive-addons' ),
|
421 |
-
'subtitle' => '<span class="info-box information help-links">' . __( 'Leave blank if plugin handles your webmaster tools', 'responsive-addons' ) . '</span>' . '<a style="margin:5px;" class="resp-addon-forum button" href="http://cyberchimps.com/forum/free/responsive/">Forum</a>' . '<a style="margin:5px;" class="resp-addon-guide button" href="http://cyberchimps.com/guide/responsive-add-ons/">' . __( 'Guide', 'responsive-addons' ) . '</a>',
|
422 |
-
'heading' => '',
|
423 |
-
'type' => 'textarea',
|
424 |
-
'id' => 'site_statistics_tracker',
|
425 |
-
'class' => array( 'site-tracker' ),
|
426 |
-
'description' => __( 'Google Analytics, StatCounter, any other or all of them.', 'responsive-addons' ),
|
427 |
-
'placeholder' => '',
|
428 |
-
),
|
429 |
-
),
|
430 |
-
);
|
431 |
-
|
432 |
-
$new = array_merge( $options, $new_options );
|
433 |
-
|
434 |
-
// Commented for now to hide updates option
|
435 |
-
/*
|
436 |
-
Add stop_responsive2 options only to Responsive theme.
|
437 |
-
if( $this->is_responsive() ) {
|
438 |
-
$new['theme_elements'][] = array(
|
439 |
-
'title' => __( 'Disable Responsive 2 Updates', 'responsive-addons' ),
|
440 |
-
'subtitle' => '',
|
441 |
-
'heading' => '',
|
442 |
-
'type' => 'checkbox',
|
443 |
-
'id' => 'stop_responsive2',
|
444 |
-
'description' => __( 'check to disable', 'responsive' ),
|
445 |
-
);
|
446 |
-
}*/
|
447 |
-
|
448 |
-
return $new;
|
449 |
-
}
|
450 |
-
|
451 |
-
/*
|
452 |
-
* Responsive 2.x Settings
|
453 |
-
*/
|
454 |
-
public function responsive_theme_options_set( $options ) {
|
455 |
-
|
456 |
-
$new_options['webmaster'] = array(
|
457 |
-
'title' => __( 'Webmaster Tools', 'responsive-addons' ),
|
458 |
-
'fields' => array(
|
459 |
-
array(
|
460 |
-
'title' => __( 'Google Site Verification', 'responsive-addons' ),
|
461 |
-
'subtitle' => '',
|
462 |
-
'heading' => '',
|
463 |
-
'type' => 'text',
|
464 |
-
'id' => 'google_site_verification',
|
465 |
-
'description' => __( 'Enter your Google ID number only', 'responsive-addons' ),
|
466 |
-
'placeholder' => '',
|
467 |
-
'default' => '',
|
468 |
-
'validate' => 'text',
|
469 |
-
),
|
470 |
-
array(
|
471 |
-
'title' => __( 'Bing Site Verification', 'responsive-addons' ),
|
472 |
-
'subtitle' => '',
|
473 |
-
'heading' => '',
|
474 |
-
'type' => 'text',
|
475 |
-
'id' => 'bing_site_verification',
|
476 |
-
'description' => __( 'Enter your Bing ID number only', 'responsive-addons' ),
|
477 |
-
'placeholder' => '',
|
478 |
-
'default' => '',
|
479 |
-
'validate' => 'text',
|
480 |
-
),
|
481 |
-
array(
|
482 |
-
'title' => __( 'Yahoo Site Verification', 'responsive-addons' ),
|
483 |
-
'subtitle' => '',
|
484 |
-
'heading' => '',
|
485 |
-
'type' => 'text',
|
486 |
-
'id' => 'yahoo_site_verification',
|
487 |
-
'description' => __( 'Enter your Yahoo ID number only', 'responsive-addons' ),
|
488 |
-
'placeholder' => '',
|
489 |
-
'default' => '',
|
490 |
-
'validate' => 'text',
|
491 |
-
),
|
492 |
-
array(
|
493 |
-
'title' => __( 'Site Statistics Tracker', 'responsive-addons' ),
|
494 |
-
'subtitle' => '<span class="info-box information help-links">' . __( 'Leave blank if plugin handles your webmaster tools', 'responsive-addons' ) . '</span>' . '<a style="margin:5px;" class="resp-addon-forum button" href="http://cyberchimps.com/forum/free/responsive/">Forum</a>' . '<a style="margin:5px;" class="resp-addon-guide button" href="http://cyberchimps.com/guide/responsive-add-ons/">' . __( 'Guide', 'responsive-addons' ) . '</a>',
|
495 |
-
'heading' => '',
|
496 |
-
'type' => 'textarea',
|
497 |
-
'id' => 'site_statistics_tracker',
|
498 |
-
'class' => array( 'site-tracker' ),
|
499 |
-
'description' => __( 'Google Analytics, StatCounter, any other or all of them.', 'responsive-addons' ),
|
500 |
-
'placeholder' => '',
|
501 |
-
'default' => '',
|
502 |
-
'validate' => 'js',
|
503 |
-
),
|
504 |
-
|
505 |
-
),
|
506 |
-
);
|
507 |
-
|
508 |
-
$new_options = array_merge( $options, $new_options );
|
509 |
-
|
510 |
-
return $new_options;
|
511 |
-
}
|
512 |
-
|
513 |
-
/**
|
514 |
-
* Add to wp head
|
515 |
-
*/
|
516 |
-
public function responsive_head() {
|
517 |
-
|
518 |
-
// Test if using Responsive theme. If yes load from responsive options else load from plugin options
|
519 |
-
$responsive_options = ( $this->is_responsive() ) ? $this->options : $this->plugin_options;
|
520 |
-
|
521 |
-
if ( ! empty( $responsive_options['google_site_verification'] ) ) {
|
522 |
-
echo '<meta name="google-site-verification" content="' . esc_attr( $responsive_options['google_site_verification'] ) . '" />' . "\n";
|
523 |
-
}
|
524 |
-
|
525 |
-
if ( ! empty( $responsive_options['bing_site_verification'] ) ) {
|
526 |
-
echo '<meta name="msvalidate.01" content="' . esc_attr( $responsive_options['bing_site_verification'] ) . '" />' . "\n";
|
527 |
-
}
|
528 |
-
|
529 |
-
if ( ! empty( $responsive_options['yahoo_site_verification'] ) ) {
|
530 |
-
echo '<meta name="y_key" content="' . esc_attr( $responsive_options['yahoo_site_verification'] ) . '" />' . "\n";
|
531 |
-
}
|
532 |
-
|
533 |
-
if ( ! empty( $responsive_options['site_statistics_tracker'] ) ) {
|
534 |
-
echo $responsive_options['site_statistics_tracker'];
|
535 |
-
}
|
536 |
-
}
|
537 |
-
|
538 |
-
public function responsive_addons_sanitize( $input ) {
|
539 |
-
|
540 |
-
$output = array();
|
541 |
-
|
542 |
-
foreach ( $input as $key => $test ) {
|
543 |
-
switch ( $key ) {
|
544 |
-
case 'google_site_verification':
|
545 |
-
$output[ $key ] = wp_filter_post_kses( $test );
|
546 |
-
break;
|
547 |
-
case 'yahoo_site_verification':
|
548 |
-
$output[ $key ] = wp_filter_post_kses( $test );
|
549 |
-
break;
|
550 |
-
case 'bing_site_verification':
|
551 |
-
$output[ $key ] = wp_filter_post_kses( $test );
|
552 |
-
break;
|
553 |
-
case 'site_statistics_tracker':
|
554 |
-
$output[ $key ] = wp_kses_stripslashes( $test );
|
555 |
-
break;
|
556 |
-
|
557 |
-
}
|
558 |
-
}
|
559 |
-
|
560 |
-
return $output;
|
561 |
-
}
|
562 |
-
|
563 |
-
/**
|
564 |
-
* Add settings link to plugin activate page
|
565 |
-
*
|
566 |
-
* @param $links
|
567 |
-
*
|
568 |
-
* @return mixed
|
569 |
-
*/
|
570 |
-
public function plugin_settings_link( $links ) {
|
571 |
-
$settings_link = '<a href="themes.php?page=responsive-add-ons">' . __( 'Settings', 'responsive-addons' ) . '</a>';
|
572 |
-
array_unshift( $links, $settings_link );
|
573 |
-
|
574 |
-
return $links;
|
575 |
-
}
|
576 |
-
|
577 |
-
/**
|
578 |
-
* Add Responsive Ready Sites Menu
|
579 |
-
*
|
580 |
-
* @since 2.0.0
|
581 |
-
*/
|
582 |
-
public function add_responsive_ready_sites_menu() {
|
583 |
-
$page_title = apply_filters( 'responsive_ready_sites_menu_page_title', __( 'Responsive Ready Sites', 'responsive-addons' ) );
|
584 |
-
|
585 |
-
$page = add_theme_page( $page_title, $page_title, 'manage_options', 'responsive_ready_sites', array( &$this, 'menu_callback' ) );
|
586 |
-
}
|
587 |
-
|
588 |
-
/**
|
589 |
-
* Menu callback
|
590 |
-
*
|
591 |
-
* @since 2.0.0
|
592 |
-
*/
|
593 |
-
public function menu_callback() {
|
594 |
-
?>
|
595 |
-
<div class="responsive-sites-menu-page-wrapper">
|
596 |
-
<?php $responsive_blocks_admin_dir = plugin_dir_path( __FILE__ ) . 'admin/'; ?>
|
597 |
-
<?php require_once $responsive_blocks_admin_dir . 'partials/responsive-ready-sites-admin-display.php'; ?>
|
598 |
-
</div>
|
599 |
-
<?php
|
600 |
-
}
|
601 |
-
|
602 |
-
/**
|
603 |
-
* Load Responsive Ready Sites Importer
|
604 |
-
*
|
605 |
-
* @since 2.0.0
|
606 |
-
*/
|
607 |
-
public function load_responsive_sites_importer() {
|
608 |
-
$responsive_blocks_includes_dir = plugin_dir_path( __FILE__ ) . 'includes/';
|
609 |
-
require_once $responsive_blocks_includes_dir . 'importers/class-responsive-ready-sites-importer.php';
|
610 |
-
}
|
611 |
-
|
612 |
-
/**
|
613 |
-
* Include Admin JS
|
614 |
-
*
|
615 |
-
* @since 2.0.0
|
616 |
-
*/
|
617 |
-
public function responsive_ready_sites_admin_enqueue_scripts( $hook ) {
|
618 |
-
|
619 |
-
wp_enqueue_script( 'install-responsive-theme', RESPONSIVE_ADDONS_URI . 'admin/js/install-responsive-theme.js', array( 'jquery', 'updates' ), '2.0.3', true );
|
620 |
-
wp_enqueue_style( 'install-responsive-theme', RESPONSIVE_ADDONS_URI . 'admin/css/install-responsive-theme.css', null, '2.0.3', 'all' );
|
621 |
-
$data = apply_filters(
|
622 |
-
'responsive_sites_install_theme_localize_vars',
|
623 |
-
array(
|
624 |
-
'installed' => __( 'Installed! Activating..', 'responsive-addons' ),
|
625 |
-
'activating' => __( 'Activating..', 'responsive-addons' ),
|
626 |
-
'activated' => __( 'Activated! Reloading..', 'responsive-addons' ),
|
627 |
-
'installing' => __( 'Installing..', 'responsive-addons' ),
|
628 |
-
'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
|
629 |
-
)
|
630 |
-
);
|
631 |
-
wp_localize_script( 'install-responsive-theme', 'ResponsiveInstallThemeVars', $data );
|
632 |
-
|
633 |
-
if ( 'appearance_page_responsive-add-ons' === $hook && empty( $_GET['action'] ) ) {
|
634 |
-
|
635 |
-
wp_enqueue_script( 'responsive-ready-sites-fetch', RESPONSIVE_ADDONS_URI . 'admin/js/fetch.umd.js', array( 'jquery' ), '2.0.0', true );
|
636 |
-
|
637 |
-
wp_enqueue_script( 'responsive-ready-sites-api', RESPONSIVE_ADDONS_URI . 'admin/js/responsive-ready-sites-api.js', array( 'jquery', 'responsive-ready-sites-fetch' ), '2.0.0', true );
|
638 |
-
|
639 |
-
wp_enqueue_script( 'responsive-ready-sites-admin-js', RESPONSIVE_ADDONS_URI . 'admin/js/responsive-ready-sites-admin.js', array( 'jquery', 'wp-util', 'updates' ), '2.0.0', true );
|
640 |
-
|
641 |
-
wp_enqueue_script( 'render-responsive-ready-sites', RESPONSIVE_ADDONS_URI . 'admin/js/render-responsive-ready-sites.js', array( 'wp-util', 'responsive-ready-sites-api', 'jquery' ), '2.0.0', true );
|
642 |
-
|
643 |
-
$data = apply_filters(
|
644 |
-
'responsive_sites_localize_vars',
|
645 |
-
array(
|
646 |
-
'debug' => ((defined('WP_DEBUG') && WP_DEBUG) || isset($_GET['debug'])) ? true : false, //phpcs:ignore
|
647 |
-
'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
|
648 |
-
'siteURL' => site_url(),
|
649 |
-
'_ajax_nonce' => wp_create_nonce( 'responsive-addons' ),
|
650 |
-
'XMLReaderDisabled' => ! class_exists( 'XMLReader' ) ? true : false,
|
651 |
-
'required_plugins' => array(),
|
652 |
-
'ApiURL' => self::$api_url,
|
653 |
-
)
|
654 |
-
);
|
655 |
-
|
656 |
-
wp_localize_script( 'responsive-ready-sites-admin-js', 'responsiveSitesAdmin', $data );
|
657 |
-
|
658 |
-
$data = apply_filters(
|
659 |
-
'responsive_sites_localize_vars',
|
660 |
-
array(
|
661 |
-
'ApiURL' => self::$api_url,
|
662 |
-
)
|
663 |
-
);
|
664 |
-
|
665 |
-
// Use this for premium demos.
|
666 |
-
$request_params = apply_filters(
|
667 |
-
'responsive_sites_api_params',
|
668 |
-
array(
|
669 |
-
'site_url' => '',
|
670 |
-
'per_page' => 15,
|
671 |
-
)
|
672 |
-
);
|
673 |
-
|
674 |
-
wp_localize_script( 'responsive-ready-sites-api', 'responsiveSitesApi', $data );
|
675 |
-
$data = apply_filters(
|
676 |
-
'responsive_sites_render_localize_vars',
|
677 |
-
array(
|
678 |
-
'sites' => $request_params,
|
679 |
-
'settings' => array(),
|
680 |
-
'active_site_data' => $this->get_active_site_data(),
|
681 |
-
)
|
682 |
-
);
|
683 |
-
|
684 |
-
wp_localize_script( 'render-responsive-ready-sites', 'responsiveSitesRender', $data );
|
685 |
-
}
|
686 |
-
}
|
687 |
-
|
688 |
-
/**
|
689 |
-
* Include Admin css
|
690 |
-
*
|
691 |
-
* @since 2.0.0
|
692 |
-
*/
|
693 |
-
public function responsive_ready_sites_admin_enqueue_styles() {
|
694 |
-
// Responsive Ready Sites admin styles.
|
695 |
-
wp_register_style( 'responsive-ready-sites-admin', RESPONSIVE_ADDONS_URI . 'admin/css/responsive-ready-sites-admin.css', false, '1.0.0' );
|
696 |
-
wp_enqueue_style( 'responsive-ready-sites-admin' );
|
697 |
-
}
|
698 |
-
|
699 |
-
/**
|
700 |
-
* Backup existing settings.
|
701 |
-
*/
|
702 |
-
public function backup_settings() {
|
703 |
-
check_ajax_referer( 'responsive-addons', '_ajax_nonce' );
|
704 |
-
|
705 |
-
if ( ! current_user_can( 'install_plugins' ) ) {
|
706 |
-
wp_send_json_error( __( 'User does not have permission!', 'responsive-addons' ) );
|
707 |
-
}
|
708 |
-
|
709 |
-
$file_name = 'responsive-ready-sites-backup-' . date( 'd-M-Y-h-i-s' ) . '.json';
|
710 |
-
$old_settings = get_option( 'responsive_theme_options', array() );
|
711 |
-
|
712 |
-
$upload_dir = Responsive_Ready_Sites_Importer_Log::get_instance()->log_dir();
|
713 |
-
$upload_path = trailingslashit( $upload_dir['path'] );
|
714 |
-
$log_file = $upload_path . $file_name;
|
715 |
-
$file_system = Responsive_Ready_Sites_Importer_Log::get_instance()->get_filesystem();
|
716 |
-
|
717 |
-
// If file Write fails
|
718 |
-
if ( false === $file_system->put_contents( $log_file, json_encode( $old_settings ), FS_CHMOD_FILE ) ) {
|
719 |
-
update_option( 'responsive_ready_sites_' . $file_name, $old_settings );
|
720 |
-
}
|
721 |
-
|
722 |
-
wp_send_json_success();
|
723 |
-
}
|
724 |
-
|
725 |
-
/**
|
726 |
-
* Get Active site data
|
727 |
-
*/
|
728 |
-
public function get_active_site_data() {
|
729 |
-
$current_active_site = get_option( 'responsive_current_active_site' );
|
730 |
-
return $current_active_site;
|
731 |
-
}
|
732 |
-
|
733 |
-
/**
|
734 |
-
* Set reset data
|
735 |
-
*/
|
736 |
-
public function set_reset_data() {
|
737 |
-
check_ajax_referer( 'responsive-addons', '_ajax_nonce' );
|
738 |
-
if ( ! current_user_can( 'install_plugins' ) ) {
|
739 |
-
return;
|
740 |
-
}
|
741 |
-
|
742 |
-
global $wpdb;
|
743 |
-
|
744 |
-
$post_ids = $wpdb->get_col( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_responsive_ready_sites_imported_post'" );
|
745 |
-
$form_ids = $wpdb->get_col( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_responsive_ready_sites_imported_wp_forms'" );
|
746 |
-
$term_ids = $wpdb->get_col( "SELECT term_id FROM {$wpdb->termmeta} WHERE meta_key='_responsive_ready_sites_imported_term'" );
|
747 |
-
|
748 |
-
wp_send_json_success(
|
749 |
-
array(
|
750 |
-
'reset_posts' => $post_ids,
|
751 |
-
'reset_wp_forms' => $form_ids,
|
752 |
-
'reset_terms' => $term_ids,
|
753 |
-
)
|
754 |
-
);
|
755 |
-
}
|
756 |
-
|
757 |
-
/**
|
758 |
-
* Required Plugin
|
759 |
-
*
|
760 |
-
* @since 1.0.0
|
761 |
-
* @return void
|
762 |
-
*/
|
763 |
-
public function required_plugin() {
|
764 |
-
|
765 |
-
// Verify Nonce.
|
766 |
-
check_ajax_referer( 'responsive-addons', '_ajax_nonce' );
|
767 |
-
|
768 |
-
$response = array(
|
769 |
-
'active' => array(),
|
770 |
-
'inactive' => array(),
|
771 |
-
'notinstalled' => array(),
|
772 |
-
);
|
773 |
-
|
774 |
-
if ( ! current_user_can( 'install_plugins' ) ) {
|
775 |
-
wp_send_json_error( $response );
|
776 |
-
}
|
777 |
-
|
778 |
-
$required_plugins = ( isset( $_POST['required_plugins'] ) ) ? $_POST['required_plugins'] : array();
|
779 |
-
|
780 |
-
if ( count( $required_plugins ) > 0 ) {
|
781 |
-
foreach ( $required_plugins as $key => $plugin ) {
|
782 |
-
|
783 |
-
if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin['init'] ) && is_plugin_inactive( $plugin['init'] ) ) {
|
784 |
-
|
785 |
-
$response['inactive'][] = $plugin;
|
786 |
-
|
787 |
-
} elseif ( ! file_exists( WP_PLUGIN_DIR . '/' . $plugin['init'] ) ) {
|
788 |
-
|
789 |
-
$response['notinstalled'][] = $plugin;
|
790 |
-
|
791 |
-
} else {
|
792 |
-
$response['active'][] = $plugin;
|
793 |
-
}
|
794 |
-
}
|
795 |
-
}
|
796 |
-
|
797 |
-
// Send response.
|
798 |
-
wp_send_json_success(
|
799 |
-
array(
|
800 |
-
'required_plugins' => $response,
|
801 |
-
)
|
802 |
-
);
|
803 |
-
}
|
804 |
-
|
805 |
-
|
806 |
-
/**
|
807 |
-
* Required Plugin Activate
|
808 |
-
*
|
809 |
-
* @since 1.0.0
|
810 |
-
*/
|
811 |
-
public function required_plugin_activate() {
|
812 |
-
|
813 |
-
check_ajax_referer( 'responsive-addons', '_ajax_nonce' );
|
814 |
-
|
815 |
-
if ( ! current_user_can( 'activate_plugins' ) ) {
|
816 |
-
wp_send_json_error(
|
817 |
-
array(
|
818 |
-
'success' => false,
|
819 |
-
'message' => __( 'Error: You don\'t have the required permissions to install plugins.', 'responsive-addons' ),
|
820 |
-
)
|
821 |
-
);
|
822 |
-
}
|
823 |
-
|
824 |
-
if ( ! isset( $_POST['init'] ) || ! $_POST['init'] ) {
|
825 |
-
wp_send_json_error(
|
826 |
-
array(
|
827 |
-
'success' => false,
|
828 |
-
'message' => __( 'Plugins data is missing.', 'responsive-addons' ),
|
829 |
-
)
|
830 |
-
);
|
831 |
-
}
|
832 |
-
|
833 |
-
$data = array();
|
834 |
-
$plugin_init = ( isset( $_POST['init'] ) ) ? esc_attr( $_POST['init'] ) : '';
|
835 |
-
|
836 |
-
$activate = activate_plugin( $plugin_init, '', false, true );
|
837 |
-
|
838 |
-
if ( is_wp_error( $activate ) ) {
|
839 |
-
wp_send_json_error(
|
840 |
-
array(
|
841 |
-
'success' => false,
|
842 |
-
'message' => $activate->get_error_message(),
|
843 |
-
)
|
844 |
-
);
|
845 |
-
}
|
846 |
-
|
847 |
-
wp_send_json_success(
|
848 |
-
array(
|
849 |
-
'success' => true,
|
850 |
-
'message' => __( 'Plugin Activated', 'responsive-addons' ),
|
851 |
-
)
|
852 |
-
);
|
853 |
-
|
854 |
-
}
|
855 |
-
|
856 |
-
/**
|
857 |
-
* Check if Responsive Addons Pro is installed.
|
858 |
-
*/
|
859 |
-
public function is_responsive_pro_is_installed() {
|
860 |
-
$responsive_pro_slug = 'responsive-addons-pro/responsive-addons-pro.php';
|
861 |
-
if ( ! function_exists( 'get_plugins' ) ) {
|
862 |
-
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
863 |
-
}
|
864 |
-
$all_plugins = get_plugins();
|
865 |
-
|
866 |
-
if ( ! empty( $all_plugins[ $responsive_pro_slug ] ) ) {
|
867 |
-
wp_send_json_success();
|
868 |
-
} else {
|
869 |
-
wp_send_json_error();
|
870 |
-
}
|
871 |
-
}
|
872 |
-
|
873 |
-
/**
|
874 |
-
* Check if Responsive Addons Pro License is Active.
|
875 |
-
*/
|
876 |
-
public function is_responsive_pro_license_is_active() {
|
877 |
-
global $wcam_lib;
|
878 |
-
if ( is_null( $wcam_lib ) ) {
|
879 |
-
wp_send_json_error();
|
880 |
-
}
|
881 |
-
$license_status = $wcam_lib->license_key_status();
|
882 |
-
|
883 |
-
if ( ! empty( $license_status['data']['activated'] ) && $license_status['data']['activated'] ) {
|
884 |
-
wp_send_json_success();
|
885 |
-
} else {
|
886 |
-
wp_send_json_error();
|
887 |
-
}
|
888 |
-
}
|
889 |
-
|
890 |
-
/**
|
891 |
-
* Check if Responsive Addons Pro License is Active.
|
892 |
-
*/
|
893 |
-
public function responsive_pro_license_is_active() {
|
894 |
-
global $wcam_lib;
|
895 |
-
if ( is_null( $wcam_lib ) ) {
|
896 |
-
return false;
|
897 |
-
}
|
898 |
-
$license_status = $wcam_lib->license_key_status();
|
899 |
-
|
900 |
-
if ( ! empty( $license_status['data']['activated'] ) && $license_status['data']['activated'] ) {
|
901 |
-
return true;
|
902 |
-
} else {
|
903 |
-
return false;
|
904 |
-
}
|
905 |
-
}
|
906 |
-
|
907 |
-
/**
|
908 |
-
* Adding the theme menu page
|
909 |
-
*/
|
910 |
-
public function responsive_addons_admin_page() {
|
911 |
-
|
912 |
-
if ( $this->is_responsive() ) {
|
913 |
-
$menu_title = 'Ready Sites';
|
914 |
-
} else {
|
915 |
-
$menu_title = 'Responsive Ready Sites';
|
916 |
-
}
|
917 |
-
|
918 |
-
add_theme_page(
|
919 |
-
'Responsive Ready Sites Importer',
|
920 |
-
$menu_title,
|
921 |
-
'administrator',
|
922 |
-
'responsive-add-ons',
|
923 |
-
array( $this, 'responsive_add_ons' )
|
924 |
-
);
|
925 |
-
}
|
926 |
-
|
927 |
-
/**
|
928 |
-
* Responsive Addons Admin Page
|
929 |
-
*/
|
930 |
-
public function responsive_add_ons() {
|
931 |
-
|
932 |
-
if ( $this->is_responsive_addons_pro_is_active() && ! $this->responsive_pro_license_is_active() ) {
|
933 |
-
wp_redirect( admin_url( '/options-general.php?page=wc_am_client_responsive_addons_pro_dashboard' ) );
|
934 |
-
exit;
|
935 |
-
}
|
936 |
-
|
937 |
-
$responsive_addon_dir = plugin_dir_path( __FILE__ );
|
938 |
-
$responsive_addons_go_pro_screen = ( isset( $_GET['action'] ) && 'go_pro' === $_GET['action'] ) ? true : false; //phpcs:ignore
|
939 |
-
|
940 |
-
$responsive_addon_license_screen = ( isset( $_GET['action'] ) && 'license' === $_GET['action'] ) ? true : false; //phpcs:ignore
|
941 |
-
$responsive_addon_pro_support_screen = ( isset( $_GET['action'] ) && 'pro_support' === $_GET['action'] ) ? true : false; //phpcs:ignore?>
|
942 |
-
<div class="wrap">
|
943 |
-
<h1><?php esc_html_e( 'Responsive Ready Sites Importer' ); ?></h1>
|
944 |
-
<h2 class="nav-tab-wrapper">
|
945 |
-
<a href="<?php echo esc_url( admin_url( 'admin.php?page=responsive-add-ons' ) ); ?>" class="nav-tab
|
946 |
-
<?php
|
947 |
-
if ( ! isset( $_GET['action'] ) || isset( $_GET['action'] ) && 'go_pro' != $_GET['action'] && 'license' != $_GET['action'] && 'pro_support' != $_GET['action'] ) {
|
948 |
-
echo ' nav-tab-active';}
|
949 |
-
?>
|
950 |
-
"><?php esc_html_e( 'Ready Sites Importer' ); ?></a>
|
951 |
-
<?php
|
952 |
-
if ( ! $this->is_responsive_addons_pro_is_active() ) {
|
953 |
-
?>
|
954 |
-
|
955 |
-
<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'go_pro' ), admin_url( 'themes.php?page=responsive-add-ons' ) ) ); ?>" class="nav-tab
|
956 |
-
<?php
|
957 |
-
if ( $responsive_addons_go_pro_screen ) {
|
958 |
-
echo ' nav-tab-active';}
|
959 |
-
?>
|
960 |
-
"><?php esc_html_e( 'Go Pro' ); ?></a>
|
961 |
-
|
962 |
-
<?php } ?>
|
963 |
-
<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'pro_support' ), admin_url( 'themes.php?page=responsive-add-ons' ) ) ); ?>" class="nav-tab
|
964 |
-
<?php
|
965 |
-
if ( $responsive_addon_pro_support_screen ) {
|
966 |
-
echo ' nav-tab-active';}
|
967 |
-
?>
|
968 |
-
"><?php esc_html_e( 'Support' ); ?></a>
|
969 |
-
</h2>
|
970 |
-
<?php
|
971 |
-
if ( $responsive_addons_go_pro_screen ) {
|
972 |
-
|
973 |
-
require_once $responsive_addon_dir . 'admin/templates/responsive-addons-go-pro.php';
|
974 |
-
|
975 |
-
} elseif ( $responsive_addon_license_screen ) {
|
976 |
-
|
977 |
-
do_action( 'responsive_addons_pro_license_page' );
|
978 |
-
} elseif ( $responsive_addon_pro_support_screen ) {
|
979 |
-
|
980 |
-
require_once $responsive_addon_dir . 'admin/templates/responsive-addons-support.php';
|
981 |
-
} else {
|
982 |
-
|
983 |
-
do_action( 'responsive_addons_importer_page' );
|
984 |
-
}
|
985 |
-
?>
|
986 |
-
</div>
|
987 |
-
|
988 |
-
<?php
|
989 |
-
}
|
990 |
-
|
991 |
-
/**
|
992 |
-
* Check if Responsive Addons Pro is installed.
|
993 |
-
*/
|
994 |
-
public function is_responsive_addons_pro_is_active() {
|
995 |
-
$responsive_pro_slug = 'responsive-addons-pro/responsive-addons-pro.php';
|
996 |
-
if ( ! function_exists( 'get_plugins' ) ) {
|
997 |
-
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
998 |
-
}
|
999 |
-
|
1000 |
-
if ( is_plugin_active( $responsive_pro_slug ) ) {
|
1001 |
-
return true;
|
1002 |
-
} else {
|
1003 |
-
return false;
|
1004 |
-
}
|
1005 |
-
}
|
1006 |
-
|
1007 |
-
/**
|
1008 |
-
* Add rating links to the Responsive Addons Admin Page
|
1009 |
-
*
|
1010 |
-
* @param string $footer_text The existing footer text
|
1011 |
-
*
|
1012 |
-
* @return string
|
1013 |
-
* @since 2.0.6
|
1014 |
-
* @global string $typenow
|
1015 |
-
*/
|
1016 |
-
function responsive_addons_admin_rate_us( $footer_text ) {
|
1017 |
-
$page = isset( $_GET['page'] ) ? $_GET['page'] : '';
|
1018 |
-
$show_footer = array( 'responsive-add-ons' );
|
1019 |
-
|
1020 |
-
if ( in_array( $page, $show_footer ) ) {
|
1021 |
-
$rate_text = sprintf(
|
1022 |
-
/* translators: %s: Link to 5 star rating */
|
1023 |
-
__( 'If you like the <strong>Responsive Ready Sites Importer</strong> plugin please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'responsive-add-ons' ),
|
1024 |
-
'<a href="https://wordpress.org/support/view/plugin-reviews/responsive-add-ons?filter=5#postform" target="_blank" class="responsive-rating-link" style="text-decoration:none;" data-rated="' . esc_attr__( 'Thanks :)', 'responsive-add-ons' ) . '">★★★★★</a>'
|
1025 |
-
);
|
1026 |
-
|
1027 |
-
return $rate_text;
|
1028 |
-
} else {
|
1029 |
-
return $footer_text;
|
1030 |
-
}
|
1031 |
-
}
|
1032 |
-
|
1033 |
-
/**
|
1034 |
-
* Output buffer
|
1035 |
-
*/
|
1036 |
-
public function app_output_buffer() {
|
1037 |
-
ob_start();
|
1038 |
-
}
|
1039 |
-
|
1040 |
-
/**
|
1041 |
-
* Check if Responsive theme or Child theme of Responsive is Active
|
1042 |
-
*
|
1043 |
-
* @since 2.1.1
|
1044 |
-
*/
|
1045 |
-
public function check_responsive_theme_active() {
|
1046 |
|
1047 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1048 |
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
wp_send_json_error(
|
1056 |
-
array( 'success' => false )
|
1057 |
-
);
|
1058 |
-
}
|
1059 |
-
}
|
1060 |
-
}
|
1061 |
}
|
1062 |
|
|
|
|
|
|
|
1063 |
/**
|
1064 |
* Initialize Plugin
|
1065 |
*/
|
1066 |
-
if ( class_exists( '
|
1067 |
-
|
1068 |
-
// Installation and uninstallation hooks
|
1069 |
-
register_activation_hook( __FILE__, array( 'Responsive_Addons', 'activate' ) );
|
1070 |
-
register_deactivation_hook( __FILE__, array( 'Responsive_Addons', 'deactivate' ) );
|
1071 |
|
1072 |
-
// Initialise Class
|
1073 |
-
$responsive = new
|
1074 |
}
|
1075 |
|
1076 |
// load the latest sdk version from the active Responsive theme.
|
3 |
* Plugin Name: Responsive Ready Sites Importer
|
4 |
* Plugin URI: http://wordpress.org/plugins/responsive-add-ons/
|
5 |
* Description: Import Responsive Ready Sites that help you launch your website quickly. Just import, update & hit the launch button.
|
6 |
+
* Version: 2.2.6
|
7 |
* Author: CyberChimps
|
8 |
+
* License: GPL2
|
9 |
+
*
|
10 |
+
* @package Responsive_Add_Ons
|
11 |
*/
|
12 |
|
13 |
/*
|
27 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
28 |
*/
|
29 |
|
30 |
+
// Set Constants.
|
31 |
if ( ! defined( 'RESPONSIVE_ADDONS_FILE' ) ) {
|
32 |
define( 'RESPONSIVE_ADDONS_FILE', __FILE__ );
|
33 |
}
|
34 |
|
35 |
if ( ! defined( 'RESPONSIVE_ADDONS_DIR' ) ) {
|
36 |
+
define( 'RESPONSIVE_ADDONS_DIR', plugin_dir_path( RESPONSIVE_ADDONS_FILE ) );
|
37 |
+
}
|
38 |
+
|
39 |
+
if ( ! defined( 'RESPONSIVE_ADDONS_DIR_URL' ) ) {
|
40 |
+
define( 'RESPONSIVE_ADDONS_DIR_URL', plugin_dir_url( RESPONSIVE_ADDONS_FILE ) );
|
41 |
}
|
42 |
|
43 |
if ( ! defined( 'RESPONSIVE_ADDONS_URI' ) ) {
|
45 |
}
|
46 |
|
47 |
if ( ! defined( 'RESPONSIVE_ADDONS_VER' ) ) {
|
48 |
+
define( 'RESPONSIVE_ADDONS_VER', '2.2.6' );
|
49 |
}
|
50 |
|
51 |
if ( ! function_exists( 'ra_fs' ) ) {
|
52 |
+
/**
|
53 |
+
* Helper function to access SDK.
|
54 |
+
*/
|
55 |
function ra_fs() {
|
56 |
global $rao_fs;
|
57 |
|
65 |
'slug' => 'responsive-add-ons',
|
66 |
'product_name' => 'Responsive Ready Sites Importer',
|
67 |
'module_type' => 'plugin',
|
68 |
+
'version' => '2.2.6',
|
69 |
'plugin_basename' => 'responsive-add-ons/responsive-add-ons.php',
|
70 |
+
'plugin_url' => RESPONSIVE_ADDONS_DIR_URL,
|
71 |
)
|
72 |
);
|
73 |
}
|
81 |
do_action( 'ra_fs_loaded' );
|
82 |
}
|
83 |
|
84 |
+
/**
|
85 |
+
* The core plugin class that is used to define internationalization,
|
86 |
+
* admin-specific hooks, and public-facing site hooks.
|
87 |
+
*/
|
88 |
+
require plugin_dir_path( __FILE__ ) . 'includes/class-responsive-add-ons.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
|
90 |
+
/**
|
91 |
+
* The code that runs during plugin activation.
|
92 |
+
*/
|
93 |
+
function activate_responsive_addons() {
|
94 |
+
require_once plugin_dir_path( __FILE__ ) . 'includes/class-responsive-add-ons-activator.php';
|
95 |
+
Responsive_Add_Ons_Activator::activate();
|
96 |
+
}
|
97 |
|
98 |
+
/**
|
99 |
+
* The code that runs during plugin deactivation.
|
100 |
+
*/
|
101 |
+
function deactivate_responsive_addons() {
|
102 |
+
require_once plugin_dir_path( __FILE__ ) . 'includes/class-responsive-add-ons-deactivator.php';
|
103 |
+
Responsive_Add_Ons_Deactivator::deactivate();
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
}
|
105 |
|
106 |
+
register_activation_hook( __FILE__, 'activate_responsive_addons' );
|
107 |
+
register_deactivation_hook( __FILE__, 'deactivate_responsive_addons' );
|
108 |
+
|
109 |
/**
|
110 |
* Initialize Plugin
|
111 |
*/
|
112 |
+
if ( class_exists( 'Responsive_Add_Ons' ) ) {
|
|
|
|
|
|
|
|
|
113 |
|
114 |
+
// Initialise Class.
|
115 |
+
$responsive = new Responsive_Add_Ons();
|
116 |
}
|
117 |
|
118 |
// load the latest sdk version from the active Responsive theme.
|