Boxzilla - Version 3.2.7

Version Description

Download this release

Release Info

Developer DvanKooten
Plugin Icon 128x128 Boxzilla
Version 3.2.7
Comparing to
See all releases

Code changes from version 3.2.6 to 3.2.7

bootstrap.php CHANGED
@@ -42,9 +42,11 @@ add_action( 'plugins_loaded', function() use( $boxzilla ) {
42
  $boxzilla['license_poller']->hook();
43
  });
44
 
 
45
  if( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
46
- if( count( $boxzilla->plugins ) > 0 ) {
47
- $boxzilla['license_manager']->hook();
 
48
  $boxzilla['update_manager']->hook();
49
  }
50
  }
42
  $boxzilla['license_poller']->hook();
43
  });
44
 
45
+ // license manager
46
  if( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
47
+ $boxzilla['license_manager']->hook();
48
+
49
+ if( count( $boxzilla->plugins ) > 0 ) {
50
  $boxzilla['update_manager']->hook();
51
  }
52
  }
boxzilla.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Boxzilla
4
- Version: 3.2.6
5
  Plugin URI: https://boxzillaplugin.com/#utm_source=wp-plugin&utm_medium=boxzilla&utm_campaign=plugins-page
6
  Description: Call-To-Action Boxes that display after visitors scroll down far enough. Unobtrusive, but highly conversing!
7
  Author: ibericode
