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

Version Description

  • Fixed bug when arguments contained UTF8 characters ( like hebrew, chirilic... )
  • Fixed Sortable field in Custom Fields Creator that wasn't clickable
Download this release

Release Info

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

Code changes from version 1.0.1 to 1.0.2

images/banner_pro.png CHANGED
Binary file
readme.txt CHANGED
@@ -5,8 +5,8 @@ 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.5.1
9
- Stable tag: 1.0.1
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,10 @@ Creating a taxonomy generally automatically creates a special query variable usi
138
  10. Taxonomy listing
139
 
140
  == Changelog ==
 
 
 
 
141
  = 1.0.1 =
142
  * Fixed Menu Position argument for Custom Post Type Creator.
143
  * Added filter for default_value.
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.5.2
9
+ Stable tag: 1.0.2
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.2 =
142
+ * Fixed bug when arguments contained UTF8 characters ( like hebrew, chirilic... )
143
+ * Fixed Sortable field in Custom Fields Creator that wasn't clickable
144
+
145
  = 1.0.1 =
146
  * Fixed Menu Position argument for Custom Post Type Creator.
147
  * Added filter for default_value.
wck-cfc.php CHANGED
@@ -217,7 +217,7 @@ function wck_cfc_display_label_wrapper_attach_end( $form, $i, $value ){
217
  /* Show the slug for field title */
218
  add_filter( "wck_after_listed_wck_cfc_fields_element_0", 'wck_cfc_display_field_title_slug', 10, 3 );
219
  function wck_cfc_display_field_title_slug( $form, $i, $value ){
220
- $form .= '<li class="slug-title"><em>'. __( 'Slug:', 'wck' ) .'</em><span>'. sanitize_title_with_dashes( remove_accents( $value ) ) .'</span> '. __( '(Note:changing the slug when you already have a lot of existing entries may result in unexpected behavior.)', 'wck' ) .' </li>';
221
  return $form;
222
  }
223
 
@@ -280,7 +280,7 @@ function wck_cfc_create_boxes_args(){
280
  foreach( $wck_cfc_args as $wck_cfc_arg ){
281
 
282
  /* metabox_id must be different from meta_name */
283
- $metabox_id = sanitize_title_with_dashes( remove_accents ( $box_title ) );
284
  if( $wck_cfc_arg['meta-name'] == $metabox_id )
285
  $metabox_id = 'wck-'. $metabox_id;
286
 
@@ -302,8 +302,11 @@ function wck_cfc_create_boxes_args(){
302
 
303
  if( !empty( $wck_cfc_arg['page-template'] ) )
304
  $box_args['page_template'] = $wck_cfc_arg['page-template'];
305
-
306
- $all_box_args[] = apply_filters( "wck_cfc_box_args_".$wck_cfc_arg['meta-name'], $box_args );
 
 
 
307
  }
308
  }
309
  }
@@ -426,8 +429,8 @@ function wck_cfc_change_field_title( $meta, $id, $values, $element_id ){
426
  foreach( $post_id_with_this_meta as $post ){
427
  $results = get_post_meta( $post->post_id, $meta_name, true );
428
  foreach( $results as $key => $result ){
429
- $results[$key][ sanitize_title_with_dashes( remove_accents( $values['field-title'] ) ) ] = $results[$key][ sanitize_title_with_dashes( remove_accents( $wck_cfc_fields[$element_id]['field-title'] ) ) ];
430
- unset( $results[$key][ sanitize_title_with_dashes( remove_accents( $wck_cfc_fields[$element_id]['field-title'] ) ) ] );
431
  }
432
  update_post_meta( $post->post_id, $meta_name, $results );
433
  }
217
  /* Show the slug for field title */
218
  add_filter( "wck_after_listed_wck_cfc_fields_element_0", 'wck_cfc_display_field_title_slug', 10, 3 );
219
  function wck_cfc_display_field_title_slug( $form, $i, $value ){
220
+ $form .= '<li class="slug-title"><em>'. __( 'Slug:', 'wck' ) .'</em><span>'. Wordpress_Creation_Kit::wck_generate_slug( $value ) .'</span> '. __( '(Note:changing the slug when you already have a lot of existing entries may result in unexpected behavior.)', 'wck' ) .' </li>';
221
  return $form;
222
  }
223
 
280
  foreach( $wck_cfc_args as $wck_cfc_arg ){
281
 
282
  /* metabox_id must be different from meta_name */
283
+ $metabox_id = Wordpress_Creation_Kit::wck_generate_slug( $box_title );
284
  if( $wck_cfc_arg['meta-name'] == $metabox_id )
285
  $metabox_id = 'wck-'. $metabox_id;
286
 
302
 
303
  if( !empty( $wck_cfc_arg['page-template'] ) )
304
  $box_args['page_template'] = $wck_cfc_arg['page-template'];
305
+
306
+ /* create the box */
307
+ //new Wordpress_Creation_Kit( $box_args );
308
+
309
+ $all_box_args[] = $box_args;
310
  }
311
  }
312
  }
