Version Description
- Improved speed by at least 100% in most cases for the interface
- Small visual and functionality interface tweaks
Download this release
Release Info
Developer | madalin.ungureanu |
Plugin | Custom Post Types and Custom Fields creator – WCK |
Version | 2.1.8 |
Comparing to | |
See all releases |
Code changes from version 2.1.7 to 2.1.8
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: cozmoslabs, reflectionmedia, madalin.ungureanu, sareiodata, adispi
|
|
3 |
Donate link: http://www.cozmoslabs.com/wordpress-creation-kit/
|
4 |
Tags: custom fields, custom field, wordpress custom fields, custom post type, custom post types, post types, repeater fields, meta box, metabox, custom taxonomy, custom fields creator, post meta
|
5 |
Requires at least: 3.1
|
6 |
-
Tested up to: 4.9.
|
7 |
-
Stable tag: 2.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -137,6 +137,10 @@ Creating a taxonomy generally automatically creates a special query variable usi
|
|
137 |
10. Taxonomy listing
|
138 |
|
139 |
== Changelog ==
|
|
|
|
|
|
|
|
|
140 |
= 2.1.7 =
|
141 |
* Important security fix. Please update!
|
142 |
|
3 |
Donate link: http://www.cozmoslabs.com/wordpress-creation-kit/
|
4 |
Tags: custom fields, custom field, wordpress custom fields, custom post type, custom post types, post types, repeater fields, meta box, metabox, custom taxonomy, custom fields creator, post meta
|
5 |
Requires at least: 3.1
|
6 |
+
Tested up to: 4.9.2
|
7 |
+
Stable tag: 2.1.8
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
137 |
10. Taxonomy listing
|
138 |
|
139 |
== Changelog ==
|
140 |
+
= 2.1.8 =
|
141 |
+
* Improved speed by at least 100% in most cases for the interface
|
142 |
+
* Small visual and functionality interface tweaks
|
143 |
+
|
144 |
= 2.1.7 =
|
145 |
* Important security fix. Please update!
|
146 |
|
wck.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WCK - Custom Fields and Custom Post Types Creator
|
4 |
Description: WordPress Creation Kit consists of three tools that can help you create and maintain custom post types, custom taxonomies and most importantly, custom fields and metaboxes for your posts, pages or CPT's.
|
5 |
Author: Cozmoslabs, Madalin Ungureanu, Cristian Antohe
|
6 |
-
Version: 2.1.
|
7 |
Author URI: http://www.cozmoslabs.com
|
8 |
|
9 |
License: GPL2
|
@@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
25 |
*/
|
26 |
|
27 |
define( 'WCK_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . dirname( plugin_basename( __FILE__ ) ) );
|
|
|
28 |
|
29 |
/* ready for localization */
|
30 |
$current_theme = wp_get_theme();
|
3 |
Plugin Name: WCK - Custom Fields and Custom Post Types Creator
|
4 |
Description: WordPress Creation Kit consists of three tools that can help you create and maintain custom post types, custom taxonomies and most importantly, custom fields and metaboxes for your posts, pages or CPT's.
|
5 |
Author: Cozmoslabs, Madalin Ungureanu, Cristian Antohe
|
6 |
+
Version: 2.1.8
|
7 |
Author URI: http://www.cozmoslabs.com
|
8 |
|
9 |
License: GPL2
|
25 |
*/
|
26 |
|
27 |
define( 'WCK_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . dirname( plugin_basename( __FILE__ ) ) );
|
28 |
+
define( 'WCK_PLUGIN_VERSION', '2.5.1' );
|
29 |
|
30 |
/* ready for localization */
|
31 |
$current_theme = wp_get_theme();
|
wordpress-creation-kit-api/wck-fep/wck-fep.css
CHANGED
@@ -621,5 +621,5 @@ body #TB_window{
|
|
621 |
left:0;
|
622 |
width:100%;
|
623 |
height:100%;
|
624 |
-
background:url(
|
625 |
}
|
621 |
left:0;
|
622 |
width:100%;
|
623 |
height:100%;
|
624 |
+
background:url(../../../../../wp-admin/images/spinner-2x.gif) rgba(255, 255, 255, 0.5) center center no-repeat; z-index:999;
|
625 |
}
|
wordpress-creation-kit-api/wordpress-creation-kit.css
CHANGED
@@ -75,7 +75,7 @@
|
|
75 |
left:0;
|
76 |
width:100%;
|
77 |
height:100%;
|
78 |
-
background:url(images/
|
79 |
}
|
80 |
|
81 |
.mb-table-container pre{
|
@@ -138,6 +138,7 @@ td.wck-number{
|
|
138 |
|
139 |
.mb-table-container tr.wck-ui-state-highlight{
|
140 |
min-height:100px;
|
|
|
141 |
}
|
142 |
|
143 |
.mb-table-container tr td {
|
@@ -165,12 +166,12 @@ td.wck-number{
|
|
165 |
max-width:600px;
|
166 |
}
|
167 |
.mb-text-input{
|
168 |
-
width:
|
169 |
-
max-width:
|
170 |
}
|
171 |
|
172 |
.mb-select{
|
173 |
-
min-width:
|
174 |
}
|
175 |
|
176 |
/* upload field */
|
75 |
left:0;
|
76 |
width:100%;
|
77 |
height:100%;
|
78 |
+
background:url(../../../../wp-admin/images/spinner-2x.gif) center center no-repeat; z-index:999;
|
79 |
}
|
80 |
|
81 |
.mb-table-container pre{
|
138 |
|
139 |
.mb-table-container tr.wck-ui-state-highlight{
|
140 |
min-height:100px;
|
141 |
+
background-color: #f0fbff;
|
142 |
}
|
143 |
|
144 |
.mb-table-container tr td {
|
166 |
max-width:600px;
|
167 |
}
|
168 |
.mb-text-input{
|
169 |
+
width:60%;
|
170 |
+
max-width:600px;
|
171 |
}
|
172 |
|
173 |
.mb-select{
|
174 |
+
min-width:250px;
|
175 |
}
|
176 |
|
177 |
/* upload field */
|
wordpress-creation-kit-api/wordpress-creation-kit.js
CHANGED
@@ -94,39 +94,25 @@ function addMeta(value, id, nonce){
|
|
94 |
}
|
95 |
else{
|
96 |
/* refresh the list */
|
97 |
-
jQuery
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
if( !jQuery( '#'+value ).hasClass('single') ){
|
108 |
-
jQuery.post( wckAjaxurl , { action:"wck_add_form"+meta, meta:value, id:id }, function(response) {
|
109 |
-
jQuery( '#'+value ).replaceWith( response );
|
110 |
-
});
|
111 |
-
}
|
112 |
-
|
113 |
-
/* jQuery('#'+value+' .mb-field').each(function(){
|
114 |
-
if(jQuery(this).attr('type') == 'checkbox' || jQuery(this).attr('type') == 'radio' )
|
115 |
-
jQuery(this).removeAttr( 'checked' );
|
116 |
-
else
|
117 |
-
jQuery(this).val('');
|
118 |
-
});
|
119 |
-
|
120 |
-
jQuery('#'+value+' .upload-field-details').each(function(){
|
121 |
-
jQuery(this).html('<p><span class="file-name"></span><span class="file-type"></span></p>');
|
122 |
-
}); */
|
123 |
-
|
124 |
jQuery('#'+value).parent().css('opacity','1');
|
125 |
-
|
126 |
-
jQuery('body').trigger('wck-added-element');
|
127 |
-
|
128 |
jQuery('#mb-ajax-loading').remove();
|
129 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
}
|
131 |
});
|
132 |
|
@@ -151,22 +137,18 @@ function removeMeta(value, id, element_id, nonce){
|
|
151 |
|
152 |
/* If single add the form */
|
153 |
if( jQuery( '#container_'+value ).hasClass('single') ){
|
154 |
-
jQuery
|
155 |
-
|
156 |
-
jQuery( '#'+value ).addClass('single');
|
157 |
-
});
|
158 |
}
|
159 |
|
160 |
/* refresh the list */
|
161 |
-
jQuery
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
jQuery('#mb-ajax-loading').remove();
|
169 |
-
});
|
170 |
|
171 |
});
|
172 |
}
|
@@ -214,17 +196,14 @@ function mb_sortable_elements() {
|
|
214 |
}
|
215 |
|
216 |
|
217 |
-
jQuery.post( wckAjaxurl , { action:"wck_reorder_meta"+meta, meta:value, id:id, values:values}, function(response) {
|
218 |
-
jQuery
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
jQuery('#mb-ajax-loading').remove();
|
226 |
-
});
|
227 |
-
|
228 |
});
|
229 |
},
|
230 |
items: "> tr",
|
@@ -376,17 +355,15 @@ function updateMeta(value, id, element_id, nonce){
|
|
376 |
jQuery('#update_container_'+value+'_'+element_id).remove();
|
377 |
|
378 |
/* refresh the list */
|
379 |
-
jQuery
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
jQuery('#mb-ajax-loading').remove();
|
389 |
-
});
|
390 |
}
|
391 |
});
|
392 |
}
|
94 |
}
|
95 |
else{
|
96 |
/* refresh the list */
|
97 |
+
jQuery('#container_'+value).replaceWith(response.entry_list);
|
98 |
+
|
99 |
+
jQuery('.mb-table-container tbody td').css('width', function(){ return jQuery(this).width() });
|
100 |
+
|
101 |
+
if( !jQuery( '#'+value ).hasClass('single') )
|
102 |
+
mb_sortable_elements();
|
103 |
+
|
104 |
+
/* restore the add form to the original values */
|
105 |
+
if( !jQuery( '#'+value ).hasClass('single') ){
|
106 |
+
jQuery( '#'+value ).replaceWith( response.add_form );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
jQuery('#'+value).parent().css('opacity','1');
|
|
|
|
|
|
|
108 |
jQuery('#mb-ajax-loading').remove();
|
109 |
+
}
|
110 |
+
else{
|
111 |
+
jQuery('#'+value).parent().css('opacity','1');
|
112 |
+
jQuery('#mb-ajax-loading').remove();
|
113 |
+
}
|
114 |
+
|
115 |
+
jQuery('body').trigger('wck-added-element');
|
116 |
}
|
117 |
});
|
118 |
|
137 |
|
138 |
/* If single add the form */
|
139 |
if( jQuery( '#container_'+value ).hasClass('single') ){
|
140 |
+
jQuery( '#container_'+value ).before( response.add_form );
|
141 |
+
jQuery( '#'+value ).addClass('single');
|
|
|
|
|
142 |
}
|
143 |
|
144 |
/* refresh the list */
|
145 |
+
jQuery('#container_'+value).replaceWith(response.entry_list);
|
146 |
+
|
147 |
+
jQuery('.mb-table-container tbody td').css('width', function(){ return jQuery(this).width() });
|
148 |
+
|
149 |
+
mb_sortable_elements();
|
150 |
+
jQuery('#'+value).parent().css('opacity','1');
|
151 |
+
jQuery('#mb-ajax-loading').remove();
|
|
|
|
|
152 |
|
153 |
});
|
154 |
}
|
196 |
}
|
197 |
|
198 |
|
199 |
+
jQuery.post( wckAjaxurl , { action:"wck_reorder_meta"+meta, meta:value, id:id, values:values}, function(response) {
|
200 |
+
jQuery('#container_'+value).replaceWith(response.entry_list);
|
201 |
+
|
202 |
+
jQuery('.mb-table-container tbody td').css('width', function(){ return jQuery(this).width() });
|
203 |
+
|
204 |
+
mb_sortable_elements();
|
205 |
+
jQuery('#'+value).parent().css('opacity','1');
|
206 |
+
jQuery('#mb-ajax-loading').remove();
|
|
|
|
|
|
|
207 |
});
|
208 |
},
|
209 |
items: "> tr",
|
355 |
jQuery('#update_container_'+value+'_'+element_id).remove();
|
356 |
|
357 |
/* refresh the list */
|
358 |
+
jQuery('#container_'+value+' #element_'+element_id).replaceWith(response.entry_content);
|
359 |
+
|
360 |
+
jQuery('.mb-table-container tbody td').css('width', function(){ return jQuery(this).width() });
|
361 |
+
|
362 |
+
if( jQuery( '#container_' + value + " tbody" ).hasClass('ui-sortable') )
|
363 |
+
jQuery( '#container_' + value + " tbody" ).sortable("enable");
|
364 |
+
|
365 |
+
jQuery('#container_'+value).parent().css('opacity','1');
|
366 |
+
jQuery('#mb-ajax-loading').remove();
|
|
|
|
|
367 |
}
|
368 |
});
|
369 |
}
|
wordpress-creation-kit-api/wordpress-creation-kit.php
CHANGED
@@ -98,9 +98,6 @@ class Wordpress_Creation_Kit{
|
|
98 |
add_action("wp_ajax_wck_add_meta".$this->args['meta_name'], array( &$this, 'wck_add_meta') );
|
99 |
add_action("wp_ajax_wck_update_meta".$this->args['meta_name'], array( &$this, 'wck_update_meta') );
|
100 |
add_action("wp_ajax_wck_show_update".$this->args['meta_name'], array( &$this, 'wck_show_update_form') );
|
101 |
-
add_action("wp_ajax_wck_refresh_list".$this->args['meta_name'], array( &$this, 'wck_refresh_list') );
|
102 |
-
add_action("wp_ajax_wck_refresh_entry".$this->args['meta_name'], array( &$this, 'wck_refresh_entry') );
|
103 |
-
add_action("wp_ajax_wck_add_form".$this->args['meta_name'], array( &$this, 'wck_add_form') );
|
104 |
add_action("wp_ajax_wck_remove_meta".$this->args['meta_name'], array( &$this, 'wck_remove_meta') );
|
105 |
add_action("wp_ajax_wck_reorder_meta".$this->args['meta_name'], array( &$this, 'wck_reorder_meta') );
|
106 |
|
@@ -109,9 +106,6 @@ class Wordpress_Creation_Kit{
|
|
109 |
add_action("wp_ajax_nopriv_wck_add_meta".$this->args['meta_name'], array( &$this, 'wck_add_meta') );
|
110 |
add_action("wp_ajax_nopriv_wck_update_meta".$this->args['meta_name'], array( &$this, 'wck_update_meta') );
|
111 |
add_action("wp_ajax_nopriv_wck_show_update".$this->args['meta_name'], array( &$this, 'wck_show_update_form') );
|
112 |
-
add_action("wp_ajax_nopriv_wck_refresh_list".$this->args['meta_name'], array( &$this, 'wck_refresh_list') );
|
113 |
-
add_action("wp_ajax_nopriv_wck_refresh_entry".$this->args['meta_name'], array( &$this, 'wck_refresh_entry') );
|
114 |
-
add_action("wp_ajax_nopriv_wck_add_form".$this->args['meta_name'], array( &$this, 'wck_add_form') );
|
115 |
add_action("wp_ajax_nopriv_wck_remove_meta".$this->args['meta_name'], array( &$this, 'wck_remove_meta') );
|
116 |
add_action("wp_ajax_nopriv_wck_reorder_meta".$this->args['meta_name'], array( &$this, 'wck_reorder_meta') );
|
117 |
}
|
@@ -759,8 +753,8 @@ class Wordpress_Creation_Kit{
|
|
759 |
wp_enqueue_script( 'jquery-ui-dialog' );
|
760 |
wp_enqueue_style( 'wp-jquery-ui-dialog' );
|
761 |
|
762 |
-
wp_enqueue_script('wordpress-creation-kit', plugins_url('/wordpress-creation-kit.js', __FILE__), array('jquery', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable' ) );
|
763 |
-
wp_register_style('wordpress-creation-kit-css', plugins_url('/wordpress-creation-kit.css', __FILE__));
|
764 |
wp_enqueue_style('wordpress-creation-kit-css');
|
765 |
|
766 |
// wysiwyg
|
@@ -926,8 +920,13 @@ class Wordpress_Creation_Kit{
|
|
926 |
$results = array( $values );
|
927 |
else
|
928 |
$results[] = $values;
|
929 |
-
|
930 |
-
|
|
|
|
|
|
|
|
|
|
|
931 |
|
932 |
if( $this->args['context'] == 'post_meta' )
|
933 |
update_post_meta($id, $meta, $results);
|
@@ -962,8 +961,12 @@ class Wordpress_Creation_Kit{
|
|
962 |
}
|
963 |
}
|
964 |
}
|
965 |
-
|
966 |
-
|
|
|
|
|
|
|
|
|
967 |
}
|
968 |
|
969 |
/* ajax update a reccord in the meta */
|
@@ -1007,8 +1010,13 @@ class Wordpress_Creation_Kit{
|
|
1007 |
$results = get_option( $meta );
|
1008 |
|
1009 |
$results[$element_id] = $values;
|
1010 |
-
|
1011 |
-
|
|
|
|
|
|
|
|
|
|
|
1012 |
|
1013 |
if( $this->args['context'] == 'post_meta' )
|
1014 |
update_post_meta($id, $meta, $results);
|
@@ -1043,69 +1051,48 @@ class Wordpress_Creation_Kit{
|
|
1043 |
}
|
1044 |
}
|
1045 |
}
|
1046 |
-
|
1047 |
-
|
|
|
|
|
|
|
1048 |
}
|
1049 |
|
1050 |
-
/*
|
1051 |
-
function wck_refresh_list(){
|
1052 |
-
|
1053 |
-
$meta
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
else
|
1059 |
-
$id = '';
|
1060 |
-
echo self::wck_output_meta_content($meta, $id, $this->args['meta_array']);
|
1061 |
-
|
1062 |
-
do_action( "wck_refresh_list_{$meta}", $id );
|
1063 |
-
|
1064 |
-
exit;
|
1065 |
}
|
1066 |
|
1067 |
-
/*
|
1068 |
-
function wck_refresh_entry(){
|
1069 |
-
if( isset( $_POST['meta'] ) )
|
1070 |
-
$meta = sanitize_text_field( $_POST['meta'] );
|
1071 |
-
else
|
1072 |
-
$meta = '';
|
1073 |
-
if( isset( $_POST['id'] ) )
|
1074 |
-
$id = absint( $_POST['id'] );
|
1075 |
-
else
|
1076 |
-
$id = '';
|
1077 |
-
if( isset( $_POST['element_id'] ) )
|
1078 |
-
$element_id = absint( $_POST['element_id'] );
|
1079 |
-
else
|
1080 |
-
$element_id = '';
|
1081 |
-
|
1082 |
if( $this->args['context'] == 'post_meta' )
|
1083 |
$results = get_post_meta($id, $meta, true);
|
1084 |
else if ( $this->args['context'] == 'option' )
|
1085 |
$results = get_option( $meta );
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
|
|
1092 |
}
|
1093 |
|
1094 |
-
/*
|
1095 |
-
function wck_add_form(){
|
1096 |
-
if( !empty( $_POST['meta'] ) )
|
1097 |
-
$meta = sanitize_text_field( $_POST['meta'] );
|
1098 |
-
else
|
1099 |
-
$meta = '';
|
1100 |
-
if( !empty( $_POST['id'] ) )
|
1101 |
-
$id = absint( $_POST['id'] );
|
1102 |
-
else
|
1103 |
-
$id = '';
|
1104 |
$post = get_post($id);
|
1105 |
-
|
1106 |
-
|
|
|
|
|
|
|
1107 |
|
1108 |
-
|
1109 |
}
|
1110 |
|
1111 |
|
@@ -1157,8 +1144,13 @@ class Wordpress_Creation_Kit{
|
|
1157 |
unset($results[$element_id]);
|
1158 |
/* reset the keys for the array */
|
1159 |
$results = array_values($results);
|
1160 |
-
|
1161 |
-
|
|
|
|
|
|
|
|
|
|
|
1162 |
|
1163 |
if( $this->args['context'] == 'post_meta' )
|
1164 |
update_post_meta($id, $meta, $results);
|
@@ -1229,8 +1221,12 @@ class Wordpress_Creation_Kit{
|
|
1229 |
}
|
1230 |
|
1231 |
}
|
1232 |
-
|
1233 |
-
|
|
|
|
|
|
|
|
|
1234 |
}
|
1235 |
|
1236 |
|
@@ -1255,7 +1251,12 @@ class Wordpress_Creation_Kit{
|
|
1255 |
die( json_encode( $error ) );
|
1256 |
}
|
1257 |
|
1258 |
-
|
|
|
|
|
|
|
|
|
|
|
1259 |
|
1260 |
if( $this->args['context'] == 'post_meta' )
|
1261 |
$results = get_post_meta($id, $meta, true);
|
@@ -1310,9 +1311,11 @@ class Wordpress_Creation_Kit{
|
|
1310 |
}
|
1311 |
}
|
1312 |
|
1313 |
-
}
|
1314 |
-
|
1315 |
-
|
|
|
|
|
1316 |
}
|
1317 |
|
1318 |
/**
|
98 |
add_action("wp_ajax_wck_add_meta".$this->args['meta_name'], array( &$this, 'wck_add_meta') );
|
99 |
add_action("wp_ajax_wck_update_meta".$this->args['meta_name'], array( &$this, 'wck_update_meta') );
|
100 |
add_action("wp_ajax_wck_show_update".$this->args['meta_name'], array( &$this, 'wck_show_update_form') );
|
|
|
|
|
|
|
101 |
add_action("wp_ajax_wck_remove_meta".$this->args['meta_name'], array( &$this, 'wck_remove_meta') );
|
102 |
add_action("wp_ajax_wck_reorder_meta".$this->args['meta_name'], array( &$this, 'wck_reorder_meta') );
|
103 |
|
106 |
add_action("wp_ajax_nopriv_wck_add_meta".$this->args['meta_name'], array( &$this, 'wck_add_meta') );
|
107 |
add_action("wp_ajax_nopriv_wck_update_meta".$this->args['meta_name'], array( &$this, 'wck_update_meta') );
|
108 |
add_action("wp_ajax_nopriv_wck_show_update".$this->args['meta_name'], array( &$this, 'wck_show_update_form') );
|
|
|
|
|
|
|
109 |
add_action("wp_ajax_nopriv_wck_remove_meta".$this->args['meta_name'], array( &$this, 'wck_remove_meta') );
|
110 |
add_action("wp_ajax_nopriv_wck_reorder_meta".$this->args['meta_name'], array( &$this, 'wck_reorder_meta') );
|
111 |
}
|
753 |
wp_enqueue_script( 'jquery-ui-dialog' );
|
754 |
wp_enqueue_style( 'wp-jquery-ui-dialog' );
|
755 |
|
756 |
+
wp_enqueue_script('wordpress-creation-kit', plugins_url('/wordpress-creation-kit.js', __FILE__), array('jquery', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable' ), WCK_PLUGIN_VERSION );
|
757 |
+
wp_register_style('wordpress-creation-kit-css', plugins_url('/wordpress-creation-kit.css', __FILE__), array(), WCK_PLUGIN_VERSION );
|
758 |
wp_enqueue_style('wordpress-creation-kit-css');
|
759 |
|
760 |
// wysiwyg
|
920 |
$results = array( $values );
|
921 |
else
|
922 |
$results[] = $values;
|
923 |
+
|
924 |
+
/* make sure this does not output anything so it won't break the json response below
|
925 |
+
will keep it do_action for compatibility reasons
|
926 |
+
*/
|
927 |
+
ob_start();
|
928 |
+
do_action( 'wck_before_add_meta', $meta, $id, $values );
|
929 |
+
$wck_before_add_meta = ob_get_clean(); //don't output it
|
930 |
|
931 |
if( $this->args['context'] == 'post_meta' )
|
932 |
update_post_meta($id, $meta, $results);
|
961 |
}
|
962 |
}
|
963 |
}
|
964 |
+
|
965 |
+
$entry_list = $this->wck_refresh_list( $meta, $id );
|
966 |
+
$add_form = $this->wck_add_form( $meta, $id );
|
967 |
+
|
968 |
+
header( 'Content-type: application/json' );
|
969 |
+
die( json_encode( array( 'entry_list' => $entry_list, 'add_form' => $add_form ) ) );
|
970 |
}
|
971 |
|
972 |
/* ajax update a reccord in the meta */
|
1010 |
$results = get_option( $meta );
|
1011 |
|
1012 |
$results[$element_id] = $values;
|
1013 |
+
|
1014 |
+
/* make sure this does not output anything so it won't break the json response below
|
1015 |
+
will keep it do_action for compatibility reasons
|
1016 |
+
*/
|
1017 |
+
ob_start();
|
1018 |
+
do_action( 'wck_before_update_meta', $meta, $id, $values, $element_id );
|
1019 |
+
$wck_before_update_meta = ob_get_clean(); //don't output it
|
1020 |
|
1021 |
if( $this->args['context'] == 'post_meta' )
|
1022 |
update_post_meta($id, $meta, $results);
|
1051 |
}
|
1052 |
}
|
1053 |
}
|
1054 |
+
|
1055 |
+
$entry_content = $this->wck_refresh_entry( $meta, $id, $element_id );
|
1056 |
+
|
1057 |
+
header( 'Content-type: application/json' );
|
1058 |
+
die( json_encode( array( 'entry_content' => $entry_content ) ) );
|
1059 |
}
|
1060 |
|
1061 |
+
/* function to output the the meta content list */
|
1062 |
+
function wck_refresh_list( $meta = '', $id = '' ){
|
1063 |
+
ob_start();
|
1064 |
+
echo self::wck_output_meta_content($meta, $id, $this->args['meta_array']);
|
1065 |
+
do_action( "wck_refresh_list_{$meta}", $id );
|
1066 |
+
$entry_list = ob_get_clean();
|
1067 |
+
|
1068 |
+
return $entry_list;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1069 |
}
|
1070 |
|
1071 |
+
/* function to return an entry content */
|
1072 |
+
function wck_refresh_entry( $meta = '', $id = '', $element_id = '' ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1073 |
if( $this->args['context'] == 'post_meta' )
|
1074 |
$results = get_post_meta($id, $meta, true);
|
1075 |
else if ( $this->args['context'] == 'option' )
|
1076 |
$results = get_option( $meta );
|
1077 |
+
|
1078 |
+
ob_start();
|
1079 |
+
echo self::wck_output_entry_content( $meta, $id, $this->args['meta_array'], $results, $element_id );
|
1080 |
+
do_action( "wck_refresh_entry_{$meta}", $id );
|
1081 |
+
$entry_content = ob_get_clean();
|
1082 |
+
|
1083 |
+
return $entry_content;
|
1084 |
}
|
1085 |
|
1086 |
+
/* function that returns the form for single */
|
1087 |
+
function wck_add_form( $meta = '', $id = '' ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1088 |
$post = get_post($id);
|
1089 |
+
|
1090 |
+
ob_start();
|
1091 |
+
self::create_add_form($this->args['meta_array'], $meta, $post );
|
1092 |
+
do_action( "wck_ajax_add_form_{$meta}", $id );
|
1093 |
+
$add_form = ob_get_clean();
|
1094 |
|
1095 |
+
return $add_form;
|
1096 |
}
|
1097 |
|
1098 |
|
1144 |
unset($results[$element_id]);
|
1145 |
/* reset the keys for the array */
|
1146 |
$results = array_values($results);
|
1147 |
+
|
1148 |
+
/* make sure this does not output anything so it won't break the json response below
|
1149 |
+
will keep it do_action for compatibility reasons
|
1150 |
+
*/
|
1151 |
+
ob_start();
|
1152 |
+
do_action( 'wck_before_remove_meta', $meta, $id, $element_id );
|
1153 |
+
$wck_before_remove_meta = ob_get_clean(); //don't output it
|
1154 |
|
1155 |
if( $this->args['context'] == 'post_meta' )
|
1156 |
update_post_meta($id, $meta, $results);
|
1221 |
}
|
1222 |
|
1223 |
}
|
1224 |
+
|
1225 |
+
$entry_list = $this->wck_refresh_list( $meta, $id );
|
1226 |
+
$add_form = $this->wck_add_form( $meta, $id );
|
1227 |
+
|
1228 |
+
header( 'Content-type: application/json' );
|
1229 |
+
die( json_encode( array( 'entry_list' => $entry_list, 'add_form' => $add_form ) ) );
|
1230 |
}
|
1231 |
|
1232 |
|
1251 |
die( json_encode( $error ) );
|
1252 |
}
|
1253 |
|
1254 |
+
/* make sure this does not output anything so it won't break the json response below
|
1255 |
+
will keep it do_action for compatibility reasons
|
1256 |
+
*/
|
1257 |
+
ob_start();
|
1258 |
+
do_action( 'wck_before_reorder_meta', $meta, $id, $elements_id );
|
1259 |
+
$wck_before_reorder_meta = ob_get_clean(); //don't output it
|
1260 |
|
1261 |
if( $this->args['context'] == 'post_meta' )
|
1262 |
$results = get_post_meta($id, $meta, true);
|
1311 |
}
|
1312 |
}
|
1313 |
|
1314 |
+
}
|
1315 |
+
|
1316 |
+
$entry_list = $this->wck_refresh_list( $meta, $id );
|
1317 |
+
header( 'Content-type: application/json' );
|
1318 |
+
die( json_encode( array( 'entry_list' => $entry_list ) ) );
|
1319 |
}
|
1320 |
|
1321 |
/**
|