@@ -43,12 +43,12 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | protected function addAttributesToRender($writer) |
| 45 | 45 | { |
| 46 | - $writer->addAttribute('id',$this->getClientID()); |
|
| 47 | - $writer->addAttribute('method',$this->getMethod()); |
|
| 46 | + $writer->addAttribute('id', $this->getClientID()); |
|
| 47 | + $writer->addAttribute('method', $this->getMethod()); |
|
| 48 | 48 | $uri=$this->getRequest()->getRequestURI(); |
| 49 | - $writer->addAttribute('action',str_replace('&','&',str_replace('&','&',$uri))); |
|
| 49 | + $writer->addAttribute('action', str_replace('&', '&', str_replace('&', '&', $uri))); |
|
| 50 | 50 | if(($enctype=$this->getEnctype())!=='') |
| 51 | - $writer->addAttribute('enctype',$enctype); |
|
| 51 | + $writer->addAttribute('enctype', $enctype); |
|
| 52 | 52 | |
| 53 | 53 | $attributes=$this->getAttributes(); |
| 54 | 54 | $attributes->remove('action'); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | if(($button=$this->findControl($butt))!==null) |
| 60 | 60 | $this->getPage()->getClientScript()->registerDefaultButton($this, $button); |
| 61 | 61 | else |
| 62 | - throw new TInvalidDataValueException('form_defaultbutton_invalid',$butt); |
|
| 62 | + throw new TInvalidDataValueException('form_defaultbutton_invalid', $butt); |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function getDefaultButton() |
| 110 | 110 | { |
| 111 | - return $this->getViewState('DefaultButton',''); |
|
| 111 | + return $this->getViewState('DefaultButton', ''); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | public function setDefaultButton($value) |
| 121 | 121 | { |
| 122 | - $this->setViewState('DefaultButton',$value,''); |
|
| 122 | + $this->setViewState('DefaultButton', $value, ''); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function getMethod() |
| 129 | 129 | { |
| 130 | - return $this->getViewState('Method','post'); |
|
| 130 | + return $this->getViewState('Method', 'post'); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | public function setMethod($value) |
| 137 | 137 | { |
| 138 | - $this->setViewState('Method',TPropertyValue::ensureEnum($value,'post','get'),'post'); |
|
| 138 | + $this->setViewState('Method', TPropertyValue::ensureEnum($value, 'post', 'get'), 'post'); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function getEnctype() |
| 145 | 145 | { |
| 146 | - return $this->getViewState('Enctype',''); |
|
| 146 | + return $this->getViewState('Enctype', ''); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function setEnctype($value) |
| 157 | 157 | { |
| 158 | - $this->setViewState('Enctype',$value,''); |
|
| 158 | + $this->setViewState('Enctype', $value, ''); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /** |
@@ -92,8 +92,7 @@ |
||
| 92 | 92 | |
| 93 | 93 | $cs->renderScriptFilesEnd($writer); |
| 94 | 94 | $cs->renderEndScripts($writer); |
| 95 | - } |
|
| 96 | - else |
|
| 95 | + } else |
|
| 97 | 96 | { |
| 98 | 97 | $cs->renderHiddenFieldsBegin($writer); |
| 99 | 98 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | public function setWriter($writer) |
| 90 | 90 | { |
| 91 | - $this->_writer = $writer; |
|
| 91 | + $this->_writer=$writer; |
|
| 92 | 92 | } |
| 93 | 93 | /** |
| 94 | 94 | * Adds a list of attributes to be rendered. |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * @param string name of the attribute |
| 106 | 106 | * @param string value of the attribute |
| 107 | 107 | */ |
| 108 | - public function addAttribute($name,$value) |
|
| 108 | + public function addAttribute($name, $value) |
|
| 109 | 109 | { |
| 110 | 110 | $this->_attributes[THttpUtility::htmlStrip($name)]=THttpUtility::htmlEncode($value); |
| 111 | 111 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @param string stylesheet attribute name |
| 135 | 135 | * @param string stylesheet attribute value |
| 136 | 136 | */ |
| 137 | - public function addStyleAttribute($name,$value) |
|
| 137 | + public function addStyleAttribute($name, $value) |
|
| 138 | 138 | { |
| 139 | 139 | $this->_styles[THttpUtility::htmlStrip($name)]=THttpUtility::htmlEncode($value); |
| 140 | 140 | } |
@@ -203,12 +203,12 @@ discard block |
||
| 203 | 203 | if(isset(self::$_simpleTags[$tagName])) |
| 204 | 204 | { |
| 205 | 205 | $str.=' />'; |
| 206 | - $this->_openTags[] = ''; |
|
| 206 | + $this->_openTags[]=''; |
|
| 207 | 207 | } |
| 208 | 208 | else |
| 209 | 209 | { |
| 210 | 210 | $str.='>'; |
| 211 | - $this->_openTags[] = $tagName; |
|
| 211 | + $this->_openTags[]=$tagName; |
|
| 212 | 212 | } |
| 213 | 213 | $this->_writer->write($str); |
| 214 | 214 | $this->_attributes=array(); |
@@ -207,8 +207,7 @@ |
||
| 207 | 207 | { |
| 208 | 208 | $str.=' />'; |
| 209 | 209 | $this->_openTags[] = ''; |
| 210 | - } |
|
| 211 | - else |
|
| 210 | + } else |
|
| 212 | 211 | { |
| 213 | 212 | $str.='>'; |
| 214 | 213 | $this->_openTags[] = $tagName; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function save($state) |
| 52 | 52 | { |
| 53 | - $this->_page->setClientState(TPageStateFormatter::serialize($this->_page,$state)); |
|
| 53 | + $this->_page->setClientState(TPageStateFormatter::serialize($this->_page, $state)); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public function load() |
| 62 | 62 | { |
| 63 | - if(($data=TPageStateFormatter::unserialize($this->_page,$this->_page->getRequestClientState()))!==null) |
|
| 63 | + if(($data=TPageStateFormatter::unserialize($this->_page, $this->_page->getRequestClientState()))!==null) |
|
| 64 | 64 | return $data; |
| 65 | 65 | else |
| 66 | - throw new THttpException(400,'pagestatepersister_pagestate_corrupted'); |
|
| 66 | + throw new THttpException(400, 'pagestatepersister_pagestate_corrupted'); |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
@@ -18,9 +18,9 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | class THttpUtility |
| 20 | 20 | { |
| 21 | - private static $_encodeTable=array('<'=>'<','>'=>'>','"'=>'"'); |
|
| 22 | - private static $_decodeTable=array('<'=>'<','>'=>'>','"'=>'"'); |
|
| 23 | - private static $_stripTable=array('<'=>'','>'=>'','"'=>''); |
|
| 21 | + private static $_encodeTable=array('<'=>'<', '>'=>'>', '"'=>'"'); |
|
| 22 | + private static $_decodeTable=array('<'=>'<', '>'=>'>', '"'=>'"'); |
|
| 23 | + private static $_stripTable=array('<'=>'', '>'=>'', '"'=>''); |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * HTML-encodes a string. |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public static function htmlEncode($s) |
| 34 | 34 | { |
| 35 | - return strtr($s,self::$_encodeTable); |
|
| 35 | + return strtr($s, self::$_encodeTable); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public static function htmlDecode($s) |
| 45 | 45 | { |
| 46 | - return strtr($s,self::$_decodeTable); |
|
| 46 | + return strtr($s, self::$_decodeTable); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public static function htmlStrip($s) |
| 56 | 56 | { |
| 57 | - return strtr($s,self::$_stripTable); |
|
| 57 | + return strtr($s, self::$_stripTable); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | class TDateTimeStamp |
| 27 | 27 | { |
| 28 | - protected static $_month_normal = array("",31,28,31,30,31,30,31,31,30,31,30,31); |
|
| 29 | - protected static $_month_leaf = array("",31,29,31,30,31,30,31,31,30,31,30,31); |
|
| 28 | + protected static $_month_normal=array("", 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
|
| 29 | + protected static $_month_leaf=array("", 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Returns the day of the week (0=Sunday, 1=Monday, .. 6=Saturday) |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function getDayofWeek($year, $month, $day) |
| 38 | 38 | { |
| 39 | - $dt = new DateTime(); |
|
| 39 | + $dt=new DateTime(); |
|
| 40 | 40 | $dt->setDate($year, $month, $day); |
| 41 | 41 | return (int) $dt->format('w'); |
| 42 | 42 | } |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function isLeapYear($year) |
| 51 | 51 | { |
| 52 | - $year = $this->digitCheck($year); |
|
| 53 | - $dt = new DateTime(); |
|
| 52 | + $year=$this->digitCheck($year); |
|
| 53 | + $dt=new DateTime(); |
|
| 54 | 54 | $dt->setDate($year, 1, 1); |
| 55 | 55 | return (bool) $dt->format('L'); |
| 56 | 56 | } |
@@ -62,22 +62,22 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | protected function digitCheck($y) |
| 64 | 64 | { |
| 65 | - if ($y < 100){ |
|
| 66 | - $yr = (integer) date("Y"); |
|
| 67 | - $century = (integer) ($yr /100); |
|
| 65 | + if($y < 100) { |
|
| 66 | + $yr=(integer) date("Y"); |
|
| 67 | + $century=(integer) ($yr / 100); |
|
| 68 | 68 | |
| 69 | - if ($yr%100 > 50) { |
|
| 70 | - $c1 = $century + 1; |
|
| 71 | - $c0 = $century; |
|
| 69 | + if($yr % 100 > 50) { |
|
| 70 | + $c1=$century + 1; |
|
| 71 | + $c0=$century; |
|
| 72 | 72 | } else { |
| 73 | - $c1 = $century; |
|
| 74 | - $c0 = $century - 1; |
|
| 73 | + $c1=$century; |
|
| 74 | + $c0=$century - 1; |
|
| 75 | 75 | } |
| 76 | - $c1 *= 100; |
|
| 76 | + $c1*=100; |
|
| 77 | 77 | // if 2-digit year is less than 30 years in future, set it to this century |
| 78 | 78 | // otherwise if more than 30 years in future, then we set 2-digit year to the prev century. |
| 79 | - if (($y + $c1) < $yr+30) $y = $y + $c1; |
|
| 80 | - else $y = $y + $c0*100; |
|
| 79 | + if(($y + $c1) < $yr + 30) $y=$y + $c1; |
|
| 80 | + else $y=$y + $c0 * 100; |
|
| 81 | 81 | } |
| 82 | 82 | return $y; |
| 83 | 83 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function getGMTDiff($ts=false) |
| 94 | 94 | { |
| 95 | - $dt = new DateTime(); |
|
| 95 | + $dt=new DateTime(); |
|
| 96 | 96 | if($ts) |
| 97 | 97 | $dt->setTimeStamp($ts); |
| 98 | 98 | else |
@@ -106,9 +106,9 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | function parseDate($txt=false) |
| 108 | 108 | { |
| 109 | - if ($txt === false) return getdate(); |
|
| 109 | + if($txt===false) return getdate(); |
|
| 110 | 110 | |
| 111 | - $dt = new DateTime($txt); |
|
| 111 | + $dt=new DateTime($txt); |
|
| 112 | 112 | |
| 113 | 113 | return array( |
| 114 | 114 | 'seconds' => (int) $dt->format('s'), |
@@ -128,11 +128,11 @@ discard block |
||
| 128 | 128 | /** |
| 129 | 129 | * @return array an array with date info. |
| 130 | 130 | */ |
| 131 | - function getDate($d=false,$fast=false) |
|
| 131 | + function getDate($d=false, $fast=false) |
|
| 132 | 132 | { |
| 133 | - if ($d === false) return getdate(); |
|
| 133 | + if($d===false) return getdate(); |
|
| 134 | 134 | |
| 135 | - $dt = new DateTime(); |
|
| 135 | + $dt=new DateTime(); |
|
| 136 | 136 | $dt->setTimestamp($d); |
| 137 | 137 | |
| 138 | 138 | return array( |
@@ -153,20 +153,20 @@ discard block |
||
| 153 | 153 | /** |
| 154 | 154 | * @return boolean true if valid date, semantic check only. |
| 155 | 155 | */ |
| 156 | - public function isValidDate($y,$m,$d) |
|
| 156 | + public function isValidDate($y, $m, $d) |
|
| 157 | 157 | { |
| 158 | - if ($this->isLeapYear($y)) |
|
| 159 | - $marr =& self::$_month_leaf; |
|
| 158 | + if($this->isLeapYear($y)) |
|
| 159 | + $marr=& self::$_month_leaf; |
|
| 160 | 160 | else |
| 161 | - $marr =& self::$_month_normal; |
|
| 161 | + $marr=& self::$_month_normal; |
|
| 162 | 162 | |
| 163 | - if ($m > 12 || $m < 1) return false; |
|
| 163 | + if($m > 12 || $m < 1) return false; |
|
| 164 | 164 | |
| 165 | - if ($d > 31 || $d < 1) return false; |
|
| 165 | + if($d > 31 || $d < 1) return false; |
|
| 166 | 166 | |
| 167 | - if ($marr[$m] < $d) return false; |
|
| 167 | + if($marr[$m] < $d) return false; |
|
| 168 | 168 | |
| 169 | - if ($y < 1000 && $y > 3000) return false; |
|
| 169 | + if($y < 1000 && $y > 3000) return false; |
|
| 170 | 170 | |
| 171 | 171 | return true; |
| 172 | 172 | } |
@@ -174,9 +174,9 @@ discard block |
||
| 174 | 174 | /** |
| 175 | 175 | * @return string formatted date based on timestamp $d |
| 176 | 176 | */ |
| 177 | - function formatDate($fmt,$ts=false,$is_gmt=false) |
|
| 177 | + function formatDate($fmt, $ts=false, $is_gmt=false) |
|
| 178 | 178 | { |
| 179 | - $dt = new DateTime(); |
|
| 179 | + $dt=new DateTime(); |
|
| 180 | 180 | if($is_gmt) |
| 181 | 181 | $dt->setTimeZone(new DateTimeZone('UTC')); |
| 182 | 182 | $dt->setTimestamp($ts); |
@@ -187,9 +187,9 @@ discard block |
||
| 187 | 187 | /** |
| 188 | 188 | * @return integer|float a timestamp given a local time |
| 189 | 189 | */ |
| 190 | - function getTimeStamp($hr,$min,$sec,$mon=false,$day=false,$year=false,$is_gmt=false) |
|
| 190 | + function getTimeStamp($hr, $min, $sec, $mon=false, $day=false, $year=false, $is_gmt=false) |
|
| 191 | 191 | { |
| 192 | - $dt = new DateTime(); |
|
| 192 | + $dt=new DateTime(); |
|
| 193 | 193 | if($is_gmt) |
| 194 | 194 | $dt->setTimeZone(new DateTimeZone('UTC')); |
| 195 | 195 | $dt->setDate($year!==false ? $year : date('Y'), |
@@ -190,7 +190,7 @@ |
||
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | 192 | * @return integer|float a timestamp given a local time |
| 193 | - */ |
|
| 193 | + */ |
|
| 194 | 194 | function getTimeStamp($hr,$min,$sec,$mon=false,$day=false,$year=false,$is_gmt=false) |
| 195 | 195 | { |
| 196 | 196 | $dt = new DateTime(); |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | * the object and method name as string |
| 45 | 45 | * @param array The array of arguments to the function call chain |
| 46 | 46 | */ |
| 47 | - public function addCall($method,$args) |
|
| 47 | + public function addCall($method, $args) |
|
| 48 | 48 | { |
| 49 | - $this->add(array($method,$args)); |
|
| 49 | + $this->add(array($method, $args)); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | $args=func_get_args(); |
| 94 | 94 | if($this->getCount()===0) |
| 95 | - return isset($args[0])?$args[0]:null; |
|
| 95 | + return isset($args[0]) ? $args[0] : null; |
|
| 96 | 96 | |
| 97 | 97 | if(!$this->_iterator) |
| 98 | 98 | { |
@@ -103,15 +103,15 @@ discard block |
||
| 103 | 103 | do { |
| 104 | 104 | $handler=$this->_iterator->current(); |
| 105 | 105 | $this->_iterator->next(); |
| 106 | - if(is_array($handler[0])&&$handler[0][0] instanceof IClassBehavior) |
|
| 107 | - array_splice($handler[1],1,count($args),$args); |
|
| 106 | + if(is_array($handler[0]) && $handler[0][0] instanceof IClassBehavior) |
|
| 107 | + array_splice($handler[1], 1, count($args), $args); |
|
| 108 | 108 | else |
| 109 | - array_splice($handler[1],0,count($args),$args); |
|
| 109 | + array_splice($handler[1], 0, count($args), $args); |
|
| 110 | 110 | $handler[1][]=$this; |
| 111 | - $result=call_user_func_array($handler[0],$handler[1]); |
|
| 111 | + $result=call_user_func_array($handler[0], $handler[1]); |
|
| 112 | 112 | } while($this->_iterator->valid()); |
| 113 | 113 | else |
| 114 | - $result = $args[0]; |
|
| 114 | + $result=$args[0]; |
|
| 115 | 115 | return $result; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -137,10 +137,10 @@ discard block |
||
| 137 | 137 | * @param string method name of the unspecified object method |
| 138 | 138 | * @param array arguments to the unspecified object method |
| 139 | 139 | */ |
| 140 | - public function __dycall($method,$args) |
|
| 140 | + public function __dycall($method, $args) |
|
| 141 | 141 | { |
| 142 | 142 | if($this->_method==$method) |
| 143 | - return call_user_func_array(array($this,'call'),$args); |
|
| 143 | + return call_user_func_array(array($this, 'call'), $args); |
|
| 144 | 144 | return null; |
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | \ No newline at end of file |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | $this->_owner=$owner; |
| 45 | 45 | foreach($this->events() as $event=>$handler) |
| 46 | - $owner->attachEventHandler($event,array($this,$handler)); |
|
| 46 | + $owner->attachEventHandler($event, array($this, $handler)); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | public function detach($owner) |
| 57 | 57 | { |
| 58 | 58 | foreach($this->events() as $event=>$handler) |
| 59 | - $owner->detachEventHandler($event,array($this,$handler)); |
|
| 59 | + $owner->detachEventHandler($event, array($this, $handler)); |
|
| 60 | 60 | $this->_owner=null; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $this->loadParameters($config); |
| 62 | 62 | if($this->_paramFile!==null) |
| 63 | 63 | { |
| 64 | - $configFile = null; |
|
| 64 | + $configFile=null; |
|
| 65 | 65 | if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_XML && ($cache=$this->getApplication()->getCache())!==null) |
| 66 | 66 | { |
| 67 | 67 | $cacheKey='TParameterModule:'.$this->_paramFile; |
@@ -69,14 +69,14 @@ discard block |
||
| 69 | 69 | { |
| 70 | 70 | $configFile=new TXmlDocument; |
| 71 | 71 | $configFile->loadFromFile($this->_paramFile); |
| 72 | - $cache->set($cacheKey,$configFile,0,new TFileCacheDependency($this->_paramFile)); |
|
| 72 | + $cache->set($cacheKey, $configFile, 0, new TFileCacheDependency($this->_paramFile)); |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | else |
| 76 | 76 | { |
| 77 | 77 | if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP) |
| 78 | 78 | { |
| 79 | - $configFile = include $this->_paramFile; |
|
| 79 | + $configFile=include $this->_paramFile; |
|
| 80 | 80 | } |
| 81 | 81 | else |
| 82 | 82 | { |
@@ -103,12 +103,12 @@ discard block |
||
| 103 | 103 | { |
| 104 | 104 | if(is_array($parameter) && isset($parameter['class'])) |
| 105 | 105 | { |
| 106 | - $properties = isset($parameter['properties'])?$parameter['properties']:array(); |
|
| 107 | - $parameters[$id]=array($parameter['class'],$properties); |
|
| 106 | + $properties=isset($parameter['properties']) ? $parameter['properties'] : array(); |
|
| 107 | + $parameters[$id]=array($parameter['class'], $properties); |
|
| 108 | 108 | } |
| 109 | 109 | else |
| 110 | 110 | { |
| 111 | - $parameters[$id] = $parameter; |
|
| 111 | + $parameters[$id]=$parameter; |
|
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $parameters[$id]=$value; |
| 128 | 128 | } |
| 129 | 129 | else |
| 130 | - $parameters[$id]=array($type,$properties->toArray()); |
|
| 130 | + $parameters[$id]=array($type, $properties->toArray()); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
@@ -138,11 +138,11 @@ discard block |
||
| 138 | 138 | { |
| 139 | 139 | $component=Prado::createComponent($parameter[0]); |
| 140 | 140 | foreach($parameter[1] as $name=>$value) |
| 141 | - $component->setSubProperty($name,$value); |
|
| 142 | - $appParams->add($id,$component); |
|
| 141 | + $component->setSubProperty($name, $value); |
|
| 142 | + $appParams->add($id, $component); |
|
| 143 | 143 | } |
| 144 | 144 | else |
| 145 | - $appParams->add($id,$parameter); |
|
| 145 | + $appParams->add($id, $parameter); |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | { |
| 165 | 165 | if($this->_initialized) |
| 166 | 166 | throw new TInvalidOperationException('parametermodule_parameterfile_unchangeable'); |
| 167 | - else if(($this->_paramFile=Prado::getPathOfNamespace($value,$this->getApplication()->getConfigurationFileExt()))===null || !is_file($this->_paramFile)) |
|
| 168 | - throw new TConfigurationException('parametermodule_parameterfile_invalid',$value); |
|
| 167 | + else if(($this->_paramFile=Prado::getPathOfNamespace($value, $this->getApplication()->getConfigurationFileExt()))===null || !is_file($this->_paramFile)) |
|
| 168 | + throw new TConfigurationException('parametermodule_parameterfile_invalid', $value); |
|
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
@@ -71,14 +71,12 @@ discard block |
||
| 71 | 71 | $configFile->loadFromFile($this->_paramFile); |
| 72 | 72 | $cache->set($cacheKey,$configFile,0,new TFileCacheDependency($this->_paramFile)); |
| 73 | 73 | } |
| 74 | - } |
|
| 75 | - else |
|
| 74 | + } else |
|
| 76 | 75 | { |
| 77 | 76 | if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP) |
| 78 | 77 | { |
| 79 | 78 | $configFile = include $this->_paramFile; |
| 80 | - } |
|
| 81 | - else |
|
| 79 | + } else |
|
| 82 | 80 | { |
| 83 | 81 | $configFile=new TXmlDocument; |
| 84 | 82 | $configFile->loadFromFile($this->_paramFile); |
@@ -105,14 +103,12 @@ discard block |
||
| 105 | 103 | { |
| 106 | 104 | $properties = isset($parameter['properties'])?$parameter['properties']:array(); |
| 107 | 105 | $parameters[$id]=array($parameter['class'],$properties); |
| 108 | - } |
|
| 109 | - else |
|
| 106 | + } else |
|
| 110 | 107 | { |
| 111 | 108 | $parameters[$id] = $parameter; |
| 112 | 109 | } |
| 113 | 110 | } |
| 114 | - } |
|
| 115 | - else if($config instanceof TXmlElement) |
|
| 111 | + } else if($config instanceof TXmlElement) |
|
| 116 | 112 | { |
| 117 | 113 | foreach($config->getElementsByTagName('parameter') as $node) |
| 118 | 114 | { |
@@ -125,8 +121,7 @@ discard block |
||
| 125 | 121 | $parameters[$id]=$node; |
| 126 | 122 | else |
| 127 | 123 | $parameters[$id]=$value; |
| 128 | - } |
|
| 129 | - else |
|
| 124 | + } else |
|
| 130 | 125 | $parameters[$id]=array($type,$properties->toArray()); |
| 131 | 126 | } |
| 132 | 127 | } |
@@ -140,8 +135,7 @@ discard block |
||
| 140 | 135 | foreach($parameter[1] as $name=>$value) |
| 141 | 136 | $component->setSubProperty($name,$value); |
| 142 | 137 | $appParams->add($id,$component); |
| 143 | - } |
|
| 144 | - else |
|
| 138 | + } else |
|
| 145 | 139 | $appParams->add($id,$parameter); |
| 146 | 140 | } |
| 147 | 141 | } |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | * @return string SQL search condition matching on a set of columns. |
| 31 | 31 | */ |
| 32 | 32 | public function getSearchExpression($fields, $keywords) { |
| 33 | - $columns = array (); |
|
| 34 | - foreach ($fields as $field) { |
|
| 35 | - if ($this->isSearchableColumn($this->getTableInfo()->getColumn($field))) |
|
| 36 | - $columns[] = $field; |
|
| 33 | + $columns=array(); |
|
| 34 | + foreach($fields as $field) { |
|
| 35 | + if($this->isSearchableColumn($this->getTableInfo()->getColumn($field))) |
|
| 36 | + $columns[]=$field; |
|
| 37 | 37 | } |
| 38 | 38 | return parent :: getSearchExpression($columns, $keywords); |
| 39 | 39 | } |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | * @return boolean true if column can be used for LIKE searching. |
| 43 | 43 | */ |
| 44 | 44 | protected function isSearchableColumn($column) { |
| 45 | - $type = strtolower($column->getDbType()); |
|
| 46 | - return $type === 'character varying' || $type === 'varchar2' || $type === 'character' || $type === 'char' || $type === 'text'; |
|
| 45 | + $type=strtolower($column->getDbType()); |
|
| 46 | + return $type==='character varying' || $type==='varchar2' || $type==='character' || $type==='char' || $type==='text'; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -72,59 +72,59 @@ discard block |
||
| 72 | 72 | * @param integer row offset, -1 to ignore offset. |
| 73 | 73 | * @return string SQL with limit and offset in Oracle way. |
| 74 | 74 | */ |
| 75 | - public function applyLimitOffset($sql, $limit = -1, $offset = -1) { |
|
| 76 | - if ((int) $limit <= 0 && (int) $offset <= 0) |
|
| 75 | + public function applyLimitOffset($sql, $limit=-1, $offset=-1) { |
|
| 76 | + if((int) $limit <= 0 && (int) $offset <= 0) |
|
| 77 | 77 | return $sql; |
| 78 | 78 | |
| 79 | - $pradoNUMLIN = 'pradoNUMLIN'; |
|
| 80 | - $fieldsALIAS = 'xyz'; |
|
| 79 | + $pradoNUMLIN='pradoNUMLIN'; |
|
| 80 | + $fieldsALIAS='xyz'; |
|
| 81 | 81 | |
| 82 | - $nfimDaSQL = strlen($sql); |
|
| 83 | - $nfimDoWhere = (strpos($sql, 'ORDER') !== false ? strpos($sql, 'ORDER') : $nfimDaSQL); |
|
| 84 | - $niniDoSelect = strpos($sql, 'SELECT') + 6; |
|
| 85 | - $nfimDoSelect = (strpos($sql, 'FROM') !== false ? strpos($sql, 'FROM') : $nfimDaSQL); |
|
| 82 | + $nfimDaSQL=strlen($sql); |
|
| 83 | + $nfimDoWhere=(strpos($sql, 'ORDER')!==false ? strpos($sql, 'ORDER') : $nfimDaSQL); |
|
| 84 | + $niniDoSelect=strpos($sql, 'SELECT') + 6; |
|
| 85 | + $nfimDoSelect=(strpos($sql, 'FROM')!==false ? strpos($sql, 'FROM') : $nfimDaSQL); |
|
| 86 | 86 | |
| 87 | 87 | $WhereInSubSelect=""; |
| 88 | 88 | if(strpos($sql, 'WHERE')!==false) |
| 89 | - $WhereInSubSelect = "WHERE " .substr($sql, strpos($sql, 'WHERE')+5, $nfimDoWhere - $niniDoWhere); |
|
| 89 | + $WhereInSubSelect="WHERE ".substr($sql, strpos($sql, 'WHERE') + 5, $nfimDoWhere - $niniDoWhere); |
|
| 90 | 90 | |
| 91 | - $sORDERBY = ''; |
|
| 92 | - if (stripos($sql, 'ORDER') !== false) { |
|
| 93 | - $p = stripos($sql, 'ORDER'); |
|
| 94 | - $sORDERBY = substr($sql, $p +8); |
|
| 91 | + $sORDERBY=''; |
|
| 92 | + if(stripos($sql, 'ORDER')!==false) { |
|
| 93 | + $p=stripos($sql, 'ORDER'); |
|
| 94 | + $sORDERBY=substr($sql, $p + 8); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - $fields = substr($sql, 0, $nfimDoSelect); |
|
| 98 | - $fields = trim(substr($fields, $niniDoSelect)); |
|
| 99 | - $aliasedFields = ', '; |
|
| 97 | + $fields=substr($sql, 0, $nfimDoSelect); |
|
| 98 | + $fields=trim(substr($fields, $niniDoSelect)); |
|
| 99 | + $aliasedFields=', '; |
|
| 100 | 100 | |
| 101 | - if (trim($fields) == '*') { |
|
| 102 | - $aliasedFields = ", {$fieldsALIAS}.{$fields}"; |
|
| 103 | - $fields = ''; |
|
| 104 | - $arr = $this->getTableInfo()->getColumns(); |
|
| 105 | - foreach ($arr as $field) { |
|
| 106 | - $fields .= strtolower($field->getColumnName()) . ', '; |
|
| 101 | + if(trim($fields)=='*') { |
|
| 102 | + $aliasedFields=", {$fieldsALIAS}.{$fields}"; |
|
| 103 | + $fields=''; |
|
| 104 | + $arr=$this->getTableInfo()->getColumns(); |
|
| 105 | + foreach($arr as $field) { |
|
| 106 | + $fields.=strtolower($field->getColumnName()).', '; |
|
| 107 | 107 | } |
| 108 | - $fields = str_replace('"', '', $fields); |
|
| 109 | - $fields = trim($fields); |
|
| 110 | - $fields = substr($fields, 0, strlen($fields) - 1); |
|
| 108 | + $fields=str_replace('"', '', $fields); |
|
| 109 | + $fields=trim($fields); |
|
| 110 | + $fields=substr($fields, 0, strlen($fields) - 1); |
|
| 111 | 111 | } else { |
| 112 | - if (strpos($fields, ',') !== false) { |
|
| 113 | - $arr = $this->getTableInfo()->getColumns(); |
|
| 114 | - foreach ($arr as $field) { |
|
| 115 | - $field = strtolower($field); |
|
| 116 | - $existAS = str_ireplace(' as ', '-as-', $field); |
|
| 117 | - if (strpos($existAS, '-as-') === false) |
|
| 118 | - $aliasedFields .= "{$fieldsALIAS}." . trim($field) . ", "; |
|
| 112 | + if(strpos($fields, ',')!==false) { |
|
| 113 | + $arr=$this->getTableInfo()->getColumns(); |
|
| 114 | + foreach($arr as $field) { |
|
| 115 | + $field=strtolower($field); |
|
| 116 | + $existAS=str_ireplace(' as ', '-as-', $field); |
|
| 117 | + if(strpos($existAS, '-as-')===false) |
|
| 118 | + $aliasedFields.="{$fieldsALIAS}.".trim($field).", "; |
|
| 119 | 119 | else |
| 120 | - $aliasedFields .= "{$field}, "; |
|
| 120 | + $aliasedFields.="{$field}, "; |
|
| 121 | 121 | } |
| 122 | - $aliasedFields = trim($aliasedFields); |
|
| 123 | - $aliasedFields = substr($aliasedFields, 0, strlen($aliasedFields) - 1); |
|
| 122 | + $aliasedFields=trim($aliasedFields); |
|
| 123 | + $aliasedFields=substr($aliasedFields, 0, strlen($aliasedFields) - 1); |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | - if ($aliasedFields == ', ') |
|
| 127 | - $aliasedFields = " , $fieldsALIAS.* "; |
|
| 126 | + if($aliasedFields==', ') |
|
| 127 | + $aliasedFields=" , $fieldsALIAS.* "; |
|
| 128 | 128 | |
| 129 | 129 | /* ************************ |
| 130 | 130 | $newSql = " SELECT $fields FROM ". |
@@ -134,17 +134,17 @@ discard block |
||
| 134 | 134 | ") WHERE {$pradoNUMLIN} >= {$offset} "; |
| 135 | 135 | |
| 136 | 136 | ************************* */ |
| 137 | - $offset=(int)$offset; |
|
| 138 | - $toReg = $offset + $limit ; |
|
| 139 | - $fullTableName = $this->getTableInfo()->getTableFullName(); |
|
| 140 | - if (empty ($sORDERBY)) |
|
| 137 | + $offset=(int) $offset; |
|
| 138 | + $toReg=$offset + $limit; |
|
| 139 | + $fullTableName=$this->getTableInfo()->getTableFullName(); |
|
| 140 | + if(empty ($sORDERBY)) |
|
| 141 | 141 | $sORDERBY="ROWNUM"; |
| 142 | 142 | |
| 143 | - $newSql = " SELECT $fields FROM " . |
|
| 144 | - "( " . |
|
| 145 | - " SELECT ROW_NUMBER() OVER ( ORDER BY {$sORDERBY} ) -1 as {$pradoNUMLIN} {$aliasedFields} " . |
|
| 146 | - " FROM {$fullTableName} {$fieldsALIAS} $WhereInSubSelect" . |
|
| 147 | - ") nn " . |
|
| 143 | + $newSql=" SELECT $fields FROM ". |
|
| 144 | + "( ". |
|
| 145 | + " SELECT ROW_NUMBER() OVER ( ORDER BY {$sORDERBY} ) -1 as {$pradoNUMLIN} {$aliasedFields} ". |
|
| 146 | + " FROM {$fullTableName} {$fieldsALIAS} $WhereInSubSelect". |
|
| 147 | + ") nn ". |
|
| 148 | 148 | " WHERE nn.{$pradoNUMLIN} >= {$offset} AND nn.{$pradoNUMLIN} < {$toReg} "; |
| 149 | 149 | //echo $newSql."\n<br>\n"; |
| 150 | 150 | return $newSql; |