Version Description
- 4th March 2020 =
- Added - Secured Ajax requests
Download this release
Release Info
Developer | cyberchimps |
Plugin | Responsive Add Ons |
Version | 2.2.5 |
Comparing to | |
See all releases |
Code changes from version 2.2.4 to 2.2.5
analytics/includes/analytics-core-functions.php
CHANGED
@@ -106,13 +106,13 @@ if ( ! function_exists( 'as_request_get' ) ) {
|
|
106 |
*/
|
107 |
switch ( $type ) {
|
108 |
case 'post':
|
109 |
-
$value = isset( $_POST[ $key ] ) ? $_POST[ $key ] : $def;
|
110 |
break;
|
111 |
case 'get':
|
112 |
-
$value = isset( $_GET[ $key ] ) ? $_GET[ $key ] : $def;
|
113 |
break;
|
114 |
default:
|
115 |
-
$value = isset( $_REQUEST[ $key ] ) ? $_REQUEST[ $key ] : $def;
|
116 |
break;
|
117 |
}
|
118 |
|
106 |
*/
|
107 |
switch ( $type ) {
|
108 |
case 'post':
|
109 |
+
$value = isset( $_POST[ $key ] ) ? sanitize_text_field( wp_unslash( $_POST[ $key ] ) ) : $def;
|
110 |
break;
|
111 |
case 'get':
|
112 |
+
$value = isset( $_GET[ $key ] ) ? sanitize_text_field( wp_unslash( $_GET[ $key ] ) ) : $def;
|
113 |
break;
|
114 |
default:
|
115 |
+
$value = isset( $_REQUEST[ $key ] ) ? sanitize_text_field( wp_unslash( $_REQUEST[ $key ] ) ) : $def;
|
116 |
break;
|
117 |
}
|
118 |
|
analytics/includes/class-analytics.php
CHANGED
@@ -60,14 +60,14 @@ class Analytics {
|
|
60 |
*/
|
61 |
private $_plugin_basename;
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
|
72 |
/**
|
73 |
* Current page.
|
@@ -121,9 +121,9 @@ class Analytics {
|
|
121 |
if ( '' !== $plugin_basename ) {
|
122 |
$this->_plugin_basename = $plugin_basename;
|
123 |
}
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
|
128 |
$this->_blog_id = is_multisite() ? get_current_blog_id() : null;
|
129 |
|
@@ -204,19 +204,7 @@ class Analytics {
|
|
204 |
add_action( 'admin_init', array( &$this, '_hook_action_links_and_register_account_hooks' ) );
|
205 |
}
|
206 |
|
207 |
-
add_action( '
|
208 |
-
add_action( 'wp_ajax_ask-for-review-dismiss', array( &$this, '_ask_for_review_dismiss' ) );
|
209 |
-
}
|
210 |
-
|
211 |
-
/**
|
212 |
-
* Set user content on form submission
|
213 |
-
*
|
214 |
-
* @since 1.0.1
|
215 |
-
*/
|
216 |
-
public function set_user_consent() {
|
217 |
-
$value = isset( $_REQUEST['value'] ) ? $_REQUEST['value'] : '';
|
218 |
-
update_option( 'allow_user_data_' . $this->get_slug(), $value );
|
219 |
-
wp_send_json_success();
|
220 |
}
|
221 |
|
222 |
/**
|
@@ -596,7 +584,7 @@ class Analytics {
|
|
596 |
if ( ! is_admin() ) {
|
597 |
return;
|
598 |
}
|
599 |
-
|
600 |
/**
|
601 |
* Show deactivation form on themes.php page.
|
602 |
*
|
@@ -611,39 +599,40 @@ class Analytics {
|
|
611 |
}
|
612 |
}
|
613 |
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
|
|
647 |
|
648 |
/**
|
649 |
* Called after the user has submitted his reason for deactivating the plugin.
|
@@ -653,6 +642,8 @@ class Analytics {
|
|
653 |
*/
|
654 |
public function _submit_uninstall_reason_action() {
|
655 |
|
|
|
|
|
656 |
$deactivation_reason = as_request_get( 'deactivation_reason' );
|
657 |
|
658 |
$reason_info = trim( as_request_get( 'reason_info', '' ) );
|
60 |
*/
|
61 |
private $_plugin_basename;
|
62 |
|
63 |
+
/**
|
64 |
+
* Plugin URL.
|
65 |
+
*
|
66 |
+
* @since 1.0.0
|
67 |
+
*
|
68 |
+
* @var string
|
69 |
+
*/
|
70 |
+
private $_plugin_url;
|
71 |
|
72 |
/**
|
73 |
* Current page.
|
121 |
if ( '' !== $plugin_basename ) {
|
122 |
$this->_plugin_basename = $plugin_basename;
|
123 |
}
|
124 |
+
if ( '' !== $plugin_url ) {
|
125 |
+
$this->_plugin_url = $plugin_url;
|
126 |
+
}
|
127 |
|
128 |
$this->_blog_id = is_multisite() ? get_current_blog_id() : null;
|
129 |
|
204 |
add_action( 'admin_init', array( &$this, '_hook_action_links_and_register_account_hooks' ) );
|
205 |
}
|
206 |
|
207 |
+
add_action( 'wp_ajax_ask-for-review-dismiss', array( &$this, '_ask_for_review_dismiss' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
}
|
209 |
|
210 |
/**
|
584 |
if ( ! is_admin() ) {
|
585 |
return;
|
586 |
}
|
587 |
+
add_action( 'admin_notices', array( &$this, '_ask_for_review_notice' ) );
|
588 |
/**
|
589 |
* Show deactivation form on themes.php page.
|
590 |
*
|
599 |
}
|
600 |
}
|
601 |
|
602 |
+
/**
|
603 |
+
* Dismiss review notice.
|
604 |
+
*/
|
605 |
+
public function _ask_for_review_dismiss() {
|
606 |
+
check_ajax_referer( 'ask_for_review', 'security' );
|
607 |
+
if ( isset( $_POST['slug'] ) ) {
|
608 |
+
$slug = $_POST['slug'] ? sanitize_text_field( $_POST['slug'] ) : '';
|
609 |
+
update_option( $slug . '-ask-for-review-dismissed', true );
|
610 |
+
}
|
611 |
+
wp_send_json_success();
|
612 |
+
}
|
613 |
+
|
614 |
+
/**
|
615 |
+
* Notice to be displayed for Review.
|
616 |
+
*/
|
617 |
+
public function _ask_for_review_notice() {
|
618 |
+
if ( false === get_option( $this->_slug . '-setup' ) ) {
|
619 |
+
update_option( $this->_slug . '-setup', true );
|
620 |
+
set_transient( $this->_slug . '-ask-for-review-flag', true, MONTH_IN_SECONDS );
|
621 |
+
} else {
|
622 |
+
if ( false === get_transient( $this->_slug . '-ask-for-review-flag' ) && false === get_option( $this->_slug . '-ask-for-review-dismissed' ) ) {
|
623 |
+
$vars = array(
|
624 |
+
'id' => $this->_module_id,
|
625 |
+
'slug' => $this->_slug,
|
626 |
+
'product_name' => $this->_product_name,
|
627 |
+
'version' => $this->_version,
|
628 |
+
'module_type' => $this->_module_type,
|
629 |
+
'plugin_url' => $this->_plugin_url,
|
630 |
+
);
|
631 |
+
|
632 |
+
as_require_template( 'forms/review/form.php', $vars );
|
633 |
+
}
|
634 |
+
}
|
635 |
+
}
|
636 |
|
637 |
/**
|
638 |
* Called after the user has submitted his reason for deactivating the plugin.
|
642 |
*/
|
643 |
public function _submit_uninstall_reason_action() {
|
644 |
|
645 |
+
check_ajax_referer( 'uninstall_reason', 'security' );
|
646 |
+
|
647 |
$deactivation_reason = as_request_get( 'deactivation_reason' );
|
648 |
|
649 |
$reason_info = trim( as_request_get( 'reason_info', '' ) );
|
analytics/templates/forms/deactivation/form.php
CHANGED
@@ -24,6 +24,8 @@ $anonymous_feedback_checkbox_html = '';
|
|
24 |
|
25 |
$reasons_list_items_html = '';
|
26 |
|
|
|
|
|
27 |
if ( $show_deactivation_feedback_form ) {
|
28 |
$reasons = $VARS['reasons'];
|
29 |
|
@@ -205,7 +207,8 @@ as_enqueue_local_style( 'as_dialog_boxes', '/admin/dialog-boxes.css' );
|
|
205 |
action : 'submit_uninstall_reason',
|
206 |
deactivation_reason : $deactivation_reason,
|
207 |
reason_info : userReason,
|
208 |
-
is_anonymous : isAnonymousFeedback()
|
|
|
209 |
},
|
210 |
beforeSend: function () {
|
211 |
_parent.find('.as-modal-footer .button').addClass('disabled');
|
24 |
|
25 |
$reasons_list_items_html = '';
|
26 |
|
27 |
+
$uninstall_reason_nonce = wp_create_nonce( 'uninstall_reason' );
|
28 |
+
|
29 |
if ( $show_deactivation_feedback_form ) {
|
30 |
$reasons = $VARS['reasons'];
|
31 |
|
207 |
action : 'submit_uninstall_reason',
|
208 |
deactivation_reason : $deactivation_reason,
|
209 |
reason_info : userReason,
|
210 |
+
is_anonymous : isAnonymousFeedback(),
|
211 |
+
security : '<?php echo $uninstall_reason_nonce; ?>',
|
212 |
},
|
213 |
beforeSend: function () {
|
214 |
_parent.find('.as-modal-footer .button').addClass('disabled');
|
includes/importers/class-responsive-ready-sites-importer.php
CHANGED
@@ -53,29 +53,31 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Importer' ) ) :
|
|
53 |
include_once $responsive_ready_sites_importers_dir . 'class-responsive-ready-sites-widgets-importer.php';
|
54 |
include_once $responsive_ready_sites_importers_dir . 'class-responsive-ready-sites-options-importer.php';
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
add_action( 'responsive_ready_sites_import_complete', array( $this, 'clear_cache' ) );
|
66 |
|
67 |
include_once $responsive_ready_sites_importers_dir . 'batch-processing/class-responsive-ready-sites-batch-processing.php';
|
68 |
|
69 |
-
// Reset Customizer Data.
|
70 |
-
add_action( 'wp_ajax_responsive-ready-sites-reset-customizer-data', array( $this, 'reset_customizer_data' ) );
|
71 |
-
add_action( 'wp_ajax_responsive-ready-sites-reset-site-options', array( $this, 'reset_site_options' ) );
|
72 |
-
add_action( 'wp_ajax_responsive-ready-sites-reset-widgets-data', array( $this, 'reset_widgets_data' ) );
|
73 |
-
|
74 |
-
// Reset Post & Terms.
|
75 |
-
add_action( 'wp_ajax_responsive-ready-sites-delete-posts', array( $this, 'delete_imported_posts' ) );
|
76 |
-
add_action( 'wp_ajax_responsive-ready-sites-delete-wp-forms', array( $this, 'delete_imported_wp_forms' ) );
|
77 |
-
add_action( 'wp_ajax_responsive-ready-sites-delete-terms', array( $this, 'delete_imported_terms' ) );
|
78 |
-
|
79 |
if ( version_compare( get_bloginfo( 'version' ), '5.0.0', '>=' ) ) {
|
80 |
add_filter( 'http_request_timeout', array( $this, 'set_timeout_for_images' ), 10, 2 );
|
81 |
}
|
@@ -685,7 +687,7 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Importer' ) ) :
|
|
685 |
|
686 |
if ( isset( $sidebars_widgets['wp_inactive_widgets'] ) ) {
|
687 |
if ( ! in_array( $widget_key, $sidebars_widgets['wp_inactive_widgets'], true ) ) {
|
688 |
-
|
689 |
}
|
690 |
}
|
691 |
}
|
@@ -702,6 +704,7 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Importer' ) ) :
|
|
702 |
* Delete imported posts
|
703 |
*
|
704 |
* @since 1.3.0
|
|
|
705 |
* @return void
|
706 |
*/
|
707 |
public function delete_imported_posts( $post_id = 0 ) {
|
@@ -730,6 +733,7 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Importer' ) ) :
|
|
730 |
* Delete imported WP forms
|
731 |
*
|
732 |
* @since 1.3.0
|
|
|
733 |
* @return void
|
734 |
*/
|
735 |
public function delete_imported_wp_forms( $post_id = 0 ) {
|
@@ -757,6 +761,7 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Importer' ) ) :
|
|
757 |
* Delete imported terms
|
758 |
*
|
759 |
* @since 1.3.0
|
|
|
760 |
* @return void
|
761 |
*/
|
762 |
public function delete_imported_terms( $term_id = 0 ) {
|
53 |
include_once $responsive_ready_sites_importers_dir . 'class-responsive-ready-sites-widgets-importer.php';
|
54 |
include_once $responsive_ready_sites_importers_dir . 'class-responsive-ready-sites-options-importer.php';
|
55 |
|
56 |
+
if ( is_admin() ) {
|
57 |
+
// Import AJAX.
|
58 |
+
add_action( 'wp_ajax_responsive-ready-sites-import-set-site-data-free', array( $this, 'import_start' ) );
|
59 |
+
add_action( 'wp_ajax_responsive-ready-sites-import-xml', array( $this, 'import_xml_data' ) );
|
60 |
+
add_action( 'wp_ajax_responsive-ready-sites-import-wpforms', array( $this, 'import_wpforms' ) );
|
61 |
+
add_action( 'wp_ajax_responsive-ready-sites-import-customizer-settings', array( $this, 'import_customizer_settings' ) );
|
62 |
+
add_action( 'wp_ajax_responsive-ready-sites-import-widgets', array( $this, 'import_widgets' ) );
|
63 |
+
add_action( 'wp_ajax_responsive-ready-sites-import-options', array( $this, 'import_options' ) );
|
64 |
+
add_action( 'wp_ajax_responsive-ready-sites-import-end', array( $this, 'import_end' ) );
|
65 |
+
|
66 |
+
// Reset Customizer Data.
|
67 |
+
add_action( 'wp_ajax_responsive-ready-sites-reset-customizer-data', array( $this, 'reset_customizer_data' ) );
|
68 |
+
add_action( 'wp_ajax_responsive-ready-sites-reset-site-options', array( $this, 'reset_site_options' ) );
|
69 |
+
add_action( 'wp_ajax_responsive-ready-sites-reset-widgets-data', array( $this, 'reset_widgets_data' ) );
|
70 |
+
|
71 |
+
// Reset Post & Terms.
|
72 |
+
add_action( 'wp_ajax_responsive-ready-sites-delete-posts', array( $this, 'delete_imported_posts' ) );
|
73 |
+
add_action( 'wp_ajax_responsive-ready-sites-delete-wp-forms', array( $this, 'delete_imported_wp_forms' ) );
|
74 |
+
add_action( 'wp_ajax_responsive-ready-sites-delete-terms', array( $this, 'delete_imported_terms' ) );
|
75 |
+
}
|
76 |
|
77 |
add_action( 'responsive_ready_sites_import_complete', array( $this, 'clear_cache' ) );
|
78 |
|
79 |
include_once $responsive_ready_sites_importers_dir . 'batch-processing/class-responsive-ready-sites-batch-processing.php';
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
if ( version_compare( get_bloginfo( 'version' ), '5.0.0', '>=' ) ) {
|
82 |
add_filter( 'http_request_timeout', array( $this, 'set_timeout_for_images' ), 10, 2 );
|
83 |
}
|
687 |
|
688 |
if ( isset( $sidebars_widgets['wp_inactive_widgets'] ) ) {
|
689 |
if ( ! in_array( $widget_key, $sidebars_widgets['wp_inactive_widgets'], true ) ) {
|
690 |
+
$sidebars_widgets['wp_inactive_widgets'][] = $widget_key;
|
691 |
}
|
692 |
}
|
693 |
}
|
704 |
* Delete imported posts
|
705 |
*
|
706 |
* @since 1.3.0
|
707 |
+
* @param int $post_id Post Id.
|
708 |
* @return void
|
709 |
*/
|
710 |
public function delete_imported_posts( $post_id = 0 ) {
|
733 |
* Delete imported WP forms
|
734 |
*
|
735 |
* @since 1.3.0
|
736 |
+
* @param int $post_id Post Id.
|
737 |
* @return void
|
738 |
*/
|
739 |
public function delete_imported_wp_forms( $post_id = 0 ) {
|
761 |
* Delete imported terms
|
762 |
*
|
763 |
* @since 1.3.0
|
764 |
+
* @param int $term_id Term Id.
|
765 |
* @return void
|
766 |
*/
|
767 |
public function delete_imported_terms( $term_id = 0 ) {
|
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.4 - 4th March 2020 =
|
110 |
* Added - Improved security using nonce
|
111 |
|
@@ -214,4 +217,4 @@ Absolutely not! Once you install the plugin, it will take care of all other depe
|
|
214 |
* Bug fixes
|
215 |
|
216 |
= 1.0.0 =
|
217 |
-
* Initial set up and release
|
5 |
Requires at least: 5.0
|
6 |
Tested up to: 5.3
|
7 |
Requires PHP: 5.3
|
8 |
+
Stable tag: 2.2.5
|
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.5 - 4th March 2020 =
|
110 |
+
* Added - Secured Ajax requests
|
111 |
+
|
112 |
= 2.2.4 - 4th March 2020 =
|
113 |
* Added - Improved security using nonce
|
114 |
|
217 |
* Bug fixes
|
218 |
|
219 |
= 1.0.0 =
|
220 |
+
* Initial set up and release
|
responsive-add-ons.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<?php
|
2 |
-
|
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 |
/*
|
12 |
Copyright 2013 CyberChimps (email : support@cyberchimps.com)
|
13 |
|
@@ -27,51 +27,53 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
27 |
|
28 |
// Set Constants
|
29 |
if ( ! defined( 'RESPONSIVE_ADDONS_FILE' ) ) {
|
30 |
-
|
31 |
}
|
32 |
|
33 |
if ( ! defined( 'RESPONSIVE_ADDONS_DIR' ) ) {
|
34 |
-
|
35 |
}
|
36 |
|
37 |
if ( ! defined( 'RESPONSIVE_ADDONS_URI' ) ) {
|
38 |
-
|
39 |
}
|
40 |
|
41 |
if ( ! defined( 'RESPONSIVE_ADDONS_VER' ) ) {
|
42 |
-
|
43 |
}
|
44 |
|
45 |
if ( ! function_exists( 'ra_fs' ) ) {
|
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 |
-
if( !class_exists( 'Responsive_Addons' ) ) {
|
75 |
|
76 |
class Responsive_Addons {
|
77 |
|
@@ -84,8 +86,7 @@ if( !class_exists( 'Responsive_Addons' ) ) {
|
|
84 |
public function __construct() {
|
85 |
|
86 |
add_action( 'admin_init', array( &$this, 'admin_init' ) );
|
87 |
-
add_action('admin_notices', array( &$this, 'add_theme_installation_notice'), 1);
|
88 |
-
add_action( 'wp_ajax_responsive-ready-sites-activate-theme', array( $this, 'activate_theme' ) );
|
89 |
add_action( 'after_setup_theme', array( &$this, 'after_setup_theme' ) );
|
90 |
add_action( 'wp_head', array( &$this, 'responsive_head' ) );
|
91 |
add_action( 'plugins_loaded', array( &$this, 'responsive_addons_translations' ) );
|
@@ -93,165 +94,166 @@ if( !class_exists( 'Responsive_Addons' ) ) {
|
|
93 |
add_filter( "plugin_action_links_$plugin", array( &$this, 'plugin_settings_link' ) );
|
94 |
|
95 |
// Responsive Ready Site Importer Menu
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
-
|
|
|
99 |
|
100 |
-
|
101 |
-
|
102 |
-
add_action( 'wp_ajax_responsive-ready-sites-set-reset-data', array(&$this, 'set_reset_data'));
|
103 |
-
add_action( 'wp_ajax_responsive-ready-sites-backup-settings', array(&$this, 'backup_settings'));
|
104 |
-
add_action( 'wp_ajax_responsive-is-theme-active', array(&$this, 'check_responsive_theme_active' ) );
|
105 |
|
106 |
-
|
107 |
-
add_action( 'wp_ajax_responsive-notice-dismiss', array(&$this, 'dismiss_notice'));
|
108 |
|
109 |
-
|
110 |
-
add_action( 'wp_ajax_check-responsive-add-ons-pro-installed', array( $this, 'is_responsive_pro_is_installed') );
|
111 |
|
112 |
-
|
113 |
-
|
114 |
|
115 |
-
|
116 |
-
|
117 |
|
118 |
-
|
119 |
-
$this->plugin_options = get_option( 'responsive_addons_options' );
|
120 |
|
121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
-
add_action( 'responsive_addons_importer_page', array($this, 'menu_callback'));
|
124 |
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
-
|
129 |
-
self::set_api_url();
|
130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
}
|
132 |
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
<p><?php echo esc_html( 'Responsive theme needs to be active to use the Responsive Ready Sites Importer plugin.' ); ?> </p>
|
159 |
-
<p class="responsive-addons-message-actions">
|
160 |
-
<a href="#" class="<?php echo $theme_status; ?> button button-primary" data-theme-slug="responsive">Install & Activate Now</a>
|
161 |
-
</p>
|
162 |
-
</div>
|
163 |
-
</div>
|
164 |
-
</div>
|
165 |
-
<?php
|
166 |
-
}
|
167 |
-
|
168 |
-
/**
|
169 |
-
* Is notice expired?
|
170 |
-
*
|
171 |
-
* @since 2.0.3
|
172 |
-
*
|
173 |
-
* @return boolean
|
174 |
-
*/
|
175 |
-
public static function is_activation_theme_notice_expired() {
|
176 |
-
|
177 |
-
// Check the user meta status if current notice is dismissed.
|
178 |
-
$meta_status = get_user_meta( get_current_user_id(), 'responsive-theme-activation', true );
|
179 |
-
|
180 |
-
if ( empty( $meta_status ) ) {
|
181 |
-
return false;
|
182 |
-
}
|
183 |
-
|
184 |
-
return true;
|
185 |
-
}
|
186 |
-
|
187 |
-
/**
|
188 |
-
* Dismiss Notice.
|
189 |
-
*
|
190 |
-
* @since 2.0.3
|
191 |
-
* @return void
|
192 |
-
*/
|
193 |
-
public function dismiss_notice() {
|
194 |
-
$notice_id = ( isset( $_POST['notice_id'] ) ) ? sanitize_key( $_POST['notice_id'] ) : '';
|
195 |
-
|
196 |
-
// check for Valid input
|
197 |
-
if ( ! empty( $notice_id ) ) {
|
198 |
-
update_user_meta( get_current_user_id(), $notice_id, 'notice-dismissed' );
|
199 |
-
wp_send_json_success();
|
200 |
-
}
|
201 |
-
|
202 |
-
wp_send_json_error();
|
203 |
-
}
|
204 |
-
|
205 |
-
|
206 |
-
/**
|
207 |
-
* Activate theme
|
208 |
-
*
|
209 |
-
* @since 2.0.3
|
210 |
-
* @return void
|
211 |
-
*/
|
212 |
-
function activate_theme() {
|
213 |
-
|
214 |
-
check_ajax_referer( 'responsive-addons', '_ajax_nonce' );
|
215 |
-
|
216 |
-
if ( ! current_user_can( 'switch_themes' ) ) {
|
217 |
-
wp_send_json_error( __( 'You are not allowed to activate the Theme', 'responsive-addons' ) );
|
218 |
-
}
|
219 |
-
|
220 |
-
switch_theme( 'responsive' );
|
221 |
-
|
222 |
-
wp_send_json_success(
|
223 |
-
array(
|
224 |
-
'success' => true,
|
225 |
-
'message' => __( 'Theme Activated', 'responsive-addons' ),
|
226 |
-
)
|
227 |
-
);
|
228 |
-
}
|
229 |
-
|
230 |
-
/**
|
231 |
-
* Get theme install, active or inactive status.
|
232 |
-
*
|
233 |
-
* @since 1.3.2
|
234 |
-
*
|
235 |
-
* @return string Theme status
|
236 |
-
*/
|
237 |
-
function get_theme_status() {
|
238 |
-
|
239 |
-
$theme = wp_get_theme();
|
240 |
-
|
241 |
-
// Theme installed and activate.
|
242 |
-
if ( 'Responsive' === $theme->name || 'Responsive' === $theme->parent_theme ) {
|
243 |
-
return 'installed-and-active';
|
244 |
-
}
|
245 |
-
|
246 |
-
// Theme installed but not activate.
|
247 |
-
foreach ( (array) wp_get_themes() as $theme_dir => $theme ) {
|
248 |
-
if ( 'Responsive' === $theme->name || 'Responsive' === $theme->parent_theme ) {
|
249 |
-
return 'installed-but-inactive';
|
250 |
-
}
|
251 |
-
}
|
252 |
-
|
253 |
-
return 'not-installed';
|
254 |
-
}
|
255 |
|
256 |
/**
|
257 |
* Stuff to do when you activate
|
@@ -265,14 +267,14 @@ if( !class_exists( 'Responsive_Addons' ) ) {
|
|
265 |
public static function deactivate() {
|
266 |
}
|
267 |
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
|
277 |
/**
|
278 |
* Hook into WP admin_init
|
@@ -281,11 +283,12 @@ if( !class_exists( 'Responsive_Addons' ) ) {
|
|
281 |
public function admin_init( $options ) {
|
282 |
|
283 |
// Check if the theme being used is Responsive. If True then add settings to Responsive settings, else set up a settings page
|
284 |
-
if( $this->is_responsive() ) {
|
285 |
add_filter( 'responsive_option_sections_filter', array( &$this, 'responsive_option_sections' ), 10, 1 );
|
286 |
add_filter( 'responsive_options_filter', array( &$this, 'responsive_options' ), 10, 1 );
|
287 |
|
288 |
-
|
|
|
289 |
|
290 |
// Check if stop_responsive2 toggle is on, if on then include update class from wp-updates.com
|
291 |
if( 1 == $stop_responsive2 ) {
|
@@ -306,7 +309,7 @@ if( !class_exists( 'Responsive_Addons' ) ) {
|
|
306 |
public function after_setup_theme() {
|
307 |
|
308 |
// Check if the theme being used is Responsive. If True then add settings to Responsive settings, else set up a settings page
|
309 |
-
if( $this->is_responsive() ) {
|
310 |
|
311 |
add_filter( 'responsive_option_options_filter', array( $this, 'responsive_theme_options_set' ) );
|
312 |
|
@@ -333,21 +336,21 @@ if( !class_exists( 'Responsive_Addons' ) ) {
|
|
333 |
|
334 |
}
|
335 |
|
336 |
-
|
337 |
-
|
338 |
|
339 |
-
|
340 |
-
|
341 |
|
342 |
-
|
343 |
* The settings page
|
344 |
*/
|
345 |
public function plugin_settings_page() {
|
346 |
-
if( !current_user_can( 'manage_options' ) ) {
|
347 |
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
|
348 |
}
|
349 |
// Render the settings template
|
350 |
-
include
|
351 |
}
|
352 |
|
353 |
/**
|
@@ -358,7 +361,7 @@ if( !class_exists( 'Responsive_Addons' ) ) {
|
|
358 |
public static function is_responsive() {
|
359 |
$theme = wp_get_theme();
|
360 |
|
361 |
-
if( $theme->Name == 'Responsive' || $theme->Template == 'responsive' || $theme->Name == 'Responsive Pro' || $theme->Template == 'responsivepro' ) {
|
362 |
return true;
|
363 |
} else {
|
364 |
return false;
|
@@ -370,8 +373,8 @@ if( !class_exists( 'Responsive_Addons' ) ) {
|
|
370 |
$new_sections = array(
|
371 |
array(
|
372 |
'title' => __( 'Webmaster Tools', 'responsive-addons' ),
|
373 |
-
'id' => 'webmaster'
|
374 |
-
)
|
375 |
);
|
376 |
|
377 |
$new = array_merge( $sections, $new_sections );
|
@@ -393,7 +396,7 @@ if( !class_exists( 'Responsive_Addons' ) ) {
|
|
393 |
'type' => 'text',
|
394 |
'id' => 'google_site_verification',
|
395 |
'description' => __( 'Enter your Google ID number only', 'responsive-addons' ),
|
396 |
-
'placeholder' => ''
|
397 |
),
|
398 |
array(
|
399 |
'title' => __( 'Bing Site Verification', 'responsive-addons' ),
|
@@ -402,7 +405,7 @@ if( !class_exists( 'Responsive_Addons' ) ) {
|
|
402 |
'type' => 'text',
|
403 |
'id' => 'bing_site_verification',
|
404 |
'description' => __( 'Enter your Bing ID number only', 'responsive-addons' ),
|
405 |
-
'placeholder' => ''
|
406 |
),
|
407 |
array(
|
408 |
'title' => __( 'Yahoo Site Verification', 'responsive-addons' ),
|
@@ -411,7 +414,7 @@ if( !class_exists( 'Responsive_Addons' ) ) {
|
|
411 |
'type' => 'text',
|
412 |
'id' => 'yahoo_site_verification',
|
413 |
'description' => __( 'Enter your Yahoo ID number only', 'responsive-addons' ),
|
414 |
-
'placeholder' => ''
|
415 |
),
|
416 |
array(
|
417 |
'title' => __( 'Site Statistics Tracker', 'responsive-addons' ),
|
@@ -421,15 +424,16 @@ if( !class_exists( 'Responsive_Addons' ) ) {
|
|
421 |
'id' => 'site_statistics_tracker',
|
422 |
'class' => array( 'site-tracker' ),
|
423 |
'description' => __( 'Google Analytics, StatCounter, any other or all of them.', 'responsive-addons' ),
|
424 |
-
'placeholder' => ''
|
425 |
),
|
426 |
-
)
|
427 |
);
|
428 |
|
429 |
$new = array_merge( $options, $new_options );
|
430 |
|
431 |
// Commented for now to hide updates option
|
432 |
-
/*
|
|
|
433 |
if( $this->is_responsive() ) {
|
434 |
$new['theme_elements'][] = array(
|
435 |
'title' => __( 'Disable Responsive 2 Updates', 'responsive-addons' ),
|
@@ -461,7 +465,7 @@ if( !class_exists( 'Responsive_Addons' ) ) {
|
|
461 |
'description' => __( 'Enter your Google ID number only', 'responsive-addons' ),
|
462 |
'placeholder' => '',
|
463 |
'default' => '',
|
464 |
-
'validate' => 'text'
|
465 |
),
|
466 |
array(
|
467 |
'title' => __( 'Bing Site Verification', 'responsive-addons' ),
|
@@ -472,7 +476,7 @@ if( !class_exists( 'Responsive_Addons' ) ) {
|
|
472 |
'description' => __( 'Enter your Bing ID number only', 'responsive-addons' ),
|
473 |
'placeholder' => '',
|
474 |
'default' => '',
|
475 |
-
'validate' => 'text'
|
476 |
),
|
477 |
array(
|
478 |
'title' => __( 'Yahoo Site Verification', 'responsive-addons' ),
|
@@ -483,7 +487,7 @@ if( !class_exists( 'Responsive_Addons' ) ) {
|
|
483 |
'description' => __( 'Enter your Yahoo ID number only', 'responsive-addons' ),
|
484 |
'placeholder' => '',
|
485 |
'default' => '',
|
486 |
-
'validate' => 'text'
|
487 |
),
|
488 |
array(
|
489 |
'title' => __( 'Site Statistics Tracker', 'responsive-addons' ),
|
@@ -495,10 +499,10 @@ if( !class_exists( 'Responsive_Addons' ) ) {
|
|
495 |
'description' => __( 'Google Analytics, StatCounter, any other or all of them.', 'responsive-addons' ),
|
496 |
'placeholder' => '',
|
497 |
'default' => '',
|
498 |
-
'validate' => 'js'
|
499 |
),
|
500 |
|
501 |
-
)
|
502 |
);
|
503 |
|
504 |
$new_options = array_merge( $options, $new_options );
|
@@ -514,19 +518,19 @@ if( !class_exists( 'Responsive_Addons' ) ) {
|
|
514 |
// Test if using Responsive theme. If yes load from responsive options else load from plugin options
|
515 |
$responsive_options = ( $this->is_responsive() ) ? $this->options : $this->plugin_options;
|
516 |
|
517 |
-
if( !empty( $responsive_options['google_site_verification'] ) ) {
|
518 |
echo '<meta name="google-site-verification" content="' . esc_attr( $responsive_options['google_site_verification'] ) . '" />' . "\n";
|
519 |
}
|
520 |
|
521 |
-
if( !empty( $responsive_options['bing_site_verification'] ) ) {
|
522 |
echo '<meta name="msvalidate.01" content="' . esc_attr( $responsive_options['bing_site_verification'] ) . '" />' . "\n";
|
523 |
}
|
524 |
|
525 |
-
if( !empty( $responsive_options['yahoo_site_verification'] ) ) {
|
526 |
echo '<meta name="y_key" content="' . esc_attr( $responsive_options['yahoo_site_verification'] ) . '" />' . "\n";
|
527 |
}
|
528 |
|
529 |
-
if( !empty( $responsive_options['site_statistics_tracker'] ) ) {
|
530 |
echo $responsive_options['site_statistics_tracker'];
|
531 |
}
|
532 |
}
|
@@ -535,23 +539,22 @@ if( !class_exists( 'Responsive_Addons' ) ) {
|
|
535 |
|
536 |
$output = array();
|
537 |
|
538 |
-
foreach( $input as $key => $test ) {
|
539 |
-
switch( $key ) {
|
540 |
case 'google_site_verification':
|
541 |
-
$output[$key] = wp_filter_post_kses( $test );
|
542 |
break;
|
543 |
case 'yahoo_site_verification':
|
544 |
-
$output[$key] = wp_filter_post_kses( $test );
|
545 |
break;
|
546 |
case 'bing_site_verification':
|
547 |
-
$output[$key] = wp_filter_post_kses( $test );
|
548 |
break;
|
549 |
case 'site_statistics_tracker':
|
550 |
-
$output[$key] = wp_kses_stripslashes( $test );
|
551 |
break;
|
552 |
|
553 |
}
|
554 |
-
|
555 |
}
|
556 |
|
557 |
return $output;
|
@@ -571,471 +574,496 @@ if( !class_exists( 'Responsive_Addons' ) ) {
|
|
571 |
return $links;
|
572 |
}
|
573 |
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
'debug' => ((defined('WP_DEBUG') && WP_DEBUG) || isset($_GET['debug'])) ? true : false, //phpcs:ignore
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
926 |
$responsive_addons_go_pro_screen = ( isset( $_GET['action'] ) && 'go_pro' === $_GET['action'] ) ? true : false; //phpcs:ignore
|
927 |
|
928 |
$responsive_addon_license_screen = ( isset( $_GET['action'] ) && 'license' === $_GET['action'] ) ? true : false; //phpcs:ignore
|
929 |
$responsive_addon_pro_support_screen = ( isset( $_GET['action'] ) && 'pro_support' === $_GET['action'] ) ? true : false; //phpcs:ignore?>
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1033 |
}
|
1034 |
|
1035 |
/**
|
1036 |
* Initialize Plugin
|
1037 |
*/
|
1038 |
-
if( class_exists( 'Responsive_Addons' ) ) {
|
1039 |
|
1040 |
// Installation and uninstallation hooks
|
1041 |
register_activation_hook( __FILE__, array( 'Responsive_Addons', 'activate' ) );
|
1 |
<?php
|
2 |
+
/**
|
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.5
|
7 |
+
* Author: CyberChimps
|
8 |
+
* License: GPL2
|
9 |
+
*/
|
10 |
+
|
11 |
/*
|
12 |
Copyright 2013 CyberChimps (email : support@cyberchimps.com)
|
13 |
|
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', plugin_dir_url( RESPONSIVE_ADDONS_FILE ) );
|
35 |
}
|
36 |
|
37 |
if ( ! defined( 'RESPONSIVE_ADDONS_URI' ) ) {
|
38 |
+
define( 'RESPONSIVE_ADDONS_URI', plugins_url( '/', RESPONSIVE_ADDONS_FILE ) );
|
39 |
}
|
40 |
|
41 |
if ( ! defined( 'RESPONSIVE_ADDONS_VER' ) ) {
|
42 |
+
define( 'RESPONSIVE_ADDONS_VER', '2.2.5' );
|
43 |
}
|
44 |
|
45 |
if ( ! function_exists( 'ra_fs' ) ) {
|
46 |
+
// Helper function to access SDK
|
47 |
+
function ra_fs() {
|
48 |
+
global $rao_fs;
|
49 |
+
|
50 |
+
if ( ! isset( $rao_fs ) ) {
|
51 |
+
// Include Analytics SDK.
|
52 |
+
require_once dirname( __FILE__ ) . '/analytics/start.php';
|
53 |
+
|
54 |
+
$rao_fs = ras_dynamic_init(
|
55 |
+
array(
|
56 |
+
'id' => '1',
|
57 |
+
'slug' => 'responsive-add-ons',
|
58 |
+
'product_name' => 'Responsive Ready Sites Importer',
|
59 |
+
'module_type' => 'plugin',
|
60 |
+
'version' => '2.2.5',
|
61 |
+
'plugin_basename' => 'responsive-add-ons/responsive-add-ons.php',
|
62 |
+
'plugin_url' => RESPONSIVE_ADDONS_DIR,
|
63 |
+
)
|
64 |
+
);
|
65 |
+
}
|
66 |
+
|
67 |
+
return $rao_fs;
|
68 |
+
}
|
69 |
+
|
70 |
+
// Init Analytics.
|
71 |
+
ra_fs();
|
72 |
+
// SDK initiated.
|
73 |
+
do_action( 'ra_fs_loaded' );
|
74 |
}
|
75 |
|
76 |
+
if ( ! class_exists( 'Responsive_Addons' ) ) {
|
77 |
|
78 |
class Responsive_Addons {
|
79 |
|
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' ) );
|
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
|
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
|
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 ) {
|
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 |
|
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 |
/**
|
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;
|
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 );
|
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' ),
|
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' ),
|
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' ),
|
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' ),
|
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' ),
|
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' ),
|
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' ),
|
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 );
|
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 |
}
|
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;
|
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 |
+
check_ajax_referer( 'responsive-addons', '_ajax_nonce' );
|
1048 |
+
|
1049 |
+
$current_theme = wp_get_theme();
|
1050 |
+
if ( ( 'Responsive' === $current_theme->get( 'Name' ) ) || ( is_child_theme() && 'Responsive' === $current_theme->parent()->get( 'Name' ) ) ) {
|
1051 |
+
wp_send_json_success(
|
1052 |
+
array( 'success' => true )
|
1053 |
+
);
|
1054 |
+
} else {
|
1055 |
+
wp_send_json_error(
|
1056 |
+
array( 'success' => false )
|
1057 |
+
);
|
1058 |
+
}
|
1059 |
+
}
|
1060 |
+
}
|
1061 |
}
|
1062 |
|
1063 |
/**
|
1064 |
* Initialize Plugin
|
1065 |
*/
|
1066 |
+
if ( class_exists( 'Responsive_Addons' ) ) {
|
1067 |
|
1068 |
// Installation and uninstallation hooks
|
1069 |
register_activation_hook( __FILE__, array( 'Responsive_Addons', 'activate' ) );
|