Passed
Push — master ( 32c874...a28393 )
by David
57s
created
lib/Dwoo/Plugins/Functions/PluginEol.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@
 block discarded – undo
27 27
  */
28 28
 class PluginEol extends Plugin implements ICompilable
29 29
 {
30
-    /**
31
-     * @param Compiler $compiler
32
-     *
33
-     * @return string
34
-     */
35
-    public static function compile(Compiler $compiler)
36
-    {
37
-        return 'PHP_EOL';
38
-    }
30
+	/**
31
+	 * @param Compiler $compiler
32
+	 *
33
+	 * @return string
34
+	 */
35
+	public static function compile(Compiler $compiler)
36
+	{
37
+		return 'PHP_EOL';
38
+	}
39 39
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginCountParagraphs.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,14 +30,14 @@
 block discarded – undo
30 30
  */
31 31
 class PluginCountParagraphs extends Plugin implements ICompilable
32 32
 {
33
-    /**
34
-     * @param Compiler $compiler
35
-     * @param string   $value
36
-     *
37
-     * @return string
38
-     */
39
-    public static function compile(Compiler $compiler, $value)
40
-    {
41
-        return '(preg_match_all(\'#[\r\n]+#\', ' . $value . ', $tmp)+1)';
42
-    }
33
+	/**
34
+	 * @param Compiler $compiler
35
+	 * @param string   $value
36
+	 *
37
+	 * @return string
38
+	 */
39
+	public static function compile(Compiler $compiler, $value)
40
+	{
41
+		return '(preg_match_all(\'#[\r\n]+#\', ' . $value . ', $tmp)+1)';
42
+	}
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,6 +38,6 @@
 block discarded – undo
38 38
      */
39 39
     public static function compile(Compiler $compiler, $value)
40 40
     {
41
-        return '(preg_match_all(\'#[\r\n]+#\', ' . $value . ', $tmp)+1)';
41
+        return '(preg_match_all(\'#[\r\n]+#\', '.$value.', $tmp)+1)';
42 42
     }
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginEscape.php 3 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -34,70 +34,70 @@
 block discarded – undo
34 34
  */
35 35
 class PluginEscape extends Plugin
36 36
 {
37
-    /**
38
-     * @param string $value
39
-     * @param string $format
40
-     * @param null   $charset
41
-     *
42
-     * @return mixed|string
43
-     */
44
-    public function process($value = '', $format = 'html', $charset = null)
45
-    {
46
-        if ($charset === null) {
47
-            $charset = $this->core->getCharset();
48
-        }
37
+	/**
38
+	 * @param string $value
39
+	 * @param string $format
40
+	 * @param null   $charset
41
+	 *
42
+	 * @return mixed|string
43
+	 */
44
+	public function process($value = '', $format = 'html', $charset = null)
45
+	{
46
+		if ($charset === null) {
47
+			$charset = $this->core->getCharset();
48
+		}
49 49
 
50
-        switch ($format) {
51
-            case 'html':
52
-                return htmlspecialchars((string)$value, ENT_QUOTES, $charset);
53
-            case 'htmlall':
54
-                return htmlentities((string)$value, ENT_QUOTES, $charset);
55
-            case 'url':
56
-                return rawurlencode((string)$value);
57
-            case 'urlpathinfo':
58
-                return str_replace('%2F', '/', rawurlencode((string)$value));
59
-            case 'quotes':
60
-                return preg_replace("#(?<!\\\\)'#", "\\'", (string)$value);
61
-            case 'hex':
62
-                $out = '';
63
-                $cnt = strlen((string)$value);
64
-                for ($i = 0; $i < $cnt; ++ $i) {
65
-                    $out .= '%' . bin2hex((string)$value[$i]);
66
-                }
50
+		switch ($format) {
51
+			case 'html':
52
+				return htmlspecialchars((string)$value, ENT_QUOTES, $charset);
53
+			case 'htmlall':
54
+				return htmlentities((string)$value, ENT_QUOTES, $charset);
55
+			case 'url':
56
+				return rawurlencode((string)$value);
57
+			case 'urlpathinfo':
58
+				return str_replace('%2F', '/', rawurlencode((string)$value));
59
+			case 'quotes':
60
+				return preg_replace("#(?<!\\\\)'#", "\\'", (string)$value);
61
+			case 'hex':
62
+				$out = '';
63
+				$cnt = strlen((string)$value);
64
+				for ($i = 0; $i < $cnt; ++ $i) {
65
+					$out .= '%' . bin2hex((string)$value[$i]);
66
+				}
67 67
 
68
-                return $out;
69
-            case 'hexentity':
70
-                $out = '';
71
-                $cnt = strlen((string)$value);
72
-                for ($i = 0; $i < $cnt; ++ $i) {
73
-                    $out .= '&#x' . bin2hex((string)$value[$i]) . ';';
74
-                }
68
+				return $out;
69
+			case 'hexentity':
70
+				$out = '';
71
+				$cnt = strlen((string)$value);
72
+				for ($i = 0; $i < $cnt; ++ $i) {
73
+					$out .= '&#x' . bin2hex((string)$value[$i]) . ';';
74
+				}
75 75
 
76
-                return $out;
77
-            case 'javascript':
78
-            case 'js':
79
-                return strtr((string)$value,
80
-                    array(
81
-                        '\\' => '\\\\',
82
-                        "'"  => "\\'",
83
-                        '"'  => '\\"',
84
-                        "\r" => '\\r',
85
-                        "\n" => '\\n',
86
-                        '</' => '<\/'
87
-                    ));
88
-            case 'mail':
89
-                return str_replace(array(
90
-                    '@',
91
-                    '.'
92
-                ),
93
-                    array(
94
-                        '&nbsp;(AT)&nbsp;',
95
-                        '&nbsp;(DOT)&nbsp;'
96
-                    ),
97
-                    (string)$value);
98
-            default:
99
-                $this->core->triggerError('Escape\'s format argument must be one of : html, htmlall, url, urlpathinfo, hex, hexentity, javascript, js or mail, "' . $format . '" given.',
100
-                    E_USER_WARNING);
101
-        }
102
-    }
76
+				return $out;
77
+			case 'javascript':
78
+			case 'js':
79
+				return strtr((string)$value,
80
+					array(
81
+						'\\' => '\\\\',
82
+						"'"  => "\\'",
83
+						'"'  => '\\"',
84
+						"\r" => '\\r',
85
+						"\n" => '\\n',
86
+						'</' => '<\/'
87
+					));
88
+			case 'mail':
89
+				return str_replace(array(
90
+					'@',
91
+					'.'
92
+				),
93
+					array(
94
+						'&nbsp;(AT)&nbsp;',
95
+						'&nbsp;(DOT)&nbsp;'
96
+					),
97
+					(string)$value);
98
+			default:
99
+				$this->core->triggerError('Escape\'s format argument must be one of : html, htmlall, url, urlpathinfo, hex, hexentity, javascript, js or mail, "' . $format . '" given.',
100
+					E_USER_WARNING);
101
+		}
102
+	}
103 103
 }
104 104
\ No newline at end of file
Please login to merge, or discard this patch.
Switch Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -48,56 +48,56 @@
 block discarded – undo
48 48
         }
49 49
 
50 50
         switch ($format) {
51
-            case 'html':
52
-                return htmlspecialchars((string)$value, ENT_QUOTES, $charset);
53
-            case 'htmlall':
54
-                return htmlentities((string)$value, ENT_QUOTES, $charset);
55
-            case 'url':
56
-                return rawurlencode((string)$value);
57
-            case 'urlpathinfo':
58
-                return str_replace('%2F', '/', rawurlencode((string)$value));
59
-            case 'quotes':
60
-                return preg_replace("#(?<!\\\\)'#", "\\'", (string)$value);
61
-            case 'hex':
62
-                $out = '';
63
-                $cnt = strlen((string)$value);
64
-                for ($i = 0; $i < $cnt; ++ $i) {
65
-                    $out .= '%' . bin2hex((string)$value[$i]);
66
-                }
51
+        case 'html':
52
+            return htmlspecialchars((string)$value, ENT_QUOTES, $charset);
53
+        case 'htmlall':
54
+            return htmlentities((string)$value, ENT_QUOTES, $charset);
55
+        case 'url':
56
+            return rawurlencode((string)$value);
57
+        case 'urlpathinfo':
58
+            return str_replace('%2F', '/', rawurlencode((string)$value));
59
+        case 'quotes':
60
+            return preg_replace("#(?<!\\\\)'#", "\\'", (string)$value);
61
+        case 'hex':
62
+            $out = '';
63
+            $cnt = strlen((string)$value);
64
+            for ($i = 0; $i < $cnt; ++ $i) {
65
+                $out .= '%' . bin2hex((string)$value[$i]);
66
+            }
67 67
 
68
-                return $out;
69
-            case 'hexentity':
70
-                $out = '';
71
-                $cnt = strlen((string)$value);
72
-                for ($i = 0; $i < $cnt; ++ $i) {
73
-                    $out .= '&#x' . bin2hex((string)$value[$i]) . ';';
74
-                }
68
+            return $out;
69
+        case 'hexentity':
70
+            $out = '';
71
+            $cnt = strlen((string)$value);
72
+            for ($i = 0; $i < $cnt; ++ $i) {
73
+                $out .= '&#x' . bin2hex((string)$value[$i]) . ';';
74
+            }
75 75
 
76
-                return $out;
77
-            case 'javascript':
78
-            case 'js':
79
-                return strtr((string)$value,
80
-                    array(
81
-                        '\\' => '\\\\',
82
-                        "'"  => "\\'",
83
-                        '"'  => '\\"',
84
-                        "\r" => '\\r',
85
-                        "\n" => '\\n',
86
-                        '</' => '<\/'
87
-                    ));
88
-            case 'mail':
89
-                return str_replace(array(
90
-                    '@',
91
-                    '.'
76
+            return $out;
77
+        case 'javascript':
78
+        case 'js':
79
+            return strtr((string)$value,
80
+                array(
81
+                    '\\' => '\\\\',
82
+                    "'"  => "\\'",
83
+                    '"'  => '\\"',
84
+                    "\r" => '\\r',
85
+                    "\n" => '\\n',
86
+                    '</' => '<\/'
87
+                ));
88
+        case 'mail':
89
+            return str_replace(array(
90
+                '@',
91
+                '.'
92
+            ),
93
+                array(
94
+                    '&nbsp;(AT)&nbsp;',
95
+                    '&nbsp;(DOT)&nbsp;'
92 96
                 ),
93
-                    array(
94
-                        '&nbsp;(AT)&nbsp;',
95
-                        '&nbsp;(DOT)&nbsp;'
96
-                    ),
97
-                    (string)$value);
98
-            default:
99
-                $this->core->triggerError('Escape\'s format argument must be one of : html, htmlall, url, urlpathinfo, hex, hexentity, javascript, js or mail, "' . $format . '" given.',
100
-                    E_USER_WARNING);
97
+                (string)$value);
98
+        default:
99
+            $this->core->triggerError('Escape\'s format argument must be one of : html, htmlall, url, urlpathinfo, hex, hexentity, javascript, js or mail, "' . $format . '" given.',
100
+                E_USER_WARNING);
101 101
         }
102 102
     }
103 103
 }
