@@ -49,6 +49,7 @@ |
||
49 | 49 | |
50 | 50 | /** |
51 | 51 | * @param string id of this service |
52 | + * @param string $value |
|
52 | 53 | */ |
53 | 54 | public function setID($value) |
54 | 55 | { |
@@ -98,6 +98,7 @@ |
||
98 | 98 | * @param integer level filter |
99 | 99 | * @param array category filter |
100 | 100 | * @param array control filter |
101 | + * @param integer $levels |
|
101 | 102 | * @return array list of messages. Each array elements represents one message |
102 | 103 | * with the following structure: |
103 | 104 | * array( |
@@ -63,16 +63,16 @@ discard block |
||
63 | 63 | * @param string category of the message |
64 | 64 | * @param string|TControl control of the message |
65 | 65 | */ |
66 | - public function log($message,$level,$category='Uncategorized', $ctl=null) |
|
66 | + public function log($message, $level, $category='Uncategorized', $ctl=null) |
|
67 | 67 | { |
68 | 68 | if($ctl) { |
69 | 69 | if($ctl instanceof TControl) |
70 | - $ctl = $ctl->ClientId; |
|
70 | + $ctl=$ctl->ClientId; |
|
71 | 71 | else if(!is_string($ctl)) |
72 | - $ctl = null; |
|
72 | + $ctl=null; |
|
73 | 73 | } else |
74 | - $ctl = null; |
|
75 | - $this->_logs[]=array($message,$level,$category,microtime(true),memory_get_usage(),$ctl); |
|
74 | + $ctl=null; |
|
75 | + $this->_logs[]=array($message, $level, $category, microtime(true), memory_get_usage(), $ctl); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * [4] => memory in bytes |
109 | 109 | * [5] => control client id |
110 | 110 | */ |
111 | - public function getLogs($levels=null,$categories=null,$controls=null,$timestamp=null) |
|
111 | + public function getLogs($levels=null, $categories=null, $controls=null, $timestamp=null) |
|
112 | 112 | { |
113 | 113 | $this->_levels=$levels; |
114 | 114 | $this->_categories=$categories; |
@@ -116,15 +116,15 @@ discard block |
||
116 | 116 | $this->_timestamp=$timestamp; |
117 | 117 | if(empty($levels) && empty($categories) && empty($controls) && is_null($timestamp)) |
118 | 118 | return $this->_logs; |
119 | - $logs = $this->_logs; |
|
119 | + $logs=$this->_logs; |
|
120 | 120 | if(!empty($levels)) |
121 | - $logs = array_values(array_filter( array_filter($logs,array($this,'filterByLevels')) )); |
|
121 | + $logs=array_values(array_filter(array_filter($logs, array($this, 'filterByLevels')))); |
|
122 | 122 | if(!empty($categories)) |
123 | - $logs = array_values(array_filter( array_filter($logs,array($this,'filterByCategories')) )); |
|
123 | + $logs=array_values(array_filter(array_filter($logs, array($this, 'filterByCategories')))); |
|
124 | 124 | if(!empty($controls)) |
125 | - $logs = array_values(array_filter( array_filter($logs,array($this,'filterByControl')) )); |
|
125 | + $logs=array_values(array_filter(array_filter($logs, array($this, 'filterByControl')))); |
|
126 | 126 | if(!is_null($timestamp)) |
127 | - $logs = array_values(array_filter( array_filter($logs,array($this,'filterByTimeStamp')) )); |
|
127 | + $logs=array_values(array_filter(array_filter($logs, array($this, 'filterByTimeStamp')))); |
|
128 | 128 | return $logs; |
129 | 129 | } |
130 | 130 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * @param array category filter |
153 | 153 | * @param array control filter |
154 | 154 | */ |
155 | - public function deleteLogs($levels=null,$categories=null,$controls=null,$timestamp=null) |
|
155 | + public function deleteLogs($levels=null, $categories=null, $controls=null, $timestamp=null) |
|
156 | 156 | { |
157 | 157 | $this->_levels=$levels; |
158 | 158 | $this->_categories=$categories; |
@@ -163,16 +163,16 @@ discard block |
||
163 | 163 | $this->_logs=array(); |
164 | 164 | return; |
165 | 165 | } |
166 | - $logs = $this->_logs; |
|
166 | + $logs=$this->_logs; |
|
167 | 167 | if(!empty($levels)) |
168 | - $logs = array_filter( array_filter($logs,array($this,'filterByLevels')) ); |
|
168 | + $logs=array_filter(array_filter($logs, array($this, 'filterByLevels'))); |
|
169 | 169 | if(!empty($categories)) |
170 | - $logs = array_filter( array_filter($logs,array($this,'filterByCategories')) ); |
|
170 | + $logs=array_filter(array_filter($logs, array($this, 'filterByCategories'))); |
|
171 | 171 | if(!empty($controls)) |
172 | - $logs = array_filter( array_filter($logs,array($this,'filterByControl')) ); |
|
172 | + $logs=array_filter(array_filter($logs, array($this, 'filterByControl'))); |
|
173 | 173 | if(!is_null($timestamp)) |
174 | - $logs = array_filter( array_filter($logs,array($this,'filterByTimeStamp')) ); |
|
175 | - $this->_logs = array_values( array_diff_key($this->_logs, $logs) ); |
|
174 | + $logs=array_filter(array_filter($logs, array($this, 'filterByTimeStamp'))); |
|
175 | + $this->_logs=array_values(array_diff_key($this->_logs, $logs)); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | foreach($this->_categories as $category) |
185 | 185 | { |
186 | 186 | // element 2 is the category |
187 | - if($value[2]===$category || strpos($value[2],$category.'.')===0) |
|
187 | + if($value[2]===$category || strpos($value[2], $category.'.')===0) |
|
188 | 188 | return $value; |
189 | 189 | } |
190 | 190 | return false; |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | // element 5 are the control client ids |
213 | 213 | foreach($this->_controls as $control) |
214 | 214 | { |
215 | - if($value[5]===$control || strpos($value[5],$control)===0) |
|
215 | + if($value[5]===$control || strpos($value[5], $control)===0) |
|
216 | 216 | return $value; |
217 | 217 | } |
218 | 218 | return false; |
@@ -105,6 +105,9 @@ |
||
105 | 105 | * @param string RPC server URL |
106 | 106 | * @param array payload data |
107 | 107 | * @param string request mime type |
108 | + * @param string $serverUrl |
|
109 | + * @param string $mimeType |
|
110 | + * @return string |
|
108 | 111 | */ |
109 | 112 | protected function performRequest($serverUrl, $payload, $mimeType) |
110 | 113 | { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | /** |
58 | 58 | * @var boolean whether the request is a notification and therefore should not care about the result (default: false) |
59 | 59 | */ |
60 | - private $_isNotification = false; |
|
60 | + private $_isNotification=false; |
|
61 | 61 | |
62 | 62 | // magics |
63 | 63 | |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | * @param string url to RPC server |
66 | 66 | * @param boolean whether requests are considered to be notifications (completely ignoring the response) (default: false) |
67 | 67 | */ |
68 | - public function __construct($serverUrl, $isNotification = false) |
|
68 | + public function __construct($serverUrl, $isNotification=false) |
|
69 | 69 | { |
70 | - $this->_serverUrl = $serverUrl; |
|
71 | - $this->_isNotification = TPropertyValue::ensureBoolean($isNotification); |
|
70 | + $this->_serverUrl=$serverUrl; |
|
71 | + $this->_isNotification=TPropertyValue::ensureBoolean($isNotification); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | // methods |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | * @return TRpcClient instance |
79 | 79 | * @throws TApplicationException if an unsupported RPC client type was specified |
80 | 80 | */ |
81 | - public static function create($type, $serverUrl, $isNotification = false) |
|
81 | + public static function create($type, $serverUrl, $isNotification=false) |
|
82 | 82 | { |
83 | - if(($_handler = constant('TRpcClientTypesEnumerable::'.strtoupper($type))) === null) |
|
83 | + if(($_handler=constant('TRpcClientTypesEnumerable::'.strtoupper($type)))===null) |
|
84 | 84 | throw new TApplicationException('rpcclient_unsupported_handler'); |
85 | 85 | |
86 | 86 | return new $_handler($serverUrl, $isNotification); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | protected function performRequest($serverUrl, $payload, $mimeType) |
112 | 112 | { |
113 | - if(($_response = @file_get_contents($serverUrl, false, $this->createStreamContext($payload, $mimeType))) === false) |
|
113 | + if(($_response=@file_get_contents($serverUrl, false, $this->createStreamContext($payload, $mimeType)))===false) |
|
114 | 114 | throw new TRpcClientRequestException('Request failed ("'.$http_response_header[0].'")'); |
115 | 115 | |
116 | 116 | return $_response; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function setIsNotification($bool) |
133 | 133 | { |
134 | - $this->_isNotification = TPropertyValue::ensureBoolean($bool); |
|
134 | + $this->_isNotification=TPropertyValue::ensureBoolean($bool); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -147,6 +147,6 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function setServerUrl($value) |
149 | 149 | { |
150 | - $this->_serverUrl = $value; |
|
150 | + $this->_serverUrl=$value; |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | \ No newline at end of file |
@@ -55,6 +55,9 @@ |
||
55 | 55 | return self::$_output; |
56 | 56 | } |
57 | 57 | |
58 | + /** |
|
59 | + * @param integer $level |
|
60 | + */ |
|
58 | 61 | private static function dumpInternal($var,$level) |
59 | 62 | { |
60 | 63 | switch(gettype($var)) |
@@ -40,27 +40,27 @@ discard block |
||
40 | 40 | * @param integer maximum depth that the dumper should go into the variable. Defaults to 10. |
41 | 41 | * @return string the string representation of the variable |
42 | 42 | */ |
43 | - public static function dump($var,$depth=10,$highlight=false) |
|
43 | + public static function dump($var, $depth=10, $highlight=false) |
|
44 | 44 | { |
45 | 45 | self::$_output=''; |
46 | 46 | self::$_objects=array(); |
47 | 47 | self::$_depth=$depth; |
48 | - self::dumpInternal($var,0); |
|
48 | + self::dumpInternal($var, 0); |
|
49 | 49 | if($highlight) |
50 | 50 | { |
51 | - $result=highlight_string("<?php\n".self::$_output,true); |
|
52 | - return preg_replace('/<\\?php<br \\/>/','',$result,1); |
|
51 | + $result=highlight_string("<?php\n".self::$_output, true); |
|
52 | + return preg_replace('/<\\?php<br \\/>/', '', $result, 1); |
|
53 | 53 | } |
54 | 54 | else |
55 | 55 | return self::$_output; |
56 | 56 | } |
57 | 57 | |
58 | - private static function dumpInternal($var,$level) |
|
58 | + private static function dumpInternal($var, $level) |
|
59 | 59 | { |
60 | 60 | switch(gettype($var)) |
61 | 61 | { |
62 | 62 | case 'boolean': |
63 | - self::$_output.=$var?'true':'false'; |
|
63 | + self::$_output.=$var ? 'true' : 'false'; |
|
64 | 64 | break; |
65 | 65 | case 'integer': |
66 | 66 | self::$_output.="$var"; |
@@ -81,41 +81,41 @@ discard block |
||
81 | 81 | self::$_output.='{unknown}'; |
82 | 82 | break; |
83 | 83 | case 'array': |
84 | - if(self::$_depth<=$level) |
|
84 | + if(self::$_depth <= $level) |
|
85 | 85 | self::$_output.='array(...)'; |
86 | 86 | else if(empty($var)) |
87 | 87 | self::$_output.='array()'; |
88 | 88 | else |
89 | 89 | { |
90 | 90 | $keys=array_keys($var); |
91 | - $spaces=str_repeat(' ',$level*4); |
|
91 | + $spaces=str_repeat(' ', $level * 4); |
|
92 | 92 | self::$_output.="array\n".$spaces.'('; |
93 | 93 | foreach($keys as $key) |
94 | 94 | { |
95 | 95 | self::$_output.="\n".$spaces." [$key] => "; |
96 | - self::$_output.=self::dumpInternal($var[$key],$level+1); |
|
96 | + self::$_output.=self::dumpInternal($var[$key], $level + 1); |
|
97 | 97 | } |
98 | 98 | self::$_output.="\n".$spaces.')'; |
99 | 99 | } |
100 | 100 | break; |
101 | 101 | case 'object': |
102 | - if(($id=array_search($var,self::$_objects,true))!==false) |
|
103 | - self::$_output.=get_class($var).'#'.($id+1).'(...)'; |
|
104 | - else if(self::$_depth<=$level) |
|
102 | + if(($id=array_search($var, self::$_objects, true))!==false) |
|
103 | + self::$_output.=get_class($var).'#'.($id + 1).'(...)'; |
|
104 | + else if(self::$_depth <= $level) |
|
105 | 105 | self::$_output.=get_class($var).'(...)'; |
106 | 106 | else |
107 | 107 | { |
108 | - $id=array_push(self::$_objects,$var); |
|
108 | + $id=array_push(self::$_objects, $var); |
|
109 | 109 | $className=get_class($var); |
110 | - $members=(array)$var; |
|
110 | + $members=(array) $var; |
|
111 | 111 | $keys=array_keys($members); |
112 | - $spaces=str_repeat(' ',$level*4); |
|
112 | + $spaces=str_repeat(' ', $level * 4); |
|
113 | 113 | self::$_output.="$className#$id\n".$spaces.'('; |
114 | 114 | foreach($keys as $key) |
115 | 115 | { |
116 | - $keyDisplay=strtr(trim($key),array("\0"=>':')); |
|
116 | + $keyDisplay=strtr(trim($key), array("\0"=>':')); |
|
117 | 117 | self::$_output.="\n".$spaces." [$keyDisplay] => "; |
118 | - self::$_output.=self::dumpInternal($members[$key],$level+1); |
|
118 | + self::$_output.=self::dumpInternal($members[$key], $level + 1); |
|
119 | 119 | } |
120 | 120 | self::$_output.="\n".$spaces.')'; |
121 | 121 | } |
@@ -52,8 +52,7 @@ |
||
52 | 52 | { |
53 | 53 | $result=highlight_string("<?php\n".self::$_output,true); |
54 | 54 | return preg_replace('/<\\?php<br \\/>/','',$result,1); |
55 | - } |
|
56 | - else |
|
55 | + } else |
|
57 | 56 | return self::$_output; |
58 | 57 | } |
59 | 58 |
@@ -140,6 +140,7 @@ |
||
140 | 140 | /** |
141 | 141 | * Renders content provided by TJsonResponse::getJsonContent() as |
142 | 142 | * javascript in JSON format. |
143 | + * @param TJsonResponse $service |
|
143 | 144 | */ |
144 | 145 | protected function createJsonResponse($service,$properties,$config) |
145 | 146 | { |
@@ -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 |
@@ -79,8 +79,7 @@ discard block |
||
79 | 79 | foreach($config['json'] as $id => $json) |
80 | 80 | $this->_services[$id] = $json; |
81 | 81 | } |
82 | - } |
|
83 | - else |
|
82 | + } else |
|
84 | 83 | { |
85 | 84 | foreach($config->getElementsByTagName('json') as $json) |
86 | 85 | { |
@@ -111,14 +110,11 @@ discard block |
||
111 | 110 | { |
112 | 111 | $properties = isset($serviceConfig['properties'])?$serviceConfig['properties']:array(); |
113 | 112 | $this->createJsonResponse($service,$properties,$serviceConfig); |
114 | - } |
|
115 | - else |
|
113 | + } else |
|
116 | 114 | throw new TConfigurationException('jsonservice_response_type_invalid',$id); |
117 | - } |
|
118 | - else |
|
115 | + } else |
|
119 | 116 | throw new TConfigurationException('jsonservice_class_required',$id); |
120 | - } |
|
121 | - else |
|
117 | + } else |
|
122 | 118 | { |
123 | 119 | $properties=$serviceConfig->getAttributes(); |
124 | 120 | if(($class=$properties->remove('class'))!==null) |
@@ -128,12 +124,10 @@ discard block |
||
128 | 124 | $this->createJsonResponse($service,$properties,$serviceConfig); |
129 | 125 | else |
130 | 126 | throw new TConfigurationException('jsonservice_response_type_invalid',$id); |
131 | - } |
|
132 | - else |
|
127 | + } else |
|
133 | 128 | throw new TConfigurationException('jsonservice_class_required',$id); |
134 | 129 | } |
135 | - } |
|
136 | - else |
|
130 | + } else |
|
137 | 131 | throw new THttpException(404,'jsonservice_provider_unknown',$id); |
138 | 132 | } |
139 | 133 |
@@ -31,6 +31,7 @@ |
||
31 | 31 | /** |
32 | 32 | * Constructor. Attach a response to be adapted. |
33 | 33 | * @param THttpResponse the response object the adapter is to attach to. |
34 | + * @param THttpResponse $response |
|
34 | 35 | */ |
35 | 36 | public function __construct($response) |
36 | 37 | { |
@@ -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 |
@@ -265,6 +265,7 @@ discard block |
||
265 | 265 | * If true, make sure the methods {@link _open}, {@link _close}, {@link _read}, |
266 | 266 | * {@link _write}, {@link _destroy}, and {@link _gc} are overridden in child |
267 | 267 | * class, because they will be used as the callback handlers. |
268 | + * @param boolean $value |
|
268 | 269 | */ |
269 | 270 | public function setUseCustomStorage($value) |
270 | 271 | { |
@@ -527,6 +528,7 @@ discard block |
||
527 | 528 | * Returns the session variable value with the session variable name. |
528 | 529 | * This method is exactly the same as {@link offsetGet}. |
529 | 530 | * @param mixed the session variable name |
531 | + * @param string $key |
|
530 | 532 | * @return mixed the session variable value, null if no such variable exists |
531 | 533 | */ |
532 | 534 | public function itemAt($key) |
@@ -539,6 +541,7 @@ discard block |
||
539 | 541 | * Note, if the specified name already exists, the old value will be removed first. |
540 | 542 | * @param mixed session variable name |
541 | 543 | * @param mixed session variable value |
544 | + * @param string $key |
|
542 | 545 | */ |
543 | 546 | public function add($key,$value) |
544 | 547 | { |
@@ -309,13 +309,11 @@ discard block |
||
309 | 309 | { |
310 | 310 | ini_set('session.use_cookies','0'); |
311 | 311 | ini_set('session.use_only_cookies','0'); |
312 | - } |
|
313 | - else if($value===THttpSessionCookieMode::Allow) |
|
312 | + } else if($value===THttpSessionCookieMode::Allow) |
|
314 | 313 | { |
315 | 314 | ini_set('session.use_cookies','1'); |
316 | 315 | ini_set('session.use_only_cookies','0'); |
317 | - } |
|
318 | - else |
|
316 | + } else |
|
319 | 317 | { |
320 | 318 | ini_set('session.use_cookies','1'); |
321 | 319 | ini_set('session.use_only_cookies','1'); |
@@ -368,8 +366,7 @@ discard block |
||
368 | 366 | { |
369 | 367 | ini_set('session.gc_probability',$value); |
370 | 368 | ini_set('session.gc_divisor','100'); |
371 | - } |
|
372 | - else |
|
369 | + } else |
|
373 | 370 | throw new TInvalidDataValueException('httpsession_gcprobability_invalid',$value); |
374 | 371 | } |
375 | 372 | } |
@@ -557,8 +554,7 @@ discard block |
||
557 | 554 | $value=$_SESSION[$key]; |
558 | 555 | unset($_SESSION[$key]); |
559 | 556 | return $value; |
560 | - } |
|
561 | - else |
|
557 | + } else |
|
562 | 558 | return null; |
563 | 559 | } |
564 | 560 |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | if(!$this->_started) |
140 | 140 | { |
141 | 141 | if($this->_customStorage) |
142 | - session_set_save_handler(array($this,'_open'),array($this,'_close'),array($this,'_read'),array($this,'_write'),array($this,'_destroy'),array($this,'_gc')); |
|
142 | + session_set_save_handler(array($this, '_open'), array($this, '_close'), array($this, '_read'), array($this, '_write'), array($this, '_destroy'), array($this, '_gc')); |
|
143 | 143 | if($this->_cookie!==null) |
144 | - session_set_cookie_params($this->_cookie->getExpire(),$this->_cookie->getPath(),$this->_cookie->getDomain(),$this->_cookie->getSecure(),$this->_cookie->getHttpOnly()); |
|
144 | + session_set_cookie_params($this->_cookie->getExpire(), $this->_cookie->getPath(), $this->_cookie->getDomain(), $this->_cookie->getSecure(), $this->_cookie->getHttpOnly()); |
|
145 | 145 | if(ini_get('session.auto_start')!=='1') |
146 | 146 | session_start(); |
147 | 147 | $this->_started=true; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function regenerate($deleteOld=false) |
183 | 183 | { |
184 | - $old = $this->getSessionID(); |
|
184 | + $old=$this->getSessionID(); |
|
185 | 185 | session_regenerate_id($deleteOld); |
186 | 186 | return $old; |
187 | 187 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | else if(ctype_alnum($value)) |
234 | 234 | session_name($value); |
235 | 235 | else |
236 | - throw new TInvalidDataValueException('httpsession_sessionname_invalid',$value); |
|
236 | + throw new TInvalidDataValueException('httpsession_sessionname_invalid', $value); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
@@ -254,10 +254,10 @@ discard block |
||
254 | 254 | throw new TInvalidOperationException('httpsession_savepath_unchangeable'); |
255 | 255 | elseif(is_dir($value)) |
256 | 256 | session_save_path(realpath($value)); |
257 | - elseif(null !== ($ns = Prado::getPathOfNamespace($value)) && is_dir($ns)) |
|
257 | + elseif(null!==($ns=Prado::getPathOfNamespace($value)) && is_dir($ns)) |
|
258 | 258 | session_save_path(realpath($ns)); |
259 | 259 | else |
260 | - throw new TInvalidDataValueException('httpsession_savepath_invalid',$value); |
|
260 | + throw new TInvalidDataValueException('httpsession_savepath_invalid', $value); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | public function getCookie() |
286 | 286 | { |
287 | 287 | if($this->_cookie===null) |
288 | - $this->_cookie=new THttpCookie($this->getSessionName(),$this->getSessionID()); |
|
288 | + $this->_cookie=new THttpCookie($this->getSessionName(), $this->getSessionID()); |
|
289 | 289 | return $this->_cookie; |
290 | 290 | } |
291 | 291 | |
@@ -312,21 +312,21 @@ discard block |
||
312 | 312 | throw new TInvalidOperationException('httpsession_cookiemode_unchangeable'); |
313 | 313 | else |
314 | 314 | { |
315 | - $value=TPropertyValue::ensureEnum($value,'Prado\\Web\\THttpSessionCookieMode'); |
|
315 | + $value=TPropertyValue::ensureEnum($value, 'Prado\\Web\\THttpSessionCookieMode'); |
|
316 | 316 | if($value===THttpSessionCookieMode::None) |
317 | 317 | { |
318 | - ini_set('session.use_cookies','0'); |
|
319 | - ini_set('session.use_only_cookies','0'); |
|
318 | + ini_set('session.use_cookies', '0'); |
|
319 | + ini_set('session.use_only_cookies', '0'); |
|
320 | 320 | } |
321 | 321 | else if($value===THttpSessionCookieMode::Allow) |
322 | 322 | { |
323 | - ini_set('session.use_cookies','1'); |
|
324 | - ini_set('session.use_only_cookies','0'); |
|
323 | + ini_set('session.use_cookies', '1'); |
|
324 | + ini_set('session.use_only_cookies', '0'); |
|
325 | 325 | } |
326 | 326 | else |
327 | 327 | { |
328 | - ini_set('session.use_cookies','1'); |
|
329 | - ini_set('session.use_only_cookies','1'); |
|
328 | + ini_set('session.use_cookies', '1'); |
|
329 | + ini_set('session.use_only_cookies', '1'); |
|
330 | 330 | ini_set('session.use_trans_sid', 0); |
331 | 331 | } |
332 | 332 | } |
@@ -372,13 +372,13 @@ discard block |
||
372 | 372 | else |
373 | 373 | { |
374 | 374 | $value=TPropertyValue::ensureInteger($value); |
375 | - if($value>=0 && $value<=100) |
|
375 | + if($value >= 0 && $value <= 100) |
|
376 | 376 | { |
377 | - ini_set('session.gc_probability',$value); |
|
378 | - ini_set('session.gc_divisor','100'); |
|
377 | + ini_set('session.gc_probability', $value); |
|
378 | + ini_set('session.gc_divisor', '100'); |
|
379 | 379 | } |
380 | 380 | else |
381 | - throw new TInvalidDataValueException('httpsession_gcprobability_invalid',$value); |
|
381 | + throw new TInvalidDataValueException('httpsession_gcprobability_invalid', $value); |
|
382 | 382 | } |
383 | 383 | } |
384 | 384 | |
@@ -400,9 +400,9 @@ discard block |
||
400 | 400 | else |
401 | 401 | { |
402 | 402 | $value=TPropertyValue::ensureBoolean($value); |
403 | - if ($value && $this->getCookieMode()==THttpSessionCookieMode::Only) |
|
403 | + if($value && $this->getCookieMode()==THttpSessionCookieMode::Only) |
|
404 | 404 | throw new TInvalidOperationException('httpsession_transid_cookieonly'); |
405 | - ini_set('session.use_trans_sid',$value?'1':'0'); |
|
405 | + ini_set('session.use_trans_sid', $value ? '1' : '0'); |
|
406 | 406 | } |
407 | 407 | } |
408 | 408 | |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | if($this->_started) |
424 | 424 | throw new TInvalidOperationException('httpsession_maxlifetime_unchangeable'); |
425 | 425 | else |
426 | - ini_set('session.gc_maxlifetime',$value); |
|
426 | + ini_set('session.gc_maxlifetime', $value); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | /** |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | * @param string session name |
434 | 434 | * @return boolean whether session is opened successfully |
435 | 435 | */ |
436 | - public function _open($savePath,$sessionName) |
|
436 | + public function _open($savePath, $sessionName) |
|
437 | 437 | { |
438 | 438 | return true; |
439 | 439 | } |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | * @param string session data |
467 | 467 | * @return boolean whether session write is successful |
468 | 468 | */ |
469 | - public function _write($id,$data) |
|
469 | + public function _write($id, $data) |
|
470 | 470 | { |
471 | 471 | return true; |
472 | 472 | } |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | * @param mixed session variable name |
549 | 549 | * @param mixed session variable value |
550 | 550 | */ |
551 | - public function add($key,$value) |
|
551 | + public function add($key, $value) |
|
552 | 552 | { |
553 | 553 | $_SESSION[$key]=$value; |
554 | 554 | } |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | * @param integer the offset to set element |
622 | 622 | * @param mixed the element value |
623 | 623 | */ |
624 | - public function offsetSet($offset,$item) |
|
624 | + public function offsetSet($offset, $item) |
|
625 | 625 | { |
626 | 626 | $_SESSION[$offset]=$item; |
627 | 627 | } |
@@ -314,10 +314,10 @@ |
||
314 | 314 | { |
315 | 315 | $value=TPropertyValue::ensureEnum($value,'Prado\\Web\\THttpSessionCookieMode'); |
316 | 316 | if($value===THttpSessionCookieMode::None) |
317 | - { |
|
317 | + { |
|
318 | 318 | ini_set('session.use_cookies','0'); |
319 | 319 | ini_set('session.use_only_cookies','0'); |
320 | - } |
|
320 | + } |
|
321 | 321 | else if($value===THttpSessionCookieMode::Allow) |
322 | 322 | { |
323 | 323 | ini_set('session.use_cookies','1'); |
@@ -175,6 +175,7 @@ |
||
175 | 175 | |
176 | 176 | /** |
177 | 177 | * @param string state tracker class. |
178 | + * @param string $value |
|
178 | 179 | */ |
179 | 180 | public function setStateTracker($value) |
180 | 181 | { |
@@ -78,8 +78,8 @@ |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
81 | - * Publish the ajax script |
|
82 | - */ |
|
81 | + * Publish the ajax script |
|
82 | + */ |
|
83 | 83 | public function onPreRender($param) |
84 | 84 | { |
85 | 85 | parent::onPreRender($param); |
@@ -73,12 +73,12 @@ discard block |
||
73 | 73 | if($type===null) |
74 | 74 | { |
75 | 75 | if($this->getControl() instanceof ICallbackEventHandler) |
76 | - $this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveCallbackControl'; |
|
76 | + $this->_activeControlType='Prado\\Web\UI\\ActiveControls\\TBaseActiveCallbackControl'; |
|
77 | 77 | else |
78 | - $this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveControl'; |
|
78 | + $this->_activeControlType='Prado\\Web\UI\\ActiveControls\\TBaseActiveControl'; |
|
79 | 79 | } |
80 | 80 | else |
81 | - $this->_activeControlType = $type; |
|
81 | + $this->_activeControlType=$type; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | { |
119 | 119 | if($this->_baseActiveControl===null) |
120 | 120 | { |
121 | - $type = $this->_activeControlType; |
|
122 | - $this->_baseActiveControl = new $type($this->getControl()); |
|
121 | + $type=$this->_activeControlType; |
|
122 | + $this->_baseActiveControl=new $type($this->getControl()); |
|
123 | 123 | } |
124 | 124 | return $this->_baseActiveControl; |
125 | 125 | } |
@@ -131,10 +131,10 @@ discard block |
||
131 | 131 | { |
132 | 132 | if($this->getPage()->getIsCallback()) |
133 | 133 | { |
134 | - $target = $this->getPage()->getCallbackEventTarget(); |
|
134 | + $target=$this->getPage()->getCallbackEventTarget(); |
|
135 | 135 | if($target instanceof ICallbackEventHandler) |
136 | 136 | { |
137 | - $client = $target->getActiveControl()->getClientSide(); |
|
137 | + $client=$target->getActiveControl()->getClientSide(); |
|
138 | 138 | return $client->getEnablePageStateUpdate(); |
139 | 139 | } |
140 | 140 | } |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | { |
149 | 149 | if($this->getIsTrackingPageState()) |
150 | 150 | { |
151 | - $stateTrackerClass = $this->_stateTrackerClass; |
|
152 | - $this->_stateTracker = new $stateTrackerClass($this->getControl()); |
|
151 | + $stateTrackerClass=$this->_stateTrackerClass; |
|
152 | + $this->_stateTracker=new $stateTrackerClass($this->getControl()); |
|
153 | 153 | $this->_stateTracker->trackChanges(); |
154 | 154 | } |
155 | 155 | parent::onLoad($param); |
@@ -182,6 +182,6 @@ discard block |
||
182 | 182 | */ |
183 | 183 | public function setStateTracker($value) |
184 | 184 | { |
185 | - $this->_stateTrackerClass = TPropertyValue::ensureString($value); |
|
185 | + $this->_stateTrackerClass=TPropertyValue::ensureString($value); |
|
186 | 186 | } |
187 | 187 | } |
@@ -76,8 +76,7 @@ |
||
76 | 76 | $this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveCallbackControl'; |
77 | 77 | else |
78 | 78 | $this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveControl'; |
79 | - } |
|
80 | - else |
|
79 | + } else |
|
81 | 80 | $this->_activeControlType = $type; |
82 | 81 | } |
83 | 82 |
@@ -66,7 +66,7 @@ |
||
66 | 66 | /** |
67 | 67 | * No client class for this control. |
68 | 68 | * This method overrides the parent implementation. |
69 | - * @return null no javascript class name. |
|
69 | + * @return string no javascript class name. |
|
70 | 70 | */ |
71 | 71 | protected function getClientClassName() |
72 | 72 | { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | protected function createListItemCollection() |
84 | 84 | { |
85 | - $collection = new TActiveListItemCollection; |
|
85 | + $collection=new TActiveListItemCollection; |
|
86 | 86 | $collection->setControl($this); |
87 | 87 | return $collection; |
88 | 88 | } |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | protected function addAttributesToRender($writer) |
103 | 103 | { |
104 | 104 | parent::addAttributesToRender($writer); |
105 | - $writer->addAttribute('id',$this->getClientID()); |
|
106 | - if ($this->getAutoPostBack()) |
|
105 | + $writer->addAttribute('id', $this->getClientID()); |
|
106 | + if($this->getAutoPostBack()) |
|
107 | 107 | $this->getActiveControl()->registerCallbackClientScript( |
108 | 108 | $this->getClientClassName(), $this->getPostBackOptions()); |
109 | 109 | } |