Collapse-O-Matic - Version 1.6.5

Version Description

  • maptastic class only removed when present
  • maptastic has a max-width assigned to prevent content from entering display area.
  • updated collapse-commander integration to work with new licensing system
  • tested up to: WordPress 4.2-alpha-31047
Download this release

Release Info

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

Code changes from version 1.6.4 to 1.6.5

Files changed (5) hide show
  1. collapse-o-matic.php +142 -31
  2. dark_style.css +2 -1
  3. js/collapse.js +2 -2
  4. light_style.css +1 -0
  5. readme.txt +8 -2
collapse-o-matic.php CHANGED
@@ -5,7 +5,7 @@ Text Domain: colomat
5
  Domain Path: /languages
6
  Plugin URI: http://plugins.twinpictures.de/plugins/collapse-o-matic/
7
  Description: Collapse-O-Matic adds an [expand] shortcode that wraps content into a lovely, jQuery collapsible div.
8
- Version: 1.6.4
9
  Author: twinpictures, baden03
10
  Author URI: http://twinpictures.de/
11
  License: GPL2
@@ -16,14 +16,21 @@ License: GPL2
16
  * @package WP_Collapse_O_Matic
17
  * @category WordPress Plugins
18
  */
19
-
 
 
 
 
 
 
 
20
  class WP_Collapse_O_Matic {
21
 
22
  /**
23
  * Current version
24
  * @var string
25
  */
26
- var $version = '1.6.4';
27
 
28
  /**
29
  * Used as prefix for options entry
@@ -56,6 +63,15 @@ class WP_Collapse_O_Matic {
56
  'cc_download_key' => '',
57
  'cc_email' => ''
58
  );
 
 
 
 
 
 
 
 
 
59
 
60
  /**
61
  * PHP5 constructor
@@ -113,7 +129,7 @@ class WP_Collapse_O_Matic {
113
  if($this->options['script_location'] == 'footer' ){
114
  $load_in_footer = true;
115
  }
116
- wp_register_script('collapseomatic-js', plugins_url('js/collapse.js', __FILE__), array('jquery'), '1.5.13', $load_in_footer);
117
  if( empty($this->options['script_check']) ){
118
  wp_enqueue_script('collapseomatic-js');
119
  }
@@ -139,6 +155,7 @@ class WP_Collapse_O_Matic {
139
  function admin_init() {
140
  // register settings
141
  register_setting( $this->domain, $this->options_name );
 
142
  }
143
 
144
  /**
@@ -191,10 +208,8 @@ class WP_Collapse_O_Matic {
191
  while ( $query_commander->have_posts() ) {
192
  $query_commander->the_post();
193
  $title = get_the_title();
194
- if(get_the_content()){
195
- $content = apply_filters('the_content',get_the_content());
196
- }
197
-
198
  $meta_values = get_post_meta( $cid );
199
  foreach($meta_values as $key => $value){
200
  if(!empty($value) && $key[0] != '_'){
@@ -207,6 +222,16 @@ class WP_Collapse_O_Matic {
207
  if(!empty($highlander) && !empty($rel)){
208
  $rel .= '-highlander';
209
  }
 
 
 
 
 
 
 
 
 
 
210
  }
211
  }
212
  wp_reset_postdata();
@@ -396,7 +421,6 @@ class WP_Collapse_O_Matic {
396
  <form method="post" action="options.php">
397
  <?php
398
  settings_fields( $this->domain );
399
- $this->_set_options();
400
  $options = $this->options;
401
  ?>
402
  <fieldset class="options">
@@ -545,13 +569,13 @@ class WP_Collapse_O_Matic {
545
  <?php if( !is_plugin_active( 'collapse-commander/collapse-commander.php' ) ) : ?>
546
  <tr>
547
  <th><strong><?php _e( 'Take Command!', 'colomat' ) ?></strong></th>
548
- <td><?php printf(__( '%sCollapse Commander%s is an add-on plugin that introduces an advanced management interface to better organize expand elements and simplify expand shortcodes.', 'colomat' ), '<a href="http://plugins.twinpictures.de/premium-plugins/collapse-commander/">', '</a>'); ?>
549
  </td>
550
  </tr>
551
  <?php endif; ?>
552
  <tr>
553
  <th><strong><?php _e( 'Level Up!', 'colomat' ) ?></strong></th>
554
- <td><?php printf(__( '%sCollapse-Pro-Matic%s is our premium plugin that offers additional attributes and features for <i>ultimate</i> flexibility.', 'colomat' ), '<a href="http://plugins.twinpictures.de/premium-plugins/collapse-pro-matic/">', '</a>'); ?>
555
  </td>
556
  </tr>
557
  </table>
@@ -560,6 +584,7 @@ class WP_Collapse_O_Matic {
560
  <p class="submit">
561
  <input class="button-primary" type="submit" value="<?php _e( 'Save Changes' ) ?>" />
562
  </p>
 
563
  </div>
564
  </div>
565
  </div>
@@ -579,7 +604,9 @@ class WP_Collapse_O_Matic {
579
  <li><?php printf( __('If this plugin %s, please consider %sreviewing it at WordPress.org%s to help others.', 'colomat'), $like_it, '<a href="http://wordpress.org/support/view/plugin-reviews/jquery-collapse-o-matic" target="_blank">', '</a>' ) ?></li>
580
  <li><a href="http://wordpress.org/extend/plugins/jquery-collapse-o-matic/" target="_blank">WordPress.org</a> | <a href="http://plugins.twinpictures.de/plugins/collapse-o-matic/" target="_blank">Twinpictues Plugin Oven</a></li>
581
  </ul>
 
582
  <p style="padding: 5px; border: 1px dashed #cccc66; background: #EEE;"><strong>Limited Offer:</strong> <a href="http://plugins.twinpictures.de/premium-plugins/collapse-pro-matic/">Upgrade to Collapse-Pro-Matic</a> or add on <a href="http://plugins.twinpictures.de/premium-plugins/collapse-commander/">Collapse Commander</a> before January 1, 2015 and receive a lifetime unlimited licence. Starting in 2015, all Plugin Oven pro plugins will introduce new pricing and licensing tiers.</p>
 
583
  </div>
584
  </div>
585
  </div>
@@ -593,34 +620,66 @@ class WP_Collapse_O_Matic {
593
  <div class="postbox">
594
  <h3 class="handle"><?php _e( 'Register Collapse Commander', 'colomat') ?></h3>
595
  <div class="inside">
596
- <p><?php _e('To receive plugin updates you must register your plugin. Enter your Receipt ID and email address used to purchase the plugin below.', 'colomat'); ?></p>
 
 
 
 
 
 
597
  <fieldset>
598
- <table>
599
- <tr>
600
- <th><?php _e( 'Receipt ID', 'colomat' ) ?>:</th>
601
- <td><label><input type="password" id="<?php echo $this->options_name ?>[cc_download_key]" name="<?php echo $this->options_name ?>[cc_download_key]" value="<?php echo $options['cc_download_key']; ?>" style="width: 100%" />
602
- <br /><span class="description"><?php _e('Receipt ID is found in the Collapse Commander Purchase Receipt', 'colomat'); ?></span></label>
603
- </td>
604
- </tr>
605
-
606
- <tr>
607
- <th><?php _e( 'Email', 'colomat' ) ?>:</th>
608
- <td><label><input type="password" id="<?php echo $this->options_name ?>[cc_email]" name="<?php echo $this->options_name ?>[cc_email]" value="<?php echo $options['cc_email']; ?>" style="width: 100%" />
609
- <br /><span class="description"><?php _e('Email address used to purchase Collapse Commander', 'colomat'); ?></span></label>
610
- </td>
611
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
612
  </table>
613
  </fieldset>
614
- <p class="submit" style="margin-bottom: 20px;">
615
- <input class="button-primary" type="submit" style="float: right;" value="<?php _e( 'Register', 'colomat') ?>" />
616
- </p>
617
  </div>
618
  </div>
619
  </div>
620
  </div>
621
-
 
 
 
 
 
 
 
 
 
 
 
 
 
622
  <?php endif; ?>
623
- </form>
624
  <?php
625
  }
626
 
@@ -643,6 +702,58 @@ class WP_Collapse_O_Matic {
643
  }
644
  }
645
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
646
 
647
  } // end class WP_Collapse_O_Matic
648
 
5
  Domain Path: /languages
6
  Plugin URI: http://plugins.twinpictures.de/plugins/collapse-o-matic/
7
  Description: Collapse-O-Matic adds an [expand] shortcode that wraps content into a lovely, jQuery collapsible div.
8
+ Version: 1.6.5
9
  Author: twinpictures, baden03
10
  Author URI: http://twinpictures.de/
11
  License: GPL2
16
  * @package WP_Collapse_O_Matic
17
  * @category WordPress Plugins
18
  */
19
+
20
+ if(!defined('PLUGIN_OVEN_URL')){
21
+ define( 'PLUGIN_OVEN_URL', 'http://plugins.twinpictures.de' );
22
+ }
23
+ if(!defined('PLUGIN_OVEN_CC')){
24
+ define( 'PLUGIN_OVEN_CC', 'Collapse Commander' );
25
+ }
26
+
27
  class WP_Collapse_O_Matic {
28
 
29
  /**
30
  * Current version
31
  * @var string
32
  */
33
+ var $version = '1.6.5';
34
 
35
  /**
36
  * Used as prefix for options entry
63
  'cc_download_key' => '',
64
  'cc_email' => ''
65
  );
66
+
67
+ var $license_group = 'colomat_licenseing';
68
+
69
+ var $license_name = 'WP_Collapse_O_Matic_license';
70
+
71
+ var $license_options = array(
72
+ 'collapse_commander_license_key' => '',
73
+ 'collapse_commander_license_status' => ''
74
+ );
75
 
76
  /**
77
  * PHP5 constructor
129
  if($this->options['script_location'] == 'footer' ){
130
  $load_in_footer = true;
131
  }
132
+ wp_register_script('collapseomatic-js', plugins_url('js/collapse.js', __FILE__), array('jquery'), '1.5.14', $load_in_footer);
133
  if( empty($this->options['script_check']) ){
134
  wp_enqueue_script('collapseomatic-js');
135
  }
155
  function admin_init() {
156
  // register settings
157
  register_setting( $this->domain, $this->options_name );
158
+ register_setting( $this->license_group, $this->license_name, array($this, 'edd_sanitize_license') );
159
  }
160
 
161
  /**
208
  while ( $query_commander->have_posts() ) {
209
  $query_commander->the_post();
210
  $title = get_the_title();
211
+
212
+ //meta values
 
 
213
  $meta_values = get_post_meta( $cid );
214
  foreach($meta_values as $key => $value){
215
  if(!empty($value) && $key[0] != '_'){
222
  if(!empty($highlander) && !empty($rel)){
223
  $rel .= '-highlander';
224
  }
225
+
226
+ //content
227
+ if(get_the_content()){
228
+ if(empty($filter)){
229
+ $content = get_the_content();
230
+ }else{
231
+ $content = apply_filters( 'the_content', get_the_content() );
232
+ $content = str_replace( ']]>', ']]&gt;', $content );
233
+ }
234
+ }
235
  }
236
  }
237
  wp_reset_postdata();
421
  <form method="post" action="options.php">
422
  <?php
423
  settings_fields( $this->domain );
 
424
  $options = $this->options;
425
  ?>
426
  <fieldset class="options">
569
  <?php if( !is_plugin_active( 'collapse-commander/collapse-commander.php' ) ) : ?>
570
  <tr>
571
  <th><strong><?php _e( 'Take Command!', 'colomat' ) ?></strong></th>
572
+ <td><?php printf(__( '%sCollapse Commander%s is an add-on plugin that introduces an advanced management interface to better organize expand elements and simplify expand shortcodes.', 'colomat' ), '<a href="http://plugins.twinpictures.de/premium-plugins/collapse-commander/?utm_source=collapse-o-matic&utm_medium=plugin-settings-page&utm_content=collapse-commander&utm_campaign=collapse-o-matic-commander">', '</a>'); ?>
573
  </td>
574
  </tr>
575
  <?php endif; ?>
576
  <tr>
577
  <th><strong><?php _e( 'Level Up!', 'colomat' ) ?></strong></th>
578
+ <td><?php printf(__( '%sCollapse-Pro-Matic%s is our premium plugin that offers additional attributes and features for <i>ultimate</i> flexibility.', 'colomat' ), '<a href="http://plugins.twinpictures.de/premium-plugins/collapse-pro-matic/?utm_source=collapse-o-matic&utm_medium=plugin-settings-page&utm_content=collapse-pro-matic&utm_campaign=collapse-o-matic-pro">', '</a>'); ?>
579
  </td>
580
  </tr>
581
  </table>
584
  <p class="submit">
585
  <input class="button-primary" type="submit" value="<?php _e( 'Save Changes' ) ?>" />
586
  </p>
587
+ </form>
588
  </div>
589
  </div>
590
  </div>
604
  <li><?php printf( __('If this plugin %s, please consider %sreviewing it at WordPress.org%s to help others.', 'colomat'), $like_it, '<a href="http://wordpress.org/support/view/plugin-reviews/jquery-collapse-o-matic" target="_blank">', '</a>' ) ?></li>
605
  <li><a href="http://wordpress.org/extend/plugins/jquery-collapse-o-matic/" target="_blank">WordPress.org</a> | <a href="http://plugins.twinpictures.de/plugins/collapse-o-matic/" target="_blank">Twinpictues Plugin Oven</a></li>
606
  </ul>
607
+ <!--
608
  <p style="padding: 5px; border: 1px dashed #cccc66; background: #EEE;"><strong>Limited Offer:</strong> <a href="http://plugins.twinpictures.de/premium-plugins/collapse-pro-matic/">Upgrade to Collapse-Pro-Matic</a> or add on <a href="http://plugins.twinpictures.de/premium-plugins/collapse-commander/">Collapse Commander</a> before January 1, 2015 and receive a lifetime unlimited licence. Starting in 2015, all Plugin Oven pro plugins will introduce new pricing and licensing tiers.</p>
609
+ -->
610
  </div>
611
  </div>
612
  </div>
620
  <div class="postbox">
621
  <h3 class="handle"><?php _e( 'Register Collapse Commander', 'colomat') ?></h3>
622
  <div class="inside">
623
+ <p><?php printf( __('To receive plugin updates you must register your plugin. Enter your Collapse Commander licence key below. Licence keys may be viewed and manged by logging into %syour account%s.', 'colpromat'), '<a href="http://plugins.twinpictures.de/your-account/" target="_blank">', '</a>'); ?></p>
624
+ <form method="post" action="options.php">
625
+ <?php
626
+ settings_fields( $this->license_group );
627
+ $options = get_option($this->license_name);
628
+ $cc_licence = ( !isset( $options['collapse_commander_license_key'] ) ) ? '' : $options['collapse_commander_license_key'];
629
+ ?>
630
  <fieldset>
631
+ <table style="width: 100%">
632
+ <tbody>
633
+ <tr>
634
+ <th><?php _e( 'License Key', 'colpromat' ) ?>:</th>
635
+ <td><label for="<?php echo $this->license_name ?>[collapse_commander_license_key]"><input type="text" id="<?php echo $this->license_name ?>[collapse_commander_license_key]" name="<?php echo $this->license_name ?>[collapse_commander_license_key]" value="<?php esc_attr_e( $cc_licence ); ?>" style="width: 100%" />
636
+ <br /><span class="description"><?php _e('Enter your license key', 'colpromat'); ?></span></label>
637
+ </td>
638
+
639
+ </tr>
640
+
641
+ <?php if( isset($options['collapse_commander_license_key']) ) { ?>
642
+ <tr valign="top">
643
+ <th><?php _e('License Status', 'colpromat'); ?>:</th>
644
+ <td>
645
+ <?php if( isset($options['collapse_commander_license_status']) && $options['collapse_commander_license_status'] == 'valid' ) { ?>
646
+ <span style="color:green;"><?php _e('active'); ?></span><br/>
647
+ <input type="submit" class="button-secondary" name="edd_cc_license_deactivate" value="<?php _e('Deactivate License'); ?>"/>
648
+ <?php } else {
649
+ if( isset($options['collapse_commander_license_status']) ){ ?>
650
+ <span style="color: red"><?php echo $options['collapse_commander_license_status']; ?></span><br/>
651
+ <?php } else { ?>
652
+ <span style="color: grey">inactive</span><br/>
653
+ <?php } ?>
654
+ <input type="submit" class="button-secondary" name="edd_cc_license_activate" value="<?php _e('Activate License'); ?>"/>
655
+ <?php } ?>
656
+ </td>
657
+ </tr>
658
+ <?php } ?>
659
+ </tbody>
660
  </table>
661
  </fieldset>
662
+ <?php submit_button( __( 'Register', 'colpromat') ); ?>
663
+ </form>
 
664
  </div>
665
  </div>
666
  </div>
667
  </div>
668
+ <?php else: ?>
669
+ <div class="postbox-container side metabox-holder meta-box-sortables" style="width:29%;">
670
+ <div style="margin:0 5px;">
671
+ <div class="postbox">
672
+ <div class="handlediv" title="<?php _e( 'Click to toggle', 'colomat' ) ?>"><br/></div>
673
+ <h3 class="hndle">Collapse Commander</h3>
674
+ <div class="inside">
675
+ <p>A brief and not-exactly-sober overview of <a href="http://plugins.twinpictures.de/premium-plugins/collapse-commander/?utm_source=collapse-o-matic&utm_medium=plugin-settings-page&utm_content=collapse-commander&utm_campaign=collapse-o-matic-commander">Collapse Commander</a>, a new add-on plugin for Collapse-O-Matic and Collapse-Pro-Matic that adds and advanded expand shortcode management system.</p>
676
+ <iframe width="100%" height="300" src="//www.youtube.com/embed/w9X4nXpAEfo" frameborder="0" allowfullscreen></iframe>
677
+ </div>
678
+ </div>
679
+ </div>
680
+ <div class="clear"></div>
681
+ </div>
682
  <?php endif; ?>
 
683
  <?php
684
  }
685
 
702
  }
703
  }
704
  }
705
+
706
+ function edd_sanitize_license( $new ) {
707
+ //collapse commander
708
+ $options = get_option($this->license_name);
709
+ $old_cc = ( !isset( $options['collapse_commander_license_key'] ) ) ? '' : $options['collapse_commander_license_key'];
710
+ $old_cc_status = ( !isset( $options['collapse_commander_license_status'] ) ) ? '' : $options['collapse_commander_license_status'];
711
+
712
+ if( !empty($old_cc) && $old_cc != $new['collapse_commander_license_key'] ) {
713
+ $new['collapse_commander_license_status'] = '';
714
+ }
715
+ else{
716
+ $new['collapse_commander_license_status'] = $old_cc_status;
717
+ }
718
+
719
+ if( isset( $_POST['edd_cc_license_activate'] ) ) {
720
+ $new['collapse_commander_license_status'] = $this->plugin_oven_activate_license( urlencode( PLUGIN_OVEN_CC ), $new['collapse_commander_license_key'], 'activate_license');
721
+ }
722
+
723
+ if( isset( $_POST['edd_cc_license_deactivate'] ) ) {
724
+ $new['collapse_commander_license_status'] = $this->plugin_oven_activate_license( urlencode( PLUGIN_OVEN_CC ), $new['collapse_commander_license_key'], 'deactivate_license');
725
+ }
726
+ return $new;
727
+ }
728
+
729
+
730
+ /************************************
731
+ * this illustrates how to activate
732
+ * a license key
733
+ *************************************/
734
+
735
+ function plugin_oven_activate_license($plugin_name, $license_key, $edd_action) {
736
+ // data to send in our API request
737
+ $api_params = array(
738
+ 'edd_action' => $edd_action,
739
+ 'license' => $license_key,
740
+ 'item_name' => $plugin_name,
741
+ 'url' => home_url()
742
+ );
743
+
744
+ // Call the custom API.
745
+ $response = wp_remote_get( add_query_arg( $api_params, PLUGIN_OVEN_URL ), array( 'timeout' => 15, 'sslverify' => false ) );
746
+
747
+ // make sure the response came back okay
748
+ if ( is_wp_error( $response ) )
749
+ return false;
750
+
751
+ // decode the license data
752
+ $license_data = json_decode( wp_remote_retrieve_body( $response ) );
753
+
754
+ // $license_data->license will be either "valid" or "invalid"
755
+ return $license_data->license;
756
+ }
757
 
758
  } // end class WP_Collapse_O_Matic
759
 
dark_style.css CHANGED
@@ -36,9 +36,10 @@
36
  text-decoration: underline;
37
  }
