PixTypes - Version 1.4.12

Version Description

  • Fixed a bug where metaboxes wouldn't appear when Gutenberg editor was active.
  • Code optimization.
Download this release

Release Info

Developer babbardel
Plugin Icon wp plugin PixTypes
Version 1.4.12
Comparing to
See all releases

Code changes from version 1.4.11 to 1.4.12

callbacks/save_settings.php CHANGED
@@ -103,7 +103,6 @@ function save_pixtypes_settings( $values ){
103
 
104
  $is_jetpack_compatible = false;
105
  if ( strpos( $name, 'jetpack' ) !== FALSE ) {
106
- ///$xxxx = str_replace( 'jetpack-', '', $name);
107
  $is_jetpack_compatible = true;
108
  }
109
 
@@ -131,11 +130,6 @@ function save_pixtypes_settings( $values ){
131
  // save this settings back
132
  update_option('pixtypes_settings', $options);
133
 
134
- /** Usually these settings will change slug settings se we need to flush the permalinks */
135
- // global $wp_rewrite;
136
- // //Call flush_rules() as a method of the $wp_rewrite object
137
- // $wp_rewrite->flush_rules();
138
-
139
  /**
140
  * http://wordpress.stackexchange.com/questions/36152/flush-rewrite-rules-not-working-on-plugin-deactivation-invalid-urls-not-showing
141
  * nothing from above works in plugin so ...
103
 
104
  $is_jetpack_compatible = false;
105
  if ( strpos( $name, 'jetpack' ) !== FALSE ) {
 
106
  $is_jetpack_compatible = true;
107
  }
108
 
130
  // save this settings back
131
  update_option('pixtypes_settings', $options);
132
 
 
 
 
 
 
133
  /**
134
  * http://wordpress.stackexchange.com/questions/36152/flush-rewrite-rules-not-working-on-plugin-deactivation-invalid-urls-not-showing
135
  * nothing from above works in plugin so ...
class-pixtypes.php CHANGED
@@ -375,7 +375,7 @@ class PixTypesPlugin {
375
  // process menu icon if it exists
376
  if ( isset( $post_type_args['menu_icon'] ) ) {
377
  // If we have been given a dashicon or full URL, use it without processing
378
- if ( false === strpos( $post_type_args['menu_icon'], 'dashicon' ) && false === filter_var( $post_type_args['menu_icon'], FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED ) ) {
379
  $post_type_args['menu_icon'] = plugins_url( 'assets/' . $post_type_args['menu_icon'], __FILE__ );
380
  }
381
  }
@@ -647,7 +647,7 @@ class PixTypesPlugin {
647
  * Ajax callback for cleaning up the settings for a theme
648
  */
649
  function ajax_unset_pixtypes() {
650
- $result = array( 'success' => false, 'msg' => 'Incorect nonce' );
651
  if ( ! wp_verify_nonce( $_POST['_ajax_nonce'], 'unset_pixtype' ) ) {
652
  echo json_encode( $result );
653
  die();
375
  // process menu icon if it exists
376
  if ( isset( $post_type_args['menu_icon'] ) ) {
377
  // If we have been given a dashicon or full URL, use it without processing
378
+ if ( false === strpos( $post_type_args['menu_icon'], 'dashicon' ) && false === filter_var( $post_type_args['menu_icon'], FILTER_VALIDATE_URL ) ) {
379
  $post_type_args['menu_icon'] = plugins_url( 'assets/' . $post_type_args['menu_icon'], __FILE__ );
380
  }
381
  }
647
  * Ajax callback for cleaning up the settings for a theme
648
  */
649
  function ajax_unset_pixtypes() {
650
+ $result = array( 'success' => false, 'msg' => 'Incorrect nonce' );
651
  if ( ! wp_verify_nonce( $_POST['_ajax_nonce'], 'unset_pixtype' ) ) {
652
  echo json_encode( $result );
653
  die();
features/metaboxes/cmb-field-select2-v2/cmb-field-select2.php CHANGED
@@ -52,18 +52,6 @@ function pw_select_v2( $field, $meta ) {
52
  function pw_multiselect_v2( $field, $meta ) {
53
  $options = array();
54
 
55
- // if ( isset( $field['options'] ) && ! empty( $field['options'] ) ) {
56
- // foreach ( $field['options'] as $option_key => $option ) {
57
- // $opt_label = is_array( $option ) && array_key_exists( 'name', $option ) ? $option['name'] : $option;
58
- // $opt_value = is_array( $option ) && array_key_exists( 'value', $option ) ? $option['value'] : $option_key;
59
- //
60
- // $options[] = array(
61
- // 'id' => $opt_value,
62
- // 'text' => $opt_label
63
- // );
64
- // }
65
- // }
66
-
67
  echo '<select name="', $field['id'], '[]" id="', $field['id'], '" data-placeholder="' . $field['desc'] . '" class="select2">';
68
  echo '<option></option>';
69
  if ( isset( $field['options'] ) && ! empty( $field['options'] ) ) {
@@ -75,14 +63,6 @@ function pw_multiselect_v2( $field, $meta ) {
75
  }
76
  }
77
  echo '</select>';
78
-
79
- // wp_localize_script( 'pw-select2-field-init', $field['id'] . '_data', $options );
80
- //
81
- // if ( ! empty( $meta ) ) {
82
- // $meta = implode( ',', $meta );
83
- // }
84
- //
85
- // echo '<input type="hidden" name="' . $field['id'] . '" id="' . $field['id'] . '" data-placeholder="' . $field['desc'] . '" class="select2" value="' . $meta . '" />';
86
  }
87
 
88
  /**
52
  function pw_multiselect_v2( $field, $meta ) {
53
  $options = array();
54
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  echo '<select name="', $field['id'], '[]" id="', $field['id'], '" data-placeholder="' . $field['desc'] . '" class="select2">';
56
  echo '<option></option>';
57
  if ( isset( $field['options'] ) && ! empty( $field['options'] ) ) {
63
  }
64
  }
65
  echo '</select>';
 
 
 
 
 
 
 
 
66
  }
67
 
68
  /**
features/metaboxes/fields/pix_builder.php CHANGED
@@ -244,7 +244,5 @@ function pix_builder_display_content( $content = '', $decode = true ) {
244
  $content = apply_filters( 'prepend_attachment', $content );
245
 
246
  // in case there is a shortcode
247
- // return nl2br( $content );
248
- // return do_shortcode( $content );
249
  return $content;
250
  }
244
  $content = apply_filters( 'prepend_attachment', $content );
245
 
246
  // in case there is a shortcode
 
 
247
  return $content;
248
  }
features/metaboxes/js/cmb.js CHANGED
@@ -380,6 +380,23 @@ jQuery(document).ready(function ($) {
380
  $(selector).find('select, input:radio').trigger('change');
381
  };
382
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
383
  /**
384
  * Fold elements when the entire page is loaded
385
  * Some css classes are added dynamically, they can only be used after the load event
@@ -392,6 +409,10 @@ jQuery(document).ready(function ($) {
392
  $('.show_metabox_on').each(function () {
393
  toggle_metaboxes(this);
394
  });
 
 
 
 
395
  });
396
 
397
  var toggle_metaboxes = function(el) {
@@ -405,6 +426,8 @@ jQuery(document).ready(function ($) {
405
 
406
  if ( key == 'page-template' ) {
407
 
 
 
408
  var condition = false;
409
  $.each(value, function(key,val){
410
  if ( $('select#page_template').val() == val ) {
@@ -412,6 +435,18 @@ jQuery(document).ready(function ($) {
412
  }
413
  });
414
 
 
 
 
 
 
 
 
 
 
 
 
 
415
  if ( condition ) {
416
  display_metabox( el, !hide );
417
  } else {
@@ -447,38 +482,6 @@ jQuery(document).ready(function ($) {
447
  });
448
  });
449
 
450
- // $.ajax({
451
- // type: 'post',
452
- // dataType: 'json',
453
- // url: window.ajaxurl,
454
- // data: {
455
- // 'action': 'ajax_update_metaboxes',
456
- // 'new_page_template': $(this).val(),
457
- // 'post_ID': window.cmb_ajax_data.post_id,
458
- // 'post_type': window.cmb_ajax_data.post_type,
459
- // 'ajax_nonce': window.cmb_ajax_data.ajax_nonce
460
- // // do a nonce here
461
- // },
462
- // success: function (response) {
463
- //
464
- // if (response.hasOwnProperty('metaboxes')) {
465
- // $('#postbox-container-2').html(response.metaboxes);
466
- // }
467
- //
468
- //// // update wp-editors
469
- //// $('#postbox-container-2 .wp-editor-area').each(function (i, e) {
470
- //// var editor_id = $(e).attr('name');
471
- ////
472
- //// var editor = new tinymce.Editor(e);
473
- //// tinyMCE.add(editor);
474
- //// editor.render();
475
- //// });
476
- //
477
- // $(window).trigger('load');
478
- // }
479
- // });
480
- // });
481
-
482
  //LENS - Ahaaaaaa!!! This is so evil and shameful, but I like it
483
 
484
  //logic for the LENS homepage chooser metabox
380
  $(selector).find('select, input:radio').trigger('change');
381
  };
382
 
383
+ function showMetaboxesGutenberg() {
384
+ $('#custom_portfolio_page_settings').show();
385
+ $('.editor-block-list__layout').hide();
386
+ $('.edit-post-layout__content .edit-post-visual-editor').css(
387
+ {
388
+ 'flex-basis': 0,
389
+ 'flex': 'unset'
390
+ }
391
+ );
392
+ }
393
+
394
+ function hideMetaboxesGutenberg() {
395
+ $('#custom_portfolio_page_settings').hide();
396
+ $('.editor-block-list__layout').show();
397
+ $('.edit-post-layout__content .edit-post-visual-editor').removeAttr('style');
398
+ }
399
+
400
  /**
401
  * Fold elements when the entire page is loaded
402
  * Some css classes are added dynamically, they can only be used after the load event
409
  $('.show_metabox_on').each(function () {
410
  toggle_metaboxes(this);
411
  });
412
+
413
+ if ($('.editor-page-attributes__template select').val() === 'page-templates/custom-portfolio-page.php') {
414
+ showMetaboxesGutenberg();
415
+ }
416
  });
417
 
418
  var toggle_metaboxes = function(el) {
426
 
427
  if ( key == 'page-template' ) {
428
 
429
+ var templateSelector = $('.editor-page-attributes__template select');
430
+
431
  var condition = false;
432
  $.each(value, function(key,val){
433
  if ( $('select#page_template').val() == val ) {
435
  }
436
  });
437
 
438
+ // Make metaboxes show on Gutenberg Editor
439
+ if ($('body').hasClass('block-editor-page')) {
440
+
441
+ templateSelector.on('change', function(){
442
+ if (templateSelector.val() === 'page-templates/custom-portfolio-page.php') {
443
+ showMetaboxesGutenberg()
444
+ } else {
445
+ hideMetaboxesGutenberg();
446
+ }
447
+ });
448
+ }
449
+
450
  if ( condition ) {
451
  display_metabox( el, !hide );
452
  } else {
482
  });
483
  });
484
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
485
  //LENS - Ahaaaaaa!!! This is so evil and shameful, but I like it
486
 
487
  //logic for the LENS homepage chooser metabox
features/metaboxes/js/pixplaylist.js CHANGED
@@ -23,26 +23,6 @@
23
 
24
  var controler = wp.media.EditPixPlaylist._frame.states.get( 'video-playlist-edit' );
25
 
26
- // force display settings off
27
- //controler.attributes.displaySettings = false;
28
-
29
- //but still keep the reverse button in our modal
30
- //controler.gallerySettings = function( browser ) {
31
- // var library = this.get('library');
32
- // if ( ! library || ! browser ) {
33
- // return;
34
- // }
35
- //
36
- // library.gallery = library.gallery || new Backbone.Model();
37
- // browser.toolbar.set( 'reverse', {
38
- // text: l10n.reverseOrder,
39
- // priority: 80,
40
- // click: function() {
41
- // library.reset( library.toArray().reverse() );
42
- // }
43
- // });
44
- //};
45
-
46
  wp.media.EditPixPlaylist._frame.states.add( 'playlist-edit', controler );
47
 
48
  // on update send our attachments ids into a post meta field
23
 
24
  var controler = wp.media.EditPixPlaylist._frame.states.get( 'video-playlist-edit' );
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  wp.media.EditPixPlaylist._frame.states.add( 'playlist-edit', controler );
27
 
28
  // on update send our attachments ids into a post meta field
pixtypes.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: PixTypes
4
  * Plugin URI: https://wordpress.org/plugins/pixtypes/
5
  * Description: Custom post types and meta-boxes needed by your themes.
6
- * Version: 1.4.11
7
  * Author URI: https://pixelgrade.com
8
  * Author Email: hello@pixelgrade.com
9
  * License: GPL2+
@@ -56,4 +56,4 @@ register_activation_hook( __FILE__, array( 'PixTypesPlugin', 'activate' ) );
56
  //register_deactivation_hook( __FILE__, array( 'PixTypesPlugin', 'deactivate' ) );
57
 
58
  global $pixtypes_plugin;
59
- $pixtypes_plugin = PixTypesPlugin::get_instance( '1.4.11' );
3
  * Plugin Name: PixTypes
4
  * Plugin URI: https://wordpress.org/plugins/pixtypes/
5
  * Description: Custom post types and meta-boxes needed by your themes.
6
+ * Version: 1.4.12
7
  * Author URI: https://pixelgrade.com
8
  * Author Email: hello@pixelgrade.com
9
  * License: GPL2+
56
  //register_deactivation_hook( __FILE__, array( 'PixTypesPlugin', 'deactivate' ) );
57
 
58
  global $pixtypes_plugin;
59
+ $pixtypes_plugin = PixTypesPlugin::get_instance( '1.4.12' );
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === PixTypes ===
2
  Contributors: pixelgrade, euthelup, babbardel, vlad.olaru, cristianfrumusanu, razvanonofrei
3
  Tags: custom, post-types, metadata, builder, gallery
4
- Requires at least: 4.9.0
5
- Tested up to: 5.2.0
6
- Stable tag: 1.4.11
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -23,6 +23,10 @@ Note: This plugin is addressed to developers, it doesn't do nothing if it isn't
23
 
24
  == Changelog ==
25
 
 
 
 
 
26
  = 1.4.11 =
27
  * We did several compatibility checks with the latest WordPress releases, so that everything will be working as smoothly as always.
28
 
1
  === PixTypes ===
2
  Contributors: pixelgrade, euthelup, babbardel, vlad.olaru, cristianfrumusanu, razvanonofrei
3
  Tags: custom, post-types, metadata, builder, gallery
4
+ Requires at least: 4.9.9
5
+ Tested up to: 5.2.2
6
+ Stable tag: 1.4.12
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
23
 
24
  == Changelog ==
25
 
26
+ = 1.4.12 =
27
+ * Fixed a bug where metaboxes wouldn't appear when Gutenberg editor was active.
28
+ * Code optimization.
29
+
30
  = 1.4.11 =
31
  * We did several compatibility checks with the latest WordPress releases, so that everything will be working as smoothly as always.
32