429
  foreach( $post_id_with_this_meta as $post ){
430
  $results = get_post_meta( $post->post_id, $meta_name, true );
431
  foreach( $results as $key => $result ){
432
+ $results[$key][ Wordpress_Creation_Kit::wck_generate_slug( $values['field-title'] ) ] = $results[$key][ Wordpress_Creation_Kit::wck_generate_slug( $wck_cfc_fields[$element_id]['field-title'] ) ];
433
+ unset( $results[$key][ Wordpress_Creation_Kit::wck_generate_slug( $wck_cfc_fields[$element_id]['field-title'] ) ] );
434
  }
435
  update_post_meta( $post->post_id, $meta_name, $results );
436
  }
wck.php CHANGED
@@ -3,13 +3,13 @@
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.1
7
  Author URI: http://www.reflectionmedia.ro
8
 
9
  License: GPL2
10
 
11
  == Copyright ==
12
- Copyright 2013 Reflection Media (wwww.reflectionmedia.ro)
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License as published by
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.2
7
  Author URI: http://www.reflectionmedia.ro
8
 
9
  License: GPL2
10
 
11
  == Copyright ==
12
+ Copyright 2011 Reflection Media (wwww.reflectionmedia.ro)
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License as published by
wordpress-creation-kit-api/fields/checkbox.php CHANGED
@@ -33,7 +33,7 @@ foreach( $details['options'] as $option ){
33
  }
34
  }
35
 
36
- $element .= '<div><label><input type="checkbox" name="'. esc_attr( sanitize_title_with_dashes( remove_accents( $details['title'] ) ) ) .'" id="'. $frontend_prefix . esc_attr( sanitize_title_with_dashes( remove_accents( $details['title'] . '_' . $value_attr ) ) ) .'" value="'. esc_attr( $value_attr ) .'" '. checked( $found, true, false ) .'class="mb-checkbox mb-field" />'. esc_html( $label ) .'</label></div>' ;
37
  }
38
  $element .= '</div>';
39
  }
33
  }
34
  }
35
 
36
+ $element .= '<div><label><input type="checkbox" name="'. esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'" id="'. $frontend_prefix . esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] . '_' . $value_attr ) ) .'" value="'. esc_attr( $value_attr ) .'" '. checked( $found, true, false ) .'class="mb-checkbox mb-field" />'. esc_html( $label ) .'</label></div>' ;
37
  }
38
  $element .= '</div>';
39
  }
wordpress-creation-kit-api/fields/radio.php CHANGED
@@ -29,7 +29,7 @@ if( !empty( $details['options'] ) ){
29
  }
30
  }
31
 
32
- $element .= '<div><label><input type="radio" name="'. esc_attr( sanitize_title_with_dashes( remove_accents( $details['title'] ) ) ) .'" id="'. $frontend_prefix . esc_attr( sanitize_title_with_dashes( remove_accents( $details['title'] . '_' . $value_attr ) ) ) .'" value="'. esc_attr( $value_attr ) .'" '. checked( $found, true, false ) .'class="mb-radio mb-field" />'. esc_html( $label ) .'</label></div>';
33
  }
34
  $element .= '</div>';
35
  }
29
  }
30
  }
31
 
32
+ $element .= '<div><label><input type="radio" name="'. esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'" id="'. $frontend_prefix . esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] . '_' . $value_attr ) ) .'" value="'. esc_attr( $value_attr ) .'" '. checked( $found, true, false ) .'class="mb-radio mb-field" />'. esc_html( $label ) .'</label></div>';
33
  }
34
  $element .= '</div>';
35
  }
wordpress-creation-kit-api/fields/select.php CHANGED
@@ -5,7 +5,7 @@
5
  * @param string $context Context where the function is used. Depending on it some actions are preformed.;
6
  * @return string $element input element html string. */
7
 
8
- $element .= '<select name="'. esc_attr( sanitize_title_with_dashes( remove_accents( $details['title'] ) ) ) .'" id="'. $frontend_prefix . esc_attr( sanitize_title_with_dashes( remove_accents( $details['title'] ) ) ) .'" class="mb-select mb-field" >';
9
 
10
  if( !empty( $details['default-option'] ) && $details['default-option'] )
11
  $element .= '<option value="">'. __('...Chose', 'wck') .'</option>';
@@ -40,7 +40,7 @@ if( !empty( $details['options'] ) ){
40
  $i++;
41
  }
42
  }
43
- $field_name = sanitize_title_with_dashes( remove_accents( $details['title'] ) );
44
  $element .= apply_filters( "wck_select_{$meta}_{$field_name}_options", $options );
45
  $element .= '</select>';
46
  ?>
5
  * @param string $context Context where the function is used. Depending on it some actions are preformed.;
6
  * @return string $element input element html string. */
7
 
8
+ $element .= '<select name="'. esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'" id="'. $frontend_prefix . esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'" class="mb-select mb-field" >';
9
 
10
  if( !empty( $details['default-option'] ) && $details['default-option'] )
11
  $element .= '<option value="">'. __('...Chose', 'wck') .'</option>';
40
  $i++;
41
  }
42
  }
43
+ $field_name = Wordpress_Creation_Kit::wck_generate_slug( $details['title'] );
44
  $element .= apply_filters( "wck_select_{$meta}_{$field_name}_options", $options );