104 104
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -49,34 +49,34 @@  discard block
 block discarded – undo
49 49
 
50 50
         switch ($format) {
51 51
             case 'html':
52
-                return htmlspecialchars((string)$value, ENT_QUOTES, $charset);
52
+                return htmlspecialchars((string) $value, ENT_QUOTES, $charset);
53 53
             case 'htmlall':
54
-                return htmlentities((string)$value, ENT_QUOTES, $charset);
54
+                return htmlentities((string) $value, ENT_QUOTES, $charset);
55 55
             case 'url':
56
-                return rawurlencode((string)$value);
56
+                return rawurlencode((string) $value);
57 57
             case 'urlpathinfo':
58
-                return str_replace('%2F', '/', rawurlencode((string)$value));
58
+                return str_replace('%2F', '/', rawurlencode((string) $value));
59 59
             case 'quotes':
60
-                return preg_replace("#(?<!\\\\)'#", "\\'", (string)$value);
60
+                return preg_replace("#(?<!\\\\)'#", "\\'", (string) $value);
61 61
             case 'hex':
62 62
                 $out = '';
63
-                $cnt = strlen((string)$value);
63
+                $cnt = strlen((string) $value);
64 64
                 for ($i = 0; $i < $cnt; ++ $i) {
65
-                    $out .= '%' . bin2hex((string)$value[$i]);
65
+                    $out .= '%'.bin2hex((string) $value[$i]);
66 66
                 }
67 67
 
68 68
                 return $out;
69 69
             case 'hexentity':
70 70
                 $out = '';
71
-                $cnt = strlen((string)$value);
71
+                $cnt = strlen((string) $value);
72 72
                 for ($i = 0; $i < $cnt; ++ $i) {
73
-                    $out .= '&#x' . bin2hex((string)$value[$i]) . ';';
73
+                    $out .= '&#x'.bin2hex((string) $value[$i]).';';
74 74
                 }
75 75
 
76 76
                 return $out;
77 77
             case 'javascript':
78 78
             case 'js':
79
-                return strtr((string)$value,
79
+                return strtr((string) $value,
80 80
                     array(
81 81
                         '\\' => '\\\\',
82 82
                         "'"  => "\\'",
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
                         '&nbsp;(AT)&nbsp;',
95 95
                         '&nbsp;(DOT)&nbsp;'
96 96
                     ),
97
-                    (string)$value);
97
+                    (string) $value);
98 98
             default:
99
-                $this->core->triggerError('Escape\'s format argument must be one of : html, htmlall, url, urlpathinfo, hex, hexentity, javascript, js or mail, "' . $format . '" given.',
99
+                $this->core->triggerError('Escape\'s format argument must be one of : html, htmlall, url, urlpathinfo, hex, hexentity, javascript, js or mail, "'.$format.'" given.',
100 100
                     E_USER_WARNING);
101 101
         }
102 102
     }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginSafe.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -31,16 +31,16 @@
 block discarded – undo
