@@ -118,6 +118,9 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | + /** |
|
| 122 | + * @return double |
|
| 123 | + */ |
|
| 121 | 124 | public function getSeconds() |
| 122 | 125 | { |
| 123 | 126 | if ($this->_seconds === null) { |
@@ -165,11 +168,17 @@ discard block |
||
| 165 | 168 | return $return; |
| 166 | 169 | } |
| 167 | 170 | |
| 171 | + /** |
|
| 172 | + * @return string |
|
| 173 | + */ |
|
| 168 | 174 | public function getHoursPart() |
| 169 | 175 | { |
| 170 | 176 | return $this->getPart('h'); |
| 171 | 177 | } |
| 172 | 178 | |
| 179 | + /** |
|
| 180 | + * @param string $p |
|
| 181 | + */ |
|
| 173 | 182 | public function getPart($p) |
| 174 | 183 | { |
| 175 | 184 | if ($this->_parts === null) { |
@@ -179,11 +188,17 @@ discard block |
||
| 179 | 188 | return $this->_parts[$p]; |
| 180 | 189 | } |
| 181 | 190 | |
| 191 | + /** |
|
| 192 | + * @return string |
|
| 193 | + */ |
|
| 182 | 194 | public function getMinutesPart() |
| 183 | 195 | { |
| 184 | 196 | return $this->getPart('m'); |
| 185 | 197 | } |
| 186 | 198 | |
| 199 | + /** |
|
| 200 | + * @return string |
|
| 201 | + */ |
|
| 187 | 202 | public function getSecondsPart() |
| 188 | 203 | { |
| 189 | 204 | return $this->getPart('s'); |
@@ -149,17 +149,17 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | $hours = $this->getHoursPart(); |
| 151 | 151 | if ($hours OR $return) { |
| 152 | - $return .= ($return ? ' ' : '').str_pad($hours, 2, 0, STR_PAD_LEFT).'h'; |
|
| 152 | + $return .= ($return ? ' ' : '') . str_pad($hours, 2, 0, STR_PAD_LEFT) . 'h'; |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | $minutes = $this->getMinutesPart(); |
| 156 | 156 | if ($minutes OR $return) { |
| 157 | - $return .= ($return ? ' ' : '').str_pad($minutes, 2, 0, STR_PAD_LEFT).'m'; |
|
| 157 | + $return .= ($return ? ' ' : '') . str_pad($minutes, 2, 0, STR_PAD_LEFT) . 'm'; |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | $seconds = $this->getSecondsPart(); |
| 161 | 161 | if ($seconds) { |
| 162 | - $return .= ($return ? ' ' : '').str_pad($seconds, 2, 0, STR_PAD_LEFT).'s'; |
|
| 162 | + $return .= ($return ? ' ' : '') . str_pad($seconds, 2, 0, STR_PAD_LEFT) . 's'; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | return $return; |
@@ -195,6 +195,6 @@ discard block |
||
| 195 | 195 | $minutes = str_pad($this->getMinutesPart(), 2, 0, STR_PAD_LEFT); |
| 196 | 196 | $seconds = str_pad($this->getSecondsPart(), 2, 0, STR_PAD_LEFT); |
| 197 | 197 | |
| 198 | - return $hours.':'.$minutes.':'.$seconds; |
|
| 198 | + return $hours . ':' . $minutes . ':' . $seconds; |
|
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | \ No newline at end of file |
@@ -236,7 +236,7 @@ |
||
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | /** |
| 239 | - * @param $path |
|
| 239 | + * @param string $path |
|
| 240 | 240 | * @return $this |
| 241 | 241 | */ |
| 242 | 242 | public function setBasePath($path) |
@@ -30,6 +30,6 @@ |
||
| 30 | 30 | { |
| 31 | 31 | $params = $this->stripEmptyParams($params); |
| 32 | 32 | |
| 33 | - return $this->getMap().($params ? '?'.http_build_query($params) : ''); |
|
| 33 | + return $this->getMap() . ($params ? '?' . http_build_query($params) : ''); |
|
| 34 | 34 | } |
| 35 | 35 | } |
@@ -127,7 +127,7 @@ |
||
| 127 | 127 | { |
| 128 | 128 | $return = ''; |
| 129 | 129 | foreach ($this->attributes as $name => $value) { |
| 130 | - $return .= ' '.$name.'="'.$value.'"'; |
|
| 130 | + $return .= ' ' . $name . '="' . $value . '"'; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | return $return; |
@@ -6,47 +6,47 @@ |
||
| 6 | 6 | protected $_error; |
| 7 | 7 | protected $_tmp_name; |
| 8 | 8 | |
| 9 | - public function __construct($data = array()) |
|
| 10 | - { |
|
| 11 | - if ($data) { |
|
| 9 | + public function __construct($data = array()) |
|
| 10 | + { |
|
| 11 | + if ($data) { |
|
| 12 | 12 | $this->_name = $data['name']; |
| 13 | 13 | $this->_tmp_name = $data['tmp_name']; |
| 14 | 14 | |
| 15 | 15 | parent::__construct(TMP_PATH . $this->_tmp_name); |
| 16 | - } |
|
| 17 | - } |
|
| 16 | + } |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - public function valid() |
|
| 20 | - { |
|
| 21 | - $result = false; |
|
| 19 | + public function valid() |
|
| 20 | + { |
|
| 21 | + $result = false; |
|
| 22 | 22 | |
| 23 | 23 | $max_upload = ini_get("post_max_size"); |
| 24 | - $unit = strtoupper(substr($max_upload, -1)); |
|
| 25 | - $multiplier = ($unit == 'M') ? 1048576 : (($unit == 'K') ? 1024 : (($unit == 'G') ? 1073741824 : 1)); |
|
| 24 | + $unit = strtoupper(substr($max_upload, -1)); |
|
| 25 | + $multiplier = ($unit == 'M') ? 1048576 : (($unit == 'K') ? 1024 : (($unit == 'G') ? 1073741824 : 1)); |
|
| 26 | 26 | |
| 27 | - if ($max_upload && ((int) $_SERVER['CONTENT_LENGTH'] > $multiplier * (int) $max_upload)) { |
|
| 27 | + if ($max_upload && ((int) $_SERVER['CONTENT_LENGTH'] > $multiplier * (int) $max_upload)) { |
|
| 28 | 28 | return self::ERROR_MAX_POST_SIZE; |
| 29 | - } |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - if (!$this->getPath()) { |
|
| 31 | + if (!$this->getPath()) { |
|
| 32 | 32 | return false; |
| 33 | 33 | |
| 34 | - } else if (isset($this->error) && $this->error != 0) { |
|
| 34 | + } else if (isset($this->error) && $this->error != 0) { |
|
| 35 | 35 | return false; |
| 36 | 36 | |
| 37 | - } else if (!isset($this->_tmp_name) || !@is_uploaded_file($this->_tmp_name)) { |
|
| 37 | + } else if (!isset($this->_tmp_name) || !@is_uploaded_file($this->_tmp_name)) { |
|
| 38 | 38 | return false; |
| 39 | 39 | |
| 40 | - } else if (!isset($this->_name)) { |
|
| 40 | + } else if (!isset($this->_name)) { |
|
| 41 | 41 | return false; |
| 42 | - } |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - return true; |
|
| 45 | - } |
|
| 44 | + return true; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - public function upload($path) |
|
| 48 | - { |
|
| 49 | - return $this->move($path); |
|
| 50 | - } |
|
| 47 | + public function upload($path) |
|
| 48 | + { |
|
| 49 | + return $this->move($path); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | 52 | } |
| 53 | 53 | \ No newline at end of file |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | $filename = implode(".", $filename); |
| 47 | 47 | $image->path = $dir . '/' . $filename; |
| 48 | 48 | $image->save(); |
| 49 | - } |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | 51 | public function getRandomFrame() |
| 52 | 52 | { |
@@ -11,15 +11,15 @@ |
||
| 11 | 11 | |
| 12 | 12 | $command = []; |
| 13 | 13 | $command[] = '/usr/bin/ffmpeg'; |
| 14 | - $command[] = "-i ".escapeshellarg($this->path); |
|
| 14 | + $command[] = "-i " . escapeshellarg($this->path); |
|
| 15 | 15 | foreach ($params as $key => $value) { |
| 16 | - $command[] = "-$key ".escapeshellarg($value); |
|
| 16 | + $command[] = "-$key " . escapeshellarg($value); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - $path = dirname($this->path) .DIRECTORY_SEPARATOR. pathinfo($this->path, PATHINFO_FILENAME) . '.' . strtolower($params['f']); |
|
| 19 | + $path = dirname($this->path) . DIRECTORY_SEPARATOR . pathinfo($this->path, PATHINFO_FILENAME) . '.' . strtolower($params['f']); |
|
| 20 | 20 | $command[] = $path; |
| 21 | 21 | |
| 22 | - $command = implode(" ", $command) . " && chmod 777 $path".($removeOriginal ? " && rm $this->path" : ""); |
|
| 22 | + $command = implode(" ", $command) . " && chmod 777 $path" . ($removeOriginal ? " && rm $this->path" : ""); |
|
| 23 | 23 | |
| 24 | 24 | $process = new Process($command); |
| 25 | 25 | $process->start(); |
@@ -90,13 +90,13 @@ |
||
| 90 | 90 | public function save() { |
| 91 | 91 | $expire = $this->getExpire(); |
| 92 | 92 | if (!$expire) { |
| 93 | - $timer = $this->getExpireTimer() ? $this->getExpireTimer() : 3*60*60; |
|
| 93 | + $timer = $this->getExpireTimer() ? $this->getExpireTimer() : 3 * 60 * 60; |
|
| 94 | 94 | $expire = time() + $timer; |
| 95 | 95 | |
| 96 | 96 | } |
| 97 | 97 | $domain = ($this->getDomain() != 'localhost') ? $this->getDomain() : false; |
| 98 | 98 | |
| 99 | - return setcookie ( |
|
| 99 | + return setcookie( |
|
| 100 | 100 | $this->getName(), |
| 101 | 101 | $this->getValue(), |
| 102 | 102 | $expire, |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * @return Cookie |
| 17 | - */ |
|
| 17 | + */ |
|
| 18 | 18 | public function newCookie() { |
| 19 | 19 | $cookie = new Cookie(); |
| 20 | 20 | $defaults = $this->getDefaults(); |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | return $this->_defaults; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Singleton |
|
| 53 | - * |
|
| 54 | - * @return self |
|
| 55 | - */ |
|
| 51 | + /** |
|
| 52 | + * Singleton |
|
| 53 | + * |
|
| 54 | + * @return self |
|
| 55 | + */ |
|
| 56 | 56 | public static function instance() { |
| 57 | 57 | if (!self::$instance instanceof self) { |
| 58 | 58 | self::$instance = new self; |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | $this->_defaults = array( |
| 27 | 27 | 'path' => '/', |
| 28 | 28 | 'domain' => $_SERVER['SERVER_NAME'], |
| 29 | - 'expireTimer' => 6 * 60 *60, |
|
| 29 | + 'expireTimer' => 6 * 60 * 60, |
|
| 30 | 30 | ); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -7,24 +7,24 @@ |
||
| 7 | 7 | class XML extends View |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - public function load($view = false, $variables = array(), $return = false) |
|
| 11 | - { |
|
| 12 | - header('Content-type: text/xml'); |
|
| 13 | - return parent::load($view, $variables, $return); |
|
| 14 | - } |
|
| 10 | + public function load($view = false, $variables = array(), $return = false) |
|
| 11 | + { |
|
| 12 | + header('Content-type: text/xml'); |
|
| 13 | + return parent::load($view, $variables, $return); |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * Singleton |
|
| 18 | - * |
|
| 19 | - * @return self |
|
| 20 | - */ |
|
| 21 | - public static function instance() |
|
| 22 | - { |
|
| 23 | - static $instance; |
|
| 24 | - if (!($instance instanceof self)) { |
|
| 25 | - $instance = new self(); |
|
| 26 | - } |
|
| 27 | - return $instance; |
|
| 28 | - } |
|
| 16 | + /** |
|
| 17 | + * Singleton |
|
| 18 | + * |
|
| 19 | + * @return self |
|
| 20 | + */ |
|
| 21 | + public static function instance() |
|
| 22 | + { |
|
| 23 | + static $instance; |
|
| 24 | + if (!($instance instanceof self)) { |
|
| 25 | + $instance = new self(); |
|
| 26 | + } |
|
| 27 | + return $instance; |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | 30 | } |