コード例 #1
0
 /**
  * Setup the class
  */
 public function __construct()
 {
     parent::__construct();
     $this->db = $this->setDb('mysql');
     $this->fparams = $this->_getFrontendParams();
     $this->options = $this->_getOptions();
 }
コード例 #2
0
 /**
  * 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();
     }
 }
コード例 #3
0
<?php

if (isset($_GET['mode']) && $_GET['mode'] == 'nojs') {
    $path = './../';
    while (!realpath($path . 'app')) {
        $path .= '../';
    }
    $path = realpath($path);
    require_once $path . '/app/iniApp.php';
    //$parser = new Rajax_Fallback_Parser('js/main.js');
    Rajax_Application::$fallback = true;
    $fallback = new Rajax_Fallback_Fallback($path, $events, $rootFolder);
} else {
    $split = explode('/', $_SERVER['PHP_SELF']);
    unset($split[count($split) - 1]);
    $redirect = $_SERVER['SERVER_NAME'] . implode('/', $split) . '/nojs';
    print '<noscript>
				<meta http-equiv="refresh" content="0; url=http://' . $redirect . '"> 
			  </noscript>';
}
コード例 #4
0
<?php

$path = './../';
while (!realpath($path . 'app')) {
    $path .= '../';
}
$path = realpath($path);
require_once $path . '/app/iniApp.php';
/* Setup and Start Rajax */
$rajax = new Rajax_Application();
$rajax->start();
コード例 #5
0
 /**
  * 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();
     }
 }
コード例 #6
0
 public function error()
 {
     Rajax_Application::error404();
 }
コード例 #7
0
 /**
  * Output a rajax request
  * @return string
  */
 private function _outputData()
 {
     $path = $this->_path;
     ob_start();
     $rajax = new Rajax_Application();
     $rajax->start();
     $output = ob_get_contents();
     ob_end_clean();
     return $output;
 }