31 31
 class PluginSafe extends Plugin implements ICompilable
32 32
 {
33 33
 
34
-    /**
35
-     * @param Compiler $compiler
36
-     * @param mixed    $var
37
-     *
38
-     * @return mixed
39
-     */
40
-    public static function compile(Compiler $compiler, $var)
41
-    {
42
-        return preg_replace('#\(is_string\(\$tmp=(.+)\) \? htmlspecialchars\(\$tmp, ENT_QUOTES, \$this->charset\) : \$tmp\)#',
43
-            '$1',
44
-            $var);
45
-    }
34
+	/**
35
+	 * @param Compiler $compiler
36
+	 * @param mixed    $var
37
+	 *
38
+	 * @return mixed
39
+	 */
40
+	public static function compile(Compiler $compiler, $var)
41
+	{
42
+		return preg_replace('#\(is_string\(\$tmp=(.+)\) \? htmlspecialchars\(\$tmp, ENT_QUOTES, \$this->charset\) : \$tmp\)#',
43
+			'$1',
44
+			$var);
45
+	}
46 46
 }
47 47
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginMailto.php 3 patches
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -36,109 +36,109 @@
 block discarded – undo
36 36
  */
37 37
 class PluginMailto extends Plugin
38 38
 {
39
-    /**
40
-     * @param      $address
41
-     * @param null $text
42
-     * @param null $subject
43
-     * @param null $encode
44
-     * @param null $cc
45
-     * @param null $bcc
46
-     * @param null $newsgroups
47
-     * @param null $followupto
48
-     * @param null $extra
49
-     *
50
-     * @return string
51
-     */
52
-    public function process($address, $text = null, $subject = null, $encode = null, $cc = null, $bcc = null, $newsgroups = null, $followupto = null, $extra = null)
53
-    {
54
-        if (empty($address)) {
55
-            return '';
56
-        }
57
-        if (empty($text)) {
58
-            $text = $address;
59
-        }
60
-
61
-        // build address string
62
-        $address .= '?';
63
-
64
-        if (!empty($subject)) {
65
-            $address .= 'subject=' . rawurlencode($subject) . '&';
66
-        }
67
-        if (!empty($cc)) {
68
-            $address .= 'cc=' . rawurlencode($cc) . '&';
69
-        }
70
-        if (!empty($bcc)) {
71
-            $address .= 'bcc=' . rawurlencode($bcc) . '&';
72
-        }
73
-        if (!empty($newsgroups)) {
74
-            $address .= 'newsgroups=' . rawurlencode($newsgroups) . '&';
75
-        }
76
-        if (!empty($followupto)) {
77
-            $address .= 'followupto=' . rawurlencode($followupto) . '&';
78
-        }
79
-
80
-        $address = rtrim($address, '?&');
81
-
82
-        // output
83
-        switch ($encode) {
84
-
85
-            case 'none':
86
-            case null:
87
-                return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
88
-
89
-            case 'js':
90
-            case 'javascript':
91
-                $str = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');';
92
-                $len = strlen($str);
93
-
94
-                $out = '';
95
-                for ($i = 0; $i < $len; ++ $i) {
96
-                    $out .= '%' . bin2hex($str[$i]);
97
-                }
98
-
99
-                return '<script type="text/javascript">eval(unescape(\'' . $out . '\'));</script>';
100
-
101
-                break;
102
-            case 'javascript_charcode':
103
-            case 'js_charcode':
104
-            case 'jscharcode':
105
-            case 'jschar':
106
-                $str = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
107
-                $len = strlen($str);
108
-
109
-                $out = '<script type="text/javascript">' . "\n<!--\ndocument.write(Str.fromCharCode(";
110
-                for ($i = 0; $i < $len; ++ $i) {
111
-                    $out .= ord($str[$i]) . ',';
112
-                }
113
-
114
-                return rtrim($out, ',') . "));\n-->\n</script>\n";
115
-
116
-                break;
117
-
118
-            case 'hex':
119
-                if (strpos($address, '?') !== false) {
120
-                    $this->core->triggerError('Mailto: Hex encoding is not possible with extra attributes, use one of : <em>js, jscharcode or none</em>.', E_USER_WARNING);
121
-                }
122
-
123
-                $out = '<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;';
124
-                $len = strlen($address);
125
-                for ($i = 0; $i < $len; ++ $i) {
126
-                    if (preg_match('#\w#', $address[$i])) {
127
-                        $out .= '%' . bin2hex($address[$i]);
128
-                    } else {
129
-                        $out .= $address[$i];
130
-                    }
131
-                }
132
-                $out .= '" ' . $extra . '>';
133
-                $len = strlen($text);
134
-                for ($i = 0; $i < $len; ++ $i) {
135
-                    $out .= '&#x' . bin2hex($text[$i]);
136
-                }
137
-
138
-                return $out . '</a>';
139
-
140
-            default:
141
-                $this->core->triggerError('Mailto: <em>encode</em> argument is invalid, it must be one of : <em>none (= no value), js, js_charcode or hex</em>', E_USER_WARNING);
142
-        }
143
-    }
39
+	/**
40
+	 * @param      $address
41
+	 * @param null $text
42
+	 * @param null $subject
43
+	 * @param null $encode
44
+	 * @param null $cc
45
+	 * @param null $bcc
46
+	 * @param null $newsgroups
47
+	 * @param null $followupto
48
+	 * @param null $extra
49
+	 *
50
+	 * @return string
51
+	 */
52
+	public function process($address, $text = null, $subject = null, $encode = null, $cc = null, $bcc = null, $newsgroups = null, $followupto = null, $extra = null)
53
+	{
54
+		if (empty($address)) {
55
+			return '';
56
+		}
57
+		if (empty($text)) {
58
+			$text = $address;
59
+		}
60
+
61
+		// build address string
62
+		$address .= '?';
63
+
64
+		if (!empty($subject)) {
65
+			$address .= 'subject=' . rawurlencode($subject) . '&';
66
+		}
67
+		if (!empty($cc)) {
68
+			$address .= 'cc=' . rawurlencode($cc) . '&';
69
+		}
70
+		if (!empty($bcc)) {
71
+			$address .= 'bcc=' . rawurlencode($bcc) . '&';
72
+		}
73
+		if (!empty($newsgroups)) {
74
+			$address .= 'newsgroups=' . rawurlencode($newsgroups) . '&';
75
+		}
76
+		if (!empty($followupto)) {
77
+			$address .= 'followupto=' . rawurlencode($followupto) . '&';
78
+		}
79
+
80
+		$address = rtrim($address, '?&');
81
+
82
+		// output
83
+		switch ($encode) {
84
+
85
+			case 'none':
86
+			case null:
87
+				return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
88
+
89
+			case 'js':
90
+			case 'javascript':
91
+				$str = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');';
92
+				$len = strlen($str);
93
+
94
+				$out = '';
95
+				for ($i = 0; $i < $len; ++ $i) {
96
+					$out .= '%' . bin2hex($str[$i]);
97
+				}
98
+
99
+				return '<script type="text/javascript">eval(unescape(\'' . $out . '\'));</script>';
100
+
101
+				break;
102
+			case 'javascript_charcode':
103
+			case 'js_charcode':
104
+			case 'jscharcode':
105
+			case 'jschar':
106
+				$str = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
107
+				$len = strlen($str);
108
+
109
+				$out = '<script type="text/javascript">' . "\n<!--\ndocument.write(Str.fromCharCode(";
110
+				for ($i = 0; $i < $len; ++ $i) {
111
+					$out .= ord($str[$i]) . ',';
112
+				}
113
+
114
+				return rtrim($out, ',') . "));\n-->\n</script>\n";
115
+
116
+				break;
117
+
118
+			case 'hex':
119
+				if (strpos($address, '?') !== false) {
120
+					$this->core->triggerError('Mailto: Hex encoding is not possible with extra attributes, use one of : <em>js, jscharcode or none</em>.', E_USER_WARNING);
121
+				}
122
+
123
+				$out = '<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;';
124
+				$len = strlen($address);
125
+				for ($i = 0; $i < $len; ++ $i) {
126
+					if (preg_match('#\w#', $address[$i])) {
127
+						$out .= '%' . bin2hex($address[$i]);
128
+					} else {
129
+						$out .= $address[$i];
130
+					}
131
+				}
132
+				$out .= '" ' . $extra . '>';
133
+				$len = strlen($text);
134
+				for ($i = 0; $i < $len; ++ $i) {
135
+					$out .= '&#x' . bin2hex($text[$i]);
136
+				}
137
+
138
+				return $out . '</a>';
139
+
140
+			default:
141
+				$this->core->triggerError('Mailto: <em>encode</em> argument is invalid, it must be one of : <em>none (= no value), js, js_charcode or hex</em>', E_USER_WARNING);
142
+		}
143
+	}
144 144
 }
145 145
\ No newline at end of file
Please login to merge, or discard this patch.
Switch Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -82,63 +82,63 @@
 block discarded – undo
82 82
         // output
83 83
         switch ($encode) {
84 84
 
85
-            case 'none':
86
-            case null:
87
-                return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
88
-
89
-            case 'js':
90
-            case 'javascript':
91
-                $str = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');';
92
-                $len = strlen($str);
93
-
94
-                $out = '';
95
-                for ($i = 0; $i < $len; ++ $i) {
96
-                    $out .= '%' . bin2hex($str[$i]);
85
+        case 'none':
86
+        case null:
87
+            return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
88
+
89
+        case 'js':
90
+        case 'javascript':
91
+            $str = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');';
92
+            $len = strlen($str);
93
+
94
+            $out = '';
95
+            for ($i = 0; $i < $len; ++ $i) {
96
+                $out .= '%' . bin2hex($str[$i]);
97
+            }
98
+
99
+            return '<script type="text/javascript">eval(unescape(\'' . $out . '\'));</script>';
100
+
101
+            break;
102
+        case 'javascript_charcode':
103
+        case 'js_charcode':
104
+        case 'jscharcode':
105
+        case 'jschar':
106
+            $str = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
107
+            $len = strlen($str);
108
+
109
+            $out = '<script type="text/javascript">' . "\n<!--\ndocument.write(Str.fromCharCode(";
110
+            for ($i = 0; $i < $len; ++ $i) {
111
+                $out .= ord($str[$i]) . ',';
112
+            }
113
+
114
+            return rtrim($out, ',') . "));\n-->\n</script>\n";
115
+
116
+            break;
117
+
118
+        case 'hex':
119
+            if (strpos($address, '?') !== false) {
120
+                $this->core->triggerError('Mailto: Hex encoding is not possible with extra attributes, use one of : <em>js, jscharcode or none</em>.', E_USER_WARNING);
121
+            }
122
+
123
+            $out = '<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;';
124
+            $len = strlen($address);
125
+            for ($i = 0; $i < $len; ++ $i) {
126
+                if (preg_match('#\w#', $address[$i])) {
127
+                    $out .= '%' . bin2hex($address[$i]);
128
+                } else {
129
+                    $out .= $address[$i];
97 130
                 }
131
+            }
132
+            $out .= '" ' . $extra . '>';
133
+            $len = strlen($text);
134
+            for ($i = 0; $i < $len; ++ $i) {
135
+                $out .= '&#x' . bin2hex($text[$i]);
136
+            }
98 137
 
99
-                return '<script type="text/javascript">eval(unescape(\'' . $out . '\'));</script>';
138
+            return $out . '</a>';
100 139
 
101
-                break;
102
-            case 'javascript_charcode':
103
-            case 'js_charcode':
104
-            case 'jscharcode':
105
-            case 'jschar':
106
-                $str = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
107
-                $len = strlen($str);
108
-
109
-                $out = '<script type="text/javascript">' . "\n<!--\ndocument.write(Str.fromCharCode(";
110
-                for ($i = 0; $i < $len; ++ $i) {
111
-                    $out .= ord($str[$i]) . ',';
112
-                }
113
-
114
-                return rtrim($out, ',') . "));\n-->\n</script>\n";
115
-
116
-                break;
117
-
118
-            case 'hex':
119
-                if (strpos($address, '?') !== false) {
120
-                    $this->core->triggerError('Mailto: Hex encoding is not possible with extra attributes, use one of : <em>js, jscharcode or none</em>.', E_USER_WARNING);
121
-                }
122
-
123
-                $out = '<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;';
124
-                $len = strlen($address);
125
-                for ($i = 0; $i < $len; ++ $i) {
126
-                    if (preg_match('#\w#', $address[$i])) {
127
-                        $out .= '%' . bin2hex($address[$i]);
128
-                    } else {
129
-                        $out .= $address[$i];
130
-                    }
131
-                }
132
-                $out .= '" ' . $extra . '>';
133
-                $len = strlen($text);
134
-                for ($i = 0; $i < $len; ++ $i) {
135
-                    $out .= '&#x' . bin2hex($text[$i]);
136
-                }
137
-
138
-                return $out . '</a>';
139
-
140
-            default:
141
-                $this->core->triggerError('Mailto: <em>encode</em> argument is invalid, it must be one of : <em>none (= no value), js, js_charcode or hex</em>', E_USER_WARNING);
140
+        default:
141
+            $this->core->triggerError('Mailto: <em>encode</em> argument is invalid, it must be one of : <em>none (= no value), js, js_charcode or hex</em>', E_USER_WARNING);
142 142
         }
143 143
     }
144 144
 }
145 145
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -62,19 +62,19 @@  discard block
 block discarded – undo
62 62
         $address .= '?';
63 63
 
64 64
         if (!empty($subject)) {
65
-            $address .= 'subject=' . rawurlencode($subject) . '&';
65
+            $address .= 'subject='.rawurlencode($subject).'&';
66 66
         }
67 67
         if (!empty($cc)) {
68
-            $address .= 'cc=' . rawurlencode($cc) . '&';
68
+            $address .= 'cc='.rawurlencode($cc).'&';
69 69
         }
70 70
         if (!empty($bcc)) {
71
-            $address .= 'bcc=' . rawurlencode($bcc) . '&';
71
+            $address .= 'bcc='.rawurlencode($bcc).'&';
72 72
         }
73 73
         if (!empty($newsgroups)) {
74
-            $address .= 'newsgroups=' . rawurlencode($newsgroups) . '&';
74
+            $address .= 'newsgroups='.rawurlencode($newsgroups).'&';
75 75
         }
76 76
         if (!empty($followupto)) {
77
-            $address .= 'followupto=' . rawurlencode($followupto) . '&';
77
+            $address .= 'followupto='.rawurlencode($followupto).'&';
78 78
         }
79 79
 
80 80
         $address = rtrim($address, '?&');
@@ -84,34 +84,34 @@  discard block
 block discarded – undo
84 84
 
85 85
             case 'none':
86 86
             case null:
87
-                return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
87
+                return '<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>';
88 88
 
89 89
             case 'js':
90 90
             case 'javascript':
91
-                $str = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');';
91
+                $str = 'document.write(\'<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>\');';
92 92
                 $len = strlen($str);
93 93
 
94 94
                 $out = '';
95 95
                 for ($i = 0; $i < $len; ++ $i) {
96
-                    $out .= '%' . bin2hex($str[$i]);
96
+                    $out .= '%'.bin2hex($str[$i]);
97 97
                 }
98 98
 
99
-                return '<script type="text/javascript">eval(unescape(\'' . $out . '\'));</script>';
99
+                return '<script type="text/javascript">eval(unescape(\''.$out.'\'));</script>';
100 100
 
101 101
                 break;
102 102
             case 'javascript_charcode':
103 103
             case 'js_charcode':
104 104
             case 'jscharcode':
105 105
             case 'jschar':
106
-                $str = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
106
+                $str = '<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>';
107 107
                 $len = strlen($str);
108 108
 
109
-                $out = '<script type="text/javascript">' . "\n<!--\ndocument.write(Str.fromCharCode(";
109
+                $out = '<script type="text/javascript">'."\n<!--\ndocument.write(Str.fromCharCode(";
110 110
                 for ($i = 0; $i < $len; ++ $i) {
111
-                    $out .= ord($str[$i]) . ',';
111
+                    $out .= ord($str[$i]).',';
112 112
                 }
113 113
 
114
-                return rtrim($out, ',') . "));\n-->\n</script>\n";
114
+                return rtrim($out, ',')."));\n-->\n</script>\n";
115 115
 
116 116
                 break;
117 117
 
@@ -124,18 +124,18 @@  discard block
 block discarded – undo
124 124
                 $len = strlen($address);
125 125
                 for ($i = 0; $i < $len; ++ $i) {
126 126
                     if (preg_match('#\w#', $address[$i])) {
127
-                        $out .= '%' . bin2hex($address[$i]);
127
+                        $out .= '%'.bin2hex($address[$i]);
128 128
                     } else {
129 129
                         $out .= $address[$i];
130 130
                     }
131 131
                 }
132
-                $out .= '" ' . $extra . '>';
132
+                $out .= '" '.$extra.'>';
133 133
                 $len = strlen($text);
