/** * Starting rajax * * @return void */ public function start() { if (class_exists('Rajax_Generate')) { // calling rajax generator and updating main.js if neccessary } if (!Rajax_Route::Route()) { print Rajax_Application::error404(); } }
/** * Get all posts in a specific category * * @return void */ public function getPostsByCategory() { $catName = $this->fparams[0]; $multiplier = isset($this->fparams[1]) && $this->fparams[1] != 0 ? $this->fparams[1] : 1; $query = "SELECT object_id FROM " . $this->_tableSuffix . "term_relationships WHERE term_taxonomy_id=\n\t\t\t\t (SELECT term_id FROM " . $this->_tableSuffix . "terms WHERE slug like '" . $catName . "')"; $result = $this->db->fetchAll($query); $siteNumbers = ''; if (count($result) != 0) { $getPostQuery = $this->_getPagesSQL($result, $multiplier); $posts = $this->db->fetchAll(str_replace(',)', ')', $getPostQuery)); $countedRows = explode('LIMIT', str_replace('*', 'count(*)', str_replace(',)', ')', $getPostQuery))); $countedRows = $this->db->fetchAll($countedRows[0]); if (preg_match('#xml|json#', Rajax_Application::$request->output)) { $posts[count($posts)]['rwp_sites'] = ceil($countedRows[0]['count(*)'] / $this->_maxPostsEachCategory); if (!$this->output($posts)) { $this->_showCustomError($this->_noCat); } return; } if (!$this->output($posts)) { $this->_showCustomError($this->_noCat); return; } for ($i = 1; $i <= ceil($countedRows[0]['count(*)'] / $this->_maxPostsEachCategory); ++$i) { $siteNumbers .= '<li><a href="#!/' . $catName . '/' . $i . '">' . $i . '</a></li>'; } print '<ul class="rwp_sites">' . $siteNumbers . '</ul>'; } else { print Rajax_Application::error404(); } }
public function error() { Rajax_Application::error404(); }