Custom Post Types and Custom Fields creator – WCK - Version 1.2.0

Version Description

  • We now display error message when meta name contains uppercase letters
  • We now display error message when taxonomy name contains uppercase letters or spaces
  • Security improvements
  • Fixed issues with post thumbnail and themes that added thumbnail support for specific post types in Custom Post Types Creator
  • Removed notice when WPML was active in certain cases
Download this release

Release Info

Developer madalin.ungureanu
Plugin Icon 128x128 Custom Post Types and Custom Fields creator – WCK
Version 1.2.0
Comparing to
See all releases

Code changes from version 1.1.9 to 1.2.0

readme.txt CHANGED
@@ -5,8 +5,8 @@ Donate link: http://www.cozmoslabs.com/wordpress-creation-kit/
5
  Tags: custom fields, custom field, wordpress custom fields, advanced custom fields, custom post type, custom post types, post types, cpt, post type, repeater fields, repeater, repeatable fields, meta box, metabox, taxonomy, taxonomies, custom taxonomy, custom taxonomies, custom, custom fields creator, post meta, meta, get_post_meta, post creator, cck, content types, types
6
 
7
  Requires at least: 3.1
8
- Tested up to: 4.4.1
9
- Stable tag: 1.1.9
10
 
11
  A must have tool for creating custom fields, custom post types and taxonomies, fast and without any programming knowledge.
12
 
@@ -141,6 +141,13 @@ Creating a taxonomy generally automatically creates a special query variable usi
141
  10. Taxonomy listing
142
 
143
  == Changelog ==
 
 
 
 
 
 
 
144
  = 1.1.9 =
145
  * Fixed typo from 'Chose' to 'Choose'
146
 
5
  Tags: custom fields, custom field, wordpress custom fields, advanced custom fields, custom post type, custom post types, post types, cpt, post type, repeater fields, repeater, repeatable fields, meta box, metabox, taxonomy, taxonomies, custom taxonomy, custom taxonomies, custom, custom fields creator, post meta, meta, get_post_meta, post creator, cck, content types, types
6
 
7
  Requires at least: 3.1
8
+ Tested up to: 4.4.2
9
+ Stable tag: 1.2.0
10
 
11
  A must have tool for creating custom fields, custom post types and taxonomies, fast and without any programming knowledge.
12
 
141
  10. Taxonomy listing
142
 
143
  == Changelog ==
144
+ = 1.2.0 =
145
+ * We now display error message when meta name contains uppercase letters
146
+ * We now display error message when taxonomy name contains uppercase letters or spaces
147
+ * Security improvements
148
+ * Fixed issues with post thumbnail and themes that added thumbnail support for specific post types in Custom Post Types Creator
149
+ * Removed notice when WPML was active in certain cases
150
+
151
  = 1.1.9 =
152
  * Fixed typo from 'Chose' to 'Choose'
153
 
wck-cfc.php CHANGED
@@ -347,7 +347,12 @@ function wck_cfc_ceck_meta_name( $bool, $value, $post_id ){
347
  else
348
  $restricted_name = true;
349
 
350
- return ( $check_meta_existance || empty($value) || $contains_spaces || $restricted_name );
 
 
 
 
 
351
  }
352
 
353
  add_filter( 'wck_required_message_wck_cfc_args_meta-name', 'wck_cfc_change_meta_message', 10, 2 );
@@ -358,10 +363,13 @@ function wck_cfc_change_meta_message( $message, $value ){
358
  return __( "Choose a different Meta Name as this one contains spaces\n", "wck" );
359
  else if( trim( strtolower( $value ) ) === 'content' || trim( strtolower( $value ) ) === 'action' )
360
  return __( "Choose a different Meta Name as this one is reserved\n", "wck" );
 
 
361
  else
362
  return __( "Choose a different Meta Name as this one already exists\n", "wck" );
363
  }
364
 
 
365
  /* Field Name Verification */
366
  add_filter( 'wck_required_test_wck_cfc_fields_field-title', 'wck_cfc_ceck_field_title', 10, 3 );
367
  function wck_cfc_ceck_field_title( $bool, $value, $post_id ){
347
  else
348
  $restricted_name = true;
349
 
350
+ if ( strtolower($value) == $value )
351
+ $has_uppercase = false;
352
+ else
353
+ $has_uppercase = true;
354
+
355
+ return ( $check_meta_existance || empty($value) || $contains_spaces || $restricted_name || $has_uppercase );
356
  }
357
 
