@@ -3,13 +3,13 @@ discard block |
||
| 3 | 3 | //$Id: packages.php 3319 2013-09-08 20:59:44Z ctrlaltca $ |
| 4 | 4 | |
| 5 | 5 | // To make future upgrades easier |
| 6 | -if (!defined('PROTOTYPE_DIR')) define ('PROTOTYPE_DIR', 'prototype-1.7'); |
|
| 7 | -if (!defined('JQUERY_DIR')) define ('JQUERY_DIR', 'jquery'); |
|
| 8 | -if (!defined('BOOTSTRAP_DIR')) define ('BOOTSTRAP_DIR', 'bootstrap3'); |
|
| 9 | -if (!defined('SCRIPTACULOUS_DIR')) define ('SCRIPTACULOUS_DIR', 'scriptaculous-1.9.0'); |
|
| 6 | +if(!defined('PROTOTYPE_DIR')) define('PROTOTYPE_DIR', 'prototype-1.7'); |
|
| 7 | +if(!defined('JQUERY_DIR')) define('JQUERY_DIR', 'jquery'); |
|
| 8 | +if(!defined('BOOTSTRAP_DIR')) define('BOOTSTRAP_DIR', 'bootstrap3'); |
|
| 9 | +if(!defined('SCRIPTACULOUS_DIR')) define('SCRIPTACULOUS_DIR', 'scriptaculous-1.9.0'); |
|
| 10 | 10 | |
| 11 | 11 | //package names and its contents (files relative to the current directory) |
| 12 | -$packages = array( |
|
| 12 | +$packages=array( |
|
| 13 | 13 | // base prado scripts |
| 14 | 14 | 'prado' => array( |
| 15 | 15 | 'prado/prado.js', |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | |
| 117 | 117 | //package names and their dependencies |
| 118 | -$dependencies = array( |
|
| 118 | +$dependencies=array( |
|
| 119 | 119 | 'jquery' => array('jquery'), |
| 120 | 120 | 'prado' => array('jquery', 'prado'), |
| 121 | 121 | 'bootstrap' => array('jquery', 'bootstrap'), |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | 'jqueryui' => array('jquery', 'jqueryui'), |
| 139 | 139 | 'prototype' => array('prototype'), |
| 140 | 140 | 'dragdrop' => array('prototype', 'jquery', 'prado', 'ajax', 'dragdrop'), |
| 141 | - 'dragdropextra' => array('prototype', 'jquery', 'prado', 'ajax', 'dragdrop','dragdropextra'), |
|
| 141 | + 'dragdropextra' => array('prototype', 'jquery', 'prado', 'ajax', 'dragdrop', 'dragdropextra'), |
|
| 142 | 142 | 'autocomplete' => array('prototype', 'jquery', 'prado', 'ajax', 'autocomplete'), |
| 143 | 143 | ); |
| 144 | 144 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | $str=''; |
| 32 | 32 | foreach($files as $file) |
| 33 | - $str.= self::renderScriptFile($file); |
|
| 33 | + $str.=self::renderScriptFile($file); |
|
| 34 | 34 | return $str; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | public static function renderScriptBlocks($scripts) |
| 53 | 53 | { |
| 54 | 54 | if(count($scripts)) |
| 55 | - return "<script type=\"text/javascript\">\n/*<![CDATA[*/\n".implode("\n",$scripts)."\n/*]]>*/\n</script>\n"; |
|
| 55 | + return "<script type=\"text/javascript\">\n/*<![CDATA[*/\n".implode("\n", $scripts)."\n/*]]>*/\n</script>\n"; |
|
| 56 | 56 | else |
| 57 | 57 | return ''; |
| 58 | 58 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | public static function renderScriptBlocksCallback($scripts) |
| 66 | 66 | { |
| 67 | 67 | if(count($scripts)) |
| 68 | - return implode("\n",$scripts)."\n"; |
|
| 68 | + return implode("\n", $scripts)."\n"; |
|
| 69 | 69 | else |
| 70 | 70 | return ''; |
| 71 | 71 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public static function quoteString($js) |
| 91 | 91 | { |
| 92 | - return self::jsonEncode($js,JSON_HEX_QUOT | JSON_HEX_APOS | JSON_HEX_TAG); |
|
| 92 | + return self::jsonEncode($js, JSON_HEX_QUOT | JSON_HEX_APOS | JSON_HEX_TAG); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -150,16 +150,16 @@ discard block |
||
| 150 | 150 | * @param boolean wether to encode empty strings too. Default to false for BC. |
| 151 | 151 | * @return string the encoded string |
| 152 | 152 | */ |
| 153 | - public static function encode($value,$toMap=true,$encodeEmptyStrings=false) |
|
| 153 | + public static function encode($value, $toMap=true, $encodeEmptyStrings=false) |
|
| 154 | 154 | { |
| 155 | 155 | if(is_string($value)) |
| 156 | 156 | return self::quoteString($value); |
| 157 | 157 | else if(is_bool($value)) |
| 158 | - return $value?'true':'false'; |
|
| 158 | + return $value ? 'true' : 'false'; |
|
| 159 | 159 | else if(is_array($value)) |
| 160 | 160 | { |
| 161 | 161 | $results=''; |
| 162 | - if(($n=count($value))>0 && array_keys($value)!==range(0,$n-1)) |
|
| 162 | + if(($n=count($value)) > 0 && array_keys($value)!==range(0, $n - 1)) |
|
| 163 | 163 | { |
| 164 | 164 | foreach($value as $k=>$v) |
| 165 | 165 | { |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | { |
| 168 | 168 | if($results!=='') |
| 169 | 169 | $results.=','; |
| 170 | - $results.="'$k':".self::encode($v,$toMap,$encodeEmptyStrings); |
|
| 170 | + $results.="'$k':".self::encode($v, $toMap, $encodeEmptyStrings); |
|
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | return '{'.$results.'}'; |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | { |
| 181 | 181 | if($results!=='') |
| 182 | 182 | $results.=','; |
| 183 | - $results.=self::encode($v,$toMap, $encodeEmptyStrings); |
|
| 183 | + $results.=self::encode($v, $toMap, $encodeEmptyStrings); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | return '['.$results.']'; |
@@ -208,10 +208,10 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | } |
| 210 | 210 | else if(is_object($value)) |
| 211 | - if ($value instanceof TJavaScriptLiteral) |
|
| 211 | + if($value instanceof TJavaScriptLiteral) |
|
| 212 | 212 | return $value->toJavaScriptLiteral(); |
| 213 | 213 | else |
| 214 | - return self::encode(get_object_vars($value),$toMap); |
|
| 214 | + return self::encode(get_object_vars($value), $toMap); |
|
| 215 | 215 | else if($value===null) |
| 216 | 216 | return 'null'; |
| 217 | 217 | else |
@@ -223,14 +223,14 @@ discard block |
||
| 223 | 223 | * @param mixed variable to be encoded |
| 224 | 224 | * @return string encoded string |
| 225 | 225 | */ |
| 226 | - public static function jsonEncode($value, $options = 0) |
|
| 226 | + public static function jsonEncode($value, $options=0) |
|
| 227 | 227 | { |
| 228 | - if (($g=Prado::getApplication()->getGlobalization(false))!==null && |
|
| 228 | + if(($g=Prado::getApplication()->getGlobalization(false))!==null && |
|
| 229 | 229 | strtoupper($enc=$g->getCharset())!='UTF-8') { |
| 230 | 230 | self::convertToUtf8($value, $enc); |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - $s = @json_encode($value,$options); |
|
| 233 | + $s=@json_encode($value, $options); |
|
| 234 | 234 | self::checkJsonError(); |
| 235 | 235 | return $s; |
| 236 | 236 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | private static function convertToUtf8(&$value, $sourceEncoding) { |
| 244 | 244 | if(is_string($value)) |
| 245 | 245 | $value=iconv($sourceEncoding, 'UTF-8', $value); |
| 246 | - else if (is_array($value)) |
|
| 246 | + else if(is_array($value)) |
|
| 247 | 247 | { |
| 248 | 248 | foreach($value as &$element) |
| 249 | 249 | self::convertToUtf8($element, $sourceEncoding); |
@@ -258,37 +258,37 @@ discard block |
||
| 258 | 258 | * @param int recursion depth |
| 259 | 259 | * @return mixed decoded variable |
| 260 | 260 | */ |
| 261 | - public static function jsonDecode($value, $assoc = false, $depth = 512) |
|
| 261 | + public static function jsonDecode($value, $assoc=false, $depth=512) |
|
| 262 | 262 | { |
| 263 | - $s= @json_decode($value, $assoc, $depth); |
|
| 263 | + $s=@json_decode($value, $assoc, $depth); |
|
| 264 | 264 | self::checkJsonError(); |
| 265 | 265 | return $s; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | private static function checkJsonError() |
| 269 | 269 | { |
| 270 | - switch ($err = json_last_error()) |
|
| 270 | + switch($err=json_last_error()) |
|
| 271 | 271 | { |
| 272 | 272 | case JSON_ERROR_NONE: |
| 273 | 273 | return; |
| 274 | 274 | break; |
| 275 | 275 | case JSON_ERROR_DEPTH: |
| 276 | - $msg = 'Maximum stack depth exceeded'; |
|
| 276 | + $msg='Maximum stack depth exceeded'; |
|
| 277 | 277 | break; |
| 278 | 278 | case JSON_ERROR_STATE_MISMATCH: |
| 279 | - $msg = 'Underflow or the modes mismatch'; |
|
| 279 | + $msg='Underflow or the modes mismatch'; |
|
| 280 | 280 | break; |
| 281 | 281 | case JSON_ERROR_CTRL_CHAR: |
| 282 | - $msg = 'Unexpected control character found'; |
|
| 282 | + $msg='Unexpected control character found'; |
|
| 283 | 283 | break; |
| 284 | 284 | case JSON_ERROR_SYNTAX: |
| 285 | - $msg = 'Syntax error, malformed JSON'; |
|
| 285 | + $msg='Syntax error, malformed JSON'; |
|
| 286 | 286 | break; |
| 287 | 287 | case JSON_ERROR_UTF8: |
| 288 | - $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded'; |
|
| 288 | + $msg='Malformed UTF-8 characters, possibly incorrectly encoded'; |
|
| 289 | 289 | break; |
| 290 | 290 | default: |
| 291 | - $msg = 'Unknown error'; |
|
| 291 | + $msg='Unknown error'; |
|
| 292 | 292 | break; |
| 293 | 293 | } |
| 294 | 294 | throw new Exception("JSON error ($err): $msg"); |
@@ -46,29 +46,29 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | |
| 48 | 48 | class JSMin { |
| 49 | - const ORD_LF = 10; |
|
| 50 | - const ORD_SPACE = 32; |
|
| 49 | + const ORD_LF=10; |
|
| 50 | + const ORD_SPACE=32; |
|
| 51 | 51 | |
| 52 | - protected $a = ''; |
|
| 53 | - protected $b = ''; |
|
| 54 | - protected $input = ''; |
|
| 55 | - protected $inputIndex = 0; |
|
| 56 | - protected $inputLength = 0; |
|
| 57 | - protected $lookAhead = null; |
|
| 58 | - protected $output = ''; |
|
| 52 | + protected $a=''; |
|
| 53 | + protected $b=''; |
|
| 54 | + protected $input=''; |
|
| 55 | + protected $inputIndex=0; |
|
| 56 | + protected $inputLength=0; |
|
| 57 | + protected $lookAhead=null; |
|
| 58 | + protected $output=''; |
|
| 59 | 59 | |
| 60 | 60 | // -- Public Static Methods -------------------------------------------------- |
| 61 | 61 | |
| 62 | 62 | public static function minify($js) { |
| 63 | - $jsmin = new JSMin($js); |
|
| 63 | + $jsmin=new JSMin($js); |
|
| 64 | 64 | return $jsmin->min(); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | // -- Public Instance Methods ------------------------------------------------ |
| 68 | 68 | |
| 69 | 69 | public function __construct($input) { |
| 70 | - $this->input = str_replace("\r\n", "\n", $input); |
|
| 71 | - $this->inputLength = strlen($this->input); |
|
| 70 | + $this->input=str_replace("\r\n", "\n", $input); |
|
| 71 | + $this->inputLength=strlen($this->input); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // -- Protected Instance Methods --------------------------------------------- |
@@ -76,80 +76,80 @@ discard block |
||
| 76 | 76 | protected function action($d) { |
| 77 | 77 | switch($d) { |
| 78 | 78 | case 1: |
| 79 | - $this->output .= $this->a; |
|
| 79 | + $this->output.=$this->a; |
|
| 80 | 80 | |
| 81 | 81 | case 2: |
| 82 | - $this->a = $this->b; |
|
| 82 | + $this->a=$this->b; |
|
| 83 | 83 | |
| 84 | - if ($this->a === "'" || $this->a === '"') { |
|
| 85 | - for (;;) { |
|
| 86 | - $this->output .= $this->a; |
|
| 87 | - $this->a = $this->get(); |
|
| 84 | + if($this->a==="'" || $this->a==='"') { |
|
| 85 | + for(;;) { |
|
| 86 | + $this->output.=$this->a; |
|
| 87 | + $this->a=$this->get(); |
|
| 88 | 88 | |
| 89 | - if ($this->a === $this->b) { |
|
| 89 | + if($this->a===$this->b) { |
|
| 90 | 90 | break; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if (ord($this->a) <= self::ORD_LF) { |
|
| 93 | + if(ord($this->a) <= self::ORD_LF) { |
|
| 94 | 94 | throw new JSMinException('Unterminated string literal.'); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if ($this->a === '\\') { |
|
| 98 | - $this->output .= $this->a; |
|
| 99 | - $this->a = $this->get(); |
|
| 97 | + if($this->a==='\\') { |
|
| 98 | + $this->output.=$this->a; |
|
| 99 | + $this->a=$this->get(); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | case 3: |
| 105 | - $this->b = $this->next(); |
|
| 105 | + $this->b=$this->next(); |
|
| 106 | 106 | |
| 107 | - if ($this->b === '/' && ( |
|
| 108 | - $this->a === '(' || $this->a === ',' || $this->a === '=' || |
|
| 109 | - $this->a === ':' || $this->a === '[' || $this->a === '!' || |
|
| 110 | - $this->a === '&' || $this->a === '|' || $this->a === '?')) { |
|
| 107 | + if($this->b==='/' && ( |
|
| 108 | + $this->a==='(' || $this->a===',' || $this->a==='=' || |
|
| 109 | + $this->a===':' || $this->a==='[' || $this->a==='!' || |
|
| 110 | + $this->a==='&' || $this->a==='|' || $this->a==='?')) { |
|
| 111 | 111 | |
| 112 | - $this->output .= $this->a . $this->b; |
|
| 112 | + $this->output.=$this->a.$this->b; |
|
| 113 | 113 | |
| 114 | - for (;;) { |
|
| 115 | - $this->a = $this->get(); |
|
| 114 | + for(;;) { |
|
| 115 | + $this->a=$this->get(); |
|
| 116 | 116 | |
| 117 | - if ($this->a === '/') { |
|
| 117 | + if($this->a==='/') { |
|
| 118 | 118 | break; |
| 119 | - } elseif ($this->a === '\\') { |
|
| 120 | - $this->output .= $this->a; |
|
| 121 | - $this->a = $this->get(); |
|
| 122 | - } elseif (ord($this->a) <= self::ORD_LF) { |
|
| 119 | + } elseif($this->a==='\\') { |
|
| 120 | + $this->output.=$this->a; |
|
| 121 | + $this->a=$this->get(); |
|
| 122 | + } elseif(ord($this->a) <= self::ORD_LF) { |
|
| 123 | 123 | throw new JSMinException('Unterminated regular expression '. |
| 124 | 124 | 'literal.'); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - $this->output .= $this->a; |
|
| 127 | + $this->output.=$this->a; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - $this->b = $this->next(); |
|
| 130 | + $this->b=$this->next(); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | protected function get() { |
| 136 | - $c = $this->lookAhead; |
|
| 137 | - $this->lookAhead = null; |
|
| 136 | + $c=$this->lookAhead; |
|
| 137 | + $this->lookAhead=null; |
|
| 138 | 138 | |
| 139 | - if ($c === null) { |
|
| 140 | - if ($this->inputIndex < $this->inputLength) { |
|
| 141 | - $c = $this->input[$this->inputIndex]; |
|
| 142 | - $this->inputIndex += 1; |
|
| 139 | + if($c===null) { |
|
| 140 | + if($this->inputIndex < $this->inputLength) { |
|
| 141 | + $c=$this->input[$this->inputIndex]; |
|
| 142 | + $this->inputIndex+=1; |
|
| 143 | 143 | } else { |
| 144 | - $c = null; |
|
| 144 | + $c=null; |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - if ($c === "\r") { |
|
| 148 | + if($c==="\r") { |
|
| 149 | 149 | return "\n"; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) { |
|
| 152 | + if($c===null || $c==="\n" || ord($c) >= self::ORD_SPACE) { |
|
| 153 | 153 | return $c; |
| 154 | 154 | } |
| 155 | 155 | |
@@ -157,17 +157,17 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | protected function isAlphaNum($c) { |
| 160 | - return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1; |
|
| 160 | + return ord($c) > 126 || $c==='\\' || preg_match('/^[\w\$]$/', $c)===1; |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | protected function min() { |
| 164 | - $this->a = "\n"; |
|
| 164 | + $this->a="\n"; |
|
| 165 | 165 | $this->action(3); |
| 166 | 166 | |
| 167 | - while ($this->a !== null) { |
|
| 168 | - switch ($this->a) { |
|
| 167 | + while($this->a!==null) { |
|
| 168 | + switch($this->a) { |
|
| 169 | 169 | case ' ': |
| 170 | - if ($this->isAlphaNum($this->b)) { |
|
| 170 | + if($this->isAlphaNum($this->b)) { |
|
| 171 | 171 | $this->action(1); |
| 172 | 172 | } else { |
| 173 | 173 | $this->action(2); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | break; |
| 176 | 176 | |
| 177 | 177 | case "\n": |
| 178 | - switch ($this->b) { |
|
| 178 | + switch($this->b) { |
|
| 179 | 179 | case '{': |
| 180 | 180 | case '[': |
| 181 | 181 | case '(': |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | break; |
| 190 | 190 | |
| 191 | 191 | default: |
| 192 | - if ($this->isAlphaNum($this->b)) { |
|
| 192 | + if($this->isAlphaNum($this->b)) { |
|
| 193 | 193 | $this->action(1); |
| 194 | 194 | } |
| 195 | 195 | else { |
@@ -199,9 +199,9 @@ discard block |
||
| 199 | 199 | break; |
| 200 | 200 | |
| 201 | 201 | default: |
| 202 | - switch ($this->b) { |
|
| 202 | + switch($this->b) { |
|
| 203 | 203 | case ' ': |
| 204 | - if ($this->isAlphaNum($this->a)) { |
|
| 204 | + if($this->isAlphaNum($this->a)) { |
|
| 205 | 205 | $this->action(1); |
| 206 | 206 | break; |
| 207 | 207 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | break; |
| 211 | 211 | |
| 212 | 212 | case "\n": |
| 213 | - switch ($this->a) { |
|
| 213 | + switch($this->a) { |
|
| 214 | 214 | case '}': |
| 215 | 215 | case ']': |
| 216 | 216 | case ')': |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | break; |
| 223 | 223 | |
| 224 | 224 | default: |
| 225 | - if ($this->isAlphaNum($this->a)) { |
|
| 225 | + if($this->isAlphaNum($this->a)) { |
|
| 226 | 226 | $this->action(1); |
| 227 | 227 | } |
| 228 | 228 | else { |
@@ -242,15 +242,15 @@ discard block |
||
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | protected function next() { |
| 245 | - $c = $this->get(); |
|
| 245 | + $c=$this->get(); |
|
| 246 | 246 | |
| 247 | - if ($c === '/') { |
|
| 247 | + if($c==='/') { |
|
| 248 | 248 | switch($this->peek()) { |
| 249 | 249 | case '/': |
| 250 | - for (;;) { |
|
| 251 | - $c = $this->get(); |
|
| 250 | + for(;;) { |
|
| 251 | + $c=$this->get(); |
|
| 252 | 252 | |
| 253 | - if (ord($c) <= self::ORD_LF) { |
|
| 253 | + if(ord($c) <= self::ORD_LF) { |
|
| 254 | 254 | return $c; |
| 255 | 255 | } |
| 256 | 256 | } |
@@ -258,10 +258,10 @@ discard block |
||
| 258 | 258 | case '*': |
| 259 | 259 | $this->get(); |
| 260 | 260 | |
| 261 | - for (;;) { |
|
| 261 | + for(;;) { |
|
| 262 | 262 | switch($this->get()) { |
| 263 | 263 | case '*': |
| 264 | - if ($this->peek() === '/') { |
|
| 264 | + if($this->peek()==='/') { |
|
| 265 | 265 | $this->get(); |
| 266 | 266 | return ' '; |
| 267 | 267 | } |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | protected function peek() { |
| 284 | - $this->lookAhead = $this->get(); |
|
| 284 | + $this->lookAhead=$this->get(); |
|
| 285 | 285 | return $this->lookAhead; |
| 286 | 286 | } |
| 287 | 287 | } |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | * @return string URL |
| 65 | 65 | * @see parseUrl |
| 66 | 66 | */ |
| 67 | - public function constructUrl($serviceID,$serviceParam,$getItems,$encodeAmpersand,$encodeGetItems) |
|
| 67 | + public function constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems) |
|
| 68 | 68 | { |
| 69 | 69 | $url=$serviceID.'='.urlencode($serviceParam); |
| 70 | - $amp=$encodeAmpersand?'&':'&'; |
|
| 70 | + $amp=$encodeAmpersand ? '&' : '&'; |
|
| 71 | 71 | $request=$this->getRequest(); |
| 72 | 72 | if(is_array($getItems) || $getItems instanceof Traversable) |
| 73 | 73 | { |
@@ -103,9 +103,9 @@ discard block |
||
| 103 | 103 | switch($request->getUrlFormat()) |
| 104 | 104 | { |
| 105 | 105 | case THttpRequestUrlFormat::Path: |
| 106 | - return $request->getApplicationUrl().'/'.strtr($url,array($amp=>'/','?'=>'/','='=>$request->getUrlParamSeparator())); |
|
| 106 | + return $request->getApplicationUrl().'/'.strtr($url, array($amp=>'/', '?'=>'/', '='=>$request->getUrlParamSeparator())); |
|
| 107 | 107 | case THttpRequestUrlFormat::HiddenPath: |
| 108 | - return rtrim(dirname($request->getApplicationUrl()), '/').'/'.strtr($url,array($amp=>'/','?'=>'/','='=>$request->getUrlParamSeparator())); |
|
| 108 | + return rtrim(dirname($request->getApplicationUrl()), '/').'/'.strtr($url, array($amp=>'/', '?'=>'/', '='=>$request->getUrlParamSeparator())); |
|
| 109 | 109 | default: |
| 110 | 110 | return $request->getApplicationUrl().'?'.$url; |
| 111 | 111 | } |
@@ -127,24 +127,24 @@ discard block |
||
| 127 | 127 | public function parseUrl() |
| 128 | 128 | { |
| 129 | 129 | $request=$this->getRequest(); |
| 130 | - $pathInfo=trim($request->getPathInfo(),'/'); |
|
| 130 | + $pathInfo=trim($request->getPathInfo(), '/'); |
|
| 131 | 131 | if(($request->getUrlFormat()===THttpRequestUrlFormat::Path || |
| 132 | 132 | $request->getUrlFormat()===THttpRequestUrlFormat::HiddenPath) && |
| 133 | 133 | $pathInfo!=='') |
| 134 | 134 | { |
| 135 | 135 | $separator=$request->getUrlParamSeparator(); |
| 136 | - $paths=explode('/',$pathInfo); |
|
| 136 | + $paths=explode('/', $pathInfo); |
|
| 137 | 137 | $getVariables=array(); |
| 138 | 138 | foreach($paths as $path) |
| 139 | 139 | { |
| 140 | 140 | if(($path=trim($path))!=='') |
| 141 | 141 | { |
| 142 | - if(($pos=strpos($path,$separator))!==false) |
|
| 142 | + if(($pos=strpos($path, $separator))!==false) |
|
| 143 | 143 | { |
| 144 | - $name=substr($path,0,$pos); |
|
| 145 | - $value=substr($path,$pos+1); |
|
| 146 | - if(($pos=strpos($name,'[]'))!==false) |
|
| 147 | - $getVariables[substr($name,0,$pos)][]=$value; |
|
| 144 | + $name=substr($path, 0, $pos); |
|
| 145 | + $value=substr($path, $pos + 1); |
|
| 146 | + if(($pos=strpos($name, '[]'))!==false) |
|
| 147 | + $getVariables[substr($name, 0, $pos)][]=$value; |
|
| 148 | 148 | else |
| 149 | 149 | $getVariables[$name]=$value; |
| 150 | 150 | } |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | */ |
| 72 | 72 | public function createNewHtmlWriter($type, $writer) |
| 73 | 73 | { |
| 74 | - return $this->_response->createNewHtmlWriter($type,$writer); |
|
| 74 | + return $this->_response->createNewHtmlWriter($type, $writer); |
|
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
@@ -59,17 +59,17 @@ discard block |
||
| 59 | 59 | /** |
| 60 | 60 | * const string base api provider class which every API must extend |
| 61 | 61 | */ |
| 62 | - const BASE_API_PROVIDER = 'TRpcApiProvider'; |
|
| 62 | + const BASE_API_PROVIDER='TRpcApiProvider'; |
|
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * const string base RPC server implementation |
| 66 | 66 | */ |
| 67 | - const BASE_RPC_SERVER = 'TRpcServer'; |
|
| 67 | + const BASE_RPC_SERVER='TRpcServer'; |
|
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * @var array containing mimetype to protocol handler mappings |
| 71 | 71 | */ |
| 72 | - protected $protocolHandlers = array( |
|
| 72 | + protected $protocolHandlers=array( |
|
| 73 | 73 | 'application/json' => 'TJsonRpcProtocol', |
| 74 | 74 | 'text/xml' => 'TXmlRpcProtocol' |
| 75 | 75 | ); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | /** |
| 78 | 78 | * @var array containing API provider and their configured properties |
| 79 | 79 | */ |
| 80 | - protected $apiProviders = array(); |
|
| 80 | + protected $apiProviders=array(); |
|
| 81 | 81 | |
| 82 | 82 | // methods |
| 83 | 83 | |
@@ -88,27 +88,27 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function createApiProvider(TRpcProtocol $protocolHandler, $providerId) |
| 90 | 90 | { |
| 91 | - $_properties = $this->apiProviders[$providerId]; |
|
| 91 | + $_properties=$this->apiProviders[$providerId]; |
|
| 92 | 92 | |
| 93 | - if(($_providerClass = $_properties->remove('class')) === null) |
|
| 93 | + if(($_providerClass=$_properties->remove('class'))===null) |
|
| 94 | 94 | throw new TConfigurationException('rpcservice_apiprovider_required'); |
| 95 | 95 | |
| 96 | 96 | Prado::using($_providerClass); |
| 97 | 97 | |
| 98 | - $_providerClassName = ($_pos = strrpos($_providerClass, '.')) !== false ? substr($_providerClass, $_pos + 1) : $_providerClass; |
|
| 98 | + $_providerClassName=($_pos=strrpos($_providerClass, '.'))!==false ? substr($_providerClass, $_pos + 1) : $_providerClass; |
|
| 99 | 99 | if(!is_subclass_of($_providerClassName, self::BASE_API_PROVIDER)) |
| 100 | 100 | throw new TConfigurationException('rpcservice_apiprovider_invalid'); |
| 101 | 101 | |
| 102 | - if(($_rpcServerClass = $_properties->remove('server')) === null) |
|
| 103 | - $_rpcServerClass = self::BASE_RPC_SERVER; |
|
| 102 | + if(($_rpcServerClass=$_properties->remove('server'))===null) |
|
| 103 | + $_rpcServerClass=self::BASE_RPC_SERVER; |
|
| 104 | 104 | |
| 105 | 105 | Prado::using($_rpcServerClass); |
| 106 | 106 | |
| 107 | - $_rpcServerClassName = ($_pos = strrpos($_rpcServerClass, '.')) !== false ? substr($_rpcServerClass, $_pos + 1) : $_rpcServerClass; |
|
| 107 | + $_rpcServerClassName=($_pos=strrpos($_rpcServerClass, '.'))!==false ? substr($_rpcServerClass, $_pos + 1) : $_rpcServerClass; |
|
| 108 | 108 | if($_rpcServerClassName!==self::BASE_RPC_SERVER && !is_subclass_of($_rpcServerClassName, self::BASE_RPC_SERVER)) |
| 109 | 109 | throw new TConfigurationException('rpcservice_rpcserver_invalid'); |
| 110 | 110 | |
| 111 | - $_apiProvider = new $_providerClassName(new $_rpcServerClassName($protocolHandler)); |
|
| 111 | + $_apiProvider=new $_providerClassName(new $_rpcServerClassName($protocolHandler)); |
|
| 112 | 112 | $_apiProvider->setId($providerId); |
| 113 | 113 | |
| 114 | 114 | foreach($_properties as $_key => $_value) |
@@ -134,15 +134,15 @@ discard block |
||
| 134 | 134 | { |
| 135 | 135 | foreach($xml->getElementsByTagName('rpcapi') as $_apiProviderXml) |
| 136 | 136 | { |
| 137 | - $_properties = $_apiProviderXml->getAttributes(); |
|
| 137 | + $_properties=$_apiProviderXml->getAttributes(); |
|
| 138 | 138 | |
| 139 | - if(($_id = $_properties->remove('id')) === null || $_id == "") |
|
| 139 | + if(($_id=$_properties->remove('id'))===null || $_id=="") |
|
| 140 | 140 | throw new TConfigurationException('rpcservice_apiproviderid_required'); |
| 141 | 141 | |
| 142 | 142 | if(isset($this->apiProviders[$_id])) |
| 143 | 143 | throw new TConfigurationException('rpcservice_apiproviderid_duplicated'); |
| 144 | 144 | |
| 145 | - $this->apiProviders[$_id] = $_properties; |
|
| 145 | + $this->apiProviders[$_id]=$_properties; |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
@@ -151,26 +151,26 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | public function run() |
| 153 | 153 | { |
| 154 | - $_request = $this->getRequest(); |
|
| 154 | + $_request=$this->getRequest(); |
|
| 155 | 155 | |
| 156 | - if(($_providerId = $_request->getServiceParameter()) == "") |
|
| 156 | + if(($_providerId=$_request->getServiceParameter())=="") |
|
| 157 | 157 | throw new THttpException(400, 'RPC API-Provider id required'); |
| 158 | 158 | |
| 159 | - if(($_method = $_request->getRequestType()) != 'POST') |
|
| 159 | + if(($_method=$_request->getRequestType())!='POST') |
|
| 160 | 160 | throw new THttpException(405, 'Invalid request method "'.$_method.'"!'); // TODO Exception muss "Allow POST" Header setzen |
| 161 | 161 | |
| 162 | - if(($_mimeType = $_request->getContentType()) === null) |
|
| 162 | + if(($_mimeType=$_request->getContentType())===null) |
|
| 163 | 163 | throw new THttpException(406, 'Content-Type is missing!'); // TODO Exception muss gültige Content-Type werte zurück geben |
| 164 | 164 | |
| 165 | 165 | if(!in_array($_mimeType, array_keys($this->protocolHandlers))) |
| 166 | 166 | throw new THttpException(406, 'Unsupported Content-Type!'); // TODO see previous |
| 167 | 167 | |
| 168 | - $_protocolHandlerClass = $this->protocolHandlers[$_mimeType]; |
|
| 169 | - $_protocolHandler = new $_protocolHandlerClass; |
|
| 168 | + $_protocolHandlerClass=$this->protocolHandlers[$_mimeType]; |
|
| 169 | + $_protocolHandler=new $_protocolHandlerClass; |
|
| 170 | 170 | |
| 171 | - if(($_result = $this->createApiProvider($_protocolHandler, $_providerId)->processRequest()) !== null) |
|
| 171 | + if(($_result=$this->createApiProvider($_protocolHandler, $_providerId)->processRequest())!==null) |
|
| 172 | 172 | { |
| 173 | - $_response = $this->getResponse(); |
|
| 173 | + $_response=$this->getResponse(); |
|
| 174 | 174 | $_protocolHandler->createResponseHeaders($_response); |
| 175 | 175 | $_response->write($_result); |
| 176 | 176 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function __construct(TRpcProtocol $protocolHandler) |
| 208 | 208 | { |
| 209 | - $this->handler = $protocolHandler; |
|
| 209 | + $this->handler=$protocolHandler; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | */ |
| 259 | 259 | class TRpcException extends TException |
| 260 | 260 | { |
| 261 | - public function __construct($message, $errorCode = -1) |
|
| 261 | + public function __construct($message, $errorCode=-1) |
|
| 262 | 262 | { |
| 263 | 263 | $this->setErrorCode($errorCode); |
| 264 | 264 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | */ |
| 319 | 319 | public function __construct(TRpcServer $rpcServer) |
| 320 | 320 | { |
| 321 | - $this->rpcServer = $rpcServer; |
|
| 321 | + $this->rpcServer=$rpcServer; |
|
| 322 | 322 | |
| 323 | 323 | foreach($this->registerMethods() as $_methodName => $_methodDetails) |
| 324 | 324 | $this->rpcServer->addRpcMethod($_methodName, $_methodDetails); |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | /** |
| 360 | 360 | * @var array containing the mapping from RPC method names to the actual handlers |
| 361 | 361 | */ |
| 362 | - protected $rpcMethods = array(); |
|
| 362 | + protected $rpcMethods=array(); |
|
| 363 | 363 | |
| 364 | 364 | // abstracts |
| 365 | 365 | |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | */ |
| 408 | 408 | public function addMethod($methodName, $handlerDetails) |
| 409 | 409 | { |
| 410 | - $this->rpcMethods[$methodName] = $handlerDetails; |
|
| 410 | + $this->rpcMethods[$methodName]=$handlerDetails; |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | /** |
@@ -421,11 +421,11 @@ discard block |
||
| 421 | 421 | if(!isset($this->rpcMethods[$methodName])) |
| 422 | 422 | throw new TRpcException('Method "'.$methodName.'" not found'); |
| 423 | 423 | |
| 424 | - if($parameters === null) |
|
| 425 | - $parameters = array(); |
|
| 424 | + if($parameters===null) |
|
| 425 | + $parameters=array(); |
|
| 426 | 426 | |
| 427 | 427 | if(!is_array($parameters)) |
| 428 | - $parameters = array($parameters); |
|
| 428 | + $parameters=array($parameters); |
|
| 429 | 429 | return call_user_func_array($this->rpcMethods[$methodName]['method'], $parameters); |
| 430 | 430 | } |
| 431 | 431 | } |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | { |
| 458 | 458 | try |
| 459 | 459 | { |
| 460 | - $_request = $this->decode($requestPayload); |
|
| 460 | + $_request=$this->decode($requestPayload); |
|
| 461 | 461 | |
| 462 | 462 | if(isset($_request['jsonrpc'])) |
| 463 | 463 | { |
@@ -473,15 +473,15 @@ discard block |
||
| 473 | 473 | throw new TRpcException('Missing request method', '-32600'); |
| 474 | 474 | |
| 475 | 475 | if(!isset($_request['params'])) |
| 476 | - $parameters = array(); |
|
| 476 | + $parameters=array(); |
|
| 477 | 477 | else |
| 478 | - $parameters = $_request['params']; |
|
| 478 | + $parameters=$_request['params']; |
|
| 479 | 479 | |
| 480 | 480 | if(!is_array($parameters)) |
| 481 | - $parameters = array($parameters); |
|
| 481 | + $parameters=array($parameters); |
|
| 482 | 482 | |
| 483 | 483 | // a request without an id is a notification that doesn't need a response |
| 484 | - if($this->_id !== null) |
|
| 484 | + if($this->_id!==null) |
|
| 485 | 485 | { |
| 486 | 486 | if($this->_specificationVersion==2.0) |
| 487 | 487 | { |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | */ |
| 561 | 561 | public function decode($data) |
| 562 | 562 | { |
| 563 | - $s = json_decode($data, true); |
|
| 563 | + $s=json_decode($data, true); |
|
| 564 | 564 | self::checkJsonError(); |
| 565 | 565 | return $s; |
| 566 | 566 | } |
@@ -572,15 +572,15 @@ discard block |
||
| 572 | 572 | */ |
| 573 | 573 | public function encode($data) |
| 574 | 574 | { |
| 575 | - $s = json_encode($data); |
|
| 575 | + $s=json_encode($data); |
|
| 576 | 576 | self::checkJsonError(); |
| 577 | 577 | return $s; |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | private static function checkJsonError() |
| 581 | 581 | { |
| 582 | - $errnum = json_last_error(); |
|
| 583 | - if($errnum != JSON_ERROR_NONE) |
|
| 582 | + $errnum=json_last_error(); |
|
| 583 | + if($errnum!=JSON_ERROR_NONE) |
|
| 584 | 584 | throw new Exception("JSON error: $msg", $err); |
| 585 | 585 | } |
| 586 | 586 | |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | */ |
| 626 | 626 | public function __construct() |
| 627 | 627 | { |
| 628 | - $this->_xmlrpcServer = xmlrpc_server_create(); |
|
| 628 | + $this->_xmlrpcServer=xmlrpc_server_create(); |
|
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | /** |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | if(is_array($config)) |
| 78 | 78 | { |
| 79 | 79 | foreach($config['json'] as $id => $json) |
| 80 | - $this->_services[$id] = $json; |
|
| 80 | + $this->_services[$id]=$json; |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | else |
@@ -109,14 +109,14 @@ discard block |
||
| 109 | 109 | $service=Prado::createComponent($serviceConfig['class']); |
| 110 | 110 | if($service instanceof TJsonResponse) |
| 111 | 111 | { |
| 112 | - $properties = isset($serviceConfig['properties'])?$serviceConfig['properties']:array(); |
|
| 113 | - $this->createJsonResponse($service,$properties,$serviceConfig); |
|
| 112 | + $properties=isset($serviceConfig['properties']) ? $serviceConfig['properties'] : array(); |
|
| 113 | + $this->createJsonResponse($service, $properties, $serviceConfig); |
|
| 114 | 114 | } |
| 115 | 115 | else |
| 116 | - throw new TConfigurationException('jsonservice_response_type_invalid',$id); |
|
| 116 | + throw new TConfigurationException('jsonservice_response_type_invalid', $id); |
|
| 117 | 117 | } |
| 118 | 118 | else |
| 119 | - throw new TConfigurationException('jsonservice_class_required',$id); |
|
| 119 | + throw new TConfigurationException('jsonservice_class_required', $id); |
|
| 120 | 120 | } |
| 121 | 121 | else |
| 122 | 122 | { |
@@ -125,33 +125,33 @@ discard block |
||
| 125 | 125 | { |
| 126 | 126 | $service=Prado::createComponent($class); |
| 127 | 127 | if($service instanceof TJsonResponse) |
| 128 | - $this->createJsonResponse($service,$properties,$serviceConfig); |
|
| 128 | + $this->createJsonResponse($service, $properties, $serviceConfig); |
|
| 129 | 129 | else |
| 130 | - throw new TConfigurationException('jsonservice_response_type_invalid',$id); |
|
| 130 | + throw new TConfigurationException('jsonservice_response_type_invalid', $id); |
|
| 131 | 131 | } |
| 132 | 132 | else |
| 133 | - throw new TConfigurationException('jsonservice_class_required',$id); |
|
| 133 | + throw new TConfigurationException('jsonservice_class_required', $id); |
|
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | else |
| 137 | - throw new THttpException(404,'jsonservice_provider_unknown',$id); |
|
| 137 | + throw new THttpException(404, 'jsonservice_provider_unknown', $id); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
| 141 | 141 | * Renders content provided by TJsonResponse::getJsonContent() as |
| 142 | 142 | * javascript in JSON format. |
| 143 | 143 | */ |
| 144 | - protected function createJsonResponse($service,$properties,$config) |
|
| 144 | + protected function createJsonResponse($service, $properties, $config) |
|
| 145 | 145 | { |
| 146 | 146 | // init service properties |
| 147 | 147 | foreach($properties as $name=>$value) |
| 148 | - $service->setSubproperty($name,$value); |
|
| 148 | + $service->setSubproperty($name, $value); |
|
| 149 | 149 | $service->init($config); |
| 150 | 150 | |
| 151 | 151 | //send content if not null |
| 152 | 152 | if(($content=$service->getJsonContent())!==null) |
| 153 | 153 | { |
| 154 | - $response = $this->getResponse(); |
|
| 154 | + $response=$this->getResponse(); |
|
| 155 | 155 | $response->setContentType('application/json'); |
| 156 | 156 | $response->setCharset('UTF-8'); |
| 157 | 157 | //send content |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | if(is_array($config)) |
| 73 | 73 | { |
| 74 | 74 | foreach($config as $id => $feed) |
| 75 | - $this->_feeds[$id] = $feed; |
|
| 75 | + $this->_feeds[$id]=$feed; |
|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | else |
@@ -105,20 +105,20 @@ discard block |
||
| 105 | 105 | if(isset($this->_feeds[$id])) |
| 106 | 106 | { |
| 107 | 107 | $feedConfig=$this->_feeds[$id]; |
| 108 | - $properties = array(); |
|
| 109 | - $feed = null; |
|
| 108 | + $properties=array(); |
|
| 109 | + $feed=null; |
|
| 110 | 110 | if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP) |
| 111 | 111 | { |
| 112 | 112 | if(isset($feedConfig['class'])) |
| 113 | 113 | { |
| 114 | 114 | $feed=Prado::createComponent($feedConfig['class']); |
| 115 | 115 | if($service instanceof IFeedContentProvider) |
| 116 | - $properties=isset($feedConfig['properties'])?$feedConfig['properties']:array(); |
|
| 116 | + $properties=isset($feedConfig['properties']) ? $feedConfig['properties'] : array(); |
|
| 117 | 117 | else |
| 118 | - throw new TConfigurationException('jsonservice_response_type_invalid',$id); |
|
| 118 | + throw new TConfigurationException('jsonservice_response_type_invalid', $id); |
|
| 119 | 119 | } |
| 120 | 120 | else |
| 121 | - throw new TConfigurationException('jsonservice_class_required',$id); |
|
| 121 | + throw new TConfigurationException('jsonservice_class_required', $id); |
|
| 122 | 122 | } |
| 123 | 123 | else |
| 124 | 124 | { |
@@ -127,15 +127,15 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | $feed=Prado::createComponent($class); |
| 129 | 129 | if(!($feed instanceof IFeedContentProvider)) |
| 130 | - throw new TConfigurationException('feedservice_feedtype_invalid',$id); |
|
| 130 | + throw new TConfigurationException('feedservice_feedtype_invalid', $id); |
|
| 131 | 131 | } |
| 132 | 132 | else |
| 133 | - throw new TConfigurationException('feedservice_class_required',$id); |
|
| 133 | + throw new TConfigurationException('feedservice_class_required', $id); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | // init feed properties |
| 137 | 137 | foreach($properties as $name=>$value) |
| 138 | - $feed->setSubproperty($name,$value); |
|
| 138 | + $feed->setSubproperty($name, $value); |
|
| 139 | 139 | $feed->init($feedConfig); |
| 140 | 140 | |
| 141 | 141 | $content=$feed->getFeedContent(); |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | $this->getResponse()->write($content); |
| 145 | 145 | } |
| 146 | 146 | else |
| 147 | - throw new THttpException(404,'feedservice_feed_unknown',$id); |
|
| 147 | + throw new THttpException(404, 'feedservice_feed_unknown', $id); |
|
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | if($cache===null || !($cache instanceof ICache)) |
| 111 | 111 | { |
| 112 | 112 | if($this->_cacheModuleID!=='') |
| 113 | - throw new TConfigurationException('cachepagestatepersister_cachemoduleid_invalid',$this->_cacheModuleID); |
|
| 113 | + throw new TConfigurationException('cachepagestatepersister_cachemoduleid_invalid', $this->_cacheModuleID); |
|
| 114 | 114 | else |
| 115 | 115 | throw new TConfigurationException('cachepagestatepersister_cache_required'); |
| 116 | 116 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | public function setCacheTimeout($value) |
| 135 | 135 | { |
| 136 | - if(($value=TPropertyValue::ensureInteger($value))>=0) |
|
| 136 | + if(($value=TPropertyValue::ensureInteger($value)) >= 0) |
|
| 137 | 137 | $this->_timeout=$value; |
| 138 | 138 | else |
| 139 | 139 | throw new TInvalidDataValueException('cachepagestatepersister_timeout_invalid'); |
@@ -173,10 +173,10 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | public function save($data) |
| 175 | 175 | { |
| 176 | - $timestamp=(string)microtime(true); |
|
| 176 | + $timestamp=(string) microtime(true); |
|
| 177 | 177 | $key=$this->calculateKey($timestamp); |
| 178 | - $this->getCache()->add($key,$data,$this->_timeout); |
|
| 179 | - $this->_page->setClientState(TPageStateFormatter::serialize($this->_page,$timestamp)); |
|
| 178 | + $this->getCache()->add($key, $data, $this->_timeout); |
|
| 179 | + $this->_page->setClientState(TPageStateFormatter::serialize($this->_page, $timestamp)); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | /** |
@@ -186,13 +186,13 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | public function load() |
| 188 | 188 | { |
| 189 | - if(($timestamp=TPageStateFormatter::unserialize($this->_page,$this->_page->getRequestClientState()))!==null) |
|
| 189 | + if(($timestamp=TPageStateFormatter::unserialize($this->_page, $this->_page->getRequestClientState()))!==null) |
|
| 190 | 190 | { |
| 191 | 191 | $key=$this->calculateKey($timestamp); |
| 192 | 192 | if(($data=$this->getCache()->get($key))!==false) |
| 193 | 193 | return $data; |
| 194 | 194 | } |
| 195 | - throw new THttpException(400,'cachepagestatepersister_pagestate_corrupted'); |
|
| 195 | + throw new THttpException(400, 'cachepagestatepersister_pagestate_corrupted'); |
|
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |