@@ -57,7 +57,7 @@ |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | - * Decrypts the given data. |
|
| 60 | + * Decrypts the given data. |
|
| 61 | 61 | * |
| 62 | 62 | * @param String $data Data to decrypt. |
| 63 | 63 | * |
@@ -51,8 +51,8 @@ |
||
| 51 | 51 | public function setValue($key, $value, $expire=0) |
| 52 | 52 | { |
| 53 | 53 | $envelope = array("expire"=>$expire, |
| 54 | - "createdAt"=>time(), |
|
| 55 | - "value"=>$value); |
|
| 54 | + "createdAt"=>time(), |
|
| 55 | + "value"=>$value); |
|
| 56 | 56 | $filename = $this->getFilenameByKey($key); |
| 57 | 57 | |
| 58 | 58 | if (!file_put_contents($filename, serialize($envelope))) { |
@@ -1,102 +1,102 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class Tiqr_AutoLoader { |
| 3 | 3 | |
| 4 | - protected static $instance; |
|
| 5 | - |
|
| 6 | - protected $tiqrPath; |
|
| 7 | - protected $qrcodePath; |
|
| 8 | - protected $zendPath; |
|
| 9 | - |
|
| 10 | - protected function __construct($options) { |
|
| 11 | - if ($options !== NULL) { |
|
| 12 | - $this->setOptions($options); |
|
| 13 | - } |
|
| 14 | - spl_autoload_register(array(__CLASS__, 'autoload')); |
|
| 15 | - } |
|
| 16 | - |
|
| 17 | - public static function getInstance($options = NULL) { |
|
| 18 | - if (null === self::$instance) { |
|
| 19 | - self::$instance = new self($options); |
|
| 20 | - } |
|
| 21 | - |
|
| 22 | - return self::$instance; |
|
| 23 | - } |
|
| 24 | - |
|
| 25 | - public static function autoload($className) { |
|
| 26 | - if($className === NULL) { |
|
| 27 | - return; |
|
| 28 | - } |
|
| 29 | - |
|
| 30 | - $self = self::getInstance(); |
|
| 31 | - |
|
| 32 | - $substr5 = substr($className, 0, 5); |
|
| 33 | - |
|
| 34 | - if ($substr5 === 'Tiqr_' || $substr5 === 'OATH_') { |
|
| 35 | - $file = $self->tiqrPath . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; |
|
| 36 | - } elseif ($className === 'QRcode') { |
|
| 37 | - $file = $self->qrcodePath . DIRECTORY_SEPARATOR . 'qrlib.php'; |
|
| 38 | - } elseif ($substr5 === 'Zend_') { |
|
| 39 | - $file = $self->zendPath . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; |
|
| 4 | + protected static $instance; |
|
| 5 | + |
|
| 6 | + protected $tiqrPath; |
|
| 7 | + protected $qrcodePath; |
|
| 8 | + protected $zendPath; |
|
| 9 | + |
|
| 10 | + protected function __construct($options) { |
|
| 11 | + if ($options !== NULL) { |
|
| 12 | + $this->setOptions($options); |
|
| 13 | + } |
|
| 14 | + spl_autoload_register(array(__CLASS__, 'autoload')); |
|
| 15 | + } |
|
| 16 | + |
|
| 17 | + public static function getInstance($options = NULL) { |
|
| 18 | + if (null === self::$instance) { |
|
| 19 | + self::$instance = new self($options); |
|
| 20 | + } |
|
| 21 | + |
|
| 22 | + return self::$instance; |
|
| 23 | + } |
|
| 24 | + |
|
| 25 | + public static function autoload($className) { |
|
| 26 | + if($className === NULL) { |
|
| 27 | + return; |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + $self = self::getInstance(); |
|
| 31 | + |
|
| 32 | + $substr5 = substr($className, 0, 5); |
|
| 33 | + |
|
| 34 | + if ($substr5 === 'Tiqr_' || $substr5 === 'OATH_') { |
|
| 35 | + $file = $self->tiqrPath . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; |
|
| 36 | + } elseif ($className === 'QRcode') { |
|
| 37 | + $file = $self->qrcodePath . DIRECTORY_SEPARATOR . 'qrlib.php'; |
|
| 38 | + } elseif ($substr5 === 'Zend_') { |
|
| 39 | + $file = $self->zendPath . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; |
|
| 40 | 40 | } elseif ($className === 'ReadWriteException') { |
| 41 | 41 | $file = $self->tiqrPath . DIRECTORY_SEPARATOR . 'Tiqr/Exception/ReadWriteException.php'; |
| 42 | - } else { |
|
| 43 | - return; |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - if (file_exists($file)) { |
|
| 47 | - require_once($file); |
|
| 48 | - } |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - public function setOptions($options) { |
|
| 52 | - if (isset($options["tiqr.path"])) { |
|
| 53 | - $tiqr_dir = $options["tiqr.path"]; |
|
| 54 | - $tiqr_path = realpath($tiqr_dir); |
|
| 55 | - } else { |
|
| 56 | - $tiqr_dir = dirname(__FILE__); |
|
| 57 | - $tiqr_path = $tiqr_dir; |
|
| 58 | - } |
|
| 59 | - if (is_dir($tiqr_path)) { |
|
| 60 | - $this->tiqrPath = $tiqr_path; |
|
| 61 | - } else { |
|
| 62 | - throw new Exception('Directory not found: ' . var_export($tiqr_dir, TRUE)); |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - if (isset($options["phpqrcode.path"])) { |
|
| 66 | - $qrcode_dir = $options["phpqrcode.path"]; |
|
| 67 | - $qrcode_path = realpath($qrcode_dir); |
|
| 68 | - } else { |
|
| 69 | - $qrcode_dir = dirname(dirname(dirname(__FILE__))) . '/phpqrcode'; |
|
| 70 | - $qrcode_path = $qrcode_dir; |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - if (is_dir($qrcode_path)) { |
|
| 74 | - $this->qrcodePath = $qrcode_path; |
|
| 75 | - } else { |
|
| 76 | - throw new Exception('Directory not found: ' . var_export($qrcode_dir, TRUE)); |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - if (isset($options["zend.path"])) { |
|
| 80 | - $zend_dir = $options["zend.path"]; |
|
| 81 | - $zend_path = realpath($zend_dir); |
|
| 82 | - } else { |
|
| 83 | - $zend_dir = dirname(dirname(dirname(__FILE__))) . "/zend"; |
|
| 84 | - $zend_path = $zend_dir; |
|
| 85 | - } |
|
| 86 | - if (is_dir($zend_path)) { |
|
| 87 | - $this->zendPath = $zend_path; |
|
| 88 | - } else { |
|
| 89 | - throw new Exception('Directory not found: ' . var_export($zend_dir, TRUE)); |
|
| 90 | - } |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - |
|
| 94 | - public function setIncludePath() { |
|
| 95 | - set_include_path(implode(PATH_SEPARATOR, array( |
|
| 96 | - $this->tiqrPath, |
|
| 97 | - $this->zendPath, |
|
| 98 | - $this->qrcodePath, |
|
| 99 | - get_include_path(), |
|
| 100 | - ))); |
|
| 101 | - } |
|
| 42 | + } else { |
|
| 43 | + return; |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + if (file_exists($file)) { |
|
| 47 | + require_once($file); |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + public function setOptions($options) { |
|
| 52 | + if (isset($options["tiqr.path"])) { |
|
| 53 | + $tiqr_dir = $options["tiqr.path"]; |
|
| 54 | + $tiqr_path = realpath($tiqr_dir); |
|
| 55 | + } else { |
|
| 56 | + $tiqr_dir = dirname(__FILE__); |
|
| 57 | + $tiqr_path = $tiqr_dir; |
|
| 58 | + } |
|
| 59 | + if (is_dir($tiqr_path)) { |
|
| 60 | + $this->tiqrPath = $tiqr_path; |
|
| 61 | + } else { |
|
| 62 | + throw new Exception('Directory not found: ' . var_export($tiqr_dir, TRUE)); |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + if (isset($options["phpqrcode.path"])) { |
|
| 66 | + $qrcode_dir = $options["phpqrcode.path"]; |
|
| 67 | + $qrcode_path = realpath($qrcode_dir); |
|
| 68 | + } else { |
|
| 69 | + $qrcode_dir = dirname(dirname(dirname(__FILE__))) . '/phpqrcode'; |
|
| 70 | + $qrcode_path = $qrcode_dir; |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + if (is_dir($qrcode_path)) { |
|
| 74 | + $this->qrcodePath = $qrcode_path; |
|
| 75 | + } else { |
|
| 76 | + throw new Exception('Directory not found: ' . var_export($qrcode_dir, TRUE)); |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + if (isset($options["zend.path"])) { |
|
| 80 | + $zend_dir = $options["zend.path"]; |
|
| 81 | + $zend_path = realpath($zend_dir); |
|
| 82 | + } else { |
|
| 83 | + $zend_dir = dirname(dirname(dirname(__FILE__))) . "/zend"; |
|
| 84 | + $zend_path = $zend_dir; |
|
| 85 | + } |
|
| 86 | + if (is_dir($zend_path)) { |
|
| 87 | + $this->zendPath = $zend_path; |
|
| 88 | + } else { |
|
| 89 | + throw new Exception('Directory not found: ' . var_export($zend_dir, TRUE)); |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + |
|
| 94 | + public function setIncludePath() { |
|
| 95 | + set_include_path(implode(PATH_SEPARATOR, array( |
|
| 96 | + $this->tiqrPath, |
|
| 97 | + $this->zendPath, |
|
| 98 | + $this->qrcodePath, |
|
| 99 | + get_include_path(), |
|
| 100 | + ))); |
|
| 101 | + } |
|
| 102 | 102 | } |