Changeset 587972
- Timestamp:
- 08/20/2012 08:57:26 PM (13 years ago)
- Location:
- kickpress/trunk
- Files:
-
- 8 edited
-
elements/class-checkbox.php (modified) (1 diff)
-
includes/js/kickpress-ajax.js (modified) (1 diff)
-
kickpress-api.php (modified) (3 diffs)
-
kickpress-form-elements.php (modified) (3 diffs)
-
kickpress-functions.php (modified) (1 diff)
-
kickpress-post-types.php (modified) (1 diff)
-
kickpress-relationships.php (modified) (3 diffs)
-
kickpress-workflows.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
kickpress/trunk/elements/class-checkbox.php
r583190 r587972 45 45 extract( $params, EXTR_SKIP ); 46 46 47 return self::_html_input( 'checkbox', $name, 1, array(47 return self::_html_input( 'checkbox', $name, 'enable', array( 48 48 'id' => $id, 49 49 'class' => $class, 50 'checked' => 'enable' == $value50 'checked' => kickpress_boolean( $value ) 51 51 ) ); 52 } 53 54 public function validate_input( $data ) { 55 return kickpress_boolean( $data ) ? 'enable' : 'disable'; 52 56 } 53 57 } -
kickpress/trunk/includes/js/kickpress-ajax.js
r570596 r587972 1 1 jQuery(document).ready( function($) { 2 $('a.ajax-reload'). live('click', function(e) {2 $('a.ajax-reload').on('click', function(e) { 3 3 var wrapper = $('div#' + this.rel); 4 4 -
kickpress/trunk/kickpress-api.php
r586895 r587972 639 639 ); 640 640 641 $post_type = $this->params['post_type']; 642 643 $filter_array = apply_filters( "kickpress_filter_array", $filter_array ); 644 $filter_array = apply_filters( "kickpress_filter_array_{$post_type}", $filter_array ); 645 641 646 return $filter_array; 642 647 } … … 1719 1724 if ( !isset( $this->params['id'] ) ) 1720 1725 $this->params['id'] = $post_id; 1721 1726 1727 // this returns custom fields from the original API, 1728 // not the current post type 1722 1729 $fields = $this->get_custom_fields( true ); 1723 1730 … … 2748 2755 } 2749 2756 2750 $custom_fields = $this->get_custom_fields( $this->params['merge_base_fields'] == ' true' );2757 $custom_fields = $this->get_custom_fields( $this->params['merge_base_fields'] == 'enable' ); 2751 2758 2752 2759 foreach ( $custom_fields as $key => $field ) { -
kickpress/trunk/kickpress-form-elements.php
r586927 r587972 66 66 67 67 if ( ! isset( $value ) ) $value = null; 68 $attr = isset( $properties ) ? $properties : array(); 69 70 $attr['id'] = $id; 71 $attr['class'] = $class; 68 69 $attr = $this->get_attributes( $params ); 72 70 73 71 return self::_html_input( 'text', $name, $value, $attr ); … … 87 85 } 88 86 87 protected function get_attributes( $params ) { 88 extract( $params, EXTR_SKIP ); 89 90 $attr = isset( $properties ) ? $properties : array(); 91 $attr['id'] = $id; 92 $attr['class'] = $class; 93 94 return $attr; 95 } 96 89 97 /** 90 98 * This method SHOULD be over-ridden in child classes 91 99 */ 92 public function validate_input( $ data) {93 return $ data;100 public function validate_input( $value ) { 101 return $value; 94 102 } 95 103 … … 136 144 137 145 return self::_html_select( $name, $value, $options, $attr ); 146 } 147 148 /** 149 * 150 */ 151 public static function filter_alpha( $value ) { 152 return preg_replace( '/[^a-z]/i', '', $value ); 153 } 154 155 /** 156 * 157 */ 158 public static function filter_alnum( $value ) { 159 return preg_replace( '/[^0-9a-z]/i', '', $value ); 160 } 161 162 /** 163 * 164 */ 165 public static function filter_digit( $value ) { 166 return preg_replace( '/[^0-9]/', '', $value ); 167 } 168 169 /** 170 * 171 */ 172 public static function filter_xdigit( $value ) { 173 return preg_replace( '/[^0-9a-f]/i', '', $value ); 138 174 } 139 175 -
kickpress/trunk/kickpress-functions.php
r586895 r587972 696 696 * if one is provided, or FALSE otherwise. 697 697 */ 698 function kickpress_boolean( $ param= null, $default = false ) {698 function kickpress_boolean( $value = null, $default = false ) { 699 699 // ensure that the default is a boolean value 700 700 if ( ! is_bool( $default ) ) 701 701 $default = kickpress_boolean( $default ); 702 702 703 if ( is_null( $ param ) )703 if ( is_null( $value ) ) { 704 704 return $default; 705 elseif ( 'enable' == strtolower( $param ) ) 706 return true; 707 elseif ( 'disable' == strtolower( $param ) ) 708 return false; 709 elseif ( 'false' == strtolower( $param ) ) 710 return false; 711 elseif ( is_string( $param ) ) 712 return (bool) trim( $param ); 713 elseif ( is_scalar( $param ) ) 714 return (bool) $param; 705 } elseif ( is_string( $value ) ) { 706 $true_strings = array( 'true', 'enable' ); 707 $false_strings = array( 'false', 'disable' ); 708 709 $lower_value = strtolower( $value ); 710 711 if ( in_array( $lower_value, $true_strings ) ) 712 return true; 713 elseif ( in_array( $lower_value, $false_strings ) ) 714 return false; 715 716 return (bool) trim( $value ); 717 } elseif ( is_scalar( $value ) ) { 718 return (bool) $value; 719 } 715 720 716 721 return $default; -
kickpress/trunk/kickpress-post-types.php
r586932 r587972 25 25 $show_in_menu = current_user_can( 'manage_options' ); 26 26 27 register_taxonomy( $cat_slug, 'custom-post-types', array(27 register_taxonomy( $cat_slug, 'custom-post-types', array( 28 28 'public' => false, 29 29 'publicly_queryable' => false, -
kickpress/trunk/kickpress-relationships.php
r587447 r587972 399 399 var slug = form.attr('id').substr(16); 400 400 401 var label = $('<label/>').text($(this).text()); 401 var input_id = 'rel_posts-' + slug + '-' + post_id; 402 403 var label = $('<label/>', { 404 'for': input_id 405 }).text(' ' + $(this).text()); 406 402 407 var input = $('<input/>', { 403 'type': 'hidden', 408 'id': input_id, 409 'type': 'checkbox', 404 410 'name': 'rel_posts[' + slug + '][]', 405 'value': post_id 411 'value': post_id, 412 'checked': 'checked' 406 413 }); 407 414 … … 411 418 list.append($('<div/>', { 412 419 'class': 'related-post' 413 }).append($('<a/>', { 414 'href': '#', 415 'title': 'Remove Related Post', 416 'class': 'remove-post' 417 }).text('Remove Related Post')).append(label).append(input)); 420 }).append(input).append(label)); 418 421 419 422 form.hide('blind', null, 'fast'); … … 488 491 <div id="related-posts-<?php echo $slug; ?>" class="related-posts"> 489 492 <?php if ( ! empty( $rel_posts ) ) : ?> 490 <?php if ( 'many' == $rel->object_qty ) : foreach ( $rel_posts as $rel_post ) : ?> 493 <?php if ( 'many' == $rel->object_qty ) : foreach ( $rel_posts as $rel_post ) : 494 $input_id = "rel_posts-{$slug}-{$rel_post->ID}"; ?> 491 495 <div class="related-post"> 492 <a href="#" title="Remove Related Post" class="remove-post">Remove Related Post</a> 493 <label><?php echo $rel_post->post_title; ?></label> 494 <input type="hidden" name="rel_posts[<?php echo $slug; ?>][]" value="<?php echo $rel_post->ID; ?>"> 496 <input id="<?php esc_attr_e( $input_id ); ?>" 497 type="checkbox" checked="checked" 498 name="rel_posts[<?php echo $slug; ?>][]" 499 value="<?php echo $rel_post->ID; ?>"> 500 <label for="<?php esc_attr_e( $input_id ); ?>"> 501 <?php echo $rel_post->post_title; ?> 502 </label> 495 503 </div> 496 504 <?php endforeach; elseif ( 'one' == $rel->object_qty ) : ?> -
kickpress/trunk/kickpress-workflows.php
r498767 r587972 291 291 292 292 foreach ( $kickpress_post_types as $type ) { 293 if ( 'false' == $type['api']->params['builtin']) {293 if ( kickpress_boolean( $type['api']->params['builtin'] ) ) { 294 294 $slug = $type['post_type'] . '-workflow'; 295 295
Note: See TracChangeset
for help on using the changeset viewer.