45
  $element .= '</select>';
46
  ?>
wordpress-creation-kit-api/fields/text.php CHANGED
@@ -6,5 +6,5 @@
6
  * @return string $element input element html string. */
7
 
8
 
9
- $element .= '<input type="text" name="'. esc_attr( sanitize_title_with_dashes( remove_accents( $details['title'] ) ) ) .'" id="'. $frontend_prefix . esc_attr( sanitize_title_with_dashes( remove_accents( $details['title'] ) ) ) .'" value="'. esc_attr( $value ) .'" class="mb-text-input mb-field"/>';
10
  ?>
6
  * @return string $element input element html string. */
7
 
8
 
9
+ $element .= '<input type="text" name="'. esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'" id="'. $frontend_prefix . esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'" value="'. esc_attr( $value ) .'" class="mb-text-input mb-field"/>';
10
  ?>
wordpress-creation-kit-api/fields/textarea.php CHANGED
@@ -5,5 +5,5 @@
5
  * @param string $context Context where the function is used. Depending on it some actions are preformed.;
6
  * @return string $element input element html string. */
7
 
8
- $element .= '<textarea name="'. esc_attr( sanitize_title_with_dashes( remove_accents( $details['title'] ) ) ) .'" id="'. $frontend_prefix . esc_attr( sanitize_title_with_dashes( remove_accents( $details['title'] ) ) ) .'" style="vertical-align:top;" class="mb-textarea mb-field">'. esc_html( $value ) .'</textarea>';
9
  ?>
5
  * @param string $context Context where the function is used. Depending on it some actions are preformed.;
6
  * @return string $element input element html string. */
7
 
8
+ $element .= '<textarea name="'. esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'" id="'. $frontend_prefix . esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'" style="vertical-align:top;" class="mb-textarea mb-field">'. esc_html( $value ) .'</textarea>';
9
  ?>
wordpress-creation-kit-api/fields/upload.php CHANGED
@@ -6,11 +6,11 @@
6
  * @return string $element input element html string. */
7
 
8
  /* define id's for input and info div */
9
- $upload_input_id = str_replace( '-', '_', sanitize_title_with_dashes( remove_accents( $meta . $details['title'] ) ) );
10
- $upload_info_div_id = str_replace( '-', '_', sanitize_title_with_dashes( remove_accents( $meta .'_info_container_'. $details['title'] ) ) );
11
 
12
  /* hidden input that will hold the attachment id */
13
- $element .= '<input id="'. esc_attr( $upload_input_id ) .'" type="hidden" size="36" name="'. esc_attr( sanitize_title_with_dashes( remove_accents ( $details['title'] ) ) ) .'" value="'. $value .'" class="mb-text-input mb-field"/>';
14
 
15
  /* container for the image preview (or file ico) and name and file type */
