@@ -46,8 +46,9 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | function _recaptcha_qsencode ($data) { |
| 48 | 48 | $req = ""; |
| 49 | - foreach ( $data as $key => $value ) |
|
| 50 | - $req .= $key . '=' . urlencode( stripslashes($value) ) . '&'; |
|
| 49 | + foreach ( $data as $key => $value ) { |
|
| 50 | + $req .= $key . '=' . urlencode( stripslashes($value) ) . '&'; |
|
| 51 | + } |
|
| 51 | 52 | |
| 52 | 53 | // Cut the last '&' |
| 53 | 54 | $req=substr($req,0,strlen($req)-1); |
@@ -83,8 +84,10 @@ discard block |
||
| 83 | 84 | |
| 84 | 85 | fwrite($fs, $http_request); |
| 85 | 86 | |
| 86 | - while ( !feof($fs) ) |
|
| 87 | - $response .= fgets($fs, 1160); // One TCP-IP packet |
|
| 87 | + while ( !feof($fs) ) { |
|
| 88 | + $response .= fgets($fs, 1160); |
|
| 89 | + } |
|
| 90 | + // One TCP-IP packet |
|
| 88 | 91 | fclose($fs); |
| 89 | 92 | $response = explode("\r\n\r\n", $response, 2); |
| 90 | 93 | |
@@ -183,8 +186,7 @@ discard block |
||
| 183 | 186 | |
| 184 | 187 | if (trim ($answers [0]) == 'true') { |
| 185 | 188 | $recaptcha_response->is_valid = true; |
| 186 | - } |
|
| 187 | - else { |
|
| 189 | + } else { |
|
| 188 | 190 | $recaptcha_response->is_valid = false; |
| 189 | 191 | $recaptcha_response->error = $answers [1]; |
| 190 | 192 | } |
@@ -42,8 +42,9 @@ discard block |
||
| 42 | 42 | public function attach($owner) |
| 43 | 43 | { |
| 44 | 44 | $this->_owner=$owner; |
| 45 | - foreach($this->events() as $event=>$handler) |
|
| 46 | - $owner->attachEventHandler($event,array($this,$handler)); |
|
| 45 | + foreach($this->events() as $event=>$handler) { |
|
| 46 | + $owner->attachEventHandler($event,array($this,$handler)); |
|
| 47 | + } |
|
| 47 | 48 | } |
| 48 | 49 | |
| 49 | 50 | /** |
@@ -55,8 +56,9 @@ discard block |
||
| 55 | 56 | */ |
| 56 | 57 | public function detach($owner) |
| 57 | 58 | { |
| 58 | - foreach($this->events() as $event=>$handler) |
|
| 59 | - $owner->detachEventHandler($event,array($this,$handler)); |
|
| 59 | + foreach($this->events() as $event=>$handler) { |
|
| 60 | + $owner->detachEventHandler($event,array($this,$handler)); |
|
| 61 | + } |
|
| 60 | 62 | $this->_owner=null; |
| 61 | 63 | } |
| 62 | 64 | |
@@ -191,8 +191,7 @@ discard block |
||
| 191 | 191 | default: |
| 192 | 192 | if ($this->isAlphaNum($this->b)) { |
| 193 | 193 | $this->action(1); |
| 194 | - } |
|
| 195 | - else { |
|
| 194 | + } else { |
|
| 196 | 195 | $this->action(2); |
| 197 | 196 | } |
| 198 | 197 | } |
@@ -224,8 +223,7 @@ discard block |
||
| 224 | 223 | default: |
| 225 | 224 | if ($this->isAlphaNum($this->a)) { |
| 226 | 225 | $this->action(1); |
| 227 | - } |
|
| 228 | - else { |
|
| 226 | + } else { |
|
| 229 | 227 | $this->action(3); |
| 230 | 228 | } |
| 231 | 229 | } |
@@ -129,28 +129,24 @@ |
||
| 129 | 129 | { |
| 130 | 130 | $param->setData($data); |
| 131 | 131 | $this->_nextPageList = null; |
| 132 | - } |
|
| 133 | - else |
|
| 132 | + } else |
|
| 134 | 133 | { |
| 135 | 134 | $param->setData(array_slice($data, 0, $pageSize)); |
| 136 | 135 | $this->_nextPageList = array_slice($data, $pageSize-1,$total); |
| 137 | 136 | } |
| 138 | - } |
|
| 139 | - else |
|
| 137 | + } else |
|
| 140 | 138 | { |
| 141 | 139 | if($total <= $pageSize) |
| 142 | 140 | { |
| 143 | 141 | $this->_prevPageList = array_slice($data, 0, $total); |
| 144 | 142 | $param->setData(array()); |
| 145 | 143 | $this->_nextPageList = null; |
| 146 | - } |
|
| 147 | - else if($total <= $pageSize*2) |
|
| 144 | + } else if($total <= $pageSize*2) |
|
| 148 | 145 | { |
| 149 | 146 | $this->_prevPageList = array_slice($data, 0, $pageSize); |
| 150 | 147 | $param->setData(array_slice($data, $pageSize, $total)); |
| 151 | 148 | $this->_nextPageList = null; |
| 152 | - } |
|
| 153 | - else |
|
| 149 | + } else |
|
| 154 | 150 | { |
| 155 | 151 | $this->_prevPageList = array_slice($data, 0, $pageSize); |
| 156 | 152 | $param->setData(array_slice($data, $pageSize, $pageSize)); |
@@ -110,8 +110,9 @@ |
||
| 110 | 110 | $fkeys = $this->findForeignKeys($fkObjects[0], $source); |
| 111 | 111 | for($i=0;$i<$total;$i++) |
| 112 | 112 | { |
| 113 | - foreach($fkeys as $fKey => $srcKey) |
|
| 114 | - $fkObjects[$i]->setColumnValue($fKey, $source->getColumnValue($srcKey)); |
|
| 113 | + foreach($fkeys as $fKey => $srcKey) { |
|
| 114 | + $fkObjects[$i]->setColumnValue($fKey, $source->getColumnValue($srcKey)); |
|
| 115 | + } |
|
| 115 | 116 | $success = $fkObjects[$i]->save() && $success; |
| 116 | 117 | } |
| 117 | 118 | } |
@@ -213,8 +213,9 @@ discard block |
||
| 213 | 213 | return 'FALSE'; |
| 214 | 214 | $columns = array(); |
| 215 | 215 | $tableName = $table->getTableFullName(); |
| 216 | - foreach($fields as $field) |
|
| 217 | - $columns[] = $tableName.'.'.$table->getColumn($field)->getColumnName(); |
|
| 216 | + foreach($fields as $field) { |
|
| 217 | + $columns[] = $tableName.'.'.$table->getColumn($field)->getColumnName(); |
|
| 218 | + } |
|
| 218 | 219 | return '('.implode(', ',$columns).') IN '.$this->quoteTuple($values); |
| 219 | 220 | } |
| 220 | 221 | |
@@ -256,8 +257,9 @@ discard block |
||
| 256 | 257 | { |
| 257 | 258 | $conn = $this->getDbConnection(); |
| 258 | 259 | $data = array(); |
| 259 | - foreach($array as $k=>$v) |
|
| 260 | - $data[] = is_array($v) ? $this->quoteTuple($v) : $conn->quoteString($v); |
|
| 260 | + foreach($array as $k=>$v) { |
|
| 261 | + $data[] = is_array($v) ? $this->quoteTuple($v) : $conn->quoteString($v); |
|
| 262 | + } |
|
| 261 | 263 | return '('.implode(', ', $data).')'; |
| 262 | 264 | } |
| 263 | 265 | |
@@ -416,8 +416,7 @@ |
||
| 416 | 416 | { |
| 417 | 417 | $useArgs = !is_array($parameters) && is_array($args); |
| 418 | 418 | return new TSqlCriteria($criteria,$useArgs ? $args : $parameters); |
| 419 | - } |
|
| 420 | - else if($criteria instanceof TSqlCriteria) |
|
| 419 | + } else if($criteria instanceof TSqlCriteria) |
|
| 421 | 420 | return $criteria; |
| 422 | 421 | else |
| 423 | 422 | throw new TDbException('dbtablegateway_invalid_criteria'); |
@@ -192,8 +192,9 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | public function getIsNamedParameters() |
| 194 | 194 | { |
| 195 | - foreach($this->getParameters() as $k=>$v) |
|
| 196 | - return is_string($k); |
|
| 195 | + foreach($this->getParameters() as $k=>$v) { |
|
| 196 | + return is_string($k); |
|
| 197 | + } |
|
| 197 | 198 | } |
| 198 | 199 | |
| 199 | 200 | /** |
@@ -265,13 +266,15 @@ discard block |
||
| 265 | 266 | if(strlen((string)$this->getCondition()) > 0) |
| 266 | 267 | $str .= '"'.(string)$this->getCondition().'"'; |
| 267 | 268 | $params = array(); |
| 268 | - foreach($this->getParameters() as $k=>$v) |
|
| 269 | - $params[] = "{$k} => ${v}"; |
|
| 269 | + foreach($this->getParameters() as $k=>$v) { |
|
| 270 | + $params[] = "{$k} => ${v}"; |
|
| 271 | + } |
|
| 270 | 272 | if(count($params) > 0) |
| 271 | 273 | $str .= ', "'.implode(', ',$params).'"'; |
| 272 | 274 | $orders = array(); |
| 273 | - foreach($this->getOrdersBy() as $k=>$v) |
|
| 274 | - $orders[] = "{$k} => ${v}"; |
|
| 275 | + foreach($this->getOrdersBy() as $k=>$v) { |
|
| 276 | + $orders[] = "{$k} => ${v}"; |
|
| 277 | + } |
|
| 275 | 278 | if(count($orders) > 0) |
| 276 | 279 | $str .= ', "'.implode(', ',$orders).'"'; |
| 277 | 280 | if($this->_limit !==null) |
@@ -287,8 +287,9 @@ discard block |
||
| 287 | 287 | { |
| 288 | 288 | $class=new ReflectionClass($className); |
| 289 | 289 | $relations=array(); |
| 290 | - foreach($class->getStaticPropertyValue('RELATIONS') as $key=>$value) |
|
| 291 | - $relations[strtolower($key)]=array($key,$value); |
|
| 290 | + foreach($class->getStaticPropertyValue('RELATIONS') as $key=>$value) { |
|
| 291 | + $relations[strtolower($key)]=array($key,$value); |
|
| 292 | + } |
|
| 292 | 293 | self::$_relations[$className]=$relations; |
| 293 | 294 | } |
| 294 | 295 | } |
@@ -303,8 +304,9 @@ discard block |
||
| 303 | 304 | $data=get_object_vars($data); |
| 304 | 305 | if(!is_array($data)) |
| 305 | 306 | throw new TActiveRecordException('ar_data_invalid', get_class($this)); |
| 306 | - foreach($data as $name=>$value) |
|
| 307 | - $this->setColumnValue($name,$value); |
|
| 307 | + foreach($data as $name=>$value) { |
|
| 308 | + $this->setColumnValue($name,$value); |
|
| 309 | + } |
|
| 308 | 310 | } |
| 309 | 311 | |
| 310 | 312 | |
@@ -425,14 +427,12 @@ discard block |
||
| 425 | 427 | $this->_recordState = self::STATE_LOADED; |
| 426 | 428 | return true; |
| 427 | 429 | } |
| 428 | - } |
|
| 429 | - else if($this->_recordState===self::STATE_LOADED) |
|
| 430 | + } else if($this->_recordState===self::STATE_LOADED) |
|
| 430 | 431 | { |
| 431 | 432 | $this->onUpdate($param); |
| 432 | 433 | if($param->getIsValid() && $gateway->update($this)) |
| 433 | 434 | return true; |
| 434 | - } |
|
| 435 | - else |
|
| 435 | + } else |
|
| 436 | 436 | throw new TActiveRecordException('ar_save_invalid', get_class($this)); |
| 437 | 437 | |
| 438 | 438 | return false; |
@@ -455,8 +455,7 @@ discard block |
||
| 455 | 455 | $this->_recordState=self::STATE_DELETED; |
| 456 | 456 | return true; |
| 457 | 457 | } |
| 458 | - } |
|
| 459 | - else |
|
| 458 | + } else |
|
| 460 | 459 | throw new TActiveRecordException('ar_delete_invalid', get_class($this)); |
| 461 | 460 | |
| 462 | 461 | return false; |
@@ -533,8 +532,9 @@ discard block |
||
| 533 | 532 | protected function populateObjects($reader) |
| 534 | 533 | { |
| 535 | 534 | $result=array(); |
| 536 | - foreach($reader as $data) |
|
| 537 | - $result[] = $this->populateObject($data); |
|
| 535 | + foreach($reader as $data) { |
|
| 536 | + $result[] = $this->populateObject($data); |
|
| 537 | + } |
|
| 538 | 538 | return $result; |
| 539 | 539 | } |
| 540 | 540 | |
@@ -723,8 +723,7 @@ discard block |
||
| 723 | 723 | { |
| 724 | 724 | $criteria = $this->getRecordCriteria(count($args)>0 ? $args[0] : null, array_slice($args,1)); |
| 725 | 725 | return $context->getRelationHandler($criteria); |
| 726 | - } |
|
| 727 | - else |
|
| 726 | + } else |
|
| 728 | 727 | return null; |
| 729 | 728 | } |
| 730 | 729 | |
@@ -743,8 +742,7 @@ discard block |
||
| 743 | 742 | { |
| 744 | 743 | list($property, $relation) = $definition; |
| 745 | 744 | return new TActiveRecordRelationContext($this,$property,$relation); |
| 746 | - } |
|
| 747 | - else |
|
| 745 | + } else |
|
| 748 | 746 | return null; |
| 749 | 747 | } |
| 750 | 748 | |
@@ -827,8 +825,7 @@ discard block |
||
| 827 | 825 | { |
| 828 | 826 | $property= $method[4]==='_' ? substr($method,5) : substr($method,4); |
| 829 | 827 | return $this->getRelationHandler($property, $args); |
| 830 | - } |
|
| 831 | - else if($findOne=strncasecmp($method,'findby',6)===0) |
|
| 828 | + } else if($findOne=strncasecmp($method,'findby',6)===0) |
|
| 832 | 829 | $condition = $method[6]==='_' ? substr($method,7) : substr($method,6); |
| 833 | 830 | else if(strncasecmp($method,'findallby',9)===0) |
| 834 | 831 | $condition = $method[9]==='_' ? substr($method,10) : substr($method,9); |
@@ -894,8 +891,7 @@ discard block |
||
| 894 | 891 | { |
| 895 | 892 | $useArgs = !is_array($parameters) && is_array($args); |
| 896 | 893 | return new TActiveRecordCriteria($criteria,$useArgs ? $args : $parameters); |
| 897 | - } |
|
| 898 | - else if($criteria instanceof TSqlCriteria) |
|
| 894 | + } else if($criteria instanceof TSqlCriteria) |
|
| 899 | 895 | return $criteria; |
| 900 | 896 | else |
| 901 | 897 | return new TActiveRecordCriteria(); |