/** * Get themes * @param array $args (optional) Arguments * @return array Themes */ public function get($args = null) { //Normalize arguments $args_default = array('include_public' => true, 'include_private' => false); $r = wp_parse_args($args, $args_default); $r['include_public'] = !!$r['include_public']; $r['include_private'] = !!$r['include_private']; $items = parent::get($args); if (empty($items)) { return $items; } /* Process custom arguments */ //Filter $items_exclude = array(); //Identify excluded themes $filter_props = array('include_public' => true, 'include_private' => false); foreach ($filter_props as $filter_prop => $filter_value) { if (!$r[$filter_prop]) { foreach ($items as $id => $item) { if ($item->get_public() == $filter_value) { $items_exclude[] = $id; } } } } //Filter themes from collection $items = array_diff_key($items, array_fill_keys($items_exclude, null)); return $items; }
/** * Retrieves handlers sorted by priority * @see parent::get() * @uses get_cache() * @param mixed $args Unused * @return array Handlers */ public function get($args = null) { $items = $this->get_cache(); if (empty($items)) { // Retrieve items $items = parent::get(array('orderby' => array('meta' => 'priority'))); $this->update_cache($items); } return $items; }