358
  add_filter( 'wck_required_message_wck_cfc_args_meta-name', 'wck_cfc_change_meta_message', 10, 2 );
363
  return __( "Choose a different Meta Name as this one contains spaces\n", "wck" );
364
  else if( trim( strtolower( $value ) ) === 'content' || trim( strtolower( $value ) ) === 'action' )
365
  return __( "Choose a different Meta Name as this one is reserved\n", "wck" );
366
+ else if ( strtolower($value) != $value )
367
+ return __( "Choose a different Meta Name as this one contains uppercase letters\n", "wck" );
368
  else
369
  return __( "Choose a different Meta Name as this one already exists\n", "wck" );
370
  }
371
 
372
+
373
  /* Field Name Verification */
374
  add_filter( 'wck_required_test_wck_cfc_fields_field-title', 'wck_cfc_ceck_field_title', 10, 3 );
375
  function wck_cfc_ceck_field_title( $bool, $value, $post_id ){
wck-cptc.php CHANGED
@@ -306,4 +306,25 @@ function wck_cptc_help () {
306
  'content' => '<p>' . __( 'The Advanced Options are set to the most common defaults for custom post types. To display them click the "Show Advanced Options" link.', 'wck' ) . '</p>',
307
  ) );
308
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
  ?>
306
  'content' => '<p>' . __( 'The Advanced Options are set to the most common defaults for custom post types. To display them click the "Show Advanced Options" link.', 'wck' ) . '</p>',
307
  ) );
308
  }
309
+
310
+ add_action( 'init', 'wck_cpt_make_sure_thumbnail_support_works', 11 );
311
+ function wck_cpt_make_sure_thumbnail_support_works(){
312
+ global $_wp_theme_features;
313
+
314
+ if( is_array( $_wp_theme_features["post-thumbnails"] ) ){
315
+ $post_types_with_thumbnails = $_wp_theme_features["post-thumbnails"][0];
316
+
317
+ $cpts = get_option('wck_cptc');
318
+ if( !empty( $cpts ) ) {
319
+ foreach ($cpts as $cpt) {
320
+ $cpt_supports = explode( ', ', $cpt['supports'] );
321
+ if( in_array( 'thumbnail', $cpt_supports ) ){
322
+ $post_types_with_thumbnails[] = $cpt['post-type'];
323
+ }
324
+ }
325
+ }
326
+
327
+ $_wp_theme_features["post-thumbnails"][0] = $post_types_with_thumbnails;
328
+ }
329
+ }
330
  ?>
wck-ctc.php CHANGED
@@ -123,6 +123,38 @@ function wck_ctc_create_taxonomy(){
123
  }
124
  }
125
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  /* Flush rewrite rules */
127
  add_action('init', 'ctc_flush_rules', 20);
128
  function ctc_flush_rules(){
123
  }
124
  }
125
 
126
+ /* Taxonomy Name Verification */
127
+
128
+ add_filter( 'wck_required_test_wck_ctc_taxonomy', 'wck_ctc_check_taxonomy', 10, 3 );
129
+ function wck_ctc_check_taxonomy( $bool, $value, $post_id ){
130
+ //Make sure it doesn't contain capital letters or spaces
131
+ $no_spaces_value = str_replace(' ', '', $value);
132
+ $lowercase_value = strtolower($value);
133
+
134
+ if ( ( $no_spaces_value == $value ) && ( $lowercase_value == $value ) )
135
+ $checked = false;
136
+ else
137
+ $checked = true;
138
+
139
+ return ( empty($value) || $checked );
140
+
141
+ }
142
+
143
+ add_filter( 'wck_required_message_wck_ctc_taxonomy', 'wck_ctc_change_taxonomy_message', 10, 2 );
144
+ function wck_ctc_change_taxonomy_message( $message, $value ){
145
+ // change error message
146
+ $no_spaces_value = str_replace(' ', '', $value);
147
+ $lowercase_value = strtolower($value);
148
+
149
+ if( empty( $value ) )
150
+ return $message;
151
+ else if( $no_spaces_value != $value )
152
+ return __("Taxonomy name must not contain any spaces\n", "wck" );
153
+ else if ($lowercase_value != $value)
154
+ return __( "Tanomony name must not contain any capital letters\n", "wck" );
155
+ }
156
+
157
+
158
  /* Flush rewrite rules */
159
  add_action('init', 'ctc_flush_rules', 20);
