Completed
Push — master ( 5d7b0f...8d92ea )
by Thierry
03:20
created
templates/plugins/ready.js.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 jaxon.dom.ready(function() {
2 2
     jaxon.command.handler.register('cc', jaxon.confirm.commands);
3 3
 
4
-<?php if($this->sPluginScript): ?>
4
+<?php if ($this->sPluginScript): ?>
5 5
 <?php echo $this->sPluginScript ?>
6 6
 <?php endif ?>
7 7
 });
Please login to merge, or discard this patch.
src/Response/Manager.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function append(Response $xResponse)
73 73
     {
74
-        if(!$this->xResponse)
74
+        if (!$this->xResponse)
75 75
         {
76 76
             $this->xResponse = $xResponse;
77 77
         }
78
-        elseif(get_class($this->xResponse) == get_class($xResponse))
78
+        elseif (get_class($this->xResponse) == get_class($xResponse))
79 79
         {
80
-            if($this->xResponse != $xResponse)
80
+            if ($this->xResponse != $xResponse)
81 81
             {
82 82
                 $this->xResponse->appendResponse($xResponse);
83 83
             }
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
      */
111 111
     public function printDebug()
112 112
     {
113
-        if(($this->xResponse))
113
+        if (($this->xResponse))
114 114
         {
115
-            foreach($this->aDebugMessages as $sMessage)
115
+            foreach ($this->aDebugMessages as $sMessage)
116 116
             {
117 117
                 $this->xResponse->debug($sMessage);
118 118
             }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function sendHeaders()
129 129
     {
130
-        if(($this->xResponse))
130
+        if (($this->xResponse))
131 131
         {
132 132
             $this->xResponse->sendHeaders();
133 133
         }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
      */
141 141
     public function getOutput()
142 142
     {
143
-        if(($this->xResponse))
143
+        if (($this->xResponse))
144 144
         {
145 145
             return $this->xResponse->getOutput();
146 146
         }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      */
155 155
     public function sendOutput()
156 156
     {
157
-        if(($this->xResponse))
157
+        if (($this->xResponse))
158 158
         {
159 159
             $this->xResponse->sendHeaders();
160 160
             $this->xResponse->printOutput();
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,15 +74,13 @@
 block discarded – undo
74 74
         if(!$this->xResponse)
75 75
         {
76 76
             $this->xResponse = $xResponse;
77
-        }
78
-        elseif(get_class($this->xResponse) == get_class($xResponse))
77
+        } elseif(get_class($this->xResponse) == get_class($xResponse))
79 78
         {
80 79
             if($this->xResponse != $xResponse)
81 80
             {
82 81
                 $this->xResponse->appendResponse($xResponse);
83 82
             }
84
-        }
85
-        else
83
+        } else
86 84
         {
87 85
             $this->debug($this->trans('errors.mismatch.types', array('class' => get_class($xResponse))));
88 86
         }
Please login to merge, or discard this patch.
src/Utils/URI.php 2 patches
Braces   +10 added lines, -16 removed lines patch added patch discarded remove patch
@@ -37,8 +37,7 @@  discard block
 block discarded – undo
37 37
             if(!empty($_SERVER['HTTP_SCHEME']))
38 38
             {
39 39
                 $aURL['scheme'] = $_SERVER['HTTP_SCHEME'];
40
-            }
41
-            else
40
+            } else
42 41
             {
43 42
                 $aURL['scheme'] = ((!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') ? 'https' : 'http');
44 43
             }
@@ -51,28 +50,23 @@  discard block
 block discarded – undo
51 50
                 if(strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ':') > 0)
52 51
                 {
53 52
                     list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_X_FORWARDED_HOST']);
54
-                }
55
-                else
53
+                } else
56 54
                 {
57 55
                     $aURL['host'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
58 56
                 }
59
-            }
60
-            elseif(!empty($_SERVER['HTTP_HOST']))
57
+            } elseif(!empty($_SERVER['HTTP_HOST']))
61 58
             {
62 59
                 if(strpos($_SERVER['HTTP_HOST'], ':') > 0)
63 60
                 {
64 61
                     list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_HOST']);
65
-                }
66
-                else
62
+                } else
67 63
                 {
68 64
                     $aURL['host'] = $_SERVER['HTTP_HOST'];
69 65
                 }
70
-            }
71
-            elseif(!empty($_SERVER['SERVER_NAME']))
66
+            } elseif(!empty($_SERVER['SERVER_NAME']))
72 67
             {
73 68
                 $aURL['host'] = $_SERVER['SERVER_NAME'];
74
-            }
75
-            else
69
+            } else
76 70
             {
77 71
                 throw new \Jaxon\Exception\URI();
78 72
             }
@@ -94,8 +88,7 @@  discard block
 block discarded – undo
94 88
             if(!empty($_SERVER['PATH_INFO']))
95 89
             {
96 90
                 $sPath = parse_url($_SERVER['PATH_INFO']);
97
-            }
98
-            else
91
+            } else
99 92
             {
100 93
                 $sPath = parse_url($_SERVER['PHP_SELF']);
101 94
             }
@@ -153,8 +146,9 @@  discard block
 block discarded – undo
153 146
         
154 147
             foreach($aQueries as $sKey => $sQuery)
155 148
             {
156
-                if("jxnGenerate" == substr($sQuery, 0, 11))
157
-                    unset($aQueries[$sKey]);
149
+                if("jxnGenerate" == substr($sQuery, 0, 11)) {
150
+                                    unset($aQueries[$sKey]);
151
+                }
158 152
             }
159 153
                 
160 154
             $sQueries = implode("&", $aQueries);
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -25,16 +25,16 @@  discard block
 block discarded – undo
25 25
     {
26 26
         $aURL = [];
27 27
         // Try to get the request URL
28
-        if(!empty($_SERVER['REQUEST_URI']))
28
+        if (!empty($_SERVER['REQUEST_URI']))
29 29
         {
30
-            $_SERVER['REQUEST_URI'] = str_replace(array('"',"'",'<','>'), array('%22','%27','%3C','%3E'), $_SERVER['REQUEST_URI']);
30
+            $_SERVER['REQUEST_URI'] = str_replace(array('"', "'", '<', '>'), array('%22', '%27', '%3C', '%3E'), $_SERVER['REQUEST_URI']);
31 31
             $aURL = parse_url($_SERVER['REQUEST_URI']);
32 32
         }
33 33
 
34 34
         // Fill in the empty values
35
-        if(empty($aURL['scheme']))
35
+        if (empty($aURL['scheme']))
36 36
         {
37
-            if(!empty($_SERVER['HTTP_SCHEME']))
37
+            if (!empty($_SERVER['HTTP_SCHEME']))
38 38
             {
39 39
                 $aURL['scheme'] = $_SERVER['HTTP_SCHEME'];
40 40
             }
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
             }
45 45
         }
46 46
 
47
-        if(empty($aURL['host']))
47
+        if (empty($aURL['host']))
48 48
         {
49
-            if(!empty($_SERVER['HTTP_X_FORWARDED_HOST']))
49
+            if (!empty($_SERVER['HTTP_X_FORWARDED_HOST']))
50 50
             {
51
-                if(strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ':') > 0)
51
+                if (strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ':') > 0)
52 52
                 {
53 53
                     list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_X_FORWARDED_HOST']);
54 54
                 }
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
                     $aURL['host'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
58 58
                 }
59 59
             }
60
-            elseif(!empty($_SERVER['HTTP_HOST']))
60
+            elseif (!empty($_SERVER['HTTP_HOST']))
61 61
             {
62
-                if(strpos($_SERVER['HTTP_HOST'], ':') > 0)
62
+                if (strpos($_SERVER['HTTP_HOST'], ':') > 0)
63 63
                 {
64 64
                     list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_HOST']);
65 65
                 }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                     $aURL['host'] = $_SERVER['HTTP_HOST'];
69 69
                 }
70 70
             }
71
-            elseif(!empty($_SERVER['SERVER_NAME']))
71
+            elseif (!empty($_SERVER['SERVER_NAME']))
72 72
             {
73 73
                 $aURL['host'] = $_SERVER['SERVER_NAME'];
74 74
             }
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
             }
79 79
         }
80 80
 