16
  if( !empty ( $value ) ){
@@ -37,7 +37,7 @@ $media_upload_url = 'media-upload.php?'.$attach_to_post.'type=file&amp;mb_type='
37
 
38
  $media_upload_url = admin_url( $media_upload_url );
39
 
40
- $element .= '<a id="upload_'. esc_attr(sanitize_title_with_dashes( remove_accents( $details['title'] ) )) .'_button" class="button" onclick="tb_show(\'\', \''.$media_upload_url.'\');">'. __( 'Upload ', 'wck' ) . $details['title'] .' </a>';
41
 
42
  /* add js global var for the hidden input, and info container div */
43
  $element .= '<script type="text/javascript">';
6
  * @return string $element input element html string. */
7
 
8
  /* define id's for input and info div */
9
+ $upload_input_id = str_replace( '-', '_', Wordpress_Creation_Kit::wck_generate_slug( $meta . $details['title'] ) );
10
+ $upload_info_div_id = str_replace( '-', '_', Wordpress_Creation_Kit::wck_generate_slug( $meta .'_info_container_'. $details['title'] ) );
11
 
12
  /* hidden input that will hold the attachment id */
13
+ $element .= '<input id="'. esc_attr( $upload_input_id ) .'" type="hidden" size="36" name="'. esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'" value="'. $value .'" class="mb-text-input mb-field"/>';
14
 
15
  /* container for the image preview (or file ico) and name and file type */
16
  if( !empty ( $value ) ){
37
 
38
  $media_upload_url = admin_url( $media_upload_url );
39
 
40
+ $element .= '<a id="upload_'. esc_attr(Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'_button" class="button" onclick="tb_show(\'\', \''.$media_upload_url.'\');">'. __( 'Upload ', 'wck' ) . $details['title'] .' </a>';
41
 
42
  /* add js global var for the hidden input, and info container div */
43
  $element .= '<script type="text/javascript">';
wordpress-creation-kit-api/fields/wysiwyg editor.php CHANGED
@@ -5,6 +5,6 @@
5
  * @param string $context Context where the function is used. Depending on it some actions are preformed.;
6
  * @return string $element input element html string. */
7
 
8
- $element .= '<textarea name="'. esc_attr( sanitize_title_with_dashes( remove_accents( $details['title'] ) ) ) .'" style="vertical-align:top;width:400px;height:200px" class="mb-textarea mb-field '. esc_attr( sanitize_title_with_dashes( remove_accents( $details['title'] ) ) ) .'">'. esc_html( $value ) .'</textarea>';
9
- $element .= '<script type="text/javascript">jQuery( function(){ wckInitTinyMCE("'. sanitize_title_with_dashes( remove_accents( $details['title'] ) ) .'")});</script>';
10
  ?>
5
  * @param string $context Context where the function is used. Depending on it some actions are preformed.;
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
  ?>
wordpress-creation-kit-api/wordpress-creation-kit.css CHANGED
@@ -1,207 +1,207 @@
1
- .wck-post-box{
2
- visibility:hidden;
3
- height:0;
4
- overflow:auto;
5
- }
6
-
7
- .mb-list-entry-fields li{
8
- margin-bottom:15px;
9
- clear:both;
10
- overflow:hidden;
11
- }
12
-
13
- .mb-right-column{
14
- overflow:hidden;
15
- }
16
-
17
- .field-label{
18
- /* width:190px; */
19
- float:left;
20
- min-height:30px;
21
- font-weight:bold;
22
- padding-right:10px;
23
- }
24
-
25
- .field-label.error{
26
- color:#ff0000;
27
- }
28
-
29
- .field-label .required{
30
- color:#ff0000;
31
- padding:0 2px;
32
- }
33
-
34
- .mb-right-column label{
35
- padding:0 6px 0 0;
36
- }
37
-
38
- .mb-right-column input[type="checkbox"], .mb-right-column input[type="radio"]{
39
- margin-right:3px;
40
- }
41
-
42
- #mb-ajax-loading{
43
- position:absolute;
44
- top:0;
45
- left:0;
46
- width:100%;
47
- height:100%;
48
- background:url(images/ajax-loader.gif) center center no-repeat; z-index:999;
49
- }
50
-
51
- .mb-table-container pre{
52
- display:inline-block;
53
- vertical-align:top;
54
- margin:0;
55
- white-space: -moz-pre-wrap;
56
- white-space: -pre-wrap;
57
- white-space: -o-pre-wrap;
58
- white-space: pre-wrap;
59
- word-wrap: break-word;
60
- }
61
-
62
-
63
- .wck-edit, .wck-delete, .wck-number{
64
- width:50px;
65
- text-align:center !important;
66
- }
67
-
68
- td.wck-number{
69
- cursor:move;
70
- }
71
-
72
- .wck-content > ul{
73
- margin:0;
74
- }
75
-
76
- .not-sortable td.wck-number{
77
- cursor:auto;
78
- }
79
-
80
- .wck-edit .button-secondary{
81
- padding:0 15px;
82
- }
83
-
84
- .mbdelete, .wck-remove-upload{
85
- color:#BC0B0B;
86
- cursor:pointer;
87
- }
88
-
89
- .mbdelete:hover, .wck-remove-upload:hover{
90
- color:#FF0000;
91
- }
92
-
93
- .mb-list-entry-fields{
94
- list-style:none;
95
- }
96
-
97
- .mb-table-container tr:nth-child(2n+1) {
98
- background-color:#FCFCFC;
99
- }
100
-
101
- .mb-table-container tr:last-child td {
102
- border-bottom: 0 none;
103
- }
104
-
105
- .mb-table-container tr td {
106
- background: none repeat scroll 0 0 transparent;
107
- border-bottom: 1px solid #EDEDED;
108
- border-right: 1px solid #EDEDED;
109
- padding: 8px;
110
- position: relative;
111
- }
112
-
113
- .mb-table-container tr td:last-child {
114
- border-right: 0 none;
115
- }
116
-
117
- .mb-table-container thead > tr > th {
118
- border-right: 1px solid #E1E1E1;
119
- }
120
-
121
- .mb-table-container tr > th:last-child {
122
- border-right: 0 none;
123
- }
124
-
125
- .mb-textarea{
126
- width:60%;
127
- max-width:600px;
128
- height:130px;
129
- }
130
- .mb-text-input{
131
- width:40%;
132
- max-width:400px;
133
- }
134
-
135
- .mb-select{
136
- min-width:150px;
137
- }
138
-
139
- /* upload field */
140
- .upload-field-details{
141
- display:inline-block;
142
- vertical-align:middle;
143
- min-height:24px;
144
- padding:2px 0;
145
- }
146
-
147
- .upload-field-details p{
148
- margin:2px 0 0;
149
- }
150
-
151
- .upload-field-details img{
152
- margin:0 5px;
153
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
154
- }
155
-
156
- .upload-field-details > *{
157
- float:left;
158
- }
159
-
160
- .upload-field-details span{
161
- display:block;
162
- }
163
-
164
- .upload-field-details .file-name{
165
- font-weight:bold;
166
- color:#21759B;
167
- }
168
-
169
-
170
- /* Settings page. */
171
- .side .form-table th {
172
- width: 20%;
173
- font-weight: bold;
174
- text-align: left;
175
- padding-left: 0;
176
- }
177
-
178
- .wck-post-body{
179
- clear: left;
180
- float: left;
181
- margin-right: -2000px;
182
- width: 100%;
183
- }
184
-
185
- .metabox-holder .column-1 {
186
- margin-right:300px;
187
- }
188
- .metabox-holder .column-2 {
189
- float: right;
190
- width: 280px;
191
- clear:right;
192
- position:relative;
193
- }
194
- .metabox-holder .column-3 {
195
- clear: both;
196
- margin-right:300px;
197
- }
198
-
199
- /* wysiwyg */
200
- .mb-right-column .wp_themeSkin table.mceLayout{
201
- border-color: #CCCCCC #CCCCCC #DFDFDF;
202
- border-style: solid;
203
- border-top-left-radius: 3px;
204
- border-top-right-radius: 3px;
205
- border-width: 1px;
206
- background-color:#fff;
207
  }
1
+ .wck-post-box{
2
+ visibility:hidden;
3
+ height:0;
4
+ overflow:auto;
5
+ }
6
+
7
+ .mb-list-entry-fields li{
8
+ margin-bottom:15px;
9
+ clear:both;
10
+ overflow:hidden;
11
+ }
12
+
13
+ .mb-right-column{
14
+ overflow:hidden;
15
+ }
16
+
17
+ .field-label{
18
+ /* width:190px; */
19
+ float:left;
20
+ min-height:30px;
21
+ font-weight:bold;
22
+ padding-right:10px;
23
+ }
24
+
25
+ .field-label.error{
26
+ color:#ff0000;
27
+ }
28
+
29
+ .field-label .required{
30
+ color:#ff0000;
31
+ padding:0 2px;
32
+ }
33
+
34
+ .mb-right-column label{
35
+ padding:0 6px 0 0;
36
+ }
37
+
38
+ .mb-right-column input[type="checkbox"], .mb-right-column input[type="radio"]{
39
+ margin-right:3px;
40
+ }
41
+
42
+ #mb-ajax-loading{
43
+ position:absolute;
44
+ top:0;
45
+ left:0;
46
+ width:100%;
47
+ height:100%;
48
+ background:url(images/ajax-loader.gif) center center no-repeat; z-index:999;
49
+ }
50
+
51
+ .mb-table-container pre{
52
+ display:inline-block;
53
+ vertical-align:top;
54
+ margin:0;
55
+ white-space: -moz-pre-wrap;
56
+ white-space: -pre-wrap;
57
+ white-space: -o-pre-wrap;
58
+ white-space: pre-wrap;
59
+ word-wrap: break-word;
60
+ }
61
+
62
+
63
+ .wck-edit, .wck-delete, .wck-number{
64
+ width:50px;
65
+ text-align:center !important;
66
+ }
67
+
68
+ td.wck-number{
69
+ cursor:move;
70
+ }
71
+
72
+ .wck-content > ul{
73
+ margin:0;
74
+ }
75
+
76
+ .not-sortable td.wck-number{
77
+ cursor:auto;
78
+ }
79
+
80
+ .wck-edit .button-secondary{
81
+ padding:0 15px;
82
+ }
83
+
84
+ .mbdelete, .wck-remove-upload{
85
+ color:#BC0B0B;
86
+ cursor:pointer;
87
+ }
88
+
89
+ .mbdelete:hover, .wck-remove-upload:hover{
90
+ color:#FF0000;
91
+ }
92
+
93
+ .mb-list-entry-fields{
94
+ list-style:none;
95
+ }
96
+
97
+ .mb-table-container tr:nth-child(2n+1) {
98
+ background-color:#FCFCFC;
99
+ }
100
+
101
+ .mb-table-container tr:last-child td {
102
+ border-bottom: 0 none;
103
+ }
104
+
105
+ .mb-table-container tr td {
106
+ background: none repeat scroll 0 0 transparent;
107
+ border-bottom: 1px solid #EDEDED;
108
+ border-right: 1px solid #EDEDED;
109
+ padding: 8px;
110
+ position: relative;
111
+ }
112
+
113
+ .mb-table-container tr td:last-child {
114
+ border-right: 0 none;
115
+ }
116
+
117
+ .mb-table-container thead > tr > th {
118
+ border-right: 1px solid #E1E1E1;
119
+ }
120
+
121
+ .mb-table-container tr > th:last-child {
122
+ border-right: 0 none;
123
+ }
124
+
125
+ .mb-textarea{
126
+ width:60%;
127
+ max-width:600px;
128
+ height:130px;
129
+ }
130
+ .mb-text-input{
131
+ width:40%;
132
+ max-width:400px;
133
+ }
134
+
135
+ .mb-select{
136
+ min-width:150px;
137
+ }
138
+
139
+ /* upload field */
140
+ .upload-field-details{
141
+ display:inline-block;
142
+ vertical-align:middle;
143
+ min-height:24px;
144
+ padding:2px 0;
145
+ }
146
+
147
+ .upload-field-details p{
148
+ margin:2px 0 0;
149
+ }
150
+
151
+ .upload-field-details img{
152
+ margin:0 5px;
153
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
154
+ }
155
+
156
+ .upload-field-details > *{
157
+ float:left;
158
+ }
159
+
160
+ .upload-field-details span{
161
+ display:block;
162
+ }
163
+
164
+ .upload-field-details .file-name{
165
+ font-weight:bold;
166
+ color:#21759B;
167
+ }
168
+
169
+
170
+ /* Settings page. */
171
+ .side .form-table th {
172
+ width: 20%;
173
+ font-weight: bold;
174
+ text-align: left;
175
+ padding-left: 0;
176
+ }
177
+
178
+ .wck-post-body{
179
+ clear: left;
180
+ float: left;
181
+ margin-right: -2000px;
182
+ width: 100%;
183
+ }
184
+
185
+ .metabox-holder .column-1 {
186
+ margin-right:300px;
187
+ }
188
+ .metabox-holder .column-2 {
189
+ float: right;
190
+ width: 280px;
191
+ clear:right;
192
+ position:relative;
193
+ }
194
+ .metabox-holder .column-3 {
195
+ clear: both;
196
+ margin-right:300px;
197
+ }
198
+
199
+ /* wysiwyg */
200
+ .mb-right-column .wp_themeSkin table.mceLayout{
201
+ border-color: #CCCCCC #CCCCCC #DFDFDF;
202
+ border-style: solid;
203
+ border-top-left-radius: 3px;
204
+ border-top-right-radius: 3px;
205
+ border-width: 1px;
206
+ background-color:#fff;
207
  }
wordpress-creation-kit-api/wordpress-creation-kit.js CHANGED
@@ -199,7 +199,8 @@ function mb_sortable_elements() {
199
  });