134 134
                 for ($i = 0; $i < $len; ++ $i) {
135
-                    $out .= '&#x' . bin2hex($text[$i]);
135
+                    $out .= '&#x'.bin2hex($text[$i]);
136 136
                 }
137 137
 
138
-                return $out . '</a>';
138
+                return $out.'</a>';
139 139
 
140 140
             default:
141 141
                 $this->core->triggerError('Mailto: <em>encode</em> argument is invalid, it must be one of : <em>none (= no value), js, js_charcode or hex</em>', E_USER_WARNING);
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginInclude.php 3 patches
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -36,75 +36,75 @@
 block discarded – undo
36 36
  */
37 37
 class PluginInclude extends Plugin
38 38
 {
39
-    /**
40
-     * @param        $file
41
-     * @param null   $cache_time
42
-     * @param null   $cache_id
43
-     * @param null   $compile_id
44
-     * @param string $data
45
-     * @param null   $assign
46
-     * @param array  $rest
47
-     *
48
-     * @return string
49
-     */
50
-    public function process($file, $cache_time = null, $cache_id = null, $compile_id = null, $data = '_root', $assign = null, array $rest = array())
51
-    {
52
-        $include = null;
53
-        if ($file === '') {
54
-            return '';
55
-        }
39
+	/**
40
+	 * @param        $file
41
+	 * @param null   $cache_time
42
+	 * @param null   $cache_id
43
+	 * @param null   $compile_id
44
+	 * @param string $data
45
+	 * @param null   $assign
46
+	 * @param array  $rest
47
+	 *
48
+	 * @return string
49
+	 */
50
+	public function process($file, $cache_time = null, $cache_id = null, $compile_id = null, $data = '_root', $assign = null, array $rest = array())
51
+	{
52
+		$include = null;
53
+		if ($file === '') {
54
+			return '';
55
+		}
56 56
 
57
-        if (preg_match('#^([a-z]{2,}):(.*)$#i', $file, $m)) {
58
-            // resource:identifier given, extract them
59
-            $resource   = $m[1];
60
-            $identifier = $m[2];
61
-        } else {
62
-            // get the current template's resource
63
-            $resource   = $this->core->getTemplate()->getResourceName();
64
-            $identifier = $file;
65
-        }
57
+		if (preg_match('#^([a-z]{2,}):(.*)$#i', $file, $m)) {
58
+			// resource:identifier given, extract them
59
+			$resource   = $m[1];
60
+			$identifier = $m[2];
61
+		} else {
62
+			// get the current template's resource
63
+			$resource   = $this->core->getTemplate()->getResourceName();
64
+			$identifier = $file;
65
+		}
66 66
 
67
-        try {
68
-            $include = $this->core->templateFactory($resource, $identifier, $cache_time, $cache_id, $compile_id);
69
-        }
70
-        catch (SecurityException $e) {
71
-            $this->core->triggerError('Include : Security restriction : ' . $e->getMessage(), E_USER_WARNING);
72
-        }
73
-        catch (Exception $e) {
74
-            $this->core->triggerError('Include : ' . $e->getMessage(), E_USER_WARNING);
75
-        }
67
+		try {
68
+			$include = $this->core->templateFactory($resource, $identifier, $cache_time, $cache_id, $compile_id);
69
+		}
70
+		catch (SecurityException $e) {
71
+			$this->core->triggerError('Include : Security restriction : ' . $e->getMessage(), E_USER_WARNING);
72
+		}
73
+		catch (Exception $e) {
74
+			$this->core->triggerError('Include : ' . $e->getMessage(), E_USER_WARNING);
75
+		}
76 76
 
77
-        if ($include === null) {
78
-            $this->core->triggerError('Include : Resource "' . $resource . ':' . $identifier . '" not found.',
79
-                E_USER_WARNING);
80
-        } elseif ($include === false) {
81
-            $this->core->triggerError('Include : Resource "' . $resource . '" does not support includes.',
82
-                E_USER_WARNING);
83
-        }
77
+		if ($include === null) {
78
+			$this->core->triggerError('Include : Resource "' . $resource . ':' . $identifier . '" not found.',
79
+				E_USER_WARNING);
80
+		} elseif ($include === false) {
81
+			$this->core->triggerError('Include : Resource "' . $resource . '" does not support includes.',
82
+				E_USER_WARNING);
83
+		}
84 84
 
85
-        if (is_string($data)) {
86
-            $vars = $this->core->readVar($data);
87
-        } else {
88
-            $vars = $data;
89
-        }
85
+		if (is_string($data)) {
86
+			$vars = $this->core->readVar($data);
87
+		} else {
88
+			$vars = $data;
89
+		}
90 90
 
91
-        if (count($rest)) {
92
-            $vars = $rest + $vars;
93
-        }
91
+		if (count($rest)) {
92
+			$vars = $rest + $vars;
93
+		}
94 94
 
95
-        $clone = clone $this->core;
96
-        $out   = $clone->get($include, $vars);
95
+		$clone = clone $this->core;
96
+		$out   = $clone->get($include, $vars);
97 97
 
98
-        if ($assign !== null) {
99
-            $this->core->assignInScope($out, $assign);
100
-        }
98
+		if ($assign !== null) {
99
+			$this->core->assignInScope($out, $assign);
100
+		}
101 101
 
102
-        foreach ($clone->getReturnValues() as $name => $value) {
103
-            $this->core->assignInScope($value, $name);
104
-        }
102
+		foreach ($clone->getReturnValues() as $name => $value) {
103
+			$this->core->assignInScope($value, $name);
104
+		}
105 105
 
106
-        if ($assign === null) {
107
-            return $out;
108
-        }
109
-    }
106
+		if ($assign === null) {
107
+			return $out;
108
+		}
109
+	}
110 110
 }
111 111
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -68,17 +68,17 @@  discard block
 block discarded – undo
68 68
             $include = $this->core->templateFactory($resource, $identifier, $cache_time, $cache_id, $compile_id);
69 69
         }
70 70
         catch (SecurityException $e) {
71
-            $this->core->triggerError('Include : Security restriction : ' . $e->getMessage(), E_USER_WARNING);
71
+            $this->core->triggerError('Include : Security restriction : '.$e->getMessage(), E_USER_WARNING);
72 72
         }
73 73
         catch (Exception $e) {
74
-            $this->core->triggerError('Include : ' . $e->getMessage(), E_USER_WARNING);
74
+            $this->core->triggerError('Include : '.$e->getMessage(), E_USER_WARNING);
75 75
         }
