クラス WP_Date_Query::__construct() コンストラクタ
2014/12/16
WP_Date_Query::__construct() コンストラクタ
定義ファイル :/blog/wp-includes/date.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | public function __construct( $date_query, $default_column = 'post_date' ) { if ( empty( $date_query ) || ! is_array( $date_query ) ) return; if ( isset( $date_query['relation'] ) && strtoupper( $date_query['relation'] ) == 'OR' ) $this->relation = 'OR'; else $this->relation = 'AND'; if ( ! empty( $date_query['column'] ) ) $this->column = esc_sql( $date_query['column'] ); else $this->column = esc_sql( $default_column ); $this->column = $this->validate_column( $this->column ); $this->compare = $this->get_compare( $date_query ); // If an array of arrays wasn't passed, fix it if ( ! isset( $date_query[0] ) ) $date_query = array( $date_query ); $this->queries = array(); foreach ( $date_query as $key => $query ) { if ( ! is_array( $query ) ) continue; $this->queries[$key] = $query; } } |