Responsive Add Ons - Version 2.2.3

Version Description

  • 18th February 2020 =
  • Added - API request parameters
  • Added - Updated analytics library
Download this release

Release Info

Developer cyberchimps
Plugin Icon 128x128 Responsive Add Ons
Version 2.2.3
Comparing to
See all releases

Code changes from version 2.2.2 to 2.2.3

admin/js/responsive-ready-sites-admin.js CHANGED
@@ -1010,7 +1010,7 @@ var ResponsiveSitesAjaxQueue = (function() {
1010
 
1011
  // 1. Fail - Request Site Import.
1012
  if ( false === demo_data.success ) {
1013
- ResponsiveSitesAdmin._log_error( 'There was an error while processing import. Please try again.', true );
1014
  } else {
1015
 
1016
  ResponsiveSitesAdmin.xml_path = encodeURI( demo_data.data['xml_path'] ) || '';
1010
 
1011
  // 1. Fail - Request Site Import.
1012
  if ( false === demo_data.success ) {
1013
+ ResponsiveSitesAdmin._log_error( demo_data.data, true );
1014
  } else {
1015
 
1016
  ResponsiveSitesAdmin.xml_path = encodeURI( demo_data.data['xml_path'] ) || '';
analytics/assets/css/admin/ask-for-review.css ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .notice.ask-for-review-notice {
2
+ position: relative;
3
+ padding: 10px;
4
+ }
5
+ .notice.ask-for-review-notice > div.notice-content > a {
6
+ position: static;
7
+ float: right;
8
+ top: 0;
9
+ right: 0;
10
+ padding: 0 15px 10px 28px;
11
+ margin-top: -10px;
12
+ font-size: 13px;
13
+ line-height: 1.23076923;
14
+ text-decoration: none;
15
+ }
16
+ .notice.ask-for-review-notice > div.notice-content > a::before {
17
+ position: relative;
18
+ top: 18px;
19
+ left: -20px;
20
+ -webkit-transition: all .1s ease-in-out;
21
+ transition: all .1s ease-in-out;
22
+ }
23
+ .notice.ask-for-review-notice > div.notice-image {
24
+ width: 65px;
25
+ height: 65px;
26
+ float: left;
27
+ margin-right: 10px;
28
+ }
29
+ .notice.ask-for-review-notice > div.notice-image > img {
30
+ width: 100%;
31
+ border-radius: 10%;
32
+ vertical-align: text-top;
33
+ }
analytics/assets/js/admin/ask-for-review.js ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function( $ ) {
2
+ 'use strict';
3
+
4
+ /**
5
+ * All of the code for your admin-facing JavaScript source
6
+ * should reside in this file.
7
+ *
8
+ * Note: It has been assumed you will write jQuery code here, so the
9
+ * $ function reference has been prepared for usage within the scope
10
+ * of this function.
11
+ *
12
+ * This enables you to define handlers, for when the DOM is ready:
13
+ *
14
+ * $(function() {
15
+ *
16
+ * });
17
+ *
18
+ * When the window is loaded:
19
+ *
20
+ * $( window ).load(function() {
21
+ *
22
+ * });
23
+ *
24
+ * ...and/or other possibilities.
25
+ *
26
+ * Ideally, it is not considered best practise to attach more than a
27
+ * single DOM-ready or window-load handler for a particular page.
28
+ * Although scripts in the WordPress core, Plugins and Themes may be
29
+ * practising this, we should strive to set a better example in our own work.
30
+ */
31
+ $(
32
+ function() {
33
+ $( document ).on(
34
+ 'click',
35
+ '.ask-for-review-notice .notice-dismiss, .ask-for-review-notice .notice-buttons a',
36
+ function(){
37
+ var parent = $(this).parents('.ask-for-review-notice');
38
+ var slug = parent.find('input').val();
39
+ var data = {
40
+ action: 'ask-for-review-dismiss',
41
+ slug: slug,
42
+ security: ask_for_review.nonces.ask_for_review,
43
+ };
44
+ $.ajax(
45
+ {
46
+ url: ask_for_review.ajax_url,
47
+ data: data,
48
+ dataType:'json',
49
+ type: 'POST',
50
+ success: function (data) {}
51
+ }
52
+ );
53
+ }
54
+ );
55
+ }
56
+ );
57
+ })( jQuery );
analytics/includes/class-analytics.php CHANGED
@@ -60,6 +60,15 @@ class Analytics {
60
  */
61
  private $_plugin_basename;
62
 
 
 
 
 
 
 
 
 
 
63
  /**
64
  * Current page.
65
  *
@@ -103,7 +112,7 @@ class Analytics {
103
  * @param string $version Product Version.
104
  * @param string $module_type Module Type.
105
  */
106
- private function __construct( $module_id, $slug = false, $product_name, $version, $module_type, $plugin_basename = '' ) {
107
  $this->_module_id = $module_id;
108
  $this->_slug = $slug;
109
  $this->_module_type = $module_type;
@@ -112,6 +121,9 @@ class Analytics {
112
  if ( '' !== $plugin_basename ) {
113
  $this->_plugin_basename = $plugin_basename;
114
  }
 
 
 
115
 
116
  $this->_blog_id = is_multisite() ? get_current_blog_id() : null;
117
 
@@ -132,14 +144,14 @@ class Analytics {
132
  *
133
  * @return Analytics|false
134
  */
135
- static function instance( $module_id, $slug = false, $product_name, $version, $module_type, $plugin_basename = '' ) {
136
  if ( empty( $module_id ) ) {
137
  return false;
138
  }
139
 
140
  $key = 'm_' . $slug;
141
 
142
- self::$_instances[ $key ] = new Analytics( $module_id, $slug, $product_name, $version, $module_type, $plugin_basename );
143
 
144
  return self::$_instances[ $key ];
145
  }
@@ -193,6 +205,7 @@ class Analytics {
193
  }
194
 
195
  add_action( 'wp_ajax_set-user-consent', array( &$this, 'set_user_consent' ) );
 
196
  }
197
 
198
  /**
@@ -583,7 +596,7 @@ class Analytics {
583
  if ( ! is_admin() ) {
584
  return;
585
  }
586
-
587
  /**
588
  * Show deactivation form on themes.php page.
589
  *
@@ -598,6 +611,40 @@ class Analytics {
598
  }
599
  }
600
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
601
  /**
602
  * Called after the user has submitted his reason for deactivating the plugin.
603
  *
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.
74
  *
112
  * @param string $version Product Version.
113
  * @param string $module_type Module Type.
114
  */
115
+ private function __construct( $module_id, $slug = false, $product_name, $version, $module_type, $plugin_basename = '', $plugin_url = '' ) {
116
  $this->_module_id = $module_id;
117
  $this->_slug = $slug;
118
  $this->_module_type = $module_type;
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
 
144
  *
145
  * @return Analytics|false
146
  */
147
+ static function instance( $module_id, $slug = false, $product_name, $version, $module_type, $plugin_basename = '', $plugin_url = '' ) {
148
  if ( empty( $module_id ) ) {
149
  return false;
150
  }
151
 
152
  $key = 'm_' . $slug;
153
 
154
+ self::$_instances[ $key ] = new Analytics( $module_id, $slug, $product_name, $version, $module_type, $plugin_basename, $plugin_url );
155
 
156
  return self::$_instances[ $key ];
157
  }
205
  }
206
 
207
  add_action( 'wp_ajax_set-user-consent', array( &$this, 'set_user_consent' ) );
208
+ add_action( 'wp_ajax_ask-for-review-dismiss', array( &$this, '_ask_for_review_dismiss' ) );
209
  }
210
 
211
  /**
596
  if ( ! is_admin() ) {
597
  return;
598
  }
599
+ add_action( 'admin_notices', array( &$this, '_ask_for_review_notice' ) );
600
  /**
601
  * Show deactivation form on themes.php page.
602
  *
611
  }
612
  }
613
 
614
+ /**
615
+ * Dismiss review notice.
616
+ */
617
+ public function _ask_for_review_dismiss() {
618
+ if( isset( $_POST['slug'] ) ) {
619
+ $slug = $_POST['slug'] ? sanitize_text_field( $_POST['slug'] ) : '';
620
+ update_option( $slug . '-ask-for-review-dismissed', true );
621
+ }
622
+ wp_send_json_success();
623
+ }
624
+
625
+ /**
626
+ * Notice to be displayed for Review.
627
+ */
628
+ public function _ask_for_review_notice() {
629
+ if( false === get_option( $this->_slug . '-setup' ) ) {
630
+ update_option( $this->_slug . '-setup', true );
631
+ set_transient( $this->_slug . '-ask-for-review-flag', true, MONTH_IN_SECONDS );
632
+ } else {
633
+ if( false === get_transient( $this->_slug . '-ask-for-review-flag' ) && false === get_option( $this->_slug . '-ask-for-review-dismissed' ) ) {
634
+ $vars = array(
635
+ 'id' => $this->_module_id,
636
+ 'slug' => $this->_slug,
637
+ 'product_name' => $this->_product_name,
638
+ 'version' => $this->_version,
639
+ 'module_type' => $this->_module_type,
640
+ 'plugin_url' => $this->_plugin_url,
641
+ );
642
+
643
+ as_require_template( 'forms/review/form.php', $vars );
644
+ }
645
+ }
646
+ }
647
+
648
  /**
649
  * Called after the user has submitted his reason for deactivating the plugin.
650
  *
analytics/start.php CHANGED
@@ -42,7 +42,12 @@ if ( ! class_exists( 'Analytics' ) ) {
42
  } else {
43
  $plugin_basename = $module['plugin_basename'];
44
  }
45
- $ra = Analytics::instance( $module['id'], $module['slug'], $module['product_name'], $module['version'], $module['module_type'], $plugin_basename );
 
 
 
 
 
46
  $ra->dynamic_init( $module );
47
 
48
  return $ra;
42
  } else {
43
  $plugin_basename = $module['plugin_basename'];
44
  }
45
+ if ( ! isset( $module['plugin_url'] ) ) {
46
+ $plugin_url = '';
47
+ } else {
48
+ $plugin_url = $module['plugin_url'];
49
+ }
50
+ $ra = Analytics::instance( $module['id'], $module['slug'], $module['product_name'], $module['version'], $module['module_type'], $plugin_basename, $plugin_url );
51
  $ra->dynamic_init( $module );
52
 
53
  return $ra;
analytics/templates/forms/review/form.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Analytics
4
+ * @copyright Copyright (c) 2019, CyberChimps, Inc.
5
+ * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6
+ * @since 1.0.0
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * @var array $VARS
15
+ */
16
+ $als = analytics( $VARS['id'], $VARS['slug'], $VARS['product_name'], $VARS['version'], $VARS['module_type'] );
17
+ $slug = $als->get_slug();
18
+ $name = $VARS['product_name'];
19
+ $img_url = $VARS['plugin_url'] . 'icon.png';
20
+ $review_url = 'https://wordpress.org/support/plugin/' . $slug . '/reviews/?filter=5#new-post';
21
+ $params = array(
22
+ 'nonces' => array(
23
+ 'ask_for_review' => wp_create_nonce( 'ask_for_review' ),
24
+ ),
25
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
26
+ );
27
+
28
+ as_enqueue_local_style( 'as_ask_for_review', '/admin/ask-for-review.css' );
29
+ as_enqueue_local_script( 'as_ask_for_review', '/admin/ask-for-review.js' );
30
+ wp_localize_script( 'as_ask_for_review', 'ask_for_review', $params );
31
+
32
+ ?>
33
+ <div class="notice ask-for-review-notice is-dismissible">
34
+ <input type="hidden" name="plugin_slug" value="<?php echo esc_attr( $slug ); ?>">
35
+ <div class="notice-image">
36
+ <img src="<?php echo esc_url( $img_url ); ?>" alt="<?php echo esc_attr( $name )?>" />
37
+ </div>
38
+ <div class="notice-content">
39
+ <div class="notice-heading">
40
+ <p>Thanks for using the <?php echo esc_attr( $name ); ?>. Can you please do us a favor and give us a 5-star rating?</p>
41
+ </div>
42
+ <div class="notice-buttons">
43
+ <a href="<?php echo esc_url( $review_url ); ?>" class="button button-primary" target="_blank">Submit Review</a>
44
+ </div>
45
+ </div>
46
+ </div>
icon.png ADDED
Binary file
includes/importers/class-responsive-ready-sites-importer.php CHANGED
@@ -161,8 +161,8 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Importer' ) ) :
161
  if ( ! empty( $demo_api_uri ) ) {
162
 
163
  $demo_data = self::get_responsive_single_demo( $demo_api_uri );
164
- if ( ! $demo_data ) {
165
- wp_send_json_error( __( 'Request site API URL is empty. Try again!', 'responsive-addons' ) );
166
  }
167
 
168
  update_option( 'responsive_ready_sites_import_data', $demo_data );
@@ -525,8 +525,9 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Importer' ) ) :
525
  $request_params = apply_filters(
526
  'responsive_sites_api_params',
527
  array(
528
- 'api_key' => '',
529
- 'site_url' => site_url(),
 
530
  )
531
  );
532
 
@@ -544,7 +545,7 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Importer' ) ) :
544
  } else {
545
  $data = json_decode( wp_remote_retrieve_body( $response ), true );
546
  if ( ! $data['success'] ) {
547
- return false;
548
  }
549
  }
550
 
@@ -559,6 +560,7 @@ if ( ! class_exists( 'Responsive_Ready_Sites_Importer' ) ) :
559
  $remote_args['slug'] = $data['slug'];
560
  $remote_args['featured_image_url'] = $data['featured_image_url'];
561
  $remote_args['title'] = $data['title']['rendered'];
 
562
  }
563
 
564
  // Merge remote demo and defaults.
161
  if ( ! empty( $demo_api_uri ) ) {
162
 
163
  $demo_data = self::get_responsive_single_demo( $demo_api_uri );
164
+ if ( ! $demo_data['success'] ) {
165
+ wp_send_json( $demo_data );
166
  }
167
 
168
  update_option( 'responsive_ready_sites_import_data', $demo_data );
525
  $request_params = apply_filters(
526
  'responsive_sites_api_params',
527
  array(
528
+ 'api_key' => '',
529
+ 'site_url' => site_url(),
530
+ 'responsive_addons_ver' => RESPONSIVE_ADDONS_VER,
531
  )
532
  );
533
 
545
  } else {
546
  $data = json_decode( wp_remote_retrieve_body( $response ), true );
547
  if ( ! $data['success'] ) {
548
+ return $data;
549
  }
550
  }
551
 
560
  $remote_args['slug'] = $data['slug'];
561
  $remote_args['featured_image_url'] = $data['featured_image_url'];
562
  $remote_args['title'] = $data['title']['rendered'];
563
+ $remote_args['success'] = true;
564
  }
565
 
566
  // Merge remote demo and defaults.
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.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -106,6 +106,10 @@ 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.2 - 3rd February 2020 =
110
  * Added - Compatibility with EventOn plugin
111
 
5
  Requires at least: 5.0
6
  Tested up to: 5.3
7
  Requires PHP: 5.3
8
+ Stable tag: 2.2.3
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.3 - 18th February 2020 =
110
+ * Added - API request parameters
111
+ * Added - Updated analytics library
112
+
113
  = 2.2.2 - 3rd February 2020 =
114
  * Added - Compatibility with EventOn plugin
115
 
responsive-add-ons.php CHANGED
@@ -3,7 +3,7 @@
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.2
7
  Author: CyberChimps
8
  Author URI: http://www.cyberchimps.com
9
  License: GPL2
@@ -38,6 +38,10 @@ if ( ! defined( 'RESPONSIVE_ADDONS_URI' ) ) {
38
  define( 'RESPONSIVE_ADDONS_URI', plugins_url( '/', RESPONSIVE_ADDONS_FILE ) );
39
  }
40
 
 
 
 
 
41
  if ( ! function_exists( 'ra_fs' ) ) {
42
  // Helper function to access SDK
43
  function ra_fs() {
@@ -52,8 +56,9 @@ if ( ! function_exists( 'ra_fs' ) ) {
52
  'slug' => 'responsive-add-ons',
53
  'product_name' => 'Responsive Ready Sites Importer',
54
  'module_type' => 'plugin',
55
- 'version' => '2.2.2',
56
  'plugin_basename' => 'responsive-add-ons/responsive-add-ons.php',
 
57
  ) );
58
  }
59
 
@@ -246,7 +251,6 @@ if( !class_exists( 'Responsive_Addons' ) ) {
246
  * Stuff to do when you activate
247
  */
248
  public static function activate() {
249
- add_option( 'analytics_activation_redirect_responsive-add-ons', true );
250
  }
251
 
252
  /**
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.3
7
  Author: CyberChimps
8
  Author URI: http://www.cyberchimps.com
9
  License: GPL2
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.3' );
43
+ }
44
+
45
  if ( ! function_exists( 'ra_fs' ) ) {
46
  // Helper function to access SDK
47
  function ra_fs() {
56
  'slug' => 'responsive-add-ons',
57
  'product_name' => 'Responsive Ready Sites Importer',
58
  'module_type' => 'plugin',
59
+ 'version' => '2.2.3',
60
  'plugin_basename' => 'responsive-add-ons/responsive-add-ons.php',
61
+ 'plugin_url' => RESPONSIVE_ADDONS_DIR,
62
  ) );
63
  }
64
 
251
  * Stuff to do when you activate
252
  */
253
  public static function activate() {
 
254
  }
255
 
256
  /**