コード例 #1
0
 /**
  * Retrieve content depending of xml type wanted
  *
  * @access	private
  */
 private function get_content()
 {
     if ($this->_type == 'rss') {
         $to_read['table'] = 'post';
         $to_read['columns'] = array('POST_ID AS guid', 'post_title AS title', 'post_content AS description', 'post_date AS pubDate', 'post_author AS author', 'post_permalink AS link');
         $to_read['condition_columns'][':s'] = 'post_status';
         $to_read['condition_select_types'][':s'] = '=';
         $to_read['condition_values'][':s'] = 'publish';
         $to_read['value_types'][':s'] = 'str';
         if (VGet::cat()) {
             $to_read['condition_types'][':cat'] = 'AND';
             $to_read['condition_columns'][':cat'] = 'post_category';
             $to_read['condition_select_types'][':cat'] = 'LIKE';
             $to_read['condition_values'][':cat'] = '%' . VGet::cat() . '%';
             $to_read['value_types'][':cat'] = 'str';
         }
         $this->_content = $this->_db->read($to_read);
         if (!empty($this->_content)) {
             foreach ($this->_content as &$value) {
                 $user = new User($value['author']);
                 $value['author'] = $user->_publicname;
                 $value['title'] = htmlspecialchars($value['title']);
                 $value['description'] = htmlspecialchars(substr($value['description'], 0, 200));
             }
         }
     } elseif ($this->_type == 'sitemap') {
         $to_read['table'] = 'post';
         $to_read['columns'] = array('post_permalink AS SPLink', 'post_date AS SPPubDate');
         $to_read['condition_columns'][':s'] = 'post_status';
         $to_read['condition_select_types'][':s'] = '=';
         $to_read['condition_values'][':s'] = 'publish';
         $to_read['value_types'][':s'] = 'str';
         $this->_content = $this->_db->read($to_read);
         $to_read = null;
         $to_read['table'] = 'media';
         $to_read['columns'] = array('MEDIA_ID AS SMLink', 'media_date AS SMPubDate');
         $to_read['condition_columns'][':t'] = 'media_type';
         $to_read['condition_select_types'][':t'] = '=';
         $to_read['condition_values'][':t'] = 'album';
         $to_read['value_types'][':t'] = 'str';
         $to_read['condition_types'][':s'] = 'AND';
         $to_read['condition_columns'][':s'] = 'media_status';
         $to_read['condition_select_types'][':s'] = '=';
         $to_read['condition_values'][':s'] = 'publish';
         $to_read['value_types'][':s'] = 'str';
         $media = $this->_db->read($to_read);
         if (!empty($media)) {
             foreach ($media as $value) {
                 array_push($this->_content, $value);
             }
         }
     }
 }
コード例 #2
0
 /**
  * Load category in attribute if set
  *
  * @access	private
  */
 private function load_cat()
 {
     try {
         if (VGet::cat()) {
             $cat = new Category(VGet::cat());
             $this->_category = $cat->_name;
         }
     } catch (Exception $e) {
         header('Location: 404.php');
     }
 }
コード例 #3
0
 /**
  * Method to build the complement link for navigation
  *
  * @access	protected
  * @return	string
  */
 protected function link_navigation()
 {
     switch ($this->_pid) {
         case 'posts':
             $link = 'ctl=posts&';
             break;
         case 'search':
             if (VGet::tag()) {
                 $link = 'ctl=search&tag=' . VGet::tag() . '&';
             } elseif (VGet::cat()) {
                 $link = 'ctl=search&cat=' . VGet::cat() . '&';
             } else {
                 $link = 'ctl=search&q=' . VGet::q() . '&';
             }
             break;
         default:
             $link = 'ctl=' . $this->_pid . '&';
             break;
     }
     return $link;
 }
コード例 #4
0
 /**
  * Extract wanted words and set them in associated attributes
  *
  * @access	private
  */
 private function build_search()
 {
     if (substr(VGet::q(), 0, 4) == 'date') {
         $this->_by_date = trim(substr(VGet::q(), 5));
     } elseif (VGet::q()) {
         $this->_words_to_find = array_unique(explode(' ', trim(VGet::q())));
         $this->_search = implode(' ', $this->_words_to_find);
     } elseif (VGet::tag()) {
         $this->_tag = VGet::tag();
     } elseif (VGet::cat()) {
         $this->_cat = VGet::cat();
     } else {
         header('Location: 404.php');
     }
 }
コード例 #5
0
 /**
  * Display page content
  *
  * @access	public
  */
 public function display_content()
 {
     if (VGet::cat()) {
         $add = $this->_menu[VGet::cat()];
     } else {
         $add = null;
     }
     Html::header_videos($add);
     if (!empty($this->_content)) {
         Html::html5('o', 'id="videos">');
         if (!VSession::html5()) {
             echo '<ul>';
         }
         foreach ($this->_content as $video) {
             Html::video($video->_name, $video->_author_publicname, $video->_permalink, $video->_embed_code, nl2br($video->_description), $video->_date);
         }
         if (!VSession::html5()) {
             echo '</ul>';
         }
         Html::html5('c');
     } else {
         if (!VSession::html5()) {
             echo '<ul>';
         }
         Html::no_content('There\'s no videos right now.');
         if (!VSession::html5()) {
             echo '</ul>';
         }
     }
 }