Version Description
- Added Custom Fields Api
- Added option to enable/disable WCK tools(CFC, CPTC, FEP...) that you want/don't want to use
- Labels of required custom fields turn red when empty
- Added in Custom Taxonomy Creator support for show_admin_column argument that allows automatic creation of taxonomy columns on associated post-types
- Improved visibility of WCK Help tab
- We no longer get js error when deregistering wysiwig init script
Download this release
Release Info
Developer | madalin.ungureanu |
Plugin | Custom Post Types and Custom Fields creator – WCK |
Version | 1.0.4 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 1.0.4
- readme.txt +11 -3
- wck-cfc.php +24 -5
- wck-ctc.php +7 -5
- wck-sas.php +27 -0
- wck-template-api/index.php +2 -0
- wck-template-api/wck-field-preprocess.php +248 -0
- wck-template-api/wck-template-api-class.php +132 -0
- wck-template-api/wck-template-api.php +81 -0
- wck.php +38 -9
- wordpress-creation-kit-api/fields/text.php +5 -2
- wordpress-creation-kit-api/fields/upload.php +6 -3
- wordpress-creation-kit-api/fields/wysiwyg editor.php +1 -1
- wordpress-creation-kit-api/readme.txt +1 -1
- wordpress-creation-kit-api/wordpress-creation-kit.css +29 -0
- wordpress-creation-kit-api/wordpress-creation-kit.js +5 -5
- wordpress-creation-kit-api/wordpress-creation-kit.php +19 -8
readme.txt
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
=== WCK - Custom Fields and Custom Post Types Creator ===
|
2 |
|
3 |
-
Contributors: reflectionmedia, madalin.ungureanu
|
4 |
Donate link: http://www.cozmoslabs.com/wordpress-creation-kit-sale-page/
|
5 |
Tags: custom fields, custom field, wordpress custom fields, advanced custom fields, custom post type, custom post types, post types, repeater fields, repeater, repeatable, meta box, meta boxes, 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: 3.
|
9 |
-
Stable tag: 1.0.
|
10 |
|
11 |
A must have tool for creating custom fields, custom post types and taxonomies, fast and without any programming knowledge.
|
12 |
|
@@ -138,6 +138,14 @@ Creating a taxonomy generally automatically creates a special query variable usi
|
|
138 |
10. Taxonomy listing
|
139 |
|
140 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
= 1.0.3 =
|
142 |
* Removed all notices and warnings from the code
|
143 |
|
1 |
=== WCK - Custom Fields and Custom Post Types Creator ===
|
2 |
|
3 |
+
Contributors: reflectionmedia, madalin.ungureanu, sareiodata
|
4 |
Donate link: http://www.cozmoslabs.com/wordpress-creation-kit-sale-page/
|
5 |
Tags: custom fields, custom field, wordpress custom fields, advanced custom fields, custom post type, custom post types, post types, repeater fields, repeater, repeatable, meta box, meta boxes, 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: 3.7.1
|
9 |
+
Stable tag: 1.0.4
|
10 |
|
11 |
A must have tool for creating custom fields, custom post types and taxonomies, fast and without any programming knowledge.
|
12 |
|
138 |
10. Taxonomy listing
|
139 |
|
140 |
== Changelog ==
|
141 |
+
= 1.0.4 =
|
142 |
+
* Added Custom Fields Api
|
143 |
+
* Added option to enable/disable WCK tools(CFC, CPTC, FEP...) that you want/don't want to use
|
144 |
+
* Labels of required custom fields turn red when empty
|
145 |
+
* Added in Custom Taxonomy Creator support for show_admin_column argument that allows automatic creation of taxonomy columns on associated post-types
|
146 |
+
* Improved visibility of WCK Help tab
|
147 |
+
* We no longer get js error when deregistering wysiwig init script
|
148 |
+
|
149 |
= 1.0.3 =
|
150 |
* Removed all notices and warnings from the code
|
151 |
|
wck-cfc.php
CHANGED
@@ -54,6 +54,23 @@ function wck_cfc_create_custom_fields_cpt(){
|
|
54 |
|
55 |
register_post_type( 'wck-meta-box', $args );
|
56 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
/* Remove view action from post list view */
|
58 |
add_filter('post_row_actions','wck_cfc_remove_view_action');
|
59 |
function wck_cfc_remove_view_action($actions){
|
@@ -92,7 +109,7 @@ function wck_cfc_create_box(){
|
|
92 |
array( 'type' => 'text', 'title' => __( 'Meta name', 'wck' ), 'description' => __( 'The name of the meta field. It is the name by which you will query the data in the frontend. Must be unique, only lowercase letters, no spaces and no special characters.', 'wck' ), 'required' => true ),
|
93 |
array( 'type' => 'select', 'title' => __( 'Post Type', 'wck' ), 'options' => $post_type_names, 'default-option' => true, 'description' => __( 'What post type the meta box should be attached to', 'wck' ), 'required' => true ),
|
94 |
array( 'type' => 'select', 'title' => __( 'Repeater', 'wck' ), 'options' => array( 'false', 'true' ), 'default' => 'false', 'description' => __( 'Whether the box supports just one entry or if it is a repeater field. By default it is a single field.', 'wck' ) ),
|
95 |
-
array( 'type' => 'select', 'title' => __( 'Sortable', 'wck' ), 'options' => array( 'true', 'false' ), 'default' => 'false', 'description' => __( 'Whether the entries are sortable or not.
|
96 |
array( 'type' => 'text', 'title' => __( 'Post ID', 'wck' ), 'description' => __( 'ID of a post on which the meta box should appear.', 'wck' ) )
|
97 |
);
|
98 |
|
@@ -133,8 +150,8 @@ function wck_cfc_create_box(){
|
|
133 |
array( 'type' => 'textarea', 'title' => __( 'Description', 'wck' ), 'description' => 'The description of the field.' ),
|
134 |
array( 'type' => 'select', 'title' => __( 'Required', 'wck' ), 'options' => array( 'false', 'true' ), 'default' => 'false', 'description' => __( 'Whether the field is required or not', 'wck' ) ),
|
135 |
array( 'type' => 'select', 'title' => __( 'CPT', 'wck' ), 'options' => $post_types, 'default' => 'post', 'description' => __( 'Select what custom post type should be used in the CPT Select.', 'wck' ) ),
|
136 |
-
array( 'type' => 'text', 'title' => __( 'Default Value', 'wck' ), 'description' => __( 'Default value of the field. For Checkboxes if there are multiple values
|
137 |
-
array( 'type' => 'text', 'title' => __( 'Options', 'wck' ), 'description' => __( 'Options for field types "select", "checkbox" and "radio". For multiple options
|
138 |
array( 'type' => 'radio', 'title' => __( 'Attach upload to post', 'wck' ), 'description' => __( 'Whether or not the uploads should be attached to the post', 'wck' ), 'options' => array( 'yes', 'no' ) )
|
139 |
) );
|
140 |
|
@@ -267,6 +284,8 @@ function wck_cfc_create_boxes_args(){
|
|
267 |
if( !empty( $wck_cfc_arg['page-template'] ) )
|
268 |
$box_args['page_template'] = $wck_cfc_arg['page-template'];
|
269 |
|
|
|
|
|
270 |
/* nested repeater arg for pro version only */
|
271 |
if( !empty( $wck_cfc_arg['nested'] ) )
|
272 |
$box_args['nested'] = $wck_cfc_arg['nested'] == 'false' ? false : true;
|
@@ -326,7 +345,7 @@ function wck_cfc_change_meta_message( $message, $value ){
|
|
326 |
return __( "Choose a different Meta Name as this one already exists\n", "wck" );
|
327 |
}
|
328 |
|
329 |
-
/* Add the
|
330 |
add_action( 'wck_before_add_meta', 'wck_cfc_add_separate_meta', 10, 3 );
|
331 |
function wck_cfc_add_separate_meta( $meta, $id, $values ){
|
332 |
if( $meta == 'wck_cfc_args' ){
|
@@ -347,7 +366,7 @@ function wck_cfc_add_separate_meta( $meta, $id, $values ){
|
|
347 |
}
|
348 |
}
|
349 |
|
350 |
-
/* Change meta_key in db if field changed and also update the
|
351 |
add_action( 'wck_before_update_meta', 'wck_cfc_change_meta_key', 10, 4 );
|
352 |
function wck_cfc_change_meta_key( $meta, $id, $values, $element_id ){
|
353 |
global $wpdb;
|
54 |
|
55 |
register_post_type( 'wck-meta-box', $args );
|
56 |
}
|
57 |
+
|
58 |
+
/* add admin body class to cfc custom post type */
|
59 |
+
add_filter( 'admin_body_class', 'wck_cfc_admin_body_class' );
|
60 |
+
function wck_cfc_admin_body_class( $classes ){
|
61 |
+
if( isset( $_GET['post_type'] ) || isset( $_GET['post'] ) ){
|
62 |
+
if( isset( $_GET['post_type'] ) )
|
63 |
+
$post_type = $_GET['post_type'];
|
64 |
+
else if( isset( $_GET['post'] ) )
|
65 |
+
$post_type = get_post_type( $_GET['post'] );
|
66 |
+
|
67 |
+
if( 'wck-meta-box' == $post_type ){
|
68 |
+
$classes .= ' wck_page_cfc-page ';
|
69 |
+
}
|
70 |
+
}
|
71 |
+
return $classes;
|
72 |
+
}
|
73 |
+
|
74 |
/* Remove view action from post list view */
|
75 |
add_filter('post_row_actions','wck_cfc_remove_view_action');
|
76 |
function wck_cfc_remove_view_action($actions){
|
109 |
array( 'type' => 'text', 'title' => __( 'Meta name', 'wck' ), 'description' => __( 'The name of the meta field. It is the name by which you will query the data in the frontend. Must be unique, only lowercase letters, no spaces and no special characters.', 'wck' ), 'required' => true ),
|
110 |
array( 'type' => 'select', 'title' => __( 'Post Type', 'wck' ), 'options' => $post_type_names, 'default-option' => true, 'description' => __( 'What post type the meta box should be attached to', 'wck' ), 'required' => true ),
|
111 |
array( 'type' => 'select', 'title' => __( 'Repeater', 'wck' ), 'options' => array( 'false', 'true' ), 'default' => 'false', 'description' => __( 'Whether the box supports just one entry or if it is a repeater field. By default it is a single field.', 'wck' ) ),
|
112 |
+
array( 'type' => 'select', 'title' => __( 'Sortable', 'wck' ), 'options' => array( 'true', 'false' ), 'default' => 'false', 'description' => __( 'Whether the entries are sortable or not. This is valid for repeater fields.', 'wck' ) ),
|
113 |
array( 'type' => 'text', 'title' => __( 'Post ID', 'wck' ), 'description' => __( 'ID of a post on which the meta box should appear.', 'wck' ) )
|
114 |
);
|
115 |
|
150 |
array( 'type' => 'textarea', 'title' => __( 'Description', 'wck' ), 'description' => 'The description of the field.' ),
|
151 |
array( 'type' => 'select', 'title' => __( 'Required', 'wck' ), 'options' => array( 'false', 'true' ), 'default' => 'false', 'description' => __( 'Whether the field is required or not', 'wck' ) ),
|
152 |
array( 'type' => 'select', 'title' => __( 'CPT', 'wck' ), 'options' => $post_types, 'default' => 'post', 'description' => __( 'Select what custom post type should be used in the CPT Select.', 'wck' ) ),
|
153 |
+
array( 'type' => 'text', 'title' => __( 'Default Value', 'wck' ), 'description' => __( 'Default value of the field. For Checkboxes if there are multiple values separate them with a ","', 'wck' ) ),
|
154 |
+
array( 'type' => 'text', 'title' => __( 'Options', 'wck' ), 'description' => __( 'Options for field types "select", "checkbox" and "radio". For multiple options separate them with a ",". You can use the following structure if you want the label to be different from the value: %LabelOne%valueone,%LabelTwo%valuetwo,%LabelThree%valuethree', 'wck' ) ),
|
155 |
array( 'type' => 'radio', 'title' => __( 'Attach upload to post', 'wck' ), 'description' => __( 'Whether or not the uploads should be attached to the post', 'wck' ), 'options' => array( 'yes', 'no' ) )
|
156 |
) );
|
157 |
|
284 |
if( !empty( $wck_cfc_arg['page-template'] ) )
|
285 |
$box_args['page_template'] = $wck_cfc_arg['page-template'];
|
286 |
|
287 |
+
$box_args['unserialize_fields'] = apply_filters( 'wck_cfc_unserialize_fields_'.$wck_cfc_arg['meta-name'], false );
|
288 |
+
|
289 |
/* nested repeater arg for pro version only */
|
290 |
if( !empty( $wck_cfc_arg['nested'] ) )
|
291 |
$box_args['nested'] = $wck_cfc_arg['nested'] == 'false' ? false : true;
|
345 |
return __( "Choose a different Meta Name as this one already exists\n", "wck" );
|
346 |
}
|
347 |
|
348 |
+
/* Add the separate meta for post type, post id and page template */
|
349 |
add_action( 'wck_before_add_meta', 'wck_cfc_add_separate_meta', 10, 3 );
|
350 |
function wck_cfc_add_separate_meta( $meta, $id, $values ){
|
351 |
if( $meta == 'wck_cfc_args' ){
|
366 |
}
|
367 |
}
|
368 |
|
369 |
+
/* Change meta_key in db if field changed and also update the separate meta for post type, post id and page template */
|
370 |
add_action( 'wck_before_update_meta', 'wck_cfc_change_meta_key', 10, 4 );
|
371 |
function wck_cfc_change_meta_key( $meta, $id, $values, $element_id ){
|
372 |
global $wpdb;
|
wck-ctc.php
CHANGED
@@ -56,7 +56,8 @@ function wck_ctc_create_box(){
|
|
56 |
|
57 |
array( 'type' => 'select', 'title' => __( 'Public', 'wck' ), 'options' => array( 'false', 'true' ), 'default' => 'true', 'description' => __( 'Meta argument used to define default values for publicly_queriable, show_ui, show_in_nav_menus and exclude_from_search', 'wck' ) ),
|
58 |
array( 'type' => 'select', 'title' => __( 'Show UI', 'wck' ), 'options' => array( 'false', 'true' ), 'default' => 'true', 'description' => __( 'Whether to generate a default UI for managing this post type.', 'wck' ) ),
|
59 |
-
array( 'type' => 'select', 'title' => __( 'Show Tagcloud', 'wck' ), 'options' => array( 'false', 'true' ), 'default' => 'true', 'description' => __( 'Whether to allow the Tag Cloud widget to use this taxonomy.', 'wck' ) )
|
|
|
60 |
);
|
61 |
|
62 |
$args = array(
|
@@ -103,7 +104,8 @@ function wck_ctc_create_taxonomy(){
|
|
103 |
'public' => $ct['public'] == 'false' ? false : true,
|
104 |
'show_ui' => $ct['show-ui'] == 'false' ? false : true,
|
105 |
'hierarchical' => $ct['hierarchical'] == 'false' ? false : true,
|
106 |
-
'show_tagcloud' => $ct['show-tagcloud'] == 'false' ? false : true
|
|
|
107 |
);
|
108 |
|
109 |
if( !empty( $ct['attach-to'] ) )
|
@@ -149,7 +151,7 @@ function wck_ctc_form_wrapper_start(){
|
|
149 |
echo '<li id="ctc-advanced-options-container" style="display:none;"><ul>';
|
150 |
}
|
151 |
|
152 |
-
add_action( "
|
153 |
function wck_ctc_form_wrapper_end(){
|
154 |
echo '</ul></li>';
|
155 |
}
|
@@ -176,7 +178,7 @@ function wck_ctc_update_form_wrapper_start( $form, $i ){
|
|
176 |
return $form;
|
177 |
}
|
178 |
|
179 |
-
add_filter( "
|
180 |
function wck_ctc_update_form_wrapper_end( $form, $i ){
|
181 |
$form .= '</ul></li>';
|
182 |
return $form;
|
@@ -205,7 +207,7 @@ function wck_ctc_display_adv_wrapper_start( $form, $i ){
|
|
205 |
return $form;
|
206 |
}
|
207 |
|
208 |
-
add_filter( "
|
209 |
function wck_ctc_display_adv_wrapper_end( $form, $i ){
|
210 |
$form .= '</ul></li>';
|
211 |
return $form;
|
56 |
|
57 |
array( 'type' => 'select', 'title' => __( 'Public', 'wck' ), 'options' => array( 'false', 'true' ), 'default' => 'true', 'description' => __( 'Meta argument used to define default values for publicly_queriable, show_ui, show_in_nav_menus and exclude_from_search', 'wck' ) ),
|
58 |
array( 'type' => 'select', 'title' => __( 'Show UI', 'wck' ), 'options' => array( 'false', 'true' ), 'default' => 'true', 'description' => __( 'Whether to generate a default UI for managing this post type.', 'wck' ) ),
|
59 |
+
array( 'type' => 'select', 'title' => __( 'Show Tagcloud', 'wck' ), 'options' => array( 'false', 'true' ), 'default' => 'true', 'description' => __( 'Whether to allow the Tag Cloud widget to use this taxonomy.', 'wck' ) ),
|
60 |
+
array( 'type' => 'select', 'title' => __( 'Show Admin Column', 'wck' ), 'options' => array( 'false', 'true' ), 'default' => 'false', 'description' => __( 'Whether to allow automatic creation of taxonomy columns on associated post-types.', 'wck' ) )
|
61 |
);
|
62 |
|
63 |
$args = array(
|
104 |
'public' => $ct['public'] == 'false' ? false : true,
|
105 |
'show_ui' => $ct['show-ui'] == 'false' ? false : true,
|
106 |
'hierarchical' => $ct['hierarchical'] == 'false' ? false : true,
|
107 |
+
'show_tagcloud' => $ct['show-tagcloud'] == 'false' ? false : true,
|
108 |
+
'show_admin_column' => $ct['show-admin-column'] == 'false' ? false : true
|
109 |
);
|
110 |
|
111 |
if( !empty( $ct['attach-to'] ) )
|
151 |
echo '<li id="ctc-advanced-options-container" style="display:none;"><ul>';
|
152 |
}
|
153 |
|
154 |
+
add_action( "wck_after_add_form_wck_ctc_element_21", 'wck_ctc_form_wrapper_end' );
|
155 |
function wck_ctc_form_wrapper_end(){
|
156 |
echo '</ul></li>';
|
157 |
}
|
178 |
return $form;
|
179 |
}
|
180 |
|
181 |
+
add_filter( "wck_after_update_form_wck_ctc_element_21", 'wck_ctc_update_form_wrapper_end', 10, 2 );
|
182 |
function wck_ctc_update_form_wrapper_end( $form, $i ){
|
183 |
$form .= '</ul></li>';
|
184 |
return $form;
|
207 |
return $form;
|
208 |
}
|
209 |
|
210 |
+
add_filter( "wck_after_listed_wck_ctc_element_21", 'wck_ctc_display_adv_wrapper_end', 10, 2 );
|
211 |
function wck_ctc_display_adv_wrapper_end( $form, $i ){
|
212 |
$form .= '</ul></li>';
|
213 |
return $form;
|
wck-sas.php
CHANGED
@@ -51,6 +51,32 @@ function wck_sas_create_box(){
|
|
51 |
if (file_exists ($wck_premium_update . 'update-checker.php'))
|
52 |
new Wordpress_Creation_Kit( $args );
|
53 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
}
|
56 |
|
@@ -120,6 +146,7 @@ function wck_sas_quickintro($hook){
|
|
120 |
/* add refresh to page. Needed to display the serial notification. Need to refactor in the future so it works via ajax. */
|
121 |
add_action("wck_refresh_list_wck_serial", "wck_serial_after_refresh_list");
|
122 |
add_action("wck_refresh_entry_wck_serial", "wck_serial_after_refresh_list");
|
|
|
123 |
function wck_serial_after_refresh_list(){
|
124 |
echo '<script type="text/javascript">window.location="'. get_admin_url() . 'admin.php?page=sas-page&updated=true' .'";</script>';
|
125 |
}
|
51 |
if (file_exists ($wck_premium_update . 'update-checker.php'))
|
52 |
new Wordpress_Creation_Kit( $args );
|
53 |
}
|
54 |
+
|
55 |
+
/* set up the tools array */
|
56 |
+
$sas_tools_activate = array(
|
57 |
+
array( 'type' => 'radio', 'title' => __( 'Custom Fields Creator', 'wck' ), 'options' => array( 'enabled', 'disabled' ), 'default' => 'enabled' ),
|
58 |
+
array( 'type' => 'radio', 'title' => __( 'Custom Post Type Creator', 'wck' ), 'options' => array( 'enabled', 'disabled' ), 'default' => 'enabled' ),
|
59 |
+
array( 'type' => 'radio', 'title' => __( 'Custom Taxonomy Creator', 'wck' ), 'options' => array( 'enabled', 'disabled' ), 'default' => 'enabled' ),
|
60 |
+
);
|
61 |
+
if( file_exists( dirname(__FILE__).'/wck-fep.php' ) )
|
62 |
+
$sas_tools_activate[] = array( 'type' => 'radio', 'title' => __( 'Frontend Posting', 'wck' ), 'options' => array( 'enabled', 'disabled' ), 'default' => 'enabled' );
|
63 |
+
if( file_exists( dirname(__FILE__).'/wck-opc.php' ) )
|
64 |
+
$sas_tools_activate[] = array( 'type' => 'radio', 'title' => __( 'Option Pages Creator', 'wck' ), 'options' => array( 'enabled', 'disabled' ), 'default' => 'enabled' );
|
65 |
+
|
66 |
+
|
67 |
+
/* set up the box arguments */
|
68 |
+
$args = array(
|
69 |
+
'metabox_id' => 'wck_tools_activate',
|
70 |
+
'metabox_title' => __( 'WordPress Creation Kit Tools: enable or disable the tools you want', 'wck' ),
|
71 |
+
'post_type' => 'sas-page',
|
72 |
+
'meta_name' => 'wck_tools',
|
73 |
+
'meta_array' => $sas_tools_activate,
|
74 |
+
'context' => 'option',
|
75 |
+
'single' => true
|
76 |
+
);
|
77 |
+
|
78 |
+
/* create the box */
|
79 |
+
new Wordpress_Creation_Kit( $args );
|
80 |
|
81 |
}
|
82 |
|
146 |
/* add refresh to page. Needed to display the serial notification. Need to refactor in the future so it works via ajax. */
|
147 |
add_action("wck_refresh_list_wck_serial", "wck_serial_after_refresh_list");
|
148 |
add_action("wck_refresh_entry_wck_serial", "wck_serial_after_refresh_list");
|
149 |
+
add_action("wck_refresh_entry_wck_tools", "wck_serial_after_refresh_list");
|
150 |
function wck_serial_after_refresh_list(){
|
151 |
echo '<script type="text/javascript">window.location="'. get_admin_url() . 'admin.php?page=sas-page&updated=true' .'";</script>';
|
152 |
}
|
wck-template-api/index.php
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//silence is golden
|
wck-template-api/wck-field-preprocess.php
ADDED
@@ -0,0 +1,248 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Copyright 2013 cozmoslabs.com (email : hello@cozmoslabs.com)
|
3 |
+
This program is free software; you can redistribute it and/or modify
|
4 |
+
it under the terms of the GNU General Public License as published by
|
5 |
+
the Free Software Foundation; either version 2 of the License, or
|
6 |
+
(at your option) any later version.
|
7 |
+
This program is distributed in the hope that it will be useful,
|
8 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10 |
+
GNU General Public License for more details.
|
11 |
+
You should have received a copy of the GNU General Public License
|
12 |
+
along with this program; if not, write to the Free Software
|
13 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
14 |
+
*/
|
15 |
+
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Preprocess the textarea field types.
|
19 |
+
* We're converting new lines to <br /> tags
|
20 |
+
*
|
21 |
+
* @since 1.1.5
|
22 |
+
*
|
23 |
+
* @param string $field The actual field content
|
24 |
+
* @return string $field The processed field
|
25 |
+
*/
|
26 |
+
add_filter( 'wck_output_get_field_textarea', 'wck_preprocess_field_textarea', 10 );
|
27 |
+
function wck_preprocess_field_textarea( $field ){
|
28 |
+
return nl2br( $field );
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Preprocess the checkbox field types.
|
33 |
+
* We're returnig an array with the selected checkboxes
|
34 |
+
*
|
35 |
+
* @since 1.1.5
|
36 |
+
*
|
37 |
+
* @param string $field The actual field content
|
38 |
+
* @return string $checkbox The processed field
|
39 |
+
*/
|
40 |
+
add_filter( 'wck_output_get_field_checkbox', 'wck_preprocess_field_checkbox', 10 );
|
41 |
+
function wck_preprocess_field_checkbox( $field ){
|
42 |
+
$checkbox = explode( ', ', $field );
|
43 |
+
return $checkbox;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Preprocess the checkbox field types in the the_cfc_field .
|
48 |
+
* We're returnig a coma separated list with the selected values - not labels
|
49 |
+
*
|
50 |
+
* @since 1.1.5
|
51 |
+
*
|
52 |
+
* @param string $field The actual field content
|
53 |
+
* @return string $checkbox The processed field
|
54 |
+
*/
|
55 |
+
add_filter( 'wck_output_the_field_checkbox', 'wck_preprocess_the_field_checkbox', 10 );
|
56 |
+
function wck_preprocess_the_field_checkbox( $field ){
|
57 |
+
$checkbox_list = implode( ', ', $field );
|
58 |
+
return $checkbox_list;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Preprocess the upload field types.
|
63 |
+
* We're returnig an array for images and an object for normal files
|
64 |
+
*
|
65 |
+
* @since 1.1.5
|
66 |
+
*
|
67 |
+
* @param string $field The actual field content
|
68 |
+
* @return string $upload The processed field
|
69 |
+
*/
|
70 |
+
add_filter( 'wck_output_get_field_upload', 'wck_preprocess_field_upload', 10 );
|
71 |
+
function wck_preprocess_field_upload( $field ){
|
72 |
+
|
73 |
+
if ( $field == '' || !is_numeric( $field ) )
|
74 |
+
return false;
|
75 |
+
|
76 |
+
if ( is_null( get_post( $field ) ) )
|
77 |
+
return false;
|
78 |
+
|
79 |
+
if ( wp_attachment_is_image( $field ) ) {
|
80 |
+
|
81 |
+
$attachment = get_post( $field );
|
82 |
+
|
83 |
+
// create array to hold value data
|
84 |
+
$src = wp_get_attachment_image_src( $attachment->ID, 'full' );
|
85 |
+
|
86 |
+
$value = array(
|
87 |
+
'id' => $attachment->ID,
|
88 |
+
'alt' => get_post_meta($attachment->ID, '_wp_attachment_image_alt', true),
|
89 |
+
'title' => $attachment->post_title,
|
90 |
+
'caption' => $attachment->post_excerpt,
|
91 |
+
'description' => $attachment->post_content,
|
92 |
+
'url' => $src[0],
|
93 |
+
'width' => $src[1],
|
94 |
+
'height' => $src[2],
|
95 |
+
'sizes' => array(),
|
96 |
+
);
|
97 |
+
|
98 |
+
// find all image sizes
|
99 |
+
$image_sizes = get_intermediate_image_sizes();
|
100 |
+
|
101 |
+
if( $image_sizes )
|
102 |
+
{
|
103 |
+
foreach( $image_sizes as $image_size )
|
104 |
+
{
|
105 |
+
// find src
|
106 |
+
$src = wp_get_attachment_image_src( $attachment->ID, $image_size );
|
107 |
+
|
108 |
+
// add src
|
109 |
+
$value[ 'sizes' ][ $image_size ] = $src[0];
|
110 |
+
$value[ 'sizes' ][ $image_size . '-width' ] = $src[1];
|
111 |
+
$value[ 'sizes' ][ $image_size . '-height' ] = $src[2];
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
return $value;
|
116 |
+
|
117 |
+
} else {
|
118 |
+
|
119 |
+
$attachement = get_post( $field );
|
120 |
+
|
121 |
+
return $attachement;
|
122 |
+
|
123 |
+
}
|
124 |
+
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Preprocess the upload field types in the_cfc_field function.
|
129 |
+
* We're returnig an url.
|
130 |
+
*
|
131 |
+
* @since 1.1.5
|
132 |
+
*
|
133 |
+
*/
|
134 |
+
add_filter( 'wck_output_the_field_upload', 'wck_preprocess_the_field_upload', 10 );
|
135 |
+
function wck_preprocess_the_field_upload( $field ){
|
136 |
+
|
137 |
+
if( $field === false ){
|
138 |
+
return;
|
139 |
+
}
|
140 |
+
|
141 |
+
if ( is_object( $field ) ){
|
142 |
+
return $field->guid;
|
143 |
+
}
|
144 |
+
|
145 |
+
if ( is_array( $field ) ){
|
146 |
+
return $field['url'];
|
147 |
+
}
|
148 |
+
|
149 |
+
}
|
150 |
+
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Preprocess the user select field types.
|
154 |
+
* We're returnig an array with user related information
|
155 |
+
*
|
156 |
+
* @since 1.1.5
|
157 |
+
*
|
158 |
+
* @param string $field The actual field content
|
159 |
+
* @return string $user The processed field
|
160 |
+
*/
|
161 |
+
add_filter( 'wck_output_get_field_user-select', 'wck_preprocess_field_user_select', 10 );
|
162 |
+
function wck_preprocess_field_user_select( $uid ){
|
163 |
+
$user_data = get_userdata( $uid );
|
164 |
+
|
165 |
+
if ( $user_data ){
|
166 |
+
$user_array = array();
|
167 |
+
$user_array['ID'] = $uid;
|
168 |
+
$user_array['user_firstname'] = $user_data->user_firstname;
|
169 |
+
$user_array['user_lastname'] = $user_data->user_lastname;
|
170 |
+
$user_array['nickname'] = $user_data->nickname;
|
171 |
+
$user_array['user_nicename'] = $user_data->user_nicename;
|
172 |
+
$user_array['display_name'] = $user_data->display_name;
|
173 |
+
$user_array['user_email'] = $user_data->user_email;
|
174 |
+
$user_array['user_url'] = $user_data->user_url;
|
175 |
+
$user_array['user_registered'] = $user_data->user_registered;
|
176 |
+
$user_array['user_description'] = $user_data->user_description;
|
177 |
+
$user_array['user_avatar'] = get_avatar( $uid );
|
178 |
+
|
179 |
+
return $user_array;
|
180 |
+
|
181 |
+
} else {
|
182 |
+
|
183 |
+
return false;
|
184 |
+
|
185 |
+
}
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Preprocess the user select field types for the_cfc_field.
|
190 |
+
* We're returnig the Display Name
|
191 |
+
*
|
192 |
+
* @since 1.1.5
|
193 |
+
*
|
194 |
+
*/
|
195 |
+
add_filter( 'wck_output_the_field_user-select', 'wck_preprocess_the_field_user_select', 10 );
|
196 |
+
function wck_preprocess_the_field_user_select( $user ){
|
197 |
+
|
198 |
+
if( $user === false ){
|
199 |
+
return;
|
200 |
+
}
|
201 |
+
|
202 |
+
if( is_array( $user ) ){
|
203 |
+
return $user['display_name'];
|
204 |
+
}
|
205 |
+
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Preprocess the cpt select field types.
|
210 |
+
* We're returnig a post object
|
211 |
+
*
|
212 |
+
* @since 1.1.5
|
213 |
+
*
|
214 |
+
* @param string $field The actual field content
|
215 |
+
* @return string $user The processed field
|
216 |
+
*/
|
217 |
+
add_filter( 'wck_output_get_field_cpt-select', 'wck_preprocess_field_cpt_select', 10 );
|
218 |
+
function wck_preprocess_field_cpt_select( $id ){
|
219 |
+
|
220 |
+
if ( $id == '' || !is_numeric( $id ) )
|
221 |
+
return false;
|
222 |
+
|
223 |
+
$post = get_post( $id );
|
224 |
+
if( is_null( $post ) )
|
225 |
+
return false;
|
226 |
+
|
227 |
+
return $post;
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Preprocess the cpt select field types for the_cpt_field.
|
232 |
+
* We're returnig the post title.
|
233 |
+
*
|
234 |
+
* @since 1.1.5
|
235 |
+
*
|
236 |
+
*/
|
237 |
+
add_filter( 'wck_output_the_field_cpt-select', 'wck_preprocess_the_field_cpt_select', 10 );
|
238 |
+
function wck_preprocess_the_field_cpt_select( $post ){
|
239 |
+
|
240 |
+
if( $post == false ){
|
241 |
+
return;
|
242 |
+
}
|
243 |
+
|
244 |
+
if( is_object( $post ) ){
|
245 |
+
return $post->post_title;
|
246 |
+
}
|
247 |
+
|
248 |
+
}
|
wck-template-api/wck-template-api-class.php
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Copyright 2013 cozmoslabs.com (email : hello@cozmoslabs.com)
|
3 |
+
This program is free software; you can redistribute it and/or modify
|
4 |
+
it under the terms of the GNU General Public License as published by
|
5 |
+
the Free Software Foundation; either version 2 of the License, or
|
6 |
+
(at your option) any later version.
|
7 |
+
This program is distributed in the hope that it will be useful,
|
8 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10 |
+
GNU General Public License for more details.
|
11 |
+
You should have received a copy of the GNU General Public License
|
12 |
+
along with this program; if not, write to the Free Software
|
13 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
14 |
+
*/
|
15 |
+
|
16 |
+
class WCK_Template_API{
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Helper function for post ID
|
20 |
+
*
|
21 |
+
* @post_id
|
22 |
+
*/
|
23 |
+
|
24 |
+
static function get_post_id( $post_id = false ){
|
25 |
+
|
26 |
+
// set post_id to global
|
27 |
+
if( !$post_id )
|
28 |
+
{
|
29 |
+
global $post;
|
30 |
+
|
31 |
+
if( $post )
|
32 |
+
{
|
33 |
+
$post_id = $post->ID;
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
// return
|
38 |
+
return $post_id;
|
39 |
+
}
|
40 |
+
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Returns the value of a post_meta created with CFC or empty.
|
44 |
+
*
|
45 |
+
* @meta_name
|
46 |
+
* @post_id
|
47 |
+
*/
|
48 |
+
|
49 |
+
static function get_meta( $meta_name = false, $post_id = false ){
|
50 |
+
|
51 |
+
$post_id = WCK_Template_API::get_post_id($post_id);
|
52 |
+
|
53 |
+
$post_meta = get_post_meta( $post_id, $meta_name, true );
|
54 |
+
|
55 |
+
if ( is_array( $post_meta ) )
|
56 |
+
return $post_meta;
|
57 |
+
|
58 |
+
// get_post_meta with the 3'rd param true returns an empty string if nothing found.
|
59 |
+
// We'll overwrite that so we get an empty array.
|
60 |
+
return array();
|
61 |
+
}
|
62 |
+
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Returns the value of a field from CFC single and repeater.
|
66 |
+
*
|
67 |
+
*/
|
68 |
+
|
69 |
+
static function get_field( $meta_name = false, $field_name = false, $post_id = false, $key = 0 ){
|
70 |
+
$post_meta = WCK_Template_API::get_meta( $meta_name, $post_id );
|
71 |
+
|
72 |
+
if ( isset( $post_meta[$key][$field_name] ) ){
|
73 |
+
$field_type = WCK_Template_API::generate_slug( WCK_Template_API::get_field_type( $meta_name, $field_name ) );
|
74 |
+
|
75 |
+
// use this filter to modify the return var in order to output text, arrays or objects
|
76 |
+
$output = apply_filters('wck_output_get_field_' . $field_type, $post_meta[$key][$field_name] );
|
77 |
+
|
78 |
+
return $output;
|
79 |
+
}
|
80 |
+
return '';
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Find out what type of field the user asks for.
|
85 |
+
*
|
86 |
+
*/
|
87 |
+
|
88 |
+
static function get_field_type( $meta_name = false, $field_name = false ){
|
89 |
+
|
90 |
+
// get all CFC's
|
91 |
+
$args = array(
|
92 |
+
'post_type' => 'wck-meta-box',
|
93 |
+
'posts_per_page' => -1,
|
94 |
+
'post_status' => 'all',
|
95 |
+
'fields' => 'ids',
|
96 |
+
);
|
97 |
+
$all_cfc = get_posts( $args );
|
98 |
+
|
99 |
+
foreach( $all_cfc as $post_id ) {
|
100 |
+
$queried_meta_name = WCK_Template_API::get_meta('wck_cfc_args', $post_id );
|
101 |
+
$queried_meta_name = $queried_meta_name[0]['meta-name'];
|
102 |
+
|
103 |
+
if ( $meta_name == $queried_meta_name ) {
|
104 |
+
$available_fields = WCK_Template_API::get_meta( 'wck_cfc_fields', $post_id );
|
105 |
+
|
106 |
+
foreach ( $available_fields as $key => $field_data ){
|
107 |
+
$current_field = WCK_Template_API::generate_slug( $field_data['field-title'] );
|
108 |
+
if ( $current_field == $field_name ){
|
109 |
+
return $field_data['field-type'];
|
110 |
+
}
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
return 'text';
|
116 |
+
}
|
117 |
+
|
118 |
+
|
119 |
+
/**
|
120 |
+
* The function used to generate slugs in WCK
|
121 |
+
* It's a copy from WCK-API so the template API is stand-alone
|
122 |
+
*
|
123 |
+
* @since 1.1.5
|
124 |
+
*
|
125 |
+
* @param string $string The input string from which we generate the slug
|
126 |
+
* @return string $slug The henerated slug
|
127 |
+
*/
|
128 |
+
static function generate_slug( $string ){
|
129 |
+
$slug = rawurldecode( sanitize_title_with_dashes( remove_accents( $string ) ) );
|
130 |
+
return $slug;
|
131 |
+
}
|
132 |
+
}
|
wck-template-api/wck-template-api.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Copyright 2013 cozmoslabs.com (email : hello@cozmoslabs.com)
|
3 |
+
This program is free software; you can redistribute it and/or modify
|
4 |
+
it under the terms of the GNU General Public License as published by
|
5 |
+
the Free Software Foundation; either version 2 of the License, or
|
6 |
+
(at your option) any later version.
|
7 |
+
This program is distributed in the hope that it will be useful,
|
8 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10 |
+
GNU General Public License for more details.
|
11 |
+
You should have received a copy of the GNU General Public License
|
12 |
+
along with this program; if not, write to the Free Software
|
13 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
14 |
+
*/
|
15 |
+
|
16 |
+
|
17 |
+
// Load the WCK_Template_API class
|
18 |
+
require_once( 'wck-template-api-class.php' );
|
19 |
+
|
20 |
+
// Load the functions that will preprocess our field data
|
21 |
+
require_once( 'wck-field-preprocess.php' );
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Front-end function that returns an entire non-processed post meta
|
25 |
+
*
|
26 |
+
* @since 1.1.5
|
27 |
+
*
|
28 |
+
*/
|
29 |
+
if( !function_exists( 'get_cfc_meta' ) ){
|
30 |
+
function get_cfc_meta( $meta_name = false, $post_id = false ){
|
31 |
+
return WCK_Template_API::get_meta( $meta_name, $post_id );
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Front-end function that returns a pre-processed CFC field
|
37 |
+
*
|
38 |
+
* @since 1.1.5
|
39 |
+
*
|
40 |
+
*/
|
41 |
+
if( !function_exists( 'get_cfc_field' ) ){
|
42 |
+
function get_cfc_field( $meta_name, $field_name, $post_id = false, $key = 0 ){
|
43 |
+
return WCK_Template_API::get_field( $meta_name, $field_name, $post_id, $key );
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Front-end function that echo out information found inside the field
|
49 |
+
*
|
50 |
+
* @since 1.1.5
|
51 |
+
*
|
52 |
+
*/
|
53 |
+
if( !function_exists( 'the_cfc_field' ) ){
|
54 |
+
function the_cfc_field( $meta_name, $field_name, $post_id = false, $key = 0 ){
|
55 |
+
|
56 |
+
$current_field = WCK_Template_API::get_field( $meta_name, $field_name, $post_id, $key );
|
57 |
+
|
58 |
+
$field_type = WCK_Template_API::generate_slug( WCK_Template_API::get_field_type( $meta_name, $field_name ) );
|
59 |
+
|
60 |
+
// use this filter to modify the return var in order to output text, links or urls
|
61 |
+
$current_field = apply_filters('wck_output_the_field_' . $field_type, $current_field );
|
62 |
+
|
63 |
+
if( $current_field === false ){
|
64 |
+
return;
|
65 |
+
}
|
66 |
+
|
67 |
+
// Echoing objects with error out.
|
68 |
+
// Thus we're echoing an empty string so we don't brake the front-end,
|
69 |
+
if ( is_object( $current_field ) ){
|
70 |
+
return;
|
71 |
+
}
|
72 |
+
|
73 |
+
// Echoing arrays will echo 'Array'.
|
74 |
+
// Thus we're echoing an empty string so we don't brake the front-end.
|
75 |
+
if ( is_array( $current_field ) ){
|
76 |
+
return;
|
77 |
+
}
|
78 |
+
|
79 |
+
echo $current_field;
|
80 |
+
}
|
81 |
+
}
|
wck.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/*
|
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: Reflection Media, Madalin Ungureanu
|
6 |
-
Version: 1.0.
|
7 |
Author URI: http://www.reflectionmedia.ro
|
8 |
|
9 |
License: GPL2
|
@@ -52,19 +52,48 @@ function wck_remove_wck_submenu_page(){
|
|
52 |
remove_submenu_page( 'wck-page', 'wck-page' );
|
53 |
}
|
54 |
|
|
|
|
|
|
|
|
|
55 |
/* include Start and Settings Page */
|
56 |
require_once('wck-sas.php');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
/* include Custom Post Type Creator */
|
58 |
-
|
|
|
59 |
/* include Custom Taxonomy Creator */
|
60 |
-
|
|
|
61 |
/* include Custom Fields Creator */
|
62 |
-
|
|
|
|
|
|
|
|
|
63 |
/* include FrontEnd Posting */
|
64 |
-
if( file_exists( dirname(__FILE__).'/wck-fep.php' ) )
|
65 |
require_once('wck-fep.php');
|
66 |
/* include Option Page Creator */
|
67 |
-
if( file_exists( dirname(__FILE__).'/wck-opc.php' ) )
|
68 |
require_once('wck-opc.php');
|
69 |
|
70 |
/* deactivation hook */
|
@@ -93,7 +122,7 @@ if (file_exists ($wck_premium_update . 'update-checker.php')){
|
|
93 |
}
|
94 |
|
95 |
/* include nested repeaters */
|
96 |
-
if( file_exists( dirname(__FILE__).'/wordpress-creation-kit-api/wck-nested-repeaters/wck-nested-repeaters.php' ) )
|
97 |
-
require_once('wordpress-creation-kit-api/wck-nested-repeaters/wck-nested-repeaters.php');
|
98 |
|
99 |
?>
|
2 |
/*
|
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: Reflection Media, Madalin Ungureanu, sareiodata
|
6 |
+
Version: 1.0.4
|
7 |
Author URI: http://www.reflectionmedia.ro
|
8 |
|
9 |
License: GPL2
|
52 |
remove_submenu_page( 'wck-page', 'wck-page' );
|
53 |
}
|
54 |
|
55 |
+
/* include template API */
|
56 |
+
if( file_exists( dirname(__FILE__).'/wck-template-api/wck-template-api.php' ) )
|
57 |
+
require_once('wck-template-api/wck-template-api.php');
|
58 |
+
|
59 |
/* include Start and Settings Page */
|
60 |
require_once('wck-sas.php');
|
61 |
+
|
62 |
+
$wck_tools = get_option( 'wck_tools' );
|
63 |
+
if( $wck_tools ){
|
64 |
+
if( !empty( $wck_tools[0]['custom-fields-creator'] ) ){
|
65 |
+
$wck_cfc = $wck_tools[0]['custom-fields-creator'];
|
66 |
+
}
|
67 |
+
if( !empty( $wck_tools[0]['custom-post-type-creator'] ) ){
|
68 |
+
$wck_cptc = $wck_tools[0]['custom-post-type-creator'];
|
69 |
+
}
|
70 |
+
if( !empty( $wck_tools[0]['custom-taxonomy-creator'] ) ){
|
71 |
+
$wck_ctc = $wck_tools[0]['custom-taxonomy-creator'];
|
72 |
+
}
|
73 |
+
if( !empty( $wck_tools[0]['frontend-posting'] ) ){
|
74 |
+
$wck_fep = $wck_tools[0]['frontend-posting'];
|
75 |
+
}
|
76 |
+
if( !empty( $wck_tools[0]['option-pages-creator'] ) ){
|
77 |
+
$wck_opc = $wck_tools[0]['option-pages-creator'];
|
78 |
+
}
|
79 |
+
}
|
80 |
/* include Custom Post Type Creator */
|
81 |
+
if( !isset( $wck_cptc ) || $wck_cptc == 'enabled' )
|
82 |
+
require_once('wck-cptc.php');
|
83 |
/* include Custom Taxonomy Creator */
|
84 |
+
if( !isset( $wck_ctc ) || $wck_ctc == 'enabled' )
|
85 |
+
require_once('wck-ctc.php');
|
86 |
/* include Custom Fields Creator */
|
87 |
+
if( !isset( $wck_cfc ) || $wck_cfc == 'enabled' )
|
88 |
+
require_once('wck-cfc.php');
|
89 |
+
|
90 |
+
|
91 |
+
|
92 |
/* include FrontEnd Posting */
|
93 |
+
if( file_exists( dirname(__FILE__).'/wck-fep.php' ) && ( !isset( $wck_fep ) || $wck_fep == 'enabled' ) )
|
94 |
require_once('wck-fep.php');
|
95 |
/* include Option Page Creator */
|
96 |
+
if( file_exists( dirname(__FILE__).'/wck-opc.php' ) && ( !isset( $wck_opc ) || $wck_opc == 'enabled' ) )
|
97 |
require_once('wck-opc.php');
|
98 |
|
99 |
/* deactivation hook */
|
122 |
}
|
123 |
|
124 |
/* include nested repeaters */
|
125 |
+
/* if( file_exists( dirname(__FILE__).'/wordpress-creation-kit-api/wck-nested-repeaters/wck-nested-repeaters.php' ) )
|
126 |
+
require_once('wordpress-creation-kit-api/wck-nested-repeaters/wck-nested-repeaters.php'); */
|
127 |
|
128 |
?>
|
wordpress-creation-kit-api/fields/text.php
CHANGED
@@ -8,6 +8,9 @@
|
|
8 |
|
9 |
$element .= '<input type="text" name="'. esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'" id="';
|
10 |
if( !empty( $frontend_prefix ) )
|
11 |
-
$element .= $frontend_prefix;
|
12 |
-
$element .= esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'"
|
|
|
|
|
|
|
13 |
?>
|
8 |
|
9 |
$element .= '<input type="text" name="'. esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'" id="';
|
10 |
if( !empty( $frontend_prefix ) )
|
11 |
+
$element .= $frontend_prefix;
|
12 |
+
$element .= esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'"';
|
13 |
+
if( !empty( $details['readonly'] ) && $details['readonly'] )
|
14 |
+
$element .= 'readonly="readonly"';
|
15 |
+
$element .= ' value="'. esc_attr( $value ) .'" class="mb-text-input mb-field"/>';
|
16 |
?>
|
wordpress-creation-kit-api/fields/upload.php
CHANGED
@@ -31,9 +31,12 @@ if( !empty ( $value ) )
|
|
31 |
$element .= '<span class="wck-remove-upload">'.__( 'Remove', 'wck' ).'</span>';
|
32 |
$element .= '</p></div>';
|
33 |
/* the upload link. we send through get the hidden input id, details div id and meta name */
|
34 |
-
if( !empty( $details['attach_to_post'] ) )
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
37 |
$attach_to_post = '';
|
38 |
|
39 |
if( empty( $var_prefix ) )
|
31 |
$element .= '<span class="wck-remove-upload">'.__( 'Remove', 'wck' ).'</span>';
|
32 |
$element .= '</p></div>';
|
33 |
/* the upload link. we send through get the hidden input id, details div id and meta name */
|
34 |
+
if( !empty( $details['attach_to_post'] ) ){
|
35 |
+
if( get_the_id() != null )
|
36 |
+
$post_id = get_the_id();
|
37 |
+
|
38 |
+
$attach_to_post = 'post_id='. $post_id .'&';
|
39 |
+
}else
|
40 |
$attach_to_post = '';
|
41 |
|
42 |
if( empty( $var_prefix ) )
|
wordpress-creation-kit-api/fields/wysiwyg editor.php
CHANGED
@@ -6,5 +6,5 @@
|
|
6 |
* @return string $element input element html string. */
|
7 |
|
8 |
$element .= '<textarea name="'. esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'" style="vertical-align:top;width:400px;height:200px" class="mb-textarea mb-field '. esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'">'. esc_html( $value ) .'</textarea>';
|
9 |
-
$element .= '<script type="text/javascript">jQuery( function(){ wckInitTinyMCE("'. Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) .'")});</script>';
|
10 |
?>
|
6 |
* @return string $element input element html string. */
|
7 |
|
8 |
$element .= '<textarea name="'. esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'" style="vertical-align:top;width:400px;height:200px" class="mb-textarea mb-field '. esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'">'. esc_html( $value ) .'</textarea>';
|
9 |
+
$element .= '<script type="text/javascript">jQuery( function(){ if ( typeof wckInitTinyMCE == "function" ) wckInitTinyMCE("'. Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) .'")});</script>';
|
10 |
?>
|
wordpress-creation-kit-api/readme.txt
CHANGED
@@ -111,7 +111,7 @@ Parameters for meta_array
|
|
111 |
'description' (string) The description of the field.
|
112 |
'required' (boolean) true if the field is required.
|
113 |
'default' (string) If you want the string to have a default value enter it here. For Checkboxes if there are multiple
|
114 |
-
values
|
115 |
'default-option' (boolean) true if you want Select to have a default option.
|
116 |
'options' (array) Options for field types "select", "checkbox" and "radio".
|
117 |
|
111 |
'description' (string) The description of the field.
|
112 |
'required' (boolean) true if the field is required.
|
113 |
'default' (string) If you want the string to have a default value enter it here. For Checkboxes if there are multiple
|
114 |
+
values separate them with a ",".
|
115 |
'default-option' (boolean) true if you want Select to have a default option.
|
116 |
'options' (array) Options for field types "select", "checkbox" and "radio".
|
117 |
|
wordpress-creation-kit-api/wordpress-creation-kit.css
CHANGED
@@ -219,4 +219,33 @@ td.wck-number{
|
|
219 |
|
220 |
.mb-table-container li[data-type="nested-repeater"]{
|
221 |
display:none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
}
|
219 |
|
220 |
.mb-table-container li[data-type="nested-repeater"]{
|
221 |
display:none;
|
222 |
+
}
|
223 |
+
|
224 |
+
.wck_page_cptc-page #contextual-help-link-wrap, .wck_page_ctc-page #contextual-help-link-wrap, .wck_page_cfc-page #contextual-help-link-wrap, .wck_page_fep-page #contextual-help-link-wrap, .wck_page_opc-page #contextual-help-link-wrap{
|
225 |
+
background: rgb(248,79,79); /* Old browsers */
|
226 |
+
background: -moz-linear-gradient(top, rgba(248,79,79,1) 0%, rgba(210,11,11,1) 100%); /* FF3.6+ */
|
227 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(248,79,79,1)), color-stop(100%,rgba(210,11,11,1))); /* Chrome,Safari4+ */
|
228 |
+
background: -webkit-linear-gradient(top, rgba(248,79,79,1) 0%,rgba(210,11,11,1) 100%); /* Chrome10+,Safari5.1+ */
|
229 |
+
background: -o-linear-gradient(top, rgba(248,79,79,1) 0%,rgba(210,11,11,1) 100%); /* Opera 11.10+ */
|
230 |
+
background: -ms-linear-gradient(top, rgba(248,79,79,1) 0%,rgba(210,11,11,1) 100%); /* IE10+ */
|
231 |
+
background: linear-gradient(to bottom, rgba(248,79,79,1) 0%,rgba(210,11,11,1) 100%); /* W3C */
|
232 |
+
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f84f4f', endColorstr='#d20b0b',GradientType=0 ); /* IE6-9 */
|
233 |
+
}
|
234 |
+
|
235 |
+
.wck_page_cptc-page #contextual-help-link-wrap #contextual-help-link, .wck_page_ctc-page #contextual-help-link-wrap #contextual-help-link, .wck_page_cfc-page #contextual-help-link-wrap #contextual-help-link, .wck_page_fep-page #contextual-help-link-wrap #contextual-help-link, .wck_page_opc-page #contextual-help-link-wrap #contextual-help-link{
|
236 |
+
padding-left:55px;
|
237 |
+
color: #FFFFFF;
|
238 |
+
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
|
239 |
+
}
|
240 |
+
|
241 |
+
.wck_page_cptc-page #contextual-help-link-wrap #contextual-help-link:before, .wck_page_ctc-page #contextual-help-link-wrap #contextual-help-link:before, .wck_page_cfc-page #contextual-help-link-wrap #contextual-help-link:before, .wck_page_fep-page #contextual-help-link-wrap #contextual-help-link:before, .wck_page_opc-page #contextual-help-link-wrap #contextual-help-link:before{
|
242 |
+
content:"WCK";
|
243 |
+
width:15px;
|
244 |
+
height:20px;
|
245 |
+
background:url( ../images/wck-icon-dark.png ) no-repeat 0 0;
|
246 |
+
position:absolute;
|
247 |
+
top:4px;
|
248 |
+
left:4px;
|
249 |
+
line-height: 16px;
|
250 |
+
padding-left: 18px;
|
251 |
}
|
wordpress-creation-kit-api/wordpress-creation-kit.js
CHANGED
@@ -67,8 +67,8 @@ function addMeta(value, id, nonce){
|
|
67 |
jQuery('#'+value).parent().css('opacity','1');
|
68 |
jQuery('#mb-ajax-loading').remove();
|
69 |
|
70 |
-
jQuery.each( response.errorfields, function (index,
|
71 |
-
jQuery( '#'+value+' .field-label[for="' +
|
72 |
});
|
73 |
|
74 |
alert( response.error );
|
@@ -179,7 +179,7 @@ function removeMeta(value, id, element_id, nonce){
|
|
179 |
*/
|
180 |
|
181 |
/* reorder elements through drag and drop */
|
182 |
-
function mb_sortable_elements() {
|
183 |
jQuery( ".mb-table-container tbody" ).not( jQuery( ".mb-table-container.single tbody, .mb-table-container.not-sortable tbody" ) ).sortable({
|
184 |
update: function(event, ui){
|
185 |
|
@@ -326,8 +326,8 @@ function updateMeta(value, id, element_id, nonce){
|
|
326 |
jQuery('#container_'+value).parent().css('opacity','1');
|
327 |
jQuery('#mb-ajax-loading').remove();
|
328 |
|
329 |
-
jQuery.each( response.errorfields, function (index,
|
330 |
-
jQuery( '#update_container_'+value+'_'+element_id + ' .field-label[for="' +
|
331 |
});
|
332 |
|
333 |
alert( response.error );
|
67 |
jQuery('#'+value).parent().css('opacity','1');
|
68 |
jQuery('#mb-ajax-loading').remove();
|
69 |
|
70 |
+
jQuery.each( response.errorfields, function (index, field) {
|
71 |
+
jQuery( '#'+value+' .field-label[for="' + field + '"]' ).addClass('error');
|
72 |
});
|
73 |
|
74 |
alert( response.error );
|
179 |
*/
|
180 |
|
181 |
/* reorder elements through drag and drop */
|
182 |
+
function mb_sortable_elements() {
|
183 |
jQuery( ".mb-table-container tbody" ).not( jQuery( ".mb-table-container.single tbody, .mb-table-container.not-sortable tbody" ) ).sortable({
|
184 |
update: function(event, ui){
|
185 |
|
326 |
jQuery('#container_'+value).parent().css('opacity','1');
|
327 |
jQuery('#mb-ajax-loading').remove();
|
328 |
|
329 |
+
jQuery.each( response.errorfields, function (index, field) {
|
330 |
+
jQuery( '#update_container_'+value+'_'+element_id + ' .field-label[for="' + field + '"]' ).addClass('error');
|
331 |
});
|
332 |
|
333 |
alert( response.error );
|
wordpress-creation-kit-api/wordpress-creation-kit.php
CHANGED
@@ -208,12 +208,13 @@ class Wordpress_Creation_Kit{
|
|
208 |
* @param array $details Contains the details for the field.
|
209 |
* @param string $value Contains input value;
|
210 |
* @param string $context Context where the function is used. Depending on it some actions are preformed.;
|
|
|
211 |
* @return string $element input element html string.
|
212 |
*/
|
213 |
|
214 |
-
function wck_output_form_field( $meta, $details, $value = '', $context = '' ){
|
215 |
$element = '';
|
216 |
-
|
217 |
if( $context == 'edit_form' ){
|
218 |
$edit_class = '.mb-table-container ';
|
219 |
$var_prefix = 'edit';
|
@@ -294,7 +295,7 @@ class Wordpress_Creation_Kit{
|
|
294 |
|
295 |
?>
|
296 |
<li class="row-<?php echo esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) ?>">
|
297 |
-
<?php echo self::wck_output_form_field( $meta, $details ); ?>
|
298 |
</li>
|
299 |
<?php
|
300 |
|
@@ -354,7 +355,7 @@ class Wordpress_Creation_Kit{
|
|
354 |
|
355 |
$form .= '<li class="row-'. esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'">';
|
356 |
|
357 |
-
$form .= self::wck_output_form_field( $meta, $details, $value, 'edit_form' );
|
358 |
|
359 |
$form .= '</li>';
|
360 |
|
@@ -385,14 +386,18 @@ class Wordpress_Creation_Kit{
|
|
385 |
* the meta to apear in custom fields box.
|
386 |
* @param int $id Post id
|
387 |
*/
|
388 |
-
function wck_output_meta_content($meta, $id, $fields){
|
|
|
|
|
|
|
|
|
389 |
|
390 |
if( $this->args['context'] == 'post_meta' || $this->args['context'] == '' )
|
391 |
$results = get_post_meta($id, $meta, true);
|
392 |
else if ( $this->args['context'] == 'option' )
|
393 |
$results = get_option( $meta );
|
394 |
|
395 |
-
$list = '';
|
396 |
$list .= '<table id="container_'.esc_attr($meta).'" class="mb-table-container widefat';
|
397 |
|
398 |
if( $this->args['single'] ) $list .= ' single';
|
@@ -620,6 +625,9 @@ class Wordpress_Creation_Kit{
|
|
620 |
}
|
621 |
}
|
622 |
|
|
|
|
|
|
|
623 |
if( $required_message != '' ){
|
624 |
$errors = array( 'error' => $required_message, 'errorfields' => $required_fields_with_errors );
|
625 |
}
|
@@ -668,7 +676,7 @@ class Wordpress_Creation_Kit{
|
|
668 |
else if ( $this->args['context'] == 'option' )
|
669 |
update_option( $meta, $results );
|
670 |
|
671 |
-
/* if unserialize_fields is true add for each entry
|
672 |
if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){
|
673 |
|
674 |
$meta_suffix = count( $results );
|
@@ -808,6 +816,9 @@ class Wordpress_Creation_Kit{
|
|
808 |
$element_id = $_POST['element_id'];
|
809 |
|
810 |
echo self::mb_update_form($this->args['meta_array'], $meta, $id, $element_id);
|
|
|
|
|
|
|
811 |
exit;
|
812 |
}
|
813 |
|
@@ -1201,7 +1212,7 @@ class Wordpress_Creation_Kit{
|
|
1201 |
* @param string $string The input string from which we generate the slug
|
1202 |
* @return string $slug The henerated slug
|
1203 |
*/
|
1204 |
-
function wck_generate_slug( $string ){
|
1205 |
$slug = rawurldecode( sanitize_title_with_dashes( remove_accents( $string ) ) );
|
1206 |
return $slug;
|
1207 |
}
|
208 |
* @param array $details Contains the details for the field.
|
209 |
* @param string $value Contains input value;
|
210 |
* @param string $context Context where the function is used. Depending on it some actions are preformed.;
|
211 |
+
* @param int $post_id The post ID;
|
212 |
* @return string $element input element html string.
|
213 |
*/
|
214 |
|
215 |
+
function wck_output_form_field( $meta, $details, $value = '', $context = '', $post_id = '' ){
|
216 |
$element = '';
|
217 |
+
|
218 |
if( $context == 'edit_form' ){
|
219 |
$edit_class = '.mb-table-container ';
|
220 |
$var_prefix = 'edit';
|
295 |
|
296 |
?>
|
297 |
<li class="row-<?php echo esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) ?>">
|
298 |
+
<?php echo self::wck_output_form_field( $meta, $details, '', '', $post_id ); ?>
|
299 |
</li>
|
300 |
<?php
|
301 |
|
355 |
|
356 |
$form .= '<li class="row-'. esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'">';
|
357 |
|
358 |
+
$form .= self::wck_output_form_field( $meta, $details, $value, 'edit_form', $id );
|
359 |
|
360 |
$form .= '</li>';
|
361 |
|
386 |
* the meta to apear in custom fields box.
|
387 |
* @param int $id Post id
|
388 |
*/
|
389 |
+
function wck_output_meta_content($meta, $id, $fields, $box_args = '' ){
|
390 |
+
/* in fep $this->args is empty so we need it as a parameter */
|
391 |
+
if( !empty( $box_args ) )
|
392 |
+
$this->args = wp_parse_args( $box_args, $this->defaults );
|
393 |
+
|
394 |
|
395 |
if( $this->args['context'] == 'post_meta' || $this->args['context'] == '' )
|
396 |
$results = get_post_meta($id, $meta, true);
|
397 |
else if ( $this->args['context'] == 'option' )
|
398 |
$results = get_option( $meta );
|
399 |
|
400 |
+
$list = '';
|
401 |
$list .= '<table id="container_'.esc_attr($meta).'" class="mb-table-container widefat';
|
402 |
|
403 |
if( $this->args['single'] ) $list .= ' single';
|
625 |
}
|
626 |
}
|
627 |
|
628 |
+
$required_message .= apply_filters( "wck_extra_message", "", $fields, $required_fields, $meta, $values, $id );
|
629 |
+
$required_fields_with_errors = apply_filters( "wck_required_fields_with_errors", $required_fields_with_errors, $fields, $required_fields, $meta, $value, $id );
|
630 |
+
|
631 |
if( $required_message != '' ){
|
632 |
$errors = array( 'error' => $required_message, 'errorfields' => $required_fields_with_errors );
|
633 |
}
|
676 |
else if ( $this->args['context'] == 'option' )
|
677 |
update_option( $meta, $results );
|
678 |
|
679 |
+
/* if unserialize_fields is true add for each entry separate post meta for every element of the form */
|
680 |
if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){
|
681 |
|
682 |
$meta_suffix = count( $results );
|
816 |
$element_id = $_POST['element_id'];
|
817 |
|
818 |
echo self::mb_update_form($this->args['meta_array'], $meta, $id, $element_id);
|
819 |
+
|
820 |
+
do_action( 'wck_after_adding_form', $meta, $id, $element_id );
|
821 |
+
|
822 |
exit;
|
823 |
}
|
824 |
|
1212 |
* @param string $string The input string from which we generate the slug
|
1213 |
* @return string $slug The henerated slug
|
1214 |
*/
|
1215 |
+
static function wck_generate_slug( $string ){
|
1216 |
$slug = rawurldecode( sanitize_title_with_dashes( remove_accents( $string ) ) );
|
1217 |
return $slug;
|
1218 |
}
|