@@ -115,6 +115,9 @@ discard block |
||
| 115 | 115 | protected $trace = []; |
| 116 | 116 | protected $errors = []; |
| 117 | 117 | |
| 118 | + /** |
|
| 119 | + * @param string[] $a |
|
| 120 | + */ |
|
| 118 | 121 | public function trace_enter($a) |
| 119 | 122 | { |
| 120 | 123 | array_unshift($this->trace, $a); |
@@ -205,6 +208,9 @@ discard block |
||
| 205 | 208 | return $rc; |
| 206 | 209 | } |
| 207 | 210 | |
| 211 | + /** |
|
| 212 | + * @return string |
|
| 213 | + */ |
|
| 208 | 214 | public function get_file() |
| 209 | 215 | { |
| 210 | 216 | foreach ($this->trace as $trace) |
@@ -233,6 +239,9 @@ discard block |
||
| 233 | 239 | |
| 234 | 240 | protected $templates = []; |
| 235 | 241 | |
| 242 | + /** |
|
| 243 | + * @param string $name |
|
| 244 | + */ |
|
| 236 | 245 | public function addTemplate($name, $template) |
| 237 | 246 | { |
| 238 | 247 | if (isset($this->templates[$name])) |
@@ -317,7 +326,7 @@ discard block |
||
| 317 | 326 | /** |
| 318 | 327 | * Calls a template. |
| 319 | 328 | * |
| 320 | - * @param $name |
|
| 329 | + * @param string $name |
|
| 321 | 330 | * @param array $args |
| 322 | 331 | * |
| 323 | 332 | * @return string |
@@ -376,6 +385,9 @@ discard block |
||
| 376 | 385 | ** |
| 377 | 386 | */ |
| 378 | 387 | |
| 388 | + /** |
|
| 389 | + * @return Node[] |
|
| 390 | + */ |
|
| 379 | 391 | protected function get_compiled($template) |
| 380 | 392 | { |
| 381 | 393 | static $compiler; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @param string $expression |
| 88 | 88 | * @param bool $silent |
| 89 | 89 | */ |
| 90 | - public function evaluate($expression, $silent=false, $context=null) |
|
| 90 | + public function evaluate($expression, $silent = false, $context = null) |
|
| 91 | 91 | { |
| 92 | 92 | $evaluator = $this->evaluator; |
| 93 | 93 | |
@@ -125,11 +125,11 @@ discard block |
||
| 125 | 125 | array_shift($this->trace); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - public function error($alert, array $args=[]) |
|
| 128 | + public function error($alert, array $args = []) |
|
| 129 | 129 | { |
| 130 | 130 | if ($alert instanceof \ICanBoogie\Exception\Config) |
| 131 | 131 | { |
| 132 | - $this->errors[] = '<div class="alert alert-danger">' . $alert->getMessage() . '</div>'; |
|
| 132 | + $this->errors[] = '<div class="alert alert-danger">'.$alert->getMessage().'</div>'; |
|
| 133 | 133 | |
| 134 | 134 | return; |
| 135 | 135 | } |
@@ -166,12 +166,12 @@ discard block |
||
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - $trace_html .= sprintf('#%02d: in %s "%s"', $i--, $which, $message) . '<br />'; |
|
| 169 | + $trace_html .= sprintf('#%02d: in %s "%s"', $i--, $which, $message).'<br />'; |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | if ($trace_html) |
| 173 | 173 | { |
| 174 | - $trace_html = '<pre>' . $trace_html . '</pre>'; |
|
| 174 | + $trace_html = '<pre>'.$trace_html.'</pre>'; |
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | # |
| 180 | 180 | # |
| 181 | 181 | |
| 182 | - $this->errors[] = '<div class="alert alert-danger">' . $alert . $trace_html . '</div>'; |
|
| 182 | + $this->errors[] = '<div class="alert alert-danger">'.$alert.$trace_html.'</div>'; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | public function handle_exception(\Exception $e) |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | $tries = []; |
| 281 | - $template_pathname = $template_resolver->resolve($name, [ '.patron', '.html' ], $tries); |
|
| 281 | + $template_pathname = $template_resolver->resolve($name, ['.patron', '.html'], $tries); |
|
| 282 | 282 | |
| 283 | 283 | if ($template_pathname) |
| 284 | 284 | { |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | $template_name = TemplateName::from($name); |
| 289 | - $template_pathname = $template_resolver->resolve($template_name->as_partial, [ '.patron', '.html' ], $tries); |
|
| 289 | + $template_pathname = $template_resolver->resolve($template_name->as_partial, ['.patron', '.html'], $tries); |
|
| 290 | 290 | |
| 291 | 291 | if ($template_pathname) |
| 292 | 292 | { |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | $content = file_get_contents($pathname); |
| 302 | 302 | $nodes = $this->get_compiled($content); |
| 303 | 303 | |
| 304 | - return new Template($nodes, [ 'file' => $pathname ]); |
|
| 304 | + return new Template($nodes, ['file' => $pathname]); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | protected function get_template($name) |
@@ -322,14 +322,14 @@ discard block |
||
| 322 | 322 | * |
| 323 | 323 | * @return string |
| 324 | 324 | */ |
| 325 | - public function callTemplate($name, array $args=[]) |
|
| 325 | + public function callTemplate($name, array $args = []) |
|
| 326 | 326 | { |
| 327 | 327 | $template = $this->get_template($name); |
| 328 | 328 | |
| 329 | 329 | if (!$template) |
| 330 | 330 | { |
| 331 | 331 | $er = 'Unknown template %name'; |
| 332 | - $params = [ '%name' => $name ]; |
|
| 332 | + $params = ['%name' => $name]; |
|
| 333 | 333 | |
| 334 | 334 | if ($this->templates) |
| 335 | 335 | { |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | return null; |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - $this->trace_enter([ 'template', $name, $template ]); |
|
| 345 | + $this->trace_enter(['template', $name, $template]); |
|
| 346 | 346 | |
| 347 | 347 | $this->context['self']['arguments'] = $args; |
| 348 | 348 | |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | protected function init_context() |
| 367 | 367 | { |
| 368 | - $this->context = new \BlueTihi\Context([ 'self' => null, 'this' => null ]); |
|
| 368 | + $this->context = new \BlueTihi\Context(['self' => null, 'this' => null]); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | /* |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | return $compiler($template); |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - public function __invoke($template, $bind=null, array $options=[]) |
|
| 391 | + public function __invoke($template, $bind = null, array $options = []) |
|
| 392 | 392 | { |
| 393 | 393 | if (!$template) |
| 394 | 394 | { |
@@ -448,12 +448,12 @@ discard block |
||
| 448 | 448 | $template = $this->get_compiled($template); |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | - $template = new Template($template, [ 'file' => $file ]); |
|
| 451 | + $template = new Template($template, ['file' => $file]); |
|
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | if ($template->file) |
| 455 | 455 | { |
| 456 | - $this->trace_enter([ 'file', $template->file ]); |
|
| 456 | + $this->trace_enter(['file', $template->file]); |
|
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | $rc = ''; |
@@ -264,6 +264,10 @@ |
||
| 264 | 264 | return $parts; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | + /** |
|
| 268 | + * @param string $expression |
|
| 269 | + * @param boolean $silent |
|
| 270 | + */ |
|
| 267 | 271 | protected function evaluate($context, $expression, $tokens, $silent) |
| 268 | 272 | { |
| 269 | 273 | $expression_path = []; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | if ($str{0} == '@') |
| 67 | 67 | { |
| 68 | - $str = 'this.' . substr($str, 1); |
|
| 68 | + $str = 'this.'.substr($str, 1); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $str .= '.'; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | $parts = []; |
| 86 | 86 | |
| 87 | - for ($i = 0 ; $i < $length ; $i++) |
|
| 87 | + for ($i = 0; $i < $length; $i++) |
|
| 88 | 88 | { |
| 89 | 89 | $c = $str{$i}; |
| 90 | 90 | |
@@ -280,8 +280,7 @@ discard block |
||
| 280 | 280 | { |
| 281 | 281 | if (!is_array($context) && !is_object($context)) |
| 282 | 282 | { |
| 283 | - throw new \InvalidArgumentException(\ICanBoogie\format |
|
| 284 | - ( |
|
| 283 | + throw new \InvalidArgumentException(\ICanBoogie\format( |
|
| 285 | 284 | 'Unexpected variable type: %type (%value) for %identifier in expression %expression, should be either an array or an object', [ |
| 286 | 285 | |
| 287 | 286 | '%type' => gettype($context), |
@@ -325,7 +324,7 @@ discard block |
||
| 325 | 324 | |
| 326 | 325 | if ($args_evaluate) |
| 327 | 326 | { |
| 328 | - $this->engine->error('we should evaluate %eval', [ '%eval' => $args_evaluate ]); |
|
| 327 | + $this->engine->error('we should evaluate %eval', ['%eval' => $args_evaluate]); |
|
| 329 | 328 | } |
| 330 | 329 | |
| 331 | 330 | # |
@@ -334,7 +333,7 @@ discard block |
||
| 334 | 333 | |
| 335 | 334 | if (is_object($context) && method_exists($context, $method)) |
| 336 | 335 | { |
| 337 | - $context = call_user_func_array([ $context, $method ], $args); |
|
| 336 | + $context = call_user_func_array([$context, $method], $args); |
|
| 338 | 337 | |
| 339 | 338 | break; |
| 340 | 339 | } |
@@ -355,24 +354,24 @@ discard block |
||
| 355 | 354 | { |
| 356 | 355 | if (is_string($context)) |
| 357 | 356 | { |
| 358 | - if (function_exists('str' . $method)) |
|
| 357 | + if (function_exists('str'.$method)) |
|
| 359 | 358 | { |
| 360 | - $callback = 'str' . $method; |
|
| 359 | + $callback = 'str'.$method; |
|
| 361 | 360 | } |
| 362 | - else if (function_exists('str_' . $method)) |
|
| 361 | + else if (function_exists('str_'.$method)) |
|
| 363 | 362 | { |
| 364 | - $callback = 'str_' . $method; |
|
| 363 | + $callback = 'str_'.$method; |
|
| 365 | 364 | } |
| 366 | 365 | } |
| 367 | 366 | else if (is_array($context) || is_object($context)) |
| 368 | 367 | { |
| 369 | - if (function_exists('ICanBoogie\array_' . $method)) |
|
| 368 | + if (function_exists('ICanBoogie\array_'.$method)) |
|
| 370 | 369 | { |
| 371 | - $callback = 'ICanBoogie\array_' . $method; |
|
| 370 | + $callback = 'ICanBoogie\array_'.$method; |
|
| 372 | 371 | } |
| 373 | - else if (function_exists('array_' . $method)) |
|
| 372 | + else if (function_exists('array_'.$method)) |
|
| 374 | 373 | { |
| 375 | - $callback = 'array_' . $method; |
|
| 374 | + $callback = 'array_'.$method; |
|
| 376 | 375 | } |
| 377 | 376 | } |
| 378 | 377 | } |
@@ -393,7 +392,7 @@ discard block |
||
| 393 | 392 | { |
| 394 | 393 | if (is_object($context) && method_exists($context, '__call')) |
| 395 | 394 | { |
| 396 | - $context = call_user_func_array([ $context, $method ], $args); |
|
| 395 | + $context = call_user_func_array([$context, $method], $args); |
|
| 397 | 396 | |
| 398 | 397 | break; |
| 399 | 398 | } |
@@ -460,7 +459,7 @@ discard block |
||
| 460 | 459 | * |
| 461 | 460 | * @return mixed The extracted value. |
| 462 | 461 | */ |
| 463 | - protected function extract_value($container, $identifier, &$exists=false) |
|
| 462 | + protected function extract_value($container, $identifier, &$exists = false) |
|
| 464 | 463 | { |
| 465 | 464 | $exists = false; |
| 466 | 465 | |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | namespace Patron; |
| 4 | 4 | |
| 5 | -$hooks = Hooks::class . '::'; |
|
| 5 | +$hooks = Hooks::class.'::'; |
|
| 6 | 6 | |
| 7 | 7 | return [ |
| 8 | 8 | |
@@ -12,9 +12,9 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | 'template' => [ |
| 14 | 14 | |
| 15 | - $hooks . 'markup_template', [ |
|
| 15 | + $hooks.'markup_template', [ |
|
| 16 | 16 | |
| 17 | - 'name' => [ 'required' => true ] |
|
| 17 | + 'name' => ['required' => true] |
|
| 18 | 18 | |
| 19 | 19 | ], |
| 20 | 20 | |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | 'call-template' => [ |
| 26 | 26 | |
| 27 | - $hooks . 'markup_call_template', [ |
|
| 27 | + $hooks.'markup_call_template', [ |
|
| 28 | 28 | |
| 29 | - 'name' => [ 'required' => true ] |
|
| 29 | + 'name' => ['required' => true] |
|
| 30 | 30 | |
| 31 | 31 | ], |
| 32 | 32 | |
@@ -36,18 +36,18 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | 'decorate' => [ |
| 38 | 38 | |
| 39 | - $hooks . 'markup_decorate', [ |
|
| 39 | + $hooks.'markup_decorate', [ |
|
| 40 | 40 | |
| 41 | - 'with' => [ 'required' => true ] |
|
| 41 | + 'with' => ['required' => true] |
|
| 42 | 42 | |
| 43 | 43 | ] |
| 44 | 44 | ], |
| 45 | 45 | |
| 46 | 46 | 'foreach' => [ |
| 47 | 47 | |
| 48 | - $hooks . 'markup_foreach', [ |
|
| 48 | + $hooks.'markup_foreach', [ |
|
| 49 | 49 | |
| 50 | - 'in' => [ 'default' => 'this', 'expression' => true ], |
|
| 50 | + 'in' => ['default' => 'this', 'expression' => true], |
|
| 51 | 51 | 'as' => null |
| 52 | 52 | |
| 53 | 53 | ] |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | 'variable' => [ |
| 57 | 57 | |
| 58 | - $hooks . 'markup_variable', [ |
|
| 58 | + $hooks.'markup_variable', [ |
|
| 59 | 59 | |
| 60 | - 'name' => [ 'required' => true ], |
|
| 61 | - 'select' => [ 'expression' => true ] |
|
| 60 | + 'name' => ['required' => true], |
|
| 61 | + 'select' => ['expression' => true] |
|
| 62 | 62 | |
| 63 | 63 | ], |
| 64 | 64 | |
@@ -67,16 +67,16 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | 'with' => [ |
| 69 | 69 | |
| 70 | - $hooks . 'markup_with', [ |
|
| 70 | + $hooks.'markup_with', [ |
|
| 71 | 71 | |
| 72 | - 'select' => [ 'expression' => true ] |
|
| 72 | + 'select' => ['expression' => true] |
|
| 73 | 73 | |
| 74 | 74 | ] |
| 75 | 75 | ], |
| 76 | 76 | |
| 77 | 77 | 'choose' => [ |
| 78 | 78 | |
| 79 | - $hooks . 'markup_choose', [ |
|
| 79 | + $hooks.'markup_choose', [ |
|
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | ], |
@@ -87,10 +87,10 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | 'if' => [ |
| 89 | 89 | |
| 90 | - $hooks . 'markup_if', [ |
|
| 90 | + $hooks.'markup_if', [ |
|
| 91 | 91 | |
| 92 | - 'test' => [ 'expression' => [ 'silent' => true ] ], |
|
| 93 | - 'select' => [ 'expression' => [ 'silent' => true ] ], |
|
| 92 | + 'test' => ['expression' => ['silent' => true]], |
|
| 93 | + 'select' => ['expression' => ['silent' => true]], |
|
| 94 | 94 | 'equals' => null |
| 95 | 95 | |
| 96 | 96 | ], |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | 'translate' => [ |
| 103 | 103 | |
| 104 | - $hooks . 'markup_translate', [ |
|
| 104 | + $hooks.'markup_translate', [ |
|
| 105 | 105 | |
| 106 | - 'native' => [ 'required' => true ] |
|
| 106 | + 'native' => ['required' => true] |
|
| 107 | 107 | |
| 108 | 108 | ] |
| 109 | 109 | ], |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | 'pager' => [ |
| 116 | 116 | |
| 117 | - $hooks . 'markup_pager', [ |
|
| 117 | + $hooks.'markup_pager', [ |
|
| 118 | 118 | |
| 119 | 119 | 'count' => null, |
| 120 | 120 | 'page' => null, |
| 121 | 121 | 'limit' => null, |
| 122 | 122 | 'with' => null, |
| 123 | - 'range' => [ 'expression' => true ], |
|
| 123 | + 'range' => ['expression' => true], |
|
| 124 | 124 | 'noarrows' => false |
| 125 | 125 | |
| 126 | 126 | ] |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | 'document:css' => [ |
| 130 | 130 | |
| 131 | - $hooks . 'markup_document_css', [ |
|
| 131 | + $hooks.'markup_document_css', [ |
|
| 132 | 132 | |
| 133 | 133 | 'href' => null, |
| 134 | 134 | 'weight' => 100 |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | 'document:js' => [ |
| 140 | 140 | |
| 141 | - $hooks . 'markup_document_js', [ |
|
| 141 | + $hooks.'markup_document_js', [ |
|
| 142 | 142 | |
| 143 | 143 | 'href' => null, |
| 144 | 144 | 'weight' => 100 |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | if (!$f) |
| 48 | 48 | { |
| 49 | - throw new FunctionNotDefined([ $method, $this ]); |
|
| 49 | + throw new FunctionNotDefined([$method, $this]); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | return call_user_func_array($f, $arguments); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | { |
| 78 | 78 | if (!$this->offsetExists($name)) |
| 79 | 79 | { |
| 80 | - throw new FunctionNotDefined([ $name, $this ]); |
|
| 80 | + throw new FunctionNotDefined([$name, $this]); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | return $this->collection[$name]; |
@@ -118,21 +118,21 @@ discard block |
||
| 118 | 118 | return $this->collection[$name]; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - $try = 'ICanBoogie\\' . $name; |
|
| 121 | + $try = 'ICanBoogie\\'.$name; |
|
| 122 | 122 | |
| 123 | 123 | if (function_exists($try)) |
| 124 | 124 | { |
| 125 | 125 | return $try; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - $try = 'ICanBoogie\I18n\\' . $name; |
|
| 128 | + $try = 'ICanBoogie\I18n\\'.$name; |
|
| 129 | 129 | |
| 130 | 130 | if (function_exists($try)) |
| 131 | 131 | { |
| 132 | 132 | return $try; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $try = 'Patron\\' . $name; |
|
| 135 | + $try = 'Patron\\'.$name; |
|
| 136 | 136 | |
| 137 | 137 | if (function_exists($try)) |
| 138 | 138 | { |
@@ -27,18 +27,18 @@ discard block |
||
| 27 | 27 | @define('txt_registered', '®'); |
| 28 | 28 | @define('txt_copyright', '©'); |
| 29 | 29 | */ |
| 30 | -@define('txt_apostrophe', '\''); |
|
| 31 | -@define('txt_quote_double_open', '« '); |
|
| 30 | +@define('txt_apostrophe', '\''); |
|
| 31 | +@define('txt_quote_double_open', '« '); |
|
| 32 | 32 | @define('txt_quote_double_close', ' »'); |
| 33 | -@define('txt_prime', 'ʹ'); |
|
| 34 | -@define('txt_prime_double', 'ʺ'); |
|
| 35 | -@define('txt_ellipsis', '…'); |
|
| 36 | -@define('txt_emdash', '—'); |
|
| 37 | -@define('txt_endash', '–'); |
|
| 38 | -@define('txt_dimension', '×'); |
|
| 39 | -@define('txt_trademark', '™'); |
|
| 40 | -@define('txt_registered', '®'); |
|
| 41 | -@define('txt_copyright', '©'); |
|
| 33 | +@define('txt_prime', 'ʹ'); |
|
| 34 | +@define('txt_prime_double', 'ʺ'); |
|
| 35 | +@define('txt_ellipsis', '…'); |
|
| 36 | +@define('txt_emdash', '—'); |
|
| 37 | +@define('txt_endash', '–'); |
|
| 38 | +@define('txt_dimension', '×'); |
|
| 39 | +@define('txt_trademark', '™'); |
|
| 40 | +@define('txt_registered', '®'); |
|
| 41 | +@define('txt_copyright', '©'); |
|
| 42 | 42 | |
| 43 | 43 | class Textmark_Parser extends MarkdownExtra_Parser |
| 44 | 44 | { |
@@ -52,14 +52,12 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | function __construct() |
| 54 | 54 | { |
| 55 | - $this->early_gamut += array |
|
| 56 | - ( |
|
| 55 | + $this->early_gamut += array( |
|
| 57 | 56 | 'doShell' => 5, |
| 58 | 57 | 'doURL' => 6 |
| 59 | 58 | ); |
| 60 | 59 | |
| 61 | - $this->span_gamut += array |
|
| 62 | - ( |
|
| 60 | + $this->span_gamut += array( |
|
| 63 | 61 | 'doGlyphs' => 70, |
| 64 | 62 | 'doSpan' => 71 |
| 65 | 63 | ); |
@@ -69,8 +67,7 @@ discard block |
||
| 69 | 67 | |
| 70 | 68 | public function doShell($text) |
| 71 | 69 | { |
| 72 | - return preg_replace_callback |
|
| 73 | - ( |
|
| 70 | + return preg_replace_callback( |
|
| 74 | 71 | '{^\$\s+([^\n]+)\n}xm', array($this, 'doShell_callback'), $text |
| 75 | 72 | ); |
| 76 | 73 | |
@@ -79,7 +76,7 @@ discard block |
||
| 79 | 76 | |
| 80 | 77 | protected function doShell_callback($matches) |
| 81 | 78 | { |
| 82 | - $text = '<pre class="markdown shell">$ ' . $matches[1] . '</pre>' . PHP_EOL; |
|
| 79 | + $text = '<pre class="markdown shell">$ '.$matches[1].'</pre>'.PHP_EOL; |
|
| 83 | 80 | |
| 84 | 81 | return $this->hashBlock($text); |
| 85 | 82 | } |
@@ -210,9 +207,9 @@ discard block |
||
| 210 | 207 | |
| 211 | 208 | switch ($type) |
| 212 | 209 | { |
| 213 | - case 'php': return '<pre class="php"><code>' . $this->doSourcePHP($text) . '</code></pre>'; |
|
| 214 | - case 'html': return '<pre class="html"><code>' . $this->doSourceHTML($text) . '</code></pre>'; |
|
| 215 | - case 'raw': return '<pre><code>' . $this->doSourceRaw($text) . '</code></pre>'; |
|
| 210 | + case 'php': return '<pre class="php"><code>'.$this->doSourcePHP($text).'</code></pre>'; |
|
| 211 | + case 'html': return '<pre class="html"><code>'.$this->doSourceHTML($text).'</code></pre>'; |
|
| 212 | + case 'raw': return '<pre><code>'.$this->doSourceRaw($text).'</code></pre>'; |
|
| 216 | 213 | case 'publish': return $this->doSourcePublish($text); |
| 217 | 214 | } |
| 218 | 215 | |
@@ -271,8 +268,7 @@ discard block |
||
| 271 | 268 | |
| 272 | 269 | */ |
| 273 | 270 | |
| 274 | - $text = preg_replace_callback |
|
| 275 | - ( |
|
| 271 | + $text = preg_replace_callback( |
|
| 276 | 272 | '{ |
| 277 | 273 | ^h([1-6])\. # $1 = string of h? |
| 278 | 274 | [ ]* |
@@ -296,9 +292,9 @@ discard block |
||
| 296 | 292 | case '-': $level = 3; break; |
| 297 | 293 | } |
| 298 | 294 | |
| 299 | - $block = "<h$level>" . $this->runSpanGamut($matches[1]) . "</h$level>"; |
|
| 295 | + $block = "<h$level>".$this->runSpanGamut($matches[1])."</h$level>"; |
|
| 300 | 296 | |
| 301 | - return "\n" . $this->hashBlock($block) . "\n\n"; |
|
| 297 | + return "\n".$this->hashBlock($block)."\n\n"; |
|
| 302 | 298 | } |
| 303 | 299 | |
| 304 | 300 | function _doHeaders_callback_tp($matches) |
@@ -306,8 +302,8 @@ discard block |
||
| 306 | 302 | // \ICanBoogie\log('<pre>doHeaders[atx]: \1</pre>', print_r($matches, true)); |
| 307 | 303 | |
| 308 | 304 | $level = $matches[1]; |
| 309 | - $block = "<h$level>" . $this->runSpanGamut($matches[2]) . "</h$level>"; |
|
| 310 | - return "\n" . $this->hashBlock($block) . "\n\n"; |
|
| 305 | + $block = "<h$level>".$this->runSpanGamut($matches[2])."</h$level>"; |
|
| 306 | + return "\n".$this->hashBlock($block)."\n\n"; |
|
| 311 | 307 | } |
| 312 | 308 | |
| 313 | 309 | /* |
@@ -327,14 +323,14 @@ discard block |
||
| 327 | 323 | |
| 328 | 324 | $c = "(?:{$clas}|{$styl}|{$lnge}|{$hlgn})*"; |
| 329 | 325 | |
| 330 | - $qtags = array('\*\*','\*','\?\?','-','__','_','%','\+','~','\^'); |
|
| 326 | + $qtags = array('\*\*', '\*', '\?\?', '-', '__', '_', '%', '\+', '~', '\^'); |
|
| 331 | 327 | $pnct = ".,\"'?!;:"; |
| 332 | 328 | |
| 333 | - foreach($qtags as $f) { |
|
| 329 | + foreach ($qtags as $f) { |
|
| 334 | 330 | $text = preg_replace_callback("/ |
| 335 | 331 | (^|(?<=[\s>$pnct\(])|[{[]) |
| 336 | 332 | ($f)(?!$f) |
| 337 | - (" . $c . ") |
|
| 333 | + (".$c.") |
|
| 338 | 334 | (?::(\S+))? |
| 339 | 335 | ([^\s$f]+|\S.*?[^\s$f\n]) |
| 340 | 336 | ([$pnct]*) |
@@ -382,23 +378,22 @@ discard block |
||
| 382 | 378 | { |
| 383 | 379 | // echo l('doGlyphs: "\1"<br />', \ICanBoogie\escape($text)); |
| 384 | 380 | |
| 385 | - $glyph_search = array |
|
| 386 | - ( |
|
| 381 | + $glyph_search = array( |
|
| 387 | 382 | // '/(\w)\'(\w)/', // apostrophe's |
| 388 | - '/(\s)\'(\d+\w?)\b(?!\')/u', // back in '88 |
|
| 383 | + '/(\s)\'(\d+\w?)\b(?!\')/u', // back in '88 |
|
| 389 | 384 | // '/(\S)\'(?=\s|[[:punct:]]|<|$)/', // single closing |
| 390 | 385 | // '/\'/', // single opening |
| 391 | - '/(\S)\"(?=\s|[[:punct:]]|<|$)/u', // double closing |
|
| 392 | - '/"/', // double opening |
|
| 393 | - '/\b([A-Z][A-Z0-9]{2,})\b(?:[(]([^)]*)[)])/u', // 3+ uppercase acronym |
|
| 394 | - '/(?<=\s|^|[>(;-])([A-Z]{3,})([a-z]*)(?=\s|[[:punct:]]|<|$)/u', // 3+ uppercase |
|
| 395 | - '/([^.]?)\.{3}/u', // ellipsis |
|
| 396 | - '/(\s?)--(\s?)/u', // em dash |
|
| 397 | - '/\s-(?:\s|$)/u', // en dash |
|
| 398 | - '/(\d+)( ?)x( ?)(?=\d+)/u', // dimension sign |
|
| 399 | - '/(\b ?|\s|^)[([]TM[])]/iu', // trademark |
|
| 400 | - '/(\b ?|\s|^)[([]R[])]/iu', // registered |
|
| 401 | - '/(\b ?|\s|^)[([]C[])]/iu', // copyright |
|
| 386 | + '/(\S)\"(?=\s|[[:punct:]]|<|$)/u', // double closing |
|
| 387 | + '/"/', // double opening |
|
| 388 | + '/\b([A-Z][A-Z0-9]{2,})\b(?:[(]([^)]*)[)])/u', // 3+ uppercase acronym |
|
| 389 | + '/(?<=\s|^|[>(;-])([A-Z]{3,})([a-z]*)(?=\s|[[:punct:]]|<|$)/u', // 3+ uppercase |
|
| 390 | + '/([^.]?)\.{3}/u', // ellipsis |
|
| 391 | + '/(\s?)--(\s?)/u', // em dash |
|
| 392 | + '/\s-(?:\s|$)/u', // en dash |
|
| 393 | + '/(\d+)( ?)x( ?)(?=\d+)/u', // dimension sign |
|
| 394 | + '/(\b ?|\s|^)[([]TM[])]/iu', // trademark |
|
| 395 | + '/(\b ?|\s|^)[([]R[])]/iu', // registered |
|
| 396 | + '/(\b ?|\s|^)[([]C[])]/iu', // copyright |
|
| 402 | 397 | |
| 403 | 398 | # |
| 404 | 399 | # the following is for french language |
@@ -407,29 +402,28 @@ discard block |
||
| 407 | 402 | '#\s(\!|\?|\:|\;|\-)#u', |
| 408 | 403 | ); |
| 409 | 404 | |
| 410 | - $glyph_replace = array |
|
| 411 | - ( |
|
| 405 | + $glyph_replace = array( |
|
| 412 | 406 | // '$1'.$txt_apostrophe.'$2', // apostrophe's |
| 413 | - '$1'.txt_apostrophe.'$2', // back in '88 |
|
| 407 | + '$1'.txt_apostrophe.'$2', // back in '88 |
|
| 414 | 408 | // '$1'.$txt_quote_single_close, // single closing |
| 415 | 409 | // $txt_quote_single_open, // single opening |
| 416 | - '$1'.txt_quote_double_close, // double closing |
|
| 417 | - txt_quote_double_open, // double opening |
|
| 418 | - '<acronym title="$2">$1</acronym>', // 3+ uppercase acronym |
|
| 419 | - '<span class="caps">$1</span>$2', // 3+ uppercase |
|
| 420 | - '$1'.txt_ellipsis, // ellipsis |
|
| 421 | - '$1'.txt_emdash.'$2', // em dash |
|
| 422 | - ' '.txt_endash.' ', // en dash |
|
| 423 | - '$1$2'.txt_dimension.'$3', // dimension sign |
|
| 424 | - '$1'.txt_trademark, // trademark |
|
| 425 | - '$1'.txt_registered, // registered |
|
| 426 | - '$1'.txt_copyright, // copyright |
|
| 410 | + '$1'.txt_quote_double_close, // double closing |
|
| 411 | + txt_quote_double_open, // double opening |
|
| 412 | + '<acronym title="$2">$1</acronym>', // 3+ uppercase acronym |
|
| 413 | + '<span class="caps">$1</span>$2', // 3+ uppercase |
|
| 414 | + '$1'.txt_ellipsis, // ellipsis |
|
| 415 | + '$1'.txt_emdash.'$2', // em dash |
|
| 416 | + ' '.txt_endash.' ', // en dash |
|
| 417 | + '$1$2'.txt_dimension.'$3', // dimension sign |
|
| 418 | + '$1'.txt_trademark, // trademark |
|
| 419 | + '$1'.txt_registered, // registered |
|
| 420 | + '$1'.txt_copyright, // copyright |
|
| 427 | 421 | |
| 428 | 422 | # |
| 429 | 423 | # the following is for french language |
| 430 | 424 | # |
| 431 | 425 | |
| 432 | - self::NBSP . '$1', |
|
| 426 | + self::NBSP.'$1', |
|
| 433 | 427 | ); |
| 434 | 428 | |
| 435 | 429 | return preg_replace($glyph_search, $glyph_replace, $text); |
@@ -467,8 +461,7 @@ discard block |
||
| 467 | 461 | |
| 468 | 462 | $style = NULL; |
| 469 | 463 | |
| 470 | - if (preg_match |
|
| 471 | - ( |
|
| 464 | + if (preg_match( |
|
| 472 | 465 | '{ |
| 473 | 466 | ( # the whole thing is saved in $1 |
| 474 | 467 | ^p # start |
@@ -514,7 +507,7 @@ discard block |
||
| 514 | 507 | { |
| 515 | 508 | if ($style) |
| 516 | 509 | { |
| 517 | - $value = '<p style="' . $style . '">' . $value . '</p>'; |
|
| 510 | + $value = '<p style="'.$style.'">'.$value.'</p>'; |
|
| 518 | 511 | } |
| 519 | 512 | else |
| 520 | 513 | { |
@@ -583,8 +576,7 @@ discard block |
||
| 583 | 576 | # First, handle reference-style labeled images: ![alt text][id] |
| 584 | 577 | # |
| 585 | 578 | |
| 586 | - $text = preg_replace_callback |
|
| 587 | - ( |
|
| 579 | + $text = preg_replace_callback( |
|
| 588 | 580 | '{ |
| 589 | 581 | ( # wrap whole match in $1 |
| 590 | 582 | ! # start |
@@ -697,10 +689,8 @@ discard block |
||
| 697 | 689 | |
| 698 | 690 | if (isset($parts[1])) |
| 699 | 691 | { |
| 700 | - $entry = $module->model()->loadRange |
|
| 701 | - ( |
|
| 702 | - 0, 1, 'WHERE `' . $module->getConstant('TITLE') . '` = ? AND `' . $module->getConstant('ALBUM') . '` = ?', array |
|
| 703 | - ( |
|
| 692 | + $entry = $module->model()->loadRange( |
|
| 693 | + 0, 1, 'WHERE `'.$module->getConstant('TITLE').'` = ? AND `'.$module->getConstant('ALBUM').'` = ?', array( |
|
| 704 | 694 | $parts[1], $parts[0] |
| 705 | 695 | ) |
| 706 | 696 | ) |
@@ -709,10 +699,8 @@ discard block |
||
| 709 | 699 | } |
| 710 | 700 | else |
| 711 | 701 | { |
| 712 | - $entry = $module->model()->loadRange |
|
| 713 | - ( |
|
| 714 | - 0, 1, 'WHERE `slug` = ? OR `title` = ?', array |
|
| 715 | - ( |
|
| 702 | + $entry = $module->model()->loadRange( |
|
| 703 | + 0, 1, 'WHERE `slug` = ? OR `title` = ?', array( |
|
| 716 | 704 | $id, $id |
| 717 | 705 | ) |
| 718 | 706 | ) |
@@ -727,8 +715,7 @@ discard block |
||
| 727 | 715 | return parent::_doImages_reference_callback($matches); |
| 728 | 716 | } |
| 729 | 717 | |
| 730 | - $params = array |
|
| 731 | - ( |
|
| 718 | + $params = array( |
|
| 732 | 719 | 'src' => $entry->path, |
| 733 | 720 | 'alt' => \ICanBoogie\escape($alt), |
| 734 | 721 | 'width' => $entry->width, |
@@ -757,11 +744,11 @@ discard block |
||
| 757 | 744 | { |
| 758 | 745 | // \ICanBoogie\log('<pre>in \1: \2</pre>', __FUNCTION__, $matches); |
| 759 | 746 | |
| 760 | - $whole_match = $matches[1]; |
|
| 747 | + $whole_match = $matches[1]; |
|
| 761 | 748 | $align = $matches[2]; |
| 762 | - $alt_text = $matches[3]; |
|
| 749 | + $alt_text = $matches[3]; |
|
| 763 | 750 | $url = $matches[4] == '' ? $matches[5] : $matches[4]; |
| 764 | - $title =& $matches[8]; |
|
| 751 | + $title = & $matches[8]; |
|
| 765 | 752 | |
| 766 | 753 | $alt_text = str_replace('"', '"', $alt_text); |
| 767 | 754 | $result = "<img src=\"$url\" alt=\"$alt_text\""; |
@@ -776,13 +763,13 @@ discard block |
||
| 776 | 763 | case '>': $align = 'right'; break; |
| 777 | 764 | } |
| 778 | 765 | |
| 779 | - $result .= ' align="' . $align . '"'; |
|
| 766 | + $result .= ' align="'.$align.'"'; |
|
| 780 | 767 | } |
| 781 | 768 | |
| 782 | 769 | if (isset($title)) |
| 783 | 770 | { |
| 784 | 771 | $title = str_replace('"', '"', $title); |
| 785 | - $result .= " title=\"$title\""; # $title already quoted |
|
| 772 | + $result .= " title=\"$title\""; # $title already quoted |
|
| 786 | 773 | } |
| 787 | 774 | |
| 788 | 775 | $result .= $this->empty_element_suffix; |
@@ -798,16 +785,16 @@ discard block |
||
| 798 | 785 | ** |
| 799 | 786 | */ |
| 800 | 787 | |
| 801 | - function createElement($markup, $attrs, $body=NULL) |
|
| 788 | + function createElement($markup, $attrs, $body = NULL) |
|
| 802 | 789 | { |
| 803 | 790 | $rc = array(); |
| 804 | 791 | |
| 805 | 792 | foreach ($attrs as $name => $value) |
| 806 | 793 | { |
| 807 | - $rc[] = $name . '="' . $value . '"'; |
|
| 794 | + $rc[] = $name.'="'.$value.'"'; |
|
| 808 | 795 | } |
| 809 | 796 | |
| 810 | - return "<$markup " . implode(' ', $rc) . ($body ? ">$body</$markup>" : " />"); |
|
| 797 | + return "<$markup ".implode(' ', $rc).($body ? ">$body</$markup>" : " />"); |
|
| 811 | 798 | } |
| 812 | 799 | |
| 813 | 800 | protected function format_codeblock($codeblock, $type) |
@@ -847,8 +834,7 @@ discard block |
||
| 847 | 834 | # markup |
| 848 | 835 | # |
| 849 | 836 | |
| 850 | - $text = preg_replace_callback |
|
| 851 | - ( |
|
| 837 | + $text = preg_replace_callback( |
|
| 852 | 838 | '#(\<\!?[^\s^\>]+)(\s+[^\>]+)?(\/?\>)#m', array($this, '_do_html_markup'), $text |
| 853 | 839 | ); |
| 854 | 840 | |
@@ -860,8 +846,7 @@ discard block |
||
| 860 | 846 | |
| 861 | 847 | // \ICanBoogie\log('## \1 ## <pre>\2</pre>', __FUNCTION__, $text); |
| 862 | 848 | |
| 863 | - $text = preg_replace_callback |
|
| 864 | - ( |
|
| 849 | + $text = preg_replace_callback( |
|
| 865 | 850 | '#\<\/[a-zA-Z]+\>#m', array($this, '_do_html_markup_close'), $text |
| 866 | 851 | ); |
| 867 | 852 | |
@@ -882,14 +867,14 @@ discard block |
||
| 882 | 867 | { |
| 883 | 868 | // \ICanBoogie\log('<pre>in \1: \2</pre>', __FUNCTION__, $matches); |
| 884 | 869 | |
| 885 | - return $this->hashPart('<span class="string">' . \ICanBoogie\escape($matches[0]) . '</span>'); |
|
| 870 | + return $this->hashPart('<span class="string">'.\ICanBoogie\escape($matches[0]).'</span>'); |
|
| 886 | 871 | } |
| 887 | 872 | |
| 888 | 873 | function _do_html_attribute($matches) |
| 889 | 874 | { |
| 890 | 875 | // \ICanBoogie\log('<pre>in \1: \2</pre>', __FUNCTION__, $matches); |
| 891 | 876 | |
| 892 | - return $this->hashPart('<span class="attribute">' . \ICanBoogie\escape($matches[0]) . '</span>'); |
|
| 877 | + return $this->hashPart('<span class="attribute">'.\ICanBoogie\escape($matches[0]).'</span>'); |
|
| 893 | 878 | } |
| 894 | 879 | |
| 895 | 880 | function _do_html_markup($matches) |
@@ -902,8 +887,7 @@ discard block |
||
| 902 | 887 | # strings |
| 903 | 888 | # |
| 904 | 889 | |
| 905 | - $text = preg_replace_callback |
|
| 906 | - ( |
|
| 890 | + $text = preg_replace_callback( |
|
| 907 | 891 | '#\"[^\"]+\"#', array(&$this, '_do_html_string'), $text |
| 908 | 892 | ); |
| 909 | 893 | |
@@ -913,14 +897,13 @@ discard block |
||
| 913 | 897 | # attributes |
| 914 | 898 | # |
| 915 | 899 | |
| 916 | - $text = preg_replace_callback |
|
| 917 | - ( |
|
| 900 | + $text = preg_replace_callback( |
|
| 918 | 901 | '#[^\s\=]+#', array(&$this, '_do_html_attribute'), $text |
| 919 | 902 | ); |
| 920 | 903 | |
| 921 | - $rc = $this->hashPart('<span class="markup">' . \ICanBoogie\escape($matches[1]) . '</span>'); |
|
| 904 | + $rc = $this->hashPart('<span class="markup">'.\ICanBoogie\escape($matches[1]).'</span>'); |
|
| 922 | 905 | $rc .= $text; |
| 923 | - $rc .= $this->hashpart('<span class="markup">' . \ICanBoogie\escape($matches[3]) . '</span>'); |
|
| 906 | + $rc .= $this->hashpart('<span class="markup">'.\ICanBoogie\escape($matches[3]).'</span>'); |
|
| 924 | 907 | |
| 925 | 908 | return $rc; |
| 926 | 909 | } |
@@ -929,7 +912,7 @@ discard block |
||
| 929 | 912 | { |
| 930 | 913 | // \ICanBoogie\log('<pre>in \1: \2</pre>', __FUNCTION__, $matches); |
| 931 | 914 | |
| 932 | - return $this->hashPart('<span class="markup">' . \ICanBoogie\escape($matches[0]) . '</span>'); |
|
| 915 | + return $this->hashPart('<span class="markup">'.\ICanBoogie\escape($matches[0]).'</span>'); |
|
| 933 | 916 | } |
| 934 | 917 | |
| 935 | 918 | # |
@@ -948,7 +931,7 @@ discard block |
||
| 948 | 931 | { |
| 949 | 932 | $in_quotes = NULL; |
| 950 | 933 | |
| 951 | - for ($i = 0 ; $i < strlen($line) ; $i++) |
|
| 934 | + for ($i = 0; $i < strlen($line); $i++) |
|
| 952 | 935 | { |
| 953 | 936 | $c = $line{$i}; |
| 954 | 937 | |
@@ -970,8 +953,8 @@ discard block |
||
| 970 | 953 | |
| 971 | 954 | $line = |
| 972 | 955 | |
| 973 | - substr($line, 0, $i) . |
|
| 974 | - $this->hashPart('<code class="comment">' . \ICanBoogie\escape(substr($line, $i)) . '</code>'); |
|
| 956 | + substr($line, 0, $i). |
|
| 957 | + $this->hashPart('<code class="comment">'.\ICanBoogie\escape(substr($line, $i)).'</code>'); |
|
| 975 | 958 | |
| 976 | 959 | break; |
| 977 | 960 | } |
@@ -996,7 +979,7 @@ discard block |
||
| 996 | 979 | |
| 997 | 980 | $y = strlen($text); |
| 998 | 981 | |
| 999 | - for ($i = 0 ; $i < $y ; $i++) |
|
| 982 | + for ($i = 0; $i < $y; $i++) |
|
| 1000 | 983 | { |
| 1001 | 984 | $c = $text{$i}; |
| 1002 | 985 | |
@@ -1010,7 +993,7 @@ discard block |
||
| 1010 | 993 | } |
| 1011 | 994 | else if ($quote_start !== null && $c == $quote) |
| 1012 | 995 | { |
| 1013 | - $out .= $this->hashPart('<span class="string">' . \ICanBoogie\escape($quote . substr($text, $quote_start + 1, $i - $quote_start - 1) . $quote) . '</span>'); |
|
| 996 | + $out .= $this->hashPart('<span class="string">'.\ICanBoogie\escape($quote.substr($text, $quote_start + 1, $i - $quote_start - 1).$quote).'</span>'); |
|
| 1014 | 997 | |
| 1015 | 998 | $quote_start = null; |
| 1016 | 999 | $quote = null; |
@@ -1055,8 +1038,7 @@ discard block |
||
| 1055 | 1038 | # comment block |
| 1056 | 1039 | # |
| 1057 | 1040 | |
| 1058 | - $text = preg_replace_callback |
|
| 1059 | - ( |
|
| 1041 | + $text = preg_replace_callback( |
|
| 1060 | 1042 | '#/\*.*?\*/#ms', array(&$this, '_do_php_comment'), $text |
| 1061 | 1043 | ); |
| 1062 | 1044 | |
@@ -1066,8 +1048,7 @@ discard block |
||
| 1066 | 1048 | # functions |
| 1067 | 1049 | # |
| 1068 | 1050 | |
| 1069 | - $text = preg_replace_callback |
|
| 1070 | - ( |
|
| 1051 | + $text = preg_replace_callback( |
|
| 1071 | 1052 | '#(\$?[a-zA-z0-9_]+)\(#', array(&$this, '_do_php_function'), $text |
| 1072 | 1053 | ); |
| 1073 | 1054 | |
@@ -1077,8 +1058,7 @@ discard block |
||
| 1077 | 1058 | |
| 1078 | 1059 | // \ICanBoogie\log('## \1 ## <pre>\2</pre>', __FUNCTION__, \ICanBoogie\escape($text)); |
| 1079 | 1060 | |
| 1080 | - $text = preg_replace_callback |
|
| 1081 | - ( |
|
| 1061 | + $text = preg_replace_callback( |
|
| 1082 | 1062 | '#(\$|\-\>)([a-zA-z0-9_]+)(?!\x1A)#', array(&$this, '_do_php_variable'), $text |
| 1083 | 1063 | ); |
| 1084 | 1064 | |
@@ -1086,13 +1066,11 @@ discard block |
||
| 1086 | 1066 | # numbers |
| 1087 | 1067 | # |
| 1088 | 1068 | |
| 1089 | - $text = preg_replace_callback |
|
| 1090 | - ( |
|
| 1069 | + $text = preg_replace_callback( |
|
| 1091 | 1070 | '#0x[0-9a-fA-F]{1,8}#u', array(&$this, '_do_php_number'), $text |
| 1092 | 1071 | ); |
| 1093 | 1072 | |
| 1094 | - $text = preg_replace_callback |
|
| 1095 | - ( |
|
| 1073 | + $text = preg_replace_callback( |
|
| 1096 | 1074 | '#(?<!\x1A)\d+(?![\w])#u', array(&$this, '_do_php_number'), $text |
| 1097 | 1075 | ); |
| 1098 | 1076 | |
@@ -1100,8 +1078,7 @@ discard block |
||
| 1100 | 1078 | # reserved keywords |
| 1101 | 1079 | # |
| 1102 | 1080 | |
| 1103 | - $reserved = array |
|
| 1104 | - ( |
|
| 1081 | + $reserved = array( |
|
| 1105 | 1082 | 'include_once', |
| 1106 | 1083 | 'require_once', |
| 1107 | 1084 | 'endswitch', |
@@ -1148,9 +1125,8 @@ discard block |
||
| 1148 | 1125 | |
| 1149 | 1126 | foreach ($reserved as $k) |
| 1150 | 1127 | { |
| 1151 | - $text = preg_replace_callback |
|
| 1152 | - ( |
|
| 1153 | - '#' . $k . '#', array(&$this, '_do_php_reserved'), $text |
|
| 1128 | + $text = preg_replace_callback( |
|
| 1129 | + '#'.$k.'#', array(&$this, '_do_php_reserved'), $text |
|
| 1154 | 1130 | ); |
| 1155 | 1131 | } |
| 1156 | 1132 | |
@@ -1158,8 +1134,7 @@ discard block |
||
| 1158 | 1134 | # symbols |
| 1159 | 1135 | # |
| 1160 | 1136 | |
| 1161 | - $text = preg_replace_callback |
|
| 1162 | - ( |
|
| 1137 | + $text = preg_replace_callback( |
|
| 1163 | 1138 | '#[\(\)\[\]\{\}\!\@\%\&\*\|\/\<\>\-\+\=]+#', array(&$this, '_do_php_symbol'), $text |
| 1164 | 1139 | ); |
| 1165 | 1140 | |
@@ -1176,8 +1151,8 @@ discard block |
||
| 1176 | 1151 | |
| 1177 | 1152 | $text = |
| 1178 | 1153 | |
| 1179 | - '<span class="delimiter">' . |
|
| 1180 | - "<?php</span>\n\n" . |
|
| 1154 | + '<span class="delimiter">'. |
|
| 1155 | + "<?php</span>\n\n". |
|
| 1181 | 1156 | |
| 1182 | 1157 | $text; |
| 1183 | 1158 | |
@@ -1221,10 +1196,9 @@ discard block |
||
| 1221 | 1196 | |
| 1222 | 1197 | // \ICanBoogie\log('## \1 ## \2', __FUNCTION__, $matches); |
| 1223 | 1198 | |
| 1224 | - return $this->hashPart |
|
| 1225 | - ( |
|
| 1226 | - '<span class="comment">' . |
|
| 1227 | - $this->_do_codeentities($matches[0]) . |
|
| 1199 | + return $this->hashPart( |
|
| 1200 | + '<span class="comment">'. |
|
| 1201 | + $this->_do_codeentities($matches[0]). |
|
| 1228 | 1202 | '</span>' |
| 1229 | 1203 | ); |
| 1230 | 1204 | } |
@@ -1235,24 +1209,24 @@ discard block |
||
| 1235 | 1209 | |
| 1236 | 1210 | if ($matches[1] == '->') |
| 1237 | 1211 | { |
| 1238 | - return '->' . $this->hashPart('<span class="variable">' . $matches[2] . '</span>'); |
|
| 1212 | + return '->'.$this->hashPart('<span class="variable">'.$matches[2].'</span>'); |
|
| 1239 | 1213 | } |
| 1240 | 1214 | |
| 1241 | - return $this->hashPart('<span class="variable">' . $matches[0] . '</span>'); |
|
| 1215 | + return $this->hashPart('<span class="variable">'.$matches[0].'</span>'); |
|
| 1242 | 1216 | } |
| 1243 | 1217 | |
| 1244 | 1218 | function _do_php_reserved($matches) |
| 1245 | 1219 | { |
| 1246 | 1220 | // \ICanBoogie\log('## \1 ## \2', __FUNCTION__, $matches); |
| 1247 | 1221 | |
| 1248 | - return $this->hashPart('<span class="reserved">' . $matches[0] . '</span>'); |
|
| 1222 | + return $this->hashPart('<span class="reserved">'.$matches[0].'</span>'); |
|
| 1249 | 1223 | } |
| 1250 | 1224 | |
| 1251 | 1225 | function _do_php_function_def($matches) |
| 1252 | 1226 | { |
| 1253 | 1227 | // \ICanBoogie\log('## \1 ## \2', __FUNCTION__, $matches); |
| 1254 | 1228 | |
| 1255 | - return $this->hashPart('<span class="function">function</span>' . $matches[1]); |
|
| 1229 | + return $this->hashPart('<span class="function">function</span>'.$matches[1]); |
|
| 1256 | 1230 | // return $this->hashPart('<span class="function">' . $matches[1] . '</span>(', 'F'); |
| 1257 | 1231 | } |
| 1258 | 1232 | |
@@ -1265,19 +1239,19 @@ discard block |
||
| 1265 | 1239 | return $matches[0]; |
| 1266 | 1240 | } |
| 1267 | 1241 | |
| 1268 | - return $this->hashPart('<span class="function">' . $matches[1] . '</span>', 'F'). '('; |
|
| 1242 | + return $this->hashPart('<span class="function">'.$matches[1].'</span>', 'F').'('; |
|
| 1269 | 1243 | } |
| 1270 | 1244 | |
| 1271 | 1245 | function _do_php_symbol($matches) |
| 1272 | 1246 | { |
| 1273 | - return $this->hashPart('<span class="symbol">' . \ICanBoogie\escape($matches[0]) . '</span>'); |
|
| 1247 | + return $this->hashPart('<span class="symbol">'.\ICanBoogie\escape($matches[0]).'</span>'); |
|
| 1274 | 1248 | } |
| 1275 | 1249 | |
| 1276 | 1250 | function _do_php_number($matches) |
| 1277 | 1251 | { |
| 1278 | 1252 | // \ICanBoogie\log('## \1 ## \2', __FUNCTION__, $matches); |
| 1279 | 1253 | |
| 1280 | - return $this->hashPart('<span class="number">' . $matches[0] . '</span>'); |
|
| 1254 | + return $this->hashPart('<span class="number">'.$matches[0].'</span>'); |
|
| 1281 | 1255 | } |
| 1282 | 1256 | |
| 1283 | 1257 | /* |
@@ -1291,10 +1265,10 @@ discard block |
||
| 1291 | 1265 | |
| 1292 | 1266 | function _doAnchors_inline_callback($matches) |
| 1293 | 1267 | { |
| 1294 | - $whole_match = $matches[1]; |
|
| 1295 | - $link_text = $this->runSpanGamut($matches[2]); |
|
| 1296 | - $url = $matches[3] == '' ? $matches[4] : $matches[3]; |
|
| 1297 | - $title =& $matches[7]; |
|
| 1268 | + $whole_match = $matches[1]; |
|
| 1269 | + $link_text = $this->runSpanGamut($matches[2]); |
|
| 1270 | + $url = $matches[3] == '' ? $matches[4] : $matches[3]; |
|
| 1271 | + $title = & $matches[7]; |
|
| 1298 | 1272 | |
| 1299 | 1273 | $url = $this->encodeAmpsAndAngles($url); |
| 1300 | 1274 | |
@@ -1302,7 +1276,7 @@ discard block |
||
| 1302 | 1276 | if (isset($title)) { |
| 1303 | 1277 | $title = str_replace('"', '"', $title); |
| 1304 | 1278 | $title = $this->encodeAmpsAndAngles($title); |
| 1305 | - $result .= " title=\"$title\""; |
|
| 1279 | + $result .= " title=\"$title\""; |
|
| 1306 | 1280 | } |
| 1307 | 1281 | |
| 1308 | 1282 | if (substr($url, 0, 7) == 'http://') |