public function info($name) { App::import('Core', 'GummHash'); $args = func_get_args(); if (count($args) == 2) { $this->info = GummHash::insert($this->info, $name, $args[1]); return $this; } return GummHash::get($this->info, $name); }
public function getImportedSampleContentData($type = null, $reset = false, $fromPending = false) { if (!Set::filter($this->importedSampleContentData) || $reset) { if (!($result = get_option(GUMM_THEME_PREFIX . '__sample_content_data'))) { $result = array(); } $this->importedSampleContentData = $result; } $contentData = $this->importedSampleContentData; if ($fromPending === true) { $contentData = Set::merge($contentData, $this->currentSampleDataToImport); } if ($type) { $data = GummHash::get($contentData, $type); } else { $data = $contentData; } if (!$data) { $data = array(); } return $data; }
protected function queryPosts($instanceData = array()) { if (!$this->supports('postType')) { return; } $this->resetQueryAfterRender = true; if ($this->posts) { return $this->posts; } $postType = GummHash::get($instanceData, 'post_type.post_type'); if (!$postType) { $postType = $this->queryPostType; } $postsNumber = (int) GummHash::get($instanceData, 'post_type.posts_number'); if (!$postsNumber) { $postsNumber = 4; } $args = array('post_type' => $postType, 'posts_per_page' => $postsNumber); $termIds = Set::filter(Set::booleanize(GummHash::get($instanceData, 'post_type.' . $postType . '-category'))); if ($termIds) { $termIds = array_keys($termIds); } if ($termIds) { $termName = $postType == 'post' ? 'category' : $postType . '_category'; $args['tax_query'] = array(array('taxonomy' => $termName, 'field' => 'term_id', 'terms' => (array) $termIds)); } $this->posts = query_posts($args); return $this->posts; }