コード例 #1
0
ファイル: controller.php プロジェクト: jonolsson/Saturday
 function __construct($route, $request, $response)
 {
     $cfg = api_config::getInstance();
     $this->config = $cfg;
     $this->params = $route;
     $this->request = $request;
     $this->response = $response;
     //        $writerConfig = $cfg->log;
     //        $this->logger = Zend_Log::factory(array($writerConfig));
     $this->logger = api_log::getInstance();
     $this->dispatcher = new sfEventDispatcher();
     $this->init();
 }
コード例 #2
0
ファイル: log.php プロジェクト: jonolsson/Saturday
 public static function log($prio)
 {
     if (self::$instance === false) {
         return false;
     }
     if (self::$instance === null) {
         $config = api_config::getInstance()->log;
         if (empty($config) || (self::$instance = api_log::getInstance())) {
             self::$instance = false;
             return false;
         }
     }
     $params = func_get_args();
     array_shift($params);
     return self::$instance->logMessage($params, $prio);
 }
コード例 #3
0
ファイル: mapper.php プロジェクト: jonolsson/Saturday
 function __construct($table)
 {
     if (!isset(self::$DB)) {
         //self::$DB = new PDO('mysql:dbname=mapper;host=localhost', 'mapper', 'mapper' );
         self::$DB = api_database::factory();
         self::$DB->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         self::$DB->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL);
         self::$logger = api_log::getInstance();
     }
     //echo "<br />self::DB => ";
     //$sth = self::$DB->exec("select * from user");
     //print_r(self::$DB->errorCode());
     //echo "<br />";
     $this->driver = self::$DB->getAttribute(PDO::ATTR_DRIVER_NAME);
     $this->table = $table;
     switch ($this->driver) {
         case 'mysql':
             $this->name_opening = $this->name_closing = '`';
             break;
         case 'mssql':
             $this->name_opening = '[';
             $this->name_closing = ']';
             break;
         case 'pgsql':
             $this->name_opening = "'";
             $this->name_closing = "'";
             $this->column_opening = $this->column_closing = '"';
             break;
         default:
             $this->name_opening = $this->name_closing = '"';
             break;
     }
     $this->table_meta = $this->get_table_meta();
     $this->table_meta_minus_pk = $this->table_meta;
     unset($this->table_meta_minus_pk[$this->primary_key]);
     $this->selectStmt = "SELECT * FROM " . $this->table . " WHERE {$this->primary_key}=?";
     $this->selectAllStmt = "SELECT * FROM {$this->table}";
     //     $this->updateStmt           = $this->buildUpdateStmt();
     $this->insertStmt = $this->buildInsertStmt();
     $this->deleteStmt = "DELETE FROM {$this->table} WHERE id = ?";
     // }
     foreach ($this->table_meta as $key => $value) {
         $this->{$key} = '';
     }
 }
コード例 #4
0
ファイル: hub.php プロジェクト: jonolsson/Saturday
 /**
  * Constructor.
  *
  * @param $subscriptions
  *   Subsriptions object that handles subscription storage. Must implement
  *   PuSHHubSubscriptionsInterface.
  */
 protected function __construct(api_push_hub_subscriptions_interface $subscriptions)
 {
     $this->logger = api_log::getInstance();
     //Zend_Log::factory(array($cfg->log));
     $this->subscriptions = $subscriptions;
 }