76 76
 
77 77
         if ($include === null) {
78
-            $this->core->triggerError('Include : Resource "' . $resource . ':' . $identifier . '" not found.',
78
+            $this->core->triggerError('Include : Resource "'.$resource.':'.$identifier.'" not found.',
79 79
                 E_USER_WARNING);
80 80
         } elseif ($include === false) {
81
-            $this->core->triggerError('Include : Resource "' . $resource . '" does not support includes.',
81
+            $this->core->triggerError('Include : Resource "'.$resource.'" does not support includes.',
82 82
                 E_USER_WARNING);
83 83
         }
84 84
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         }
90 90
 
91 91
         if (count($rest)) {
92
-            $vars = $rest + $vars;
92
+            $vars = $rest+$vars;
93 93
         }
94 94
 
95 95
         $clone = clone $this->core;
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -66,11 +66,9 @@
 block discarded – undo
66 66
 
67 67
         try {
68 68
             $include = $this->core->templateFactory($resource, $identifier, $cache_time, $cache_id, $compile_id);
69
-        }
70
-        catch (SecurityException $e) {
69
+        } catch (SecurityException $e) {
71 70
             $this->core->triggerError('Include : Security restriction : ' . $e->getMessage(), E_USER_WARNING);
72
-        }
73
-        catch (Exception $e) {
71
+        } catch (Exception $e) {
74 72
             $this->core->triggerError('Include : ' . $e->getMessage(), E_USER_WARNING);
75 73
         }
76 74
 
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginEval.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -37,26 +37,26 @@
 block discarded – undo
37 37
  */
38 38
 class PluginEval extends Plugin
39 39
 {
40
-    /**
41
-     * @param string $var
42
-     * @param null   $assign
43
-     *
44
-     * @return string
45
-     */
46
-    public function process($var, $assign = null)
47
-    {
48
-        if ($var == '') {
49
-            return '';
50
-        }
40
+	/**
41
+	 * @param string $var
42
+	 * @param null   $assign
43
+	 *
44
+	 * @return string
45
+	 */
46
+	public function process($var, $assign = null)
47
+	{
48
+		if ($var == '') {
49
+			return '';
50
+		}
51 51
 
52
-        $tpl   = new TemplateString($var);
53
-        $clone = clone $this->core;
54
-        $out   = $clone->get($tpl, $this->core->readVar('_parent'));
52
+		$tpl   = new TemplateString($var);
53
+		$clone = clone $this->core;
54
+		$out   = $clone->get($tpl, $this->core->readVar('_parent'));
55 55
 
56
-        if ($assign !== null) {
57
-            $this->core->assignInScope($out, $assign);
58
-        } else {
59
-            return $out;
60
-        }
61
-    }
56
+		if ($assign !== null) {
57
+			$this->core->assignInScope($out, $assign);
58
+		} else {
59
+			return $out;
60
+		}
61
+	}
62 62
 }
63 63
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginTif.php 3 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -36,70 +36,70 @@
 block discarded – undo
36 36
  */
37 37
 class PluginTif extends Plugin implements ICompilable
38 38
 {
39
-    /**
40
-     * @param Compiler $compiler
41
-     * @param array    $rest
42
-     * @param array    $tokens
43
-     *
44
-     * @return mixed|string
45
-     * @throws CompilationException
46
-     */
47
-    public static function compile(Compiler $compiler, array $rest, array $tokens)
48
-    {
49
-        // load if plugin
50
-        if (!class_exists(Core::NAMESPACE_PLUGINS_BLOCKS . 'PluginIf')) {
51
-            try {
52
-                $compiler->getDwoo()->getLoader()->loadPlugin('if');
53
-            }
54
-            catch (Exception $e) {
55
-                throw new CompilationException($compiler, 'Tif: the if plugin is required to use Tif');
56
-            }
57
-        }
39
+	/**
40
+	 * @param Compiler $compiler
41
+	 * @param array    $rest
42
+	 * @param array    $tokens
43
+	 *
44
+	 * @return mixed|string
45
+	 * @throws CompilationException
46
+	 */
47
+	public static function compile(Compiler $compiler, array $rest, array $tokens)
48
+	{
49
+		// load if plugin
50
+		if (!class_exists(Core::NAMESPACE_PLUGINS_BLOCKS . 'PluginIf')) {
51
+			try {
52
+				$compiler->getDwoo()->getLoader()->loadPlugin('if');
53
+			}
54
+			catch (Exception $e) {
55
+				throw new CompilationException($compiler, 'Tif: the if plugin is required to use Tif');
56
+			}
57
+		}
58 58
 
59
-        if (count($rest) == 1) {
60
-            return $rest[0];
61
-        }
59
+		if (count($rest) == 1) {
60
+			return $rest[0];
61
+		}
62 62
 
63
-        // fetch false result and remove the ":" if it was present
64
-        $falseResult = array_pop($rest);
63
+		// fetch false result and remove the ":" if it was present
64
+		$falseResult = array_pop($rest);
65 65
 
66
-        if (trim(end($rest), '"\'') === ':') {
67
-            // remove the ':' if present
68
-            array_pop($rest);
69
-        } elseif (trim(end($rest), '"\'') === '?' || count($rest) === 1) {
70
-            if ($falseResult === '?' || $falseResult === ':') {
71
-                throw new CompilationException($compiler,
72
-                    'Tif: incomplete tif statement, value missing after ' . $falseResult);
73
-            }
74
-            // there was in fact no false result provided, so we move it to be the true result instead
75
-            $trueResult = $falseResult;
76
-            $falseResult = "''";
77
-        }
66
+		if (trim(end($rest), '"\'') === ':') {
67
+			// remove the ':' if present
68
+			array_pop($rest);
69
+		} elseif (trim(end($rest), '"\'') === '?' || count($rest) === 1) {
70
+			if ($falseResult === '?' || $falseResult === ':') {
71
+				throw new CompilationException($compiler,
72
+					'Tif: incomplete tif statement, value missing after ' . $falseResult);
73
+			}
74
+			// there was in fact no false result provided, so we move it to be the true result instead
75
+			$trueResult = $falseResult;
76
+			$falseResult = "''";
77
+		}
78 78
 
79
-        // fetch true result if needed
80
-        if (!isset($trueResult)) {
81
-            $trueResult = array_pop($rest);
82
-            // no true result provided so we use the expression arg
83
-            if ($trueResult === '?') {
84
-                $trueResult = true;
85
-            }
86
-        }
79
+		// fetch true result if needed
80
+		if (!isset($trueResult)) {
81
+			$trueResult = array_pop($rest);
82
+			// no true result provided so we use the expression arg
83
+			if ($trueResult === '?') {
84
+				$trueResult = true;
85
+			}
86
+		}
87 87
 
88
-        // remove the '?' if present
89
-        if (trim(end($rest), '"\'') === '?') {
90
-            array_pop($rest);
91
-        }
88
+		// remove the '?' if present
89
+		if (trim(end($rest), '"\'') === '?') {
90
+			array_pop($rest);
91
+		}
92 92
 
93
-        // check params were correctly provided
94
-        if (empty($rest) || $trueResult === null || $falseResult === null) {
95
-            throw new CompilationException($compiler,
96
-                'Tif: you must provide three parameters serving as <expression> ? <true value> : <false value>');
97
-        }
93
+		// check params were correctly provided
94
+		if (empty($rest) || $trueResult === null || $falseResult === null) {
95
+			throw new CompilationException($compiler,
96
+				'Tif: you must provide three parameters serving as <expression> ? <true value> : <false value>');
97
+		}
98 98
 
99
-        // parse condition
100
-        $condition = PluginIf::replaceKeywords($rest, $tokens, $compiler);
99
+		// parse condition
100
+		$condition = PluginIf::replaceKeywords($rest, $tokens, $compiler);
101 101
 
102
-        return '((' . implode(' ', $condition) . ') ? ' . ($trueResult === true ? implode(' ',
103
-                $condition) : $trueResult) . ' : ' . $falseResult . ')';
104
-    }
102
+		return '((' . implode(' ', $condition) . ') ? ' . ($trueResult === true ? implode(' ',
103
+				$condition) : $trueResult) . ' : ' . $falseResult . ')';
104
+	}
105 105
 }
106 106
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     public static function compile(Compiler $compiler, array $rest, array $tokens)
48 48
     {
49 49
         // load if plugin
50
-        if (!class_exists(Core::NAMESPACE_PLUGINS_BLOCKS . 'PluginIf')) {
50
+        if (!class_exists(Core::NAMESPACE_PLUGINS_BLOCKS.'PluginIf')) {
51 51
             try {
52 52
                 $compiler->getDwoo()->getLoader()->loadPlugin('if');
53 53
             }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         } elseif (trim(end($rest), '"\'') === '?' || count($rest) === 1) {
70 70
             if ($falseResult === '?' || $falseResult === ':') {
71 71
                 throw new CompilationException($compiler,
72
-                    'Tif: incomplete tif statement, value missing after ' . $falseResult);
72
+                    'Tif: incomplete tif statement, value missing after '.$falseResult);
73 73
             }
74 74
             // there was in fact no false result provided, so we move it to be the true result instead
75 75
             $trueResult = $falseResult;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         // parse condition
100 100
         $condition = PluginIf::replaceKeywords($rest, $tokens, $compiler);
101 101
 
102
-        return '((' . implode(' ', $condition) . ') ? ' . ($trueResult === true ? implode(' ',
103
-                $condition) : $trueResult) . ' : ' . $falseResult . ')';
102
+        return '(('.implode(' ', $condition).') ? '.($trueResult === true ? implode(' ',
103
+                $condition) : $trueResult).' : '.$falseResult.')';
104 104
     }
105 105
 }
106 106
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,8 +50,7 @@
 block discarded – undo
50 50
         if (!class_exists(Core::NAMESPACE_PLUGINS_BLOCKS . 'PluginIf')) {
51 51
             try {
52 52
                 $compiler->getDwoo()->getLoader()->loadPlugin('if');
53
-            }
54
-            catch (Exception $e) {
53
+            } catch (Exception $e) {
55 54
                 throw new CompilationException($compiler, 'Tif: the if plugin is required to use Tif');
56 55
             }
57 56
         }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginStripTags.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -32,24 +32,24 @@
 block discarded – undo
32 32
  */
33 33
 class PluginStripTags extends Plugin implements ICompilable
34 34
 {
35
-    /**
36
-     * @param Compiler    $compiler
37
-     * @param string      $value
38
-     * @param bool        $addspace
39
-     * @param null|string $allowable_tags
40
-     *
41
-     * @return string
42
-     */
43
-    public static function compile(Compiler $compiler, $value, $addspace = true, $allowable_tags = null)
44
-    {
45
-        if ($addspace === 'true') {
46
-            if ("null" == $allowable_tags) {
47
-                return "preg_replace('#<[^>]*>#', ' ', $value)";
48
-            }
35
+	/**
36
+	 * @param Compiler    $compiler
37
+	 * @param string      $value
38
+	 * @param bool        $addspace
39
+	 * @param null|string $allowable_tags
40
+	 *
41
+	 * @return string
42
+	 */
43
+	public static function compile(Compiler $compiler, $value, $addspace = true, $allowable_tags = null)
44
+	{
45
+		if ($addspace === 'true') {
46
+			if ("null" == $allowable_tags) {
47
+				return "preg_replace('#<[^>]*>#', ' ', $value)";
48
+			}
49 49
 
50
-            return "preg_replace('#<\\s*\\/?(" . $allowable_tags . ")\\s*[^>]*?>#im', ' ', $value)";
51
-        }
50
+			return "preg_replace('#<\\s*\\/?(" . $allowable_tags . ")\\s*[^>]*?>#im', ' ', $value)";
51
+		}
52 52
 
53
-        return "strip_tags($value, $allowable_tags)";
54
-    }
53
+		return "strip_tags($value, $allowable_tags)";
54
+	}
55 55
 }
56 56
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
                 return "preg_replace('#<[^>]*>#', ' ', $value)";
48 48
             }
49 49
 
50
-            return "preg_replace('#<\\s*\\/?(" . $allowable_tags . ")\\s*[^>]*?>#im', ' ', $value)";
50
+            return "preg_replace('#<\\s*\\/?(".$allowable_tags.")\\s*[^>]*?>#im', ' ', $value)";
51 51
         }
52 52
 
53 53
         return "strip_tags($value, $allowable_tags)";
Please login to merge, or discard this patch.