160
  function ctc_flush_rules(){
wck.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WCK - Custom Fields and Custom Post Types Creator
4
  Description: WordPress Creation Kit consists of three tools that can help you create and maintain custom post types, custom taxonomies and most importantly, custom fields and metaboxes for your posts, pages or CPT's.
5
  Author: Cozmoslabs, Madalin Ungureanu, Cristian Antohe
6
- Version: 1.1.9
7
  Author URI: http://www.cozmoslabs.com
8
 
9
  License: GPL2
3
  Plugin Name: WCK - Custom Fields and Custom Post Types Creator
4
  Description: WordPress Creation Kit consists of three tools that can help you create and maintain custom post types, custom taxonomies and most importantly, custom fields and metaboxes for your posts, pages or CPT's.
5
  Author: Cozmoslabs, Madalin Ungureanu, Cristian Antohe
6
+ Version: 1.2.0
7
  Author URI: http://www.cozmoslabs.com
8
 
9
  License: GPL2
wordpress-creation-kit-api/wck-fep/wck-fep.php CHANGED
@@ -308,10 +308,11 @@ class WCK_FrontEnd_Posting extends Wordpress_Creation_Kit{
308
  if ( $fep_form ){
309
  $author_id = $fep_form->post_author;
310
  $user_ID = get_current_user_id();
311
-
312
- if ( $author_id != $user_ID ){
313
- $error = '<div class="fep-error fep-access-denied">You are not allowed to edit this post.</div>';
314
- return $error;
 
315
  }
316
  }
317
  }
308
  if ( $fep_form ){
309
  $author_id = $fep_form->post_author;
310
  $user_ID = get_current_user_id();
311
+ if ( !current_user_can( 'edit_others_posts' ) ) {
312
+ if ($author_id != $user_ID) {
313
+ $error = '<div class="fep-error fep-access-denied">' . __( "You are not allowed to edit this post.", "wck" ) . '</div>';
314
+ return $error;
315
+ }
316
  }
317
  }
318
  }
wordpress-creation-kit-api/wordpress-creation-kit.js CHANGED
@@ -18,7 +18,7 @@ jQuery(function(){
18
  });
19
 
20
 
21
- /* add reccord to the meta */
22
  function addMeta(value, id, nonce){
23
 
24
  /* if CKEDITOR then trigger save. save puts the content in the hidden textarea */
@@ -120,7 +120,7 @@ function addMeta(value, id, nonce){
120
 
121
  }
122
 
123
- /* remove reccord from the meta */
124
  function removeMeta(value, id, element_id, nonce){
125
 
126
  var response = confirm( "Delete this item ?" );
18
  });
19
 
20
 
21
+ /* add record to the meta */
22
  function addMeta(value, id, nonce){
23
 
24
  /* if CKEDITOR then trigger save. save puts the content in the hidden textarea */
120
 
121
  }
122
 
