| @@ -26,12 +26,8 @@ | ||
| 26 | 26 | * @var array $customFields Defines the custom fields available |
| 27 | 27 | */ |
| 28 | 28 | var $customFields = array(); |
| 29 | 29 | /** |
| 30 | - * PHP 4 Compatible Constructor | |
| 31 | - */ | |
| 32 | - function customFieldsInterface( $handle, $label, $desc, $prefix, $postTypes, $customFields ) { $this->__construct( $handle, $label, $desc, $prefix, $postTypes, $customFields ); } | |
| 33 | - /** | |
| 34 | 30 | * PHP 5 Constructor |
| 35 | 31 | */ |
| 36 | 32 | function __construct( $handle, $label, $desc, $prefix, $postTypes, $customFields ) { |
| 37 | 33 | |
| @@ -87,8 +83,10 @@ | ||
| 87 | 83 | /** |
| 88 | 84 | * Create the new Custom Fields meta box |
| 89 | 85 | */ |
| 90 | 86 | function createCustomFields() { |
| 87 | + | |
| 88 | + include("jquery-ui-datetime-i18n.php" ); | |
| 91 | 89 | // Only enqueue scripts if we're dealing with 'timed-content-rule' pages |
| 92 | 90 | foreach ( $this->postTypes as $a_postType ) { |
| 93 | 91 | if ( ( isset( $_GET['post_type'] ) && $_GET['post_type'] == $a_postType ) |
| 94 | 92 | || ( isset( $post_type ) && $post_type == $a_postType ) |
| @@ -95,16 +93,24 @@ | ||
| 95 | 93 | || ( isset( $_GET['post'] ) && get_post_type( $_GET['post'] ) == $a_postType ) ) { |
| 96 | 94 | |
| 97 | 95 | wp_enqueue_style( 'wp-color-picker' ); |
| 98 | 96 | wp_enqueue_script( 'wp-color-picker' ); |
| 99 | - wp_enqueue_style( 'timed-content-jquery-ui-css', TIMED_CONTENT_JQUERY_UI_CSS, false, TIMED_CONTENT_VERSION ); | |
| 100 | - wp_enqueue_script( 'jquery-ui-datepicker' ); | |
| 101 | - wp_enqueue_script( 'jquery-ui-spinner' ); | |
| 102 | - wp_register_style( 'timed-content-jquery-ui-timepicker-css', TIMED_CONTENT_JQUERY_UI_TIMEPICKER_CSS, array( TIMED_CONTENT_JQUERY_UI_CSS ), TIMED_CONTENT_VERSION ); | |
| 103 | - wp_enqueue_style( 'timed-content-jquery-ui-timepicker-css' ); | |
| 104 | - wp_register_script( 'timed-content-jquery-ui-timepicker-js', TIMED_CONTENT_JQUERY_UI_TIMEPICKER_JS, array('jquery', 'jquery-ui-datepicker'), TIMED_CONTENT_VERSION ); | |
| 105 | - wp_enqueue_script( 'timed-content-jquery-ui-timepicker-js' ); | |
| 106 | - if ( function_exists( 'add_meta_box' ) ) | |
| 97 | + wp_enqueue_script( 'jquery-ui-spinner' ); | |
| 98 | + | |
| 99 | + wp_enqueue_style(TIMED_CONTENT_SLUG . '-jquery-ui-css', TIMED_CONTENT_JQUERY_UI_CSS); | |
| 100 | + wp_enqueue_script('jquery-ui-datepicker'); | |
| 101 | + wp_register_style(TIMED_CONTENT_SLUG . '-jquery-ui-timepicker-css', TIMED_CONTENT_JQUERY_UI_TIMEPICKER_CSS); | |
| 102 | + wp_enqueue_style(TIMED_CONTENT_SLUG . '-jquery-ui-timepicker-css'); | |
| 103 | + wp_register_script(TIMED_CONTENT_SLUG . '-jquery-ui-timepicker-js', TIMED_CONTENT_JQUERY_UI_TIMEPICKER_JS, array('jquery', 'jquery-ui-datepicker'), TIMED_CONTENT_VERSION); | |
| 104 | + wp_enqueue_script(TIMED_CONTENT_SLUG . '-jquery-ui-timepicker-js'); | |
| 105 | + if (!(wp_script_is(TIMED_CONTENT_SLUG . '-jquery-ui-datetime-i18n-js', 'registered'))) { | |
| 106 | + wp_register_script(TIMED_CONTENT_SLUG . '-jquery-ui-datetime-i18n-js', TIMED_CONTENT_PLUGIN_URL . "/js/content-protector-datetime-i18n.js", array('jquery', 'jquery-ui-datepicker', TIMED_CONTENT_SLUG . '-jquery-ui-timepicker-js'), TIMED_CONTENT_VERSION); | |
| 107 | + wp_enqueue_script(TIMED_CONTENT_SLUG . '-jquery-ui-datetime-i18n-js'); | |
| 108 | + wp_localize_script(TIMED_CONTENT_SLUG . '-jquery-ui-datetime-i18n-js', 'TimedContentJQDatepickerI18n', $jquery_ui_datetime_datepicker_i18n); | |
| 109 | + wp_localize_script(TIMED_CONTENT_SLUG . '-jquery-ui-datetime-i18n-js', 'TimedContentJQTimepickerI18n', $jquery_ui_datetime_timepicker_i18n); | |
| 110 | + } | |
| 111 | + | |
| 112 | + if ( function_exists( 'add_meta_box' ) ) | |
| 107 | 113 | add_meta_box( $this->handle, $this->label, array( &$this, 'displayCustomFields' ), $a_postType, 'normal', 'high' ); |
| 108 | 114 | } |
| 109 | 115 | } |
| 110 | 116 | } |
| @@ -155,12 +161,12 @@ | ||
| 155 | 161 | case "menu": { |
| 156 | 162 | // menu |
| 157 | 163 | echo "<label for=\"" . $this->prefix . $customField[ 'name' ] . "\" style=\"display:inline;\"><strong>" . $customField[ 'title' ] . "</strong></label><br />\n"; |
| 158 | 164 | if ( sizeof ( $customField['values'] ) == 0 ) |
| 159 | - echo "<em>This menu is empty.</em>\n"; | |
| 165 | + echo "<em>" . __( "This menu is empty.", "timed-content" ) . "</em>\n"; | |
| 160 | 166 | else { |
| 161 | 167 | $selected_value = ( "" === get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) ? $customField['default'] : get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) ); |
| 162 | - 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"; | |
| 168 | + 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"; | |
| 163 | 169 | foreach ( $customField['values'] as $value => $label ) { |
| 164 | 170 | echo "\t<option value=\"" . $value . "\""; |
| 165 | 171 | if ( $selected_value == $value ) |
| 166 | 172 | echo " selected=\"selected\""; |
| @@ -173,9 +179,9 @@ | ||
| 173 | 179 | case "list": { |
| 174 | 180 | // list |
| 175 | 181 | echo "<label for=\"" . $this->prefix . $customField[ 'name' ] . "\" style=\"display:inline;\"><strong>" . $customField[ 'title' ] . "</strong></label> \n"; |
| 176 | 182 | if ( sizeof ( $customField['values'] ) == 0 ) |
| 177 | - echo "<em>This list is empty.</em>\n"; | |
| 183 | + echo "<em>" . __( "This menu is empty.", "timed-content" ) . "</em>\n"; | |
| 178 | 184 | else { |
| 179 | 185 | $selected_value = ( "" === get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) ? $customField['default'] : get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) ); |
| 180 | 186 | echo "<select name=\"" . $this->prefix . $customField['name'] . "\" id=\"" . $this->prefix . $customField['name'] . "\" style=\"width: auto;\">\n"; |
| 181 | 187 | foreach ( $customField['values'] as $value => $label ) { |
| @@ -214,9 +220,9 @@ | ||
| 214 | 220 | $checked_value = ( "" === get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) ? $customField['default'] : get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) ); |
| 215 | 221 | |
| 216 | 222 | echo "<strong>" . $customField[ 'title' ] . "</strong><br />\n"; |
| 217 | 223 | if ( sizeof ( $customField['values'] ) == 0 ) |
| 218 | - echo "<em>This list is empty.</em>\n"; | |
| 224 | + echo "<em>" . __( "This menu is empty.", "timed-content" ) . "</em>\n"; | |
| 219 | 225 | else { |
| 220 | 226 | foreach ( $customField['values'] as $value => $label ) { |
| 221 | 227 | echo "<input type=\"checkbox\" name=\"" . $this->prefix . $customField['name'] . "[]\" id=\"" . $this->prefix . $customField['name'] . "_" . $value . "\" value=\"" . $value . "\""; |
| 222 | 228 | if ( ( is_array( $checked_value ) ) && ( in_array( $value, $checked_value ) ) ) |
| @@ -277,9 +283,9 @@ | ||
| 277 | 283 | //<![CDATA[ |
| 278 | 284 | jQuery(document).ready(function() { |
| 279 | 285 | jQuery( "#<?php echo $this->prefix . $customField[ 'name' ]; ?>" ).datepicker( |
| 280 | 286 | { |
| 281 | - dateFormat: "<?php _ex( "MM d, yy", "Date format for jQuery UI Datepicker", 'timed-content' ); ?>", | |
| 287 | + <?php if( isset( $customField[ 'custom_functions' ] ) ) echo $customField[ 'custom_functions' ]; ?> | |
| 282 | 288 | changeMonth: true, |
| 283 | 289 | changeYear: true |
| 284 | 290 | } |
| 285 | 291 | ); |
| @@ -302,9 +308,8 @@ | ||
| 302 | 308 | //<![CDATA[ |
| 303 | 309 | jQuery(document).ready(function() { |
| 304 | 310 | jQuery( "#<?php echo $this->prefix . $customField[ 'name' ]; ?>_date" ).datepicker( |
| 305 | 311 | { |
| 306 | - dateFormat: "<?php _ex( "MM d, yy", "Date format for jQuery UI Datepicker", 'timed-content' ); ?>", | |
| 307 | 312 | changeMonth: true, |
| 308 | 313 | changeYear: true |
| 309 | 314 | } |
| 310 | 315 | ); |
| @@ -309,10 +314,8 @@ | ||
| 309 | 314 | } |
| 310 | 315 | ); |
| 311 | 316 | jQuery( "#<?php echo $this->prefix . $customField[ 'name' ]; ?>_time" ).timepicker( |
| 312 | 317 | { |
| 313 | - showLeadingZero: false, | |
| 314 | - showPeriod: true, | |
| 315 | 318 | defaultTime: 'now' |
| 316 | 319 | } |
| 317 | 320 | ); |
| 318 | 321 | }); |