| @@ -1,5 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | +/** | |
| 3 | + * @package Polylang | |
| 4 | + */ | |
| 2 | 5 | |
| 3 | 6 | /** |
| 4 | 7 | * A class to manipulate the language query var in WP_Query |
| 5 | 8 | * |
| @@ -5,32 +8,8 @@ | ||
| 5 | 8 | * |
| 6 | 9 | * @since 2.2 |
| 7 | 10 | */ |
| 8 | 11 | class PLL_Query { |
| 9 | - | |
| 10 | - protected static $excludes = array( | |
| 11 | - 'p', | |
| 12 | - 'post_parent', | |
| 13 | - 'attachment', | |
| 14 | - 'attachment_id', | |
| 15 | - 'name', | |
| 16 | - 'pagename', | |
| 17 | - 'page_id', | |
| 18 | - 'category_name', | |
| 19 | - 'tag', | |
| 20 | - 'tag_id', | |
| 21 | - 'cat', | |
| 22 | - 'category__in', | |
| 23 | - 'category__and', | |
| 24 | - 'post__in', | |
| 25 | - 'post_name__in', | |
| 26 | - 'tag__in', | |
| 27 | - 'tag__and', | |
| 28 | - 'tag_slug__in', | |
| 29 | - 'tag_slug__and', | |
| 30 | - 'post_parent__in', | |
| 31 | - ); | |
| 32 | - | |
| 33 | 12 | /** |
| 34 | 13 | * Constructor |
| 35 | 14 | * |
| 36 | 15 | * @since 2.2 |
| @@ -128,35 +107,8 @@ | ||
| 128 | 107 | public function filter_query( $lang ) { |
| 129 | 108 | $qvars = &$this->query->query_vars; |
| 130 | 109 | |
| 131 | 110 | if ( ! isset( $qvars['lang'] ) ) { |
| 132 | - /** | |
| 133 | - * Filter the query vars which disable the language filter in a query | |
| 134 | - * | |
| 135 | - * @since 2.3.5 | |
| 136 | - * | |
| 137 | - * @param array $excludes Query vars excluded from the language filter | |
| 138 | - * @param object $query WP Query | |
| 139 | - * @param object $lang Language | |
| 140 | - */ | |
| 141 | - $excludes = apply_filters( 'pll_filter_query_excluded_query_vars', self::$excludes, $this->query, $lang ); | |
| 142 | - | |
| 143 | - // Do not filter the query if the language is already specified in another way | |
| 144 | - foreach ( $excludes as $k ) { | |
| 145 | - if ( ! empty( $qvars[ $k ] ) ) { | |
| 146 | - // Specific case for 'cat' as it can contain negative values | |
| 147 | - if ( 'cat' === $k ) { | |
| 148 | - foreach ( explode( ',', $qvars['cat'] ) as $cat ) { | |
| 149 | - if ( $cat > 0 ) { | |
| 150 | - return; | |
| 151 | - } | |
| 152 | - } | |
| 153 | - } else { | |
| 154 | - return; | |
| 155 | - } | |
| 156 | - } | |
| 157 | - } | |
| 158 | - | |
| 159 | 111 | $taxonomies = array_intersect( $this->model->get_translated_taxonomies(), get_taxonomies( array( '_builtin' => false ) ) ); |
| 160 | 112 | |
| 161 | 113 | foreach ( $taxonomies as $tax ) { |
| 162 | 114 | $tax = get_taxonomy( $tax ); |