123
+ /* remove record from the meta */
124
  function removeMeta(value, id, element_id, nonce){
125
 
126
  var response = confirm( "Delete this item ?" );
wordpress-creation-kit-api/wordpress-creation-kit.php CHANGED
@@ -94,21 +94,24 @@ class Wordpress_Creation_Kit{
94
 
95
  // Set up the AJAX hooks
96
  add_action("wp_ajax_wck_add_meta".$this->args['meta_name'], array( &$this, 'wck_add_meta') );
97
- add_action("wp_ajax_nopriv_wck_add_meta".$this->args['meta_name'], array( &$this, 'wck_add_meta') );
98
  add_action("wp_ajax_wck_update_meta".$this->args['meta_name'], array( &$this, 'wck_update_meta') );
99
- add_action("wp_ajax_nopriv_wck_update_meta".$this->args['meta_name'], array( &$this, 'wck_update_meta') );
100
  add_action("wp_ajax_wck_show_update".$this->args['meta_name'], array( &$this, 'wck_show_update_form') );
101
- add_action("wp_ajax_nopriv_wck_show_update".$this->args['meta_name'], array( &$this, 'wck_show_update_form') );
102
  add_action("wp_ajax_wck_refresh_list".$this->args['meta_name'], array( &$this, 'wck_refresh_list') );
103
- add_action("wp_ajax_nopriv_wck_refresh_list".$this->args['meta_name'], array( &$this, 'wck_refresh_list') );
104
  add_action("wp_ajax_wck_refresh_entry".$this->args['meta_name'], array( &$this, 'wck_refresh_entry') );
105
- add_action("wp_ajax_nopriv_wck_refresh_entry".$this->args['meta_name'], array( &$this, 'wck_refresh_entry') );
106
  add_action("wp_ajax_wck_add_form".$this->args['meta_name'], array( &$this, 'wck_add_form') );
107
- add_action("wp_ajax_nopriv_wck_add_form".$this->args['meta_name'], array( &$this, 'wck_add_form') );
108
  add_action("wp_ajax_wck_remove_meta".$this->args['meta_name'], array( &$this, 'wck_remove_meta') );
109
- add_action("wp_ajax_nopriv_wck_remove_meta".$this->args['meta_name'], array( &$this, 'wck_remove_meta') );
110
- add_action("wp_ajax_wck_reorder_meta".$this->args['meta_name'], array( &$this, 'wck_reorder_meta') );
111
- add_action("wp_ajax_nopriv_wck_reorder_meta".$this->args['meta_name'], array( &$this, 'wck_reorder_meta') );
 
 
 
 
 
 
 
 
 
112
 
113
  add_action('add_meta_boxes', array( &$this, 'wck_add_metabox') );
114
 
@@ -1202,9 +1205,9 @@ class Wordpress_Creation_Kit{
1202
  * if any of the custom fields has the 'wckwpml' prefix.
1203
  */
1204
  function wck_add_sync_translation_metabox(){
1205
- global $post;
1206
-
1207
- if( isset( $_GET['lang'] ) ){
1208
 
1209
  $has_wck_with_unserialize_fields = false;
1210
  $custom_field_keys = get_post_custom_keys( $post->ID );
94
 
95
  // Set up the AJAX hooks
96
  add_action("wp_ajax_wck_add_meta".$this->args['meta_name'], array( &$this, 'wck_add_meta') );
 
97
  add_action("wp_ajax_wck_update_meta".$this->args['meta_name'], array( &$this, 'wck_update_meta') );
 
98
  add_action("wp_ajax_wck_show_update".$this->args['meta_name'], array( &$this, 'wck_show_update_form') );
 
99
  add_action("wp_ajax_wck_refresh_list".$this->args['meta_name'], array( &$this, 'wck_refresh_list') );
 
100
  add_action("wp_ajax_wck_refresh_entry".$this->args['meta_name'], array( &$this, 'wck_refresh_entry') );
 
101
  add_action("wp_ajax_wck_add_form".$this->args['meta_name'], array( &$this, 'wck_add_form') );
 
102
  add_action("wp_ajax_wck_remove_meta".$this->args['meta_name'], array( &$this, 'wck_remove_meta') );
103
+ add_action("wp_ajax_wck_reorder_meta".$this->args['meta_name'], array( &$this, 'wck_reorder_meta') );
104
+
105
+ if( file_exists( dirname(__FILE__).'/wck-fep.php' ) && ( !isset( $wck_fep ) || $wck_fep == 'enabled' ) ){
106
+ add_action("wp_ajax_nopriv_wck_add_meta".$this->args['meta_name'], array( &$this, 'wck_add_meta') );
107
+ add_action("wp_ajax_nopriv_wck_update_meta".$this->args['meta_name'], array( &$this, 'wck_update_meta') );
108
+ add_action("wp_ajax_nopriv_wck_show_update".$this->args['meta_name'], array( &$this, 'wck_show_update_form') );
109
+ add_action("wp_ajax_nopriv_wck_refresh_list".$this->args['meta_name'], array( &$this, 'wck_refresh_list') );
110
+ add_action("wp_ajax_nopriv_wck_refresh_entry".$this->args['meta_name'], array( &$this, 'wck_refresh_entry') );
111
+ add_action("wp_ajax_nopriv_wck_add_form".$this->args['meta_name'], array( &$this, 'wck_add_form') );
112
+ add_action("wp_ajax_nopriv_wck_remove_meta".$this->args['meta_name'], array( &$this, 'wck_remove_meta') );
113
+ add_action("wp_ajax_nopriv_wck_reorder_meta".$this->args['meta_name'], array( &$this, 'wck_reorder_meta') );
114
+ }
115
 
116
  add_action('add_meta_boxes', array( &$this, 'wck_add_metabox') );
117
 
1205
  * if any of the custom fields has the 'wckwpml' prefix.
1206
  */
1207
  function wck_add_sync_translation_metabox(){
1208
+ global $post;
1209
+
1210
+ if( isset( $_GET['lang'] ) && !empty( $post ) ){
1211
 
1212
  $has_wck_with_unserialize_fields = false;
1213
  $custom_field_keys = get_post_custom_keys( $post->ID );