Completed
Push — master ( 494091...32c874 )
by David
27s
created
lib/Dwoo/Plugins/Functions/PluginIsset.php 1 patch
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 PluginIsset extends Plugin implements ICompilable
32 32
 {
33
-    /**
34
-     * @param Compiler $compiler
35
-     * @param mixed    $var
36
-     *
37
-     * @return string
38
-     */
39
-    public static function compile(Compiler $compiler, $var)
40
-    {
41
-        return '(' . $var . ' !== null)';
42
-    }
33
+	/**
34
+	 * @param Compiler $compiler
35
+	 * @param mixed    $var
36
+	 *
37
+	 * @return string
38
+	 */
39
+	public static function compile(Compiler $compiler, $var)
40
+	{
41
+		return '(' . $var . ' !== null)';
42
+	}
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginDateFormat.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -31,62 +31,62 @@
 block discarded – undo
31 31
  */
32 32
 class PluginDateFormat extends Plugin
33 33
 {
34
-    /**
35
-     * @param mixed  $value
36
-     * @param string $format
37
-     * @param null   $default
38
-     *
39
-     * @return string
40
-     */
41
-    public function process($value, $format = '%b %e, %Y', $default = null)
42
-    {
43
-        if (!empty($value)) {
44
-            // convert if it's not a valid unix timestamp
45
-            if (preg_match('#^-?\d{1,10}$#', $value) === 0) {
46
-                $value = strtotime($value);
47
-            }
48
-        } elseif (!empty($default)) {
49
-            // convert if it's not a valid unix timestamp
50
-            if (preg_match('#^-?\d{1,10}$#', $default) === 0) {
51
-                $value = strtotime($default);
52
-            } else {
53
-                $value = $default;
54
-            }
55
-        } else {
56
-            return '';
57
-        }
34
+	/**
35
+	 * @param mixed  $value
36
+	 * @param string $format
37
+	 * @param null   $default
38
+	 *
39
+	 * @return string
40
+	 */
41
+	public function process($value, $format = '%b %e, %Y', $default = null)
42
+	{
43
+		if (!empty($value)) {
44
+			// convert if it's not a valid unix timestamp
45
+			if (preg_match('#^-?\d{1,10}$#', $value) === 0) {
46
+				$value = strtotime($value);
47
+			}
48
+		} elseif (!empty($default)) {
49
+			// convert if it's not a valid unix timestamp
50
+			if (preg_match('#^-?\d{1,10}$#', $default) === 0) {
51
+				$value = strtotime($default);
52
+			} else {
53
+				$value = $default;
54
+			}
55
+		} else {
56
+			return '';
57
+		}
58 58
 
59
-        // Credits for that windows compat block to Monte Ohrt who made smarty's date_format plugin
60
-        if (DIRECTORY_SEPARATOR == '\\') {
61
-            $_win_from = array(
62
-                '%D',
63
-                '%h',
64
-                '%n',
65
-                '%r',
66
-                '%R',
67
-                '%t',
68
-                '%T'
69
-            );
70
-            $_win_to   = array(
71
-                '%m/%d/%y',
72
-                '%b',
73
-                "\n",
74
-                '%I:%M:%S %p',
75
-                '%H:%M',
76
-                "\t",
77
-                '%H:%M:%S'
78
-            );
79
-            if (strpos($format, '%e') !== false) {
80
-                $_win_from[] = '%e';
81
-                $_win_to[]   = sprintf('%\' 2d', date('j', $value));
82
-            }
83
-            if (strpos($format, '%l') !== false) {
84
-                $_win_from[] = '%l';
85
-                $_win_to[]   = sprintf('%\' 2d', date('h', $value));
86
-            }
87
-            $format = str_replace($_win_from, $_win_to, $format);
88
-        }
59
+		// Credits for that windows compat block to Monte Ohrt who made smarty's date_format plugin
60
+		if (DIRECTORY_SEPARATOR == '\\') {
61
+			$_win_from = array(
62
+				'%D',
63
+				'%h',
64
+				'%n',
65
+				'%r',
66
+				'%R',
67
+				'%t',
68
+				'%T'
69
+			);
70
+			$_win_to   = array(
71
+				'%m/%d/%y',
72
+				'%b',
73
+				"\n",
74
+				'%I:%M:%S %p',
75
+				'%H:%M',
76
+				"\t",
77
+				'%H:%M:%S'
78
+			);
79
+			if (strpos($format, '%e') !== false) {
80
+				$_win_from[] = '%e';
81
+				$_win_to[]   = sprintf('%\' 2d', date('j', $value));
82
+			}
83
+			if (strpos($format, '%l') !== false) {
84
+				$_win_from[] = '%l';
85
+				$_win_to[]   = sprintf('%\' 2d', date('h', $value));
86
+			}
87
+			$format = str_replace($_win_from, $_win_to, $format);
88
+		}
89 89
 
90
-        return strftime($format, $value);
91
-    }
90
+		return strftime($format, $value);
91
+	}
92 92
 }
93 93
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginReturn.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -36,19 +36,19 @@
 block discarded – undo
36 36
  */
37 37
 class PluginReturn extends Plugin implements ICompilable
38 38
 {
39
-    /**
40
-     * @param Compiler $compiler
41
-     * @param array    $rest
42
-     *
43
-     * @return string
44
-     */
45
-    public static function compile(Compiler $compiler, array $rest = array())
46
-    {
47
-        $out = array();
48
-        foreach ($rest as $var => $val) {
49
-            $out[] = '$this->setReturnValue(' . var_export($var, true) . ', ' . $val . ')';
50
-        }
39
+	/**
40
+	 * @param Compiler $compiler
41
+	 * @param array    $rest
42
+	 *
43
+	 * @return string
44
+	 */
45
+	public static function compile(Compiler $compiler, array $rest = array())
46
+	{
47
+		$out = array();
48
+		foreach ($rest as $var => $val) {
49
+			$out[] = '$this->setReturnValue(' . var_export($var, true) . ', ' . $val . ')';
50
+		}
51 51
 
52
-        return '(' . implode('.', $out) . ')';
53
-    }
52
+		return '(' . implode('.', $out) . ')';
53
+	}
54 54
 }
55 55
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginWhitespace.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -39,15 +39,15 @@
 block discarded – undo
39 39
  */
40 40
 class PluginWhitespace extends Plugin implements ICompilable
41 41
 {
42
-    /**
43
-     * @param Compiler $compiler
44
-     * @param string   $value
45
-     * @param string   $with
46
-     *
47
-     * @return string
48
-     */
49
-    public static function compile(Compiler $compiler, $value, $with = ' ')
50
-    {
51
-        return "preg_replace('#\s+#'.(strcasecmp(\$this->charset, 'utf-8')===0?'u':''), $with, $value)";
52
-    }
42
+	/**
43
+	 * @param Compiler $compiler
44
+	 * @param string   $value
45
+	 * @param string   $with
46
+	 *
47
+	 * @return string
48
+	 */
49
+	public static function compile(Compiler $compiler, $value, $with = ' ')
50
+	{
51
+		return "preg_replace('#\s+#'.(strcasecmp(\$this->charset, 'utf-8')===0?'u':''), $with, $value)";
52
+	}
53 53
 }
54 54
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginCountWords.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@
 block discarded – undo
30 30
  */
31 31
 class PluginCountWords extends Plugin implements ICompilable
32 32
 {
33
-    public static function compile(Compiler $compiler, $value)
34
-    {
35
-        return 'preg_match_all(strcasecmp($this->charset, \'utf-8\')===0 ? \'#[\w\pL]+#u\' : \'#\w+#\', ' . $value . ', $tmp)';
36
-    }
33
+	public static function compile(Compiler $compiler, $value)
34
+	{
35
+		return 'preg_match_all(strcasecmp($this->charset, \'utf-8\')===0 ? \'#[\w\pL]+#u\' : \'#\w+#\', ' . $value . ', $tmp)';
36
+	}
37 37
 }
38 38
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginReverse.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -29,26 +29,26 @@
 block discarded – undo
29 29
  */
30 30
 class PluginReverse extends Plugin
31 31
 {
32
-    /**
33
-     * @param string $value
34
-     * @param bool   $preserve_keys
35
-     *
36
-     * @return array|string
37
-     */
38
-    public function process($value, $preserve_keys = false)
39
-    {
40
-        if (is_array($value)) {
41
-            return array_reverse($value, $preserve_keys);
42
-        } elseif (($charset = $this->core->getCharset()) === 'iso-8859-1') {
43
-            return strrev((string)$value);
44
-        }
32
+	/**
33
+	 * @param string $value
34
+	 * @param bool   $preserve_keys
35
+	 *
36
+	 * @return array|string
37
+	 */
38
+	public function process($value, $preserve_keys = false)
39
+	{
40
+		if (is_array($value)) {
41
+			return array_reverse($value, $preserve_keys);
42
+		} elseif (($charset = $this->core->getCharset()) === 'iso-8859-1') {
43
+			return strrev((string)$value);
44
+		}
45 45
 
46
-        $strlen = mb_strlen($value);
47
-        $out    = '';
48
-        while ($strlen --) {
49
-            $out .= mb_substr($value, $strlen, 1, $charset);
50
-        }
46
+		$strlen = mb_strlen($value);
47
+		$out    = '';
48
+		while ($strlen --) {
49
+			$out .= mb_substr($value, $strlen, 1, $charset);
50
+		}
51 51
 
52
-        return $out;
53
-    }
52
+		return $out;
53
+	}
54 54
 }
55 55
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginSpacify.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -31,15 +31,15 @@
 block discarded – undo
31 31
  */
32 32
 class PluginSpacify extends Plugin implements ICompilable
33 33
 {
34
-    /**
35
-     * @param Compiler $compiler
36
-     * @param string   $value
37
-     * @param string   $space_char
38
-     *
39
-     * @return string
40
-     */
41
-    public static function compile(Compiler $compiler, $value, $space_char = ' ')
42
-    {
43
-        return 'implode(' . $space_char . ', str_split(' . $value . ', 1))';
44
-    }
34
+	/**
35
+	 * @param Compiler $compiler
36
+	 * @param string   $value
37
+	 * @param string   $space_char
38
+	 *
39
+	 * @return string
40
+	 */
41
+	public static function compile(Compiler $compiler, $value, $space_char = ' ')
42
+	{
43
+		return 'implode(' . $space_char . ', str_split(' . $value . ', 1))';
44
+	}
45 45
 }
46 46
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginUpper.php 1 patch
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 PluginUpper 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 'mb_strtoupper((string) ' . $value . ', $this->charset)';
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 'mb_strtoupper((string) ' . $value . ', $this->charset)';
42
+	}
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginOptional.php 1 patch
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 PluginOptional extends Plugin implements ICompilable
32 32
 {
33
-    /**
34
-     * @param Compiler $compiler
35
-     * @param string   $value
36
-     *
37
-     * @return mixed
38
-     */
39
-    public static function compile(Compiler $compiler, $value)
40
-    {
41
-        return $value;
42
-    }
33
+	/**
34
+	 * @param Compiler $compiler
35
+	 * @param string   $value
36
+	 *
37
+	 * @return mixed
38
+	 */
39
+	public static function compile(Compiler $compiler, $value)
40
+	{
41
+		return $value;
42
+	}
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.