Completed
Push — master ( c74a72...239795 )
by Olivier
04:51
created
lib/Hooks.php 1 patch
Spacing   +7 added lines, -9 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	{
44 44
 		$count = null;
45 45
 		$limit = null;
46
-		$page =  null;
46
+		$page = null;
47 47
 		$range = null;
48 48
 		$noarrows = null;
49 49
 		$with = null;
@@ -166,10 +166,8 @@  discard block
 block discarded – undo
166 166
 
167 167
 		if (!is_array($entries) && !is_object($entries))
168 168
 		{
169
-			$patron->error
170
-			(
171
-				'Invalid source for %param. Source must either be an array or a traversable object. Given: !entries', array
172
-				(
169
+			$patron->error(
170
+				'Invalid source for %param. Source must either be an array or a traversable object. Given: !entries', array(
173 171
 					'%param' => 'in', '!entries' => $entries
174 172
 				)
175 173
 			);
@@ -330,7 +328,7 @@  discard block
 block discarded – undo
330 328
 
331 329
 			if ($name != 'when')
332 330
 			{
333
-				$patron->error('Unexpected child: :node', [ ':node' => $node ]);
331
+				$patron->error('Unexpected child: :node', [':node' => $node]);
334 332
 
335 333
 				return null;
336 334
 			}
@@ -716,16 +714,16 @@  discard block
 block discarded – undo
716 714
 	{
717 715
 		$app->events->attach(function(MarkupCollection\AlterEvent $event, MarkupCollection $markups) use ($app) {
718 716
 
719
-			foreach((array) $app->configs['patron.markups'] as $name => $definition)
717
+			foreach ((array) $app->configs['patron.markups'] as $name => $definition)
720 718
 			{
721
-				$markups[$name] = $definition + [ 1 => [ ] ];
719
+				$markups[$name] = $definition + [1 => []];
722 720
 			}
723 721
 
724 722
 		});
725 723
 
726 724
 		$app->events->attach(function(FunctionCollection\AlterEvent $event, FunctionCollection $markups) use ($app) {
727 725
 
728
-			foreach((array) $app->configs['patron.functions'] as $name => $definition)
726
+			foreach ((array) $app->configs['patron.functions'] as $name => $definition)
729 727
 			{
730 728
 				$markups[$name] = $definition;
731 729
 			}
Please login to merge, or discard this patch.
lib/ControlNode.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -136,11 +136,11 @@
 block discarded – undo
136 136
 		# call hook
137 137
 		#
138 138
 
139
-		$engine->trace_enter([ 'markup', $name ]);
139
+		$engine->trace_enter(['markup', $name]);
140 140
 
141 141
 		if ($binding)
142 142
 		{
143
-			array_push($engine->context_markup, [ $engine->context['self'], $engine->context['this'] ]);
143
+			array_push($engine->context_markup, [$engine->context['self'], $engine->context['this']]);
144 144
 
145 145
 			$engine->context['self'] = [
146 146
 
Please login to merge, or discard this patch.
lib/MarkupCollection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
 	{
57 57
 		if (!$this->offsetExists($name))
58 58
 		{
59
-			throw new MarkupNotDefined([ $name, $this ]);
59
+			throw new MarkupNotDefined([$name, $this]);
60 60
 		}
61 61
 
62 62
 		return $this->collection[$name];
Please login to merge, or discard this patch.
config/event.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@
 block discarded – undo
4 4
 
5 5
 use ICanBoogie;
6 6
 
7
-$hooks = Hooks::class . '::';
7
+$hooks = Hooks::class.'::';
8 8
 
9 9
 return [
10 10
 
11
-	ICanBoogie\Core::class . '::boot' => $hooks . 'on_core_boot'
11
+	ICanBoogie\Core::class.'::boot' => $hooks.'on_core_boot'
12 12
 
13 13
 ];
Please login to merge, or discard this patch.
res/markups.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
res/functions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -178,7 +178,7 @@
 block discarded – undo
178 178
 
179 179
 	'markdown' => function($text) {
180 180
 
181
-		require_once dirname(__DIR__) . '/lib/textmark/textmark.php';
181
+		require_once dirname(__DIR__).'/lib/textmark/textmark.php';
182 182
 
183 183
 		return \Markdown($text);
184 184
 
Please login to merge, or discard this patch.
lib/Engine.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 = '';
Please login to merge, or discard this patch.
lib/HTMLParser.php 1 patch
Spacing   +15 added lines, -19 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	protected $error_handler;
24 24
 	protected $namespace;
25 25
 
26
-	public function __construct(array $tags=[])
26
+	public function __construct(array $tags = [])
27 27
 	{
28 28
 		$tags += [
29 29
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		$this->error_handler = $tags[self::T_ERROR_HANDLER];
39 39
 	}
40 40
 
41
-	public function parse($html, $namespace=null, $encoding='utf-8')
41
+	public function parse($html, $namespace = null, $encoding = 'utf-8')
42 42
 	{
43 43
 		$this->encoding = $encoding;
44 44
 		$this->namespace = $namespace;
@@ -63,9 +63,8 @@  discard block
 block discarded – undo
63 63
 		# note that i+2 might end with a '/' indicating an auto-closing markup
64 64
 		#
65 65
 
66
-		$this->matches = preg_split
67
-		(
68
-			'#<(/?)' . $namespace . '([^>]*)>#', $html, -1, PREG_SPLIT_DELIM_CAPTURE
66
+		$this->matches = preg_split(
67
+			'#<(/?)'.$namespace.'([^>]*)>#', $html, -1, PREG_SPLIT_DELIM_CAPTURE
69 68
 		);
70 69
 
71 70
 		#
@@ -93,13 +92,13 @@  discard block
 block discarded – undo
93 92
 		# here we escape comments
94 93
 		#
95 94
 
96
-		$html = preg_replace_callback('#<\!--.+-->#sU', [ $this, 'escapeSpecials_callback' ], $html);
95
+		$html = preg_replace_callback('#<\!--.+-->#sU', [$this, 'escapeSpecials_callback'], $html);
97 96
 
98 97
 		#
99 98
 		# and processing options
100 99
 		#
101 100
 
102
-		$html = preg_replace_callback('#<\?.+\?>#sU', [ $this, 'escapeSpecials_callback' ], $html);
101
+		$html = preg_replace_callback('#<\?.+\?>#sU', [$this, 'escapeSpecials_callback'], $html);
103 102
 
104 103
 		return $html;
105 104
 	}
@@ -110,10 +109,9 @@  discard block
 block discarded – undo
110 109
 
111 110
 		$text = $m[0];
112 111
 
113
-		$text = str_replace
114
-		(
115
-			[ '<', '>' ],
116
-			[ "\x01", "\x02" ],
112
+		$text = str_replace(
113
+			['<', '>'],
114
+			["\x01", "\x02"],
117 115
 			$text
118 116
 		);
119 117
 
@@ -122,10 +120,9 @@  discard block
 block discarded – undo
122 120
 
123 121
 	protected function unescapeSpecials($tree)
124 122
 	{
125
-		return is_array($tree) ? array_map([ $this, 'unescapeSpecials' ], $tree) : str_replace
126
-		(
127
-			[ "\x01", "\x02" ],
128
-			[ '<', '>' ],
123
+		return is_array($tree) ? array_map([$this, 'unescapeSpecials'], $tree) : str_replace(
124
+			["\x01", "\x02"],
125
+			['<', '>'],
129 126
 			$tree
130 127
 		);
131 128
 	}
@@ -246,20 +243,19 @@  discard block
 block discarded – undo
246 243
 			$args[$m[1]] = html_entity_decode($m[2], ENT_QUOTES, $this->encoding);
247 244
 		}
248 245
 
249
-		return [ 'name' => $name, 'args' => $args ];
246
+		return ['name' => $name, 'args' => $args];
250 247
 	}
251 248
 
252 249
 	protected function error($markup, $expected)
253 250
 	{
254 251
 		$this->malformed = true;
255 252
 
256
-		call_user_func
257
-		(
253
+		call_user_func(
258 254
 			$this->error_handler, $expected
259 255
 			? 'unexpected closing markup %markup, should be %expected'
260 256
 			: 'unexpected closing markup %markup, when none was opened', [
261 257
 
262
-				'%markup' => $this->namespace . $markup, '%expected' => $expected
258
+				'%markup' => $this->namespace.$markup, '%expected' => $expected
263 259
 
264 260
 			]
265 261
 		);
Please login to merge, or discard this patch.
lib/markdown/markdown.php 1 patch
Spacing   +67 added lines, -70 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 # <http://daringfireball.net/projects/markdown/>
12 12
 #
13 13
 
14
-define( 'MARKDOWN_VERSION',  "1.0.1o" ); # Sun 8 Jan 2012
14
+define('MARKDOWN_VERSION', "1.0.1o"); # Sun 8 Jan 2012
15 15
 
16 16
 
17 17
 #
@@ -19,18 +19,18 @@  discard block
 block discarded – undo
19 19
 #
20 20
 
21 21
 # Change to ">" for HTML output
22
-@define( 'MARKDOWN_EMPTY_ELEMENT_SUFFIX',  " />");
22
+@define('MARKDOWN_EMPTY_ELEMENT_SUFFIX', " />");
23 23
 
24 24
 # Define the width of a tab for code blocks.
25
-@define( 'MARKDOWN_TAB_WIDTH',     4 );
25
+@define('MARKDOWN_TAB_WIDTH', 4);
26 26
 
27 27
 # Optional title attribute for footnote links and backlinks.
28
-@define( 'MARKDOWN_FN_LINK_TITLE',         "" );
29
-@define( 'MARKDOWN_FN_BACKLINK_TITLE',     "" );
28
+@define('MARKDOWN_FN_LINK_TITLE', "");
29
+@define('MARKDOWN_FN_BACKLINK_TITLE', "");
30 30
 
31 31
 # Optional class attribute for footnote links and backlinks.
32
-@define( 'MARKDOWN_FN_LINK_CLASS',         "" );
33
-@define( 'MARKDOWN_FN_BACKLINK_CLASS',     "" );
32
+@define('MARKDOWN_FN_LINK_CLASS', "");
33
+@define('MARKDOWN_FN_BACKLINK_CLASS', "");
34 34
 
35 35
 
36 36
 #
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 #
39 39
 
40 40
 # Change to false to remove Markdown from posts and/or comments.
41
-@define( 'MARKDOWN_WP_POSTS',      true );
42
-@define( 'MARKDOWN_WP_COMMENTS',   true );
41
+@define('MARKDOWN_WP_POSTS', true);
42
+@define('MARKDOWN_WP_COMMENTS', true);
43 43
 
44 44
 
45 45
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
 if (!defined('MARKDOWN_PARSER_CLASS'))
49 49
 {
50
-	define( 'MARKDOWN_PARSER_CLASS',  'MarkdownExtra_Parser' );
50
+	define('MARKDOWN_PARSER_CLASS', 'MarkdownExtra_Parser');
51 51
 }
52 52
 
53 53
 function Markdown($text) {
@@ -86,19 +86,19 @@  discard block
 block discarded – undo
86 86
 	# - Run Markdown on excerpt, then remove all tags.
87 87
 	# - Add paragraph tag around the excerpt, but remove it for the excerpt rss.
88 88
 	if (MARKDOWN_WP_POSTS) {
89
-		remove_filter('the_content',     'wpautop');
89
+		remove_filter('the_content', 'wpautop');
90 90
         remove_filter('the_content_rss', 'wpautop');
91
-		remove_filter('the_excerpt',     'wpautop');
92
-		add_filter('the_content',     'mdwp_MarkdownPost', 6);
91
+		remove_filter('the_excerpt', 'wpautop');
92
+		add_filter('the_content', 'mdwp_MarkdownPost', 6);
93 93
         add_filter('the_content_rss', 'mdwp_MarkdownPost', 6);
94 94
 		add_filter('get_the_excerpt', 'mdwp_MarkdownPost', 6);
95 95
 		add_filter('get_the_excerpt', 'trim', 7);
96
-		add_filter('the_excerpt',     'mdwp_add_p');
96
+		add_filter('the_excerpt', 'mdwp_add_p');
97 97
 		add_filter('the_excerpt_rss', 'mdwp_strip_p');
98 98
 
99
-		remove_filter('content_save_pre',  'balanceTags', 50);
100
-		remove_filter('excerpt_save_pre',  'balanceTags', 50);
101
-		add_filter('the_content',  	  'balanceTags', 50);
99
+		remove_filter('content_save_pre', 'balanceTags', 50);
100
+		remove_filter('excerpt_save_pre', 'balanceTags', 50);
101
+		add_filter('the_content', 'balanceTags', 50);
102 102
 		add_filter('get_the_excerpt', 'balanceTags', 9);
103 103
 	}
104 104
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		if (is_single() || is_page() || is_feed()) {
113 113
 			$parser->fn_id_prefix = "";
114 114
 		} else {
115
-			$parser->fn_id_prefix = get_the_ID() . ".";
115
+			$parser->fn_id_prefix = get_the_ID().".";
116 116
 		}
117 117
 		return $parser->transform($text);
118 118
 	}
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 		add_filter('pre_comment_content', 'Markdown', 6);
129 129
 		add_filter('pre_comment_content', 'mdwp_hide_tags', 8);
130 130
 		add_filter('pre_comment_content', 'mdwp_show_tags', 12);
131
-		add_filter('get_comment_text',    'Markdown', 6);
131
+		add_filter('get_comment_text', 'Markdown', 6);
132 132
 		add_filter('get_comment_excerpt', 'Markdown', 6);
133 133
 		add_filter('get_comment_excerpt', 'mdwp_strip_p', 7);
134 134
 
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
 	@include_once 'smartypants.php';
194 194
 	# Fake Textile class. It calls Markdown instead.
195 195
 	class Textile {
196
-		function TextileThis($text, $lite='', $encode='') {
196
+		function TextileThis($text, $lite = '', $encode = '') {
197 197
 			if ($lite == '' && $encode == '')    $text = Markdown($text);
198 198
 			if (function_exists('SmartyPants'))  $text = SmartyPants($text);
199 199
 			return $text;
200 200
 		}
201 201
 		# Fake restricted version: restrictions are not supported for now.
202
-		function TextileRestricted($text, $lite='', $noimage='') {
202
+		function TextileRestricted($text, $lite = '', $noimage = '') {
203 203
 			return $this->TextileThis($text, $lite);
204 204
 		}
205 205
 		# Workaround to ensure compatibility with TextPattern 4.0.3.
@@ -339,16 +339,14 @@  discard block
 block discarded – undo
339 339
 
340 340
 		$this->teardown();
341 341
 
342
-		return $text . "\n";
342
+		return $text."\n";
343 343
 	}
344 344
 
345
-	public $early_gamut = array
346
-	(
345
+	public $early_gamut = array(
347 346
 		'doFencedCodeBlocks' => 5
348 347
 	);
349 348
 
350
-	var $document_gamut = array
351
-	(
349
+	var $document_gamut = array(
352 350
 		# Strip link definitions, store in hashes.
353 351
 		"stripLinkDefinitions" => 20,
354 352
 
@@ -359,8 +357,7 @@  discard block
 block discarded – undo
359 357
 	 * @var array These are all the transformations that form block-level tags like paragraphs, headers, and
360 358
 	 * list items.
361 359
 	 */
362
-	public $block_gamut = array
363
-	(
360
+	public $block_gamut = array(
364 361
 		"doHeaders"         => 10,
365 362
 		"doHorizontalRules" => 20,
366 363
 
@@ -407,7 +404,7 @@  discard block
 block discarded – undo
407 404
 		$link_id = strtolower($matches[1]);
408 405
 		$url = $matches[2] == '' ? $matches[3] : $matches[2];
409 406
 		$this->urls[$link_id] = $url;
410
-		$this->titles[$link_id] =& $matches[4];
407
+		$this->titles[$link_id] = & $matches[4];
411 408
 		return ''; # String that will replace the block
412 409
 	}
413 410
 
@@ -460,8 +457,8 @@  discard block
 block discarded – undo
460 457
 					(?>
461 458
 					  />
462 459
 					|
463
-					  >', $nested_tags_level).	# end of opening tag
464
-					  '.*?'.					# last level nested tag content
460
+					  >', $nested_tags_level).# end of opening tag
461
+					  '.*?'.# last level nested tag content
465 462
 			str_repeat('
466 463
 					  </\2\s*>	# closing nested tag
467 464
 					)
@@ -573,7 +570,7 @@  discard block
 block discarded – undo
573 570
 
574 571
 		# Then hash the block.
575 572
 		static $i = 0;
576
-		$key = "$boundary\x1A" . ++$i . $boundary;
573
+		$key = "$boundary\x1A".++$i.$boundary;
577 574
 		$this->html_hashes[$key] = $text;
578 575
 		return $key; # String that will replace the tag.
579 576
 	}
@@ -756,9 +753,9 @@  discard block
 block discarded – undo
756 753
 		return $text;
757 754
 	}
758 755
 	function _doAnchors_reference_callback($matches) {
759
-		$whole_match =  $matches[1];
760
-		$link_text   =  $matches[2];
761
-		$link_id     =& $matches[3];
756
+		$whole_match = $matches[1];
757
+		$link_text   = $matches[2];
758
+		$link_id     = & $matches[3];
762 759
 
763 760
 		if ($link_id == "") {
764 761
 			# for shortcut links like [this][] or [this].
@@ -774,10 +771,10 @@  discard block
 block discarded – undo
774 771
 			$url = $this->encodeAttribute($url);
775 772
 
776 773
 			$result = "<a href=\"$url\"";
777
-			if ( isset( $this->titles[$link_id] ) ) {
774
+			if (isset($this->titles[$link_id])) {
778 775
 				$title = $this->titles[$link_id];
779 776
 				$title = $this->encodeAttribute($title);
780
-				$result .=  " title=\"$title\"";
777
+				$result .= " title=\"$title\"";
781 778
 			}
782 779
 
783 780
 			$link_text = $this->runSpanGamut($link_text);
@@ -790,17 +787,17 @@  discard block
 block discarded – undo
790 787
 		return $result;
791 788
 	}
792 789
 	function _doAnchors_inline_callback($matches) {
793
-		$whole_match	=  $matches[1];
794
-		$link_text		=  $this->runSpanGamut($matches[2]);
795
-		$url			=  $matches[3] == '' ? $matches[4] : $matches[3];
796
-		$title			=& $matches[7];
790
+		$whole_match = $matches[1];
791
+		$link_text = $this->runSpanGamut($matches[2]);
792
+		$url = $matches[3] == '' ? $matches[4] : $matches[3];
793
+		$title = & $matches[7];
797 794
 
798 795
 		$url = $this->encodeAttribute($url);
799 796
 
800 797
 		$result = "<a href=\"$url\"";
801 798
 		if (isset($title)) {
802 799
 			$title = $this->encodeAttribute($title);
803
-			$result .=  " title=\"$title\"";
800
+			$result .= " title=\"$title\"";
804 801
 		}
805 802
 
806 803
 		$link_text = $this->runSpanGamut($link_text);
@@ -881,7 +878,7 @@  discard block
 block discarded – undo
881 878
 			if (isset($this->titles[$link_id])) {
882 879
 				$title = $this->titles[$link_id];
883 880
 				$title = $this->encodeAttribute($title);
884
-				$result .=  " title=\"$title\"";
881
+				$result .= " title=\"$title\"";
885 882
 			}
886 883
 			$result .= $this->empty_element_suffix;
887 884
 			$result = $this->hashPart($result);
@@ -894,17 +891,17 @@  discard block
 block discarded – undo
894 891
 		return $result;
895 892
 	}
896 893
 	function _doImages_inline_callback($matches) {
897
-		$whole_match	= $matches[1];
898
-		$alt_text		= $matches[2];
899
-		$url			= $matches[3] == '' ? $matches[4] : $matches[3];
900
-		$title			=& $matches[7];
894
+		$whole_match = $matches[1];
895
+		$alt_text = $matches[2];
896
+		$url = $matches[3] == '' ? $matches[4] : $matches[3];
897
+		$title = & $matches[7];
901 898
 
902 899
 		$alt_text = $this->encodeAttribute($alt_text);
903 900
 		$url = $this->encodeAttribute($url);
904 901
 		$result = "<img src=\"$url\" alt=\"$alt_text\"";
905 902
 		if (isset($title)) {
906 903
 			$title = $this->encodeAttribute($title);
907
-			$result .=  " title=\"$title\""; # $title already quoted
904
+			$result .= " title=\"$title\""; # $title already quoted
908 905
 		}
909 906
 		$result .= $this->empty_element_suffix;
910 907
 
@@ -949,12 +946,12 @@  discard block
 block discarded – undo
949 946
 
950 947
 		$level = $matches[2]{0} == '=' ? 1 : 2;
951 948
 		$block = "<h$level>".$this->runSpanGamut($matches[1])."</h$level>";
952
-		return "\n" . $this->hashBlock($block) . "\n\n";
949
+		return "\n".$this->hashBlock($block)."\n\n";
953 950
 	}
954 951
 	function _doHeaders_callback_atx($matches) {
955 952
 		$level = strlen($matches[1]);
956 953
 		$block = "<h$level>".$this->runSpanGamut($matches[2])."</h$level>";
957
-		return "\n" . $this->hashBlock($block) . "\n\n";
954
+		return "\n".$this->hashBlock($block)."\n\n";
958 955
 	}
959 956
 
960 957
 
@@ -1033,13 +1030,13 @@  discard block
 block discarded – undo
1033 1030
 		$list = $matches[1];
1034 1031
 		$list_type = preg_match("/$marker_ul_re/", $matches[4]) ? "ul" : "ol";
1035 1032
 
1036
-		$marker_any_re = ( $list_type == "ul" ? $marker_ul_re : $marker_ol_re );
1033
+		$marker_any_re = ($list_type == "ul" ? $marker_ul_re : $marker_ol_re);
1037 1034
 
1038 1035
 		$list .= "\n";
1039 1036
 		$result = $this->processListItems($list, $marker_any_re);
1040 1037
 
1041
-		$result = $this->hashBlock("<$list_type>\n" . $result . "</$list_type>");
1042
-		return "\n". $result ."\n\n";
1038
+		$result = $this->hashBlock("<$list_type>\n".$result."</$list_type>");
1039
+		return "\n".$result."\n\n";
1043 1040
 	}
1044 1041
 
1045 1042
 	var $list_level = 0;
@@ -1092,16 +1089,16 @@  discard block
 block discarded – undo
1092 1089
 	}
1093 1090
 	function _processListItems_callback($matches) {
1094 1091
 		$item = $matches[4];
1095
-		$leading_line =& $matches[1];
1096
-		$leading_space =& $matches[2];
1092
+		$leading_line = & $matches[1];
1093
+		$leading_space = & $matches[2];
1097 1094
 		$marker_space = $matches[3];
1098
-		$tailing_blank_line =& $matches[5];
1095
+		$tailing_blank_line = & $matches[5];
1099 1096
 
1100 1097
 		if ($leading_line || $tailing_blank_line ||
1101 1098
 			preg_match('/\n{2,}/', $item))
1102 1099
 		{
1103 1100
 			# Replace marker with the appropriate whitespace indentation
1104
-			$item = $leading_space . str_repeat(' ', strlen($marker_space)) . $item;
1101
+			$item = $leading_space.str_repeat(' ', strlen($marker_space)).$item;
1105 1102
 			$item = $this->runBlockGamut($this->outdent($item)."\n");
1106 1103
 		}
1107 1104
 		else {
@@ -1111,7 +1108,7 @@  discard block
 block discarded – undo
1111 1108
 			$item = $this->runSpanGamut($item);
1112 1109
 		}
1113 1110
 
1114
-		return "<li>" . $item . "</li>\n";
1111
+		return "<li>".$item."</li>\n";
1115 1112
 	}
1116 1113
 
1117 1114
 
@@ -1204,7 +1201,7 @@  discard block
 block discarded – undo
1204 1201
 				$token_relist[] = $strong_re;
1205 1202
 
1206 1203
 				# Construct master expression from list.
1207
-				$token_re = '{('. implode('|', $token_relist) .')}';
1204
+				$token_re = '{('.implode('|', $token_relist).')}';
1208 1205
 				$this->em_strong_prepared_relist["$em$strong"] = $token_re;
1209 1206
 			}
1210 1207
 		}
@@ -1230,8 +1227,8 @@  discard block
 block discarded – undo
1230 1227
 			#
1231 1228
 			$parts = preg_split($token_re, $text, 2, PREG_SPLIT_DELIM_CAPTURE);
1232 1229
 			$text_stack[0] .= $parts[0];
1233
-			$token =& $parts[1];
1234
-			$text =& $parts[2];
1230
+			$token = & $parts[1];
1231
+			$text = & $parts[2];
1235 1232
 
1236 1233
 			if (empty($token)) {
1237 1234
 				# Reached end of text span: empty stack without emitting.
@@ -1258,7 +1255,7 @@  discard block
 block discarded – undo
1258 1255
 				} else {
1259 1256
 					# Other closing marker: close one em or strong and
1260 1257
 					# change current token state to match the other
1261
-					$token_stack[0] = str_repeat($token{0}, 3-$token_len);
1258
+					$token_stack[0] = str_repeat($token{0}, 3 - $token_len);
1262 1259
 					$tag = $token_len == 2 ? "strong" : "em";
1263 1260
 					$span = $text_stack[0];
1264 1261
 					$span = $this->runSpanGamut($span);
@@ -1352,7 +1349,7 @@  discard block
 block discarded – undo
1352 1349
 		$bq = $matches[1];
1353 1350
 		# trim one level of quoting - trim whitespace-only lines
1354 1351
 		$bq = preg_replace('/^[ ]*>[ ]?|^[ ]+$/m', '', $bq);
1355
-		$bq = $this->runBlockGamut($bq);		# recurse
1352
+		$bq = $this->runBlockGamut($bq); # recurse
1356 1353
 
1357 1354
 		$bq = preg_replace('/^/m', "  ", $bq);
1358 1355
 		# These leading spaces cause problem with <pre> content,
@@ -1360,7 +1357,7 @@  discard block
 block discarded – undo
1360 1357
 		$bq = preg_replace_callback('{(\s*<pre>.+?</pre>)}sx',
1361 1358
 			array(&$this, '_doBlockQuotes_callback2'), $bq);
1362 1359
 
1363
-		return "\n". $this->hashBlock("<blockquote>\n$bq\n</blockquote>")."\n\n";
1360
+		return "\n".$this->hashBlock("<blockquote>\n$bq\n</blockquote>")."\n\n";
1364 1361
 	}
1365 1362
 	function _doBlockQuotes_callback2($matches) {
1366 1363
 		$pre = $matches[1];
@@ -1462,7 +1459,7 @@  discard block
 block discarded – undo
1462 1459
 			# Ampersand-encoding based entirely on Nat Irons's Amputator
1463 1460
 			# MT plugin: <http://bumppo.net/projects/amputator/>
1464 1461
 			$text = preg_replace('/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/',
1465
-								'&amp;', $text);;
1462
+								'&amp;', $text); ;
1466 1463
 		}
1467 1464
 		# Encode remaining <'s
1468 1465
 		$text = str_replace('<', '&lt;', $text);
@@ -1526,9 +1523,9 @@  discard block
 block discarded – undo
1526 1523
 	#	Based by a filter by Matthew Wickline, posted to BBEdit-Talk.
1527 1524
 	#   With some optimizations by Milian Wolff.
1528 1525
 	#
1529
-		$addr = "mailto:" . $addr;
1526
+		$addr = "mailto:".$addr;
1530 1527
 		$chars = preg_split('/(?<!^)(?!$)/', $addr);
1531
-		$seed = (int)abs(crc32($addr) / strlen($addr)); # Deterministic seed.
1528
+		$seed = (int) abs(crc32($addr) / strlen($addr)); # Deterministic seed.
1532 1529
 
1533 1530
 		foreach ($chars as $key => $char) {
1534 1531
 			$ord = ord($char);
@@ -1564,7 +1561,7 @@  discard block
 block discarded – undo
1564 1561
 				|
1565 1562
 					(?<![`\\\\])
1566 1563
 					`+						# code span marker
1567
-			'.( $this->no_markup ? '' : '
1564
+			'.($this->no_markup ? '' : '
1568 1565
 				|
1569 1566
 					<!--    .*?     -->		# comment
1570 1567
 				|
@@ -1615,7 +1612,7 @@  discard block
 block discarded – undo
1615 1612
 	{
1616 1613
 		switch ($token{0}) {
1617 1614
 			case "\\":
1618
-				return $this->hashPart("&#". ord($token{1}). ";");
1615
+				return $this->hashPart("&#".ord($token{1}).";");
1619 1616
 			case "`":
1620 1617
 				# Search for end marker in remaining text.
1621 1618
 				if (preg_match('/^(.*?[^`])'.preg_quote($token).'(?!`)(.*)$/sm',
@@ -1670,7 +1667,7 @@  discard block
 block discarded – undo
1670 1667
 			# Calculate amount of space, insert spaces, insert block.
1671 1668
 			$amount = $this->tab_width -
1672 1669
 				$strlen($line, 'UTF-8') % $this->tab_width;
1673
-			$line .= str_repeat(" ", $amount) . $block;
1670
+			$line .= str_repeat(" ", $amount).$block;
1674 1671
 		}
1675 1672
 		return $line;
1676 1673
 	}
Please login to merge, or discard this patch.