Collapse-O-Matic - Version 1.8.1

Version Description

  • options passed using the preferred wp_add_inline_script
Download this release

Release Info

Developer baden03
Plugin Icon 128x128 Collapse-O-Matic
Version 1.8.1
Comparing to
See all releases

Code changes from version 1.8.0 to 1.8.1

README.md CHANGED
@@ -4,7 +4,7 @@
4
  * Tags: collapse, expand, collapsible, expandable, expandable content, collapsable content, shortcode, hidden, hide, display, accordion, accordion, jQuery, javascript, roll-your-own, twinpictures, read me, read more, more, plugin oven
5
  * Requires at least: 4.9
6
  * Tested up to: 5.8.1
7
- * Stable tag: 1.8.0
8
  * Requires PHP: 7.2
9
  * License: GPLv2 or later
10
  * License URI: https://www.gnu.org/licenses/gpl-2.0.html
4
  * Tags: collapse, expand, collapsible, expandable, expandable content, collapsable content, shortcode, hidden, hide, display, accordion, accordion, jQuery, javascript, roll-your-own, twinpictures, read me, read more, more, plugin oven
5
  * Requires at least: 4.9
6
  * Tested up to: 5.8.1
7
+ * Stable tag: 1.8.1
8
  * Requires PHP: 7.2
9
  * License: GPLv2 or later
10
  * License URI: https://www.gnu.org/licenses/gpl-2.0.html
collapse-o-matic.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Collapse-O-Matic
4
  Text Domain: jquery-collapse-o-matic
5
  Plugin URI: https://pluginoven.com/plugins/collapse-o-matic/
6
  Description: Collapse-O-Matic adds an [expand] shortcode that wraps content into a lovely, jQuery collapsible div.
7
- Version: 1.8.0
8
  Author: twinpictures, baden03
9
  Author URI: https://twinpictures.de/
10
  License: GPL2
