Custom Post Type UI - Version 1.5.2

Version Description

  • 2017-2-1 =
  • Fixed: Chrome conflicts around the js used to sanitize post type and taxonomy slugs and cursors moving to end of input.
  • Fixed: Further hardened undefined index notices and instance checks in our cptui_not_new_install() callback.
  • Updated: Help text for post type and taxonomy slugs around the use of dashes. See http://docs.pluginize.com/article/135-dashes-in-post-type-taxonomy-slugs-for-url-seo
  • Added: Clarification text regarding what the "Get code" section is useful for.
Download this release

Release Info

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

Code changes from version 1.5.1 to 1.5.2

custom-post-type-ui.php CHANGED
@@ -15,7 +15,7 @@ Plugin Name: Custom Post Type UI
15
  Plugin URI: https://github.com/WebDevStudios/custom-post-type-ui/
16
  Description: Admin panel for creating custom post types and custom taxonomies in WordPress
17
  Author: WebDevStudios
18
- Version: 1.5.1
19
  Author URI: https://webdevstudios.com/
20
  Text Domain: custom-post-type-ui
21
  Domain Path: /languages
@@ -27,8 +27,8 @@ if ( ! defined( 'ABSPATH' ) ) {
27
  exit;
28
  }
29
 
30
- define( 'CPT_VERSION', '1.5.1' ); // Left for legacy purposes.
31
- define( 'CPTUI_VERSION', '1.5.1' );
32
  define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
33
 
34
  /**
15
  Plugin URI: https://github.com/WebDevStudios/custom-post-type-ui/
16
  Description: Admin panel for creating custom post types and custom taxonomies in WordPress
17
  Author: WebDevStudios
18
+ Version: 1.5.2
19
  Author URI: https://webdevstudios.com/
20
  Text Domain: custom-post-type-ui
21
  Domain Path: /languages
27
  exit;
28
  }
29
 
30
+ define( 'CPT_VERSION', '1.5.2' ); // Left for legacy purposes.
31
+ define( 'CPTUI_VERSION', '1.5.2' );
32
  define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
33
 
34
  /**
inc/taxonomies.php CHANGED
@@ -228,7 +228,7 @@ function cptui_manage_taxonomies() {
228
  ) );
229
 
230
  echo '<p class="cptui-slug-details">';
231
- esc_html_e( 'Slugs should only contain alphanumeric, latin characters. Underscores or dashes should be used in place of spaces.', 'custom-post-type-ui' );
232
  echo '</p>';
233
 
234
  if ( 'edit' == $tab ) {
228
  ) );
229
 
230
  echo '<p class="cptui-slug-details">';
231
+ esc_html_e( 'Slugs should only contain alphanumeric, latin characters. Underscores should be used in place of spaces. Set "Custom Rewrite Slug" field to make slug use dashes for URLs.', 'custom-post-type-ui' );
232
  echo '</p>';
233
 
234
  if ( 'edit' == $tab ) {
inc/tools.php CHANGED
@@ -748,6 +748,8 @@ function cptui_render_getcode_section() {
748
 
749
  <h2><?php _e( 'All CPT UI Post Types', 'custom-post-type-ui' ); ?></h2>
750
 
 
 
751
  <?php $cptui_post_types = cptui_get_post_type_data(); ?>
752
  <label for="cptui_post_type_get_code"><?php _e( 'Copy/paste the code below into your functions.php file.', 'custom-post-type-ui' ); ?></label>
753
  <textarea name="cptui_post_type_get_code" id="cptui_post_type_get_code" class="cptui_post_type_get_code" onclick="this.focus();this.select()" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true"><?php cptui_get_post_type_code( $cptui_post_types ); ?></textarea>
748
 
749
  <h2><?php _e( 'All CPT UI Post Types', 'custom-post-type-ui' ); ?></h2>
750
 
751
+ <p><?php esc_html_e( 'All of the selectable code snippets below are useful if you wish to migrate away from CPTUI and retain your existing registered post types or taxonomies.', 'custom-post-type-ui' ); ?></p>
752
+
753
  <?php $cptui_post_types = cptui_get_post_type_data(); ?>
754
  <label for="cptui_post_type_get_code"><?php _e( 'Copy/paste the code below into your functions.php file.', 'custom-post-type-ui' ); ?></label>
755
  <textarea name="cptui_post_type_get_code" id="cptui_post_type_get_code" class="cptui_post_type_get_code" onclick="this.focus();this.select()" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true"><?php cptui_get_post_type_code( $cptui_post_types ); ?></textarea>
inc/utility.php CHANGED
@@ -667,7 +667,11 @@ function cptui_error_admin_notice() {
667
  */
