Пример #1
0
 /**
  * Constructor
  *
  * Instantiate the cache db object
  *
  * @param  string  $db
  * @param  int     $lifetime
  * @param  string  $table
  * @param  boolean $pdo
  * @throws Exception
  * @return Sqlite
  */
 public function __construct($db, $lifetime = 0, $table = 'pop_cache', $pdo = false)
 {
     parent::__construct($lifetime);
     $this->setDb($db);
     $pdoDrivers = class_exists('Pdo', false) ? \PDO::getAvailableDrivers() : [];
     if (!class_exists('Sqlite3', false) && !in_array('sqlite', $pdoDrivers)) {
         throw new Exception('Error: SQLite is not available.');
     } else {
         if ($pdo && !in_array('sqlite', $pdoDrivers)) {
             $pdo = false;
         } else {
             if (!$pdo && !class_exists('Sqlite3', false)) {
                 $pdo = true;
             }
         }
     }
     if ($pdo) {
         $this->sqlite = new \PDO('sqlite:' . $this->db);
         $this->isPdo = true;
     } else {
         $this->sqlite = new \SQLite3($this->db);
     }
     if (null !== $table) {
         $this->setTable($table);
     }
 }
Пример #2
0
 /**
  * Constructor
  *
  * Instantiate the APC cache object
  *
  * @param  int $lifetime
  * @throws Exception
  * @return Apc
  */
 public function __construct($lifetime = 0)
 {
     parent::__construct($lifetime);
     if (!function_exists('apc_cache_info')) {
         throw new Exception('Error: APC is not available.');
     }
     $this->info = apc_cache_info();
 }
Пример #3
0
 /**
  * Constructor
  *
  * Instantiate the cache session object
  *
  * @param  int $lifetime
  * @return Session
  */
 public function __construct($lifetime = 0)
 {
     parent::__construct($lifetime);
     if (session_id() == '') {
         session_start();
     }
     if (!isset($_SESSION['_POP_CACHE'])) {
         $_SESSION['_POP_CACHE'] = [];
     }
 }
Пример #4
0
 /**
  * Constructor
  *
  * Instantiate the memcache cache object
  *
  * @param  int    $lifetime
  * @param  string $host
  * @param  int    $port
  * @throws Exception
  * @return Redis
  */
 public function __construct($lifetime = 0, $host = 'localhost', $port = 6379)
 {
     parent::__construct($lifetime);
     if (!class_exists('Redis', false)) {
         throw new Exception('Error: Redis is not available.');
     }
     $this->redis = new \Redis();
     if (!$this->redis->connect($host, (int) $port)) {
         throw new Exception('Error: Unable to connect to the memcached server.');
     }
     $this->version = $this->redis->info()['redis_version'];
 }
Пример #5
0
 /**
  * Constructor
  *
  * Instantiate the memcache cache object
  *
  * @param  int    $lifetime
  * @param  string $host
  * @param  int    $port
  * @throws Exception
  * @return Memcache
  */
 public function __construct($lifetime = 0, $host = 'localhost', $port = 11211)
 {
     parent::__construct($lifetime);
     if (!class_exists('Memcache', false)) {
         throw new Exception('Error: Memcache is not available.');
     }
     $this->memcache = new \Memcache();
     if (!$this->memcache->connect($host, (int) $port)) {
         throw new Exception('Error: Unable to connect to the memcache server.');
     }
     $this->version = $this->memcache->getVersion();
 }
Пример #6
0
 /**
  * Constructor
  *
  * Instantiate the memcached cache object
  *
  * @param  int    $lifetime
  * @param  string $host
  * @param  int    $port
  * @param  int    $weight
  * @throws Exception
  * @return Memcached
  */
 public function __construct($lifetime = 0, $host = 'localhost', $port = 11211, $weight = 1)
 {
     parent::__construct($lifetime);
     if (!class_exists('Memcached', false)) {
         throw new Exception('Error: Memcached is not available.');
     }
     $this->memcached = new \Memcached();
     $this->addServer($host, $port, $weight);
     $version = $this->memcached->getVersion();
     if (isset($version[$host . ':' . $port])) {
         $this->version = $version[$host . ':' . $port];
     }
 }