81
-        if(empty($aURL['port']) && !empty($_SERVER['SERVER_PORT']))
81
+        if (empty($aURL['port']) && !empty($_SERVER['SERVER_PORT']))
82 82
         {
83 83
             $aURL['port'] = $_SERVER['SERVER_PORT'];
84 84
         }
85 85
 
86
-        if(!empty($aURL['path']) && strlen(basename($aURL['path'])) == 0)
86
+        if (!empty($aURL['path']) && strlen(basename($aURL['path'])) == 0)
87 87
         {
88 88
             unset($aURL['path']);
89 89
         }
90 90
 
91
-        if(empty($aURL['path']))
91
+        if (empty($aURL['path']))
92 92
         {
93
-            if(!empty($_SERVER['PATH_INFO']))
93
+            if (!empty($_SERVER['PATH_INFO']))
94 94
             {
95 95
                 $sPath = parse_url($_SERVER['PATH_INFO']);
96 96
             }
@@ -98,61 +98,61 @@  discard block
 block discarded – undo
98 98
             {
99 99
                 $sPath = parse_url($_SERVER['PHP_SELF']);
100 100
             }
101
-            if(isset($sPath['path']))
101
+            if (isset($sPath['path']))
102 102
             {
103
-                $aURL['path'] = str_replace(array('"',"'",'<','>'), array('%22','%27','%3C','%3E'), $sPath['path']);
103
+                $aURL['path'] = str_replace(array('"', "'", '<', '>'), array('%22', '%27', '%3C', '%3E'), $sPath['path']);
104 104
             }
105 105
             unset($sPath);
106 106
         }
107 107
 
108
-        if(empty($aURL['query']) && !empty($_SERVER['QUERY_STRING']))
108
+        if (empty($aURL['query']) && !empty($_SERVER['QUERY_STRING']))
109 109
         {
110 110
             $aURL['query'] = $_SERVER['QUERY_STRING'];
111 111
         }
112 112
 
113
-        if(!empty($aURL['query']))
113
+        if (!empty($aURL['query']))
114 114
         {
115
-            $aURL['query'] = '?'.$aURL['query'];
115
+            $aURL['query'] = '?' . $aURL['query'];
116 116
         }
117 117
 
118 118
         // Build the URL: Start with scheme, user and pass
119
-        $sURL = $aURL['scheme'].'://';
120
-        if(!empty($aURL['user']))
119
+        $sURL = $aURL['scheme'] . '://';
120
+        if (!empty($aURL['user']))
121 121
         {
122
-            $sURL.= $aURL['user'];
123
-            if(!empty($aURL['pass']))
122
+            $sURL .= $aURL['user'];
123
+            if (!empty($aURL['pass']))
124 124
             {
125
-                $sURL.= ':'.$aURL['pass'];
125
+                $sURL .= ':' . $aURL['pass'];
126 126
             }
127
-            $sURL.= '@';
127
+            $sURL .= '@';
128 128
         }
129 129
 
130 130
         // Add the host
131
-        $sURL.= $aURL['host'];
131
+        $sURL .= $aURL['host'];
132 132
 
133 133
         // Add the port if needed
134
-        if(!empty($aURL['port'])
134
+        if (!empty($aURL['port'])
135 135
                 && (($aURL['scheme'] == 'http' && $aURL['port'] != 80)
136 136
                         || ($aURL['scheme'] == 'https' && $aURL['port'] != 443)))
137 137
         {
138
-            $sURL.= ':'.$aURL['port'];
138
+            $sURL .= ':' . $aURL['port'];
139 139
         }
140 140
 
141 141
         // Add the path and the query string
142
-        $sURL.= $aURL['path'].@$aURL['query'];
142
+        $sURL .= $aURL['path'] . @$aURL['query'];
143 143
 
144 144
         // Clean up
145 145
         unset($aURL);
146 146
 
147 147
         $aURL = explode("?", $sURL);
148 148
 
149
-        if(1 < count($aURL))
149
+        if (1 < count($aURL))
150 150
         {
151 151
             $aQueries = explode("&", $aURL[1]);
152 152
 
153
-            foreach($aQueries as $sKey => $sQuery)
153
+            foreach ($aQueries as $sKey => $sQuery)
154 154
             {
155
-                if("jxnGenerate" == substr($sQuery, 0, 11))
155
+                if ("jxnGenerate" == substr($sQuery, 0, 11))
156 156
                     unset($aQueries[$sKey]);
157 157
             }
158 158
 
Please login to merge, or discard this patch.
src/Request/Parameter.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -91,19 +91,19 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public static function make($xValue)
93 93
     {
94
-        if($xValue instanceof Interfaces\Parameter)
94
+        if ($xValue instanceof Interfaces\Parameter)
95 95
         {
96 96
             return $xValue;
97 97
         }
98
-        elseif(is_numeric($xValue))
98
+        elseif (is_numeric($xValue))
99 99
         {
100 100
             return new Parameter(Jaxon::NUMERIC_VALUE, $xValue);
101 101
         }
102
-        elseif(is_string($xValue))
102
+        elseif (is_string($xValue))
103 103
         {
104 104
             return new Parameter(Jaxon::QUOTED_VALUE, $xValue);
105 105
         }
106
-        elseif(is_bool($xValue))
106
+        elseif (is_bool($xValue))
107 107
         {
108 108
             return new Parameter(Jaxon::BOOL_VALUE, $xValue);
109 109
         }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     {
123 123
         $sJsCode = '';
124 124
         $sQuoteCharacter = "'";
125
-        switch($this->sType)
125
+        switch ($this->sType)
126 126
         {
127 127
         case Jaxon::FORM_VALUES:
128 128
             $sFormID = (string)$this->xValue;
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
             break;
131 131
         case Jaxon::INPUT_VALUE:
132 132
             $sInputID = (string)$this->xValue;
133
-            $sJsCode = "jaxon.$("  . $sQuoteCharacter . $sInputID . $sQuoteCharacter  . ").value";
133
+            $sJsCode = "jaxon.$(" . $sQuoteCharacter . $sInputID . $sQuoteCharacter . ").value";
134 134
             break;
135 135
         case Jaxon::CHECKED_VALUE:
136 136
             $sCheckedID = (string)$this->xValue;
137
-            $sJsCode = "jaxon.$("  . $sQuoteCharacter . $sCheckedID  . $sQuoteCharacter . ").checked";
137
+            $sJsCode = "jaxon.$(" . $sQuoteCharacter . $sCheckedID . $sQuoteCharacter . ").checked";
138 138
             break;
139 139
         case Jaxon::ELEMENT_INNERHTML:
140 140
             $sElementID = (string)$this->xValue;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
             $sJsCode = (string)$this->xValue;
154 154
             break;
155 155
         case Jaxon::JS_VALUE:
156
-            if(is_array($this->xValue) || is_object($this->xValue))
156
+            if (is_array($this->xValue) || is_object($this->xValue))
157 157
             {
158 158
                 // Unable to use double quotes here because they cannot be handled on client side.
159 159
                 // So we are using simple quotes even if the Json standard recommends double quotes.
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -94,20 +94,16 @@  discard block
 block discarded – undo
94 94
         if($xValue instanceof Interfaces\Parameter)
95 95
         {
96 96
             return $xValue;
97
-        }
98
-        elseif(is_numeric($xValue))
97
+        } elseif(is_numeric($xValue))
99 98
         {
100 99
             return new Parameter(Jaxon::NUMERIC_VALUE, $xValue);
101
-        }
102
-        elseif(is_string($xValue))
100
+        } elseif(is_string($xValue))
103 101
         {
104 102
             return new Parameter(Jaxon::QUOTED_VALUE, $xValue);
105
-        }
106
-        elseif(is_bool($xValue))
103
+        } elseif(is_bool($xValue))
107 104
         {
108 105
             return new Parameter(Jaxon::BOOL_VALUE, $xValue);
109
-        }
110
-        else // if(is_array($xValue) || is_object($xValue))
106
+        } else // if(is_array($xValue) || is_object($xValue))
111 107
         {
112 108
             return new Parameter(Jaxon::JS_VALUE, $xValue);
113 109
         }
@@ -158,8 +154,7 @@  discard block
 block discarded – undo
158 154
                 // Unable to use double quotes here because they cannot be handled on client side.
159 155
                 // So we are using simple quotes even if the Json standard recommends double quotes.
160 156
                 $sJsCode = str_replace(['"'], ["'"], json_encode($this->xValue, JSON_HEX_APOS | JSON_HEX_QUOT));
161
-            }
162
-            else
157
+            } else
163 158
             {
164 159
                 $sJsCode = (string)$this->xValue;
165 160
             }
