Custom Post Type UI - Version 1.8.1

Version Description

  • 2020-09-21 =
  • Fixed: Issues with WP-CLI importing.
  • Added: Menu icon preview that should have been in 1.8.0, but was missed. Props @glebkema
Download this release

Release Info

Developer tw2113
Plugin Icon 128x128 Custom Post Type UI
Version 1.8.1
Comparing to
See all releases

Code changes from version 1.8.0 to 1.8.1

classes/class.cptui_admin_ui.php CHANGED
@@ -540,6 +540,26 @@ class cptui_admin_ui {
540
  return $value;
541
  }
542
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
543
  /**
544
  * Return some array_merged default arguments for all input types.
545
  *
540
  return $value;
541
  }
542
 
543
+ /**
544
+ * Returns an HTML block for previewing the menu icon.
545
+ *
546
+ * @param string $menu_icon URL or a name of the dashicons class.
547
+ *
548
+ * @return string $value HTML block with a layout of the menu icon preview.
549
+ * @since 1.8.1
550
+ */
551
+ public function get_menu_icon_preview( $menu_icon = '' ) {
552
+ $content = '';
553
+ if ( ! empty( $menu_icon ) ) {
554
+ $content = '<img src="' . $menu_icon . '">';
555
+ if ( 0 === strpos( $menu_icon, 'dashicons-' ) ) {
556
+ $content = '<div class="dashicons-before ' . $menu_icon . '"></div>';
557
+ }
558
+ }
559
+
560
+ return '<div id="menu_icon_preview">' . $content . '</div>';
561
+ }
562
+
563
  /**
564
  * Return some array_merged default arguments for all input types.
565
  *
css/cptui.css CHANGED
@@ -259,6 +259,17 @@ fieldset .cptui-help {
259
  box-shadow: none;
260
  }
261
 
 
 
 
 
 
 
 
 
 
 
 
262
  #toplevel_page_cptui_main_menu img {
263
  height: 20px;
264
  margin-top: -2px;
259
  box-shadow: none;
260
  }
261
 
262
+ #menu_icon_preview {
263
+ float: right;
264
+ padding-left: 8px;
265
+ }
266
+
267
+ #menu_icon_preview img {
268
+ display: block;
269
+ height: 20px;
270
+ width: 20px;
271
+ }
272
+
273
  #toplevel_page_cptui_main_menu img {
274
  height: 20px;
275
  margin-top: -2px;
css/cptui.min.css CHANGED
@@ -1 +1 @@
1
- .posttypesui,.taxonomiesui{width:calc(100% - 300px)}.posttypesui .cptui-section:first-child,.taxonomiesui .cptui-section:first-child{margin-top:30px}.posttypesui .postbox-container,.taxonomiesui .postbox-container{width:100%}.posttypesui .postbox .toggle-indicator:before,.taxonomiesui .postbox .toggle-indicator:before{content:"\f142";display:inline-block;font:normal 20px/1 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none!important}.posttypesui .postbox.closed .handlediv .toggle-indicator:before,.taxonomiesui .postbox.closed .handlediv .toggle-indicator:before{content:"\f140"}.posttypesui .postbox .hndle,.taxonomiesui .postbox .hndle{cursor:pointer}.posttypesui .required,.taxonomiesui .required{color:red}.cptui-table #excerpt{display:inline-block;height:16px;margin:12px 4px 12px 0;width:auto}.cptui-table td.outer{vertical-align:top;width:50%}.cptui-edit .cptui-table textarea,.cptui-new .cptui-table textarea,.cptui-table input[type=text]{width:75%}.cptui-table .question:hover{cursor:pointer}.cptui-table th p{font-weight:400;font-size:12px}.cptui-table .cptui-slug-details{margin-top:15px}.cptui-table #slugchanged,.cptui-table #slugexists{color:red;font-weight:700}.cptui-table #slugchanged.hidemessage,.cptui-table #slugexists.hidemessage{display:none}.cpt-ui_page_cptui_tools .cptui-table .outer p{padding:0 4px}.cptui-support #support .question{font-size:18px;font-weight:700}.cptui-support #support .question:before{content:"\f139";display:inline-block;font:normal 25px/1 dashicons;margin-left:-25px;position:absolute;-webkit-font-smoothing:antialiased}.cptui-support #support .question.active:before{content:"\f140"}.cptui-support #support .answer{margin:10px 0 0 20px}.cptui-support #support ol li{list-style:none}.cptui-support #support li{position:relative}.cptui-field-description{font-style:italic}#cptui_select_post_type,#cptui_select_taxonomy{margin-top:15px}.cptui_post_import,.cptui_tax_import{height:200px;margin-bottom:10px;resize:vertical;width:100%}.cptui_post_type_get_code,.cptui_tax_get_code{height:300px;resize:vertical}.about-wrap .cptui-feature{overflow:visible!important;*zoom:1}.about-wrap .cptui-feature:after,.about-wrap .cptui-feature:before{content:" ";display:table}.about-wrap .cptui-feature:after{clear:both}.about-wrap h3+.cptui-feature{margin-top:0}.about-wrap .changelog h2{text-align:center}.about-wrap .feature-rest div{width:50%!important;padding-right:100px;box-sizing:border-box;margin:0!important}.about-wrap .feature-rest div.last-feature{padding-left:100px;padding-right:0}.about-wrap .feature-rest div.icon{width:0!important;padding:0;margin:0}.about-wrap .feature-rest div.icon:before{font-weight:400;width:100%;font-size:170px;line-height:125px;color:#9c5d90;display:inline-block;position:relative;text-align:center;speak:none;margin:0 0 0 -100px;content:"\e01d";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.rtl .about-wrap .feature-rest div{padding-left:100px}.rtl .about-wrap .feature-rest div.last-feature{padding-right:100px;padding-left:0}.rtl .about-wrap .feature-rest div.icon:before{margin:0 -100px 0 0}.about-wrap .about-integrations{background:#fff;margin:20px 0;padding:1px 20px 10px}.about-wrap .changelog h4{line-height:1.4}.about-wrap .cptui-about-text{margin-bottom:1em!important;margin-right:0;max-width:calc(100% - 173px)}.email-octopus-form-row input:-ms-input-placeholder{color:#ccc}.email-octopus-form-row input::placeholder{color:#ccc}.cptui-intro-devblock{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}#togglelabels{display:none}.js #togglelabels{display:inline-block}.cptui-help{color:#424242;margin-left:4px;opacity:.5;text-decoration:none;width:16px}fieldset .cptui-help{position:relative;top:4px}.cptui-help:hover{color:#0074a2;opacity:1}.cptui-help:focus{box-shadow:none}#toplevel_page_cptui_main_menu img{height:20px;margin-top:-2px;width:20px}.visuallyhidden{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}.cptui-spacer{display:block;margin-top:25px}.email-octopus-form-wrapper{background:#fff;margin-bottom:10px;padding:20px}.email-octopus-form-wrapper label{margin-bottom:10px}.wdsoctosignup h2{text-align:left}.wdspromos{float:right;margin-left:20px;margin-top:10px;width:275px}.wdspromos-about{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-line-pack:stretch;align-content:stretch;-ms-flex-align:start;align-items:flex-start;margin:20px 0}.wdspromos-about a:first-child,.wdspromos-about a:nth-child(2),.wdspromos-about a:nth-child(3){-ms-flex-order:0;order:0;-ms-flex:0 1 auto;flex:0 1 auto;-ms-flex-item-align:auto;-ms-grid-row-align:auto;align-self:auto}.wdspromos-about p{padding:0 5px}.wdspromos-about p:first-child{padding-left:0}.wdspromos-about p:nth-child(4){padding-right:0}.no-js #cptui_choose_icon{display:none}.cptui-listings th{font-weight:700}.cptui-listings .post-type-listing th{width:16.66667%}.cptui-listings .taxonomy-listing th{width:20%}#poststuff{min-width:463px}@media screen and (min-width:769px){.cptui-badge{margin-top:-42px;height:173px;width:173px;color:#fafafa;font-weight:700;font-size:14px;text-align:center;margin-bottom:10px;background:url(../images/cptui-icon-173x173.png) no-repeat}}@media screen and (max-width:768px){.cptui-table #description{width:100%}.wdspromos-about{-ms-flex-wrap:wrap;flex-wrap:wrap}.wdspromos-about p{margin:5px auto}.wdspromos-about p:first-child{padding-left:5px}.wdspromos-about p:nth-child(4){padding-right:5px}#cptui_debug_info_email,.cptui-table td.outer{width:100%}}
1
+ .posttypesui,.taxonomiesui{width:calc(100% - 300px)}.posttypesui .cptui-section:first-child,.taxonomiesui .cptui-section:first-child{margin-top:30px}.posttypesui .postbox-container,.taxonomiesui .postbox-container{width:100%}.posttypesui .postbox .toggle-indicator:before,.taxonomiesui .postbox .toggle-indicator:before{content:"\f142";display:inline-block;font:normal 20px/1 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none!important}.posttypesui .postbox.closed .handlediv .toggle-indicator:before,.taxonomiesui .postbox.closed .handlediv .toggle-indicator:before{content:"\f140"}.posttypesui .postbox .hndle,.taxonomiesui .postbox .hndle{cursor:pointer}.posttypesui .required,.taxonomiesui .required{color:red}.cptui-table #excerpt{display:inline-block;height:16px;margin:12px 4px 12px 0;width:auto}.cptui-table td.outer{vertical-align:top;width:50%}.cptui-edit .cptui-table textarea,.cptui-new .cptui-table textarea,.cptui-table input[type=text]{width:75%}.cptui-table .question:hover{cursor:pointer}.cptui-table th p{font-weight:400;font-size:12px}.cptui-table .cptui-slug-details{margin-top:15px}.cptui-table #slugchanged,.cptui-table #slugexists{color:red;font-weight:700}.cptui-table #slugchanged.hidemessage,.cptui-table #slugexists.hidemessage{display:none}.cpt-ui_page_cptui_tools .cptui-table .outer p{padding:0 4px}.cptui-support #support .question{font-size:18px;font-weight:700}.cptui-support #support .question:before{content:"\f139";display:inline-block;font:normal 25px/1 dashicons;margin-left:-25px;position:absolute;-webkit-font-smoothing:antialiased}.cptui-support #support .question.active:before{content:"\f140"}.cptui-support #support .answer{margin:10px 0 0 20px}.cptui-support #support ol li{list-style:none}.cptui-support #support li{position:relative}.cptui-field-description{font-style:italic}#cptui_select_post_type,#cptui_select_taxonomy{margin-top:15px}.cptui_post_import,.cptui_tax_import{height:200px;margin-bottom:10px;resize:vertical;width:100%}.cptui_post_type_get_code,.cptui_tax_get_code{height:300px;resize:vertical}.about-wrap .cptui-feature{overflow:visible!important;*zoom:1}.about-wrap .cptui-feature:after,.about-wrap .cptui-feature:before{content:" ";display:table}.about-wrap .cptui-feature:after{clear:both}.about-wrap h3+.cptui-feature{margin-top:0}.about-wrap .changelog h2{text-align:center}.about-wrap .feature-rest div{width:50%!important;padding-right:100px;box-sizing:border-box;margin:0!important}.about-wrap .feature-rest div.last-feature{padding-left:100px;padding-right:0}.about-wrap .feature-rest div.icon{width:0!important;padding:0;margin:0}.about-wrap .feature-rest div.icon:before{font-weight:400;width:100%;font-size:170px;line-height:125px;color:#9c5d90;display:inline-block;position:relative;text-align:center;speak:none;margin:0 0 0 -100px;content:"\e01d";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.rtl .about-wrap .feature-rest div{padding-left:100px}.rtl .about-wrap .feature-rest div.last-feature{padding-right:100px;padding-left:0}.rtl .about-wrap .feature-rest div.icon:before{margin:0 -100px 0 0}.about-wrap .about-integrations{background:#fff;margin:20px 0;padding:1px 20px 10px}.about-wrap .changelog h4{line-height:1.4}.about-wrap .cptui-about-text{margin-bottom:1em!important;margin-right:0;max-width:calc(100% - 173px)}.email-octopus-form-row input:-ms-input-placeholder{color:#ccc}.email-octopus-form-row input::placeholder{color:#ccc}.cptui-intro-devblock{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}#togglelabels{display:none}.js #togglelabels{display:inline-block}.cptui-help{color:#424242;margin-left:4px;opacity:.5;text-decoration:none;width:16px}fieldset .cptui-help{position:relative;top:4px}.cptui-help:hover{color:#0074a2;opacity:1}.cptui-help:focus{box-shadow:none}#menu_icon_preview{float:right;padding-left:8px}#menu_icon_preview img{display:block;height:20px;width:20px}#toplevel_page_cptui_main_menu img{height:20px;margin-top:-2px;width:20px}.visuallyhidden{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}.cptui-spacer{display:block;margin-top:25px}.email-octopus-form-wrapper{background:#fff;margin-bottom:10px;padding:20px}.email-octopus-form-wrapper label{margin-bottom:10px}.wdsoctosignup h2{text-align:left}.wdspromos{float:right;margin-left:20px;margin-top:10px;width:275px}.wdspromos-about{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-line-pack:stretch;align-content:stretch;-ms-flex-align:start;align-items:flex-start;margin:20px 0}.wdspromos-about a:first-child,.wdspromos-about a:nth-child(2),.wdspromos-about a:nth-child(3){-ms-flex-order:0;order:0;-ms-flex:0 1 auto;flex:0 1 auto;-ms-flex-item-align:auto;-ms-grid-row-align:auto;align-self:auto}.wdspromos-about p{padding:0 5px}.wdspromos-about p:first-child{padding-left:0}.wdspromos-about p:nth-child(4){padding-right:0}.no-js #cptui_choose_icon{display:none}.cptui-listings th{font-weight:700}.cptui-listings .post-type-listing th{width:16.66667%}.cptui-listings .taxonomy-listing th{width:20%}#poststuff{min-width:463px}@media screen and (min-width:769px){.cptui-badge{margin-top:-42px;height:173px;width:173px;color:#fafafa;font-weight:700;font-size:14px;text-align:center;margin-bottom:10px;background:url(../images/cptui-icon-173x173.png) no-repeat}}@media screen and (max-width:768px){.cptui-table #description{width:100%}.wdspromos-about{-ms-flex-wrap:wrap;flex-wrap:wrap}.wdspromos-about p{margin:5px auto}.wdspromos-about p:first-child{padding-left:5px}.wdspromos-about p:nth-child(4){padding-right:5px}#cptui_debug_info_email,.cptui-table td.outer{width:100%}}
css/cptui.scss CHANGED
@@ -238,6 +238,16 @@ $max-tablet: "screen and (max-width: 768px)";
238
  box-shadow: none;
239
  }
240
  }
 
 
 
 
 
 
 
 
 
 
241
  #toplevel_page_cptui_main_menu {
242
  img {
243
  height: 20px;
238
  box-shadow: none;
239
  }
240
  }
241
+ #menu_icon_preview {
242
+ float: right;
243
+ padding-left: 8px;
244
+
245
+ img {
246
+ display: block;
247
+ height: 20px;
248
+ width: 20px;
249
+ }
250
+ }
251
  #toplevel_page_cptui_main_menu {
252
  img {
253
  height: 20px;
custom-post-type-ui.php CHANGED
@@ -16,7 +16,7 @@
16
  * Plugin URI: https://github.com/WebDevStudios/custom-post-type-ui/
17
  * Description: Admin panel for creating custom post types and custom taxonomies in WordPress
18
  * Author: WebDevStudios
19
- * Version: 1.8.0
20
  * Author URI: https://webdevstudios.com/
21
  * Text Domain: custom-post-type-ui
22
  * Domain Path: /languages
@@ -30,8 +30,8 @@ if ( ! defined( 'ABSPATH' ) ) {
30
  exit;
31
  }
32
 
33
- define( 'CPT_VERSION', '1.8.0' ); // Left for legacy purposes.
34
- define( 'CPTUI_VERSION', '1.8.0' );
35
  define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
36
 
37
  /**
16
  * Plugin URI: https://github.com/WebDevStudios/custom-post-type-ui/
17
  * Description: Admin panel for creating custom post types and custom taxonomies in WordPress
18
  * Author: WebDevStudios
19
+ * Version: 1.8.1
20
  * Author URI: https://webdevstudios.com/
21
  * Text Domain: custom-post-type-ui
22
  * Domain Path: /languages
30
  exit;
31
  }
32
 
33
+ define( 'CPT_VERSION', '1.8.1' ); // Left for legacy purposes.
34
+ define( 'CPTUI_VERSION', '1.8.1' );
35
  define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
36
 
37
  /**
inc/post-types.php CHANGED
@@ -1118,12 +1118,16 @@ function cptui_manage_post_types() {
1118
  ] );
1119
  echo $ui->get_td_end() . $ui->get_tr_end();
1120
 
1121
- echo $ui->get_tr_start() . $ui->get_th_start() . '<label for="menu_icon">' . __( 'Menu Icon', 'custom-post-type-ui' ) . '</label>' . $ui->get_th_end() . $ui->get_td_start();
1122
 
 
 
 
 
1123
  echo $ui->get_text_input( [
1124
  'namearray' => 'cpt_custom_post_type',
1125
  'name' => 'menu_icon',
1126
- 'textvalue' => isset( $current['menu_icon'] ) ? esc_attr( $current['menu_icon'] ) : '',
1127
  'aftertext' => esc_attr__( '(Full URL for icon or Dashicon class)', 'custom-post-type-ui' ),
1128
  'helptext' => sprintf(
1129
  esc_html__( 'Image URL or %sDashicon class name%s to use for icon. Custom image should be 20px by 20px.', 'custom-post-type-ui' ),
1118
  ] );
1119
  echo $ui->get_td_end() . $ui->get_tr_end();
1120
 
1121
+ echo $ui->get_tr_start() . $ui->get_th_start();
1122
 
1123
+ $current_menu_icon = isset( $current['menu_icon'] ) ? esc_attr( $current['menu_icon'] ) : '';
1124
+ echo $ui->get_menu_icon_preview( $current_menu_icon );
1125
+ echo $ui->get_label( 'menu_icon', esc_html__( 'Menu Icon', 'custom-post-type-ui' ) );
1126
+ echo $ui->get_th_end() . $ui->get_td_start();
1127
  echo $ui->get_text_input( [
1128
  'namearray' => 'cpt_custom_post_type',
1129
  'name' => 'menu_icon',
1130
+ 'textvalue' => $current_menu_icon,
1131
  'aftertext' => esc_attr__( '(Full URL for icon or Dashicon class)', 'custom-post-type-ui' ),
1132
  'helptext' => sprintf(
1133
  esc_html__( 'Image URL or %sDashicon class name%s to use for icon. Custom image should be 20px by 20px.', 'custom-post-type-ui' ),
inc/tools.php CHANGED
@@ -600,7 +600,8 @@ function cptui_import_types_taxes_settings( $postdata = [] ) {
600
  return false;
601
  }
602
 
603
- if ( ! check_admin_referer( 'cptui_typetaximport_nonce_action', 'cptui_typetaximport_nonce_field' ) ) {
 
604
  return 'nonce_fail';
605
  }
606
 
600
  return false;
601
  }
602
 
603
+ $doing_wp_cli = ( defined( 'WP_CLI' ) && WP_CLI );
604
+ if ( ! $doing_wp_cli && ! check_admin_referer( 'cptui_typetaximport_nonce_action', 'cptui_typetaximport_nonce_field' ) ) {
605
  return 'nonce_fail';
606
  }
607
 
js/cptui.js CHANGED
@@ -140,6 +140,16 @@ postboxes.add_postbox_toggles(pagenow);
140
  return s;
141
  }
142
 
 
 
 
 
 
 
 
 
 
 
143
  var cyrillic = {
144
  "Ё": "YO", "Й": "I", "Ц": "TS", "У": "U", "К": "K", "Е": "E", "Н": "N", "Г": "G", "Ш": "SH", "Щ": "SCH", "З": "Z", "Х": "H", "Ъ": "'", "ё": "yo", "й": "i", "ц": "ts", "у": "u", "к": "k", "е": "e", "н": "n", "г": "g", "ш": "sh", "щ": "sch", "з": "z", "х": "h", "ъ": "'", "Ф": "F", "Ы": "I", "В": "V", "А": "a", "П": "P", "Р": "R", "О": "O", "Л": "L", "Д": "D", "Ж": "ZH", "Э": "E", "ф": "f", "ы": "i", "в": "v", "а": "a", "п": "p", "р": "r", "о": "o", "л": "l", "д": "d", "ж": "zh", "э": "e", "Я": "Ya", "Ч": "CH", "С": "S", "М": "M", "И": "I", "Т": "T", "Ь": "'", "Б": "B", "Ю": "YU", "я": "ya", "ч": "ch", "с": "s", "м": "m", "и": "i", "т": "t", "ь": "'", "б": "b", "ю": "yu"
145
  };
@@ -173,7 +183,7 @@ postboxes.add_postbox_toggles(pagenow);
173
  _custom_media = true;
174
  wp.media.editor.send.attachment = function (props, attachment) {
175
  if (_custom_media) {
176
- $("#" + id).val(attachment.url);
177
  } else {
178
  return _orig_send_attachment.apply(this, [props, attachment]);
179
  }
@@ -183,6 +193,11 @@ postboxes.add_postbox_toggles(pagenow);
183
  return false;
184
  });
185
 
 
 
 
 
 
186
  $('.cptui-help').on('click',function(e){
187
  e.preventDefault();
188
  });
140
  return s;
141
  }
142
 
143
+ function composePreviewContent(value) {
144
+ if (!value) {
145
+ return '';
146
+ } else if (0 === value.indexOf('dashicons-')) {
147
+ return $('<div class="dashicons-before"><br></div>').addClass(value);
148
+ } else {
149
+ return $('<img />').attr('src', value);
150
+ }
151
+ }
152
+
153
  var cyrillic = {
154
  "Ё": "YO", "Й": "I", "Ц": "TS", "У": "U", "К": "K", "Е": "E", "Н": "N", "Г": "G", "Ш": "SH", "Щ": "SCH", "З": "Z", "Х": "H", "Ъ": "'", "ё": "yo", "й": "i", "ц": "ts", "у": "u", "к": "k", "е": "e", "н": "n", "г": "g", "ш": "sh", "щ": "sch", "з": "z", "х": "h", "ъ": "'", "Ф": "F", "Ы": "I", "В": "V", "А": "a", "П": "P", "Р": "R", "О": "O", "Л": "L", "Д": "D", "Ж": "ZH", "Э": "E", "ф": "f", "ы": "i", "в": "v", "а": "a", "п": "p", "р": "r", "о": "o", "л": "l", "д": "d", "ж": "zh", "э": "e", "Я": "Ya", "Ч": "CH", "С": "S", "М": "M", "И": "I", "Т": "T", "Ь": "'", "Б": "B", "Ю": "YU", "я": "ya", "ч": "ch", "с": "s", "м": "m", "и": "i", "т": "t", "ь": "'", "б": "b", "ю": "yu"
155
  };
183
  _custom_media = true;
184
  wp.media.editor.send.attachment = function (props, attachment) {
185
  if (_custom_media) {
186
+ $("#" + id).val(attachment.url).change();
187
  } else {
188
  return _orig_send_attachment.apply(this, [props, attachment]);
189
  }
193
  return false;
194
  });
195
 
196
+ $('#menu_icon').on('change', function () {
197
+ var value = $(this).val().trim();
198
+ $('#menu_icon_preview').html(composePreviewContent(value));
199
+ });
200
+
201
  $('.cptui-help').on('click',function(e){
202
  e.preventDefault();
203
  });
js/cptui.min.js CHANGED
@@ -1 +1 @@
1
- postboxes.add_postbox_toggles(pagenow),function($){if($("#cptui_select_post_type_submit").hide(),$("#cptui_select_taxonomy_submit").hide(),"edit"===function(name,url){url=url||window.location.href;name=name.replace(/[\[\]]/g,"\\$&");var results=new RegExp("[?&]"+name+"(=([^&#]*)|&|#|$)").exec(url);return results?results[2]?decodeURIComponent(results[2].replace(/\+/g," ")):"":null}("action"))var original_slug=$("#name").val();$("#post_type").on("change",function(){$("#cptui_select_post_type").submit()}),$("#taxonomy").on("change",function(){$("#cptui_select_taxonomy").submit()}),$(".cptui-delete-top, .cptui-delete-bottom").on("click",function(e){e.preventDefault();var msg="";"undefined"!=typeof cptui_type_data?msg=cptui_type_data.confirm:"undefined"!=typeof cptui_tax_data&&(msg=cptui_tax_data.confirm);$('<div class="cptui-submit-delete-dialog">'+msg+"</div>").appendTo("#poststuff").dialog({dialogClass:"wp-dialog",modal:!0,autoOpen:!0,buttons:{OK:function(){$(e.target).closest("form");$(e.target).unbind("click").click()},Cancel:function(){$(this).dialog("close")}}})}),$("#support .question").each(function(){var tis=$(this),state=!1,answer=tis.next("div").slideUp();tis.on("click keydown",function(e){"keydown"===e.type&&32!==e.keyCode&&13!==e.keyCode||(e.preventDefault(),state=!state,answer.slideToggle(state),tis.toggleClass("active",state),tis.attr("aria-expanded",state.toString()),tis.focus())})}),$("#name").on("keyup",function(e){var value,original_value;if(value=original_value=$(this).val(),9!==e.keyCode&&37!==e.keyCode&&38!==e.keyCode&&39!==e.keyCode&&40!==e.keyCode&&(value=function(s){s="cpt-ui_page_cptui_manage_post_types"===window.pagenow?s.replace(/[^a-z0-9\s-]/gi,"_"):s.replace(/[^a-z0-9\s]/gi,"_");return s}(value=function(word){return word.split("").map(function(char){return cyrillic[char]||char}).join("")}(value=function(s){for(var diacritics=[/[\300-\306]/g,/[\340-\346]/g,/[\310-\313]/g,/[\350-\353]/g,/[\314-\317]/g,/[\354-\357]/g,/[\322-\330]/g,/[\362-\370]/g,/[\331-\334]/g,/[\371-\374]/g,/[\321]/g,/[\361]/g,/[\307]/g,/[\347]/g],chars=["A","a","E","e","I","i","O","o","U","u","N","n","C","c"],i=0;i<diacritics.length;i++)s=s.replace(diacritics[i],chars[i]);return s}(value=(value=value.replace(/ /g,"_")).toLowerCase()))))!==original_value&&$(this).prop("value",value),void 0!==original_slug){var $slugchanged=$("#slugchanged");value!=original_slug?$slugchanged.removeClass("hidemessage"):$slugchanged.addClass("hidemessage")}var $slugexists=$("#slugexists");"undefined"!=typeof cptui_type_data&&(cptui_type_data.existing_post_types.hasOwnProperty(value)&&value!==original_slug?$slugexists.removeClass("hidemessage"):$slugexists.addClass("hidemessage")),"undefined"!=typeof cptui_tax_data&&(cptui_tax_data.existing_taxonomies.hasOwnProperty(value)&&value!==original_slug?$slugexists.removeClass("hidemessage"):$slugexists.addClass("hidemessage"))});var cyrillic={"Ё":"YO","Й":"I","Ц":"TS","У":"U","К":"K","Е":"E","Н":"N","Г":"G","Ш":"SH","Щ":"SCH","З":"Z","Х":"H","Ъ":"'","ё":"yo","й":"i","ц":"ts","у":"u","к":"k","е":"e","н":"n","г":"g","ш":"sh","щ":"sch","з":"z","х":"h","ъ":"'","Ф":"F","Ы":"I","В":"V","А":"a","П":"P","Р":"R","О":"O","Л":"L","Д":"D","Ж":"ZH","Э":"E","ф":"f","ы":"i","в":"v","а":"a","п":"p","р":"r","о":"o","л":"l","д":"d","ж":"zh","э":"e","Я":"Ya","Ч":"CH","С":"S","М":"M","И":"I","Т":"T","Ь":"'","Б":"B","Ю":"YU","я":"ya","ч":"ch","с":"s","м":"m","и":"i","т":"t","ь":"'","б":"b","ю":"yu"};if(null!=wp.media)var _custom_media=!0,_orig_send_attachment=wp.media.editor.send.attachment;$("#cptui_choose_icon").on("click",function(e){e.preventDefault();var button=$(this),id=jQuery("#menu_icon").attr("id");return _custom_media=!0,wp.media.editor.send.attachment=function(props,attachment){if(!_custom_media)return _orig_send_attachment.apply(this,[props,attachment]);$("#"+id).val(attachment.url)},wp.media.editor.open(button),!1}),$(".cptui-help").on("click",function(e){e.preventDefault()}),$(".cptui-taxonomy-submit").on("click",function(e){if(0==$(".cptui-table :checkbox:checked").length){e.preventDefault();$('<div class="cptui-taxonomy-empty-types-dialog">'+cptui_tax_data.no_associated_type+"</div>").appendTo("#poststuff").dialog({dialogClass:"wp-dialog",modal:!0,autoOpen:!0,buttons:{OK:function(){$(this).dialog("close")}}})}}),$("#auto-populate").on("click tap",function(e){e.preventDefault();var slug=$("#name").val(),plural=$("#label").val(),singular=$("#singular_label").val(),fields=$('.cptui-labels input[type="text"]');""!==slug&&(""===plural&&(plural=slug),""===singular&&(singular=slug),$(fields).each(function(i,el){var newval=$(el).data("label"),plurality=$(el).data("plurality");"undefined"!==newval&&(newval="plural"===plurality?newval.replace(/item/gi,plural):newval.replace(/item/gi,singular),""===$(el).val()&&$(el).val(newval))}))})}(jQuery);
1
+ postboxes.add_postbox_toggles(pagenow),function($){if($("#cptui_select_post_type_submit").hide(),$("#cptui_select_taxonomy_submit").hide(),"edit"===function(name,url){url=url||window.location.href;name=name.replace(/[\[\]]/g,"\\$&");var results=new RegExp("[?&]"+name+"(=([^&#]*)|&|#|$)").exec(url);return results?results[2]?decodeURIComponent(results[2].replace(/\+/g," ")):"":null}("action"))var original_slug=$("#name").val();$("#post_type").on("change",function(){$("#cptui_select_post_type").submit()}),$("#taxonomy").on("change",function(){$("#cptui_select_taxonomy").submit()}),$(".cptui-delete-top, .cptui-delete-bottom").on("click",function(e){e.preventDefault();var msg="";"undefined"!=typeof cptui_type_data?msg=cptui_type_data.confirm:"undefined"!=typeof cptui_tax_data&&(msg=cptui_tax_data.confirm);$('<div class="cptui-submit-delete-dialog">'+msg+"</div>").appendTo("#poststuff").dialog({dialogClass:"wp-dialog",modal:!0,autoOpen:!0,buttons:{OK:function(){$(e.target).closest("form");$(e.target).unbind("click").click()},Cancel:function(){$(this).dialog("close")}}})}),$("#support .question").each(function(){var tis=$(this),state=!1,answer=tis.next("div").slideUp();tis.on("click keydown",function(e){"keydown"===e.type&&32!==e.keyCode&&13!==e.keyCode||(e.preventDefault(),state=!state,answer.slideToggle(state),tis.toggleClass("active",state),tis.attr("aria-expanded",state.toString()),tis.focus())})}),$("#name").on("keyup",function(e){var value,original_value;if(value=original_value=$(this).val(),9!==e.keyCode&&37!==e.keyCode&&38!==e.keyCode&&39!==e.keyCode&&40!==e.keyCode&&(value=function(s){s="cpt-ui_page_cptui_manage_post_types"===window.pagenow?s.replace(/[^a-z0-9\s-]/gi,"_"):s.replace(/[^a-z0-9\s]/gi,"_");return s}(value=function(word){return word.split("").map(function(char){return cyrillic[char]||char}).join("")}(value=function(s){for(var diacritics=[/[\300-\306]/g,/[\340-\346]/g,/[\310-\313]/g,/[\350-\353]/g,/[\314-\317]/g,/[\354-\357]/g,/[\322-\330]/g,/[\362-\370]/g,/[\331-\334]/g,/[\371-\374]/g,/[\321]/g,/[\361]/g,/[\307]/g,/[\347]/g],chars=["A","a","E","e","I","i","O","o","U","u","N","n","C","c"],i=0;i<diacritics.length;i++)s=s.replace(diacritics[i],chars[i]);return s}(value=(value=value.replace(/ /g,"_")).toLowerCase()))))!==original_value&&$(this).prop("value",value),void 0!==original_slug){var $slugchanged=$("#slugchanged");value!=original_slug?$slugchanged.removeClass("hidemessage"):$slugchanged.addClass("hidemessage")}var $slugexists=$("#slugexists");"undefined"!=typeof cptui_type_data&&(cptui_type_data.existing_post_types.hasOwnProperty(value)&&value!==original_slug?$slugexists.removeClass("hidemessage"):$slugexists.addClass("hidemessage")),"undefined"!=typeof cptui_tax_data&&(cptui_tax_data.existing_taxonomies.hasOwnProperty(value)&&value!==original_slug?$slugexists.removeClass("hidemessage"):$slugexists.addClass("hidemessage"))});var cyrillic={"Ё":"YO","Й":"I","Ц":"TS","У":"U","К":"K","Е":"E","Н":"N","Г":"G","Ш":"SH","Щ":"SCH","З":"Z","Х":"H","Ъ":"'","ё":"yo","й":"i","ц":"ts","у":"u","к":"k","е":"e","н":"n","г":"g","ш":"sh","щ":"sch","з":"z","х":"h","ъ":"'","Ф":"F","Ы":"I","В":"V","А":"a","П":"P","Р":"R","О":"O","Л":"L","Д":"D","Ж":"ZH","Э":"E","ф":"f","ы":"i","в":"v","а":"a","п":"p","р":"r","о":"o","л":"l","д":"d","ж":"zh","э":"e","Я":"Ya","Ч":"CH","С":"S","М":"M","И":"I","Т":"T","Ь":"'","Б":"B","Ю":"YU","я":"ya","ч":"ch","с":"s","м":"m","и":"i","т":"t","ь":"'","б":"b","ю":"yu"};if(null!=wp.media)var _custom_media=!0,_orig_send_attachment=wp.media.editor.send.attachment;$("#cptui_choose_icon").on("click",function(e){e.preventDefault();var button=$(this),id=jQuery("#menu_icon").attr("id");return _custom_media=!0,wp.media.editor.send.attachment=function(props,attachment){if(!_custom_media)return _orig_send_attachment.apply(this,[props,attachment]);$("#"+id).val(attachment.url).change()},wp.media.editor.open(button),!1}),$("#menu_icon").on("change",function(){var value=$(this).val().trim();$("#menu_icon_preview").html(function(value){return value?0===value.indexOf("dashicons-")?$('<div class="dashicons-before"><br></div>').addClass(value):$("<img />").attr("src",value):""}(value))}),$(".cptui-help").on("click",function(e){e.preventDefault()}),$(".cptui-taxonomy-submit").on("click",function(e){if(0==$(".cptui-table :checkbox:checked").length){e.preventDefault();$('<div class="cptui-taxonomy-empty-types-dialog">'+cptui_tax_data.no_associated_type+"</div>").appendTo("#poststuff").dialog({dialogClass:"wp-dialog",modal:!0,autoOpen:!0,buttons:{OK:function(){$(this).dialog("close")}}})}}),$("#auto-populate").on("click tap",function(e){e.preventDefault();var slug=$("#name").val(),plural=$("#label").val(),singular=$("#singular_label").val(),fields=$('.cptui-labels input[type="text"]');""!==slug&&(""===plural&&(plural=slug),""===singular&&(singular=slug),$(fields).each(function(i,el){var newval=$(el).data("label"),plurality=$(el).data("plurality");"undefined"!==newval&&(newval="plural"===plurality?newval.replace(/item/gi,plural):newval.replace(/item/gi,singular),""===$(el).val()&&$(el).val(newval))}))})}(jQuery);
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: webdevstudios, pluginize, tw2113, vegasgeek, modemlooper, williams
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3084056
4
  Tags: custom post types, CPT, CMS, post, types, post type, taxonomy, tax, custom, content types, post types
5
  Requires at least: 5.5
6
- Tested up to: 5.5
7
- Stable tag: 1.8.0
8
  License: GPL-2.0+
9
  Requires PHP: 5.6
10
 
@@ -31,6 +31,10 @@ Official development of Custom Post Type UI is on GitHub, with official stable r
31
 
32
  == Changelog ==
33
 
 
 
 
 
34
  = 1.8.0 - 2020-08-14 =
35
  * Added: support for default terms with a custom taxonomy.
36
  * Updated: Removed the forcing of underscores for post type slugs. Taxonomies are still forced.
@@ -70,6 +74,10 @@ Official development of Custom Post Type UI is on GitHub, with official stable r
70
 
71
  == Upgrade Notice ==
72
 
 
 
 
 
73
  = 1.8.0 - 2020-08-14 =
74
  * Added: support for default terms with a custom taxonomy.
75
  * Updated: Removed the forcing of underscores for post type slugs. Taxonomies are still forced.
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3084056
4
  Tags: custom post types, CPT, CMS, post, types, post type, taxonomy, tax, custom, content types, post types
5
  Requires at least: 5.5
6
+ Tested up to: 5.5.1
7
+ Stable tag: 1.8.1
8
  License: GPL-2.0+
9
  Requires PHP: 5.6
10
 
31
 
32
  == Changelog ==
33
 
34
+ = 1.8.1 - 2020-09-21 =
35
+ * Fixed: Issues with WP-CLI importing.
36
+ * Added: Menu icon preview that should have been in 1.8.0, but was missed. Props @glebkema
37
+
38
  = 1.8.0 - 2020-08-14 =
39
  * Added: support for default terms with a custom taxonomy.
40
  * Updated: Removed the forcing of underscores for post type slugs. Taxonomies are still forced.
74
 
75
  == Upgrade Notice ==
76
 
77
+ = 1.8.1 - 2020-09-21 =
78
+ * Fixed: Issues with WP-CLI importing.
79
+ * Added: Menu icon preview that should have been in 1.8.0, but was missed. Props @glebkema
80
+
81
  = 1.8.0 - 2020-08-14 =
82
  * Added: support for default terms with a custom taxonomy.
83
  * Updated: Removed the forcing of underscores for post type slugs. Taxonomies are still forced.