Version Description
- We now check for reserved names on Custom Post Types and Taxonomy Creator
- Added a filter to change input type: wck_text_input_type_attribute_{$meta}{$fieldslug}
- Fixed a potential notice in Custom Fields Creator
Download this release
Release Info
Developer | madalin.ungureanu |
Plugin | Custom Post Types and Custom Fields creator – WCK |
Version | 2.0.8 |
Comparing to | |
See all releases |
Code changes from version 2.0.7 to 2.0.8
- readme.txt +7 -2
- wck-cfc.php +1 -1
- wck-cptc.php +25 -3
- wck-ctc.php +24 -3
- wck-sas.php +11 -4
- wck.php +1 -1
- wordpress-creation-kit-api/fields/text.php +1 -1
- wordpress-creation-kit-api/wordpress-creation-kit.php +14 -0
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Tags: custom fields, custom field, wordpress custom fields, custom post type, cu
|
|
6 |
|
7 |
Requires at least: 3.1
|
8 |
Tested up to: 4.7.2
|
9 |
-
Stable tag: 2.0.
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
@@ -139,7 +139,12 @@ Creating a taxonomy generally automatically creates a special query variable usi
|
|
139 |
10. Taxonomy listing
|
140 |
|
141 |
== Changelog ==
|
142 |
-
= 2.
|
|
|
|
|
|
|
|
|
|
|
143 |
* Compatibility with php version 7.1
|
144 |
|
145 |
= 2.0.6 =
|
6 |
|
7 |
Requires at least: 3.1
|
8 |
Tested up to: 4.7.2
|
9 |
+
Stable tag: 2.0.8
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
139 |
10. Taxonomy listing
|
140 |
|
141 |
== Changelog ==
|
142 |
+
= 2.0.8 =
|
143 |
+
* We now check for reserved names on Custom Post Types and Taxonomy Creator
|
144 |
+
* Added a filter to change input type: wck_text_input_type_attribute_{$meta}_{$field_slug}
|
145 |
+
* Fixed a potential notice in Custom Fields Creator
|
146 |
+
|
147 |
+
= 2.0.7 =
|
148 |
* Compatibility with php version 7.1
|
149 |
|
150 |
= 2.0.6 =
|
wck-cfc.php
CHANGED
@@ -1202,7 +1202,7 @@ function wck_serialized_update_from_unserialized( $replace, $object_id, $meta_ke
|
|
1202 |
foreach( $wck_meta_boxes_ids as $wck_meta_boxes_id ){
|
1203 |
$cfc_args = get_post_meta( $wck_meta_boxes_id, 'wck_cfc_args', true );
|
1204 |
|
1205 |
-
if( !empty( $cfc_args[0]['meta-name'] ) && $cfc_args[0]['meta-name'] == $meta_key ){
|
1206 |
|
1207 |
/* get all post meta for the post id like it is done in get_post_meta() function */
|
1208 |
$meta_cache = wp_cache_get($object_id, 'post_meta');
|
1202 |
foreach( $wck_meta_boxes_ids as $wck_meta_boxes_id ){
|
1203 |
$cfc_args = get_post_meta( $wck_meta_boxes_id, 'wck_cfc_args', true );
|
1204 |
|
1205 |
+
if( !empty( $cfc_args[0] ) && !empty( $cfc_args[0]['meta-name'] ) && $cfc_args[0]['meta-name'] == $meta_key ){
|
1206 |
|
1207 |
/* get all post meta for the post id like it is done in get_post_meta() function */
|
1208 |
$meta_cache = wp_cache_get($object_id, 'post_meta');
|
wck-cptc.php
CHANGED
@@ -418,14 +418,20 @@ function wck_cptc_update_post_type( $meta, $id, $values, $element_id ){
|
|
418 |
}
|
419 |
|
420 |
/* Post Type Name Verification */
|
421 |
-
add_filter( 'wck_required_test_wck_cptc_post-type', 'wck_cptc_check_post_type', 10,
|
422 |
-
function wck_cptc_check_post_type( $bool, $value, $post_id, $field, $meta, $fields ){
|
423 |
//Make sure it doesn't contain capital letters or spaces
|
424 |
$no_spaces_value = str_replace(' ', '', $value);
|
425 |
$no_hyphens_value = str_replace('-', '', $value);
|
426 |
$lowercase_value = strtolower($value);
|
427 |
|
428 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
429 |
$checked = false;
|
430 |
else
|
431 |
$checked = true;
|
@@ -439,6 +445,7 @@ function wck_cptc_change_post_type_message( $message, $value, $required_field ){
|
|
439 |
$no_spaces_value = str_replace(' ', '', $value);
|
440 |
$no_hyphens_value = str_replace('-', '', $value);
|
441 |
$lowercase_value = strtolower($value);
|
|
|
442 |
|
443 |
if( empty( $value ) )
|
444 |
return $message;
|
@@ -448,6 +455,21 @@ function wck_cptc_change_post_type_message( $message, $value, $required_field ){
|
|
448 |
return __( "Post Type name must not contain any capital letters\n", "wck" );
|
449 |
else if ($no_hyphens_value != $value)
|
450 |
return __( "Post Type name must not contain any hyphens\n", "wck" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
}
|
452 |
|
453 |
?>
|
418 |
}
|
419 |
|
420 |
/* Post Type Name Verification */
|
421 |
+
add_filter( 'wck_required_test_wck_cptc_post-type', 'wck_cptc_check_post_type', 10, 8 );
|
422 |
+
function wck_cptc_check_post_type( $bool, $value, $post_id, $field, $meta, $fields, $values, $elemet_id ){
|
423 |
//Make sure it doesn't contain capital letters or spaces
|
424 |
$no_spaces_value = str_replace(' ', '', $value);
|
425 |
$no_hyphens_value = str_replace('-', '', $value);
|
426 |
$lowercase_value = strtolower($value);
|
427 |
|
428 |
+
/* make sure it's not reserved and avoid doing this on the update case for backwards compatibility */
|
429 |
+
$old_values = get_option( 'wck_cptc' );
|
430 |
+
$reserved_vars = array();
|
431 |
+
if( empty( $old_values[$elemet_id]['post-type'] ) || $value != $old_values[$elemet_id]['post-type'] )
|
432 |
+
$reserved_vars = wck_cpt_get_reserved_names();
|
433 |
+
|
434 |
+
if ( ( $no_spaces_value == $value ) && ( $lowercase_value == $value ) && ( $no_hyphens_value == $value ) && !in_array( $value, $reserved_vars ) )
|
435 |
$checked = false;
|
436 |
else
|
437 |
$checked = true;
|
445 |
$no_spaces_value = str_replace(' ', '', $value);
|
446 |
$no_hyphens_value = str_replace('-', '', $value);
|
447 |
$lowercase_value = strtolower($value);
|
448 |
+
$reserved_vars = wck_cpt_get_reserved_names();
|
449 |
|
450 |
if( empty( $value ) )
|
451 |
return $message;
|
455 |
return __( "Post Type name must not contain any capital letters\n", "wck" );
|
456 |
else if ($no_hyphens_value != $value)
|
457 |
return __( "Post Type name must not contain any hyphens\n", "wck" );
|
458 |
+
else if( in_array( $value, $reserved_vars ) )
|
459 |
+
return __( "Please chose a different Post Type name as this one is reserved\n", "wck" );
|
460 |
+
}
|
461 |
+
|
462 |
+
function wck_cpt_get_reserved_names(){
|
463 |
+
$reserved_vars = Wordpress_Creation_Kit::wck_get_reserved_variable_names();
|
464 |
+
/* add to reserved names existing taxonomy slugs created with wck */
|
465 |
+
$wck_taxonomies = get_option( 'wck_ctc' );
|
466 |
+
if( !empty( $wck_taxonomies ) ){
|
467 |
+
foreach ($wck_taxonomies as $wck_taxonomy) {
|
468 |
+
$reserved_vars[] = $wck_taxonomy['taxonomy'];
|
469 |
+
}
|
470 |
+
}
|
471 |
+
|
472 |
+
return $reserved_vars;
|
473 |
}
|
474 |
|
475 |
?>
|
wck-ctc.php
CHANGED
@@ -196,13 +196,19 @@ SQL;
|
|
196 |
|
197 |
/* Taxonomy Name Verification */
|
198 |
|
199 |
-
add_filter( 'wck_required_test_wck_ctc_taxonomy', 'wck_ctc_check_taxonomy', 10,
|
200 |
-
function wck_ctc_check_taxonomy( $bool, $value, $post_id, $field, $meta, $fields ){
|
201 |
//Make sure it doesn't contain capital letters or spaces
|
202 |
$no_spaces_value = str_replace(' ', '', $value);
|
203 |
$lowercase_value = strtolower($value);
|
204 |
|
205 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
$checked = false;
|
207 |
else
|
208 |
$checked = true;
|
@@ -216,6 +222,7 @@ function wck_ctc_change_taxonomy_message( $message, $value, $required_field ){
|
|
216 |
// change error message
|
217 |
$no_spaces_value = str_replace(' ', '', $value);
|
218 |
$lowercase_value = strtolower($value);
|
|
|
219 |
|
220 |
if( empty( $value ) )
|
221 |
return $message;
|
@@ -223,8 +230,22 @@ function wck_ctc_change_taxonomy_message( $message, $value, $required_field ){
|
|
223 |
return __("Taxonomy name must not contain any spaces\n", "wck" );
|
224 |
else if ($lowercase_value != $value)
|
225 |
return __( "Tanomony name must not contain any capital letters\n", "wck" );
|
|
|
|
|
226 |
}
|
227 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
|
229 |
/* Flush rewrite rules */
|
230 |
add_action('init', 'ctc_flush_rules', 20);
|
196 |
|
197 |
/* Taxonomy Name Verification */
|
198 |
|
199 |
+
add_filter( 'wck_required_test_wck_ctc_taxonomy', 'wck_ctc_check_taxonomy', 10, 8 );
|
200 |
+
function wck_ctc_check_taxonomy( $bool, $value, $post_id, $field, $meta, $fields, $values, $elemet_id ){
|
201 |
//Make sure it doesn't contain capital letters or spaces
|
202 |
$no_spaces_value = str_replace(' ', '', $value);
|
203 |
$lowercase_value = strtolower($value);
|
204 |
|
205 |
+
/* make sure it's not reserved and avoid doing this on the update case for backwards compatibility */
|
206 |
+
$old_values = get_option( 'wck_ctc' );
|
207 |
+
$reserved_vars = array();
|
208 |
+
if( empty( $old_values[$elemet_id]['taxonomy'] ) || $value != $old_values[$elemet_id]['taxonomy'] )
|
209 |
+
$reserved_vars = wck_ctc_get_reserved_names();
|
210 |
+
|
211 |
+
if ( ( $no_spaces_value == $value ) && ( $lowercase_value == $value ) && !in_array( $value, $reserved_vars ) )
|
212 |
$checked = false;
|
213 |
else
|
214 |
$checked = true;
|
222 |
// change error message
|
223 |
$no_spaces_value = str_replace(' ', '', $value);
|
224 |
$lowercase_value = strtolower($value);
|
225 |
+
$reserved_vars = wck_ctc_get_reserved_names();
|
226 |
|
227 |
if( empty( $value ) )
|
228 |
return $message;
|
230 |
return __("Taxonomy name must not contain any spaces\n", "wck" );
|
231 |
else if ($lowercase_value != $value)
|
232 |
return __( "Tanomony name must not contain any capital letters\n", "wck" );
|
233 |
+
else if( in_array( $value, $reserved_vars ) )
|
234 |
+
return __( "Please chose a different Tanomony name as this one is reserved\n", "wck" );
|
235 |
}
|
236 |
|
237 |
+
function wck_ctc_get_reserved_names(){
|
238 |
+
$reserved_vars = Wordpress_Creation_Kit::wck_get_reserved_variable_names();
|
239 |
+
/* add to reserved names existing taxonomy slugs created with wck */
|
240 |
+
$wck_post_types = get_option( 'wck_cptc' );
|
241 |
+
if( !empty( $wck_post_types ) ){
|
242 |
+
foreach ($wck_post_types as $wck_post_type) {
|
243 |
+
$reserved_vars[] = $wck_post_type['post-type'];
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
+
return $reserved_vars;
|
248 |
+
}
|
249 |
|
250 |
/* Flush rewrite rules */
|
251 |
add_action('init', 'ctc_flush_rules', 20);
|
wck-sas.php
CHANGED
@@ -31,7 +31,7 @@ function wck_sas_create_box(){
|
|
31 |
|
32 |
/* set up the fields array */
|
33 |
$sas_serial_fields = array(
|
34 |
-
array( 'type' => 'text', 'title' => __( 'Serial Number', 'wck' ), 'description' => __( 'Please enter your serial number. (e.g. WCKPRO-11-SN-251r55baa4fbe7bf595b2aabb8d72985)', 'wck' ), 'required' => true )
|
35 |
);
|
36 |
|
37 |
/* set up the box arguments */
|
@@ -324,10 +324,17 @@ if (file_exists ($wck_premium_update . 'update-checker.php')) {
|
|
324 |
if ($wck_serial_status == 'notFound' || $wck_serial_status == 'noserial' || $wck_serial_status == '') {
|
325 |
new wck_add_serial_notices('wck', sprintf(__('<p>Your <strong>WordPress Creation Kit</strong> serial number is invalid or missing. <br/>Please %1$sregister your copy%2$s of WCK to receive access to automatic updates and support. Need a license key? %3$sPurchase one now%4$s</p>', 'wck'), "<a href='admin.php?page=sas-page'>", "</a>", "<a href='http://www.cozmoslabs.com/wck-custom-fields-custom-post-types-plugin/?utm_source=WCK&utm_medium=dashboard&utm_campaign=WCK-SN-Purchase' target='_blank' class='button-primary'>", "</a>"), 'wck_serial_status');
|
326 |
} elseif ($wck_serial_status == 'expired') {
|
327 |
-
new wck_add_serial_notices('wck_expired', sprintf(__('<p style="position:relative;">Your <strong>WordPress Creation Kit</strong> licence has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now and get
|
328 |
} elseif (strpos($wck_serial_status, 'aboutToExpire') === 0) {
|
329 |
$serial_status_parts = explode( '#', $wck_serial_status );
|
330 |
$date = $serial_status_parts[1];
|
331 |
-
new wck_add_serial_notices('wck_about_to_expire', sprintf(__('<p style="position:relative;">Your <strong>WordPress Creation Kit</strong> serial number is about to expire on %5$s. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now and get
|
332 |
}
|
333 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
/* set up the fields array */
|
33 |
$sas_serial_fields = array(
|
34 |
+
array( 'type' => 'text', 'title' => __( 'Serial Number', 'wck' ), 'slug' => 'serial-number', 'description' => __( 'Please enter your serial number. (e.g. WCKPRO-11-SN-251r55baa4fbe7bf595b2aabb8d72985)', 'wck' ), 'required' => true )
|
35 |
);
|
36 |
|
37 |
/* set up the box arguments */
|
324 |
if ($wck_serial_status == 'notFound' || $wck_serial_status == 'noserial' || $wck_serial_status == '') {
|
325 |
new wck_add_serial_notices('wck', sprintf(__('<p>Your <strong>WordPress Creation Kit</strong> serial number is invalid or missing. <br/>Please %1$sregister your copy%2$s of WCK to receive access to automatic updates and support. Need a license key? %3$sPurchase one now%4$s</p>', 'wck'), "<a href='admin.php?page=sas-page'>", "</a>", "<a href='http://www.cozmoslabs.com/wck-custom-fields-custom-post-types-plugin/?utm_source=WCK&utm_medium=dashboard&utm_campaign=WCK-SN-Purchase' target='_blank' class='button-primary'>", "</a>"), 'wck_serial_status');
|
326 |
} elseif ($wck_serial_status == 'expired') {
|
327 |
+
new wck_add_serial_notices('wck_expired', sprintf(__('<p style="position:relative;">Your <strong>WordPress Creation Kit</strong> licence has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now and get 40% off %4$s %5$sDismiss%6$s</p>', 'wck'), "<a href='http://www.cozmoslabs.com/downloads/wordpress-creation-kit-".$wck_version."-yearly-renewal/?utm_source=WCK&utm_medium=dashboard&utm_campaign=WCK-Renewal' target='_blank'>", "</a>", "<a href='". esc_url( "http://www.cozmoslabs.com/downloads/wordpress-creation-kit-".$wck_version."-yearly-renewal/?utm_source=WCK&utm_medium=dashboard&utm_campaign=WCK-Renewal") ."' target='_blank' class='button-primary'>", "</a>", "<a href='" . esc_url( add_query_arg('wck_expired_dismiss_notification', '0') ) . "' class='wck-dismiss-notification' style='position:absolute; right:0px; top:50%; margin-top:-7px;'>", "</a>"), 'wck_serial_status');
|
328 |
} elseif (strpos($wck_serial_status, 'aboutToExpire') === 0) {
|
329 |
$serial_status_parts = explode( '#', $wck_serial_status );
|
330 |
$date = $serial_status_parts[1];
|
331 |
+
new wck_add_serial_notices('wck_about_to_expire', sprintf(__('<p style="position:relative;">Your <strong>WordPress Creation Kit</strong> serial number is about to expire on %5$s. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now and get 40% off %4$s %6$sDismiss%7$s</p>', 'wck'), "<a href='http://www.cozmoslabs.com/downloads/wordpress-creation-kit-".$wck_version."-yearly-renewal/?utm_source=WCK&utm_medium=dashboard&utm_campaign=WCK-Renewal'>", "</a>", "<a href='". esc_url( "http://www.cozmoslabs.com/downloads/wordpress-creation-kit-".$wck_version."-yearly-renewal/?utm_source=WCK&utm_medium=dashboard&utm_campaign=WCK-Renewal" ) ."' target='_blank' class='button-primary'>", "</a>", $date, "<a href='" . esc_url( add_query_arg('wck_about_to_expire_dismiss_notification', '0') ) . "' class='wck-dismiss-notification' style='position:absolute; right:0px; top:50%; margin-top:-7px;'>", "</a>"), 'wck_serial_status');
|
332 |
}
|
333 |
+
|
334 |
+
/* change serial field type to password */
|
335 |
+
add_filter( 'wck_text_input_type_attribute_wck_serial_serial-number', 'wck_sas_change_serial_field_type' );
|
336 |
+
function wck_sas_change_serial_field_type( $type ){
|
337 |
+
return 'password';
|
338 |
+
}
|
339 |
+
|
340 |
+
}
|
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: 2.0.
|
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: 2.0.8
|
7 |
Author URI: http://www.cozmoslabs.com
|
8 |
|
9 |
License: GPL2
|
wordpress-creation-kit-api/fields/text.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @return string $element input element html string. */
|
7 |
|
8 |
|
9 |
-
$element .= '<input type="text" name="'. $single_prefix . esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'], $details ) ) .'" id="';
|
10 |
if( !empty( $frontend_prefix ) )
|
11 |
$element .= $frontend_prefix;
|
12 |
$element .= esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'], $details ) ) .'"';
|
6 |
* @return string $element input element html string. */
|
7 |
|
8 |
|
9 |
+
$element .= '<input type="'. apply_filters( "wck_text_input_type_attribute_{$meta}_".Wordpress_Creation_Kit::wck_generate_slug( $details['title'], $details ), 'text' ) .'" name="'. $single_prefix . esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'], $details ) ) .'" id="';
|
10 |
if( !empty( $frontend_prefix ) )
|
11 |
$element .= $frontend_prefix;
|
12 |
$element .= esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'], $details ) ) .'"';
|
wordpress-creation-kit-api/wordpress-creation-kit.php
CHANGED
@@ -1657,6 +1657,20 @@ class Wordpress_Creation_Kit{
|
|
1657 |
}
|
1658 |
return $meta_name;
|
1659 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1660 |
}
|
1661 |
|
1662 |
|
1657 |
}
|
1658 |
return $meta_name;
|
1659 |
}
|
1660 |
+
|
1661 |
+
/**
|
1662 |
+
* @return mixed|void returns an array with the WordPress reserved variable names
|
1663 |
+
*/
|
1664 |
+
static function wck_get_reserved_variable_names(){
|
1665 |
+
$reserved_vars = array( 'attachment', 'attachment_id', 'author', 'author_name', 'calendar', 'cat', 'category', 'category__and', 'category__in', 'category__not_in', 'category_name', 'comments_per_page',
|
1666 |
+
'comments_popup', 'custom', 'customize_messenger_channel', 'customized', 'cpage', 'day', 'debug', 'embed', 'error', 'exact', 'feed', 'hour', 'link_category', 'm',
|
1667 |
+
'minute', 'monthnum', 'more', 'name', 'nav_menu', 'nonce', 'nopaging', 'offset', 'order', 'orderby', 'p', 'page', 'page_id', 'paged', 'pagename', 'pb', 'perm', 'post',
|
1668 |
+
'post__in', 'post__not_in', 'post_format', 'post_mime_type', 'post_status', 'post_tag', 'post_type', 'posts', 'posts_per_archive_page', 'posts_per_page', 'preview',
|
1669 |
+
'robots', 's', 'search', 'second', 'sentence', 'showposts', 'static', 'subpost', 'subpost_id', 'tag', 'tag__and', 'tag__in', 'tag__not_in', 'tag_id', 'tag_slug__and',
|
1670 |
+
'tag_slug__in', 'taxonomy', 'tb', 'term', 'terms', 'theme', 'title', 'type', 'w', 'withcomments', 'withoutcomments', 'year' );
|
1671 |
+
|
1672 |
+
return apply_filters( 'wck_reserved_variable_names', $reserved_vars );
|
1673 |
+
}
|
1674 |
}
|
1675 |
|
1676 |
|