@@ -29,7 +29,7 @@ class WP_Collapse_O_Matic {
29
  * Current version
30
  * @var string
31
  */
32
- var $version = '1.8.0';
33
 
34
  /**
35
  * Used as prefix for options entry
@@ -72,12 +72,12 @@ class WP_Collapse_O_Matic {
72
 
73
  var $license_group = 'colomat_licenseing';
74
 
75
- var $license_name = 'WP_Collapse_O_Matic_license';
76
 
77
- var $license_options = array(
78
- 'collapse_commander_license_key' => '',
79
- 'collapse_commander_license_status' => ''
80
- );
81
 
82
  /**
83
  * PHP5 constructor
@@ -120,14 +120,14 @@ class WP_Collapse_O_Matic {
120
  }
121
  wp_register_script('collapseomatic-js', plugins_url('js/collapse.js', __FILE__), array('jquery'), '1.7.0', $load_in_footer);
122
 
123
- //localize with options
124
- $com_options = array(
125
  'colomatduration' => $this->options['duration'],
126
  'colomatslideEffect' => $this->options['slideEffect'],
127
  'colomatpauseInit' => $this->options['pauseinit'],
128
  'colomattouchstart' => $this->options['touch_start']
129
- );
130
- wp_localize_script('collapseomatic-js', 'com_options', $com_options );
131
 
132
  if( empty($this->options['script_check']) ){
133
  wp_enqueue_script('collapseomatic-js');
@@ -135,7 +135,7 @@ class WP_Collapse_O_Matic {
135
 
136
  //css
137
  if ($this->options['style'] !== 'none') {
138
- wp_register_style( 'collapseomatic-css', plugins_url('/'.$this->options['style'].'_style.css', __FILE__) , array (), '1.6' );
139
  if( !empty( $this->options['custom_css'] ) ){
140
  wp_add_inline_style( 'collapseomatic-css', $this->options['custom_css'] );
141
  }
@@ -152,7 +152,7 @@ class WP_Collapse_O_Matic {
152
  [
153
  'type' => 'text/css',
154
  'codemirror' => [
155
- 'lineNumbers' => false,
156
  'autoRefresh' => true
157
  ]
158
  ]
@@ -161,6 +161,8 @@ class WP_Collapse_O_Matic {
161
  wp_enqueue_script( 'cm_js' );
162
  wp_enqueue_script( 'wp-theme-plugin-editor' );
163
  wp_enqueue_style( 'wp-codemirror' );
 
 
164
  }
165
  }
166
 
@@ -616,7 +618,7 @@ class WP_Collapse_O_Matic {
616
  $options['duration'] = 'fast';
617
  }
618
  ?>
619
- <th><?php _e( 'Collapse/Expand Duration', 'jquery-collapse-o-matic' ) ?>:</th>
620
  <td><label><input type="text" id="duration" name="<?php echo esc_attr($this->options_name); ?>[duration]" value="<?php echo esc_attr($options['duration']); ?>" />
621
  <br /><span class="description"><?php printf(__('A string or number determining how long the animation will run. See %sDuration%s in the documentation for more info.', 'jquery-collapse-o-matic'), '<a href="https://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/#duration" target="_blank">', '</a>'); ?></span></label>
622
  </td>
@@ -680,14 +682,14 @@ class WP_Collapse_O_Matic {
680
  <?php endif; ?>
681
 
682
  <tr>
683
- <th><?php _e( 'Shortcode Loads Scripts', 'jquery-collapse-o-matic' ) ?>:</th>
684
  <td><label><input type="checkbox" id="script_check" name="<?php echo esc_attr($this->options_name); ?>[script_check]" value="1" <?php echo checked( $options['script_check'], 1 ); ?> /> <?php _e('Only load scripts with shortcode.', 'jquery-collapse-o-matic'); ?>
685
  <br /><span class="description"><?php _e('Only load Collapse-O-Matic scripts if [expand] shortcode is used.', 'jquery-collapse-o-matic'); ?></span></label>
686
  </td>
687
  </tr>
688
 
689
  <tr>
690
- <th><?php _e( 'Shortcode Loads CSS', 'jquery-collapse-o-matic' ) ?>:</th>
691
  <td><label><input type="checkbox" id="css_check" name="<?php echo esc_attr($this->options_name); ?>[css_check]" value="1" <?php echo checked( $options['css_check'], 1 ); ?> /> <?php _e('Only load CSS with shortcode.', 'jquery-collapse-o-matic'); ?>
692
  <br /><span class="description"><?php _e('Only load Collapse-O-Matic CSS if [expand] shortcode is used.', 'jquery-collapse-o-matic'); ?></span></label>
693
  </td>
4
  Text Domain: jquery-collapse-o-matic
5
  Plugin URI: https://pluginoven.com/plugins/collapse-o-matic/
6
  Description: Collapse-O-Matic adds an [expand] shortcode that wraps content into a lovely, jQuery collapsible div.
7
+ Version: 1.8.1
8
  Author: twinpictures, baden03
9
  Author URI: https://twinpictures.de/
10
  License: GPL2
29
  * Current version
30
  * @var string
31
  */
32
+ var $version = '1.8.1';
33
 
34
  /**
35
  * Used as prefix for options entry
72
 
73
  var $license_group = 'colomat_licenseing';
74
 
75
+ var $license_name = 'WP_Collapse_O_Matic_license';
76
 
77
+ var $license_options = array(
78
+ 'collapse_commander_license_key' => '',
79
+ 'collapse_commander_license_status' => ''
80
+ );
81
 
82
  /**
83
  * PHP5 constructor
120
  }
121
  wp_register_script('collapseomatic-js', plugins_url('js/collapse.js', __FILE__), array('jquery'), '1.7.0', $load_in_footer);
122
 
123
+ //prep options for injection
124
+ $com_options = [
125
  'colomatduration' => $this->options['duration'],
126
  'colomatslideEffect' => $this->options['slideEffect'],
127
  'colomatpauseInit' => $this->options['pauseinit'],
128
  'colomattouchstart' => $this->options['touch_start']
129
+ ];
130
+ wp_add_inline_script( 'collapseomatic-js', 'const com_options = ' . json_encode( $com_options ), 'before' );
131
 
132
  if( empty($this->options['script_check']) ){
133
  wp_enqueue_script('collapseomatic-js');
135
 
136
  //css
137
  if ($this->options['style'] !== 'none') {
138
+ wp_register_style( 'collapseomatic-css', plugins_url('css/'.$this->options['style'].'_style.css', __FILE__) , array (), '1.6' );
139
  if( !empty( $this->options['custom_css'] ) ){
140
  wp_add_inline_style( 'collapseomatic-css', $this->options['custom_css'] );
141
  }
152
  [
153
  'type' => 'text/css',
154
  'codemirror' => [
155
+ 'lineNumbers' => true,
156
  'autoRefresh' => true
157
  ]
158
  ]
161
  wp_enqueue_script( 'cm_js' );
162
  wp_enqueue_script( 'wp-theme-plugin-editor' );
163
  wp_enqueue_style( 'wp-codemirror' );
164
+ wp_register_style( 'com-admin-css', plugins_url('css/admin_style.css', __FILE__) , array (), '1.0.0' );
165
+ wp_enqueue_style( 'com-admin-css' );
166
  }
167
  }
168
 
618
  $options['duration'] = 'fast';
619
  }
620
  ?>
621
+ <th><?php _e( 'Animation Duration', 'jquery-collapse-o-matic' ) ?>:</th>
622
  <td><label><input type="text" id="duration" name="<?php echo esc_attr($this->options_name); ?>[duration]" value="<?php echo esc_attr($options['duration']); ?>" />
623
  <br /><span class="description"><?php printf(__('A string or number determining how long the animation will run. See %sDuration%s in the documentation for more info.', 'jquery-collapse-o-matic'), '<a href="https://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/#duration" target="_blank">', '</a>'); ?></span></label>
624
  </td>
682
  <?php endif; ?>
683
 
684
  <tr>
685
+ <th><?php _e( 'Shortcode Scripts', 'jquery-collapse-o-matic' ) ?>:</th>
686
  <td><label><input type="checkbox" id="script_check" name="<?php echo esc_attr($this->options_name); ?>[script_check]" value="1" <?php echo checked( $options['script_check'], 1 ); ?> /> <?php _e('Only load scripts with shortcode.', 'jquery-collapse-o-matic'); ?>
687
  <br /><span class="description"><?php _e('Only load Collapse-O-Matic scripts if [expand] shortcode is used.', 'jquery-collapse-o-matic'); ?></span></label>
688
  </td>
689
  </tr>
690
 
691
  <tr>
692
+ <th><?php _e( 'Shortcode CSS', 'jquery-collapse-o-matic' ) ?>:</th>
693
  <td><label><input type="checkbox" id="css_check" name="<?php echo esc_attr($this->options_name); ?>[css_check]" value="1" <?php echo checked( $options['css_check'], 1 ); ?> /> <?php _e('Only load CSS with shortcode.', 'jquery-collapse-o-matic'); ?>
694
  <br /><span class="description"><?php _e('Only load Collapse-O-Matic CSS if [expand] shortcode is used.', 'jquery-collapse-o-matic'); ?></span></label>
695
  </td>
dark_style.css → css/dark_style.css RENAMED
File without changes
{images → css/images}/arrow-down-dark.png RENAMED
File without changes
{images → css/images}/arrow-down.png RENAMED
File without changes
{images → css/images}/arrow-up-dark.png RENAMED
File without changes
{images → css/images}/arrow-up.png RENAMED
File without changes
{images → css/images}/arrows.psd RENAMED
File without changes
{images → css/images}/collapse-o-matic-icon.png RENAMED
File without changes
light_style.css → css/light_style.css RENAMED
File without changes
js/collapse.js CHANGED
@@ -3,25 +3,6 @@
3
  * https://pluginoven.com/plugins/collapse-o-matic/
4
  *
5
  * Copyright 2021, Twinpictures
6
- *
7
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8
- * of this software and associated documentation files (the "Software"), to deal
9
- * in the Software without restriction, including without limitation the rights
10
- * to use, copy, modify, merge, publish, distribute, sublicense, blend, trade,
11
- * bake, hack, scramble, difiburlate, digest and/or sell copies of the Software,
12
- * and to permit persons to whom the Software is furnished to do so, subject to
13
- * the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in
16
- * all copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
  */
26
 
27
  function collapse_init() {
@@ -80,8 +61,6 @@ function swapTitle(origObj, swapObj){
80
  }
81
 
82
  function toggleState (obj, id, maptastic, trig_id) {
83
- //toggletarget class
84
- //jQuery('[id^=target][id$='+id+']').toggleClass('colomat-targ-visable');
85
 
86
  if (maptastic && jQuery('[id^=target][id$='+id+']').hasClass('maptastic') ) {
87
  jQuery('[id^=target][id$='+id+']').removeClass('maptastic');
@@ -402,11 +381,11 @@ function colomat_collapseall(loop_items){
402
 
403
  jQuery(document).ready(function() {
404
  com_binding = 'click';
405
- if (typeof com_options.colomattouchstart !== 'undefined' && com_options.colomattouchstart) {
406
  com_binding = 'click touchstart';
407
  }
408
 
409
- if (typeof com_options.colomatpauseInit !== 'undefined' && com_options.colomatpauseInit) {
410
  init_pause = setTimeout(collapse_init, com_options.colomatpauseInit);
411
  }
412
  else{
3
  * https://pluginoven.com/plugins/collapse-o-matic/
4
  *
5
  * Copyright 2021, Twinpictures
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  */
7
 
8
  function collapse_init() {
61
  }
62
 
63
  function toggleState (obj, id, maptastic, trig_id) {
 
 
64
 
65
  if (maptastic && jQuery('[id^=target][id$='+id+']').hasClass('maptastic') ) {
66
  jQuery('[id^=target][id$='+id+']').removeClass('maptastic');
381
 
382
  jQuery(document).ready(function() {
383
  com_binding = 'click';
384
+ if (com_options.colomattouchstart) {
385
  com_binding = 'click touchstart';
386
  }
387
 
388
+ if (com_options.colomatpauseInit) {
389
  init_pause = setTimeout(collapse_init, com_options.colomatpauseInit);
390
  }
391
  else{
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://plugins.twinpictures.de/plugins/collapse-o-matic/
5
  Tags: collapse, expand, collapsible, expandable, expandable content, collapsable content, shortcode, hidden, hide, display, accordion, accordion, jQuery, javascript, roll-your-own, twinpictures, read me, read more, more, plugin oven
6
  Requires at least: 4.9
7
  Tested up to: 5.8.1
8
- Stable tag: 1.8.0
9
  Requires PHP: 7.2
10
  License: GPLv2 or later
11
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -51,6 +51,9 @@ No. Not even close.
51
 
52
  == Changelog ==
53
 
 
 
 
54
  = 1.8.0 =
55
  * improved collapse-commander integration
56
  * improved method of adding custom css
@@ -396,7 +399,4 @@ Fixed auto-expand of urls with id-anchors
396
  * The plug-in came to be.
397
 
398
  == Upgrade Notice ==
399
- * improved collapse-commander integration
400
- * improved method of adding custom css
401
- * options passed using wp_localize_script
402
- * escaped options to improve security
5
  Tags: collapse, expand, collapsible, expandable, expandable content, collapsable content, shortcode, hidden, hide, display, accordion, accordion, jQuery, javascript, roll-your-own, twinpictures, read me, read more, more, plugin oven
6
  Requires at least: 4.9
7
  Tested up to: 5.8.1
8
+ Stable tag: 1.8.1
9
  Requires PHP: 7.2
10
  License: GPLv2 or later
11
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
51
 
52
  == Changelog ==
53
 
54
+ = 1.8.1 =
55
+ * options passed using the preferred wp_add_inline_script
56
+
57
  = 1.8.0 =
58
  * improved collapse-commander integration
59
  * improved method of adding custom css
399
  * The plug-in came to be.
400
 
401
  == Upgrade Notice ==
402
+ * options passed using the preferred wp_add_inline_script