PluginProbe
Timed Content / 2.3
Timed Content v2.3
2.99 trunk 1.0 1.1 1.2 2.0 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.10 2.11 2.12 2.15 2.2 2.3 2.3.1 2.4 2.5 2.5.1 2.50 2.51 2.52 All 67 releases
timed-content / lib / customFieldsInterface.php

customFieldsInterface.php in Timed Content 2.3, at lib/customFieldsInterface.php

419 lines 22.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( !class_exists('customFieldsInterface') ) {
3
4 class customFieldsInterface {
5 /**
6 * @var string $handle The handle for the box containing the custom fields
7 */
8 var $handle = "";
9 /**
10 * @var string $label The label for the box containing the custom fields
11 */
12 var $label = "";
13 /**
14 * @var string $desc The description/introduction for the box containing the custom fields
15 */
16 var $desc = "";
17 /**
18 * @var string $prefix The prefix for storing custom fields in the postmeta table
19 */
20 var $prefix = "";
21 /**
22 * @var array $postTypes An array of public custom post types, plus the standard "post" and "page" - add the custom types you want to include here
23 */
24 var $postTypes = array();
25 /**
26 * @var array $customFields Defines the custom fields available
27 */
28 var $customFields = array();
29 /**
30 * PHP 5 Constructor
31 */
32 function __construct( $handle, $label, $desc, $prefix, $postTypes, $customFields ) {
33
34 $this->handle = $handle;
35 $this->label = $label;
36 $this->desc = $desc;
37 $this->prefix = $prefix;
38 $this->postTypes = $postTypes ;
39 $this->customFields = $customFields;
40 add_action( 'admin_menu', array( &$this, 'createCustomFields' ) );
41 add_action( 'save_post', array( &$this, 'saveCustomFields' ), 1, 2 );
42 // Comment this line out if you want to keep default custom fields meta box
43 add_action( 'do_meta_boxes', array( &$this, 'removeDefaultCustomFields' ), 10, 3 );
44 }
45
46 // Inspired by http://ca1.php.net/manual/en/function.timezone-identifiers-list.php#79284
47 static function __generateTimezoneSelectOptions( $default_tz ) {
48 $timezone_identifiers = timezone_identifiers_list();
49 sort( $timezone_identifiers );
50 $current_continent = "";
51 $options_list = "";
52
53 foreach ( $timezone_identifiers as $timezone_identifier ) {
54 list( $continent, ) = explode( "/", $timezone_identifier, 2);
55 if ( in_array( $continent, array( "Africa", "America", "Antarctica", "Arctic", "Asia", "Atlantic", "Australia", "Europe", "Indian", "Pacific" ) ) ) {
56 list( , $city ) = explode( "/", $timezone_identifier, 2);
57 if ( strlen( $current_continent ) === 0 ) {
58 $options_list .= "<optgroup label=\"" . $continent . "\">"; // Start first continent optgroup
59 }
60 elseif ( $current_continent != $continent ) {
61 $options_list .= "</optgroup><optgroup label=\"" . $continent . "\">"; // End old optgroup and start new continent optgroup
62 }
63 $options_list .= "<option" . ( ( $timezone_identifier == $default_tz ) ? " selected=\"selected\"" : "" )
64 . " value=\"" . $timezone_identifier . "\">" . str_replace( "_", " ", $city ). "</option>"; //Timezone
65 }
66 $current_continent = $continent;
67 }
68 $options_list .= "</optgroup>"; // End last continent optgroup
69
70 return $options_list;
71 }
72
73 /**
74 * Remove the default Custom Fields meta box
75 */
76 function removeDefaultCustomFields( $type, $context, $post ) {
77 foreach ( array( 'normal', 'advanced', 'side' ) as $context ) {
78 foreach ( $this->postTypes as $postType ) {
79 remove_meta_box( 'postcustom', $postType, $context );
80 }
81 }
82 }
83 /**
84 * Create the new Custom Fields meta box
85 */
86 function createCustomFields() {
87
88 include("jquery-ui-datetime-i18n.php" );
89 // Only enqueue scripts if we're dealing with 'timed-content-rule' pages
90 foreach ( $this->postTypes as $a_postType ) {
91 if ( ( isset( $_GET['post_type'] ) && $_GET['post_type'] == $a_postType )
92 || ( isset( $post_type ) && $post_type == $a_postType )
93 || ( isset( $_GET['post'] ) && get_post_type( $_GET['post'] ) == $a_postType ) ) {
94
95 wp_enqueue_style( 'wp-color-picker' );
96 wp_enqueue_script( 'wp-color-picker' );
97 wp_enqueue_style( 'timed-content-jquery-ui-css', TIMED_CONTENT_JQUERY_UI_CSS, false, TIMED_CONTENT_VERSION );
98 wp_enqueue_script( 'jquery-ui-datepicker' );
99 if( !( wp_script_is( 'timed-content-jquery-ui-datepicker-i18n-js', 'registered' ) ) ) {
100 wp_register_script( 'timed-content-jquery-ui-datepicker-i18n-js', TIMED_CONTENT_PLUGIN_URL . "/js/timed-content-datepicker-i18n.js", array( 'jquery', 'jquery-ui-datepicker' ), TIMED_CONTENT_VERSION );
101 wp_enqueue_script( 'timed-content-jquery-ui-datepicker-i18n-js' );
102 wp_localize_script( 'timed-content-jquery-ui-datepicker-i18n-js', 'TimedContentJQDatepickerI18n', $jquery_ui_datetime_datepicker_i18n );
103 }
104
105 wp_enqueue_script( 'jquery-ui-spinner' );
106 wp_register_style( 'timed-content-jquery-ui-timepicker-css', TIMED_CONTENT_JQUERY_UI_TIMEPICKER_CSS, array( TIMED_CONTENT_JQUERY_UI_CSS ), TIMED_CONTENT_VERSION );
107 wp_enqueue_style( 'timed-content-jquery-ui-timepicker-css' );
108 wp_register_script( 'timed-content-jquery-ui-timepicker-js', TIMED_CONTENT_JQUERY_UI_TIMEPICKER_JS, array('jquery', 'jquery-ui-datepicker'), TIMED_CONTENT_VERSION );
109 wp_enqueue_script( 'timed-content-jquery-ui-timepicker-js' );
110 if( !( wp_script_is( 'timed-content-jquery-ui-timepicker-i18n-js', 'registered' ) ) ) {
111 wp_register_script( 'timed-content-jquery-ui-timepicker-i18n-js', TIMED_CONTENT_PLUGIN_URL . "/js/timed-content-timepicker-i18n.js", array( 'jquery', 'jquery-ui-datepicker', 'timed-content-jquery-ui-timepicker-js' ), TIMED_CONTENT_VERSION );
112 wp_enqueue_script( 'timed-content-jquery-ui-timepicker-i18n-js' );
113 wp_localize_script( 'timed-content-jquery-ui-timepicker-i18n-js', 'TimedContentJQTimepickerI18n', $jquery_ui_datetime_timepicker_i18n );
114 }
115 if ( function_exists( 'add_meta_box' ) )
116 add_meta_box( $this->handle, $this->label, array( &$this, 'displayCustomFields' ), $a_postType, 'normal', 'high' );
117 }
118 }
119 }
120 /**
121 * Display the new Custom Fields meta box
122 */
123 function displayCustomFields() {
124 global $post;
125 ?>
126 <p><?php echo $this->desc; ?></p>
127 <div class="form-wrap">
128 <?php
129 wp_nonce_field( $this->handle, $this->handle . '_wpnonce', false, true );
130 foreach ( $this->customFields as $customField ) {
131 // Check scope
132 $scope = $customField[ 'scope' ];
133 $output = false;
134 foreach ( $scope as $scopeItem ) {
135 switch ( $scopeItem ) {
136 default: {
137 if ( $post->post_type == $scopeItem )
138 $output = true;
139 break;
140 }
141 }
142 if ( $output ) break;
143 }
144 // Check capability
145 if ( !current_user_can( $customField['capability'], $post->ID ) )
146 $output = false;
147 // Output if allowed
148 if ( $output ) { ?>
149 <div class="form-field form-required" id="<?php echo $this->prefix . $customField[ 'name' ]; ?>_div" style="display: <?php echo $customField[ 'display' ]; ?>">
150 <?php
151 switch ( $customField[ 'type' ] ) {
152 case "radio": {
153 // radio
154 $checked_value = ( "" === get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) ? $customField['default'] : get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) );
155 echo "<strong>" . $customField[ 'title' ] . "</strong><br />\n";
156 foreach ( $customField['values'] as $value => $label ) {
157 echo "<input type=\"radio\" name=\"" . $this->prefix . $customField[ 'name' ] . "\" id=\"" . $this->prefix . $customField[ 'name' ] . "_" . $value . "\" value=\"" . $value . "\"";
158 if ( $checked_value == $value )
159 echo " checked=\"checked\"";
160 echo " style=\"width: 30px;\" /><label for=\"" . $this->prefix . $customField[ 'name' ] . "_" . $value . "\" style=\"display: inline;\">" . $label . "</label><br />\n";
161 }
162 break;
163 }
164 case "menu": {
165 // menu
166 echo "<label for=\"" . $this->prefix . $customField[ 'name' ] . "\" style=\"display:inline;\"><strong>" . $customField[ 'title' ] . "</strong></label><br />\n";
167 if ( sizeof ( $customField['values'] ) == 0 )
168 echo "<em>" . __( "This menu is empty.", "timed-content" ) . "</em>\n";
169 else {
170 $selected_value = ( "" === get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) ? $customField['default'] : get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) );
171 echo "<select name=\"" . $this->prefix . $customField['name'] . "[]\" id=\"" . $this->prefix . $customField['name'] . "\" style=\"width: auto; height: auto; padding: 3px;\" size=\"" . $customField['size'] . "\" multiple=\"multiple\">\n";
172 foreach ( $customField['values'] as $value => $label ) {
173 echo "\t<option value=\"" . $value . "\"";
174 if ( $selected_value == $value )
175 echo " selected=\"selected\"";
176 echo ">" . $label . "</option>\n";
177 }
178 echo "</select>\n";
179 }
180 break;
181 }
182 case "list": {
183 // list
184 echo "<label for=\"" . $this->prefix . $customField[ 'name' ] . "\" style=\"display:inline;\"><strong>" . $customField[ 'title' ] . "</strong></label>&nbsp;&nbsp;\n";
185 if ( sizeof ( $customField['values'] ) == 0 )
186 echo "<em>" . __( "This menu is empty.", "timed-content" ) . "</em>\n";
187 else {
188 $selected_value = ( "" === get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) ? $customField['default'] : get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) );
189 echo "<select name=\"" . $this->prefix . $customField['name'] . "\" id=\"" . $this->prefix . $customField['name'] . "\" style=\"width: auto;\">\n";
190 foreach ( $customField['values'] as $value => $label ) {
191 echo "\t<option value=\"" . $value . "\"";
192 if ( $selected_value == $value )
193 echo " selected=\"selected\"";
194 echo ">" . $label . "</option>\n";
195 }
196 echo "</select>\n";
197 }
198 break;
199 }
200 case "timezone-list": {
201 // timezone list
202 $selected_value = ( "" === get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) ? $customField['default'] : get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) );
203
204 echo "<label for=\"" . $this->prefix . $customField[ 'name' ] . "\" style=\"display:inline;\"><strong>" . $customField[ 'title' ] . "</strong></label>&nbsp;&nbsp;\n";
205 echo "<select name=\"" . $this->prefix . $customField['name'] . "\" id=\"" . $this->prefix . $customField['name'] . "\" style=\"width: auto;\">\n";
206 echo customFieldsInterface::__generateTimezoneSelectOptions( $selected_value );
207 echo "</select>\n";
208 break;
209 }
210 case "checkbox": {
211 // Checkbox
212 $checked_value = ( "" === get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) ? $customField['default'] : get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) );
213
214 echo "<label for=\"" . $this->prefix . $customField[ 'name' ] . "\" style=\"display:inline;\"><strong>" . $customField[ 'title' ] . "</strong></label>&nbsp;&nbsp;\n";
215 echo "<input type=\"checkbox\" name=\"" . $this->prefix . $customField['name'] . "\" id=\"" . $this->prefix . $customField['name'] . "\" value=\"yes\"";
216 if ( $checked_value == "yes" )
217 echo " checked=\"checked\"";
218 echo " style=\"width: 30px;\" />\n";
219 break;
220 }
221 case "checkbox-list": {
222 // Checkbox list
223 $checked_value = ( "" === get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) ? $customField['default'] : get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) );
224
225 echo "<strong>" . $customField[ 'title' ] . "</strong><br />\n";
226 if ( sizeof ( $customField['values'] ) == 0 )
227 echo "<em>" . __( "This menu is empty.", "timed-content" ) . "</em>\n";
228 else {
229 foreach ( $customField['values'] as $value => $label ) {
230 echo "<input type=\"checkbox\" name=\"" . $this->prefix . $customField['name'] . "[]\" id=\"" . $this->prefix . $customField['name'] . "_" . $value . "\" value=\"" . $value . "\"";
231 if ( ( is_array( $checked_value ) ) && ( in_array( $value, $checked_value ) ) )
232 echo " checked=\"checked\"";
233 echo " style=\"width: 30px;\" /><label for=\"" . $this->prefix . $customField['name'] . "_" . $value . "\" style=\"display: inline;\" >" . $label . "</label><br />\n";
234 }
235 }
236 break;
237 }
238 case "textarea":
239 case "wysiwyg": {
240 // Text area
241 $value = ( "" === get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) ? $customField['default'] : get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) );
242 echo "<label for=\"" . $this->prefix . $customField[ 'name' ] ."\"><strong>" . $customField[ 'title' ] . "</strong></label>\n";
243 echo "<textarea name=\"" . $this->prefix . $customField[ 'name' ] . "\" id=\"" . $this->prefix . $customField[ 'name' ] . "\" columns=\"30\" rows=\"3\">" . htmlspecialchars( $value ) . "</textarea>\n";
244 // WYSIWYG
245 if ( $customField[ 'type' ] == "wysiwyg" ) { ?>
246 <script type="text/javascript">
247 //<![CDATA[
248 jQuery( document ).ready( function() {
249 jQuery( "<?php echo $this->prefix . $customField[ 'name' ]; ?>" ).addClass( "mceEditor" );
250 if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) {
251 tinyMCE.execCommand( "mceAddControl", false, "<?php echo $this->prefix . $customField[ 'name' ]; ?>" );
252 }
253 });
254 //]]>
255 </script>
256 <?php }
257 break;
258 }
259 case "color-picker": {
260 $value = ( "" === get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) ? $customField['default'] : get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) );
261 // Color picker using WP's built-in Iris jQuery plugin ?>
262 <script type="text/javascript">
263 //<![CDATA[
264 jQuery(document).ready(function() {
265 var <?php echo $this->prefix . $customField[ 'name' ]; ?>Options = {
266 defaultColor: false,
267 hide: true,
268 palettes: true
269 };
270
271 jQuery("#<?php echo $this->prefix . $customField[ 'name' ]; ?>").wpColorPicker(<?php echo $this->prefix . $customField[ 'name' ]; ?>Options);
272 });
273 //]]>
274 </script>
275 <?php
276 echo "<label for=\"" . $this->prefix . $customField[ 'name' ] . "\"><strong>" . $customField[ 'title' ] . "</strong></label>&nbsp;&nbsp;\n";
277 echo "<input type=\"text\" name=\"" . $this->prefix . $customField[ 'name' ] . "\" id=\"" . $this->prefix . $customField[ 'name' ] . "\" value=\"" . $value . "\" size=\"7\" maxlength=\"7\" style=\"width: 100px;\" />\n";
278 break;
279 }
280 case "date": {
281 echo "<label for=\"" . $this->prefix . $customField[ 'name' ] . "\" style=\"display:inline;\"><strong>" . $customField[ 'title' ] . "</strong></label>&nbsp;&nbsp;\n";
282 // echo "<span style=\"display:inline;\"><strong>" . $customField[ 'title' ] . "</strong></span>&nbsp;&nbsp;\n";
283 $value = ( "" === get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) ? $customField['default'] : get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) );
284 // Date picker using WP's built-in Datepicker jQuery plugin ?>
285 <script type="text/javascript">
286 //<![CDATA[
287 jQuery(document).ready(function() {
288 jQuery( "#<?php echo $this->prefix . $customField[ 'name' ]; ?>" ).datepicker(
289 {
290 <?php if( isset( $customField[ 'custom_functions' ] ) ) echo $customField[ 'custom_functions' ]; ?>
291 changeMonth: true,
292 changeYear: true
293 }
294 );
295 });
296 //]]>
297 </script>
298 <?php
299 echo "<input type=\"text\" name=\"" . $this->prefix . $customField[ 'name' ] . "\" id=\"" . $this->prefix . $customField[ 'name' ] . "\" value=\"" . htmlspecialchars( $value ) . "\" style=\"width: 175px;\" />\n";
300 break;
301 }
302 case "datetime": {
303 echo "<span style=\"display:inline;\"><strong>" . $customField[ 'title' ] . "</strong></span><br />\n";
304 $value = ( "" === get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) ? $customField['default'] : get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) );
305 foreach ( $value as $k => $v )
306 $value[$k] = htmlspecialchars( $v );
307 // Date picker using WP's built-in Datepicker jQuery plugin
308 // Time picker using jQuery UI Timepicker: http://fgelinas.com/code/timepicker
309 ?>
310 <script type="text/javascript">
311 //<![CDATA[
312 jQuery(document).ready(function() {
313 jQuery( "#<?php echo $this->prefix . $customField[ 'name' ]; ?>_date" ).datepicker(
314 {
315 changeMonth: true,
316 changeYear: true
317 }
318 );
319 jQuery( "#<?php echo $this->prefix . $customField[ 'name' ]; ?>_time" ).timepicker(
320 {
321 defaultTime: 'now'
322 }
323 );
324 });
325 //]]>
326 </script>
327 <?php
328 echo "<label for=\"" . $this->prefix . $customField[ 'name' ] . "_date\" style=\"display:inline;\"><em>" . _x( 'Date', 'Date field label', 'timed-content' ) . ":</em></label>&nbsp;&nbsp;\n";
329 echo "<input type=\"text\" name=\"" . $this->prefix . $customField[ 'name' ] . "[date]\" id=\"" . $this->prefix . $customField[ 'name' ] . "_date\" value=\"" . $value['date'] . "\" style=\"width: 175px;\" />\n";
330 echo "<label for=\"" . $this->prefix . $customField[ 'name' ] ."_time\" style=\"display:inline;\"><em>" . _x( 'Time', 'Time field label', 'timed-content' ) . ":</em></label>&nbsp;&nbsp;\n";
331 echo "<input type=\"text\" name=\"" . $this->prefix . $customField[ 'name' ] . "[time]\" id=\"" . $this->prefix . $customField[ 'name' ] . "_time\" value=\"" . $value['time'] . "\" style=\"width: 125px;\" />\n";
332 break;
333 }
334 case "number": {
335 (int)$value = ( "" === get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) ? $customField['default'] : get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) );
336 // Number picker using WP's built-in Spinner jQuery plugin ?>
337 <script type="text/javascript">
338 //<![CDATA[
339 jQuery(document).ready(function() {
340 jQuery( "#<?php echo $this->prefix . $customField[ 'name' ]; ?>" ).spinner(
341 {
342 stop: function( event, ui ) { jQuery( this ).trigger("change"); },
343 <?php if ( isset( $customField[ 'min' ] ) ) { ?>min: <?php echo $customField[ 'min' ]; ?>, <?php } ?>
344 <?php if ( isset( $customField[ 'max' ] ) ) { ?>max: <?php echo $customField[ 'max' ]; ?> <?php } ?>
345 }
346 );
347 });
348 //]]>
349 </script>
350 <?php
351 echo "<label for=\"" . $this->prefix . $customField[ 'name' ] . "\" style=\"display:inline;\"><strong>" . $customField[ 'title' ] . "</strong></label>&nbsp;&nbsp;\n";
352 echo "<input type=\"text\" name=\"" . $this->prefix . $customField[ 'name' ] . "\" id=\"" . $this->prefix . $customField[ 'name' ] . "\" value=\"" . $value . "\" size=\"2\" />\n";
353 break;
354 }
355 case "hidden": {
356 $value = ( "" === get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) ? $customField['default'] : get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) );
357 // Hidden field
358 echo "<input type=\"hidden\" name=\"" . $this->prefix . $customField[ 'name' ] . "\" id=\"" . $this->prefix . $customField[ 'name' ] . "\" value=\"" . $value . "\" />\n";
359 break;
360 }
361 default: {
362 $value = ( "" === get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) ? $customField['default'] : get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) );
363 // Plain text field
364 echo "<label for=\"" . $this->prefix . $customField[ 'name' ] . "\"><strong>" . $customField[ 'title' ] . "</strong></label>\n";
365 echo "<input type=\"text\" name=\"" . $this->prefix . $customField[ 'name' ] . "\" id=\"" . $this->prefix . $customField[ 'name' ] . "\" value=\"" . $value . "\" />\n";
366 break;
367 }
368 }
369 ?>
370 <?php if ( isset( $customField[ 'description' ] ) ) echo "<p>" . $customField[ 'description' ] . "</p>\n"; ?>
371 </div>
372 <?php
373 }
374 } ?>
375 </div>
376 <?php
377 }
378 /**
379 * Save the new Custom Fields values
380 */
381 function saveCustomFields( $post_id, $post ) {
382 // Only save if the user intends to save
383 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
384 return;
385 // Make sure the Save request is coming from the right place
386 if ( !isset( $_POST[ $this->handle . '_wpnonce' ] ) || !wp_verify_nonce( $_POST[ $this->handle . '_wpnonce' ], $this->handle ) )
387 return;
388 // Make sure the user can edit this specific post
389 if ( !current_user_can( 'edit_post', $post_id ) )
390 return;
391 // Make sure this meta box is associated with the right post types
392 if ( ! in_array( $post->post_type, $this->postTypes ) )
393 return;
394 foreach ( $this->customFields as $customField ) {
395 if ( current_user_can( $customField['capability'], $post_id ) ) {
396 if ( isset( $_POST[ $this->prefix . $customField['name'] ] ) ) {
397 if ( is_array( $_POST[ $this->prefix . $customField['name'] ] ) ) {
398 foreach ( $_POST[ $this->prefix . $customField['name'] ] as $k => $v )
399 $_POST[ $this->prefix . $customField['name'] ][$k] = trim( $v );
400 } else
401 $_POST[ $this->prefix . $customField['name'] ] = trim( $_POST[ $this->prefix . $customField['name'] ] );
402 $value = $_POST[ $this->prefix . $customField['name'] ];
403 // Auto-paragraphs for any WYSIWYG
404 if ( $customField['type'] == "wysiwyg" ) $value = wpautop( $value );
405 if ( $customField['type'] == "checkbox" ) $value = "yes";
406 if ( $customField['type'] == "number" ) $value = intval( $value );
407 update_post_meta( $post_id, $this->prefix . $customField[ 'name' ], $value );
408 } else {
409 delete_post_meta( $post_id, $this->prefix . $customField[ 'name' ] );
410 }
411 }
412 }
413 }
414
415
416 } // End Class
417
418 } // End if class exists statement
419 ?>