200
  }
201
  });
202
- jQuery( "#sortable" ).disableSelection();
 
203
 
204
 
205
  jQuery('.mb-table-container ul').mousedown( function(e){
199
  });
200
  }
201
  });
202
+ /*I don't know if this is necessary. Remove when I have more time for tests */
203
+ jQuery( "#sortable:not(select)" ).disableSelection();
204
 
205
 
206
  jQuery('.mb-table-container ul').mousedown( function(e){
wordpress-creation-kit-api/wordpress-creation-kit.php CHANGED
@@ -58,7 +58,7 @@ class Wordpress_Creation_Kit{
58
  'page_template' => '',
59
  'post_id' => '',
60
  'single' => false,
61
- 'unserialize_fields' => false,
62
  'sortable' => true,
63
  'context' => 'post_meta'
64
  );
@@ -213,11 +213,11 @@ class Wordpress_Creation_Kit{
213
  }
214
  else{
215
  if( !empty( $details['default'] ) )
216
- $value = apply_filters( "wck_default_value_{$meta}_".sanitize_title_with_dashes( remove_accents ( $details['title'] ) ) , $details['default'] );
217
  }
218
 
219
 
220
- $element .= '<label for="'. esc_attr( sanitize_title_with_dashes( remove_accents ( $details['title'] ) ) ) .'" class="field-label">'. ucfirst($details['title']) .':';
221
  if( $details['required'] )
222
  $element .= '<span class="required">*</span>';
223
  $element .= '</label>';
@@ -268,7 +268,7 @@ class Wordpress_Creation_Kit{
268
  do_action( "wck_before_add_form_{$meta}_element_{$element_id}" );
269
 
270
  ?>
271
- <li class="row-<?php echo esc_attr( sanitize_title_with_dashes( remove_accents( $details['title'] ) ) ) ?>">
272
  <?php echo self::wck_output_form_field( $meta, $details ); ?>
273
  </li>
274
  <?php
@@ -314,11 +314,11 @@ class Wordpress_Creation_Kit{
314
 
315
  foreach( $fields as $field ){
316
  $details = $field;
317
- $value = $results[$element_id][sanitize_title_with_dashes( remove_accents( $details['title'] ) )];
318
 
319
  $form = apply_filters( "wck_before_update_form_{$meta}_element_{$i}", $form, $element_id, $value );
320
 
321
- $form .= '<li class="row-'. esc_attr( sanitize_title_with_dashes( remove_accents( $details['title'] ) ) ) .'">';
322
 
323
  $form .= self::wck_output_form_field( $meta, $details, $value, 'edit_form' );
324
 
@@ -397,7 +397,7 @@ class Wordpress_Creation_Kit{
397
  foreach( $fields as $field ){
398
  $details = $field;
399
 
400
- $value = $results[$element_id][sanitize_title_with_dashes( remove_accents( $details['title'] ) )];
401
 
402
  /* filter display value */
403
  $value = apply_filters( "wck_displayed_value_{$meta}_element_{$j}", $value );
@@ -423,7 +423,7 @@ class Wordpress_Creation_Kit{
423
 
424
  $list = apply_filters( "wck_before_listed_{$meta}_element_{$j}", $list, $element_id, $value );
425
 
426
- $list .= '<li class="row-'. esc_attr( sanitize_title_with_dashes( remove_accents( $details['title'] ) ) ) .'"><strong>'.$details['title'].': </strong>'.$display_value.' </li>';
427
 
428
  $list = apply_filters( "wck_after_listed_{$meta}_element_{$j}", $list, $element_id, $value );
429
 
@@ -498,7 +498,7 @@ class Wordpress_Creation_Kit{
498
 
499
  foreach( $fields as $field ){
500
  if( $field['required'] )
501
- $required_fields[sanitize_title_with_dashes( remove_accents ( $field['title'] ) )] = $field['title'];
502
  }
503
 
504
  foreach( $values as $key => $value ){
@@ -547,12 +547,14 @@ class Wordpress_Creation_Kit{
547
  else if ( $this->args['context'] == 'option' )
548
  update_option( $meta, $results );
549
 
550
- /* if unserialize_fields is true add for each entry separete post meta for every element of the form */
551
- if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){
552
 
553
  $meta_suffix = count( $results );
 
554
  foreach( $values as $name => $value ){
555
- update_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value);
 
556
  }
557
  }
558
 
@@ -590,12 +592,14 @@ class Wordpress_Creation_Kit{
590
  else if ( $this->args['context'] == 'option' )
591
  update_option( $meta, $results );
592
 
593
- /* if unserialize_fields is true update the coresponding post metas for every element of the form */
594
- if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){
595
 
596
- $meta_suffix = $element_id + 1;
 
597
  foreach( $values as $name => $value ){
598
- update_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value);
 
599
  }
600
  }
601
 
@@ -680,14 +684,16 @@ class Wordpress_Creation_Kit{
680
 
681
 
682
  /* TODO: optimize so that it updates from the deleted element forward */
683
- /* if unserialize_fields is true delete the coresponding post metas */
684
- if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){
685
 
686
  $meta_suffix = 1;
687
 
688
- foreach( $results as $result ){
 
689
  foreach ( $result as $name => $value){
690
- update_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value);
 
691
  }
692
  $meta_suffix++;
693
  }
@@ -695,9 +701,11 @@ class Wordpress_Creation_Kit{
695
  if( count( $results ) == 0 )
696
  $results = $old_results;
697
 
698
- foreach( $results as $result ){
 
699
  foreach ( $result as $name => $value){
700
- delete_post_meta( $id, $meta.'_'.$name.'_'.$meta_suffix );
 
701
  }
702
  break;
703
  }
@@ -731,13 +739,15 @@ class Wordpress_Creation_Kit{
731
  update_option( $meta, $results );
732
 
733
 
734
- /* if unserialize_fields is true reorder all the coresponding post metas */
735
- if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){
736
 
737
  $meta_suffix = 1;
738
- foreach( $new_results as $result ){
 
739
  foreach ( $result as $name => $value){
740
- update_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value);
 
741
  }
742
  $meta_suffix++;
743
  }
@@ -852,17 +862,17 @@ class Wordpress_Creation_Kit{
852
 
853
  if( isset( $_GET['lang'] ) ){
854
 
855
- $has_wck_with_unserialize_fields = false;
856
  $custom_field_keys = get_post_custom_keys( $post->ID );
857
  foreach( $custom_field_keys as $custom_field_key ){
858
  $custom_field_key = explode( '_', $custom_field_key );
859
  if( $custom_field_key[0] == 'wckwpml' ){
860
- $has_wck_with_unserialize_fields = true;
861
  break;
862
  }
863
  }
864
 
865
- if($has_wck_with_unserialize_fields){
866
  add_meta_box( 'wck_sync_translation', __( 'Syncronize WCK', 'wck' ), array( &$this, 'wck_add_sync_box' ), $post->post_type, 'side', 'low' );
867
  }
868
 
@@ -987,7 +997,21 @@ class Wordpress_Creation_Kit{
987
  }
988
 
989
  return $wck_meta_boxes;
990
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
991
  }
992
 
993
 
58
  'page_template' => '',
59
  'post_id' => '',
60
  'single' => false,
61
+ 'wpml_compatibility' => false,
62
  'sortable' => true,
63
  'context' => 'post_meta'
64
  );
213
  }
214
  else{
215
  if( !empty( $details['default'] ) )
216
+ $value = apply_filters( "wck_default_value_{$meta}_". Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) , $details['default'] );
217
  }
218
 
219
 
220
+ $element .= '<label for="'. esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'" class="field-label">'. ucfirst($details['title']) .':';
221
  if( $details['required'] )
222
  $element .= '<span class="required">*</span>';
223
  $element .= '</label>';
268
  do_action( "wck_before_add_form_{$meta}_element_{$element_id}" );
269
 
270
  ?>
271
+ <li class="row-<?php echo esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) ?>">
272
  <?php echo self::wck_output_form_field( $meta, $details ); ?>
273
  </li>
274
  <?php
314
 
315
  foreach( $fields as $field ){
316
  $details = $field;
317
+ $value = $results[$element_id][Wordpress_Creation_Kit::wck_generate_slug( $details['title'] )];
318
 
319
  $form = apply_filters( "wck_before_update_form_{$meta}_element_{$i}", $form, $element_id, $value );
320
 
321
+ $form .= '<li class="row-'. esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'">';
322
 
323
  $form .= self::wck_output_form_field( $meta, $details, $value, 'edit_form' );
324
 
397
  foreach( $fields as $field ){
398
  $details = $field;
399
 
400
+ $value = $results[$element_id][Wordpress_Creation_Kit::wck_generate_slug( $details['title'] )];
401
 
402
  /* filter display value */
403
  $value = apply_filters( "wck_displayed_value_{$meta}_element_{$j}", $value );
423
 
424
  $list = apply_filters( "wck_before_listed_{$meta}_element_{$j}", $list, $element_id, $value );
425
 
426
+ $list .= '<li class="row-'. esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'] ) ) .'"><strong>'.$details['title'].': </strong>'.$display_value.' </li>';
427
 
428
  $list = apply_filters( "wck_after_listed_{$meta}_element_{$j}", $list, $element_id, $value );
429
 
498
 
499
  foreach( $fields as $field ){
500
  if( $field['required'] )
501
+ $required_fields[Wordpress_Creation_Kit::wck_generate_slug( $field['title'] )] = $field['title'];
502
  }
503
 
504
  foreach( $values as $key => $value ){
547
  else if ( $this->args['context'] == 'option' )
548
  update_option( $meta, $results );
549
 
550
+ /* if wpml_compatibility is true add for each entry separete post meta for every element of the form */
551
+ if( $this->args['wpml_compatibility'] && $this->args['context'] == 'post_meta' ){
552
 
553
  $meta_suffix = count( $results );
554
+ $i=1;
555
  foreach( $values as $name => $value ){
556
+ update_post_meta($id, 'wckwpml_'.$meta.'_'.$name.'_'.$meta_suffix.'_'.$i, $value);
557
+ $i++;
558
  }
559
  }
560
 
592
  else if ( $this->args['context'] == 'option' )
593
  update_option( $meta, $results );
594
 
595
+ /* if wpml_compatibility is true update the coresponding post metas for every element of the form */
596
+ if( $this->args['wpml_compatibility'] && $this->args['context'] == 'post_meta' ){
597
 
598
+ $meta_suffix = $element_id + 1;
599
+ $i = 1;
600
  foreach( $values as $name => $value ){
601
+ update_post_meta($id, 'wckwpml_'.$meta.'_'.$name.'_'.$meta_suffix.'_'.$i, $value);
602
+ $i++;
603
  }
604
  }
605
 
684
 
685
 
686
  /* TODO: optimize so that it updates from the deleted element forward */
687
+ /* if wpml_compatibility is true delete the coresponding post metas */
688
+ if( $this->args['wpml_compatibility'] && $this->args['context'] == 'post_meta' ){
689
 
690
  $meta_suffix = 1;
691
 
692
+ foreach( $results as $result ){
693
+ $i = 1;
694
  foreach ( $result as $name => $value){
695
+ update_post_meta($id, 'wckwpml_'.$meta.'_'.$name.'_'.$meta_suffix.'_'.$i, $value);
696
+ $i++;
697
  }
698
  $meta_suffix++;
699
  }
701
  if( count( $results ) == 0 )
702
  $results = $old_results;
703
 
704
+ foreach( $results as $result ){
705
+ $i = 1;
706
  foreach ( $result as $name => $value){
707
+ delete_post_meta( $id, 'wckwpml_'.$meta.'_'.$name.'_'.$meta_suffix.'_'.$i );
708
+ $i++;
709
  }
710
  break;
711
  }
739
  update_option( $meta, $results );
740
 
741
 
742
+ /* if wpml_compatibility is true reorder all the coresponding post metas */
743
+ if( $this->args['wpml_compatibility'] && $this->args['context'] == 'post_meta' ){
744
 
745
  $meta_suffix = 1;
746
+ foreach( $new_results as $result ){
747
+ $i = 1;
748
  foreach ( $result as $name => $value){
749
+ update_post_meta($id, 'wckwpml_'.$meta.'_'.$name.'_'.$meta_suffix.'_'.$i, $value);
750
+ $i++;
751
  }
752
  $meta_suffix++;
753
  }
862
 
863
  if( isset( $_GET['lang'] ) ){
864
 
865
+ $has_wck_with_wpml_compatibility = false;
866
  $custom_field_keys = get_post_custom_keys( $post->ID );
867
  foreach( $custom_field_keys as $custom_field_key ){
868
  $custom_field_key = explode( '_', $custom_field_key );
869
  if( $custom_field_key[0] == 'wckwpml' ){
870
+ $has_wck_with_wpml_compatibility = true;
871
  break;
872
  }
873
  }
874
 
875
+ if($has_wck_with_wpml_compatibility){
876
  add_meta_box( 'wck_sync_translation', __( 'Syncronize WCK', 'wck' ), array( &$this, 'wck_add_sync_box' ), $post->post_type, 'side', 'low' );
877
  }
878
 
997
  }
998
 
999
  return $wck_meta_boxes;
1000
+ }
1001
+
1002
+
1003
+ /**
1004
+ * The function used to generate slugs in WCK
1005
+ *
1006
+ * @since 1.1.1
1007
+ *
1008
+ * @param string $string The input string from which we generate the slug
1009
+ * @return string $slug The henerated slug
1010
+ */
1011
+ function wck_generate_slug( $string ){
1012
+ $slug = rawurldecode( sanitize_title_with_dashes( remove_accents( $string ) ) );
1013
+ return $slug;
1014
+ }
1015
  }
1016
 
1017