Пример #7
0
 public function __construct($config)
 {
     parent::__construct($config);
     $this->socialFieldsMap = array('socialId' => 'id', 'email' => 'default_email', 'name' => 'real_name', 'socialPage' => 'link', 'avatar' => 'picture', 'sex' => 'sex', 'birthday' => 'birthday');
     $this->provider = 'yandex';
 }
Пример #8
0
 public function __construct($config)
 {
     parent::__construct($config);
     $this->socialFieldsMap = array('socialId' => 'uid', 'email' => 'email', 'name' => 'nick', 'socialPage' => 'link', 'avatar' => 'pic_big', 'birthday' => 'birthday');
     $this->provider = 'mailru';
 }
Пример #9
0
 /**
  * {@inheritdoc}
  */
 public function __construct($imageFilename)
 {
     parent::__construct($imageFilename);
     $this->imagick = new \Imagick($this->getImageFileName());
 }
Пример #10
0
 /**
  * @param array $params
  */
 public function __construct(array $params = array())
 {
     $this->ensureModuleExistence();
     parent::__construct($params);
 }
Пример #11
0
 public function __construct($uriBase = null, $params = null)
 {
     $this->setEnv($_GET);
     parent::__construct($uriBase, $params);
 }
Пример #12
0
 public function __construct($proxyConfig)
 {
     parent::__construct($proxyConfig);
 }
Пример #13
0
 /**
  * Constructor
  *
  * Instantiate the cache file object
  *
  * @param  string $dir
  * @param  int    $lifetime
  * @return File
  */
 public function __construct($dir, $lifetime = 0)
 {
     parent::__construct($lifetime);
     $this->setDir($dir);
 }
Пример #14
0
 public function __construct(\Memcached $client, $namespace = '', $defaultLifetime = 0)
 {
     parent::__construct($namespace, $defaultLifetime);
     $this->client = $client;
 }
Пример #15
0
 public function __construct($config)
 {
     parent::__construct($config);
     $this->socialFieldsMap = array('socialId' => 'uid', 'avatar' => 'photo_big', 'birthday' => 'bdate', 'token' => 'token', 'firstName' => 'first_name', 'secondName' => 'last_name');
     $this->provider = 'vk';
 }
Пример #16
0
 public function __construct($namespace = '', $defaultLifetime = 0, $directory = null)
 {
     parent::__construct('', $defaultLifetime);
     $this->init($namespace, $directory);
 }
Пример #17
0
 public function __construct($config)
 {
     parent::__construct($config);
     $this->socialFieldsMap = array('socialId' => 'uid', 'email' => 'email', 'avatar' => 'photo_big', 'birthday' => 'bdate');
     $this->provider = 'vk';
 }
Пример #18
0
 public function __construct($config)
 {
     parent::__construct($config);
     $this->socialFieldsMap = array('socialId' => 'id', 'email' => 'email', 'name' => 'name', 'socialPage' => 'link', 'avatar' => 'picture', 'sex' => 'gender');
     $this->provider = 'google';
 }
Пример #19
0
 public function __construct($config)
 {
     parent::__construct($config);
     $this->socialFieldsMap = array('socialId' => 'id', 'email' => 'email', 'name' => 'name', 'socialPage' => 'link', 'sex' => 'gender', 'birthday' => 'birthday');
     $this->provider = 'facebook';
 }
Пример #20
0
 /**
  * Defined by Zend_ProgressBar_Adapter
  *
  * @param null|array|\Zend\Config\Config $options
  */
 public function __construct($options = null)
 {
     // Call parent constructor with options
     parent::__construct($options);
     // Check if a width was set, else use auto width
     if ($this->_width === null) {
         $this->setWidth();
     }
 }