668
  function cptui_not_new_install( $wp_upgrader, $extras ) {
669
 
670
- if ( ! is_array( $extras['plugins'] ) ) {
 
 
 
 
671
  return;
672
  }
673
 
667
  */
668
  function cptui_not_new_install( $wp_upgrader, $extras ) {
669
 
670
+ if ( ! is_a( $wp_upgrader, 'Plugin_Upgrader' ) ) {
671
+ return;
672
+ }
673
+
674
+ if ( ! array_key_exists( 'plugins', $extras ) || ! is_array( $extras['plugins'] ) ) {
675
  return;
676
  }
677
 
js/cptui.js CHANGED
@@ -49,15 +49,17 @@ postboxes.add_postbox_toggles(pagenow);
49
 
50
  // Switch spaces for underscores on our slug fields.
51
  $('#name').on('keyup',function(e){
52
-
53
- var value = $(this).val();
54
- if ( e.keyCode !== 9 ) {
55
  value = value.replace(/ /g, "_");
56
  value = value.toLowerCase();
57
  value = replaceDiacritics(value);
58
  value = transliterate(value);
59
  value = replaceSpecialCharacters(value);
60
- $(this).attr('value', value);
 
 
61
  }
62
 
63
  //Displays a message if slug changes.
49
 
50
  // Switch spaces for underscores on our slug fields.
51
  $('#name').on('keyup',function(e){
52
+ var value, original_value;
53
+ value = original_value = $(this).val();
54
+ if ( e.keyCode !== 9 && e.keyCode !== 37 && e.keyCode !== 38 && e.keyCode !== 39 && e.keyCode !== 40 ) {
55
  value = value.replace(/ /g, "_");
56
  value = value.toLowerCase();
57
  value = replaceDiacritics(value);
58
  value = transliterate(value);
59
  value = replaceSpecialCharacters(value);
60
+ if ( value !== original_value ) {
61
+ $(this).attr('value', value);
62
+ }
63
  }
64
 
65
  //Displays a message if slug changes.
js/cptui.min.js CHANGED
@@ -1 +1 @@
1
- postboxes.add_postbox_toggles(pagenow),function($){function replaceDiacritics(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}function replaceSpecialCharacters(s){return s=s.replace(/[^a-z0-9\s]/gi,"_")}function transliterate(word){return word.split("").map(function(char){return cyrillic[char]||char}).join("")}function getParameterByName(name,url){url||(url=window.location.href),name=name.replace(/[\[\]]/g,"\\$&");var regex=new RegExp("[?&]"+name+"(=([^&#]*)|&|#|$)"),results=regex.exec(url);return results?results[2]?decodeURIComponent(results[2].replace(/\+/g," ")):"":null}if("edit"===getParameterByName("action"))var original_slug=$("#name").val();$("#post_type").on("change",function(){$("#cptui_select_post_type").submit()}),$("#taxonomy").on("change",function(){$("#cptui_select_taxonomy").submit()}),$("#cpt_submit_delete").on("click",function(){return!!confirm(cptui_type_data.confirm)}),$("#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=$(this).val();if(9!==e.keyCode&&(value=value.replace(/ /g,"_"),value=value.toLowerCase(),value=replaceDiacritics(value),value=transliterate(value),value=replaceSpecialCharacters(value),$(this).attr("value",value)),void 0!=original_slug){var $slugchanged=$("#slugchanged");value!=original_slug?$slugchanged.removeClass("hidemessage"):$slugchanged.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(void 0!=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){return _custom_media?void $("#"+id).val(attachment.url):_orig_send_attachment.apply(this,[props,attachment])},wp.media.editor.open(button),!1}),$("#togglelabels").on("click",function(e){e.preventDefault(),$("#labels_expand").toggleClass("toggledclosed")}),$("#togglesettings").on("click",function(e){e.preventDefault(),$("#settings_expand").toggleClass("toggledclosed")}),$("#labels_expand,#settings_expand").on("focus",function(e){$(this).hasClass("toggledclosed")&&$(this).toggleClass("toggledclosed")}),$("#labels_expand legend,#settings_expand legend").on("click",function(e){$(this).parent().toggleClass("toggledclosed")}),$(".cptui-help").on("click",function(e){e.preventDefault()}),$(".cptui-taxonomy-submit").on("click",function(e){0==$(".cptui-table :checkbox:checked").length&&(e.preventDefault(),alert(cptui_tax_data.no_associated_type))})}(jQuery);
1
+ postboxes.add_postbox_toggles(pagenow),function($){function replaceDiacritics(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}function replaceSpecialCharacters(s){return s=s.replace(/[^a-z0-9\s]/gi,"_")}function transliterate(word){return word.split("").map(function(char){return cyrillic[char]||char}).join("")}function getParameterByName(name,url){url||(url=window.location.href),name=name.replace(/[\[\]]/g,"\\$&");var regex=new RegExp("[?&]"+name+"(=([^&#]*)|&|#|$)"),results=regex.exec(url);return results?results[2]?decodeURIComponent(results[2].replace(/\+/g," ")):"":null}if("edit"===getParameterByName("action"))var original_slug=$("#name").val();$("#post_type").on("change",function(){$("#cptui_select_post_type").submit()}),$("#taxonomy").on("change",function(){$("#cptui_select_taxonomy").submit()}),$("#cpt_submit_delete").on("click",function(){return!!confirm(cptui_type_data.confirm)}),$("#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=value.replace(/ /g,"_"),value=value.toLowerCase(),value=replaceDiacritics(value),value=transliterate(value),value=replaceSpecialCharacters(value),value!==original_value&&$(this).attr("value",value)),void 0!=original_slug){var $slugchanged=$("#slugchanged");value!=original_slug?$slugchanged.removeClass("hidemessage"):$slugchanged.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(void 0!=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){return _custom_media?void $("#"+id).val(attachment.url):_orig_send_attachment.apply(this,[props,attachment])},wp.media.editor.open(button),!1}),$("#togglelabels").on("click",function(e){e.preventDefault(),$("#labels_expand").toggleClass("toggledclosed")}),$("#togglesettings").on("click",function(e){e.preventDefault(),$("#settings_expand").toggleClass("toggledclosed")}),$("#labels_expand,#settings_expand").on("focus",function(e){$(this).hasClass("toggledclosed")&&$(this).toggleClass("toggledclosed")}),$("#labels_expand legend,#settings_expand legend").on("click",function(e){$(this).parent().toggleClass("toggledclosed")}),$(".cptui-help").on("click",function(e){e.preventDefault()}),$(".cptui-taxonomy-submit").on("click",function(e){0==$(".cptui-table :checkbox:checked").length&&(e.preventDefault(),alert(cptui_tax_data.no_associated_type))})}(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: 4.6
6
- Tested up to: 4.7
7
- Stable tag: 1.5.1
8
  License: GPLv2
9
 
10
  Admin UI for creating custom post types and custom taxonomies for WordPress
@@ -30,6 +30,12 @@ Official development of Custom Post Type UI is on GitHub, with official stable r
30
 
31
  == Changelog ==
32
 
 
 
 
 
 
 
33
  = 1.5.1 - 2017-1-17 =
34
  * Fixed: Undefined index notice during update process for themes or plugins.
35
  * Fixed: Blacklisted the word "include" from allowed taxonomy slugs. Causes menus to not show in WP Admin.
@@ -88,6 +94,12 @@ Official development of Custom Post Type UI is on GitHub, with official stable r
88
 
89
  == Upgrade Notice ==
90
 
 
 
 
 
 
 
91
  = 1.5.1 - 2017-1-17 =
92
  * Fixed: Undefined index notice during update process for themes or plugins.
93
  * Fixed: Blacklisted the word "include" from allowed taxonomy slugs. Causes menus to not show in WP Admin.
@@ -166,5 +178,5 @@ That's it! Now you can easily start creating custom post types and taxonomies in
166
 
167
  == Frequently Asked Questions ==
168
 
169
- User documentation: http://docs.pluginize.com/collection/1-custom-post-type-ui
170
  Code/API documentation: http://codex.pluginize.com/cptui/
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: 4.6
6
+ Tested up to: 4.7.2
7
+ Stable tag: 1.5.2
8
  License: GPLv2
9
 
10
  Admin UI for creating custom post types and custom taxonomies for WordPress
30
 
31
  == Changelog ==
32
 
33
+ = 1.5.2 - 2017-2-1 =
34
+ * Fixed: Chrome conflicts around the js used to sanitize post type and taxonomy slugs and cursors moving to end of input.
35
+ * Fixed: Further hardened undefined index notices and instance checks in our cptui_not_new_install() callback.
36
+ * Updated: Help text for post type and taxonomy slugs around the use of dashes. See http://docs.pluginize.com/article/135-dashes-in-post-type-taxonomy-slugs-for-url-seo
37
+ * Added: Clarification text regarding what the "Get code" section is useful for.
38
+
39
  = 1.5.1 - 2017-1-17 =
40
  * Fixed: Undefined index notice during update process for themes or plugins.
41
  * Fixed: Blacklisted the word "include" from allowed taxonomy slugs. Causes menus to not show in WP Admin.
94
 
95
  == Upgrade Notice ==
96
 
97
+ = 1.5.2 - 2017-2-1 =
98
+ * Fixed: Chrome conflicts around the js used to sanitize post type and taxonomy slugs and cursors moving to end of input.
99
+ * Fixed: Further hardened undefined index notices and instance checks in our cptui_not_new_install() callback.
100
+ * Updated: Help text for post type and taxonomy slugs around the use of dashes. See http://docs.pluginize.com/article/135-dashes-in-post-type-taxonomy-slugs-for-url-seo
101
+ * Added: Clarification text regarding what the "Get code" section is useful for.
102
+
103
  = 1.5.1 - 2017-1-17 =
104
  * Fixed: Undefined index notice during update process for themes or plugins.
105
  * Fixed: Blacklisted the word "include" from allowed taxonomy slugs. Causes menus to not show in WP Admin.
178
 
179
  == Frequently Asked Questions ==
180
 
181
+ User documentation: http://docs.pluginize.com/category/126-custom-post-type-ui
182
  Code/API documentation: http://codex.pluginize.com/cptui/