@@ -41,7 +41,7 @@ if ( ! defined( 'ABSPATH' ) ) {
41
  function _load_boxzilla() {
42
 
43
  define( 'BOXZILLA_FILE', __FILE__ );
44
- define( 'BOXZILLA_VERSION', '3.2.6' );
45
 
46
  require __DIR__ . '/bootstrap.php';
47
  }
1
  <?php
2
  /*
3
  Plugin Name: Boxzilla
4
+ Version: 3.2.7
5
  Plugin URI: https://boxzillaplugin.com/#utm_source=wp-plugin&utm_medium=boxzilla&utm_campaign=plugins-page
6
  Description: Call-To-Action Boxes that display after visitors scroll down far enough. Unobtrusive, but highly conversing!
7
  Author: ibericode
41
  function _load_boxzilla() {
42
 
43
  define( 'BOXZILLA_FILE', __FILE__ );
44
+ define( 'BOXZILLA_VERSION', '3.2.7' );
45
 
46
  require __DIR__ . '/bootstrap.php';
47
  }
languages/boxzilla-cs_CZ.mo CHANGED
Binary file
languages/boxzilla-es_ES.mo CHANGED
Binary file
languages/boxzilla-fr_FR.mo CHANGED
Binary file
languages/boxzilla-nl_NL.mo CHANGED
Binary file
languages/boxzilla-ro_RO.mo CHANGED
Binary file
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Ibericode, DvanKooten, hchouhan, lapzor
3
  Donate link: https://boxzillaplugin.com/#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=donate-link
4
  Tags: scroll triggered box, cta, social, pop-up, newsletter, call to action, mailchimp, contact form 7, social media, mc4wp, ibericode
5
  Requires at least: 4.1
6
- Tested up to: 4.9.6
7
- Stable tag: 3.2.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Requires PHP: 5.3
@@ -150,6 +150,13 @@ Have a look at the [frequently asked questions](https://wordpress.org/plugins/bo
150
  == Changelog ==
151
 
152
 
 
 
 
 
 
 
 
153
  #### 3.2.6 - June 27, 2018
154
 
155
  **Improvements**
3
  Donate link: https://boxzillaplugin.com/#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=donate-link
4
  Tags: scroll triggered box, cta, social, pop-up, newsletter, call to action, mailchimp, contact form 7, social media, mc4wp, ibericode
5
  Requires at least: 4.1
6
+ Tested up to: 4.9.7
7
+ Stable tag: 3.2.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Requires PHP: 5.3
150
  == Changelog ==
151
 
152
 
153
+ #### 3.2.7 - July 31, 2018
154
+
155
+ **Fixes**
156
+
157
+ - Issue with boxes with only an iframe, image or video and no text not being loaded.
158
+
159
+
160
  #### 3.2.6 - June 27, 2018
161
 
162
  **Improvements**
src/class-box.php CHANGED
@@ -71,8 +71,7 @@ class Box {
71
  * @return array Array of box options
72
  */
73
  protected function load_options() {
74
-
75
- static $defaults = array(
76
  'css' => array(
77
  'background_color' => '',
78
  'color' => '',
71
  * @return array Array of box options
72
  */
73
  protected function load_options() {
74
+ $defaults = array(
 
75
  'css' => array(
76
  'background_color' => '',
77
  'color' => '',
src/class-boxzilla-service-provider.php CHANGED
@@ -56,8 +56,13 @@ class BoxzillaServiceProvider implements ServiceProviderInterface {
56
  );
57
 
58
  $container['plugins'] = function( $container ) {
59
- $plugins = (array) apply_filters( 'boxzilla_extensions', array() );
60
- return new Collection( $plugins );
 
 
 
 
 
61
  };
62
 
63
 
@@ -66,4 +71,4 @@ class BoxzillaServiceProvider implements ServiceProviderInterface {
66
 
67
 
68
  }
69
- }
56
  );
57
 
58
  $container['plugins'] = function( $container ) {
59
+ $raw = (array) apply_filters( 'boxzilla_extensions', array() );
60
+
61
+ $plugins = array();
62
+ foreach( $raw as $p ) {
63
+ $plugins[ $p->id() ] = $p;
64
+ }
65
+ return $plugins;
66
  };
67
 
68
 
71
 
72
 
73
  }
74
+ }
src/class-collection.php DELETED
@@ -1,154 +0,0 @@
1
- <?php
2
-
3
- namespace Boxzilla;
4
-
5
- use Iterator;
6
- use Countable;
7
- use ArrayAccess;
8
-
9
- class Collection implements Iterator, Countable, ArrayAccess {
10
-
11
- protected $elements = array();
12
- private $position = 0;
13
-
14
- public function __construct( array $elements ) {
15
- $this->elements = $elements;
16
- $this->position = 0;
17
- }
18
-
19
- function rewind() {
20
- $this->position = 0;
21
- }
22
-
23
- function current() {
24
- return $this->elements[ $this->position ];
25
- }
26
-
27
- function key() {
28
- return $this->position;
29
- }
30
-
31
- function next() {
32
- ++$this->position;
33
- }
34
-
35
- function valid() {
36
- return isset( $this->elements[ $this->position ] );
37
- }
38
-
39
- /**
40
- * @param $callback
41
- *
42
- * @return array
43
- */
44
- function map($callback) {
45
- $result = array();
46
-
47
- foreach( $this->elements as $element ) {
48
- $result[] = $callback( $element );
49
- }
50
-
51
- return $result;
52
- }
53
-
54
- /**
55
- * @param $callback
56
- *
57
- * @return null
58
- */
59
- function find($callback) {
60
-
61
- foreach( $this->elements as $element ) {
62
- if( $callback( $element ) ) {
63
- return $element;
64
- }
65
- }
66
-
67
- return null;
68
- }
69
-
70
- /**
71
- * (PHP 5 &gt;= 5.1.0)<br/>
72
- * Count elements of an object
73
- * @link http://php.net/manual/en/countable.count.php
74
- * @return int The custom count as an integer.
75
- * </p>
76
- * <p>
77
- * The return value is cast to an integer.
78
- */
79
- public function count() {
80
- return count( $this->elements );
81
- }
82
-
83
- /**
84
- * Whether a offset exists
85
- * @link http://php.net/manual/en/arrayaccess.offsetexists.php
86
- * @param mixed $offset <p>
87
- * An offset to check for.
88
- * </p>
89
- * @return boolean true on success or false on failure.
90
- * </p>
91
- * <p>
92
- * The return value will be casted to boolean if non-boolean was returned.
93
- * @since 5.0.0
94
- */
95
- public function offsetExists($offset)
96
- {
97
- return isset( $this->elements[ $offset ] );
98
- }
99
-
100
- /**
101
- * Offset to retrieve
102
- * @link http://php.net/manual/en/arrayaccess.offsetget.php
103
- * @param mixed $offset <p>
104
- * The offset to retrieve.
105
- * </p>
106
- * @return mixed Can return all value types.
107
- * @since 5.0.0
108
- */
109
- public function offsetGet($offset)
110
- {
111
- return $this->elements[ $offset ];
112
- }
113
-
114
- /**
115
- * Offset to set
116
- * @link http://php.net/manual/en/arrayaccess.offsetset.php
117
- * @param mixed $offset <p>
118
- * The offset to assign the value to.
119
- * </p>
120
- * @param mixed $value <p>
121
- * The value to set.
122
- * </p>
123
- * @return void
124
- * @since 5.0.0
125
- */
126
- public function offsetSet($offset, $value)
127
- {
128
- $this->elements[ $offset ] = $value;
129
- }
130
-
131
- /**
132
- * Offset to unset
133
- * @link http://php.net/manual/en/arrayaccess.offsetunset.php
134
- * @param mixed $offset <p>
135
- * The offset to unset.
136
- * </p>
137
- * @return void
138
- * @since 5.0.0
139
- */
140
- public function offsetUnset($offset)
141
- {
142
- unset( $this->elements[ $offset] );
143
- }
144
-
145
- /**
146
- * Return a random value out of the collection.
147
- *
148
- * @return mixed
149
- */
150
- public function random() {
151
- $key = array_rand( $this->elements );
152
- return $this->elements[ $key ];
153
- }
154
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/class-loader.php CHANGED
@@ -315,7 +315,7 @@ class BoxLoader {
315
  $boxes = array();
316
  foreach ( $posts as $key => $post ) {
317
  // skip posts with no content
318
- $post_content = trim( strip_tags( nl2br( $post->post_content ) ) );
319
  if( empty( $post_content ) ) {
320
  continue;
321
  }
315
  $boxes = array();
316
  foreach ( $posts as $key => $post ) {
317
  // skip posts with no content
318
+ $post_content = trim( $post->post_content );
319
  if( empty( $post_content ) ) {
320
  continue;
321
  }
src/licensing/class-license-manager.php CHANGED
@@ -29,12 +29,12 @@ class LicenseManager {
29
  protected $notices = array();
30
 
31
  /**
32
- * @param Collection $extensions
33
  * @param API $api
34
  * @param License $license
35
  * @param Notices $notices
36
  */
37
- public function __construct( Collection $extensions, API $api, License $license ) {
38
  $this->extensions = $extensions;
39
  $this->license = $license;
40
  $this->api = $api;
@@ -57,7 +57,7 @@ class LicenseManager {
57
  public function hook() {
58
 
59
  // do nothing if no extensions are registered at this point
60
- if( count( $this->extensions ) === 0 ) {
61
  return;
62
  }
63
 
@@ -83,7 +83,7 @@ class LicenseManager {
83
  return;
84
  }
85
 
86
- $plugin = $this->extensions->random();
87
  $message = sprintf( 'Please <a href="%s">activate your Boxzilla license</a> to use %s.', admin_url( 'edit.php?post_type=boxzilla-box&page=boxzilla-settings' ), '<strong>' . $plugin->name() . '</strong>' );
88
  echo sprintf( '<div class="notice notice-%s"><p>%s</p></div>', 'warning', $message );
89
  }
29
  protected $notices = array();
30
 
31
  /**
32
+ * @param array $extensions
33
  * @param API $api
34
  * @param License $license
35
  * @param Notices $notices
36
  */
37
+ public function __construct( array $extensions, API $api, License $license ) {
38
  $this->extensions = $extensions;
39
  $this->license = $license;
40
  $this->api = $api;
57
  public function hook() {
58
 
59
  // do nothing if no extensions are registered at this point
60
+ if( empty( $this->extensions ) ) {
61
  return;
62
  }
63
 
83
  return;
84
  }
85
 
86
+ $plugin = $this->extensions[ array_rand( $this->extensions ) ];
87
  $message = sprintf( 'Please <a href="%s">activate your Boxzilla license</a> to use %s.', admin_url( 'edit.php?post_type=boxzilla-box&page=boxzilla-settings' ), '<strong>' . $plugin->name() . '</strong>' );
88
  echo sprintf( '<div class="notice notice-%s"><p>%s</p></div>', 'warning', $message );
89
  }
src/licensing/class-update-manager.php CHANGED
@@ -9,9 +9,9 @@ use Boxzilla\Collection,
9
  class UpdateManager {
10
 
11
  /**
12
- * @var Collection
13
  */
14
- protected $extensions;
15
 
16
  /**
17
  * @var API
@@ -33,7 +33,7 @@ class UpdateManager {
33
  * @param API $api
34
  * @param License $license
35
  */
36
- public function __construct( Collection $extensions, API $api, License $license ) {
37
  $this->extensions = $extensions;
38
  $this->license = $license;
39
  $this->api = $api;
@@ -90,13 +90,17 @@ class UpdateManager {
90
  return $result;
91
  }
92
 
93
- // only act on our plugins
94
- $plugin = $this->extensions->find( function( $p ) use($args) {
95
- return dirname( $p->slug() ) == $args->slug;
96
- });
97
-
 
 
 
 
98
  // was it a plugin of ours?
99
- if( $plugin ) {
100
  return $this->get_update_info( $plugin );
101
  }
102
 
@@ -110,7 +114,7 @@ class UpdateManager {
110
  public function add_updates( $updates ) {
111
 
112
  // do nothing if no plugins registered
113
- if( count( $this->extensions ) === 0 ) {
114
  return $updates;
115
  }
116
 
@@ -149,7 +153,7 @@ class UpdateManager {
149
 
150
  // fetch remote info
151
  try {
152
- $remote_plugins = $this->api->get_plugins( $this->extensions );
153
  } catch( API_Exception $e ) {
154
  // set flag for 5 minutes
155
  set_transient( 'boxzilla_request_failed', strtotime('now'), 300 );
@@ -174,14 +178,13 @@ class UpdateManager {
174
  // find new versions
175
  foreach( $remote_plugins as $remote_plugin ) {
176
 
 
 
 
 
177
  // find corresponding local plugin
178
  /** @var Plugin $local_plugin */
179
- $local_plugin = $this->extensions->find(
180
- function( $local_plugin ) use( $remote_plugin ){
181
- /** @var Plugin $local_plugin */
182
- return $local_plugin->id() == $remote_plugin->sid;
183
- }
184
- );
185
 
186
  // plugin found and local plugin version not same as remote version?
187
  if( ! $local_plugin || version_compare( $local_plugin->version(), $remote_plugin->new_version, '>=' ) ) {
9
  class UpdateManager {
10
 
11
  /**
12
+ * @var array
13
  */
14
+ protected $extensions = array();
15
 
16
  /**
17
  * @var API
33
  * @param API $api
34
  * @param License $license
35
  */
36
+ public function __construct( array $extensions, API $api, License $license ) {
37
  $this->extensions = $extensions;
38
  $this->license = $license;
39
  $this->api = $api;
90
  return $result;
91
  }
92
 
93
+ $plugin = null;
94
+ foreach( $this->extensions as $p ) {
95
+ // find plugin by slug
96
+ if( dirname( $p->slug() ) == $args->slug ) {
97
+ $plugin = $p;
98
+ break;
99
+ }
100
+ }
101
+
102
  // was it a plugin of ours?
103
+ if( ! empty( $plugin ) ) {
104
  return $this->get_update_info( $plugin );
105
  }
106
 
114
  public function add_updates( $updates ) {
115
 
116
  // do nothing if no plugins registered
117
+ if( empty( $this->extensions ) ) {
118
  return $updates;
119
  }
120
 
153
 
154
  // fetch remote info
155
  try {
156
+ $remote_plugins = $this->api->get_plugins();
157
  } catch( API_Exception $e ) {
158
  // set flag for 5 minutes
159
  set_transient( 'boxzilla_request_failed', strtotime('now'), 300 );
178
  // find new versions
179
  foreach( $remote_plugins as $remote_plugin ) {
180
 
181
+ if( ! isset( $this->extensions[ $remote_plugin->sid ] ) ) {
182
+ continue;
183
+ }
184
+
185
  // find corresponding local plugin
186
  /** @var Plugin $local_plugin */
187
+ $local_plugin = $this->extensions[ $remote_plugin->sid ];
 
 
 
 
 
188
 
189
  // plugin found and local plugin version not same as remote version?
190
  if( ! $local_plugin || version_compare( $local_plugin->version(), $remote_plugin->new_version, '>=' ) ) {
src/licensing/views/license-form.php CHANGED
@@ -13,7 +13,11 @@ defined( 'ABSPATH' ) or exit;
13
  <strong><?php _e( 'Warning! You are <u>not</u> receiving plugin updates for the following plugin(s):', 'boxzilla' ); ?></strong>
14
  </p>
15
  <ul class="ul-square">
16
- <li><?php echo join( '</li><li>', $this->extensions->map(function($p) { return $p->name(); }) ); ?></li>
 
 
 
 
17
  </ul>
18
  <p>
19
  To fix this, please activate your license using the form below.
13
  <strong><?php _e( 'Warning! You are <u>not</u> receiving plugin updates for the following plugin(s):', 'boxzilla' ); ?></strong>
14
  </p>
15
  <ul class="ul-square">
16
+ <?php
17
+ foreach( $this->extensions as $p ) {
18
+ echo '<li>' . esc_html( $p->name() ) . '</li>';
19
+ }
20
+ ?>
21
  </ul>
22
  <p>
23
  To fix this, please activate your license using the form below.