Please login to merge, or discard this patch.
src/Utils/Validation/Validator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         // Verify the file extension
130 130
         $xDefault = $this->xConfig->getOption('upload.default.types');
131 131
         $aAllowed = $this->xConfig->getOption('upload.files.' . $sName . '.types', $xDefault);
132
-        if(is_array($aAllowed) && !in_array($aUploadedFile['type'], $aAllowed))
132
+        if (is_array($aAllowed) && !in_array($aUploadedFile['type'], $aAllowed))
133 133
         {
134 134
             $this->sErrorMessage = $this->xTranslator->trans('errors.upload.type', $aUploadedFile);
135 135
             return false;
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         // Verify the file extension
138 138
         $xDefault = $this->xConfig->getOption('upload.default.extensions');
139 139
         $aAllowed = $this->xConfig->getOption('upload.files.' . $sName . '.extensions', $xDefault);
140
-        if(is_array($aAllowed) && !in_array($aUploadedFile['extension'], $aAllowed))
140
+        if (is_array($aAllowed) && !in_array($aUploadedFile['extension'], $aAllowed))
141 141
         {
142 142
             $this->sErrorMessage = $this->xTranslator->trans('errors.upload.extension', $aUploadedFile);
143 143
             return false;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         // Verify the max size
146 146
         $xDefault = $this->xConfig->getOption('upload.default.max-size', 0);
147 147
         $iSize = $this->xConfig->getOption('upload.files.' . $sName . '.max-size', $xDefault);
148
-        if($iSize > 0 && $aUploadedFile['size'] > $iSize)
148
+        if ($iSize > 0 && $aUploadedFile['size'] > $iSize)
149 149
         {
150 150
             $this->sErrorMessage = $this->xTranslator->trans('errors.upload.max-size', $aUploadedFile);
151 151
             return false;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         // Verify the min size
154 154
         $xDefault = $this->xConfig->getOption('upload.default.min-size', 0);
155 155
         $iSize = $this->xConfig->getOption('upload.files.' . $sName . '.min-size', $xDefault);
156
-        if($iSize > 0 && $aUploadedFile['size'] < $iSize)
156
+        if ($iSize > 0 && $aUploadedFile['size'] < $iSize)
157 157
         {
158 158
             $this->sErrorMessage = $this->xTranslator->trans('errors.upload.min-size', $aUploadedFile);
159 159
             return false;
Please login to merge, or discard this patch.
src/Utils/Translation/Translator.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@
 block discarded – undo
121 121
         }
122 122
         if(!array_key_exists($sLanguage, $this->aTranslations) || !array_key_exists($sText, $this->aTranslations[$sLanguage]))
123 123
         {
124
-           return $sText;
124
+            return $sText;
125 125
         }
126 126
         $message = $this->aTranslations[$sLanguage][$sText];
127 127
         foreach($aPlaceHolders as $name => $value)
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,8 +63,7 @@
 block discarded – undo
63 63
             {
64 64
                 // Save this translation
65 65
                 $this->aTranslations[$sLanguage][$sName] = $xTranslation;
66
-            }
67
-            else
66
+            } else
68 67
             {
69 68
                 // Recursively read the translations in the array
70 69
                 $this->_loadTranslations($sLanguage, $sName, $xTranslation);
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
      */
56 56
     private function _loadTranslations($sLanguage, $sPrefix, array $aTranslations)
57 57
     {
58
-        foreach($aTranslations as $sName => $xTranslation)
58
+        foreach ($aTranslations as $sName => $xTranslation)
59 59
         {
60 60
             $sName = trim($sName);
61 61
             $sName = ($sPrefix) ? $sPrefix . '.' . $sName : $sName;
62
-            if(!is_array($xTranslation))
62
+            if (!is_array($xTranslation))
63 63
             {
64 64
                 // Save this translation
65 65
                 $this->aTranslations[$sLanguage][$sName] = $xTranslation;
@@ -82,17 +82,17 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function loadTranslations($sFilePath, $sLanguage)
84 84
     {
85
-        if(!file_exists($sFilePath))
85
+        if (!file_exists($sFilePath))
86 86
         {
87 87
             return;
88 88
         }
89 89
         $aTranslations = require($sFilePath);
90
-        if(!is_array($aTranslations))
90
+        if (!is_array($aTranslations))
91 91
         {
92 92
             return;
93 93
         }
94 94
         // Load the translations
95
-        if(!array_key_exists($sLanguage, $this->aTranslations))
95
+        if (!array_key_exists($sLanguage, $this->aTranslations))
96 96
         {
97 97
             $this->aTranslations[$sLanguage] = [];
98 98
         }
@@ -111,20 +111,20 @@  discard block
 block discarded – undo
111 111
     public function trans($sText, array $aPlaceHolders = [], $sLanguage = null)
112 112
     {
113 113
         $sText = trim((string)$sText);
114
-        if(!$sLanguage)
114
+        if (!$sLanguage)
115 115
         {
116 116
             $sLanguage = $this->xConfig->getOption('language');
117 117
         }
118
-        if(!$sLanguage)
118
+        if (!$sLanguage)
119 119
         {
120 120
             $sLanguage = $this->sDefaultLocale;
121 121
         }
122
-        if(!array_key_exists($sLanguage, $this->aTranslations) || !array_key_exists($sText, $this->aTranslations[$sLanguage]))
122
+        if (!array_key_exists($sLanguage, $this->aTranslations) || !array_key_exists($sText, $this->aTranslations[$sLanguage]))
123 123
         {
124 124
            return $sText;
125 125
         }
126 126
         $message = $this->aTranslations[$sLanguage][$sText];
127
-        foreach($aPlaceHolders as $name => $value)
127
+        foreach ($aPlaceHolders as $name => $value)
128 128
         {
129 129
             $message = str_replace(':' . $name, $value, $message);
130 130
         }
Please login to merge, or discard this patch.
src/Request/Plugin/FileUpload.php 5 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -217,7 +217,7 @@
 block discarded – undo
217 217
             $aFiles[$sVarName] = [];
218 218
             foreach($aUserFiles as $aUserFile)
219 219
             {
220
-                 $aFiles[$sVarName][] = $aUserFile->toTempData();
220
+                    $aFiles[$sVarName][] = $aUserFile->toTempData();
221 221
             }
222 222
         }
223 223
         // Save upload data in a temp file
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -52,8 +52,7 @@  discard block
 block discarded – undo
52 52
         if(array_key_exists('jxnupl', $_POST))
53 53
         {
54 54
             $this->sTempFile = $_POST['jxnupl'];
55
-        }
56
-        elseif(array_key_exists('jxnupl', $_GET))
55
+        } elseif(array_key_exists('jxnupl', $_GET))
57 56
         {
58 57
             $this->sTempFile = $_GET['jxnupl'];
59 58
         }
@@ -125,8 +124,7 @@  discard block
 block discarded – undo
125 124
                         'extension' => pathinfo($aFile['name'][$i], PATHINFO_EXTENSION),
126 125
                     ];
127 126
                 }
128
-            }
129
-            else
127
+            } else
130 128
             {
131 129
                 if(!$aFile['name'])
132 130
                 {
@@ -331,8 +329,7 @@  discard block
 block discarded – undo
331 329
         if(count($_FILES) > 0)
332 330
         {
333 331
             $this->readFromHttpData();
334
-        }
335
-        elseif(($this->sTempFile))
332
+        } elseif(($this->sTempFile))
336 333
         {
337 334
             $this->readFromTempFile();
338 335
         }
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
 use Jaxon\Jaxon;
16 16
 use Jaxon\Plugin\Request as RequestPlugin;
17 17
 use Jaxon\Request\Support\UploadedFile;
18
-
19 18
 use Closure;
20 19
 
21 20
 class FileUpload extends RequestPlugin
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -378,7 +378,7 @@
 block discarded – undo
378 378
     /**
379 379
      * Check uploaded files validity and move them to the user dir
380 380
      *
381
-     * @return boolean
381
+     * @return string
382 382
      */
383 383
     public function saveUploadedFiles()
384 384
     {
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
     {
59 59
         $this->sUploadSubdir = uniqid() . DIRECTORY_SEPARATOR;
60 60
 
61
-        if(array_key_exists('jxnupl', $_POST))
61
+        if (array_key_exists('jxnupl', $_POST))
62 62
         {
63 63
             $this->sTempFile = $_POST['jxnupl'];
64 64
         }
65
-        elseif(array_key_exists('jxnupl', $_GET))
65
+        elseif (array_key_exists('jxnupl', $_GET))
66 66
         {
67 67
             $this->sTempFile = $_GET['jxnupl'];
68 68
         }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      */
91 91
     protected function filterFilename($sFilename, $sVarName)
92 92
     {
93
-        if(($this->fFileFilter))
93
+        if (($this->fFileFilter))
94 94
         {
95 95
             $fFileFilter = $this->fFileFilter;
96 96
             $sFilename = (string)$fFileFilter($sFilename, $sVarName);
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
         $sUploadDir = $this->getOption('upload.files.' . $sFieldId . '.dir', $sDefaultUploadDir);
113 113
         $sUploadDir = rtrim(trim($sUploadDir), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
114 114
         // Verify that the upload dir exists and is writable
115
-        if(!is_writable($sUploadDir))
115
+        if (!is_writable($sUploadDir))
116 116
         {
117 117
             throw new \Jaxon\Exception\Error($this->trans('errors.upload.access'));
118 118
         }
119 119
         $sUploadDir .= $this->sUploadSubdir;
120
-        if(!@mkdir($sUploadDir))
120
+        if (!@mkdir($sUploadDir))
121 121
         {
122 122
             throw new \Jaxon\Exception\Error($this->trans('errors.upload.access'));
123 123
         }
@@ -135,12 +135,12 @@  discard block
 block discarded – undo
135 135
         $sUploadDir = $this->getOption('upload.default.dir');
136 136
         $sUploadDir = rtrim(trim($sUploadDir), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
137 137
         // Verify that the upload dir exists and is writable
138
-        if(!is_writable($sUploadDir))
138
+        if (!is_writable($sUploadDir))
139 139
         {
140 140
             throw new \Jaxon\Exception\Error($this->trans('errors.upload.access'));
141 141
         }
142 142
         $sUploadDir .= 'tmp' . DIRECTORY_SEPARATOR;
143
-        if(!@mkdir($sUploadDir))
143
+        if (!@mkdir($sUploadDir))
144 144
         {
145 145
             throw new \Jaxon\Exception\Error($this->trans('errors.upload.access'));
146 146
         }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         $sUploadDir = rtrim(trim($sUploadDir), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
159 159
         $sUploadDir .= 'tmp' . DIRECTORY_SEPARATOR;
160 160
         $sUploadTempFile = $sUploadDir . $this->sTempFile . '.json';
161
-        if(!is_readable($sUploadTempFile))
161
+        if (!is_readable($sUploadTempFile))
162 162
         {
163 163
             throw new \Jaxon\Exception\Error($this->trans('errors.upload.access'));
164 164
         }
@@ -174,18 +174,18 @@  discard block
 block discarded – undo
174 174
     {
175 175
         // Check validity of the uploaded files
176 176
         $aTempFiles = [];
177
-        foreach($_FILES as $sVarName => $aFile)
177
+        foreach ($_FILES as $sVarName => $aFile)
178 178
         {
179
-            if(is_array($aFile['name']))
179
+            if (is_array($aFile['name']))
180 180
             {
181 181
                 $nFileCount = count($aFile['name']);
182
-                for($i = 0; $i < $nFileCount; $i++)
182
+                for ($i = 0; $i < $nFileCount; $i++)
183 183
                 {
184
-                    if(!$aFile['name'][$i])
184
+                    if (!$aFile['name'][$i])
185 185
                     {
186 186
                         continue;
187 187
                     }
188
-                    if(!array_key_exists($sVarName, $aTempFiles))
188
+                    if (!array_key_exists($sVarName, $aTempFiles))
189 189
                     {
190 190
                         $aTempFiles[$sVarName] = [];
191 191
                     }
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
             }
206 206
             else
207 207
             {
208
-                if(!$aFile['name'])
208
+                if (!$aFile['name'])
209 209
                 {
210 210
                     continue;
211 211
                 }
212
-                if(!array_key_exists($sVarName, $aTempFiles))
212
+                if (!array_key_exists($sVarName, $aTempFiles))
213 213
                 {
214 214
                     $aTempFiles[$sVarName] = [];
215 215
                 }
@@ -229,17 +229,17 @@  discard block
 block discarded – undo
229 229
         }
230 230
 
231 231
         // Check uploaded files validity
232
-        foreach($aTempFiles as $sVarName => $aFiles)
232
+        foreach ($aTempFiles as $sVarName => $aFiles)
233 233
         {
234
-            foreach($aFiles as $aFile)
234
+            foreach ($aFiles as $aFile)
235 235
             {
236 236
                 // Verify upload result
237
-                if($aFile['error'] != 0)
237
+                if ($aFile['error'] != 0)
238 238
                 {
239 239
                     throw new \Jaxon\Exception\Error($this->trans('errors.upload.failed', $aFile));
240 240
                 }
241 241
                 // Verify file validity (format, size)
242
-                if(!$this->validateUploadedFile($sVarName, $aFile))
242
+                if (!$this->validateUploadedFile($sVarName, $aFile))
243 243
                 {
244 244
                     throw new \Jaxon\Exception\Error($this->getValidatorMessage());
245 245
                 }
@@ -249,10 +249,10 @@  discard block
 block discarded – undo
249 249
         }
250 250
 
251 251
         // Copy the uploaded files from the temp dir to the user dir
252
-        foreach($aTempFiles as $sVarName => $aTempFiles)
252
+        foreach ($aTempFiles as $sVarName => $aTempFiles)
253 253
         {
254 254
             $this->aUserFiles[$sVarName] = [];
255
-            foreach($aTempFiles as $aFile)
255
+            foreach ($aTempFiles as $aFile)
256 256
             {
257 257
                 // Get the path to the upload dir
258 258
                 $sUploadDir = $this->getUploadDir($sVarName);
@@ -274,10 +274,10 @@  discard block
 block discarded – undo
274 274
     {
275 275
         // Convert uploaded file to an array
276 276
         $aFiles = [];
277
-        foreach($this->aUserFiles as $sVarName => $aUserFiles)
277
+        foreach ($this->aUserFiles as $sVarName => $aUserFiles)
278 278
         {
279 279
             $aFiles[$sVarName] = [];
280
-            foreach($aUserFiles as $aUserFile)
280
+            foreach ($aUserFiles as $aUserFile)
281 281
             {
282 282
                  $aFiles[$sVarName][] = $aUserFile->toTempData();
283 283
             }
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
         // Upload temp file
299 299
         $sUploadTempFile = $this->getUploadTempFile();
300 300
         $aFiles = json_decode(file_get_contents($sUploadTempFile), true);
301
-        foreach($aFiles as $sVarName => $aUserFiles)
301
+        foreach ($aFiles as $sVarName => $aUserFiles)
302 302
         {
303 303
             $this->aUserFiles[$sVarName] = [];
304
-            foreach($aUserFiles as $aUserFile)
304
+            foreach ($aUserFiles as $aUserFile)
305 305
             {
306 306
                 $this->aUserFiles[$sVarName][] = UploadedFile::fromTempData($aUserFile);
307 307
             }
@@ -366,15 +366,15 @@  discard block
 block discarded – undo
366 366
      */
367 367
     public function processRequest()
368 368
     {
369
-        if(!$this->canProcessRequest())
369
+        if (!$this->canProcessRequest())
370 370
         {
371 371
             return false;
372 372
         }
373
-        if(count($_FILES) > 0)
373
+        if (count($_FILES) > 0)
374 374
         {
375 375
             $this->readFromHttpData();
376 376
         }
377
-        elseif(($this->sTempFile))
377
+        elseif (($this->sTempFile))
378 378
         {
379 379
             $this->readFromTempFile();
380 380
         }
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
     public function saveUploadedFiles()
390 390
     {
391 391
         // Process uploaded files
392
-        if(!$this->processRequest())
392
+        if (!$this->processRequest())
393 393
         {
394 394
             return '';
395 395
         }
Please login to merge, or discard this patch.
templates/plugins/config.js.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,18 +14,18 @@
 block discarded – undo
14 14
 jaxon.config.defaultMode = "<?php echo $this->sDefaultMode ?>";
15 15
 jaxon.config.defaultMethod = "<?php echo $this->sDefaultMethod ?>";
16 16
 jaxon.config.responseType = "<?php echo $this->sResponseType ?>";
17
-<?php if($this->nResponseQueueSize > 0): ?>
17
+<?php if ($this->nResponseQueueSize > 0): ?>
18 18
 jaxon.config.responseQueueSize = <?php echo $this->nResponseQueueSize ?>;
19 19
 <?php endif ?>
20
-<?php if(($this->bDebug)): ?>
21
-<?php if(($this->sDebugOutputID)): ?>
20
+<?php if (($this->bDebug)): ?>
21
+<?php if (($this->sDebugOutputID)): ?>
22 22
 jaxon.debug.outputID = "<?php echo $this->sDebugOutputID ?>";
23 23
 <?php endif ?>
24
-<?php if(($this->bVerboseDebug)): ?>
24
+<?php if (($this->bVerboseDebug)): ?>
25 25
 jaxon.debug.verbose.active = true;
26 26
 <?php endif ?>
27 27
 <?php endif ?>
28
-<?php if(($this->sCsrfMetaName)): ?>
28
+<?php if (($this->sCsrfMetaName)): ?>
29 29
 metaTags = document.getElementsByTagName('meta');
30 30
 for(i = 0; i < metaTags.length; i++)
31 31
 {
Please login to merge, or discard this patch.
src/Response/Response.php 3 patches
Doc Comments   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      * @param array         $aAttributes        Associative array of attributes that will describe the command
160 160
      * @param mixed            $mData                The data to be associated with this command
161 161
      *
162
-     * @return \Jaxon\Plugin\Response
162
+     * @return Response
163 163
      */
164 164
     public function addCommand($aAttributes, $mData)
165 165
     {
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
     /**
201 201
      * Clear all the commands already added to the response
202 202
      *
203
-     * @return \Jaxon\Plugin\Response
203
+     * @return Response
204 204
      */
205 205
     public function clearCommands()
206 206
     {
@@ -214,9 +214,9 @@  discard block
 block discarded – undo
214 214
      *
215 215
      * @param \Jaxon\Plugin\Plugin  $xPlugin            The plugin object
216 216
      * @param array                 $aAttributes        The attributes for this response command
217
-     * @param mixed                 $mData              The data to be sent with this command
217
+     * @param string                 $mData              The data to be sent with this command
218 218
      *
219
-     * @return \Jaxon\Plugin\Response
219
+     * @return Response
220 220
      */
221 221
     public function addPluginCommand($xPlugin, $aAttributes, $mData)
222 222
     {
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
      * @param integer        $iCmdNumber            The number of commands to skip upon cancel
278 278
      * @param string        $sMessage            The message to display to the user
279 279
      *
280
-     * @return \Jaxon\Plugin\Response
280
+     * @return Response
281 281
      */
282 282
     public function confirmCommands($iCmdNumber, $sMessage)
283 283
     {
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
      * @param string        $sAttribute           The attribute to be assigned
298 298
      * @param string        $sData                The value to be assigned to the attribute
299 299
      *
300
-     * @return \Jaxon\Plugin\Response
300
+     * @return Response
301 301
      */
302 302
     public function assign($sTarget, $sAttribute, $sData)
303 303
     {
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
      * @param string        $sTarget              The id of the html element on the browser
320 320
      * @param string        $sData                The value to be assigned to the attribute
321 321
      *
322
-     * @return \Jaxon\Plugin\Response
322
+     * @return Response
323 323
      */
324 324
     public function html($sTarget, $sData)
325 325
     {
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
      * @param string        $sAttribute            The name of the attribute to be appended to
334 334
      * @param string        $sData                The data to be appended to the attribute
335 335
      *
336
-     * @return \Jaxon\Plugin\Response
336
+     * @return Response
337 337
      */
338 338
     public function append($sTarget, $sAttribute, $sData)
339 339
     {
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
      * @param string        $sAttribute            The name of the attribute to be prepended to
355 355
      * @param string        $sData                The value to be prepended to the attribute
356 356
      *
357
-     * @return \Jaxon\Plugin\Response
357
+     * @return Response
358 358
      */
359 359
     public function prepend($sTarget, $sAttribute, $sData)
360 360
     {
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
      * @param string        $sSearch            The needle to search for
377 377
      * @param string        $sData                The data to use in place of the needle
378 378
      *
379
-     * @return \Jaxon\Plugin\Response
379
+     * @return Response
380 380
      */
381 381
     public function replace($sTarget, $sAttribute, $sSearch, $sData)
382 382
     {
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
      * @param string        $sTarget            The id of the element to be updated.
400 400
      * @param string        $sAttribute            The attribute to be cleared
401 401
      *
402
-     * @return \Jaxon\Plugin\Response
402
+     * @return Response
403 403
      */
404 404
     public function clear($sTarget, $sAttribute)
405 405
     {
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
      * @param string        $sAttribute            The attribute to be updated
416 416
      * @param string        $sData                The value to assign
417 417
      *
418
-     * @return \Jaxon\Plugin\Response
418
+     * @return Response
419 419
      */
420 420
     public function contextAssign($sAttribute, $sData)
421 421
     {
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
      * @param string        $sAttribute            The attribute to be appended to
438 438
      * @param string        $sData                The value to append
439 439
      *
440
-     * @return \Jaxon\Plugin\Response
440
+     * @return Response
441 441
      */
442 442
     public function contextAppend($sAttribute, $sData)
443 443
     {
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
      * @param string        $sAttribute            The attribute to be updated
460 460
      * @param string        $sData                The value to be prepended
461 461
      *
462
-     * @return \Jaxon\Plugin\Response
462
+     * @return Response
463 463
      */
464 464
     public function contextPrepend($sAttribute, $sData)
465 465
     {
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
      *
481 481
      * @param string        $sAttribute            The attribute to be cleared
482 482
      *
483
-     * @return \Jaxon\Plugin\Response
483
+     * @return Response
484 484
      */
485 485
     public function contextClear($sAttribute)
486 486
     {
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
      *
493 493
      * @param string        $sMessage            The message to be displayed
494 494
      *
495
-     * @return \Jaxon\Plugin\Response
495
+     * @return Response
496 496
      */
497 497
     public function alert($sMessage)
498 498
     {
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
      *
510 510
      * @param string        $sMessage            The message to be displayed
511 511
      *
512
-     * @return \Jaxon\Plugin\Response
512
+     * @return Response
513 513
      */
514 514
     public function debug($sMessage)
515 515
     {
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
      * @param string        $sURL                The relative or fully qualified URL
528 528
      * @param integer        $iDelay                Number of seconds to delay before the redirect occurs
529 529
      *
530
-     * @return \Jaxon\Plugin\Response
530
+     * @return Response
531 531
      */
532 532
     public function redirect($sURL, $iDelay=0)
533 533
     {
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
      *
581 581
      * @param string        $sJS                The script to execute
582 582
      *
583
-     * @return \Jaxon\Plugin\Response
583
+     * @return Response
584 584
      */
585 585
     public function script($sJS)
586 586
     {
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
      *
598 598
      * @param string        $sFunc                The name of the function to call
599 599
      *
600
-     * @return \Jaxon\Plugin\Response
600
+     * @return Response
601 601
      */
602 602
     public function call($sFunc)
603 603
     {
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
      *
618 618
      * @param string        $sTarget            The id of the element to be removed
619 619
      *
620
-     * @return \Jaxon\Plugin\Response
620
+     * @return Response
621 621
      */
622 622
     public function remove($sTarget)
623 623
     {
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
      * @param string        $sTag                The tag name to be used for the new element
638 638
      * @param string        $sId                The id to assign to the new element
639 639
      *
640
-     * @return \Jaxon\Plugin\Response
640
+     * @return Response
641 641
      */
642 642
     public function create($sParent, $sTag, $sId)
643 643
     {
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
      * @param string        $sTag               The tag name to be used for the new element
659 659
      * @param string        $sId                The id to assign to the new element
660 660
      *
661
-     * @return \Jaxon\Plugin\Response
661
+     * @return Response
662 662
      */
663 663
     public function insert($sBefore, $sTag, $sId)
664 664
     {
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
      * @param string        $sTag               The tag name to be used for the new element
680 680
      * @param string        $sId                The id to assign to the new element
681 681
      *
682
-     * @return \Jaxon\Plugin\Response
682
+     * @return Response
683 683
      */
684 684
     public function insertAfter($sAfter, $sTag, $sId)
685 685
     {
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
      * @param string        $sName                The name of the new input element
702 702
      * @param string        $sId                The id of the new element
703 703
      *
704
-     * @return \Jaxon\Plugin\Response
704
+     * @return Response
705 705
      */
706 706
     public function createInput($sParent, $sType, $sName, $sId)
707 707
     {
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
      * @param string        $sName                The name of the new input element
725 725
      * @param string        $sId                The id of the new element
726 726
      *
727
-     * @return \Jaxon\Plugin\Response
727
+     * @return Response
728 728
      */
729 729
     public function insertInput($sBefore, $sType, $sName, $sId)
730 730
     {
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
      * @param string        $sName                The name of the new input element
748 748
      * @param string        $sId                The id of the new element
749 749
      *
750
-     * @return \Jaxon\Plugin\Response
750
+     * @return Response
751 751
      */
752 752
     public function insertInputAfter($sAfter, $sType, $sName, $sId)
753 753
     {
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
      * @param string        $sEvent                The name of the event
770 770
      * @param string        $sScript            The javascript to execute when the event is fired
771 771
      *
772
-     * @return \Jaxon\Plugin\Response
772
+     * @return Response
773 773
      */
774 774
     public function setEvent($sTarget, $sEvent, $sScript)
775 775
     {
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
      * @param string        $sTarget            The id of the element that contains the event
790 790
      * @param string        $sScript            The javascript to execute when the event is fired
791 791
      *
792
-     * @return \Jaxon\Plugin\Response
792
+     * @return Response
793 793
      */
794 794
     public function onClick($sTarget, $sScript)
795 795
     {
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
      * @param string        $sEvent              The name of the event
806 806
      * @param string        $sHandler            The name of the javascript function to call when the event is fired
807 807
      *
808
-     * @return \Jaxon\Plugin\Response
808
+     * @return Response
809 809
      */
810 810
     public function addHandler($sTarget, $sEvent, $sHandler)
811 811
     {
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
      * @param string        $sEvent              The name of the event
827 827
      * @param string        $sHandler            The name of the javascript function called when the event is fired
828 828
      *
829
-     * @return \Jaxon\Plugin\Response
829
+     * @return Response
830 830
      */
831 831
     public function removeHandler($sTarget, $sEvent, $sHandler)
832 832
     {
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
      * @param string        $sArgs                Comma separated list of parameter names
848 848
      * @param string        $sScript            The javascript code that will become the body of the function
849 849
      *
850
-     * @return \Jaxon\Plugin\Response
850
+     * @return Response
851 851
      */
852 852
     public function setFunction($sFunction, $sArgs, $sScript)
853 853
     {
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
      * @param string        $sReturnValueVar    The name of the variable that will retain the return value
875 875
      *                                             from the call to the original function
876 876
      *
877
-     * @return \Jaxon\Plugin\Response
877
+     * @return Response
878 878
      */
879 879
     public function wrapFunction($sFunction, $sArgs, $aScripts, $sReturnValueVar)
880 880
     {
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
      * @param string        $sFileName            The relative or fully qualified URI of the javascript file
896 896
      * @param string        $sType                Determines the script type. Defaults to 'text/javascript'
897 897
      *
898
-     * @return \Jaxon\Plugin\Response
898
+     * @return Response
899 899
      */
900 900
     public function includeScript($sFileName, $sType = null, $sId = null)
901 901
     {
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
      * @param string        $sFileName            The relative or fully qualified URI of the javascript file
917 917
      * @param string        $sType                Determines the script type. Defaults to 'text/javascript'
918 918
      *
919
-     * @return \Jaxon\Plugin\Response
919
+     * @return Response
920 920
      */
921 921
     public function includeScriptOnce($sFileName, $sType = null, $sId = null)
922 922
     {
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
      * @param string        $sFileName            The relative or fully qualified URI of the javascript file
940 940
      * @param string        $sUnload            Name of a javascript function to call prior to unlaoding the file
941 941
      *
942
-     * @return \Jaxon\Plugin\Response
942
+     * @return Response
943 943
      */
944 944
     public function removeScript($sFileName, $sUnload = '')
945 945
     {
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
      * @param string        $sFileName            The relative or fully qualified URI of the css file
961 961
      * @param string        $sMedia                The media type of the CSS file. Defaults to 'screen'
962 962
      *
963
-     * @return \Jaxon\Plugin\Response
963
+     * @return Response
964 964
      */
965 965
     public function includeCSS($sFileName, $sMedia = null)
966 966
     {
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
      *
980 980
      * @param string        $sFileName            The relative or fully qualified URI of the css file
981 981
      *
982
-     * @return \Jaxon\Plugin\Response
982
+     * @return Response
983 983
      */
984 984
     public function removeCSS($sFileName, $sMedia = null)
985 985
     {
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
      * @param integer        $iTimeout            The number of 1/10ths of a second to pause before timing out
1005 1005
      *                                             and continuing with the execution of the response commands
1006 1006
      *
1007
-     * @return \Jaxon\Plugin\Response
1007
+     * @return Response
1008 1008
      */
1009 1009
     public function waitForCSS($iTimeout = 600)
1010 1010
     {
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
      * @param integer        $tenths                The number of 1/10ths of a second to wait before timing out
1030 1030
      *                                             and continuing with the execution of the response commands.
1031 1031
      *
1032
-     * @return \Jaxon\Plugin\Response
1032
+     * @return Response
1033 1033
      */
1034 1034
     public function waitFor($script, $tenths)
1035 1035
     {
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
      *
1051 1051
      * @param integer        $tenths                The number of 1/10ths of a second to sleep
1052 1052
      *
1053
-     * @return \Jaxon\Plugin\Response
1053
+     * @return Response
1054 1054
      */
1055 1055
     public function sleep($tenths)
1056 1056
     {
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
      * @param string        $variable            The DOM element name (id or class)
1080 1080
      * @param string        $tag                The HTML tag of the new DOM element
1081 1081
      *
1082
-     * @return \Jaxon\Plugin\Response
1082
+     * @return Response
1083 1083
      */
1084 1084
     public function domCreateElement($variable, $tag)
1085 1085
     {
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
      * @param string        $key                The name of the attribute
1100 1100
      * @param string        $value                The value of the attribute
1101 1101
      *
1102
-     * @return \Jaxon\Plugin\Response
1102
+     * @return Response
1103 1103
      */
1104 1104
     public function domSetAttribute($variable, $key, $value)
1105 1105
     {
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
      * @param string        $skip                The ??
1121 1121
      * @param string        $remove                The ??
1122 1122
      *
1123
-     * @return \Jaxon\Plugin\Response
1123
+     * @return Response
1124 1124
      */
1125 1125
     public function domRemoveChildren($parent, $skip = null, $remove = null)
1126 1126
     {
@@ -1141,7 +1141,7 @@  discard block
 block discarded – undo
1141 1141
      * @param string        $parent                The DOM parent element
1142 1142
      * @param string        $variable            The DOM element name (id or class)
1143 1143
      *
1144
-     * @return \Jaxon\Plugin\Response
1144
+     * @return Response
1145 1145
      */
1146 1146
     public function domAppendChild($parent, $variable)
1147 1147
     {
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
      * @param string        $target                The DOM target element
1161 1161
      * @param string        $variable            The DOM element name (id or class)
1162 1162
      *
1163
-     * @return \Jaxon\Plugin\Response
1163
+     * @return Response
1164 1164
      */
1165 1165
     public function domInsertBefore($target, $variable)
1166 1166
     {
@@ -1179,7 +1179,7 @@  discard block
 block discarded – undo
1179 1179
      * @param string        $target                The DOM target element
1180 1180
      * @param string        $variable            The DOM element name (id or class)
1181 1181
      *
1182
-     * @return \Jaxon\Plugin\Response
1182
+     * @return Response
1183 1183
      */
1184 1184
     public function domInsertAfter($target, $variable)
1185 1185
     {
@@ -1198,7 +1198,7 @@  discard block
 block discarded – undo
1198 1198
      * @param string        $parent                The DOM parent element
1199 1199
      * @param string        $text                The HTML text to append
1200 1200
      *
1201
-     * @return \Jaxon\Plugin\Response
1201
+     * @return Response
1202 1202
      */
1203 1203
     public function domAppendText($parent, $text)
1204 1204
     {
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
      *
1240 1240
      * @param mixed        $value                Any value
1241 1241
      *
1242
-     * @return \Jaxon\Plugin\Response
1242
+     * @return Response
1243 1243
      */
1244 1244
     public function setReturnValue($value)
1245 1245
     {
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     public function plugin($sName)
97 97
     {
98 98
         $xPlugin = $this->getPluginManager()->getResponsePlugin($sName);
99
-        if(!$xPlugin)
99
+        if (!$xPlugin)
100 100
         {
101 101
             return null;
102 102
         }
@@ -159,23 +159,23 @@  discard block
 block discarded – undo
159 159
     public function addCommand($aAttributes, $mData)
160 160
     {
161 161
         /* merge commands if possible */
162
-        if(in_array($aAttributes['cmd'], array('js', 'ap')))
162
+        if (in_array($aAttributes['cmd'], array('js', 'ap')))
163 163
         {
164
-            if(($aLastCommand = array_pop($this->aCommands)))
164
+            if (($aLastCommand = array_pop($this->aCommands)))
165 165
             {
166
-                if($aLastCommand['cmd'] == $aAttributes['cmd'])
166
+                if ($aLastCommand['cmd'] == $aAttributes['cmd'])
167 167
                 {
168
-                    if($this->getOption('core.response.merge.js') &&
168
+                    if ($this->getOption('core.response.merge.js') &&
169 169
                             $aLastCommand['cmd'] == 'js')
170 170
                     {
171
-                        $mData = $aLastCommand['data'].'; '.$mData;
171
+                        $mData = $aLastCommand['data'] . '; ' . $mData;
172 172
                     }
173
-                    elseif($this->getOption('core.response.merge.ap') &&
173
+                    elseif ($this->getOption('core.response.merge.ap') &&
174 174
                             $aLastCommand['cmd'] == 'ap' &&
175 175
                             $aLastCommand['id'] == $aAttributes['id'] &&
176 176
                             $aLastCommand['prop'] == $aAttributes['prop'])
177 177
                     {
178
-                        $mData = $aLastCommand['data'].' '.$mData;
178
+                        $mData = $aLastCommand['data'] . ' ' . $mData;
179 179
                     }
180 180
                     else
181 181
                     {
@@ -233,26 +233,26 @@  discard block
 block discarded – undo
233 233
     public function appendResponse($mCommands, $bBefore = false)
234 234
     {
235 235
         $aCommands = [];
236
-        if($mCommands instanceof Response)
236
+        if ($mCommands instanceof Response)
237 237
         {
238 238
             $this->returnValue = $mCommands->returnValue;
239 239
             $aCommands = $mCommands->aCommands;
240 240
         }
241
-        elseif(is_array($mCommands))
241
+        elseif (is_array($mCommands))
242 242
         {
243 243
             $aCommands = $mCommands;
244 244
         }
245 245
         else
246 246
         {
247
-            if(!empty($mCommands))
247
+            if (!empty($mCommands))
248 248
             {
249 249
                 throw new \Jaxon\Exception\Error($this->trans('errors.response.data.invalid'));
250 250
             }
251 251
         }
252 252
 
253
-        if(count($aCommands) > 0)
253
+        if (count($aCommands) > 0)
254 254
         {
255
-            if($bBefore)
255
+            if ($bBefore)
256 256
             {
257 257
                 $this->aCommands = array_merge($aCommands, $this->aCommands);
258 258
             }
@@ -524,33 +524,33 @@  discard block
 block discarded – undo
524 524
      *
525 525
      * @return \Jaxon\Plugin\Response
526 526
      */
527
-    public function redirect($sURL, $iDelay=0)
527
+    public function redirect($sURL, $iDelay = 0)
528 528
     {
529 529
         // we need to parse the query part so that the values are rawurlencode()'ed
530 530
         // can't just use parse_url() cos we could be dealing with a relative URL which
531 531
         // parse_url() can't deal with.
532 532
         $queryStart = strpos($sURL, '?', strrpos($sURL, '/'));
533
-        if($queryStart !== false)
533
+        if ($queryStart !== false)
534 534
         {
535 535
             $queryStart++;
536 536
             $queryEnd = strpos($sURL, '#', $queryStart);
537
-            if($queryEnd === false)
537
+            if ($queryEnd === false)
538 538
                 $queryEnd = strlen($sURL);
539
-            $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
539
+            $queryPart = substr($sURL, $queryStart, $queryEnd - $queryStart);
540 540
             parse_str($queryPart, $queryParts);
541 541
             $newQueryPart = "";
542
-            if($queryParts)
542
+            if ($queryParts)
543 543
             {
544 544
                 $first = true;
545
-                foreach($queryParts as $key => $value)
545
+                foreach ($queryParts as $key => $value)
546 546
                 {
547
-                    if($first)
547
+                    if ($first)
548 548
                         $first = false;
549 549
                     else
550 550
                         $newQueryPart .= '&';
551
-                    $newQueryPart .= rawurlencode($key).'='.rawurlencode($value);
551
+                    $newQueryPart .= rawurlencode($key) . '=' . rawurlencode($value);
552 552
                 }
553
-            } elseif($_SERVER['QUERY_STRING']) {
553
+            } elseif ($_SERVER['QUERY_STRING']) {
554 554
                     //couldn't break up the query, but there's one there
555 555
                     //possibly "http://url/page.html?query1234" type of query?
556 556
                     //just encode it and hope it works
@@ -558,8 +558,8 @@  discard block
 block discarded – undo
558 558
                 }
559 559
             $sURL = str_replace($queryPart, $newQueryPart, $sURL);
560 560
         }
561
-        if($iDelay)
562
-            $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');');
561
+        if ($iDelay)
562
+            $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay * 1000) . ');');
563 563
         else
564 564
             $this->script('window.location = "' . $sURL . '";');
565 565
         return $this;
@@ -896,10 +896,10 @@  discard block
 block discarded – undo
896 896
     {
897 897
         $command = array('cmd'  =>  'in');
898 898
 
899
-        if(($sType))
899
+        if (($sType))
900 900
             $command['type'] = trim((string)$sType, " \t");
901 901
 
902
-        if(($sId))
902
+        if (($sId))
903 903
             $command['elm_id'] = trim((string)$sId, " \t");
904 904
 
905 905
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
@@ -917,10 +917,10 @@  discard block
 block discarded – undo
917 917
     {
918 918
         $command = array('cmd' => 'ino');
919 919
 
920
-        if(($sType))
920
+        if (($sType))
921 921
             $command['type'] = trim((string)$sType, " \t");
922 922
 
923
-        if(($sId))
923
+        if (($sId))
924 924
             $command['elm_id'] = trim((string)$sId, " \t");
925 925
 
926 926
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
     {
962 962
         $command = array('cmd' => 'css');
963 963
 
964
-        if(($sMedia))
964
+        if (($sMedia))
965 965
             $command['media'] = trim((string)$sMedia, " \t");
966 966
 
967 967
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
     {
981 981
         $command = array('cmd' => 'rcss');
982 982
 
983
-        if(($sMedia))
983
+        if (($sMedia))
984 984
             $command['media'] = trim((string)$sMedia, " \t");
985 985
 
986 986
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
@@ -1121,10 +1121,10 @@  discard block
 block discarded – undo
1121 1121
     {
1122 1122
         $command = array('cmd' => 'DRC');
1123 1123
 
1124
-        if(($skip))
1124
+        if (($skip))
1125 1125
             $command['skip'] = $skip;
1126 1126
 
1127
-        if(($remove))
1127
+        if (($remove))
1128 1128
             $command['remove'] = $remove;
1129 1129
 
1130 1130
         return $this->addCommand($command, $parent);
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
      */
1250 1250
     public function sendHeaders()
1251 1251
     {
1252
-        if($this->getRequesthandler()->getRequestMethod() == Jaxon::METHOD_GET)
1252
+        if ($this->getRequesthandler()->getRequestMethod() == Jaxon::METHOD_GET)
1253 1253
         {
1254 1254
             header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
1255 1255
             header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
@@ -1259,7 +1259,7 @@  discard block
 block discarded – undo
1259 1259
 
1260 1260
         $sCharacterSet = '';
1261 1261
         $sCharacterEncoding = trim($this->getOption('core.encoding'));
1262
-        if(($sCharacterEncoding) && strlen($sCharacterEncoding) > 0)
1262
+        if (($sCharacterEncoding) && strlen($sCharacterEncoding) > 0)
1263 1263
         {
1264 1264
             $sCharacterSet = '; charset="' . trim($sCharacterEncoding) . '"';
1265 1265
         }
@@ -1276,13 +1276,13 @@  discard block
 block discarded – undo
1276 1276
     {
1277 1277
         $response = [];
1278 1278
 
1279
-        if(($this->returnValue))
1279
+        if (($this->returnValue))
1280 1280
         {
1281 1281
             $response['jxnrv'] = $this->returnValue;
1282 1282
         }
1283 1283
         $response['jxnobj'] = [];
1284 1284
 
1285
-        foreach($this->aCommands as $xCommand)
1285
+        foreach ($this->aCommands as $xCommand)
1286 1286
         {
1287 1287
             $response['jxnobj'][] = $xCommand;
1288 1288
         }
Please login to merge, or discard this patch.
Braces   +43 added lines, -38 removed lines patch added patch discarded remove patch
@@ -169,20 +169,17 @@  discard block
 block discarded – undo
169 169
                             $aLastCommand['cmd'] == 'js')
170 170
                     {
171 171
                         $mData = $aLastCommand['data'].'; '.$mData;
172
-                    }
173
-                    elseif($this->getOption('core.response.merge.ap') &&
172
+                    } elseif($this->getOption('core.response.merge.ap') &&
174 173
                             $aLastCommand['cmd'] == 'ap' &&
175 174
                             $aLastCommand['id'] == $aAttributes['id'] &&
176 175
                             $aLastCommand['prop'] == $aAttributes['prop'])
177 176
                     {
178 177
                         $mData = $aLastCommand['data'].' '.$mData;
179
-                    }
180
-                    else
178
+                    } else
181 179
                     {
182 180
                         $this->aCommands[] = $aLastCommand;
183 181
                     }
184
-                }
185
-                else
182
+                } else
186 183
                 {
187 184
                     $this->aCommands[] = $aLastCommand;
188 185
                 }
@@ -237,12 +234,10 @@  discard block
 block discarded – undo
237 234
         {
238 235
             $this->returnValue = $mCommands->returnValue;
239 236
             $aCommands = $mCommands->aCommands;
240
-        }
241
-        elseif(is_array($mCommands))
237
+        } elseif(is_array($mCommands))
242 238
         {
243 239
             $aCommands = $mCommands;
244
-        }
245
-        else
240
+        } else
246 241
         {
247 242
             if(!empty($mCommands))
248 243
             {
@@ -255,8 +250,7 @@  discard block
 block discarded – undo
255 250
             if($bBefore)
256 251
             {
257 252
                 $this->aCommands = array_merge($aCommands, $this->aCommands);
258
-            }
259
-            else
253
+            } else
260 254
             {
261 255
                 $this->aCommands = array_merge($this->aCommands, $aCommands);
262 256
             }
@@ -534,8 +528,9 @@  discard block
 block discarded – undo
534 528
         {
535 529
             $queryStart++;
536 530
             $queryEnd = strpos($sURL, '#', $queryStart);
537
-            if($queryEnd === false)
538
-                $queryEnd = strlen($sURL);
531
+            if($queryEnd === false) {
532
+                            $queryEnd = strlen($sURL);
533
+            }
539 534
             $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
540 535
             parse_str($queryPart, $queryParts);
541 536
             $newQueryPart = "";
@@ -544,10 +539,11 @@  discard block
 block discarded – undo
544 539
                 $first = true;
545 540
                 foreach($queryParts as $key => $value)
546 541
                 {
547
-                    if($first)
548
-                        $first = false;
549
-                    else
550
-                        $newQueryPart .= '&';
542
+                    if($first) {
543
+                                            $first = false;
544
+                    } else {
545
+                                            $newQueryPart .= '&';
546
+                    }
551 547
                     $newQueryPart .= rawurlencode($key).'='.rawurlencode($value);
552 548
                 }
553 549
             } elseif($_SERVER['QUERY_STRING']) {
@@ -558,10 +554,11 @@  discard block
 block discarded – undo
558 554
                 }
559 555
             $sURL = str_replace($queryPart, $newQueryPart, $sURL);
560 556
         }
561
-        if($iDelay)
562
-            $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');');
563
-        else
564
-            $this->script('window.location = "' . $sURL . '";');
557
+        if($iDelay) {
558
+                    $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');');
559
+        } else {
560
+                    $this->script('window.location = "' . $sURL . '";');
561
+        }
565 562
         return $this;
566 563
     }
567 564
 
@@ -896,11 +893,13 @@  discard block
 block discarded – undo
896 893
     {
897 894
         $command = array('cmd'  =>  'in');
898 895
 
899
-        if(($sType))
900
-            $command['type'] = trim((string)$sType, " \t");
896
+        if(($sType)) {
897
+                    $command['type'] = trim((string)$sType, " \t");
898
+        }
901 899
 
902
-        if(($sId))
903
-            $command['elm_id'] = trim((string)$sId, " \t");
900
+        if(($sId)) {
901
+                    $command['elm_id'] = trim((string)$sId, " \t");
902
+        }
904 903
 
905 904
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
906 905
     }
@@ -917,11 +916,13 @@  discard block
 block discarded – undo
917 916
     {
918 917
         $command = array('cmd' => 'ino');
919 918
 
920
-        if(($sType))
921
-            $command['type'] = trim((string)$sType, " \t");
919
+        if(($sType)) {
920
+                    $command['type'] = trim((string)$sType, " \t");
921
+        }
922 922
 
923
-        if(($sId))
924
-            $command['elm_id'] = trim((string)$sId, " \t");
923
+        if(($sId)) {
924
+                    $command['elm_id'] = trim((string)$sId, " \t");
925
+        }
925 926
 
926 927
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
927 928
     }
@@ -961,8 +962,9 @@  discard block
 block discarded – undo
961 962
     {
962 963
         $command = array('cmd' => 'css');
963 964
 
964
-        if(($sMedia))
965
-            $command['media'] = trim((string)$sMedia, " \t");
965
+        if(($sMedia)) {
966
+                    $command['media'] = trim((string)$sMedia, " \t");
967
+        }
966 968
 
967 969
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
968 970
     }
@@ -980,8 +982,9 @@  discard block
 block discarded – undo
980 982
     {
981 983
         $command = array('cmd' => 'rcss');
982 984
 
983
-        if(($sMedia))
984
-            $command['media'] = trim((string)$sMedia, " \t");
985
+        if(($sMedia)) {
986
+                    $command['media'] = trim((string)$sMedia, " \t");
987
+        }
985 988
 
986 989
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
987 990
     }
@@ -1121,11 +1124,13 @@  discard block
 block discarded – undo
1121 1124
     {
1122 1125
         $command = array('cmd' => 'DRC');
1123 1126
 
1124
-        if(($skip))
1125
-            $command['skip'] = $skip;
1127
+        if(($skip)) {
1128
+                    $command['skip'] = $skip;
1129
+        }
1126 1130
 
1127
-        if(($remove))
1128
-            $command['remove'] = $remove;
1131
+        if(($remove)) {
1132
+                    $command['remove'] = $remove;
1133
+        }
1129 1134
 
1130 1135
         return $this->addCommand($command, $parent);
1131 1136
     }
Please login to merge, or discard this patch.