@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | return; |
87 | 87 | } |
88 | 88 | |
89 | - if ( ! (PHP_SAPI === 'cli' || defined('STDIN')) ) |
|
89 | + if ( ! (PHP_SAPI === 'cli' || defined('STDIN'))) |
|
90 | 90 | { |
91 | 91 | throw new \Exception('Cli class cannot be used outside of the command line.'); |
92 | 92 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public static function segment($index) |
112 | 112 | { |
113 | - if (! isset(static::$segments[$index - 1])) |
|
113 | + if ( ! isset(static::$segments[$index - 1])) |
|
114 | 114 | { |
115 | 115 | return null; |
116 | 116 | } |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | // E.g: $ready = CLI::prompt('Are you ready?', array('y','n')); |
203 | 203 | if (is_array($args[1])) |
204 | 204 | { |
205 | - list($output, $options)=$args; |
|
205 | + list($output, $options) = $args; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | // E.g: $color = CLI::prompt('What is your favourite color?', 'white'); |
209 | 209 | elseif (is_string($args[1])) |
210 | 210 | { |
211 | - list($output, $default)=$args; |
|
211 | + list($output, $default) = $args; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | break; |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | public static function new_line($num = 1) |
392 | 392 | { |
393 | 393 | // Do it once or more, write with empty string gives us a new line |
394 | - for($i = 0; $i < $num; $i++) |
|
394 | + for ($i = 0; $i < $num; $i++) |
|
395 | 395 | { |
396 | 396 | static::write(); |
397 | 397 | } |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | * @param string $format other formatting to apply. Currently only 'underline' is understood |
428 | 428 | * @return string the color coded string |
429 | 429 | */ |
430 | - public static function color($text, $foreground, $background = null, $format=null) |
|
430 | + public static function color($text, $foreground, $background = null, $format = null) |
|
431 | 431 | { |
432 | 432 | if (static::is_windows() and ! isset($_SERVER['ANSICON'])) |
433 | 433 | { |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | throw new \RuntimeException('Invalid CLI foreground color: '.$foreground); |
440 | 440 | } |
441 | 441 | |
442 | - if ( $background !== null and ! array_key_exists($background, static::$background_colors)) |
|
442 | + if ($background !== null and ! array_key_exists($background, static::$background_colors)) |
|
443 | 443 | { |
444 | 444 | throw new \RuntimeException('Invalid CLI background color: '.$background); |
445 | 445 | } |
@@ -463,26 +463,26 @@ discard block |
||
463 | 463 | |
464 | 464 | //-------------------------------------------------------------------- |
465 | 465 | |
466 | - public static function getWidth($default=80) |
|
466 | + public static function getWidth($default = 80) |
|
467 | 467 | { |
468 | 468 | if (static::is_windows()) |
469 | 469 | { |
470 | 470 | return $default; |
471 | 471 | } |
472 | 472 | |
473 | - return (int)shell_exec('tput cols'); |
|
473 | + return (int) shell_exec('tput cols'); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | //-------------------------------------------------------------------- |
477 | 477 | |
478 | - public static function getHeight($default=32) |
|
478 | + public static function getHeight($default = 32) |
|
479 | 479 | { |
480 | 480 | if (static::is_windows()) |
481 | 481 | { |
482 | 482 | return $default; |
483 | 483 | } |
484 | 484 | |
485 | - return (int)shell_exec('tput lines'); |
|
485 | + return (int) shell_exec('tput lines'); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | //-------------------------------------------------------------------- |
@@ -494,13 +494,13 @@ discard block |
||
494 | 494 | * @param int $thisStep |
495 | 495 | * @param int $totalSteps |
496 | 496 | */ |
497 | - public static function showProgress($thisStep=1, $totalSteps=10) |
|
497 | + public static function showProgress($thisStep = 1, $totalSteps = 10) |
|
498 | 498 | { |
499 | 499 | // The first time through, save |
500 | 500 | // our position so the script knows where to go |
501 | 501 | // back to when writing the bar, and |
502 | 502 | // at the end of the script. |
503 | - if (! static::$inProgress) { |
|
503 | + if ( ! static::$inProgress) { |
|
504 | 504 | fwrite(STDOUT, "\0337"); |
505 | 505 | static::$inProgress = true; |
506 | 506 | } |
@@ -513,13 +513,13 @@ discard block |
||
513 | 513 | $thisStep = abs($thisStep); |
514 | 514 | $totalSteps = $totalSteps < 1 ? 1 : $totalSteps; |
515 | 515 | |
516 | - $percent = intval( ($thisStep / $totalSteps) * 100 ); |
|
517 | - $step = (int)round($percent / 10); |
|
516 | + $percent = intval(($thisStep / $totalSteps) * 100); |
|
517 | + $step = (int) round($percent / 10); |
|
518 | 518 | |
519 | 519 | // Write the progress bar |
520 | - fwrite(STDOUT, "[\033[32m" . str_repeat('#', $step) . str_repeat('.', 10 - $step) . "\033[0m]"); |
|
520 | + fwrite(STDOUT, "[\033[32m".str_repeat('#', $step).str_repeat('.', 10 - $step)."\033[0m]"); |
|
521 | 521 | // Textual representation... |
522 | - fwrite(STDOUT, " {$percent}% Complete" . PHP_EOL); |
|
522 | + fwrite(STDOUT, " {$percent}% Complete".PHP_EOL); |
|
523 | 523 | // Move up, undo the PHP_EOL |
524 | 524 | fwrite(STDOUT, "\033[1A"); |
525 | 525 | } |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | */ |
571 | 571 | public static function optionString() |
572 | 572 | { |
573 | - if (! count(static::$options)) |
|
573 | + if ( ! count(static::$options)) |
|
574 | 574 | { |
575 | 575 | return ''; |
576 | 576 | } |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | // so it will pass correctly. |
584 | 584 | if (strpos($value, ' ') !== false) |
585 | 585 | { |
586 | - $value = '"'. $value .'"'; |
|
586 | + $value = '"'.$value.'"'; |
|
587 | 587 | } |
588 | 588 | $out .= "-{$name} $value "; |
589 | 589 | } |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | * @param int $max |
609 | 609 | * @param int $pad_left |
610 | 610 | */ |
611 | - public static function wrap($string=null, $max=0, $pad_left=0) |
|
611 | + public static function wrap($string = null, $max = 0, $pad_left = 0) |
|
612 | 612 | { |
613 | 613 | if (empty($string)) |
614 | 614 | { |
@@ -630,13 +630,13 @@ discard block |
||
630 | 630 | $lines = wordwrap($string, $max); |
631 | 631 | |
632 | 632 | if ($pad_left > 0) { |
633 | - $lines = explode( "\n", $lines ); |
|
633 | + $lines = explode("\n", $lines); |
|
634 | 634 | |
635 | 635 | $first = true; |
636 | 636 | |
637 | - array_walk( $lines, function ( &$line, $index ) use($max, $pad_left, &$first) { |
|
638 | - if (! $first) { |
|
639 | - $line = str_repeat( " ", $pad_left ) . $line; |
|
637 | + array_walk($lines, function(&$line, $index) use($max, $pad_left, &$first) { |
|
638 | + if ( ! $first) { |
|
639 | + $line = str_repeat(" ", $pad_left).$line; |
|
640 | 640 | } |
641 | 641 | else |
642 | 642 | { |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | { |
669 | 669 | // If there's no '-' at the beginning of the argument |
670 | 670 | // then add it to our segments. |
671 | - if (! $options_found && strpos($_SERVER['argv'][$i], '-') === false) |
|
671 | + if ( ! $options_found && strpos($_SERVER['argv'][$i], '-') === false) |
|
672 | 672 | { |
673 | 673 | self::$segments[] = $_SERVER['argv'][$i]; |
674 | 674 | continue; |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | $value = null; |
686 | 686 | |
687 | 687 | // If the next item starts with a dash it's a value |
688 | - if (isset($_SERVER['argv'][$i + 1]) && substr($_SERVER['argv'][$i + 1], 0, 1) != '-' ) |
|
688 | + if (isset($_SERVER['argv'][$i + 1]) && substr($_SERVER['argv'][$i + 1], 0, 1) != '-') |
|
689 | 689 | { |
690 | 690 | $value = $_SERVER['argv'][$i + 1]; |
691 | 691 | $i++; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | |
33 | 33 | /* PHP5 spl_autoload */ |
34 | -spl_autoload_register( '\Myth\Modules::autoload' ); |
|
34 | +spl_autoload_register('\Myth\Modules::autoload'); |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * The following properties are used to provide autocomplete for IDE's. |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | $this->setupProfiler(); |
112 | 112 | |
113 | - log_message( 'debug', get_class( $this ) . ' controller loaded.' ); |
|
113 | + log_message('debug', get_class($this).' controller loaded.'); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | //-------------------------------------------------------------------- |
@@ -131,18 +131,18 @@ discard block |
||
131 | 131 | { |
132 | 132 | // If the controller doesn't override cache type, grab the values from |
133 | 133 | // the defaults set in the start file. |
134 | - if ( empty( $this->cache_type ) ) |
|
134 | + if (empty($this->cache_type)) |
|
135 | 135 | { |
136 | - $this->cache_type = $this->config->item( 'cache_type' ); |
|
136 | + $this->cache_type = $this->config->item('cache_type'); |
|
137 | 137 | } |
138 | - if ( empty( $this->backup_cache ) ) |
|
138 | + if (empty($this->backup_cache)) |
|
139 | 139 | { |
140 | - $this->backup_cache = $this->config->item( 'backup_cache_type' ); |
|
140 | + $this->backup_cache = $this->config->item('backup_cache_type'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | // Make sure that caching is ALWAYS available throughout the app |
144 | 144 | // though it defaults to 'dummy' which won't actually cache. |
145 | - $this->load->driver( 'cache', array( 'adapter' => $this->cache_type, 'backup' => $this->backup_cache ) ); |
|
145 | + $this->load->driver('cache', array('adapter' => $this->cache_type, 'backup' => $this->backup_cache)); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | //-------------------------------------------------------------------- |
@@ -153,15 +153,15 @@ discard block |
||
153 | 153 | */ |
154 | 154 | protected function autoload() |
155 | 155 | { |
156 | - if ( ! is_null( $this->language_file ) ) |
|
156 | + if ( ! is_null($this->language_file)) |
|
157 | 157 | { |
158 | - $this->lang->load( $this->language_file ); |
|
158 | + $this->lang->load($this->language_file); |
|
159 | 159 | } |
160 | 160 | |
161 | - if ( ! is_null( $this->model_file ) ) |
|
161 | + if ( ! is_null($this->model_file)) |
|
162 | 162 | { |
163 | 163 | $this->load->database(); |
164 | - $this->load->model( $this->model_file ); |
|
164 | + $this->load->model($this->model_file); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
@@ -173,19 +173,19 @@ discard block |
||
173 | 173 | */ |
174 | 174 | protected function autoMigrate() |
175 | 175 | { |
176 | - $migrations = config_item( 'auto_migrate' ); |
|
176 | + $migrations = config_item('auto_migrate'); |
|
177 | 177 | |
178 | - if ( ! is_array( $migrations ) || ! count( $migrations ) ) |
|
178 | + if ( ! is_array($migrations) || ! count($migrations)) |
|
179 | 179 | { |
180 | 180 | return; |
181 | 181 | } |
182 | 182 | |
183 | - $this->load->library( 'migration' ); |
|
183 | + $this->load->library('migration'); |
|
184 | 184 | |
185 | 185 | // Run all of our migrations for each group. |
186 | - foreach ( $migrations as $group ) |
|
186 | + foreach ($migrations as $group) |
|
187 | 187 | { |
188 | - $this->migration->latest( $group ); |
|
188 | + $this->migration->latest($group); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | // The profiler is dealt with twice so that we can set |
200 | 200 | // things up to work correctly in AJAX methods using $this->render_json |
201 | 201 | // and it's cousins. |
202 | - if ( $this->config->item( 'show_profiler' ) == TRUE ) |
|
202 | + if ($this->config->item('show_profiler') == TRUE) |
|
203 | 203 | { |
204 | - $this->output->enable_profiler( TRUE ); |
|
204 | + $this->output->enable_profiler(TRUE); |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | |
@@ -223,21 +223,21 @@ discard block |
||
223 | 223 | * |
224 | 224 | * @return void [type] [description] |
225 | 225 | */ |
226 | - public function renderText( $text, $typography = FALSE ) |
|
226 | + public function renderText($text, $typography = FALSE) |
|
227 | 227 | { |
228 | 228 | // Note that, for now anyway, we don't do any cleaning of the text |
229 | 229 | // and leave that up to the client to take care of. |
230 | 230 | |
231 | 231 | // However, we can auto_typogrify the text if we're asked nicely. |
232 | - if ( $typography === TRUE ) |
|
232 | + if ($typography === TRUE) |
|
233 | 233 | { |
234 | - $this->load->helper( 'typography' ); |
|
235 | - $text = auto_typography( $text ); |
|
234 | + $this->load->helper('typography'); |
|
235 | + $text = auto_typography($text); |
|
236 | 236 | } |
237 | 237 | |
238 | - $this->output->enable_profiler( FALSE ) |
|
239 | - ->set_content_type( 'text/plain' ) |
|
240 | - ->set_output( $text ); |
|
238 | + $this->output->enable_profiler(FALSE) |
|
239 | + ->set_content_type('text/plain') |
|
240 | + ->set_output($text); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | //-------------------------------------------------------------------- |
@@ -253,22 +253,22 @@ discard block |
||
253 | 253 | * @throws RenderException |
254 | 254 | * @return void |
255 | 255 | */ |
256 | - public function renderJSON( $json ) |
|
256 | + public function renderJSON($json) |
|
257 | 257 | { |
258 | - if ( is_resource( $json ) ) |
|
258 | + if (is_resource($json)) |
|
259 | 259 | { |
260 | - throw new \RuntimeException( lang('bad_json_encode') ); |
|
260 | + throw new \RuntimeException(lang('bad_json_encode')); |
|
261 | 261 | } |
262 | 262 | |
263 | - if ( $this->config->item( 'show_profiler' ) ) |
|
263 | + if ($this->config->item('show_profiler')) |
|
264 | 264 | { |
265 | - $this->load->library( 'profiler' ); |
|
265 | + $this->load->library('profiler'); |
|
266 | 266 | $json['#sprint-profiler'] = $this->profiler->run(); |
267 | 267 | } |
268 | 268 | |
269 | - $this->output->enable_profiler( FALSE ) |
|
270 | - ->set_content_type( 'application/json' ) |
|
271 | - ->set_output( json_encode( $json ) ); |
|
269 | + $this->output->enable_profiler(FALSE) |
|
270 | + ->set_content_type('application/json') |
|
271 | + ->set_output(json_encode($json)); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | //-------------------------------------------------------------------- |
@@ -284,16 +284,16 @@ discard block |
||
284 | 284 | * @throws RenderException |
285 | 285 | * @return void |
286 | 286 | */ |
287 | - public function renderJS( $js = NULL ) |
|
287 | + public function renderJS($js = NULL) |
|
288 | 288 | { |
289 | - if ( ! is_string( $js ) ) |
|
289 | + if ( ! is_string($js)) |
|
290 | 290 | { |
291 | - throw new \RuntimeException( lang('bad_javascript') ); |
|
291 | + throw new \RuntimeException(lang('bad_javascript')); |
|
292 | 292 | } |
293 | 293 | |
294 | - $this->output->enable_profiler( FALSE ) |
|
295 | - ->set_content_type( 'application/x-javascript' ) |
|
296 | - ->set_output( $js ); |
|
294 | + $this->output->enable_profiler(FALSE) |
|
295 | + ->set_content_type('application/x-javascript') |
|
296 | + ->set_output($js); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | //-------------------------------------------------------------------- |
@@ -308,11 +308,11 @@ discard block |
||
308 | 308 | */ |
309 | 309 | public function renderRealtime() |
310 | 310 | { |
311 | - if ( ob_get_level() > 0 ) |
|
311 | + if (ob_get_level() > 0) |
|
312 | 312 | { |
313 | 313 | end_end_flush(); |
314 | 314 | } |
315 | - ob_implicit_flush( TRUE ); |
|
315 | + ob_implicit_flush(TRUE); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | //-------------------------------------------------------------------- |
@@ -326,21 +326,21 @@ discard block |
||
326 | 326 | * |
327 | 327 | * @param string $location [description] |
328 | 328 | */ |
329 | - public function ajaxRedirect( $location = '' ) |
|
329 | + public function ajaxRedirect($location = '') |
|
330 | 330 | { |
331 | - $location = empty( $location ) ? '/' : $location; |
|
331 | + $location = empty($location) ? '/' : $location; |
|
332 | 332 | |
333 | - if ( strpos( $location, '/' ) !== 0 || strpos( $location, '://' ) !== FALSE ) |
|
333 | + if (strpos($location, '/') !== 0 || strpos($location, '://') !== FALSE) |
|
334 | 334 | { |
335 | - if ( ! function_exists( 'site_url' ) ) |
|
335 | + if ( ! function_exists('site_url')) |
|
336 | 336 | { |
337 | - $this->load->helper( 'url' ); |
|
337 | + $this->load->helper('url'); |
|
338 | 338 | } |
339 | 339 | |
340 | - $location = site_url( $location ); |
|
340 | + $location = site_url($location); |
|
341 | 341 | } |
342 | 342 | |
343 | - $this->render_json( array( 'location' => $location ) ); |
|
343 | + $this->render_json(array('location' => $location)); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | //-------------------------------------------------------------------- |
@@ -355,11 +355,11 @@ discard block |
||
355 | 355 | * |
356 | 356 | * @return mixed The formatted JSON data, or NULL. |
357 | 357 | */ |
358 | - public function getJSON( $format = 'object', $depth = 512 ) |
|
358 | + public function getJSON($format = 'object', $depth = 512) |
|
359 | 359 | { |
360 | 360 | $as_array = $format == 'array' ? TRUE : FALSE; |
361 | 361 | |
362 | - return json_decode( file_get_contents( 'php://input' ), $as_array, $depth ); |
|
362 | + return json_decode(file_get_contents('php://input'), $as_array, $depth); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | //-------------------------------------------------------------------- |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | parent::__construct(); |
68 | 68 | |
69 | 69 | // Restrict usage to the command line. |
70 | - if (! is_cli() ) |
|
70 | + if ( ! is_cli()) |
|
71 | 71 | { |
72 | - show_error( lang('cli_required') ); |
|
72 | + show_error(lang('cli_required')); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | // Make sure the CLI library is loaded and ready. |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | public function index() |
86 | 86 | { |
87 | 87 | CLI::new_line(); |
88 | - CLI::write( lang('cli.available_commands') ); |
|
88 | + CLI::write(lang('cli.available_commands')); |
|
89 | 89 | |
90 | 90 | $this->sayDescriptions($this->descriptions); |
91 | 91 | |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @param null $method |
102 | 102 | */ |
103 | - public function describeMethod($method=null) |
|
103 | + public function describeMethod($method = null) |
|
104 | 104 | { |
105 | 105 | if (empty($this->descriptions[$method])) |
106 | 106 | { |
107 | - return CLI::error( lang('cli.bad_description') ); |
|
107 | + return CLI::error(lang('cli.bad_description')); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | CLI::write("\t{$this->descriptions[$method]}", 'yellow'); |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | |
113 | 113 | //-------------------------------------------------------------------- |
114 | 114 | |
115 | - public function longDescribeMethod($method=null) |
|
115 | + public function longDescribeMethod($method = null) |
|
116 | 116 | { |
117 | 117 | if (empty($this->long_descriptions[$method])) |
118 | 118 | { |
119 | - return CLI::error( lang('cli.no_help') ); |
|
119 | + return CLI::error(lang('cli.no_help')); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | CLI::write("\t{$this->long_descriptions[$method]}", 'yellow'); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $names = $this->padArray($names); |
139 | 139 | $syntaxes = $this->padArray($syntaxes); |
140 | 140 | |
141 | - for ($i=0; $i < count($names); $i++) |
|
141 | + for ($i = 0; $i < count($names); $i++) |
|
142 | 142 | { |
143 | 143 | $out = CLI::color($names[$i], 'yellow'); |
144 | 144 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @param int $extra // How many extra spaces to add at the end |
168 | 168 | * @return array |
169 | 169 | */ |
170 | - protected function padArray($array, $extra=2) |
|
170 | + protected function padArray($array, $extra = 2) |
|
171 | 171 | { |
172 | 172 | $max = max(array_map('strlen', $array)) + $extra; |
173 | 173 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | use Myth\Themers\MetaCollection; |
33 | 33 | use Zend\Escaper\Escaper; |
34 | 34 | |
35 | -require_once dirname(__FILE__) .'/../Themers/escape.php'; |
|
35 | +require_once dirname(__FILE__).'/../Themers/escape.php'; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * Class ThemedController |
@@ -122,10 +122,10 @@ discard block |
||
122 | 122 | $themer = config_item('active_themer'); |
123 | 123 | |
124 | 124 | if (empty($themer)) { |
125 | - throw new \RuntimeException( lang('no_themer') ); |
|
125 | + throw new \RuntimeException(lang('no_themer')); |
|
126 | 126 | } |
127 | 127 | |
128 | - $this->themer = new $themer( get_instance() ); |
|
128 | + $this->themer = new $themer(get_instance()); |
|
129 | 129 | |
130 | 130 | // Register our paths with the themer |
131 | 131 | $paths = config_item('theme.paths'); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | // Set our default theme. |
138 | - $this->themer->setDefaultTheme( config_item('theme.default_theme') ); |
|
138 | + $this->themer->setDefaultTheme(config_item('theme.default_theme')); |
|
139 | 139 | |
140 | 140 | // Register our variants with the engine. |
141 | 141 | $variants = config_item('theme.variants'); |
@@ -155,12 +155,12 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | // Load up our meta collection |
158 | - $this->meta = new MetaCollection( get_instance() ); |
|
158 | + $this->meta = new MetaCollection(get_instance()); |
|
159 | 159 | |
160 | 160 | // Should we autoescape vars? |
161 | 161 | if (is_null($this->auto_escape)) |
162 | 162 | { |
163 | - $this->auto_escape = config_item( 'theme.auto_escape' ); |
|
163 | + $this->auto_escape = config_item('theme.auto_escape'); |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | * @param array $data |
176 | 176 | * @param int $cache_time |
177 | 177 | */ |
178 | - public function render($data = array(), $cache_time=0) |
|
178 | + public function render($data = array(), $cache_time = 0) |
|
179 | 179 | { |
180 | 180 | if ($cache_time > 0) |
181 | 181 | { |
182 | - $this->output->cache( (int)$cache_time ); |
|
182 | + $this->output->cache((int) $cache_time); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | // Determine the correct theme to use |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $this->themer->setTheme($theme); |
188 | 188 | |
189 | 189 | // Determine the correct layout to use |
190 | - $layout = !empty($this->layout) ? $this->layout : null; |
|
190 | + $layout = ! empty($this->layout) ? $this->layout : null; |
|
191 | 191 | $this->themer->setLayout($layout); |
192 | 192 | |
193 | 193 | // Merge any saved vars into the data |
@@ -202,12 +202,12 @@ discard block |
||
202 | 202 | $data['html_meta'] = $this->meta; |
203 | 203 | |
204 | 204 | // Include our UIKit so views can use it |
205 | - if (! empty($this->uikit)) { |
|
205 | + if ( ! empty($this->uikit)) { |
|
206 | 206 | $data['uikit'] = $this->uikit; |
207 | 207 | } |
208 | 208 | |
209 | 209 | // Build our notices from the theme's view file. |
210 | - $data['notice'] = $this->themer->display($this->themer->theme() . ':notice', ["notice" => $this->message()]); |
|
210 | + $data['notice'] = $this->themer->display($this->themer->theme().':notice', ["notice" => $this->message()]); |
|
211 | 211 | |
212 | 212 | // Make sure any scripts/stylesheets are available to the view |
213 | 213 | $data['external_scripts'] = $this->external_scripts; |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * @param string $context |
239 | 239 | * @param bool $do_escape |
240 | 240 | */ |
241 | - public function setVar($name, $value = null, $context='html', $do_escape=null) |
|
241 | + public function setVar($name, $value = null, $context = 'html', $do_escape = null) |
|
242 | 242 | { |
243 | 243 | $escape = $do_escape == true ? true : $this->auto_escape; |
244 | 244 | |
@@ -276,9 +276,9 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public function setMessage($message = '', $type = 'info') |
278 | 278 | { |
279 | - if (! empty($message)) { |
|
279 | + if ( ! empty($message)) { |
|
280 | 280 | if (isset($this->session)) { |
281 | - $this->session->set_flashdata('message', $type . '::' . $message); |
|
281 | + $this->session->set_flashdata('message', $type.'::'.$message); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | $this->message = array( |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | if (empty($message) && class_exists('CI_Session')) { |
309 | 309 | $message = $this->session->flashdata('message'); |
310 | 310 | |
311 | - if (! empty($message)) { |
|
311 | + if ( ! empty($message)) { |
|
312 | 312 | // Split out our message parts |
313 | 313 | $temp_message = explode('::', $message); |
314 | 314 | $return['type'] = $temp_message[0]; |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | public function addScript($filename) |
374 | 374 | { |
375 | 375 | if (strpos($filename, 'http') === FALSE) { |
376 | - $filename = base_url() . 'assets/js/' . $filename; |
|
376 | + $filename = base_url().'assets/js/'.$filename; |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | $this->external_scripts[] = $filename; |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | public function addStyle($filename) |
388 | 388 | { |
389 | 389 | if (strpos($filename, 'http') === FALSE) { |
390 | - $filename = base_url() . 'assets/css/' . $filename; |
|
390 | + $filename = base_url().'assets/css/'.$filename; |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | $this->stylesheets[] = $filename; |
@@ -48,21 +48,21 @@ discard block |
||
48 | 48 | public static function schedule($alias, $time_string, $task) |
49 | 49 | { |
50 | 50 | // Valid Alias? |
51 | - if (! is_string($alias) || empty($alias)) |
|
51 | + if ( ! is_string($alias) || empty($alias)) |
|
52 | 52 | { |
53 | - throw new \RuntimeException( lang('cron.bad_alias') ); |
|
53 | + throw new \RuntimeException(lang('cron.bad_alias')); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | // Valid TimeString? |
57 | - if (! is_string($time_string) || empty($time_string)) |
|
57 | + if ( ! is_string($time_string) || empty($time_string)) |
|
58 | 58 | { |
59 | - throw new \RuntimeException( lang('cron.bad_timestring') ); |
|
59 | + throw new \RuntimeException(lang('cron.bad_timestring')); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // Valid Task? |
63 | - if (! is_callable($task) && ! is_string($task)) |
|
63 | + if ( ! is_callable($task) && ! is_string($task)) |
|
64 | 64 | { |
65 | - throw new \RuntimeException( lang('cron.bad_task') . $alias); |
|
65 | + throw new \RuntimeException(lang('cron.bad_task').$alias); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | static::$tasks[$alias] = new CronTask($time_string, $task); |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | * ... |
103 | 103 | * ] |
104 | 104 | */ |
105 | - public static function listAll($current_time='now') |
|
105 | + public static function listAll($current_time = 'now') |
|
106 | 106 | { |
107 | - if (! count(static::$tasks)) |
|
107 | + if ( ! count(static::$tasks)) |
|
108 | 108 | { |
109 | 109 | return null; |
110 | 110 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public static function task($alias) |
135 | 135 | { |
136 | - if (empty(static::$tasks[$alias]) ) |
|
136 | + if (empty(static::$tasks[$alias])) |
|
137 | 137 | { |
138 | 138 | return null; |
139 | 139 | } |
@@ -168,13 +168,13 @@ discard block |
||
168 | 168 | * @param string $current_time |
169 | 169 | * @return string |
170 | 170 | */ |
171 | - public static function run($alias=null, $force_run=false, $current_time='now') |
|
171 | + public static function run($alias = null, $force_run = false, $current_time = 'now') |
|
172 | 172 | { |
173 | 173 | $tasks = static::$tasks; |
174 | 174 | |
175 | - if (! empty($alias) && isset($tasks[$alias])) |
|
175 | + if ( ! empty($alias) && isset($tasks[$alias])) |
|
176 | 176 | { |
177 | - $tasks = [$alias => $tasks[$alias] ]; |
|
177 | + $tasks = [$alias => $tasks[$alias]]; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | $output = ''; |
@@ -185,34 +185,34 @@ discard block |
||
185 | 185 | { |
186 | 186 | if ($task->isDue($current_time) || $force_run === true) |
187 | 187 | { |
188 | - $output .= sprintf( lang('cron.running_task'), $alias); |
|
188 | + $output .= sprintf(lang('cron.running_task'), $alias); |
|
189 | 189 | |
190 | 190 | try { |
191 | 191 | $result = self::runTask($alias); |
192 | 192 | |
193 | 193 | if (is_bool($result)) |
194 | 194 | { |
195 | - $output .= $result === true ? lang('done') ."\n" : lang('failed') ."\n"; |
|
195 | + $output .= $result === true ? lang('done')."\n" : lang('failed')."\n"; |
|
196 | 196 | } |
197 | 197 | else if (is_string($result)) |
198 | 198 | { |
199 | - $output .= sprintf( lang('cron.done_with_msg'), $result); |
|
199 | + $output .= sprintf(lang('cron.done_with_msg'), $result); |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | catch (\Exception $e) |
203 | 203 | { |
204 | - $output .= "[Exception] ". $e->getMessage() ."\n"; |
|
204 | + $output .= "[Exception] ".$e->getMessage()."\n"; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | $count++; |
208 | 208 | } |
209 | 209 | else |
210 | 210 | { |
211 | - $output .= sprintf( lang('cron.not_scheduled_until'), $alias, $task->nextRunDate() ); |
|
211 | + $output .= sprintf(lang('cron.not_scheduled_until'), $alias, $task->nextRunDate()); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | |
215 | - if (! $count) |
|
215 | + if ( ! $count) |
|
216 | 216 | { |
217 | 217 | $output .= lang('cron.nothing_scheduled'); |
218 | 218 | } |
@@ -270,10 +270,10 @@ discard block |
||
270 | 270 | $class = new $class(); |
271 | 271 | } else { |
272 | 272 | get_instance()->load->library($class); |
273 | - $class =& get_instance()->$class; |
|
273 | + $class = & get_instance()->$class; |
|
274 | 274 | } |
275 | 275 | |
276 | - if (! method_exists($class, $method)) { |
|
276 | + if ( ! method_exists($class, $method)) { |
|
277 | 277 | log_message('error', "[CRON] Method not found: {$class}::{$method}"); |
278 | 278 | return $success; |
279 | 279 | } |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | |
76 | 76 | // If $task is not callable, it should be a library:method |
77 | 77 | // string that we can parse. But it must have the colon in the string. |
78 | - if (! is_callable($task) && strpos($task, ':') === false) |
|
78 | + if ( ! is_callable($task) && strpos($task, ':') === false) |
|
79 | 79 | { |
80 | - throw new \RuntimeException( lang('cron.invalid_task') ); |
|
80 | + throw new \RuntimeException(lang('cron.invalid_task')); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | $this->task = $task; |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @return timestamp|null |
94 | 94 | */ |
95 | - public function nextRunDate($current_time='now') |
|
95 | + public function nextRunDate($current_time = 'now') |
|
96 | 96 | { |
97 | - $current_time = is_numeric($current_time) ? (int)$current_time : strtotime($current_time); |
|
97 | + $current_time = is_numeric($current_time) ? (int) $current_time : strtotime($current_time); |
|
98 | 98 | |
99 | 99 | $scheduleType = $this->determineScheduleType($this->schedule); |
100 | 100 | |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return timestamp|null |
125 | 125 | */ |
126 | - public function previousRunDate($current_time='now') |
|
126 | + public function previousRunDate($current_time = 'now') |
|
127 | 127 | { |
128 | - $current_time = is_numeric($current_time) ? (int)$current_time : strtotime($current_time); |
|
128 | + $current_time = is_numeric($current_time) ? (int) $current_time : strtotime($current_time); |
|
129 | 129 | |
130 | 130 | $scheduleType = $this->determineScheduleType($this->schedule); |
131 | 131 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | return $this->findPreviousOrdinal($this->schedule, $current_time); |
139 | 139 | break; |
140 | 140 | case 'increment': |
141 | - return strtotime('-1 '. $this->schedule, $current_time); |
|
141 | + return strtotime('-1 '.$this->schedule, $current_time); |
|
142 | 142 | break; |
143 | 143 | } |
144 | 144 | |
@@ -155,13 +155,13 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @return bool |
157 | 157 | */ |
158 | - public function isDue($current_time='now') |
|
158 | + public function isDue($current_time = 'now') |
|
159 | 159 | { |
160 | - $current_time = is_numeric($current_time) ? (int)$current_time : strtotime($current_time); |
|
160 | + $current_time = is_numeric($current_time) ? (int) $current_time : strtotime($current_time); |
|
161 | 161 | |
162 | 162 | // For easier matching, and I can't imagine people needing cronjob |
163 | 163 | // accuracy to the seconds, we'll just take the current minute. |
164 | - return date('Y-m-d H:i', $current_time) == date('Y-m-d H:i', $this->nextRunDate($current_time) ); |
|
164 | + return date('Y-m-d H:i', $current_time) == date('Y-m-d H:i', $this->nextRunDate($current_time)); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | //-------------------------------------------------------------------- |
@@ -219,15 +219,15 @@ discard block |
||
219 | 219 | { |
220 | 220 | $incs = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sun', 'mon', 'tue', |
221 | 221 | 'wed', 'thu', 'fri', 'sat', 'weekday', 'weekdays', 'midnight', 'noon']; |
222 | - $bigger_incs = [ 'back of', 'front of', 'first day of', 'last day of']; |
|
222 | + $bigger_incs = ['back of', 'front of', 'first day of', 'last day of']; |
|
223 | 223 | $ordinals = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth', 'eleventh', 'twelfth']; |
224 | - $schedule = trim( strtolower($schedule) ); |
|
224 | + $schedule = trim(strtolower($schedule)); |
|
225 | 225 | |
226 | 226 | $multiple_words = strpos($schedule, ' '); |
227 | 227 | $first_word = substr($schedule, 0, $multiple_words ? $multiple_words : strlen($schedule)); |
228 | 228 | |
229 | 229 | // Is the first character a number? Then it's a time |
230 | - if ( is_numeric( $first_word ) ) |
|
230 | + if (is_numeric($first_word)) |
|
231 | 231 | { |
232 | 232 | return 'time'; |
233 | 233 | } |
@@ -269,9 +269,9 @@ discard block |
||
269 | 269 | * @param $type |
270 | 270 | * @return float|int|null |
271 | 271 | */ |
272 | - public function findDateInterval($schedule, $type, $current_time='now') |
|
272 | + public function findDateInterval($schedule, $type, $current_time = 'now') |
|
273 | 273 | { |
274 | - $current_time = is_numeric($current_time) ? (int)$current_time : strtotime($current_time); |
|
274 | + $current_time = is_numeric($current_time) ? (int) $current_time : strtotime($current_time); |
|
275 | 275 | |
276 | 276 | // list($int, $period) = explode(' ', $schedule); |
277 | 277 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | if (is_numeric($return)) |
303 | 303 | { |
304 | - $return = (int)$return; |
|
304 | + $return = (int) $return; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | return $return; |
@@ -317,9 +317,9 @@ discard block |
||
317 | 317 | * @param string $current_time |
318 | 318 | * @return int|null |
319 | 319 | */ |
320 | - public function findPreviousOrdinal($schedule, $current_time='now') |
|
320 | + public function findPreviousOrdinal($schedule, $current_time = 'now') |
|
321 | 321 | { |
322 | - $current_time = is_numeric($current_time) ? (int)$current_time : strtotime($current_time); |
|
322 | + $current_time = is_numeric($current_time) ? (int) $current_time : strtotime($current_time); |
|
323 | 323 | |
324 | 324 | if (empty($schedule)) return null; |
325 | 325 |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | public function __construct($config = array()) |
88 | 88 | { |
89 | - $this->apppath = ! empty($config['apppath']) ? rtrim($config['apppath'], '/') . '/' : ''; |
|
89 | + $this->apppath = ! empty($config['apppath']) ? rtrim($config['apppath'], '/').'/' : ''; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | //-------------------------------------------------------------------- |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | try { |
160 | - $xml = new \SimpleXMLElement('<?xml version="1.0" standalone="yes"?><div>' . $content . '</div>'); |
|
160 | + $xml = new \SimpleXMLElement('<?xml version="1.0" standalone="yes"?><div>'.$content.'</div>'); |
|
161 | 161 | } catch (\Exception $e) { |
162 | 162 | // SimpleXML barfed on us, so send back the un-modified content |
163 | 163 | return $content; |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | // Prepare some things and cleanup others |
167 | 167 | $groups = array_keys($this->doc_folders); |
168 | - $site_url = rtrim($site_url, '/') . '/'; |
|
168 | + $site_url = rtrim($site_url, '/').'/'; |
|
169 | 169 | $current_url = rtrim($current_url, '#/'); |
170 | 170 | |
171 | 171 | // Try to determine the current_url if one isn't set. |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $content = trim(str_replace('<?xml version="1.0" standalone="yes"?>', '', $content)); |
185 | 185 | |
186 | 186 | // Clean up and style the tables |
187 | - $content = str_replace('<table>', '<table class="' . $this->table_classes . '">', $content); |
|
187 | + $content = str_replace('<table>', '<table class="'.$this->table_classes.'">', $content); |
|
188 | 188 | |
189 | 189 | return $content; |
190 | 190 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | } |
237 | 237 | |
238 | 238 | try { |
239 | - $xml = new \SimpleXMLElement('<?xml version="1.0" standalone="yes"?><div>' . $content . '</div>'); |
|
239 | + $xml = new \SimpleXMLElement('<?xml version="1.0" standalone="yes"?><div>'.$content.'</div>'); |
|
240 | 240 | } catch (\Exception $e) { |
241 | 241 | // SimpleXML barfed on us, so send back the un-modified content |
242 | 242 | return []; |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | |
267 | 267 | $this->formatters[] = [ |
268 | 268 | 'callable' => $callback, |
269 | - 'cascade' => (bool)$cascade |
|
269 | + 'cascade' => (bool) $cascade |
|
270 | 270 | ]; |
271 | 271 | |
272 | 272 | return $this; |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | */ |
283 | 283 | public function format($str) |
284 | 284 | { |
285 | - if (! is_array($this->formatters)) return $str; |
|
285 | + if ( ! is_array($this->formatters)) return $str; |
|
286 | 286 | |
287 | 287 | foreach ($this->formatters as $formatter) { |
288 | 288 | $method = $formatter['callable']; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | |
291 | 291 | $str = call_user_func($method, $str); |
292 | 292 | |
293 | - if (! $cascade) return $str; |
|
293 | + if ( ! $cascade) return $str; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | return $str; |
@@ -334,14 +334,14 @@ discard block |
||
334 | 334 | // Module docs need $this->current_group and $type. |
335 | 335 | $tocRoot = $this->current_folder; |
336 | 336 | if ($this->current_folder != strtolower($folder)) { |
337 | - $tocRoot .= '/' . strtolower($folder); |
|
337 | + $tocRoot .= '/'.strtolower($folder); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | $toc = []; |
341 | 341 | foreach ($map as $files) { |
342 | 342 | // If $files isn't an array, then make it one so that all situations |
343 | 343 | // may be dealt with cleanly. |
344 | - if (! is_array($files)) { |
|
344 | + if ( ! is_array($files)) { |
|
345 | 345 | $files = [$files]; |
346 | 346 | } |
347 | 347 | |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | $sizes[] = count($chapters); |
390 | 390 | } |
391 | 391 | |
392 | - $column_avg = (int)round(array_sum($sizes) / $section_count); |
|
392 | + $column_avg = (int) round(array_sum($sizes) / $section_count); |
|
393 | 393 | |
394 | 394 | // Split things into 4 columns of approximately equal size. |
395 | 395 | // If we only have 4 columns (or less), then make sure to |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | $keys = array_keys($toc); |
402 | 402 | |
403 | 403 | for ($i = 0; $i <= $section_count; $i++) { |
404 | - if (! isset($keys[$i])) { |
|
404 | + if ( ! isset($keys[$i])) { |
|
405 | 405 | continue; |
406 | 406 | } |
407 | 407 | |
@@ -450,11 +450,11 @@ discard block |
||
450 | 450 | public function addDocFolder($name, $path) |
451 | 451 | { |
452 | 452 | // Standardize the path |
453 | - $path = realpath($path) . '/'; |
|
453 | + $path = realpath($path).'/'; |
|
454 | 454 | |
455 | 455 | // realpath will return FALSE if the path doesn't exist |
456 | 456 | // or the script doesn't have access to it. |
457 | - if (! $path || $path == '/') { |
|
457 | + if ( ! $path || $path == '/') { |
|
458 | 458 | return $this; |
459 | 459 | } |
460 | 460 | |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | */ |
502 | 502 | protected function detectCurrentFolder($current_url, $groups = []) |
503 | 503 | { |
504 | - if (! is_array($groups)) { |
|
504 | + if ( ! is_array($groups)) { |
|
505 | 505 | return null; |
506 | 506 | } |
507 | 507 | |
@@ -549,9 +549,9 @@ discard block |
||
549 | 549 | { |
550 | 550 | $folders = $this->doc_folders; |
551 | 551 | |
552 | - if (! is_null($restrictToFolder)) { |
|
552 | + if ( ! is_null($restrictToFolder)) { |
|
553 | 553 | // Make sure the folder exists |
554 | - if (! is_null($restrictToFolder) && ! isset($this->doc_folders[$restrictToFolder])) { |
|
554 | + if ( ! is_null($restrictToFolder) && ! isset($this->doc_folders[$restrictToFolder])) { |
|
555 | 555 | throw new \RuntimeException('You must add the docs folder that you wish to find docs from.'); |
556 | 556 | } |
557 | 557 | |
@@ -559,11 +559,11 @@ discard block |
||
559 | 559 | } |
560 | 560 | |
561 | 561 | foreach ($folders as $alias => $folder) { |
562 | - if (file_exists($folder . $path . $this->docs_ext)) { |
|
562 | + if (file_exists($folder.$path.$this->docs_ext)) { |
|
563 | 563 | // Store the alias so we know which folder we're in. |
564 | 564 | $this->current_folder = $alias; |
565 | 565 | |
566 | - return file_get_contents($folder . $path . $this->docs_ext); |
|
566 | + return file_get_contents($folder.$path.$this->docs_ext); |
|
567 | 567 | } |
568 | 568 | } |
569 | 569 | |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | $href = $link->attributes()->href; |
587 | 587 | |
588 | 588 | // If the href is null, it's probably a named anchor with no content. |
589 | - if (! $href) { |
|
589 | + if ( ! $href) { |
|
590 | 590 | // Make sure it has an href, else the XML will not close this |
591 | 591 | // tag correctly. |
592 | 592 | $link['href'] = ' '; |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | |
600 | 600 | // If the href starts with #, then attach the current_url to it |
601 | 601 | if ($href != '' && substr_compare($href, '#', 0, 1) === 0) { |
602 | - $link['href'] = $current_url . $href; |
|
602 | + $link['href'] = $current_url.$href; |
|
603 | 603 | |
604 | 604 | return $link; |
605 | 605 | } |
@@ -637,13 +637,13 @@ discard block |
||
637 | 637 | } |
638 | 638 | } |
639 | 639 | |
640 | - if (! $group_found) { |
|
641 | - $href = $this->current_folder . '/' . $href; |
|
640 | + if ( ! $group_found) { |
|
641 | + $href = $this->current_folder.'/'.$href; |
|
642 | 642 | } |
643 | 643 | |
644 | 644 | // Convert to full site_url |
645 | 645 | if (strpos($href, 'http') !== 0) { |
646 | - $href = $site_url . 'docs/' . ltrim($href, '/ '); |
|
646 | + $href = $site_url.'docs/'.ltrim($href, '/ '); |
|
647 | 647 | } |
648 | 648 | |
649 | 649 | // Save the corrected href |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | // our page title. |
679 | 679 | if ($childType == 'h1' && empty($this->page_title)) |
680 | 680 | { |
681 | - $this->page_title = (string)$line; |
|
681 | + $this->page_title = (string) $line; |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | // Make sure that our current object is |
@@ -691,39 +691,39 @@ discard block |
||
691 | 691 | } |
692 | 692 | |
693 | 693 | if ($childType == 'h2') { |
694 | - $name = (string)$line; |
|
695 | - $link = strtolower(str_replace(' ', '_', (string)$line)); |
|
694 | + $name = (string) $line; |
|
695 | + $link = strtolower(str_replace(' ', '_', (string) $line)); |
|
696 | 696 | |
697 | 697 | $current_obj['name'] = $name; |
698 | - $current_obj['link'] = '#' . $link; |
|
698 | + $current_obj['link'] = '#'.$link; |
|
699 | 699 | $current_obj['items'] = []; |
700 | 700 | |
701 | 701 | // Insert a named anchor into the $content |
702 | - $anchor = '<a name="' . $link . '" id="' . $link . '" ></a>'; |
|
702 | + $anchor = '<a name="'.$link.'" id="'.$link.'" ></a>'; |
|
703 | 703 | |
704 | 704 | $search = "<h2>{$name}</h2>"; |
705 | 705 | |
706 | - $content = str_replace($search, $anchor . $search, $content); |
|
706 | + $content = str_replace($search, $anchor.$search, $content); |
|
707 | 707 | } elseif ($childType == 'h3') { |
708 | 708 | // Make sure we have some place to store the items. |
709 | - if (! isset($current_obj['items'])) { |
|
709 | + if ( ! isset($current_obj['items'])) { |
|
710 | 710 | $current_obj['items'] = []; |
711 | 711 | } |
712 | 712 | |
713 | - $link = strtolower(str_replace(' ', '_', (string)$line)); |
|
714 | - $name = (string)$line; |
|
713 | + $link = strtolower(str_replace(' ', '_', (string) $line)); |
|
714 | + $name = (string) $line; |
|
715 | 715 | |
716 | 716 | $current_obj['items'][] = [ |
717 | 717 | 'name' => $name, |
718 | - 'link' => '#' . $link |
|
718 | + 'link' => '#'.$link |
|
719 | 719 | ]; |
720 | 720 | |
721 | 721 | // Insert a named anchor into the $content |
722 | - $anchor = '<a name="' . $link . '" id="' . $link . '" ></a>'; |
|
722 | + $anchor = '<a name="'.$link.'" id="'.$link.'" ></a>'; |
|
723 | 723 | |
724 | 724 | $search = "<h3>{$name}</h3>"; |
725 | 725 | |
726 | - $content = str_replace($search, $anchor . $search, $content); |
|
726 | + $content = str_replace($search, $anchor.$search, $content); |
|
727 | 727 | } |
728 | 728 | |
729 | 729 | // Is this the last element? Then close out our current object. |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | if ($fp = @opendir($source_dir)) { |
756 | 756 | $filedata = array(); |
757 | 757 | $new_depth = $directory_depth - 1; |
758 | - $source_dir = rtrim($source_dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
|
758 | + $source_dir = rtrim($source_dir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; |
|
759 | 759 | |
760 | 760 | while (FALSE !== ($file = readdir($fp))) { |
761 | 761 | // Remove '.', '..', and hidden files [optional] |
@@ -763,10 +763,10 @@ discard block |
||
763 | 763 | continue; |
764 | 764 | } |
765 | 765 | |
766 | - is_dir($source_dir . $file) && $file .= DIRECTORY_SEPARATOR; |
|
766 | + is_dir($source_dir.$file) && $file .= DIRECTORY_SEPARATOR; |
|
767 | 767 | |
768 | - if (($directory_depth < 1 OR $new_depth > 0) && is_dir($source_dir . $file)) { |
|
769 | - $filedata[$file] = directory_map($source_dir . $file, $new_depth, $hidden); |
|
768 | + if (($directory_depth < 1 OR $new_depth > 0) && is_dir($source_dir.$file)) { |
|
769 | + $filedata[$file] = directory_map($source_dir.$file, $new_depth, $hidden); |
|
770 | 770 | } else { |
771 | 771 | $filedata[] = $file; |
772 | 772 | } |
@@ -54,7 +54,7 @@ |
||
54 | 54 | * @param bool $cascade // If FALSE the formatting of a component ends here. If TRUE, will be passed to next formatter. |
55 | 55 | * @return $this |
56 | 56 | */ |
57 | - public function registerFormatter($callback_name='', $cascade=false); |
|
57 | + public function registerFormatter($callback_name = '', $cascade = false); |
|
58 | 58 | |
59 | 59 | //-------------------------------------------------------------------- |
60 | 60 |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $map = $this->flattenMap($map); |
148 | 148 | |
149 | 149 | // Make sure we have something to work with. |
150 | - if (! is_array($map) || (is_array($map) && ! count($map))) { |
|
150 | + if ( ! is_array($map) || (is_array($map) && ! count($map))) { |
|
151 | 151 | return []; |
152 | 152 | } |
153 | 153 | |
@@ -161,16 +161,16 @@ discard block |
||
161 | 161 | |
162 | 162 | // Is it a folder? |
163 | 163 | if (is_array($file) && count($file)) { |
164 | - $results = array_merge($results, $this->searchFolder($term, $folder . '/' . $dir, $group_name)); |
|
164 | + $results = array_merge($results, $this->searchFolder($term, $folder.'/'.$dir, $group_name)); |
|
165 | 165 | continue; |
166 | 166 | } |
167 | 167 | |
168 | 168 | // Make sure it's the right file type... |
169 | - if (! preg_match("/({$this->allowed_file_types})/i", $file)) { |
|
169 | + if ( ! preg_match("/({$this->allowed_file_types})/i", $file)) { |
|
170 | 170 | continue; |
171 | 171 | } |
172 | 172 | |
173 | - $path = is_string($dir) ? $folder . '/' . $dir . '/' . $file : $folder . '/' . $file; |
|
173 | + $path = is_string($dir) ? $folder.'/'.$dir.'/'.$file : $folder.'/'.$file; |
|
174 | 174 | $term_html = htmlentities($term); |
175 | 175 | |
176 | 176 | // Read in the file text |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | // Do we have a match in here somewhere? |
181 | 181 | $found = stristr($text, $term) || stristr($text, $term_html); |
182 | 182 | |
183 | - if (! $found) { |
|
183 | + if ( ! $found) { |
|
184 | 184 | continue; |
185 | 185 | } |
186 | 186 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | if ($file_count >= $this->max_per_file) { |
203 | 203 | continue; |
204 | 204 | } |
205 | - $result_url = '/docs/' . $group_name . '/' . str_replace('.md', '', $file); |
|
205 | + $result_url = '/docs/'.$group_name.'/'.str_replace('.md', '', $file); |
|
206 | 206 | |
207 | 207 | foreach ($this->doc_folders as $alias => $folder) { |
208 | 208 | $result_url = str_replace($folder, $alias, $result_url); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | |
211 | 211 | $results[] = [ |
212 | 212 | 'title' => $this->extractTitle($excerpt, $file), |
213 | - 'file' => $folder . '/' . $file, |
|
213 | + 'file' => $folder.'/'.$file, |
|
214 | 214 | 'url' => $result_url, |
215 | 215 | 'extract' => $this->buildExtract($excerpt, $term, $match[0][0]) |
216 | 216 | ]; |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function format($str) |
256 | 256 | { |
257 | - if (! is_array($this->formatters)) return $str; |
|
257 | + if ( ! is_array($this->formatters)) return $str; |
|
258 | 258 | |
259 | 259 | foreach ($this->formatters as $formatter) { |
260 | 260 | $method = key($formatter); |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | |
263 | 263 | $str = call_user_func($method, $str); |
264 | 264 | |
265 | - if (! $cascade) return $str; |
|
265 | + if ( ! $cascade) return $str; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | return $str; |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | */ |
286 | 286 | protected function flattenMap($map, $prefix = '') |
287 | 287 | { |
288 | - if (! is_array($map) || ! count($map)) { |
|
288 | + if ( ! is_array($map) || ! count($map)) { |
|
289 | 289 | return $map; |
290 | 290 | } |
291 | 291 | |
@@ -296,12 +296,12 @@ discard block |
||
296 | 296 | // If it's a folder name and an array of files |
297 | 297 | // then call this method recursively to flatten it out. |
298 | 298 | if (is_array($files)) { |
299 | - $return = array_merge($return, $this->flattenMap($files, $prefix . $folder)); |
|
299 | + $return = array_merge($return, $this->flattenMap($files, $prefix.$folder)); |
|
300 | 300 | continue; |
301 | 301 | } |
302 | 302 | |
303 | 303 | // Else, add our prefix (if any) to the filename... |
304 | - $return[] = $prefix . $files; |
|
304 | + $return[] = $prefix.$files; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | return $return; |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | $extract = $this->firstXWords($extract, $this->excerpt_length); |
341 | 341 | |
342 | 342 | // Wrap the search term in a span we can style. |
343 | - $extract = str_ireplace($term, '<span class="term-hilight">' . $term . '</span>', $extract); |
|
343 | + $extract = str_ireplace($term, '<span class="term-hilight">'.$term.'</span>', $extract); |
|
344 | 344 | |
345 | 345 | return $extract; |
346 | 346 | } |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | if ($fp = @opendir($source_dir)) { |
401 | 401 | $filedata = array(); |
402 | 402 | $new_depth = $directory_depth - 1; |
403 | - $source_dir = rtrim($source_dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
|
403 | + $source_dir = rtrim($source_dir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; |
|
404 | 404 | |
405 | 405 | while (FALSE !== ($file = readdir($fp))) { |
406 | 406 | // Remove '.', '..', and hidden files [optional] |
@@ -408,11 +408,11 @@ discard block |
||
408 | 408 | continue; |
409 | 409 | } |
410 | 410 | |
411 | - is_dir($source_dir . $file) && $file .= DIRECTORY_SEPARATOR; |
|
411 | + is_dir($source_dir.$file) && $file .= DIRECTORY_SEPARATOR; |
|
412 | 412 | |
413 | - if (($directory_depth < 1 OR $new_depth > 0) && is_dir($source_dir . $file)) |
|
413 | + if (($directory_depth < 1 OR $new_depth > 0) && is_dir($source_dir.$file)) |
|
414 | 414 | { |
415 | - $filedata[$file] = $this->directory_map($source_dir . $file, $new_depth, $hidden); |
|
415 | + $filedata[$file] = $this->directory_map($source_dir.$file, $new_depth, $hidden); |
|
416 | 416 | } else |
417 | 417 | { |
418 | 418 | // Replace the directory separator here with a forward slash since |