Esempio n. 1
0
 /**
  * Get the adapter
  *
  * @return  object
  */
 public function adapter()
 {
     if (!$this->_adapter) {
         $this->_adapter = $this->_adapter();
         $this->_adapter->set('thread', $this->get('thread'));
         $this->_adapter->set('parent', $this->get('parent'));
         $this->_adapter->set('post', $this->get('id'));
         if (!$this->get('category')) {
             $category = Category::getInstance($this->get('category_id'));
             $this->set('category', $category->get('alias'));
         }
         $this->_adapter->set('category', $this->get('category'));
         if (!$this->get('section')) {
             $category = Category::getInstance($this->get('category_id'));
             $this->set('section', Section::getInstance($category->get('section_id'))->get('alias'));
         }
         $this->_adapter->set('section', $this->get('section'));
     }
     return $this->_adapter;
 }
Esempio n. 2
0
 /**
  * Get the adapter
  *
  * @return  object
  */
 public function adapter()
 {
     if (!$this->_adapter) {
         $this->_adapter = $this->_adapter();
         if (!$this->get('section_alias')) {
             $this->set('section_alias', Section::getInstance($this->get('section_id'))->get('alias'));
         }
         $this->_adapter->set('section', $this->get('section_alias'));
         $this->_adapter->set('category', $this->get('alias'));
     }
     return $this->_adapter;
 }
Esempio n. 3
0
 /**
  * Set and get a specific section
  *
  * @param   mixed   $id
  * @return  object
  */
 public function section($id = null)
 {
     if (!isset($this->_cache['section']) || $id !== null && (int) $this->_cache['section']->get('id') != $id && (string) $this->_cache['section']->get('alias') != $id) {
         $this->_cache['section'] = null;
         if ($this->_cache['sections'] instanceof ItemList) {
             foreach ($this->_cache['sections'] as $key => $section) {
                 if ((int) $section->get('id') == $id || (string) $section->get('alias') == $id) {
                     $this->_cache['section'] = $section;
                     break;
                 }
             }
         }
         if (!$this->_cache['section']) {
             $this->_cache['section'] = Section::getInstance($id, $this->get('scope'), $this->get('scope_id'));
         }
         if (!$this->_cache['section']->exists()) {
             $this->_cache['section']->set('scope', $this->get('scope'));
             $this->_cache['section']->set('scope_id', $this->get('scope_id'));
         }
     }
     return $this->_cache['section'];
 }