AdSense Plugin WP QUADS - Version 1.8.13

Version Description

  • Feature: Created new mu-plugin for removing the WP QUADS shortcode when the plugin deactive/uninstall.
  • Fix: Assigned version number of Gutenberg module js and css files.
Download this release

Release Info

Developer wpquads
Plugin Icon 128x128 AdSense Plugin WP QUADS
Version 1.8.13
Comparing to
See all releases

Code changes from version 1.8.12 to 1.8.13

Gruntfile.js CHANGED
@@ -62,7 +62,7 @@ module.exports = function (grunt) {
62
  },
63
  options: {
64
  replacements: [{
65
- pattern: /1.8.12/g,
66
  replacement: '<%= pkg.version %>'
67
  }]
68
  }
62
  },
63
  options: {
64
  replacements: [{
65
+ pattern: /1.8.13/g,
66
  replacement: '<%= pkg.version %>'
67
  }]
68
  }
assets/js/quads-admin.js CHANGED
@@ -2,7 +2,6 @@ var strict;
2
 
3
 
4
  jQuery(document).ready(function ($) {
5
-
6
  // show / hide helper description
7
  $('.quads-tooltip').click(function (e) {
8
  e.preventDefault();
2
 
3
 
4
  jQuery(document).ready(function ($) {
 
5
  // show / hide helper description
6
  $('.quads-tooltip').click(function (e) {
7
  e.preventDefault();
assets/js/quads-admin.min.js CHANGED
@@ -2,7 +2,7 @@ var strict;
2
 
3
 
4
  jQuery(document).ready(function ($) {
5
-
6
  // show / hide helper description
7
  $('.quads-tooltip').click(function (e) {
8
  e.preventDefault();
2
 
3
 
4
  jQuery(document).ready(function ($) {
5
+
6
  // show / hide helper description
7
  $('.quads-tooltip').click(function (e) {
8
  e.preventDefault();
includes/admin/settings/register-settings.php CHANGED
@@ -360,10 +360,18 @@ function quads_get_registered_settings() {
360
  'id' => 'uninstall_on_delete',
361
  'name' => __( 'Delete Data on Uninstall?', 'quick-adsense-reloaded' ),
362
  //'desc' => __( 'Check this box if you would like <strong>Settings->WPQUADS</strong> to completely remove all of its data when the plugin is deleted.', 'quick-adsense-reloaded' ),
363
- 'helper-desc' => __( 'Check this box if you would like <strong>Settings->WPQUADS</strong> to completely remove all of its data when the plugin is deleted.', 'quick-adsense-reloaded' ),
364
  'desc' => 'Delete data',
365
  'type' => 'checkbox'
366
  ),
 
 
 
 
 
 
 
 
367
  'debug_mode' => array(
368
  'id' => 'debug_mode',
369
  'name' => __( 'Debug mode', 'quick-adsense-reloaded' ),
360
  'id' => 'uninstall_on_delete',
361
  'name' => __( 'Delete Data on Uninstall?', 'quick-adsense-reloaded' ),
362
  //'desc' => __( 'Check this box if you would like <strong>Settings->WPQUADS</strong> to completely remove all of its data when the plugin is deleted.', 'quick-adsense-reloaded' ),
363
+ 'helper-desc' => __( 'Check this box if you would to completely remove all of its data when the plugin is deleted.', 'quick-adsense-reloaded' ),
364
  'desc' => 'Delete data',
365
  'type' => 'checkbox'
366
  ),
367
+ 'hide_add_on_disableplugin' => array(
368
+ 'id' => 'hide_add_on_disableplugin',
369
+ 'name' => __( 'Hide Shortcode after Deactivate', 'quick-adsense-reloaded' ),
370
+ //'desc' => __( 'Check this box if you would like <strong>Settings->WPQUADS</strong> to completely remove all of its data when the plugin is deleted.', 'quick-adsense-reloaded' ),
371
+ 'helper-desc' => __( 'Check this box if you would like to Hide [quads] shortcode from the content after deactivating the plugin.', 'quick-adsense-reloaded' ),
372
+ 'desc' => 'Hides [quads] shortcode from the content',
373
+ 'type' => 'checkbox'
374
+ ),
375
  'debug_mode' => array(
376
  'id' => 'debug_mode',
377
  'name' => __( 'Debug mode', 'quick-adsense-reloaded' ),
includes/gutenberg/src/init.php CHANGED
@@ -9,7 +9,7 @@ function quads_block_assets() { // phpcs:ignore
9
  'quads-style-css', // Handle.
10
  plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS.
11
  is_admin() ? array( 'wp-editor' ) : null, // Dependency to include the CSS after it.
12
- null // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: File modification time.
13
  );
14
 
15
  // Register block editor script for backend.
@@ -17,7 +17,7 @@ function quads_block_assets() { // phpcs:ignore
17
  'quads-js', // Handle.
18
  plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack.
19
  array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' ), // Dependencies, defined above.
20
- null, // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.build.js' ), // Version: filemtime — Gets file modification time.
21
  true // Enqueue the script in the footer.
22
  );
23
 
@@ -26,7 +26,7 @@ function quads_block_assets() { // phpcs:ignore
26
  'quads-editor-css', // Handle.
27
  plugins_url( 'dist/blocks.editor.build.css', dirname( __FILE__ ) ), // Block editor CSS.
28
  array( 'wp-edit-blocks' ), // Dependency to include the CSS after it.
29
- null // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.editor.build.css' ) // Version: File modification time.
30
  );
31
 
32
  // WP Localized globals. Use dynamic PHP stuff in JavaScript via `quadsGlobal` object.
9
  'quads-style-css', // Handle.
10
  plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS.
11
  is_admin() ? array( 'wp-editor' ) : null, // Dependency to include the CSS after it.
12
+ QUADS_VERSION // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: File modification time.
13
  );
14
 
15
  // Register block editor script for backend.
17
  'quads-js', // Handle.
18
  plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack.
19
  array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' ), // Dependencies, defined above.
20
+ QUADS_VERSION, // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.build.js' ), // Version: filemtime — Gets file modification time.
21
  true // Enqueue the script in the footer.
22
  );
23
 
26
  'quads-editor-css', // Handle.
27
  plugins_url( 'dist/blocks.editor.build.css', dirname( __FILE__ ) ), // Block editor CSS.
28
  array( 'wp-edit-blocks' ), // Dependency to include the CSS after it.
29
+ QUADS_VERSION // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.editor.build.css' ) // Version: File modification time.
30
  );
31
 
32
  // WP Localized globals. Use dynamic PHP stuff in JavaScript via `quadsGlobal` object.
includes/mu-plugin/wpquads_remove_shortcode.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: WP QUADS Shortcode Remover
4
+ * Plugin URI: https://wpquads.com/
5
+ * Description: Remove WP QUADS shortcode when the plugin AdSense Integration WP QUADS has deactive/uninstall
6
+ * Author: WP Quads
7
+ * Author URI: https://wpquads.com/
8
+ * Version: 0.1
9
+ */
10
+ // Exit if accessed directly
11
+ if( !defined( 'ABSPATH' ) )
12
+ exit;
13
+ // Plugin version
14
+ if( !defined( 'WP_QUADS_MU_PLUGIN_VERSION' ) ) {
15
+ define( 'WP_QUADS_MU_PLUGIN_VERSION', '0.1' );
16
+ }
17
+
18
+ if(!defined( 'QUADS_NAME' ) && !class_exists( 'QuickAdsenseReloaded' )){
19
+ add_shortcode( 'quads_ad', 'wpquads_remove_unsed_shortcode', 1);
20
+ add_shortcode( 'quads', 'wpquads_remove_unsed_shortcode', 1);
21
+ function wpquads_remove_unsed_shortcode( $atts ) {
22
+ return '';
23
+ }
24
+ }
quick-adsense-reloaded.php CHANGED
@@ -6,7 +6,7 @@
6
  * Description: Insert Google AdSense and other ad formats fully automatic into your website
7
  * Author: WP Quads
8
  * Author URI: https://wordpress.org/plugins/quick-adsense-reloaded/
9
- * Version: 1.8.12
10
  * Text Domain: quick-adsense-reloaded
11
  * Domain Path: languages
12
  * Credits: WP QUADS - Quick AdSense Reloaded is a fork of Quick AdSense
@@ -30,30 +30,28 @@
30
  * @version 0.9.0
31
  */
32
 
33
-
34
  // Exit if accessed directly
35
  if( !defined( 'ABSPATH' ) )
36
- exit;
37
-
38
 
39
  // Plugin version
40
  if( !defined( 'QUADS_VERSION' ) ) {
41
- define( 'QUADS_VERSION', '1.8.12' );
42
  }
43
 
44
  // Plugin name
45
  if( !defined( 'QUADS_NAME' ) ) {
46
- define( 'QUADS_NAME', 'WP QUADS - Quick AdSense Reloaded' );
47
  }
48
 
49
  // Debug
50
  if( !defined( 'QUADS_DEBUG' ) ) {
51
- define( 'QUADS_DEBUG', false );
52
  }
53
 
54
  // Files that needs to be loaded early
55
  if( !class_exists( 'QUADS_Utils' ) ) {
56
- require dirname( __FILE__ ) . '/includes/quads-utils.php';
57
  }
58
 
59
  // Define some globals
@@ -73,7 +71,7 @@ if( !class_exists( 'QuickAdsenseReloaded' ) ) :
73
  * @since 1.0.0
74
  */
75
  final class QuickAdsenseReloaded {
76
- /** Singleton ************************************************************ */
77
 
78
  /**
79
  * @var QuickAdsenseReloaded The one and only QuickAdsenseReloaded
@@ -120,17 +118,17 @@ if( !class_exists( 'QuickAdsenseReloaded' ) ) :
120
  */
121
  public static function instance() {
122
  if( !isset( self::$instance ) && !( self::$instance instanceof QuickAdsenseReloaded ) ) {
123
- self::$instance = new QuickAdsenseReloaded;
124
- self::$instance->setup_constants();
125
- self::$instance->includes();
126
- self::$instance->load_textdomain();
127
- self::$instance->load_hooks();
128
- self::$instance->logger = new quadsLogger( "quick_adsense_log_" . date( "Y-m-d" ) . ".log", quadsLogger::INFO );
129
- self::$instance->html = new QUADS_HTML_Elements();
130
- self::$instance->vi = new wpquads\vi();
131
- self::$instance->adsense = new wpquads\adsense(get_option('quads_settings'));
132
- }
133
- return self::$instance;
134
  }
135
 
136
  /**
@@ -144,8 +142,8 @@ if( !class_exists( 'QuickAdsenseReloaded' ) ) :
144
  * @return void
145
  */
146
  public function __clone() {
147
- // Cloning instances of the class is forbidden
148
- _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'QUADS' ), '1.0' );
149
  }
150
 
151
  /**
@@ -156,8 +154,8 @@ if( !class_exists( 'QuickAdsenseReloaded' ) ) :
156
  * @return void
157
  */
158
  public function __wakeup() {
159
- // Unserializing instances of the class is forbidden
160
- _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'QUADS' ), '1.0' );
161
  }
162
 
163
  /**
@@ -168,22 +166,22 @@ if( !class_exists( 'QuickAdsenseReloaded' ) ) :
168
  * @return void
169
  */
170
  private function setup_constants() {
171
- //global $wpdb;
172
-
173
- // Plugin Folder Path
174
- if( !defined( 'QUADS_PLUGIN_DIR' ) ) {
175
- define( 'QUADS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
176
- }
177
-
178
- // Plugin Folder URL
179
- if( !defined( 'QUADS_PLUGIN_URL' ) ) {
180
- define( 'QUADS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
181
- }
182
-
183
- // Plugin Root File
184
- if( !defined( 'QUADS_PLUGIN_FILE' ) ) {
185
- define( 'QUADS_PLUGIN_FILE', __FILE__ );
186
- }
187
  }
188
 
189
  /**
@@ -194,91 +192,85 @@ if( !class_exists( 'QuickAdsenseReloaded' ) ) :
194
  * @return void
195
  */
196
  private function includes() {
197
- global $quads_options;
198
 
199
- require_once QUADS_PLUGIN_DIR . 'includes/admin/settings/register-settings.php';
200
- $quads_options = quads_get_settings();
201
 
202
- require_once QUADS_PLUGIN_DIR . 'includes/post_types.php';
203
- require_once QUADS_PLUGIN_DIR . 'includes/user_roles.php';
204
- require_once QUADS_PLUGIN_DIR . 'includes/widgets.php';
205
- require_once QUADS_PLUGIN_DIR . 'includes/template-functions.php';
206
- require_once QUADS_PLUGIN_DIR . 'includes/class-quads-license-handler.php';
207
- require_once QUADS_PLUGIN_DIR . 'includes/logger.php';
208
- require_once QUADS_PLUGIN_DIR . 'includes/class-quads-html-elements.php';
209
- require_once QUADS_PLUGIN_DIR . 'includes/shortcodes.php';
210
- require_once QUADS_PLUGIN_DIR . 'includes/api.php';
211
- require_once QUADS_PLUGIN_DIR . 'includes/render-ad-functions.php';
212
- require_once QUADS_PLUGIN_DIR . 'includes/scripts.php';
213
- require_once QUADS_PLUGIN_DIR . 'includes/automattic-amp-ad.php';
214
- require_once QUADS_PLUGIN_DIR . 'includes/helper-functions.php';
215
- require_once QUADS_PLUGIN_DIR . 'includes/conditions.php';
216
- require_once QUADS_PLUGIN_DIR . 'includes/frontend-checks.php';
217
- require_once QUADS_PLUGIN_DIR . 'includes/Cron/Cron.php';
218
- require_once QUADS_PLUGIN_DIR . 'includes/vendor/vi/conditions.php';
219
- require_once QUADS_PLUGIN_DIR . 'includes/vendor/vi/vi.php';
220
- require_once QUADS_PLUGIN_DIR . 'includes/vendor/vi/render.php';
221
- require_once QUADS_PLUGIN_DIR . 'includes/vendor/google/adsense.php';
222
- require_once QUADS_PLUGIN_DIR . 'includes/class-template.php';
223
- require_once QUADS_PLUGIN_DIR . 'includes/admin/adsTxt.php';
224
- require_once QUADS_PLUGIN_DIR . 'includes/elementor/widget.php';
225
- if ( function_exists('has_blocks')) {
226
- require_once QUADS_PLUGIN_DIR . 'includes/gutenberg/src/init.php';
227
- }
228
-
229
-
230
-
231
- if( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
232
- require_once QUADS_PLUGIN_DIR . 'includes/admin/add-ons.php';
233
- require_once QUADS_PLUGIN_DIR . 'includes/admin/admin-actions.php';
234
- require_once QUADS_PLUGIN_DIR . 'includes/admin/admin-footer.php';
235
- require_once QUADS_PLUGIN_DIR . 'includes/admin/admin-pages.php';
236
- require_once QUADS_PLUGIN_DIR . 'includes/admin/plugins.php';
237
- require_once QUADS_PLUGIN_DIR . 'includes/admin/welcome.php';
238
- require_once QUADS_PLUGIN_DIR . 'includes/admin/settings/display-settings.php';
239
- require_once QUADS_PLUGIN_DIR . 'includes/admin/settings/contextual-help.php';
240
- require_once QUADS_PLUGIN_DIR . 'includes/admin/tools.php';
241
- require_once QUADS_PLUGIN_DIR . 'includes/meta-boxes.php';
242
- require_once QUADS_PLUGIN_DIR . 'includes/quicktags.php';
243
- require_once QUADS_PLUGIN_DIR . 'includes/admin/admin-notices.php';
244
- require_once QUADS_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
245
- require_once QUADS_PLUGIN_DIR . 'includes/Forms/Form.php';
246
- require_once QUADS_PLUGIN_DIR . 'includes/Autoloader.php';
247
- require_once QUADS_PLUGIN_DIR . 'includes/vendor/vi/views/Forms/adSettings.php';
248
- $this->registerNamespaces();
249
-
250
- }
251
  }
252
-
253
- /**
254
- * Register used namespaces
255
- */
256
- private function registerNamespaces() {
257
- $autoloader = new wpquads\Autoloader();
258
 
259
- // Autoloader
260
- $autoloader->registerNamespaces( array(
261
  "wpquads" => array(
262
- QUADS_PLUGIN_DIR,
263
- QUADS_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'Forms',
264
- QUADS_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'Forms' . DIRECTORY_SEPARATOR . 'Elements',
265
- QUADS_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'Forms' . DIRECTORY_SEPARATOR . 'Elements' . DIRECTORY_SEPARATOR . 'Interfaces',
266
- QUADS_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'vi',
267
- QUADS_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'vi' . DIRECTORY_SEPARATOR . 'views',
268
- )
269
- ) );
270
-
271
-
272
- // Register namespaces
273
- $autoloader->register();
274
- }
275
-
276
-
277
 
278
  public function load_hooks() {
279
- if( is_admin() && quads_is_plugins_page() ) {
280
- add_filter( 'admin_footer', 'quads_add_deactivation_feedback_modal' );
281
- }
282
  }
283
 
284
  /**
@@ -289,28 +281,28 @@ if( !class_exists( 'QuickAdsenseReloaded' ) ) :
289
  * @return void
290
  */
291
  public function load_textdomain() {
292
- // Set filter for plugin's languages directory
293
- $quads_lang_dir = dirname( plugin_basename( QUADS_PLUGIN_FILE ) ) . '/languages/';
294
- $quads_lang_dir = apply_filters( 'quads_languages_directory', $quads_lang_dir );
295
-
296
- // Traditional WordPress plugin locale filter
297
- $locale = apply_filters( 'plugin_locale', get_locale(), 'quick-adsense-reloaded' );
298
- $mofile = sprintf( '%1$s-%2$s.mo', 'quick-adsense-reloaded', $locale );
299
-
300
- // Setup paths to current locale file
301
- $mofile_local = $quads_lang_dir . $mofile;
302
- $mofile_global = WP_LANG_DIR . '/quads/' . $mofile;
303
- //echo $mofile_local;
304
- if( file_exists( $mofile_global ) ) {
305
- // Look in global /wp-content/languages/quads folder
306
- load_textdomain( 'quick-adsense-reloaded', $mofile_global );
307
- } elseif( file_exists( $mofile_local ) ) {
308
- // Look in local /wp-content/plugins/quick-adsense-reloaded/languages/ folder
309
- load_textdomain( 'quick-adsense-reloaded', $mofile_local );
310
- } else {
311
- // Load the default language files
312
- load_plugin_textdomain( 'quick-adsense-reloaded', false, $quads_lang_dir );
313
- }
314
  }
315
 
316
  /*
@@ -319,25 +311,24 @@ if( !class_exists( 'QuickAdsenseReloaded' ) ) :
319
  * @since 1.0.0
320
  *
321
  */
322
-
323
  public static function activation( $networkwide ) {
324
- global $wpdb;
325
-
326
- if( function_exists( 'is_multisite' ) && is_multisite() ) {
327
- // check if it is a network activation - if so, run the activation function for each blog id
328
- if( $networkwide ) {
329
- $old_blog = $wpdb->blogid;
330
- // Get all blog ids
331
- $blogids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
332
- foreach ( $blogids as $blog_id ) {
333
- switch_to_blog( $blog_id );
334
- QuickAdsenseReloaded::during_activation();
335
- }
336
- switch_to_blog( $old_blog );
337
- return;
338
  }
339
- }
340
- QuickAdsenseReloaded::during_activation();
 
 
 
341
  }
342
 
343
  /**
@@ -349,54 +340,54 @@ if( !class_exists( 'QuickAdsenseReloaded' ) ) :
349
  * @return void
350
  */
351
  public static function during_activation() {
352
-
353
- // Add cron event
354
- require_once plugin_dir_path( __FILE__ ) . 'includes/Cron/Cron.php';
355
- $cron = new quadsCron();
356
- $cron->schedule_event();
357
-
358
- // Create vi api endpints and settings
359
- self::instance()->vi->setSettings();
360
-
361
- // Add Upgraded From Option
362
- $current_version = get_option( 'quads_version' );
363
- if( $current_version ) {
364
- update_option( 'quads_version_upgraded_from', $current_version );
365
- }
366
- // First time installation
367
- // Get all settings and update them only if they are empty
368
- $quads_options = get_option( 'quads_settings' );
369
- if( !$quads_options ) {
370
- $quads_options['post_types'] = array('post', 'page');
371
- $quads_options['visibility']['AppHome'] = "1";
372
- $quads_options['visibility']['AppCate'] = "1";
373
- $quads_options['visibility']['AppArch'] = "1";
374
- $quads_options['visibility']['AppTags'] = "1";
375
- $quads_options['quicktags']['QckTags'] = "1";
376
-
377
- update_option( 'quads_settings', $quads_options );
378
- }
379
-
380
- // Update the current version
381
- //update_option( 'quads_version', QUADS_VERSION );
382
- // Add plugin installation date and variable for rating div
383
- add_option( 'quads_install_date', date( 'Y-m-d h:i:s' ) );
384
- add_option( 'quads_rating_div', 'no' );
385
- add_option( 'quads_show_theme_notice', 'yes' );
386
-
387
- // Add the transient to redirect (not for multisites)
388
- set_transient( 'quads_activation_redirect', true, 3600 );
 
389
  }
390
-
391
  /**
392
  * Get all wp quads settings
393
  * @return array
394
  */
395
  private function startAdsense(){
396
- new wpquads\adsense(get_option( 'quads_settings' ));
397
  }
398
-
399
- }
400
 
401
  endif; // End if class_exists check
402
 
@@ -419,16 +410,14 @@ if( !class_exists( 'QuickAdsenseReloaded' ) ) :
419
  * @return $quads a global instance class of the QuickAdsenseReloaded class.
420
  */
421
  function quads_loaded() {
422
-
423
- global $quads;
424
-
425
- if( !is_null( $quads ) ) {
426
- return $quads;
427
- }
428
-
429
- $quads_instance = new QuickAdsenseReloaded;
430
- $quads = $quads_instance->instance();
431
- return $quads;
432
  }
433
 
434
  add_action( 'plugins_loaded', 'quads_loaded' );
@@ -444,14 +433,14 @@ register_activation_hook( __FILE__, array('QuickAdsenseReloaded', 'activation')
444
  * Check if pro version is installed and active
445
  */
446
  function quads_is_pro_active() {
447
- $needle = 'wp-quads-pro';
448
- $plugins = get_option( 'active_plugins', array() );
449
- foreach ( $plugins as $key => $value ) {
450
- if( strpos( $value, $needle ) !== false ) {
451
- return true;
452
- }
453
- }
454
- return false;
455
  }
456
 
457
 
@@ -461,12 +450,12 @@ function quads_is_pro_active() {
461
  * @return boolean
462
  */
463
  function quads_is_advanced() {
464
- if( function_exists( 'quads_is_active_pro' ) ) {
465
- return quads_is_active_pro();
466
- } else {
467
- return quads_is_active_deprecated();
468
- }
469
- return false;
470
  }
471
 
472
  /**
@@ -477,12 +466,31 @@ function quads_is_advanced() {
477
  */
478
  function quads_is_active_deprecated() {
479
 
480
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
481
- $plugin = 'wp-quads-pro/wp-quads-pro.php';
 
 
 
 
 
 
482
 
483
- if( is_plugin_active( $plugin ) ) {
484
- return true;
485
- }
486
 
487
- return false;
488
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  * Description: Insert Google AdSense and other ad formats fully automatic into your website
7
  * Author: WP Quads
8
  * Author URI: https://wordpress.org/plugins/quick-adsense-reloaded/
9
+ * Version: 1.8.13
10
  * Text Domain: quick-adsense-reloaded
11
  * Domain Path: languages
12
  * Credits: WP QUADS - Quick AdSense Reloaded is a fork of Quick AdSense
30
  * @version 0.9.0
31
  */
32
 
 
33
  // Exit if accessed directly
34
  if( !defined( 'ABSPATH' ) )
35
+ exit;
 
36
 
37
  // Plugin version
38
  if( !defined( 'QUADS_VERSION' ) ) {
39
+ define( 'QUADS_VERSION', '1.8.13' );
40
  }
41
 
42
  // Plugin name
43
  if( !defined( 'QUADS_NAME' ) ) {
44
+ define( 'QUADS_NAME', 'WP QUADS - Quick AdSense Reloaded' );
45
  }
46
 
47
  // Debug
48
  if( !defined( 'QUADS_DEBUG' ) ) {
49
+ define( 'QUADS_DEBUG', false );
50
  }
51
 
52
  // Files that needs to be loaded early
53
  if( !class_exists( 'QUADS_Utils' ) ) {
54
+ require dirname( __FILE__ ) . '/includes/quads-utils.php';
55
  }
56
 
57
  // Define some globals
71
  * @since 1.0.0
72
  */
73
  final class QuickAdsenseReloaded {
74
+ /** Singleton ************************************************************ */
75
 
76
  /**
77
  * @var QuickAdsenseReloaded The one and only QuickAdsenseReloaded
118
  */
119
  public static function instance() {
120
  if( !isset( self::$instance ) && !( self::$instance instanceof QuickAdsenseReloaded ) ) {
121
+ self::$instance = new QuickAdsenseReloaded;
122
+ self::$instance->setup_constants();
123
+ self::$instance->includes();
124
+ self::$instance->load_textdomain();
125
+ self::$instance->load_hooks();
126
+ self::$instance->logger = new quadsLogger( "quick_adsense_log_" . date( "Y-m-d" ) . ".log", quadsLogger::INFO );
127
+ self::$instance->html = new QUADS_HTML_Elements();
128
+ self::$instance->vi = new wpquads\vi();
129
+ self::$instance->adsense = new wpquads\adsense(get_option('quads_settings'));
130
+ }
131
+ return self::$instance;
132
  }
133
 
134
  /**
142
  * @return void
143
  */
144
  public function __clone() {
145
+ // Cloning instances of the class is forbidden
146
+ _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'QUADS' ), '1.0' );
147
  }
148
 
149
  /**
154
  * @return void
155
  */
156
  public function __wakeup() {
157
+ // Unserializing instances of the class is forbidden
158
+ _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'QUADS' ), '1.0' );
159
  }
160
 
161
  /**
166
  * @return void
167
  */
168
  private function setup_constants() {
169
+ //global $wpdb;
170
+
171
+ // Plugin Folder Path
172
+ if( !defined( 'QUADS_PLUGIN_DIR' ) ) {
173
+ define( 'QUADS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
174
+ }
175
+
176
+ // Plugin Folder URL
177
+ if( !defined( 'QUADS_PLUGIN_URL' ) ) {
178
+ define( 'QUADS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
179
+ }
180
+
181
+ // Plugin Root File
182
+ if( !defined( 'QUADS_PLUGIN_FILE' ) ) {
183
+ define( 'QUADS_PLUGIN_FILE', __FILE__ );
184
+ }
185
  }
186
 
187
  /**
192
  * @return void
193
  */
194
  private function includes() {
195
+ global $quads_options;
196
 
197
+ require_once QUADS_PLUGIN_DIR . 'includes/admin/settings/register-settings.php';
198
+ $quads_options = quads_get_settings();
199
 
200
+ require_once QUADS_PLUGIN_DIR . 'includes/post_types.php';
201
+ require_once QUADS_PLUGIN_DIR . 'includes/user_roles.php';
202
+ require_once QUADS_PLUGIN_DIR . 'includes/widgets.php';
203
+ require_once QUADS_PLUGIN_DIR . 'includes/template-functions.php';
204
+ require_once QUADS_PLUGIN_DIR . 'includes/class-quads-license-handler.php';
205
+ require_once QUADS_PLUGIN_DIR . 'includes/logger.php';
206
+ require_once QUADS_PLUGIN_DIR . 'includes/class-quads-html-elements.php';
207
+ require_once QUADS_PLUGIN_DIR . 'includes/shortcodes.php';
208
+ require_once QUADS_PLUGIN_DIR . 'includes/api.php';
209
+ require_once QUADS_PLUGIN_DIR . 'includes/render-ad-functions.php';
210
+ require_once QUADS_PLUGIN_DIR . 'includes/scripts.php';
211
+ require_once QUADS_PLUGIN_DIR . 'includes/automattic-amp-ad.php';
212
+ require_once QUADS_PLUGIN_DIR . 'includes/helper-functions.php';
213
+ require_once QUADS_PLUGIN_DIR . 'includes/conditions.php';
214
+ require_once QUADS_PLUGIN_DIR . 'includes/frontend-checks.php';
215
+ require_once QUADS_PLUGIN_DIR . 'includes/Cron/Cron.php';
216
+ require_once QUADS_PLUGIN_DIR . 'includes/vendor/vi/conditions.php';
217
+ require_once QUADS_PLUGIN_DIR . 'includes/vendor/vi/vi.php';
218
+ require_once QUADS_PLUGIN_DIR . 'includes/vendor/vi/render.php';
219
+ require_once QUADS_PLUGIN_DIR . 'includes/vendor/google/adsense.php';
220
+ require_once QUADS_PLUGIN_DIR . 'includes/class-template.php';
221
+ require_once QUADS_PLUGIN_DIR . 'includes/admin/adsTxt.php';
222
+ require_once QUADS_PLUGIN_DIR . 'includes/elementor/widget.php';
223
+ if ( function_exists('has_blocks')) {
224
+ require_once QUADS_PLUGIN_DIR . 'includes/gutenberg/src/init.php';
225
+ }
226
+
227
+ if( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
228
+ require_once QUADS_PLUGIN_DIR . 'includes/admin/add-ons.php';
229
+ require_once QUADS_PLUGIN_DIR . 'includes/admin/admin-actions.php';
230
+ require_once QUADS_PLUGIN_DIR . 'includes/admin/admin-footer.php';
231
+ require_once QUADS_PLUGIN_DIR . 'includes/admin/admin-pages.php';
232
+ require_once QUADS_PLUGIN_DIR . 'includes/admin/plugins.php';
233
+ require_once QUADS_PLUGIN_DIR . 'includes/admin/welcome.php';
234
+ require_once QUADS_PLUGIN_DIR . 'includes/admin/settings/display-settings.php';
235
+ require_once QUADS_PLUGIN_DIR . 'includes/admin/settings/contextual-help.php';
236
+ require_once QUADS_PLUGIN_DIR . 'includes/admin/tools.php';
237
+ require_once QUADS_PLUGIN_DIR . 'includes/meta-boxes.php';
238
+ require_once QUADS_PLUGIN_DIR . 'includes/quicktags.php';
239
+ require_once QUADS_PLUGIN_DIR . 'includes/admin/admin-notices.php';
240
+ require_once QUADS_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
241
+ require_once QUADS_PLUGIN_DIR . 'includes/Forms/Form.php';
242
+ require_once QUADS_PLUGIN_DIR . 'includes/Autoloader.php';
243
+ require_once QUADS_PLUGIN_DIR . 'includes/vendor/vi/views/Forms/adSettings.php';
244
+ $this->registerNamespaces();
245
+ }
 
 
 
246
  }
247
+
248
+ /**
249
+ * Register used namespaces
250
+ */
251
+ private function registerNamespaces() {
252
+ $autoloader = new wpquads\Autoloader();
253
 
254
+ // Autoloader
255
+ $autoloader->registerNamespaces( array(
256
  "wpquads" => array(
257
+ QUADS_PLUGIN_DIR,
258
+ QUADS_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'Forms',
259
+ QUADS_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'Forms' . DIRECTORY_SEPARATOR . 'Elements',
260
+ QUADS_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'Forms' . DIRECTORY_SEPARATOR . 'Elements' . DIRECTORY_SEPARATOR . 'Interfaces',
261
+ QUADS_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'vi',
262
+ QUADS_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'vi' . DIRECTORY_SEPARATOR . 'views',
263
+ )
264
+ ) );
265
+
266
+ // Register namespaces
267
+ $autoloader->register();
268
+ }
 
 
 
269
 
270
  public function load_hooks() {
271
+ if( is_admin() && quads_is_plugins_page() ) {
272
+ add_filter( 'admin_footer', 'quads_add_deactivation_feedback_modal' );
273
+ }
274
  }
275
 
276
  /**
281
  * @return void
282
  */
283
  public function load_textdomain() {
284
+ // Set filter for plugin's languages directory
285
+ $quads_lang_dir = dirname( plugin_basename( QUADS_PLUGIN_FILE ) ) . '/languages/';
286
+ $quads_lang_dir = apply_filters( 'quads_languages_directory', $quads_lang_dir );
287
+
288
+ // Traditional WordPress plugin locale filter
289
+ $locale = apply_filters( 'plugin_locale', get_locale(), 'quick-adsense-reloaded' );
290
+ $mofile = sprintf( '%1$s-%2$s.mo', 'quick-adsense-reloaded', $locale );
291
+
292
+ // Setup paths to current locale file
293
+ $mofile_local = $quads_lang_dir . $mofile;
294
+ $mofile_global = WP_LANG_DIR . '/quads/' . $mofile;
295
+ //echo $mofile_local;
296
+ if( file_exists( $mofile_global ) ) {
297
+ // Look in global /wp-content/languages/quads folder
298
+ load_textdomain( 'quick-adsense-reloaded', $mofile_global );
299
+ } elseif( file_exists( $mofile_local ) ) {
300
+ // Look in local /wp-content/plugins/quick-adsense-reloaded/languages/ folder
301
+ load_textdomain( 'quick-adsense-reloaded', $mofile_local );
302
+ } else {
303
+ // Load the default language files
304
+ load_plugin_textdomain( 'quick-adsense-reloaded', false, $quads_lang_dir );
305
+ }
306
  }
307
 
308
  /*
311
  * @since 1.0.0
312
  *
313
  */
 
314
  public static function activation( $networkwide ) {
315
+ global $wpdb;
316
+
317
+ if( function_exists( 'is_multisite' ) && is_multisite() ) {
318
+ // check if it is a network activation - if so, run the activation function for each blog id
319
+ if( $networkwide ) {
320
+ $old_blog = $wpdb->blogid;
321
+ // Get all blog ids
322
+ $blogids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
323
+ foreach ( $blogids as $blog_id ) {
324
+ switch_to_blog( $blog_id );
325
+ QuickAdsenseReloaded::during_activation();
 
 
 
326
  }
327
+ switch_to_blog( $old_blog );
328
+ return;
329
+ }
330
+ }
331
+ QuickAdsenseReloaded::during_activation();
332
  }
333
 
334
  /**
340
  * @return void
341
  */
342
  public static function during_activation() {
343
+
344
+ // Add cron event
345
+ require_once plugin_dir_path( __FILE__ ) . 'includes/Cron/Cron.php';
346
+ $cron = new quadsCron();
347
+ $cron->schedule_event();
348
+
349
+ // Create vi api endpints and settings
350
+ self::instance()->vi->setSettings();
351
+
352
+ // Add Upgraded From Option
353
+ $current_version = get_option( 'quads_version' );
354
+ if( $current_version ) {
355
+ update_option( 'quads_version_upgraded_from', $current_version );
356
+ }
357
+
358
+ // First time installation
359
+ // Get all settings and update them only if they are empty
360
+ $quads_options = get_option( 'quads_settings' );
361
+ if( !$quads_options ) {
362
+ $quads_options['post_types'] = array('post', 'page');
363
+ $quads_options['visibility']['AppHome'] = "1";
364
+ $quads_options['visibility']['AppCate'] = "1";
365
+ $quads_options['visibility']['AppArch'] = "1";
366
+ $quads_options['visibility']['AppTags'] = "1";
367
+ $quads_options['quicktags']['QckTags'] = "1";
368
+
369
+ update_option( 'quads_settings', $quads_options );
370
+ }
371
+
372
+ // Update the current version
373
+ //update_option( 'quads_version', QUADS_VERSION );
374
+ // Add plugin installation date and variable for rating div
375
+ add_option( 'quads_install_date', date( 'Y-m-d h:i:s' ) );
376
+ add_option( 'quads_rating_div', 'no' );
377
+ add_option( 'quads_show_theme_notice', 'yes' );
378
+
379
+ // Add the transient to redirect (not for multisites)
380
+ set_transient( 'quads_activation_redirect', true, 3600 );
381
  }
382
+
383
  /**
384
  * Get all wp quads settings
385
  * @return array
386
  */
387
  private function startAdsense(){
388
+ new wpquads\adsense(get_option( 'quads_settings' ));
389
  }
390
+ }
 
391
 
392
  endif; // End if class_exists check
393
 
410
  * @return $quads a global instance class of the QuickAdsenseReloaded class.
411
  */
412
  function quads_loaded() {
413
+ global $quads;
414
+ if( !is_null( $quads ) ) {
415
+ return $quads;
416
+ }
417
+
418
+ $quads_instance = new QuickAdsenseReloaded;
419
+ $quads = $quads_instance->instance();
420
+ return $quads;
 
 
421
  }
422
 
423
  add_action( 'plugins_loaded', 'quads_loaded' );
433
  * Check if pro version is installed and active
434
  */
435
  function quads_is_pro_active() {
436
+ $needle = 'wp-quads-pro';
437
+ $plugins = get_option( 'active_plugins', array() );
438
+ foreach ( $plugins as $key => $value ) {
439
+ if( strpos( $value, $needle ) !== false ) {
440
+ return true;
441
+ }
442
+ }
443
+ return false;
444
  }
445
 
446
 
450
  * @return boolean
451
  */
452
  function quads_is_advanced() {
453
+ if( function_exists( 'quads_is_active_pro' ) ) {
454
+ return quads_is_active_pro();
455
+ } else {
456
+ return quads_is_active_deprecated();
457
+ }
458
+ return false;
459
  }
460
 
461
  /**
466
  */
467
  function quads_is_active_deprecated() {
468
 
469
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
470
+ $plugin = 'wp-quads-pro/wp-quads-pro.php';
471
+
472
+ if( is_plugin_active( $plugin ) ) {
473
+ return true;
474
+ }
475
+ return false;
476
+ }
477
 
 
 
 
478
 
479
+ /**
480
+ * Create a MU plugin to remove unused shortcode when plugin is removed.
481
+ *
482
+ * @since 1.8.12
483
+ */
484
+ add_action('update_option_quads_settings', 'wpquads_remove_shortcode',10,3);
485
+ function wpquads_remove_shortcode($old_value,$new_value,$option){
486
+ $content_url =WPMU_PLUGIN_DIR.'/wpquads_remove_shortcode.php';
487
+ if(isset($new_value['hide_add_on_disableplugin'])){
488
+ wp_mkdir_p(WPMU_PLUGIN_DIR, 755, true);
489
+ $sourc =plugin_dir_path( __FILE__ ) . 'includes/mu-plugin/wpquads_remove_shortcode.php';
490
+ if (!file_exists($content_url)) {
491
+ copy($sourc,$content_url);
492
+ }
493
+ }else{
494
+ wp_delete_file($content_url);
495
+ }
496
+ }
readme.txt CHANGED
@@ -10,7 +10,7 @@ Tags: adsense, ads, ad, google adsense, advertising, amp, ad injection, ad inser
10
  Requires at least: 3.6+
11
  Tested up to: 5.3.2
12
  Requires PHP: 5.3
13
- Stable tag: 1.8.12
14
 
15
  Ads & AdSense Plugin is the quickest way to insert Google AdSense & other ads into your website. Google AdSense integration with Google AMP support.
16
 
@@ -129,6 +129,10 @@ Alternative Installation:
129
 
130
 
131
  == Changelog ==
 
 
 
 
132
  = 1.8.12 =
133
  * Fix: Fatal error for wordpress version below 5.0
134
 
10
  Requires at least: 3.6+
11
  Tested up to: 5.3.2
12
  Requires PHP: 5.3
13
+ Stable tag: 1.8.13
14
 
15
  Ads & AdSense Plugin is the quickest way to insert Google AdSense & other ads into your website. Google AdSense integration with Google AMP support.
16
 
129
 
130
 
131
  == Changelog ==
132
+ = 1.8.13 =
133
+ * Feature: Created new mu-plugin for removing the WP QUADS shortcode when the plugin deactive/uninstall.
134
+ * Fix: Assigned version number of Gutenberg module js and css files.
135
+
136
  = 1.8.12 =
137
  * Fix: Fatal error for wordpress version below 5.0
138