Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php class WP_Term_Query { public $request; public $meta_query = false; protected $meta_..

Decoded Output download

<?php
 class WP_Term_Query { public $request; public $meta_query = false; protected $meta_query_clauses; protected $sql_clauses = array("select" => '', "from" => '', "where" => array(), "orderby" => '', "limits" => ''); public $query_vars; public $query_var_defaults; public $terms; public function __construct($query = '') { $this->query_var_defaults = array("taxonomy" => null, "object_ids" => null, "orderby" => "name", "order" => "ASC", "hide_empty" => true, "include" => array(), "exclude" => array(), "exclude_tree" => array(), "number" => '', "offset" => '', "fields" => "all", "count" => false, "name" => '', "slug" => '', "term_taxonomy_id" => '', "hierarchical" => true, "search" => '', "name__like" => '', "description__like" => '', "pad_counts" => false, "get" => '', "child_of" => 0, "parent" => '', "childless" => false, "cache_domain" => "core", "cache_results" => true, "update_term_meta_cache" => true, "meta_query" => '', "meta_key" => '', "meta_value" => '', "meta_type" => '', "meta_compare" => ''); if (!empty($query)) { $this->query($query); } } public function parse_query($query = '') { if (empty($query)) { $query = $this->query_vars; } $taxonomies = isset($query["taxonomy"]) ? (array) $query["taxonomy"] : null; $this->query_var_defaults = apply_filters("get_terms_defaults", $this->query_var_defaults, $taxonomies); $query = wp_parse_args($query, $this->query_var_defaults); $query["number"] = absint($query["number"]); $query["offset"] = absint($query["offset"]); if (0 < (int) $query["parent"]) { $query["child_of"] = false; } if ("all" === $query["get"]) { $query["childless"] = false; $query["child_of"] = 0; $query["hide_empty"] = 0; $query["hierarchical"] = false; $query["pad_counts"] = false; } $query["taxonomy"] = $taxonomies; $this->query_vars = $query; do_action("parse_term_query", $this); } public function query($query) { $this->query_vars = wp_parse_args($query); return $this->get_terms(); } public function get_terms() { global $wpdb; $this->parse_query($this->query_vars); $args =& $this->query_vars; $this->meta_query = new WP_Meta_Query(); $this->meta_query->parse_query_vars($args); do_action_ref_array("pre_get_terms", array(&$this)); $taxonomies = (array) $args["taxonomy"]; $has_hierarchical_tax = false; if ($taxonomies) { foreach ($taxonomies as $_tax) { if (is_taxonomy_hierarchical($_tax)) { $has_hierarchical_tax = true; } } } else { $has_hierarchical_tax = true; } if (!$has_hierarchical_tax) { $args["hierarchical"] = false; $args["pad_counts"] = false; } if (0 < (int) $args["parent"]) { $args["child_of"] = false; } if ("all" === $args["get"]) { $args["childless"] = false; $args["child_of"] = 0; $args["hide_empty"] = 0; $args["hierarchical"] = false; $args["pad_counts"] = false; } $args = apply_filters("get_terms_args", $args, $taxonomies); $child_of = $args["child_of"]; $parent = $args["parent"]; if ($child_of) { $_parent = $child_of; } elseif ($parent) { $_parent = $parent; } else { $_parent = false; } if ($_parent) { $in_hierarchy = false; foreach ($taxonomies as $_tax) { $hierarchy = _get_term_hierarchy($_tax); if (isset($hierarchy[$_parent])) { $in_hierarchy = true; } } if (!$in_hierarchy) { if ("count" === $args["fields"]) { return 0; } else { $this->terms = array(); return $this->terms; } } } $_orderby = $this->query_vars["orderby"]; if ("term_order" === $_orderby && empty($this->query_vars["object_ids"])) { $_orderby = "term_id"; } $orderby = $this->parse_orderby($_orderby); if ($orderby) { $orderby = "ORDER BY {$orderby}"; } $order = $this->parse_order($this->query_vars["order"]); if ($taxonomies) { $this->sql_clauses["where"]["taxonomy"] = "tt.taxonomy IN ('" . implode("', '", array_map("esc_sql", $taxonomies)) . "')"; } if (empty($args["exclude"])) { $args["exclude"] = array(); } if (empty($args["include"])) { $args["include"] = array(); } $exclude = $args["exclude"]; $exclude_tree = $args["exclude_tree"]; $include = $args["include"]; $inclusions = ''; if (!empty($include)) { $exclude = ''; $exclude_tree = ''; $inclusions = implode(",", wp_parse_id_list($include)); } if (!empty($inclusions)) { $this->sql_clauses["where"]["inclusions"] = "t.term_id IN ( " . $inclusions . " )"; } $exclusions = array(); if (!empty($exclude_tree)) { $exclude_tree = wp_parse_id_list($exclude_tree); $excluded_children = $exclude_tree; foreach ($exclude_tree as $extrunk) { $excluded_children = array_merge($excluded_children, (array) get_terms(array("taxonomy" => reset($taxonomies), "child_of" => (int) $extrunk, "fields" => "ids", "hide_empty" => 0))); } $exclusions = array_merge($excluded_children, $exclusions); } if (!empty($exclude)) { $exclusions = array_merge(wp_parse_id_list($exclude), $exclusions); } $childless = (bool) $args["childless"]; if ($childless) { foreach ($taxonomies as $_tax) { $term_hierarchy = _get_term_hierarchy($_tax); $exclusions = array_merge(array_keys($term_hierarchy), $exclusions); } } if (!empty($exclusions)) { $exclusions = "t.term_id NOT IN (" . implode(",", array_map("intval", $exclusions)) . ")"; } else { $exclusions = ''; } $exclusions = apply_filters("list_terms_exclusions", $exclusions, $args, $taxonomies); if (!empty($exclusions)) { $this->sql_clauses["where"]["exclusions"] = preg_replace("/^\s*AND\s*/", '', $exclusions); } if ('' === $args["name"]) { $args["name"] = array(); } else { $args["name"] = (array) $args["name"]; } if (!empty($args["name"])) { $names = $args["name"]; foreach ($names as &$_name) { $_name = stripslashes(sanitize_term_field("name", $_name, 0, reset($taxonomies), "db")); } $this->sql_clauses["where"]["name"] = "t.name IN ('" . implode("', '", array_map("esc_sql", $names)) . "')"; } if ('' === $args["slug"]) { $args["slug"] = array(); } else { $args["slug"] = array_map("sanitize_title", (array) $args["slug"]); } if (!empty($args["slug"])) { $slug = implode("', '", $args["slug"]); $this->sql_clauses["where"]["slug"] = "t.slug IN ('" . $slug . "')"; } if ('' === $args["term_taxonomy_id"]) { $args["term_taxonomy_id"] = array(); } else { $args["term_taxonomy_id"] = array_map("intval", (array) $args["term_taxonomy_id"]); } if (!empty($args["term_taxonomy_id"])) { $tt_ids = implode(",", $args["term_taxonomy_id"]); $this->sql_clauses["where"]["term_taxonomy_id"] = "tt.term_taxonomy_id IN ({$tt_ids})"; } if (!empty($args["name__like"])) { $this->sql_clauses["where"]["name__like"] = $wpdb->prepare("t.name LIKE %s", "%" . $wpdb->esc_like($args["name__like"]) . "%"); } if (!empty($args["description__like"])) { $this->sql_clauses["where"]["description__like"] = $wpdb->prepare("tt.description LIKE %s", "%" . $wpdb->esc_like($args["description__like"]) . "%"); } if ('' === $args["object_ids"]) { $args["object_ids"] = array(); } else { $args["object_ids"] = array_map("intval", (array) $args["object_ids"]); } if (!empty($args["object_ids"])) { $object_ids = implode(", ", $args["object_ids"]); $this->sql_clauses["where"]["object_ids"] = "tr.object_id IN ({$object_ids})"; } if (!empty($args["object_ids"])) { $args["hide_empty"] = false; } if ('' !== $parent) { $parent = (int) $parent; $this->sql_clauses["where"]["parent"] = "tt.parent = '{$parent}'"; } $hierarchical = $args["hierarchical"]; if ("count" === $args["fields"]) { $hierarchical = false; } if ($args["hide_empty"] && !$hierarchical) { $this->sql_clauses["where"]["count"] = "tt.count > 0"; } $number = $args["number"]; $offset = $args["offset"]; if ($number && !$hierarchical && !$child_of && '' === $parent) { if ($offset) { $limits = "LIMIT " . $offset . "," . $number; } else { $limits = "LIMIT " . $number; } } else { $limits = ''; } if (!empty($args["search"])) { $this->sql_clauses["where"]["search"] = $this->get_search_sql($args["search"]); } $join = ''; $distinct = ''; $this->meta_query->parse_query_vars($this->query_vars); $mq_sql = $this->meta_query->get_sql("term", "t", "term_id"); $meta_clauses = $this->meta_query->get_clauses(); if (!empty($meta_clauses)) { $join .= $mq_sql["join"]; $this->sql_clauses["where"]["meta_query"] = preg_replace("/^\s*AND\s*/", '', $mq_sql["where"]); $distinct .= "DISTINCT"; } $selects = array(); switch ($args["fields"]) { case "count": $orderby = ''; $order = ''; $selects = array("COUNT(*)"); break; default: $selects = array("t.term_id"); if ("all_with_object_id" === $args["fields"] && !empty($args["object_ids"])) { $selects[] = "tr.object_id"; } break; } $_fields = $args["fields"]; $fields = implode(", ", apply_filters("get_terms_fields", $selects, $args, $taxonomies)); $join .= " INNER JOIN {$wpdb->term_taxonomy} AS tt ON t.term_id = tt.term_id"; if (!empty($this->query_vars["object_ids"])) { $join .= " INNER JOIN {$wpdb->term_relationships} AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id"; $distinct = "DISTINCT"; } $where = implode(" AND ", $this->sql_clauses["where"]); $pieces = array("fields", "join", "where", "distinct", "orderby", "order", "limits"); $clauses = apply_filters("terms_clauses", compact($pieces), $taxonomies, $args); $fields = isset($clauses["fields"]) ? $clauses["fields"] : ''; $join = isset($clauses["join"]) ? $clauses["join"] : ''; $where = isset($clauses["where"]) ? $clauses["where"] : ''; $distinct = isset($clauses["distinct"]) ? $clauses["distinct"] : ''; $orderby = isset($clauses["orderby"]) ? $clauses["orderby"] : ''; $order = isset($clauses["order"]) ? $clauses["order"] : ''; $limits = isset($clauses["limits"]) ? $clauses["limits"] : ''; $fields_is_filtered = implode(", ", $selects) !== $fields; if ($where) { $where = "WHERE {$where}"; } $this->sql_clauses["select"] = "SELECT {$distinct} {$fields}"; $this->sql_clauses["from"] = "FROM {$wpdb->terms} AS t {$join}"; $this->sql_clauses["orderby"] = $orderby ? "{$orderby} {$order}" : ''; $this->sql_clauses["limits"] = $limits; $this->request = "{$this->sql_clauses["select"]}
	\x9\x9 {$this->sql_clauses["from"]}
\x9\x9	 {$where}
	\x9	 {$this->sql_clauses["orderby"]}
\x9	\x9 {$this->sql_clauses["limits"]}"; $this->terms = null; $this->terms = apply_filters_ref_array("terms_pre_query", array($this->terms, &$this)); if (null !== $this->terms) { return $this->terms; } if ($args["cache_results"]) { $cache_key = $this->generate_cache_key($args, $this->request); $cache = wp_cache_get($cache_key, "term-queries"); if (false !== $cache) { if ("ids" === $_fields) { $cache = array_map("intval", $cache); } elseif ("count" !== $_fields) { if ("all_with_object_id" === $_fields && !empty($args["object_ids"]) || ("all" === $_fields && $args["pad_counts"] || $fields_is_filtered)) { $term_ids = wp_list_pluck($cache, "term_id"); } else { $term_ids = array_map("intval", $cache); } _prime_term_caches($term_ids, $args["update_term_meta_cache"]); $term_objects = $this->populate_terms($cache); $cache = $this->format_terms($term_objects, $_fields); } $this->terms = $cache; return $this->terms; } } if ("count" === $_fields) { $count = $wpdb->get_var($this->request); if ($args["cache_results"]) { wp_cache_set($cache_key, $count, "term-queries"); } return $count; } $terms = $wpdb->get_results($this->request); if (empty($terms)) { if ($args["cache_results"]) { wp_cache_add($cache_key, array(), "term-queries"); } return array(); } $term_ids = wp_list_pluck($terms, "term_id"); _prime_term_caches($term_ids, false); $term_objects = $this->populate_terms($terms); if ($child_of) { foreach ($taxonomies as $_tax) { $children = _get_term_hierarchy($_tax); if (!empty($children)) { $term_objects = _get_term_children($child_of, $term_objects, $_tax); } } } if ($args["pad_counts"] && "all" === $_fields) { foreach ($taxonomies as $_tax) { _pad_term_counts($term_objects, $_tax); } } if ($hierarchical && $args["hide_empty"] && is_array($term_objects)) { foreach ($term_objects as $k => $term) { if (!$term->count) { $children = get_term_children($term->term_id, $term->taxonomy); if (is_array($children)) { foreach ($children as $child_id) { $child = get_term($child_id, $term->taxonomy); if ($child->count) { continue 2; } } } unset($term_objects[$k]); } } } if ($hierarchical && $number && is_array($term_objects)) { if ($offset >= count($term_objects)) { $term_objects = array(); } else { $term_objects = array_slice($term_objects, $offset, $number, true); } } if ($args["update_term_meta_cache"]) { $term_ids = wp_list_pluck($term_objects, "term_id"); wp_lazyload_term_meta($term_ids); } if ("all_with_object_id" === $_fields && !empty($args["object_ids"])) { $term_cache = array(); foreach ($term_objects as $term) { $object = new stdClass(); $object->term_id = $term->term_id; $object->object_id = $term->object_id; $term_cache[] = $object; } } elseif ("all" === $_fields && $args["pad_counts"]) { $term_cache = array(); foreach ($term_objects as $term) { $object = new stdClass(); $object->term_id = $term->term_id; $object->count = $term->count; $term_cache[] = $object; } } elseif ($fields_is_filtered) { $term_cache = $term_objects; } else { $term_cache = wp_list_pluck($term_objects, "term_id"); } if ($args["cache_results"]) { wp_cache_add($cache_key, $term_cache, "term-queries"); } $this->terms = $this->format_terms($term_objects, $_fields); return $this->terms; } protected function parse_orderby($orderby_raw) { $_orderby = strtolower($orderby_raw); $maybe_orderby_meta = false; if (in_array($_orderby, array("term_id", "name", "slug", "term_group"), true)) { $orderby = "t.{$_orderby}"; } elseif (in_array($_orderby, array("count", "parent", "taxonomy", "term_taxonomy_id", "description"), true)) { $orderby = "tt.{$_orderby}"; } elseif ("term_order" === $_orderby) { $orderby = "tr.term_order"; } elseif ("include" === $_orderby && !empty($this->query_vars["include"])) { $include = implode(",", wp_parse_id_list($this->query_vars["include"])); $orderby = "FIELD( t.term_id, {$include} )"; } elseif ("slug__in" === $_orderby && !empty($this->query_vars["slug"]) && is_array($this->query_vars["slug"])) { $slugs = implode("', '", array_map("sanitize_title_for_query", $this->query_vars["slug"])); $orderby = "FIELD( t.slug, '" . $slugs . "')"; } elseif ("none" === $_orderby) { $orderby = ''; } elseif (empty($_orderby) || "id" === $_orderby || "term_id" === $_orderby) { $orderby = "t.term_id"; } else { $orderby = "t.name"; $maybe_orderby_meta = true; } $orderby = apply_filters("get_terms_orderby", $orderby, $this->query_vars, $this->query_vars["taxonomy"]); if ($maybe_orderby_meta) { $maybe_orderby_meta = $this->parse_orderby_meta($_orderby); if ($maybe_orderby_meta) { $orderby = $maybe_orderby_meta; } } return $orderby; } protected function format_terms($term_objects, $_fields) { $_terms = array(); if ("id=>parent" === $_fields) { foreach ($term_objects as $term) { $_terms[$term->term_id] = $term->parent; } } elseif ("ids" === $_fields) { foreach ($term_objects as $term) { $_terms[] = (int) $term->term_id; } } elseif ("tt_ids" === $_fields) { foreach ($term_objects as $term) { $_terms[] = (int) $term->term_taxonomy_id; } } elseif ("names" === $_fields) { foreach ($term_objects as $term) { $_terms[] = $term->name; } } elseif ("slugs" === $_fields) { foreach ($term_objects as $term) { $_terms[] = $term->slug; } } elseif ("id=>name" === $_fields) { foreach ($term_objects as $term) { $_terms[$term->term_id] = $term->name; } } elseif ("id=>slug" === $_fields) { foreach ($term_objects as $term) { $_terms[$term->term_id] = $term->slug; } } elseif ("all" === $_fields || "all_with_object_id" === $_fields) { $_terms = $term_objects; } return $_terms; } protected function parse_orderby_meta($orderby_raw) { $orderby = ''; $this->meta_query->get_sql("term", "t", "term_id"); $meta_clauses = $this->meta_query->get_clauses(); if (!$meta_clauses || !$orderby_raw) { return $orderby; } $allowed_keys = array(); $primary_meta_key = null; $primary_meta_query = reset($meta_clauses); if (!empty($primary_meta_query["key"])) { $primary_meta_key = $primary_meta_query["key"]; $allowed_keys[] = $primary_meta_key; } $allowed_keys[] = "meta_value"; $allowed_keys[] = "meta_value_num"; $allowed_keys = array_merge($allowed_keys, array_keys($meta_clauses)); if (!in_array($orderby_raw, $allowed_keys, true)) { return $orderby; } switch ($orderby_raw) { case $primary_meta_key: case "meta_value": if (!empty($primary_meta_query["type"])) { $orderby = "CAST({$primary_meta_query["alias"]}.meta_value AS {$primary_meta_query["cast"]})"; } else { $orderby = "{$primary_meta_query["alias"]}.meta_value"; } break; case "meta_value_num": $orderby = "{$primary_meta_query["alias"]}.meta_value+0"; break; default: if (array_key_exists($orderby_raw, $meta_clauses)) { $meta_clause = $meta_clauses[$orderby_raw]; $orderby = "CAST({$meta_clause["alias"]}.meta_value AS {$meta_clause["cast"]})"; } break; } return $orderby; } protected function parse_order($order) { if (!is_string($order) || empty($order)) { return "DESC"; } if ("ASC" === strtoupper($order)) { return "ASC"; } else { return "DESC"; } } protected function get_search_sql($search) { global $wpdb; $like = "%" . $wpdb->esc_like($search) . "%"; return $wpdb->prepare("((t.name LIKE %s) OR (t.slug LIKE %s))", $like, $like); } protected function populate_terms($terms) { $term_objects = array(); if (!is_array($terms)) { return $term_objects; } foreach ($terms as $key => $term_data) { if (is_object($term_data) && property_exists($term_data, "term_id")) { $term = get_term($term_data->term_id); if (property_exists($term_data, "object_id")) { $term->object_id = (int) $term_data->object_id; } if (property_exists($term_data, "count")) { $term->count = (int) $term_data->count; } } else { $term = get_term($term_data); } if ($term instanceof WP_Term) { $term_objects[$key] = $term; } } return $term_objects; } protected function generate_cache_key(array $args, $sql) { global $wpdb; $cache_args = wp_array_slice_assoc($args, array_keys($this->query_var_defaults)); unset($cache_args["cache_results"], $cache_args["update_term_meta_cache"]); if ("count" !== $args["fields"] && "all_with_object_id" !== $args["fields"]) { $cache_args["fields"] = "all"; } $taxonomies = (array) $args["taxonomy"]; $sql = $wpdb->remove_placeholder_escape($sql); $key = md5(serialize($cache_args) . serialize($taxonomies) . $sql); $last_changed = wp_cache_get_last_changed("terms"); return "get_terms:{$key}:{$last_changed}"; } } ?>

Did this file decode correctly?

Original Code

<?php
 class WP_Term_Query { public $request; public $meta_query = false; protected $meta_query_clauses; protected $sql_clauses = array("\163\x65\154\x65\143\164" => '', "\146\x72\x6f\155" => '', "\x77\150\x65\x72\145" => array(), "\x6f\x72\144\145\x72\142\x79" => '', "\154\151\155\151\164\163" => ''); public $query_vars; public $query_var_defaults; public $terms; public function __construct($query = '') { $this->query_var_defaults = array("\x74\141\170\x6f\156\x6f\x6d\x79" => null, "\x6f\x62\152\145\143\164\137\x69\144\x73" => null, "\x6f\162\144\145\162\x62\x79" => "\x6e\x61\155\145", "\157\162\x64\145\x72" => "\101\x53\x43", "\150\x69\144\x65\x5f\145\x6d\160\164\171" => true, "\x69\x6e\143\154\165\144\145" => array(), "\145\x78\x63\x6c\165\144\x65" => array(), "\x65\170\143\x6c\165\x64\145\137\164\162\145\145" => array(), "\x6e\x75\x6d\142\145\x72" => '', "\x6f\x66\x66\163\x65\164" => '', "\146\x69\x65\x6c\144\163" => "\141\x6c\154", "\143\157\x75\x6e\164" => false, "\156\141\x6d\x65" => '', "\163\154\165\147" => '', "\164\145\162\x6d\x5f\x74\141\170\x6f\156\x6f\x6d\171\137\x69\144" => '', "\x68\151\x65\162\141\162\143\x68\x69\x63\141\x6c" => true, "\x73\145\x61\x72\143\150" => '', "\156\141\155\145\137\137\x6c\x69\153\x65" => '', "\x64\145\x73\143\162\151\160\x74\151\157\156\x5f\x5f\154\151\x6b\x65" => '', "\160\x61\144\137\x63\x6f\165\156\164\163" => false, "\147\145\164" => '', "\x63\150\151\x6c\144\x5f\157\x66" => 0, "\160\x61\162\145\156\x74" => '', "\143\150\x69\154\144\x6c\x65\163\163" => false, "\143\141\143\150\145\137\144\157\x6d\141\151\156" => "\x63\x6f\x72\145", "\143\x61\143\150\x65\x5f\162\x65\163\x75\154\164\x73" => true, "\x75\x70\144\x61\x74\x65\137\x74\x65\x72\155\x5f\155\x65\164\141\x5f\143\141\143\150\145" => true, "\155\145\164\141\137\x71\165\145\x72\171" => '', "\155\145\164\141\137\153\x65\x79" => '', "\155\x65\164\x61\x5f\x76\x61\154\165\145" => '', "\x6d\145\x74\141\x5f\x74\x79\x70\x65" => '', "\x6d\145\164\141\137\x63\x6f\155\160\x61\x72\x65" => ''); if (!empty($query)) { $this->query($query); } } public function parse_query($query = '') { if (empty($query)) { $query = $this->query_vars; } $taxonomies = isset($query["\164\141\170\157\x6e\157\x6d\171"]) ? (array) $query["\164\141\170\157\x6e\157\x6d\171"] : null; $this->query_var_defaults = apply_filters("\147\145\164\x5f\x74\145\x72\155\x73\x5f\144\145\146\141\x75\x6c\164\163", $this->query_var_defaults, $taxonomies); $query = wp_parse_args($query, $this->query_var_defaults); $query["\156\165\x6d\x62\x65\x72"] = absint($query["\x6e\x75\x6d\142\x65\x72"]); $query["\x6f\146\146\163\x65\164"] = absint($query["\x6f\146\x66\x73\x65\x74"]); if (0 < (int) $query["\x70\141\162\x65\156\164"]) { $query["\143\150\x69\x6c\144\137\x6f\146"] = false; } if ("\141\x6c\154" === $query["\x67\x65\x74"]) { $query["\x63\150\151\154\144\x6c\145\163\x73"] = false; $query["\143\x68\x69\154\144\x5f\157\x66"] = 0; $query["\150\151\144\x65\x5f\x65\155\x70\164\x79"] = 0; $query["\x68\151\145\162\141\x72\143\x68\x69\x63\141\154"] = false; $query["\160\x61\144\137\143\x6f\x75\156\164\x73"] = false; } $query["\x74\x61\x78\157\156\157\x6d\x79"] = $taxonomies; $this->query_vars = $query; do_action("\x70\141\162\x73\x65\x5f\164\x65\162\155\x5f\161\165\145\162\x79", $this); } public function query($query) { $this->query_vars = wp_parse_args($query); return $this->get_terms(); } public function get_terms() { global $wpdb; $this->parse_query($this->query_vars); $args =& $this->query_vars; $this->meta_query = new WP_Meta_Query(); $this->meta_query->parse_query_vars($args); do_action_ref_array("\160\x72\145\x5f\x67\145\x74\137\x74\x65\162\155\x73", array(&$this)); $taxonomies = (array) $args["\x74\x61\x78\x6f\156\x6f\x6d\x79"]; $has_hierarchical_tax = false; if ($taxonomies) { foreach ($taxonomies as $_tax) { if (is_taxonomy_hierarchical($_tax)) { $has_hierarchical_tax = true; } } } else { $has_hierarchical_tax = true; } if (!$has_hierarchical_tax) { $args["\150\x69\145\x72\x61\x72\143\150\x69\x63\141\x6c"] = false; $args["\160\141\x64\x5f\143\x6f\165\x6e\x74\163"] = false; } if (0 < (int) $args["\x70\x61\162\x65\x6e\x74"]) { $args["\x63\x68\151\154\144\x5f\x6f\146"] = false; } if ("\141\x6c\x6c" === $args["\x67\145\164"]) { $args["\x63\150\151\x6c\144\154\x65\x73\163"] = false; $args["\143\150\151\154\x64\137\157\146"] = 0; $args["\x68\x69\x64\145\x5f\x65\155\x70\164\171"] = 0; $args["\150\151\145\162\x61\162\x63\x68\x69\x63\141\154"] = false; $args["\160\141\x64\137\143\x6f\x75\x6e\164\x73"] = false; } $args = apply_filters("\147\145\164\x5f\164\145\162\x6d\x73\137\x61\162\x67\x73", $args, $taxonomies); $child_of = $args["\143\150\151\154\x64\137\157\x66"]; $parent = $args["\160\x61\162\x65\156\x74"]; if ($child_of) { $_parent = $child_of; } elseif ($parent) { $_parent = $parent; } else { $_parent = false; } if ($_parent) { $in_hierarchy = false; foreach ($taxonomies as $_tax) { $hierarchy = _get_term_hierarchy($_tax); if (isset($hierarchy[$_parent])) { $in_hierarchy = true; } } if (!$in_hierarchy) { if ("\143\157\x75\156\x74" === $args["\146\151\145\x6c\144\163"]) { return 0; } else { $this->terms = array(); return $this->terms; } } } $_orderby = $this->query_vars["\x6f\x72\x64\x65\162\142\171"]; if ("\164\x65\x72\155\x5f\x6f\162\144\145\162" === $_orderby && empty($this->query_vars["\157\x62\x6a\145\x63\164\137\151\x64\163"])) { $_orderby = "\x74\145\x72\x6d\x5f\x69\x64"; } $orderby = $this->parse_orderby($_orderby); if ($orderby) { $orderby = "\117\x52\104\x45\x52\x20\102\x59\40{$orderby}"; } $order = $this->parse_order($this->query_vars["\x6f\162\x64\145\x72"]); if ($taxonomies) { $this->sql_clauses["\167\150\x65\162\145"]["\164\x61\170\x6f\x6e\x6f\155\x79"] = "\x74\x74\x2e\x74\141\x78\157\x6e\157\155\171\40\111\x4e\x20\x28\x27" . implode("\x27\x2c\40\47", array_map("\145\163\143\137\163\161\154", $taxonomies)) . "\x27\x29"; } if (empty($args["\145\170\143\154\165\144\145"])) { $args["\x65\x78\x63\x6c\165\144\x65"] = array(); } if (empty($args["\151\156\x63\x6c\165\x64\145"])) { $args["\151\x6e\143\154\x75\144\145"] = array(); } $exclude = $args["\x65\x78\143\154\165\x64\x65"]; $exclude_tree = $args["\x65\170\143\x6c\165\144\145\x5f\164\162\x65\x65"]; $include = $args["\151\156\x63\154\165\144\x65"]; $inclusions = ''; if (!empty($include)) { $exclude = ''; $exclude_tree = ''; $inclusions = implode("\54", wp_parse_id_list($include)); } if (!empty($inclusions)) { $this->sql_clauses["\x77\x68\x65\x72\145"]["\151\x6e\x63\x6c\165\163\x69\157\x6e\x73"] = "\x74\56\164\x65\162\155\x5f\151\144\x20\111\x4e\40\50\x20" . $inclusions . "\40\x29"; } $exclusions = array(); if (!empty($exclude_tree)) { $exclude_tree = wp_parse_id_list($exclude_tree); $excluded_children = $exclude_tree; foreach ($exclude_tree as $extrunk) { $excluded_children = array_merge($excluded_children, (array) get_terms(array("\164\x61\170\x6f\156\157\x6d\x79" => reset($taxonomies), "\x63\x68\151\154\x64\x5f\x6f\146" => (int) $extrunk, "\x66\x69\x65\x6c\x64\x73" => "\x69\144\x73", "\x68\151\144\x65\137\x65\155\160\x74\x79" => 0))); } $exclusions = array_merge($excluded_children, $exclusions); } if (!empty($exclude)) { $exclusions = array_merge(wp_parse_id_list($exclude), $exclusions); } $childless = (bool) $args["\x63\150\151\154\144\154\x65\x73\x73"]; if ($childless) { foreach ($taxonomies as $_tax) { $term_hierarchy = _get_term_hierarchy($_tax); $exclusions = array_merge(array_keys($term_hierarchy), $exclusions); } } if (!empty($exclusions)) { $exclusions = "\164\56\164\145\x72\155\137\x69\x64\40\116\117\124\x20\111\116\x20\50" . implode("\54", array_map("\151\x6e\164\166\x61\x6c", $exclusions)) . "\51"; } else { $exclusions = ''; } $exclusions = apply_filters("\154\x69\x73\164\137\164\x65\x72\155\x73\137\x65\x78\143\154\x75\x73\151\157\156\163", $exclusions, $args, $taxonomies); if (!empty($exclusions)) { $this->sql_clauses["\x77\150\145\x72\145"]["\145\170\143\154\165\x73\151\x6f\x6e\x73"] = preg_replace("\x2f\136\134\x73\x2a\101\116\x44\x5c\163\x2a\x2f", '', $exclusions); } if ('' === $args["\x6e\x61\x6d\x65"]) { $args["\x6e\x61\155\x65"] = array(); } else { $args["\x6e\141\155\145"] = (array) $args["\156\141\155\145"]; } if (!empty($args["\156\x61\x6d\x65"])) { $names = $args["\x6e\141\x6d\x65"]; foreach ($names as &$_name) { $_name = stripslashes(sanitize_term_field("\x6e\141\155\145", $_name, 0, reset($taxonomies), "\144\x62")); } $this->sql_clauses["\167\x68\145\162\x65"]["\x6e\x61\155\x65"] = "\x74\x2e\156\141\155\145\x20\111\116\x20\x28\47" . implode("\x27\54\x20\47", array_map("\145\163\143\x5f\163\161\x6c", $names)) . "\47\x29"; } if ('' === $args["\x73\154\165\147"]) { $args["\163\x6c\x75\147"] = array(); } else { $args["\163\x6c\x75\x67"] = array_map("\163\x61\x6e\x69\x74\151\x7a\x65\137\164\x69\164\x6c\x65", (array) $args["\163\x6c\165\x67"]); } if (!empty($args["\x73\x6c\165\x67"])) { $slug = implode("\47\54\40\x27", $args["\163\154\x75\x67"]); $this->sql_clauses["\167\150\x65\162\x65"]["\x73\154\165\x67"] = "\x74\x2e\163\154\x75\x67\40\x49\x4e\40\x28\47" . $slug . "\x27\x29"; } if ('' === $args["\x74\x65\x72\x6d\x5f\x74\x61\170\157\x6e\x6f\155\171\x5f\x69\x64"]) { $args["\x74\145\x72\x6d\137\164\141\170\x6f\156\x6f\155\171\137\151\144"] = array(); } else { $args["\164\x65\x72\155\x5f\x74\141\170\157\x6e\x6f\155\171\137\x69\144"] = array_map("\151\x6e\164\x76\x61\154", (array) $args["\x74\x65\x72\155\137\x74\x61\x78\157\x6e\x6f\155\x79\x5f\151\x64"]); } if (!empty($args["\x74\x65\162\x6d\137\x74\x61\x78\157\x6e\x6f\155\x79\x5f\x69\x64"])) { $tt_ids = implode("\x2c", $args["\x74\145\x72\x6d\137\164\x61\170\157\x6e\x6f\x6d\x79\x5f\151\x64"]); $this->sql_clauses["\167\x68\145\162\x65"]["\164\x65\162\x6d\137\164\x61\170\x6f\x6e\x6f\155\x79\x5f\151\x64"] = "\x74\164\56\x74\x65\162\155\137\x74\141\x78\x6f\156\x6f\155\x79\137\x69\144\40\x49\116\x20\x28{$tt_ids}\51"; } if (!empty($args["\156\141\155\145\x5f\137\x6c\151\x6b\x65"])) { $this->sql_clauses["\167\150\x65\162\145"]["\x6e\x61\155\x65\137\x5f\154\x69\153\x65"] = $wpdb->prepare("\x74\x2e\156\141\x6d\x65\40\x4c\111\x4b\105\x20\45\163", "\x25" . $wpdb->esc_like($args["\x6e\x61\x6d\x65\x5f\137\x6c\x69\153\x65"]) . "\45"); } if (!empty($args["\x64\145\x73\x63\x72\x69\x70\164\x69\157\x6e\137\137\x6c\151\153\145"])) { $this->sql_clauses["\x77\150\x65\162\145"]["\144\145\163\143\162\x69\x70\x74\151\157\156\137\137\x6c\151\153\x65"] = $wpdb->prepare("\164\164\x2e\x64\x65\x73\x63\x72\x69\160\164\151\x6f\156\x20\114\x49\113\x45\40\45\x73", "\45" . $wpdb->esc_like($args["\x64\x65\x73\x63\162\x69\160\164\x69\x6f\x6e\137\x5f\154\151\x6b\145"]) . "\45"); } if ('' === $args["\157\x62\x6a\x65\x63\164\x5f\151\x64\163"]) { $args["\x6f\x62\x6a\x65\x63\x74\137\x69\144\x73"] = array(); } else { $args["\157\142\152\145\143\164\x5f\151\144\x73"] = array_map("\x69\x6e\x74\x76\141\154", (array) $args["\x6f\142\152\145\x63\164\137\x69\x64\163"]); } if (!empty($args["\x6f\142\152\x65\x63\x74\137\151\144\163"])) { $object_ids = implode("\54\40", $args["\157\142\x6a\x65\x63\x74\x5f\x69\x64\163"]); $this->sql_clauses["\167\x68\145\x72\x65"]["\157\x62\152\x65\143\164\137\x69\144\163"] = "\164\162\x2e\157\142\152\145\143\164\x5f\x69\x64\x20\111\x4e\x20\50{$object_ids}\x29"; } if (!empty($args["\x6f\142\x6a\x65\143\x74\x5f\x69\x64\163"])) { $args["\x68\x69\144\x65\137\x65\x6d\160\164\171"] = false; } if ('' !== $parent) { $parent = (int) $parent; $this->sql_clauses["\167\x68\145\x72\145"]["\x70\x61\x72\145\x6e\x74"] = "\x74\x74\x2e\x70\x61\162\x65\156\x74\x20\x3d\x20\x27{$parent}\x27"; } $hierarchical = $args["\x68\151\145\x72\141\x72\x63\x68\151\143\x61\154"]; if ("\x63\157\165\156\164" === $args["\x66\151\x65\154\144\x73"]) { $hierarchical = false; } if ($args["\x68\151\144\145\x5f\145\x6d\160\x74\171"] && !$hierarchical) { $this->sql_clauses["\x77\x68\145\162\145"]["\143\x6f\165\156\x74"] = "\164\x74\56\x63\x6f\165\156\x74\x20\76\40\x30"; } $number = $args["\156\165\x6d\142\x65\162"]; $offset = $args["\x6f\146\146\x73\145\x74"]; if ($number && !$hierarchical && !$child_of && '' === $parent) { if ($offset) { $limits = "\x4c\x49\x4d\x49\x54\40" . $offset . "\x2c" . $number; } else { $limits = "\114\x49\115\111\x54\40" . $number; } } else { $limits = ''; } if (!empty($args["\163\145\x61\162\143\150"])) { $this->sql_clauses["\x77\150\x65\162\145"]["\163\145\x61\162\x63\150"] = $this->get_search_sql($args["\x73\145\141\x72\143\x68"]); } $join = ''; $distinct = ''; $this->meta_query->parse_query_vars($this->query_vars); $mq_sql = $this->meta_query->get_sql("\x74\x65\x72\x6d", "\x74", "\164\145\162\155\x5f\151\x64"); $meta_clauses = $this->meta_query->get_clauses(); if (!empty($meta_clauses)) { $join .= $mq_sql["\152\157\151\156"]; $this->sql_clauses["\x77\x68\x65\162\x65"]["\x6d\145\164\x61\x5f\161\165\x65\162\171"] = preg_replace("\57\x5e\x5c\x73\52\101\116\104\x5c\x73\52\57", '', $mq_sql["\x77\x68\145\x72\x65"]); $distinct .= "\104\x49\123\x54\x49\116\103\124"; } $selects = array(); switch ($args["\146\x69\x65\x6c\x64\163"]) { case "\x63\157\x75\156\164": $orderby = ''; $order = ''; $selects = array("\103\x4f\x55\x4e\x54\50\x2a\51"); break; default: $selects = array("\x74\56\164\145\x72\x6d\x5f\151\144"); if ("\x61\154\x6c\137\167\151\164\150\x5f\x6f\142\x6a\145\143\x74\x5f\151\144" === $args["\x66\151\x65\x6c\144\x73"] && !empty($args["\x6f\142\x6a\145\143\164\x5f\151\x64\x73"])) { $selects[] = "\164\162\56\157\x62\x6a\145\143\x74\x5f\151\x64"; } break; } $_fields = $args["\146\x69\x65\x6c\x64\163"]; $fields = implode("\54\x20", apply_filters("\x67\x65\x74\137\164\145\162\155\x73\x5f\146\151\145\154\144\163", $selects, $args, $taxonomies)); $join .= "\x20\x49\x4e\116\105\x52\40\x4a\x4f\111\116\40{$wpdb->term_taxonomy}\40\101\x53\40\x74\x74\40\117\116\40\x74\56\x74\145\162\x6d\137\151\144\x20\75\40\x74\164\x2e\x74\x65\162\155\137\x69\x64"; if (!empty($this->query_vars["\157\142\152\145\143\x74\137\151\144\x73"])) { $join .= "\40\x49\x4e\x4e\x45\x52\40\x4a\x4f\111\116\40{$wpdb->term_relationships}\x20\x41\x53\x20\164\162\40\117\116\x20\164\x72\x2e\164\145\x72\x6d\x5f\x74\141\x78\x6f\x6e\157\155\171\137\151\x64\x20\75\40\x74\164\56\x74\145\x72\155\137\164\141\170\x6f\156\x6f\x6d\x79\137\x69\x64"; $distinct = "\104\111\123\x54\x49\116\103\x54"; } $where = implode("\40\101\116\104\40", $this->sql_clauses["\x77\x68\x65\x72\x65"]); $pieces = array("\x66\x69\145\154\144\163", "\152\x6f\x69\x6e", "\x77\150\x65\162\x65", "\x64\151\x73\x74\x69\156\143\x74", "\157\162\144\145\162\142\171", "\x6f\x72\144\x65\162", "\154\151\x6d\x69\x74\x73"); $clauses = apply_filters("\x74\x65\x72\x6d\x73\137\143\154\x61\165\163\145\x73", compact($pieces), $taxonomies, $args); $fields = isset($clauses["\x66\151\x65\x6c\x64\x73"]) ? $clauses["\146\x69\x65\154\144\163"] : ''; $join = isset($clauses["\152\x6f\151\156"]) ? $clauses["\152\x6f\151\156"] : ''; $where = isset($clauses["\x77\x68\x65\x72\145"]) ? $clauses["\167\x68\145\162\x65"] : ''; $distinct = isset($clauses["\x64\151\163\164\151\x6e\x63\164"]) ? $clauses["\144\151\163\x74\151\156\143\164"] : ''; $orderby = isset($clauses["\157\x72\144\x65\162\142\x79"]) ? $clauses["\157\x72\144\x65\162\x62\x79"] : ''; $order = isset($clauses["\157\x72\144\145\x72"]) ? $clauses["\x6f\162\144\x65\x72"] : ''; $limits = isset($clauses["\x6c\x69\x6d\x69\x74\x73"]) ? $clauses["\x6c\x69\x6d\x69\164\163"] : ''; $fields_is_filtered = implode("\x2c\40", $selects) !== $fields; if ($where) { $where = "\127\110\x45\122\105\40{$where}"; } $this->sql_clauses["\163\x65\154\x65\x63\x74"] = "\123\105\114\105\x43\x54\x20{$distinct}\40{$fields}"; $this->sql_clauses["\x66\x72\x6f\155"] = "\106\x52\117\115\x20{$wpdb->terms}\x20\101\x53\40\164\40{$join}"; $this->sql_clauses["\x6f\x72\x64\145\162\x62\171"] = $orderby ? "{$orderby}\x20{$order}" : ''; $this->sql_clauses["\x6c\x69\x6d\x69\x74\x73"] = $limits; $this->request = "{$this->sql_clauses["\x73\145\x6c\x65\143\164"]}\12\11\x9\x9\x20{$this->sql_clauses["\x66\x72\157\x6d"]}\12\x9\x9\11\x20{$where}\12\11\x9\11\40{$this->sql_clauses["\x6f\162\x64\145\162\142\171"]}\12\x9\11\x9\x20{$this->sql_clauses["\x6c\x69\155\x69\164\163"]}"; $this->terms = null; $this->terms = apply_filters_ref_array("\164\145\162\x6d\163\x5f\x70\162\x65\x5f\161\165\x65\162\171", array($this->terms, &$this)); if (null !== $this->terms) { return $this->terms; } if ($args["\143\141\x63\150\x65\137\162\x65\163\x75\x6c\164\x73"]) { $cache_key = $this->generate_cache_key($args, $this->request); $cache = wp_cache_get($cache_key, "\164\145\x72\x6d\55\161\x75\x65\162\151\x65\163"); if (false !== $cache) { if ("\151\x64\163" === $_fields) { $cache = array_map("\151\156\164\x76\141\x6c", $cache); } elseif ("\x63\x6f\165\x6e\164" !== $_fields) { if ("\141\x6c\x6c\137\167\x69\x74\150\x5f\157\142\x6a\x65\143\x74\x5f\x69\144" === $_fields && !empty($args["\x6f\142\152\x65\143\x74\x5f\151\x64\x73"]) || ("\x61\154\154" === $_fields && $args["\160\141\x64\137\143\x6f\165\x6e\164\163"] || $fields_is_filtered)) { $term_ids = wp_list_pluck($cache, "\x74\x65\x72\x6d\137\151\x64"); } else { $term_ids = array_map("\x69\x6e\x74\x76\x61\x6c", $cache); } _prime_term_caches($term_ids, $args["\165\x70\x64\141\x74\x65\137\x74\145\162\x6d\x5f\155\145\x74\x61\137\x63\141\143\x68\x65"]); $term_objects = $this->populate_terms($cache); $cache = $this->format_terms($term_objects, $_fields); } $this->terms = $cache; return $this->terms; } } if ("\x63\x6f\165\156\x74" === $_fields) { $count = $wpdb->get_var($this->request); if ($args["\x63\141\x63\150\x65\x5f\x72\145\163\x75\x6c\x74\163"]) { wp_cache_set($cache_key, $count, "\x74\145\x72\x6d\55\x71\x75\x65\x72\151\x65\163"); } return $count; } $terms = $wpdb->get_results($this->request); if (empty($terms)) { if ($args["\x63\x61\143\150\x65\x5f\162\145\x73\165\154\164\x73"]) { wp_cache_add($cache_key, array(), "\x74\x65\x72\x6d\x2d\161\165\145\x72\151\145\x73"); } return array(); } $term_ids = wp_list_pluck($terms, "\164\x65\162\x6d\x5f\x69\x64"); _prime_term_caches($term_ids, false); $term_objects = $this->populate_terms($terms); if ($child_of) { foreach ($taxonomies as $_tax) { $children = _get_term_hierarchy($_tax); if (!empty($children)) { $term_objects = _get_term_children($child_of, $term_objects, $_tax); } } } if ($args["\x70\141\x64\137\x63\x6f\165\156\164\163"] && "\x61\x6c\x6c" === $_fields) { foreach ($taxonomies as $_tax) { _pad_term_counts($term_objects, $_tax); } } if ($hierarchical && $args["\150\151\x64\x65\137\x65\155\160\164\x79"] && is_array($term_objects)) { foreach ($term_objects as $k => $term) { if (!$term->count) { $children = get_term_children($term->term_id, $term->taxonomy); if (is_array($children)) { foreach ($children as $child_id) { $child = get_term($child_id, $term->taxonomy); if ($child->count) { continue 2; } } } unset($term_objects[$k]); } } } if ($hierarchical && $number && is_array($term_objects)) { if ($offset >= count($term_objects)) { $term_objects = array(); } else { $term_objects = array_slice($term_objects, $offset, $number, true); } } if ($args["\165\x70\144\141\164\145\137\x74\x65\x72\x6d\137\155\145\x74\141\137\143\141\143\x68\145"]) { $term_ids = wp_list_pluck($term_objects, "\164\x65\x72\x6d\137\151\144"); wp_lazyload_term_meta($term_ids); } if ("\141\x6c\x6c\137\x77\x69\x74\x68\137\x6f\142\152\x65\143\x74\x5f\151\144" === $_fields && !empty($args["\x6f\x62\152\145\143\x74\137\151\144\163"])) { $term_cache = array(); foreach ($term_objects as $term) { $object = new stdClass(); $object->term_id = $term->term_id; $object->object_id = $term->object_id; $term_cache[] = $object; } } elseif ("\x61\x6c\x6c" === $_fields && $args["\160\141\x64\x5f\x63\x6f\x75\x6e\164\163"]) { $term_cache = array(); foreach ($term_objects as $term) { $object = new stdClass(); $object->term_id = $term->term_id; $object->count = $term->count; $term_cache[] = $object; } } elseif ($fields_is_filtered) { $term_cache = $term_objects; } else { $term_cache = wp_list_pluck($term_objects, "\x74\145\x72\x6d\137\151\144"); } if ($args["\x63\x61\143\x68\x65\x5f\162\145\163\165\154\164\x73"]) { wp_cache_add($cache_key, $term_cache, "\164\x65\x72\x6d\55\x71\165\145\x72\x69\x65\x73"); } $this->terms = $this->format_terms($term_objects, $_fields); return $this->terms; } protected function parse_orderby($orderby_raw) { $_orderby = strtolower($orderby_raw); $maybe_orderby_meta = false; if (in_array($_orderby, array("\164\145\x72\x6d\137\x69\x64", "\x6e\x61\x6d\x65", "\x73\x6c\165\147", "\x74\x65\x72\155\137\147\162\x6f\165\160"), true)) { $orderby = "\x74\56{$_orderby}"; } elseif (in_array($_orderby, array("\x63\157\x75\156\164", "\160\x61\x72\145\156\164", "\164\141\170\157\156\157\x6d\171", "\x74\145\162\155\137\164\141\x78\157\156\x6f\x6d\171\x5f\151\144", "\x64\x65\x73\x63\162\151\x70\x74\151\157\156"), true)) { $orderby = "\164\164\x2e{$_orderby}"; } elseif ("\164\x65\x72\x6d\x5f\157\x72\x64\x65\162" === $_orderby) { $orderby = "\164\x72\x2e\164\145\162\x6d\137\157\x72\144\x65\162"; } elseif ("\x69\156\143\154\165\144\145" === $_orderby && !empty($this->query_vars["\x69\x6e\x63\154\x75\144\145"])) { $include = implode("\x2c", wp_parse_id_list($this->query_vars["\151\x6e\x63\154\165\x64\145"])); $orderby = "\106\x49\x45\114\x44\50\x20\x74\x2e\x74\145\x72\155\x5f\151\x64\54\40{$include}\x20\51"; } elseif ("\163\x6c\165\x67\137\x5f\151\x6e" === $_orderby && !empty($this->query_vars["\163\x6c\165\x67"]) && is_array($this->query_vars["\163\154\165\147"])) { $slugs = implode("\x27\x2c\x20\47", array_map("\x73\141\156\x69\164\x69\172\145\137\164\x69\164\x6c\145\x5f\x66\157\x72\137\x71\x75\145\x72\x79", $this->query_vars["\x73\154\165\147"])); $orderby = "\106\x49\105\114\x44\50\40\164\x2e\163\x6c\165\147\x2c\40\47" . $slugs . "\47\x29"; } elseif ("\x6e\157\x6e\x65" === $_orderby) { $orderby = ''; } elseif (empty($_orderby) || "\x69\x64" === $_orderby || "\164\145\x72\x6d\137\151\x64" === $_orderby) { $orderby = "\164\x2e\164\x65\x72\x6d\137\151\144"; } else { $orderby = "\164\x2e\156\141\x6d\x65"; $maybe_orderby_meta = true; } $orderby = apply_filters("\x67\x65\x74\x5f\x74\x65\x72\x6d\163\x5f\x6f\162\144\x65\x72\142\171", $orderby, $this->query_vars, $this->query_vars["\164\141\x78\x6f\156\x6f\155\x79"]); if ($maybe_orderby_meta) { $maybe_orderby_meta = $this->parse_orderby_meta($_orderby); if ($maybe_orderby_meta) { $orderby = $maybe_orderby_meta; } } return $orderby; } protected function format_terms($term_objects, $_fields) { $_terms = array(); if ("\x69\144\75\x3e\x70\141\162\x65\x6e\164" === $_fields) { foreach ($term_objects as $term) { $_terms[$term->term_id] = $term->parent; } } elseif ("\151\x64\163" === $_fields) { foreach ($term_objects as $term) { $_terms[] = (int) $term->term_id; } } elseif ("\x74\x74\137\151\144\x73" === $_fields) { foreach ($term_objects as $term) { $_terms[] = (int) $term->term_taxonomy_id; } } elseif ("\x6e\x61\155\145\163" === $_fields) { foreach ($term_objects as $term) { $_terms[] = $term->name; } } elseif ("\163\154\x75\x67\x73" === $_fields) { foreach ($term_objects as $term) { $_terms[] = $term->slug; } } elseif ("\151\144\x3d\x3e\156\141\155\145" === $_fields) { foreach ($term_objects as $term) { $_terms[$term->term_id] = $term->name; } } elseif ("\x69\x64\x3d\x3e\x73\154\165\x67" === $_fields) { foreach ($term_objects as $term) { $_terms[$term->term_id] = $term->slug; } } elseif ("\x61\154\x6c" === $_fields || "\141\x6c\154\137\x77\151\x74\x68\x5f\157\142\x6a\x65\143\164\137\x69\144" === $_fields) { $_terms = $term_objects; } return $_terms; } protected function parse_orderby_meta($orderby_raw) { $orderby = ''; $this->meta_query->get_sql("\x74\145\x72\x6d", "\x74", "\x74\x65\162\x6d\137\151\x64"); $meta_clauses = $this->meta_query->get_clauses(); if (!$meta_clauses || !$orderby_raw) { return $orderby; } $allowed_keys = array(); $primary_meta_key = null; $primary_meta_query = reset($meta_clauses); if (!empty($primary_meta_query["\153\x65\x79"])) { $primary_meta_key = $primary_meta_query["\x6b\x65\x79"]; $allowed_keys[] = $primary_meta_key; } $allowed_keys[] = "\155\x65\164\x61\137\166\x61\154\x75\145"; $allowed_keys[] = "\155\145\164\141\137\x76\x61\x6c\x75\145\137\x6e\x75\155"; $allowed_keys = array_merge($allowed_keys, array_keys($meta_clauses)); if (!in_array($orderby_raw, $allowed_keys, true)) { return $orderby; } switch ($orderby_raw) { case $primary_meta_key: case "\x6d\x65\164\x61\x5f\x76\141\x6c\x75\x65": if (!empty($primary_meta_query["\164\171\160\x65"])) { $orderby = "\x43\x41\x53\x54\50{$primary_meta_query["\x61\x6c\x69\x61\163"]}\56\x6d\x65\164\x61\x5f\166\141\x6c\165\145\40\x41\123\x20{$primary_meta_query["\143\141\x73\164"]}\x29"; } else { $orderby = "{$primary_meta_query["\x61\x6c\151\x61\x73"]}\x2e\x6d\145\x74\x61\137\x76\141\154\165\145"; } break; case "\155\x65\164\x61\x5f\166\141\154\165\145\x5f\x6e\165\x6d": $orderby = "{$primary_meta_query["\x61\x6c\x69\x61\163"]}\56\x6d\x65\164\x61\137\166\141\x6c\165\145\x2b\60"; break; default: if (array_key_exists($orderby_raw, $meta_clauses)) { $meta_clause = $meta_clauses[$orderby_raw]; $orderby = "\103\x41\x53\124\x28{$meta_clause["\x61\154\151\141\x73"]}\x2e\155\x65\x74\141\x5f\x76\x61\154\x75\145\40\x41\123\40{$meta_clause["\143\x61\x73\164"]}\51"; } break; } return $orderby; } protected function parse_order($order) { if (!is_string($order) || empty($order)) { return "\104\105\123\x43"; } if ("\x41\x53\x43" === strtoupper($order)) { return "\101\123\x43"; } else { return "\x44\105\123\103"; } } protected function get_search_sql($search) { global $wpdb; $like = "\45" . $wpdb->esc_like($search) . "\45"; return $wpdb->prepare("\50\50\x74\x2e\156\141\155\145\40\x4c\111\x4b\x45\40\45\x73\51\x20\117\x52\40\50\x74\56\x73\x6c\x75\147\x20\x4c\x49\113\105\40\x25\x73\x29\x29", $like, $like); } protected function populate_terms($terms) { $term_objects = array(); if (!is_array($terms)) { return $term_objects; } foreach ($terms as $key => $term_data) { if (is_object($term_data) && property_exists($term_data, "\164\x65\x72\x6d\x5f\151\x64")) { $term = get_term($term_data->term_id); if (property_exists($term_data, "\157\x62\x6a\x65\143\164\x5f\x69\144")) { $term->object_id = (int) $term_data->object_id; } if (property_exists($term_data, "\x63\157\165\156\x74")) { $term->count = (int) $term_data->count; } } else { $term = get_term($term_data); } if ($term instanceof WP_Term) { $term_objects[$key] = $term; } } return $term_objects; } protected function generate_cache_key(array $args, $sql) { global $wpdb; $cache_args = wp_array_slice_assoc($args, array_keys($this->query_var_defaults)); unset($cache_args["\x63\x61\143\150\x65\x5f\x72\145\163\165\x6c\164\163"], $cache_args["\x75\160\144\x61\x74\145\137\x74\x65\162\155\x5f\x6d\x65\164\141\x5f\143\x61\x63\150\x65"]); if ("\143\x6f\x75\x6e\164" !== $args["\x66\151\x65\154\x64\163"] && "\x61\x6c\x6c\x5f\x77\x69\x74\150\137\x6f\142\152\x65\x63\x74\137\151\144" !== $args["\x66\x69\x65\x6c\x64\163"]) { $cache_args["\146\x69\x65\154\x64\x73"] = "\141\x6c\154"; } $taxonomies = (array) $args["\164\141\x78\157\x6e\157\x6d\x79"]; $sql = $wpdb->remove_placeholder_escape($sql); $key = md5(serialize($cache_args) . serialize($taxonomies) . $sql); $last_changed = wp_cache_get_last_changed("\164\x65\x72\155\x73"); return "\147\145\x74\x5f\164\145\x72\x6d\x73\x3a{$key}\72{$last_changed}"; } }

Function Calls

None

Variables

None

Stats

MD5 82741281ced4f95d070e550b3196f4d6
Eval Count 0
Decode Time 163 ms