38
  .maptastic {
39
- position: absolute !important;
40
  left: -10000px !important;
41
  display:block !important;
 
42
  }
43
  .span_fix {
44
  padding: 0 !important;
36
  text-decoration: underline;
37
  }
38
  .maptastic {
39
+ position: absolute !important;
40
  left: -10000px !important;
41
  display:block !important;
42
+ max-width: 9999px;
43
  }
44
  .span_fix {
45
  padding: 0 !important;
js/collapse.js CHANGED
@@ -1,5 +1,5 @@
1
  /*!
2
- * Collapse-O-Matic JavaSctipt v1.5.13
3
  * http://plugins.twinpictures.de/plugins/collapse-o-matic/
4
  *
5
  * Copyright 2014, Twinpictures
@@ -62,7 +62,7 @@ function swapTitle(origObj, swapObj){
62
  }
63
 
64
  function toggleState (obj, id, maptastic, trig_id) {
65
- if (maptastic) {
66
  jQuery('[id^=target][id$='+id+']').removeClass('maptastic');
67
  }
68
 
1
  /*!
2
+ * Collapse-O-Matic JavaSctipt v1.5.14
3
  * http://plugins.twinpictures.de/plugins/collapse-o-matic/
4
  *
5
  * Copyright 2014, Twinpictures
62
  }
63
 
64
  function toggleState (obj, id, maptastic, trig_id) {
65
+ if (maptastic && jQuery('[id^=target][id$='+id+']').hasClass('maptastic') ) {
66
  jQuery('[id^=target][id$='+id+']').removeClass('maptastic');
67
  }
68
 
light_style.css CHANGED
@@ -39,6 +39,7 @@
39
  position: absolute !important;
40
  left: -10000px !important;
41
  display:block !important;
 
42
  }
43
  .span_fix {
44
  padding: 0 !important;
39
  position: absolute !important;
40
  left: -10000px !important;
41
  display:block !important;
42
+ max-width: 9999px;
43
  }
44
  .span_fix {
45
  padding: 0 !important;
readme.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: twinpictures, baden03
4
  Donate link: http://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: 3.9
7
- Tested up to: 4.1
8
- Stable tag: 1.6.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -50,6 +50,12 @@ No. Not even close.
50
 
51
  == Changelog ==
52
 
 
 
 
 
 
 
53
  = 1.6.4 =
54
  * added plugin to GitHub: https://github.com/baden03/collapse-o-matic
55
  * added new tabindex attribute to shortcode and options page
4
  Donate link: http://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: 3.9
7
+ Tested up to: 4.2
8
+ Stable tag: 1.6.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
50
 
51
  == Changelog ==
52
 
53
+ = 1.6.5 =
54
+ * maptastic class only removed when present
55
+ * maptastic has a max-width assigned to prevent content from entering display area.
56
+ * updated collapse-commander integration to work with new licensing system
57
+ * tested up to: WordPress 4.2-alpha-31047
58
+
59
  = 1.6.4 =
60
  * added plugin to GitHub: https://github.com/baden03/collapse-o-matic
61
  * added new tabindex attribute to shortcode and options page