Boxzilla - Version 3.1.18

Version Description

Download this release

Release Info

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

Code changes from version 3.1.17 to 3.1.18

Files changed (4) hide show
  1. boxzilla.php +2 -2
  2. readme.txt +8 -1
  3. src/class-box.php +8 -2
  4. src/default-actions.php +16 -1
boxzilla.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Boxzilla
4
- Version: 3.1.17
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.1.17' );
45
 
46
  require __DIR__ . '/bootstrap.php';
47
  }
1
  <?php
2
  /*
3
  Plugin Name: Boxzilla
4
+ Version: 3.1.18
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.1.18' );
45
 
46
  require __DIR__ . '/bootstrap.php';
47
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://boxzillaplugin.com/#utm_source=wp-plugin-repo&utm_medium=bo
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.8.1
7
- Stable tag: 3.1.17
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.1.17 - August 30, 2017
154
 
155
  **Fixes**
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.8.1
7
+ Stable tag: 3.1.18
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.1.18 - September 7, 2017
154
+
155
+ **Additions**
156
+
157
+ - Added [`[boxzilla_link]` shortcode to generate the correct HTML for a link to show/toggle/hide/dismiss a box](https://kb.boxzillaplugin.com/shortcode-boxzilla-link/).
158
+
159
+
160
  #### 3.1.17 - August 30, 2017
161
 
162
  **Fixes**
src/class-box.php CHANGED
@@ -180,9 +180,15 @@ class Box {
180
 
181
  // replace boxzilla specific shortcodes
182
  $close_link = sprintf('<a href="javascript:Boxzilla.dismiss(%d);">', $this->ID );
183
- $content = str_replace( '[boxzilla-close]', $close_link, $content );
184
- $content = str_replace( '[/boxzilla-close]', '</a>', $content );
185
 
 
 
 
 
 
 
 
 
186
 
187
  /**
188
  * Filters the HTML for the box content
180
 
181
  // replace boxzilla specific shortcodes
182
  $close_link = sprintf('<a href="javascript:Boxzilla.dismiss(%d);">', $this->ID );
 
 
183
 
184
+ $replacements = array(
185
+ '[boxzilla_close]' => $close_link, // accept underscore and dash here for consistency with other shortcode
186
+ '[boxzilla-close]' => $close_link,
187
+ '[/boxzilla_close]' => '</a>',
188
+ '[/boxzilla-close]' => '</a>',
189
+ );
190
+
191
+ $content = str_replace( array_keys( $replacements ), array_values( $replacements ), $content );
192
 
193
  /**
194
  * Filters the HTML for the box content
src/default-actions.php CHANGED
@@ -30,4 +30,19 @@ add_action( 'init', function() use( $boxzilla ){
30
  );
31
 
32
  register_post_type( 'boxzilla-box', $args );
33
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  );
31
 
32
  register_post_type( 'boxzilla-box', $args );
33
+
34
+ add_shortcode( 'boxzilla_link', 'boxzilla_get_link_html' );
35
+ });
36
+
37
+ function boxzilla_get_link_html( $args = array(), $content = '' ) {
38
+ $valid_actions = array(
39
+ 'show',
40
+ 'toggle',
41
+ 'hide',
42
+ 'dismiss'
43
+ );
44
+ $box_id = empty( $args['box'] ) ? '' : absint( $args['box'] );
45
+ $class_attr = empty( $args['class'] ) ? '' : esc_attr( $args['class'] );
46
+ $action = empty( $args['action'] ) || ! in_array( $args['action'], $valid_actions ) ? 'show' : $args['action'];
47
+ return sprintf( '<a href="javascript:Boxzilla.%s(%s)" class="%s">', $action, $box_id, $class_attr ) . $content . '</a>';
48
+ }