@@ -92,6 +92,9 @@ |
||
| 92 | 92 | return $settings; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | + /** |
|
| 96 | + * @param string $field |
|
| 97 | + */ |
|
| 95 | 98 | protected function _normToSeconds(&$settings, $field) { |
| 96 | 99 | $settings[$field] = (int)$settings[$field] * 60; |
| 97 | 100 | } |
@@ -93,7 +93,7 @@ |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | protected function _normToSeconds(&$settings, $field) { |
| 96 | - $settings[$field] = (int)$settings[$field] * 60; |
|
| 96 | + $settings[$field] = (int) $settings[$field] * 60; |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | * counts how many users ignore the user with ID $id |
| 83 | 83 | * |
| 84 | 84 | * @param $id |
| 85 | - * @return array |
|
| 85 | + * @return integer |
|
| 86 | 86 | */ |
| 87 | 87 | public function countIgnored($id) { |
| 88 | 88 | return count($this->getIgnored($id)); |
@@ -7,6 +7,10 @@ |
||
| 7 | 7 | parent::setUp(); |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | + /** |
|
| 11 | + * @param string[] $types |
|
| 12 | + * @param string $url |
|
| 13 | + */ |
|
| 10 | 14 | protected function _checkDisallowedRequestType($types, $url) { |
| 11 | 15 | foreach ($types as $requestType) { |
| 12 | 16 | try { |
@@ -306,6 +306,9 @@ |
||
| 306 | 306 | |
| 307 | 307 | /** |
| 308 | 308 | * @see http://www.php.net/manual/en/function.str-pad.php#111147 |
| 309 | + * @param string $str |
|
| 310 | + * @param integer $padLen |
|
| 311 | + * @param integer $dir |
|
| 309 | 312 | */ |
| 310 | 313 | protected function _mbStrpad($str, $padLen, $padStr = ' ', $dir = STR_PAD_RIGHT) { |
| 311 | 314 | $strLen = mb_strlen($str); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | // @todo should be done in Setting model |
| 125 | 125 | $ad = explode('|', $this->_sOptions['video_domains_allowed']); |
| 126 | - $trim = function ($v) { |
|
| 126 | + $trim = function($v) { |
|
| 127 | 127 | return trim($v); |
| 128 | 128 | }; |
| 129 | 129 | $this->_allowedVideoDomains = array_fill_keys(array_map($trim, $ad), 1); |
@@ -193,9 +193,9 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - $out = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="' . $width . '" height="' . $height . '"> |
|
| 197 | - <param name="movie" value="' . $url . '"></param> |
|
| 198 | - <embed src="' . $url . '" width="' . $width . '" height="' . $height . '" type="application/x-shockwave-flash" wmode="opaque" style="width:' . $width . 'px; height:' . $height . 'px;" id="VideoPlayback" flashvars=""> </embed> </object>'; |
|
| 196 | + $out = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="'.$width.'" height="'.$height.'"> |
|
| 197 | + <param name="movie" value="' . $url.'"></param> |
|
| 198 | + <embed src="' . $url.'" width="'.$width.'" height="'.$height.'" type="application/x-shockwave-flash" wmode="opaque" style="width:'.$width.'px; height:'.$height.'px;" id="VideoPlayback" flashvars=""> </embed> </object>'; |
|
| 199 | 199 | return $out; |
| 200 | 200 | } |
| 201 | 201 | |
@@ -258,12 +258,12 @@ discard block |
||
| 258 | 258 | protected function _parse($content, $attributes) { |
| 259 | 259 | $listPieces = explode('[*]', $content); |
| 260 | 260 | unset($listPieces[0]); |
| 261 | - $listPieceProcessor = function ($li) { |
|
| 262 | - return '<li>' . $li . '</li>' . "\n"; |
|
| 261 | + $listPieceProcessor = function($li) { |
|
| 262 | + return '<li>'.$li.'</li>'."\n"; |
|
| 263 | 263 | }; |
| 264 | 264 | $listPieces = array_map($listPieceProcessor, $listPieces); |
| 265 | 265 | |
| 266 | - return '<ul>' . implode('', $listPieces) . '</ul>'; |
|
| 266 | + return '<ul>'.implode('', $listPieces).'</ul>'; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | } |
@@ -280,14 +280,14 @@ discard block |
||
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | $title = $this->_mbStrpad( |
| 283 | - ' ' . __('Spoiler') . ' ', |
|
| 283 | + ' '.__('Spoiler').' ', |
|
| 284 | 284 | $length, |
| 285 | 285 | '▇', |
| 286 | 286 | STR_PAD_BOTH |
| 287 | 287 | ); |
| 288 | 288 | |
| 289 | 289 | $json = json_encode(['string' => $content]); |
| 290 | - $id = 'spoiler_' . rand(0, 9999999999999); |
|
| 290 | + $id = 'spoiler_'.rand(0, 9999999999999); |
|
| 291 | 291 | |
| 292 | 292 | $out = <<<EOF |
| 293 | 293 | <div class="richtext-spoiler" style="display: inline;"> |
@@ -320,19 +320,19 @@ discard block |
||
| 320 | 320 | $result = null; |
| 321 | 321 | $repeat = ceil($strLen - $padStrLen + $padLen); |
| 322 | 322 | if ($dir == STR_PAD_RIGHT) { |
| 323 | - $result = $str . str_repeat($padStr, $repeat); |
|
| 323 | + $result = $str.str_repeat($padStr, $repeat); |
|
| 324 | 324 | $result = mb_substr($result, 0, $padLen); |
| 325 | 325 | } else { |
| 326 | 326 | if ($dir == STR_PAD_LEFT) { |
| 327 | - $result = str_repeat($padStr, $repeat) . $str; |
|
| 327 | + $result = str_repeat($padStr, $repeat).$str; |
|
| 328 | 328 | $result = mb_substr($result, -$padLen); |
| 329 | 329 | } else { |
| 330 | 330 | if ($dir == STR_PAD_BOTH) { |
| 331 | 331 | $length = ($padLen - $strLen) / 2; |
| 332 | 332 | $repeat = ceil($length / $padStrLen); |
| 333 | 333 | $result = mb_substr(str_repeat($padStr, $repeat), 0, |
| 334 | - floor($length)) . |
|
| 335 | - $str . |
|
| 334 | + floor($length)). |
|
| 335 | + $str. |
|
| 336 | 336 | mb_substr(str_repeat($padStr, $repeat), 0, ceil($length)); |
| 337 | 337 | } |
| 338 | 338 | } |
@@ -102,6 +102,9 @@ |
||
| 102 | 102 | return $this->_lastRuns; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | + /** |
|
| 106 | + * @param string $msg |
|
| 107 | + */ |
|
| 105 | 108 | protected function _log($msg) { |
| 106 | 109 | if (Configure::read('Saito.Globals.logInfo')) { |
| 107 | 110 | return CakeLog::write('saito.info', $msg); |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | } |
| 62 | 62 | $jobsExecuted++; |
| 63 | 63 | $job->execute(); |
| 64 | - $this->_log('Run cron-job ' . $job->uid); |
|
| 64 | + $this->_log('Run cron-job '.$job->uid); |
|
| 65 | 65 | $this->_lastRuns[$job->due][$job->uid] = $this->_now; |
| 66 | 66 | } |
| 67 | 67 | if ($jobsExecuted === 0) { |
@@ -30,6 +30,9 @@ |
||
| 30 | 30 | return $this->_schema; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | + /** |
|
| 34 | + * @param string $key |
|
| 35 | + */ |
|
| 33 | 36 | public function resolveKey(Model $model, $key) { |
| 34 | 37 | if (strpos('.', $key) === false) { |
| 35 | 38 | return $model->alias . '.' . $key; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | public function resolveKey(Model $model, $key) { |
| 34 | 34 | if (strpos('.', $key) === false) { |
| 35 | - return $model->alias . '.' . $key; |
|
| 35 | + return $model->alias.'.'.$key; |
|
| 36 | 36 | } |
| 37 | 37 | return $key; |
| 38 | 38 | } |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | if ($plugin) { |
| 61 | 61 | $folderPath = CakePlugin::path($plugin); |
| 62 | 62 | } else { |
| 63 | - $folderPath = ROOT . DS; |
|
| 63 | + $folderPath = ROOT.DS; |
|
| 64 | 64 | } |
| 65 | - $folderPath .= 'docs' . DS . 'help' . DS . $lang; |
|
| 65 | + $folderPath .= 'docs'.DS.'help'.DS.$lang; |
|
| 66 | 66 | |
| 67 | 67 | $folder = new Folder($folderPath); |
| 68 | 68 | $files = $folder->find("$id(-.*?)?\.md"); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | return false; |
| 71 | 71 | } |
| 72 | 72 | $name = $files[0]; |
| 73 | - $file = new File($folderPath . DS . $name, false, 0444); |
|
| 73 | + $file = new File($folderPath.DS.$name, false, 0444); |
|
| 74 | 74 | $text = $file->read(); |
| 75 | 75 | $file->close(); |
| 76 | 76 | $result = [ |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | /** |
| 38 | 38 | * Setup instance |
| 39 | 39 | * |
| 40 | - * @param type $Model |
|
| 40 | + * @param Model $Model |
|
| 41 | 41 | * @param type $settings |
| 42 | 42 | */ |
| 43 | 43 | public function setup(Model $Model, $settings = array()) { |
@@ -183,6 +183,8 @@ discard block |
||
| 183 | 183 | /** |
| 184 | 184 | * build and log error message |
| 185 | 185 | * 2009-12-18 ms |
| 186 | + * @param string $msg |
|
| 187 | + * @param string $internalMsg |
|
| 186 | 188 | */ |
| 187 | 189 | private function error($msg = null, $internalMsg = null) { |
| 188 | 190 | if (!empty($msg)) { |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $dummyField = $this->settings[$this->Model->alias]['dummyField']; |
| 92 | 92 | if (!empty($data[$dummyField])) { |
| 93 | 93 | # dummy field not empty - SPAM! |
| 94 | - return $this->error('Illegal content', 'DummyField = \'' . $data[$dummyField] . '\''); |
|
| 94 | + return $this->error('Illegal content', 'DummyField = \''.$data[$dummyField].'\''); |
|
| 95 | 95 | } |
| 96 | 96 | return true; |
| 97 | 97 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | if (isSet($data['captcha_hash']) && isSet($data['captcha_time']) |
| 111 | - && ( $data['captcha_time'] < time() - $this->settings[$this->Model->alias]['minTime'] ) |
|
| 111 | + && ($data['captcha_time'] < time() - $this->settings[$this->Model->alias]['minTime']) |
|
| 112 | 112 | ) { |
| 113 | 113 | return true; |
| 114 | 114 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | return true; |
| 128 | 128 | } |
| 129 | 129 | if (isSet($data['captcha_hash']) && isSet($data['captcha_time']) |
| 130 | - && ( $data['captcha_time'] + $this->settings[$this->Model->alias]['maxTime'] > time() ) |
|
| 130 | + && ($data['captcha_time'] + $this->settings[$this->Model->alias]['maxTime'] > time()) |
|
| 131 | 131 | ) { |
| 132 | 132 | return true; |
| 133 | 133 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | return true; |
| 162 | 162 | } |
| 163 | 163 | # wrong captcha content or session expired |
| 164 | - return $this->error('Captcha incorrect', 'SubmittedResult = \'' . $data['captcha'] . '\''); |
|
| 164 | + return $this->error('Captcha incorrect', 'SubmittedResult = \''.$data['captcha'].'\''); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -210,12 +210,12 @@ discard block |
||
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | App::import('Component', 'RequestHandler'); |
| 213 | - $msg = 'Ip \'' . RequestHandlerComponent::getClientIP() . '\', Agent \'' . env('HTTP_USER_AGENT') . '\', Referer \'' . env('HTTP_REFERER') . '\', Host-Referer \'' . RequestHandlerComponent::getReferer() . '\''; |
|
| 213 | + $msg = 'Ip \''.RequestHandlerComponent::getClientIP().'\', Agent \''.env('HTTP_USER_AGENT').'\', Referer \''.env('HTTP_REFERER').'\', Host-Referer \''.RequestHandlerComponent::getReferer().'\''; |
|
| 214 | 214 | if (!empty($this->error)) { |
| 215 | - $msg .= ', ' . $this->error; |
|
| 215 | + $msg .= ', '.$this->error; |
|
| 216 | 216 | } |
| 217 | 217 | if (!empty($this->internalError)) { |
| 218 | - $msg .= ' (' . $this->internalError . ')'; |
|
| 218 | + $msg .= ' ('.$this->internalError.')'; |
|
| 219 | 219 | } |
| 220 | 220 | $this->log($msg, 'captcha'); |
| 221 | 221 | return true; |
@@ -54,6 +54,9 @@ discard block |
||
| 54 | 54 | self::$_stopwatchCalls = 0; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | + /** |
|
| 58 | + * @param string $event |
|
| 59 | + */ |
|
| 57 | 60 | static protected function _addEvent($x, $event = null) { |
| 58 | 61 | if (self::$_enableTimer === false) { |
| 59 | 62 | return; |
@@ -264,7 +267,7 @@ discard block |
||
| 264 | 267 | /** |
| 265 | 268 | * Alias for self::stop |
| 266 | 269 | * |
| 267 | - * @param type $text |
|
| 270 | + * @param string $text |
|
| 268 | 271 | */ |
| 269 | 272 | public static function end($text) { |
| 270 | 273 | self::stop($text); |
@@ -100,10 +100,10 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | switch ($event) { |
| 102 | 102 | case 'start': |
| 103 | - $x = '* ' . $x; |
|
| 103 | + $x = '* '.$x; |
|
| 104 | 104 | break; |
| 105 | 105 | case 'stop': |
| 106 | - $x = '† ' . $x; |
|
| 106 | + $x = '† '.$x; |
|
| 107 | 107 | break; |
| 108 | 108 | } |
| 109 | 109 | |
@@ -143,13 +143,13 @@ discard block |
||
| 143 | 143 | self::start('now'); |
| 144 | 144 | |
| 145 | 145 | $out = ""; |
| 146 | - $out .= 'Time to Cake: ' . sprintf('%05.3f', self::_timeToCake()) . " s\n"; |
|
| 147 | - $out .= 'Cake bootstrap: ' . sprintf('%05.3f', self::_timeFromCakeToStopwatch()) . " s\n"; |
|
| 146 | + $out .= 'Time to Cake: '.sprintf('%05.3f', self::_timeToCake())." s\n"; |
|
| 147 | + $out .= 'Cake bootstrap: '.sprintf('%05.3f', self::_timeFromCakeToStopwatch())." s\n"; |
|
| 148 | 148 | |
| 149 | 149 | $out .= "W\tU\tW_delta\tU_delta\tMem [MB]\n"; |
| 150 | 150 | $_seriesIndex = 1; |
| 151 | 151 | foreach (self::$_events as $k => $v) { |
| 152 | - $out .= '<span id="stopwatch-' . $_seriesIndex++ . '" class="stopwatch-row">'; |
|
| 152 | + $out .= '<span id="stopwatch-'.$_seriesIndex++.'" class="stopwatch-row">'; |
|
| 153 | 153 | $out .= sprintf("%05.3f\t%05.3f\t%05.3f\t%05.3f\t%5.1f\t%s\n", |
| 154 | 154 | $v['wtime'], |
| 155 | 155 | $v['utime'], |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | $k); |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - $out .= "\n\n" . self::printStatistic(); |
|
| 199 | + $out .= "\n\n".self::printStatistic(); |
|
| 200 | 200 | |
| 201 | 201 | return $out; |
| 202 | 202 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | public static function printStatistic() { |
| 241 | - return self::$_stopwatchCalls . " calls with ca " . sprintf("%05.3f", self::$_stopwatchTime) . ' sec overhead.'; |
|
| 241 | + return self::$_stopwatchCalls." calls with ca ".sprintf("%05.3f", self::$_stopwatchTime).' sec overhead.'; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | public static function getWallTime($divider = null) { |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | self::end('getWallTime()'); |
| 259 | 259 | $time = self::$_events[count(self::$_events) - 1]['wtime'] + |
| 260 | 260 | self::_timeToStopwatch(); |
| 261 | - return number_format( $time, 3, $decimal, $thousand); |
|
| 261 | + return number_format($time, 3, $decimal, $thousand); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | /** |
@@ -151,6 +151,9 @@ |
||
| 151 | 151 | return $this->Html->tag('span', $content, ['class' => 'infoText']); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | + /** |
|
| 155 | + * @param string $icon |
|
| 156 | + */ |
|
| 154 | 157 | public function textWithIcon($text, $icon) { |
| 155 | 158 | return <<<EOF |
| 156 | 159 | <i class="saito-icon fa fa-$icon"></i> |
@@ -13,8 +13,8 @@ discard block |
||
| 13 | 13 | protected $_themeImgUrl = null; |
| 14 | 14 | |
| 15 | 15 | public function beforeRender($viewFile) { |
| 16 | - $this->_themeImgUrl = $this->request->webroot . 'theme' . DS . $this->theme . |
|
| 17 | - DS . Configure::read('App.imageBaseUrl'); |
|
| 16 | + $this->_themeImgUrl = $this->request->webroot.'theme'.DS.$this->theme. |
|
| 17 | + DS.Configure::read('App.imageBaseUrl'); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public function beforeLayout($layoutFile) { |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | public function jQueryTag() { |
| 30 | 30 | $url = 'dist/'; |
| 31 | 31 | $name = 'jquery'; |
| 32 | - if ((int)Configure::read('debug') === 0) { |
|
| 33 | - $name = $name . '.min'; |
|
| 32 | + if ((int) Configure::read('debug') === 0) { |
|
| 33 | + $name = $name.'.min'; |
|
| 34 | 34 | } |
| 35 | - return $this->Html->script($this->Html->assetUrl($url . $name, |
|
| 35 | + return $this->Html->script($this->Html->assetUrl($url.$name, |
|
| 36 | 36 | ['ext' => '.js', 'fullBase' => true])); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -69,14 +69,14 @@ discard block |
||
| 69 | 69 | 'title' => Configure::read('Saito.Settings.forum_name') |
| 70 | 70 | ]; |
| 71 | 71 | $html = []; |
| 72 | - $html[] = '<meta name="application-name" content="' . h($options['title']) . '"/>'; |
|
| 72 | + $html[] = '<meta name="application-name" content="'.h($options['title']).'"/>'; |
|
| 73 | 73 | if (isset($options['color'])) { |
| 74 | - $html[] = '<meta name="msapplication-TileColor" content="' . $options['color'] . '"/>'; |
|
| 74 | + $html[] = '<meta name="msapplication-TileColor" content="'.$options['color'].'"/>'; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $_basename = $options['baseName']; |
| 78 | 78 | $url = "{$this->_themeImgUrl}{$_basename}.png"; |
| 79 | - $html[] = '<meta name="msapplication-TileImage" content="' . $url . '"/>'; |
|
| 79 | + $html[] = '<meta name="msapplication-TileImage" content="'.$url.'"/>'; |
|
| 80 | 80 | return implode("\n", $html); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | $_content += ['first' => '', 'middle' => '', 'last' => '']; |
| 226 | 226 | $out = ''; |
| 227 | 227 | foreach (['first', 'middle', 'last'] as $key) { |
| 228 | - $out .= '<div class="heading-3-' . $key . '">'; |
|
| 228 | + $out .= '<div class="heading-3-'.$key.'">'; |
|
| 229 | 229 | $out .= $options['escape'] ? h($_content[$key]) : $_content[$key]; |
| 230 | 230 | $out .= '</div>'; |
| 231 | 231 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | public function linkToUserProfile($user, ForumsUserInterface $CurrentUser) { |
| 236 | 236 | if ($CurrentUser->isLoggedIn()) { |
| 237 | 237 | return $this->Html->link($user['username'], |
| 238 | - '/users/view/' . $user['id']); |
|
| 238 | + '/users/view/'.$user['id']); |
|
| 239 | 239 | } else { |
| 240 | 240 | return h($user['username']); |
| 241 | 241 | } |