Example #1
0
 /**
  *
  * @write to the logfile
  *
  * @access public
  *
  * @param	string	$function The name of the function called
  * @param 	array	$args	The array of args passed
  * @return	int	The number of bytes written, false other wise
  *
  */
 public static function __callStatic($function, $args)
 {
     // args[0] constains the error message
     // args[1] contains the log level
     // args[2] constains the filename
     // args[3] constains the line number
     $config = Pixelpost_Config::getInstance();
     if ($args[1] <= $config->logging['log_level']) {
         $line = array('log_function' => $function, 'log_message' => $args[0], 'log_level' => $args[1], 'log_file' => $args[2], 'log_line' => $args[3]);
         switch ($config->logging['log_handler']) {
             case 'file':
                 // set the log date/time
                 $line['log_time'] = date(DATE_ISO8601);
                 // encode the line
                 $json = json_encode($line) . "\n";
                 if ($handle = fopen($config->logging['log_file'], "a+")) {
                     if (!fwrite($handle, $json)) {
                         throw new Exception("Unable to write to log file");
                     }
                     fclose($handle);
                 }
                 break;
             case 'database':
                 $dba = new dbabstraction();
                 $dba->insert('Pixelpost_Log', $line);
                 break;
             default:
                 throw new Exception("Invalid Log Option");
         }
     }
 }
Example #2
0
 public function __construct()
 {
     $this->view = new Model_View();
     $this->front = Model_Front::getInstance();
     $this->config = $this->view->config = Pixelpost_Config::getInstance();
     // for use in the controllers
     $this->view->plugins = Pixelpost_Plugin::getInstance();
     /**
      * Default Layout
      * If empty, no layout will be used.
      */
     $this->layout = 'layout.phtml';
     // $this->view->setTemplateDir(THMPATH . '/' . $this->config->theme);
     $this->view->setCacheDir(CSHPATH);
     // $this->view->setCaching(true);
     // if ( (int)$this->front->getAction() === 0 && $this->front->getAction() != 'index' && !method_exists($this,$this->front->getAction())) {
     Pixelpost_Plugin::executeAction('hook_base_construct', $this, $this->front->getController(), $this->front->getAction());
     // }
 }
Example #3
0
 /**
  *
  * Loads the controller, sets to default if not available
  *
  * @access	public
  * @return	string	The name of the controller
  *
  */
 public function loadController()
 {
     if (class_exists("Module_{$this->_controller}_indexController")) {
         return "Module_{$this->_controller}_indexController";
     } else {
         return 'Module_' . Pixelpost_Config::getInstance()->error_controller . '_indexController';
     }
 }
Example #4
0
$autoloader->setFallbackAutoloader(true);
// Load any namespace
/**
 * Initialize Language and Model Autoloader
 */
$resourceLoader = new Zend_Loader_Autoloader_Module(array('basePath' => APPPATH, 'namespace' => ''));
$resourceLoader->addResourceType('models', 'models', 'Model');
$resourceLoader->addResourceType('modules', 'modules', 'Module');
/**
 * Initialize Uri Class
 */
Pixelpost_Uri::getInstance();
/**
 * Initialize Config Class
 */
$config = Pixelpost_Config::getInstance();
/**
 * Initialize DB Class
 */
switch ($config->database['adapter']) {
    case 'sqlite':
        Pixelpost_DB::init('pdo');
        Pixelpost_DB::connect('sqlite:' . $config->database['sqlite']);
        break;
    case 'mysql':
    default:
        Pixelpost_DB::init('mysql');
        Pixelpost_DB::connect($config->database['username'], $config->database['password'], $config->database['database'], $config->database['host']);
        break;
}
Pixelpost_DB::set_table_prefix($config->database['prefix']);
Example #5
0
 private function __construct()
 {
     // do nothing here, just make sure we cannot initiate the object
     $this->plugins = Pixelpost_Config::getInstance()->enabled_plugins;
 }