@@ -264,6 +264,9 @@ |
||
264 | 264 | { |
265 | 265 | private $_template; |
266 | 266 | |
267 | + /** |
|
268 | + * @param string $template |
|
269 | + */ |
|
267 | 270 | public function __construct($template) |
268 | 271 | { |
269 | 272 | $this->_template = $template; |
@@ -28,7 +28,7 @@ |
||
28 | 28 | |
29 | 29 | public function __construct($template) |
30 | 30 | { |
31 | - $this->_template = $template; |
|
31 | + $this->_template=$template; |
|
32 | 32 | } |
33 | 33 | /** |
34 | 34 | * Instantiates the template. |
@@ -42,6 +42,7 @@ |
||
42 | 42 | /** |
43 | 43 | * Finds the index of the accordion view whose ID is the same as the one being looked for. |
44 | 44 | * @param string the explicit ID of the accordion view to be looked for |
45 | + * @param string $id |
|
45 | 46 | * @return integer the index of the accordion view found, -1 if not found. |
46 | 47 | */ |
47 | 48 | public function findIndexByID($id) |
@@ -49,7 +49,7 @@ |
||
49 | 49 | { |
50 | 50 | foreach($this as $index => $view) |
51 | 51 | { |
52 | - if($view->getID(false) === $id) |
|
52 | + if($view->getID(false)===$id) |
|
53 | 53 | return $index; |
54 | 54 | } |
55 | 55 | return -1; |
@@ -125,7 +125,7 @@ |
||
125 | 125 | /** |
126 | 126 | * Returns the value to be validated. |
127 | 127 | * This methid is required by \Prado\Web\UI\IValidatable interface. |
128 | - * @return mixed the value of the property to be validated. |
|
128 | + * @return string the value of the property to be validated. |
|
129 | 129 | */ |
130 | 130 | public function getValidationPropertyValue() |
131 | 131 | { |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | */ |
44 | 44 | class TDropDownList extends TListControl implements \Prado\Web\UI\IPostBackDataHandler, \Prado\Web\UI\IValidatable |
45 | 45 | { |
46 | - private $_dataChanged = false; |
|
47 | - private $_isValid = true; |
|
46 | + private $_dataChanged=false; |
|
47 | + private $_isValid=true; |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Adds attributes to renderer. |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | if(!$this->getEnabled(true)) |
79 | 79 | return false; |
80 | 80 | $this->ensureDataBound(); |
81 | - $selection = isset($values[$key])?$values[$key]:null; |
|
82 | - if($selection !== null) |
|
81 | + $selection=isset($values[$key]) ? $values[$key] : null; |
|
82 | + if($selection!==null) |
|
83 | 83 | { |
84 | - $index = $this->getItems()->findIndexByValue($selection, false); |
|
85 | - if($this->getSelectedIndex() !== $index) |
|
84 | + $index=$this->getItems()->findIndexByValue($selection, false); |
|
85 | + if($this->getSelectedIndex()!==$index) |
|
86 | 86 | { |
87 | 87 | $this->setSelectedIndex($index); |
88 | - return $this->_dataChanged = true; |
|
88 | + return $this->_dataChanged=true; |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | return false; |
@@ -147,6 +147,6 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function setIsValid($value) |
149 | 149 | { |
150 | - $this->_isValid = TPropertyValue::ensureBoolean($value); |
|
150 | + $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
151 | 151 | } |
152 | 152 | } |
@@ -478,6 +478,7 @@ discard block |
||
478 | 478 | |
479 | 479 | /** |
480 | 480 | * Parse additional options set in the Options property. |
481 | + * @param string $string |
|
481 | 482 | * @return array additional custom options |
482 | 483 | */ |
483 | 484 | protected function parseEditorOptions($string) |
@@ -502,6 +503,7 @@ discard block |
||
502 | 503 | } |
503 | 504 | |
504 | 505 | /** |
506 | + * @param string $culture |
|
505 | 507 | * @return string localized editor interface language extension. |
506 | 508 | */ |
507 | 509 | protected function getLanguageSuffix($culture) |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | /** |
64 | 64 | * @var array list of locale => language file pairs. |
65 | 65 | */ |
66 | - private static $_langs = [ |
|
66 | + private static $_langs=[ |
|
67 | 67 | 'ar' => 'ar', |
68 | 68 | 'bg_BG' => 'bg_BG', |
69 | 69 | 'bs' => 'bs', |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | /** |
122 | 122 | * @var array list of default plugins to load, override using getAvailablePlugins(); |
123 | 123 | */ |
124 | - private static $_plugins = [ |
|
124 | + private static $_plugins=[ |
|
125 | 125 | 'advlist', |
126 | 126 | 'anchor', |
127 | 127 | 'autolink', |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | /** |
166 | 166 | * @var array default themes to load |
167 | 167 | */ |
168 | - private static $_themes = [ |
|
168 | + private static $_themes=[ |
|
169 | 169 | 'modern', |
170 | 170 | ]; |
171 | 171 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | |
316 | 316 | protected function loadJavascriptLibrary() |
317 | 317 | { |
318 | - $scripts = $this->getPage()->getClientScript(); |
|
318 | + $scripts=$this->getPage()->getClientScript(); |
|
319 | 319 | $scripts->registerPradoScript('htmlarea4'); |
320 | 320 | $this->copyCustomPlugins(); |
321 | 321 | } |
@@ -326,26 +326,26 @@ discard block |
||
326 | 326 | protected function registerEditorClientScript($writer) |
327 | 327 | { |
328 | 328 | $this->loadJavascriptLibrary(); |
329 | - $scripts = $this->getPage()->getClientScript(); |
|
330 | - $options = [ |
|
329 | + $scripts=$this->getPage()->getClientScript(); |
|
330 | + $options=[ |
|
331 | 331 | 'EditorOptions' => $this->getEditorOptions() |
332 | 332 | ]; |
333 | 333 | |
334 | - $options = TJavaScript::encode($options, true, true); |
|
335 | - $script = "new {$this->getClientClassName()}($options)"; |
|
336 | - $scripts->registerEndScript('prado:THtmlArea4' . $this->ClientID, $script); |
|
334 | + $options=TJavaScript::encode($options, true, true); |
|
335 | + $script="new {$this->getClientClassName()}($options)"; |
|
336 | + $scripts->registerEndScript('prado:THtmlArea4'.$this->ClientID, $script); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | protected function copyCustomPlugins() |
340 | 340 | { |
341 | - if($plugins = $this->getCustomPluginPath()) |
|
341 | + if($plugins=$this->getCustomPluginPath()) |
|
342 | 342 | { |
343 | - $basepath = $this->getPage()->getClientScript()->getPradoScriptAssetPath('tinymce'); |
|
344 | - $assets = $this->getApplication()->getAssetManager(); |
|
345 | - $path = is_dir($plugins) ? $plugins : Prado::getPathOfNameSpace($plugins); |
|
346 | - $name = basename($path); |
|
347 | - $dest = $basepath . '/plugins/' . $name; |
|
348 | - if(!is_dir($dest) || $this->getApplication()->getMode() !== TApplicationMode::Performance) |
|
343 | + $basepath=$this->getPage()->getClientScript()->getPradoScriptAssetPath('tinymce'); |
|
344 | + $assets=$this->getApplication()->getAssetManager(); |
|
345 | + $path=is_dir($plugins) ? $plugins : Prado::getPathOfNameSpace($plugins); |
|
346 | + $name=basename($path); |
|
347 | + $dest=$basepath.'/plugins/'.$name; |
|
348 | + if(!is_dir($dest) || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
|
349 | 349 | $assets->copyDirectory($path, $dest); |
350 | 350 | } |
351 | 351 | } |
@@ -356,26 +356,26 @@ discard block |
||
356 | 356 | */ |
357 | 357 | protected function getEditorOptions() |
358 | 358 | { |
359 | - $options['mode'] = 'exact'; |
|
360 | - $options['elements'] = $this->getClientID(); |
|
361 | - $options['language'] = $this->getLanguageSuffix($this->getCulture()); |
|
359 | + $options['mode']='exact'; |
|
360 | + $options['elements']=$this->getClientID(); |
|
361 | + $options['language']=$this->getLanguageSuffix($this->getCulture()); |
|
362 | 362 | //$options['theme'] = 'modern'; //default |
363 | 363 | // mimic previous (tinyMCE3) sizing behaviour |
364 | - $options['width'] = $this->getWidth(); |
|
365 | - $options['height'] = $this->getHeight(); |
|
366 | - $options['resize'] = 'both'; |
|
367 | - $options['menubar'] = false; |
|
364 | + $options['width']=$this->getWidth(); |
|
365 | + $options['height']=$this->getHeight(); |
|
366 | + $options['resize']='both'; |
|
367 | + $options['menubar']=false; |
|
368 | 368 | if($this->getReadOnly()) |
369 | 369 | { |
370 | - $options['readonly'] = true; |
|
371 | - $options['toolbar'] = false; |
|
372 | - $options['menubar'] = false; |
|
373 | - $options['statusbar'] = false; |
|
370 | + $options['readonly']=true; |
|
371 | + $options['toolbar']=false; |
|
372 | + $options['menubar']=false; |
|
373 | + $options['statusbar']=false; |
|
374 | 374 | } |
375 | 375 | |
376 | - $options['extended_valid_elements'] = 'a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]'; |
|
376 | + $options['extended_valid_elements']='a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]'; |
|
377 | 377 | |
378 | - $options = array_merge($options, $this->parseEditorOptions($this->getOptions())); |
|
378 | + $options=array_merge($options, $this->parseEditorOptions($this->getOptions())); |
|
379 | 379 | return $options; |
380 | 380 | } |
381 | 381 | |
@@ -385,20 +385,20 @@ discard block |
||
385 | 385 | */ |
386 | 386 | protected function parseEditorOptions($string) |
387 | 387 | { |
388 | - $options = []; |
|
389 | - $substrings = preg_split('/,\s*\n|\n/', trim($string)); |
|
388 | + $options=[]; |
|
389 | + $substrings=preg_split('/,\s*\n|\n/', trim($string)); |
|
390 | 390 | foreach($substrings as $bits) |
391 | 391 | { |
392 | - $option = explode(":", $bits, 2); |
|
392 | + $option=explode(":", $bits, 2); |
|
393 | 393 | |
394 | - if(count($option) == 2) |
|
394 | + if(count($option)==2) |
|
395 | 395 | { |
396 | - $value = trim(trim($option[1]), "'\""); |
|
397 | - if (($s = strtolower($value)) === 'false') |
|
398 | - $value = false; |
|
399 | - elseif ($s === 'true') |
|
400 | - $value = true; |
|
401 | - $options[trim($option[0])] = $value; |
|
396 | + $value=trim(trim($option[1]), "'\""); |
|
397 | + if(($s=strtolower($value))==='false') |
|
398 | + $value=false; |
|
399 | + elseif($s==='true') |
|
400 | + $value=true; |
|
401 | + $options[trim($option[0])]=$value; |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | return $options; |
@@ -409,12 +409,12 @@ discard block |
||
409 | 409 | */ |
410 | 410 | protected function getLanguageSuffix($culture) |
411 | 411 | { |
412 | - $app = $this->getApplication()->getGlobalization(); |
|
413 | - if(empty($culture) && ($app !== null)) |
|
414 | - $culture = $app->getCulture(); |
|
415 | - $variants = []; |
|
416 | - if($app !== null) |
|
417 | - $variants = $app->getCultureVariants($culture); |
|
412 | + $app=$this->getApplication()->getGlobalization(); |
|
413 | + if(empty($culture) && ($app!==null)) |
|
414 | + $culture=$app->getCulture(); |
|
415 | + $variants=[]; |
|
416 | + if($app!==null) |
|
417 | + $variants=$app->getCultureVariants($culture); |
|
418 | 418 | |
419 | 419 | foreach($variants as $variant) |
420 | 420 | { |
@@ -84,6 +84,7 @@ |
||
84 | 84 | |
85 | 85 | /** |
86 | 86 | * @param boolean whether there should be a visual separator between the frames. |
87 | + * @param boolean $value |
|
87 | 88 | */ |
88 | 89 | public function setShowBorder($value) |
89 | 90 | { |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function setWidth($value) |
164 | 164 | { |
165 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
166 | - $value = -1; |
|
165 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
166 | + $value=-1; |
|
167 | 167 | $this->setViewState('Width', $value, -1); |
168 | 168 | } |
169 | 169 | |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function setHeight($value) |
182 | 182 | { |
183 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
184 | - $value = -1; |
|
183 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
184 | + $value=-1; |
|
185 | 185 | $this->setViewState('Height', $value, -1); |
186 | 186 | } |
187 | 187 | |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function setMarginWidth($value) |
202 | 202 | { |
203 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
204 | - $value = -1; |
|
203 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
204 | + $value=-1; |
|
205 | 205 | $this->setViewState('MarginWidth', $value, -1); |
206 | 206 | } |
207 | 207 | |
@@ -220,8 +220,8 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public function setMarginHeight($value) |
222 | 222 | { |
223 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
224 | - $value = -1; |
|
223 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
224 | + $value=-1; |
|
225 | 225 | $this->setViewState('MarginHeight', $value, -1); |
226 | 226 | } |
227 | 227 | |
@@ -232,37 +232,37 @@ discard block |
||
232 | 232 | */ |
233 | 233 | protected function addAttributesToRender($writer) |
234 | 234 | { |
235 | - if($this->getID() !== '') |
|
235 | + if($this->getID()!=='') |
|
236 | 236 | $writer->addAttribute('name', $this->getUniqueID()); |
237 | 237 | |
238 | - if(($src = $this->getFrameUrl()) !== '') |
|
238 | + if(($src=$this->getFrameUrl())!=='') |
|
239 | 239 | $writer->addAttribute('src', $src); |
240 | 240 | |
241 | - if(($align = strtolower($this->getAlign())) !== 'notset') |
|
241 | + if(($align=strtolower($this->getAlign()))!=='notset') |
|
242 | 242 | $writer->addAttribute('align', $align); |
243 | 243 | |
244 | - $scrollBars = $this->getScrollBars(); |
|
245 | - if($scrollBars === TInlineFrameScrollBars::None) |
|
244 | + $scrollBars=$this->getScrollBars(); |
|
245 | + if($scrollBars===TInlineFrameScrollBars::None) |
|
246 | 246 | $writer->addAttribute('scrolling', 'no'); |
247 | - elseif($scrollBars === TInlineFrameScrollBars::Both) |
|
247 | + elseif($scrollBars===TInlineFrameScrollBars::Both) |
|
248 | 248 | $writer->addAttribute('scrolling', 'yes'); |
249 | 249 | |
250 | - if (!$this->getShowBorder()) |
|
250 | + if(!$this->getShowBorder()) |
|
251 | 251 | $writer->addAttribute('frameborder', '0'); |
252 | 252 | |
253 | - if(($longdesc = $this->getDescriptionUrl()) !== '') |
|
253 | + if(($longdesc=$this->getDescriptionUrl())!=='') |
|
254 | 254 | $writer->addAttribute('longdesc', $longdesc); |
255 | 255 | |
256 | - if (($width = $this->getWidth()) !== -1) |
|
256 | + if(($width=$this->getWidth())!==-1) |
|
257 | 257 | $writer->addAttribute('width', $width); |
258 | 258 | |
259 | - if (($height = $this->getHeight()) !== -1) |
|
259 | + if(($height=$this->getHeight())!==-1) |
|
260 | 260 | $writer->addAttribute('height', $height); |
261 | 261 | |
262 | - if(($marginheight = $this->getMarginHeight()) !== -1) |
|
262 | + if(($marginheight=$this->getMarginHeight())!==-1) |
|
263 | 263 | $writer->addAttribute('marginheight', $marginheight); |
264 | 264 | |
265 | - if(($marginwidth = $this->getMarginWidth()) !== -1) |
|
265 | + if(($marginwidth=$this->getMarginWidth())!==-1) |
|
266 | 266 | $writer->addAttribute('marginwidth', $marginwidth); |
267 | 267 | |
268 | 268 | parent::addAttributesToRender($writer); |
@@ -182,7 +182,7 @@ |
||
182 | 182 | * Returns the value of the TSlider control. |
183 | 183 | * This method is required by {@link \Prado\IDataRenderer}. |
184 | 184 | * It is the same as {@link getValue()}. |
185 | - * @return string the value of the TSlider control. |
|
185 | + * @return double the value of the TSlider control. |
|
186 | 186 | * @see getValue |
187 | 187 | */ |
188 | 188 | public function getData() |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | class TSlider extends \Prado\Web\UI\WebControls\TWebControl implements \Prado\Web\UI\IPostBackDataHandler, \Prado\IDataRenderer |
52 | 52 | { |
53 | - const MAX_STEPS = 200; |
|
53 | + const MAX_STEPS=200; |
|
54 | 54 | /** |
55 | 55 | * @var TSliderHandle handle component |
56 | 56 | */ |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | /* |
59 | 59 | * @var boolean Wether the data has changed during postback |
60 | 60 | */ |
61 | - private $_dataChanged = false; |
|
61 | + private $_dataChanged=false; |
|
62 | 62 | /** |
63 | 63 | * @var TSliderClientScript Clients side javascripts |
64 | 64 | */ |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | /** |
152 | 152 | * @return boolean wether to display a progress indicator or not. Defaults to true. |
153 | 153 | */ |
154 | - public function getProgressIndicator () |
|
154 | + public function getProgressIndicator() |
|
155 | 155 | { |
156 | 156 | return $this->getViewState('ProgressIndicator', true); |
157 | 157 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | /** |
160 | 160 | * @param boolean wether to display a progress indicator or not. Defaults to true. |
161 | 161 | */ |
162 | - public function setProgressIndicator ($value) |
|
162 | + public function setProgressIndicator($value) |
|
163 | 163 | { |
164 | 164 | $this->setViewState('ProgressIndicator', TPropertyValue::ensureBoolean($value), true); |
165 | 165 | } |
@@ -296,11 +296,11 @@ discard block |
||
296 | 296 | */ |
297 | 297 | public function loadPostData($key, $values) |
298 | 298 | { |
299 | - $value = (float)$values[$this->getClientID() . '_1']; |
|
300 | - if($this->getValue() !== $value) |
|
299 | + $value=(float) $values[$this->getClientID().'_1']; |
|
300 | + if($this->getValue()!==$value) |
|
301 | 301 | { |
302 | 302 | $this->setValue($value); |
303 | - return $this->_dataChanged = true; |
|
303 | + return $this->_dataChanged=true; |
|
304 | 304 | } |
305 | 305 | else |
306 | 306 | return false; |
@@ -319,8 +319,8 @@ discard block |
||
319 | 319 | */ |
320 | 320 | public function getClientSide() |
321 | 321 | { |
322 | - if($this->_clientScript === null) |
|
323 | - $this->_clientScript = $this->createClientScript(); |
|
322 | + if($this->_clientScript===null) |
|
323 | + $this->_clientScript=$this->createClientScript(); |
|
324 | 324 | return $this->_clientScript; |
325 | 325 | } |
326 | 326 | |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | /** |
336 | 336 | * @return string the HTML tag name for slider. Defaults to div. |
337 | 337 | */ |
338 | - public function getTagName () |
|
338 | + public function getTagName() |
|
339 | 339 | { |
340 | 340 | return "div"; |
341 | 341 | } |
@@ -348,10 +348,10 @@ discard block |
||
348 | 348 | { |
349 | 349 | parent::addAttributesToRender($writer); |
350 | 350 | $writer->addAttribute('id', $this->getClientID()); |
351 | - if ($this->getCssClass() === '') |
|
351 | + if($this->getCssClass()==='') |
|
352 | 352 | { |
353 | - $class = ($this->getDirection() == TSliderDirection::Horizontal)?'HorizontalSlider':'VerticalSlider'; |
|
354 | - $writer->addAttribute('class', 'Slider ' . $class); |
|
353 | + $class=($this->getDirection()==TSliderDirection::Horizontal) ? 'HorizontalSlider' : 'VerticalSlider'; |
|
354 | + $writer->addAttribute('class', 'Slider '.$class); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | } |
@@ -363,13 +363,13 @@ discard block |
||
363 | 363 | { |
364 | 364 | // Render the 'Track' |
365 | 365 | $writer->addAttribute('class', 'Track'); |
366 | - $writer->addAttribute('id', $this->getClientID() . '_track'); |
|
366 | + $writer->addAttribute('id', $this->getClientID().'_track'); |
|
367 | 367 | $writer->renderBeginTag('div'); |
368 | 368 | // Render the 'Progress Indicator' |
369 | - if ($this->getProgressIndicator()) |
|
369 | + if($this->getProgressIndicator()) |
|
370 | 370 | { |
371 | 371 | $writer->addAttribute('class', 'Progress'); |
372 | - $writer->addAttribute('id', $this->getClientID() . '_progress'); |
|
372 | + $writer->addAttribute('id', $this->getClientID().'_progress'); |
|
373 | 373 | $writer->renderBeginTag('div'); |
374 | 374 | $writer->renderEndTag(); |
375 | 375 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | |
395 | 395 | // Render the 'Handle' |
396 | 396 | $writer->addAttribute('class', 'Handle'); |
397 | - $writer->addAttribute('id', $this->getClientID() . '_handle'); |
|
397 | + $writer->addAttribute('id', $this->getClientID().'_handle'); |
|
398 | 398 | $writer->renderBeginTag('div'); |
399 | 399 | $writer->renderEndTag(); |
400 | 400 | } |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | * This method is invoked right before the control rendering, if the control is visible. |
404 | 404 | * @param mixed event parameter |
405 | 405 | */ |
406 | - public function onPreRender ($param) |
|
406 | + public function onPreRender($param) |
|
407 | 407 | { |
408 | 408 | parent::onPreRender($param); |
409 | 409 | $this->registerStyleSheet(); |
@@ -418,12 +418,12 @@ discard block |
||
418 | 418 | */ |
419 | 419 | protected function registerStyleSheet() |
420 | 420 | { |
421 | - if(($url = $this->getCssUrl()) === '') |
|
421 | + if(($url=$this->getCssUrl())==='') |
|
422 | 422 | { |
423 | - $manager = $this->getApplication()->getAssetManager(); |
|
423 | + $manager=$this->getApplication()->getAssetManager(); |
|
424 | 424 | // publish the assets |
425 | - $url = $manager->publishFilePath(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'TSlider'); |
|
426 | - $url .= '/TSlider.css'; |
|
425 | + $url=$manager->publishFilePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'TSlider'); |
|
426 | + $url.='/TSlider.css'; |
|
427 | 427 | } |
428 | 428 | $this->getPage()->getClientScript()->registerStyleSheetFile($url, $url); |
429 | 429 | } |
@@ -433,11 +433,11 @@ discard block |
||
433 | 433 | */ |
434 | 434 | protected function registerSliderClientScript() |
435 | 435 | { |
436 | - $page = $this->getPage(); |
|
437 | - $cs = $page->getClientScript(); |
|
436 | + $page=$this->getPage(); |
|
437 | + $cs=$page->getClientScript(); |
|
438 | 438 | $cs->registerPradoScript("slider"); |
439 | - $id = $this->getClientID(); |
|
440 | - $cs->registerHiddenField($id . '_1', $this->getValue()); |
|
439 | + $id=$this->getClientID(); |
|
440 | + $cs->registerHiddenField($id.'_1', $this->getValue()); |
|
441 | 441 | $page->registerRequiresPostData($this); |
442 | 442 | $cs->registerPostBackControl($this->getClientClassName(), $this->getSliderOptions()); |
443 | 443 | } |
@@ -449,50 +449,50 @@ discard block |
||
449 | 449 | protected function getSliderOptions() |
450 | 450 | { |
451 | 451 | // PostBack Options : |
452 | - $options['ID'] = $this->getClientID(); |
|
453 | - $options['EventTarget'] = $this->getUniqueID(); |
|
454 | - $options['AutoPostBack'] = $this->getAutoPostBack(); |
|
452 | + $options['ID']=$this->getClientID(); |
|
453 | + $options['EventTarget']=$this->getUniqueID(); |
|
454 | + $options['AutoPostBack']=$this->getAutoPostBack(); |
|
455 | 455 | |
456 | 456 | // Slider Control options |
457 | - $minValue = $this->getMinValue(); |
|
458 | - $maxValue = $this->getMaxValue(); |
|
459 | - $options['axis'] = strtolower($this->getDirection()); |
|
460 | - $options['maximum'] = $maxValue; |
|
461 | - $options['minimum'] = $minValue; |
|
462 | - $options['range'] = [$minValue, $maxValue]; |
|
463 | - $options['sliderValue'] = $this->getValue(); |
|
464 | - $options['disabled'] = !$this->getEnabled(); |
|
465 | - $values = $this->getValues(); |
|
466 | - if (!empty($values)) |
|
457 | + $minValue=$this->getMinValue(); |
|
458 | + $maxValue=$this->getMaxValue(); |
|
459 | + $options['axis']=strtolower($this->getDirection()); |
|
460 | + $options['maximum']=$maxValue; |
|
461 | + $options['minimum']=$minValue; |
|
462 | + $options['range']=[$minValue, $maxValue]; |
|
463 | + $options['sliderValue']=$this->getValue(); |
|
464 | + $options['disabled']=!$this->getEnabled(); |
|
465 | + $values=$this->getValues(); |
|
466 | + if(!empty($values)) |
|
467 | 467 | { |
468 | 468 | // Values are provided. Check if min/max are present in them |
469 | - if (!in_array($minValue, $values)) $values[] = $minValue; |
|
470 | - if (!in_array($maxValue, $values)) $values[] = $maxValue; |
|
469 | + if(!in_array($minValue, $values)) $values[]=$minValue; |
|
470 | + if(!in_array($maxValue, $values)) $values[]=$maxValue; |
|
471 | 471 | // Remove all values outsize the range [min..max] |
472 | - foreach ($values as $idx => $value) |
|
472 | + foreach($values as $idx => $value) |
|
473 | 473 | { |
474 | - if ($value < $minValue) unset($values[$idx]); |
|
475 | - if ($value > $maxValue) unset($values[$idx]); |
|
474 | + if($value < $minValue) unset($values[$idx]); |
|
475 | + if($value > $maxValue) unset($values[$idx]); |
|
476 | 476 | } |
477 | 477 | } |
478 | 478 | else |
479 | 479 | { |
480 | 480 | // Values are not provided, generate automatically using stepsize |
481 | - $step = $this->getStepSize(); |
|
481 | + $step=$this->getStepSize(); |
|
482 | 482 | // We want at most self::MAX_STEPS values, so, change the step if necessary |
483 | - if (($maxValue - $minValue) / $step > self::MAX_STEPS) |
|
483 | + if(($maxValue - $minValue) / $step > self::MAX_STEPS) |
|
484 | 484 | { |
485 | - $step = ($maxValue - $minValue) / self::MAX_STEPS; |
|
485 | + $step=($maxValue - $minValue) / self::MAX_STEPS; |
|
486 | 486 | } |
487 | - $values = []; |
|
488 | - for ($i = $minValue;$i <= $maxValue;$i += $step) |
|
489 | - $values[] = $i; |
|
487 | + $values=[]; |
|
488 | + for($i=$minValue; $i <= $maxValue; $i+=$step) |
|
489 | + $values[]=$i; |
|
490 | 490 | // Add max if it's not in the array because of step |
491 | - if (!in_array($maxValue, $values)) $values[] = $maxValue; |
|
491 | + if(!in_array($maxValue, $values)) $values[]=$maxValue; |
|
492 | 492 | } |
493 | - $options['values'] = $values; |
|
494 | - if($this->_clientScript !== null) |
|
495 | - $options = array_merge($options, $this->_clientScript->getOptions()->toArray()); |
|
493 | + $options['values']=$values; |
|
494 | + if($this->_clientScript!==null) |
|
495 | + $options=array_merge($options, $this->_clientScript->getOptions()->toArray()); |
|
496 | 496 | return $options; |
497 | 497 | } |
498 | 498 | } |
499 | 499 | \ No newline at end of file |
@@ -301,8 +301,7 @@ discard block |
||
301 | 301 | { |
302 | 302 | $this->setValue($value); |
303 | 303 | return $this->_dataChanged = true; |
304 | - } |
|
305 | - else |
|
304 | + } else |
|
306 | 305 | return false; |
307 | 306 | } |
308 | 307 | |
@@ -474,8 +473,7 @@ discard block |
||
474 | 473 | if ($value < $minValue) unset($values[$idx]); |
475 | 474 | if ($value > $maxValue) unset($values[$idx]); |
476 | 475 | } |
477 | - } |
|
478 | - else |
|
476 | + } else |
|
479 | 477 | { |
480 | 478 | // Values are not provided, generate automatically using stepsize |
481 | 479 | $step = $this->getStepSize(); |
@@ -42,6 +42,7 @@ |
||
42 | 42 | /** |
43 | 43 | * Finds the index of the tab view whose ID is the same as the one being looked for. |
44 | 44 | * @param string the explicit ID of the tab view to be looked for |
45 | + * @param string $id |
|
45 | 46 | * @return integer the index of the tab view found, -1 if not found. |
46 | 47 | */ |
47 | 48 | public function findIndexByID($id) |
@@ -49,7 +49,7 @@ |
||
49 | 49 | { |
50 | 50 | foreach($this as $index => $view) |
51 | 51 | { |
52 | - if($view->getID(false) === $id) |
|
52 | + if($view->getID(false)===$id) |
|
53 | 53 | return $index; |
54 | 54 | } |
55 | 55 | return -1; |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | /** |
286 | 286 | * Returns the value to be validated. |
287 | 287 | * This methid is required by \Prado\Web\UI\IValidatable interface. |
288 | - * @return mixed the value of the property to be validated. |
|
288 | + * @return string the value of the property to be validated. |
|
289 | 289 | */ |
290 | 290 | public function getValidationPropertyValue() |
291 | 291 | { |
@@ -390,6 +390,7 @@ discard block |
||
390 | 390 | * An automatic postback to the server will occur whenever the user |
391 | 391 | * modifies the text in the TTextBox control and then tabs out of the component. |
392 | 392 | * @param boolean the value indicating if postback automatically |
393 | + * @param boolean $value |
|
393 | 394 | */ |
394 | 395 | public function setAutoPostBack($value) |
395 | 396 | { |
@@ -473,6 +474,7 @@ discard block |
||
473 | 474 | |
474 | 475 | /** |
475 | 476 | * @param boolean whether the textbox is read only |
477 | + * @param boolean $value |
|
476 | 478 | */ |
477 | 479 | public function setReadOnly($value) |
478 | 480 | { |
@@ -60,28 +60,28 @@ discard block |
||
60 | 60 | /** |
61 | 61 | * Default number of rows (for MultiLine text box) |
62 | 62 | */ |
63 | - const DEFAULT_ROWS = 4; |
|
63 | + const DEFAULT_ROWS=4; |
|
64 | 64 | /** |
65 | 65 | * Default number of columns (for MultiLine text box) |
66 | 66 | */ |
67 | - const DEFAULT_COLUMNS = 20; |
|
67 | + const DEFAULT_COLUMNS=20; |
|
68 | 68 | /** |
69 | 69 | * @var mixed safe text parser |
70 | 70 | */ |
71 | - private static $_safeTextParser = null; |
|
71 | + private static $_safeTextParser=null; |
|
72 | 72 | /** |
73 | 73 | * @var string safe textbox content with javascript stripped off |
74 | 74 | */ |
75 | 75 | private $_safeText; |
76 | - private $_dataChanged = false; |
|
77 | - private $_isValid = true; |
|
76 | + private $_dataChanged=false; |
|
77 | + private $_isValid=true; |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * @return string tag name of the textbox |
81 | 81 | */ |
82 | 82 | protected function getTagName() |
83 | 83 | { |
84 | - return ($this->getTextMode() === 'MultiLine')?'textarea':'input'; |
|
84 | + return ($this->getTextMode()==='MultiLine') ? 'textarea' : 'input'; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -107,16 +107,16 @@ discard block |
||
107 | 107 | */ |
108 | 108 | protected function addAttributesToRender($writer) |
109 | 109 | { |
110 | - $page = $this->getPage(); |
|
110 | + $page=$this->getPage(); |
|
111 | 111 | $page->ensureRenderInForm($this); |
112 | - if(($uid = $this->getUniqueID()) !== '') |
|
112 | + if(($uid=$this->getUniqueID())!=='') |
|
113 | 113 | $writer->addAttribute('name', $uid); |
114 | - if(($textMode = $this->getTextMode()) === TTextBoxMode::MultiLine) |
|
114 | + if(($textMode=$this->getTextMode())===TTextBoxMode::MultiLine) |
|
115 | 115 | { |
116 | - if(($rows = $this->getRows()) <= 0) |
|
117 | - $rows = self::DEFAULT_ROWS; |
|
118 | - if(($cols = $this->getColumns()) <= 0) |
|
119 | - $cols = self::DEFAULT_COLUMNS; |
|
116 | + if(($rows=$this->getRows()) <= 0) |
|
117 | + $rows=self::DEFAULT_ROWS; |
|
118 | + if(($cols=$this->getColumns()) <= 0) |
|
119 | + $cols=self::DEFAULT_COLUMNS; |
|
120 | 120 | $writer->addAttribute('rows', "$rows"); |
121 | 121 | $writer->addAttribute('cols', "$cols"); |
122 | 122 | if(!$this->getWrap()) |
@@ -174,42 +174,42 @@ discard block |
||
174 | 174 | break; |
175 | 175 | } |
176 | 176 | |
177 | - if(($text = $this->getText()) !== '' && ($textMode !== TTextBoxMode::Password || $this->getPersistPassword())) |
|
177 | + if(($text=$this->getText())!=='' && ($textMode!==TTextBoxMode::Password || $this->getPersistPassword())) |
|
178 | 178 | $writer->addAttribute('value', $text); |
179 | 179 | |
180 | - if(($act = $this->getAutoCompleteType()) !== 'None') |
|
180 | + if(($act=$this->getAutoCompleteType())!=='None') |
|
181 | 181 | { |
182 | - if($act === 'Disabled') |
|
182 | + if($act==='Disabled') |
|
183 | 183 | $writer->addAttribute('autocomplete', 'off'); |
184 | - elseif($act === 'Search') |
|
184 | + elseif($act==='Search') |
|
185 | 185 | $writer->addAttribute('vcard_name', 'search'); |
186 | - elseif($act === 'HomeCountryRegion') |
|
186 | + elseif($act==='HomeCountryRegion') |
|
187 | 187 | $writer->addAttribute('vcard_name', 'HomeCountry'); |
188 | - elseif($act === 'BusinessCountryRegion') |
|
188 | + elseif($act==='BusinessCountryRegion') |
|
189 | 189 | $writer->addAttribute('vcard_name', 'BusinessCountry'); |
190 | 190 | else |
191 | 191 | { |
192 | - if(strpos($act, 'Business') === 0) |
|
193 | - $act = 'Business' . '.' . substr($act, 8); |
|
194 | - elseif(strpos($act, 'Home') === 0) |
|
195 | - $act = 'Home' . '.' . substr($act, 4); |
|
196 | - $writer->addAttribute('vcard_name', 'vCard.' . $act); |
|
192 | + if(strpos($act, 'Business')===0) |
|
193 | + $act='Business'.'.'.substr($act, 8); |
|
194 | + elseif(strpos($act, 'Home')===0) |
|
195 | + $act='Home'.'.'.substr($act, 4); |
|
196 | + $writer->addAttribute('vcard_name', 'vCard.'.$act); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
200 | - if(($cols = $this->getColumns()) > 0) |
|
200 | + if(($cols=$this->getColumns()) > 0) |
|
201 | 201 | $writer->addAttribute('size', "$cols"); |
202 | - if(($maxLength = $this->getMaxLength()) > 0) |
|
202 | + if(($maxLength=$this->getMaxLength()) > 0) |
|
203 | 203 | $writer->addAttribute('maxlength', "$maxLength"); |
204 | 204 | } |
205 | 205 | if($this->getReadOnly()) |
206 | 206 | $writer->addAttribute('readonly', 'readonly'); |
207 | - $isEnabled = $this->getEnabled(true); |
|
207 | + $isEnabled=$this->getEnabled(true); |
|
208 | 208 | if(!$isEnabled && $this->getEnabled()) // in this case parent will not render 'disabled' |
209 | 209 | $writer->addAttribute('disabled', 'disabled'); |
210 | 210 | if($isEnabled |
211 | 211 | && $this->getEnableClientScript() |
212 | - && ($this->getAutoPostBack() || $textMode === TTextBoxMode::SingleLine) |
|
212 | + && ($this->getAutoPostBack() || $textMode===TTextBoxMode::SingleLine) |
|
213 | 213 | && $page->getClientSupportsJavaScript()) |
214 | 214 | { |
215 | 215 | $this->renderClientControlScript($writer); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | protected function renderClientControlScript($writer) |
224 | 224 | { |
225 | 225 | $writer->addAttribute('id', $this->getClientID()); |
226 | - $cs = $this->getPage()->getClientScript(); |
|
226 | + $cs=$this->getPage()->getClientScript(); |
|
227 | 227 | $cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
228 | 228 | } |
229 | 229 | |
@@ -243,12 +243,12 @@ discard block |
||
243 | 243 | */ |
244 | 244 | protected function getPostBackOptions() |
245 | 245 | { |
246 | - $options['ID'] = $this->getClientID(); |
|
247 | - $options['EventTarget'] = $this->getUniqueID(); |
|
248 | - $options['AutoPostBack'] = $this->getAutoPostBack(); |
|
249 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
250 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
251 | - $options['TextMode'] = $this->getTextMode(); |
|
246 | + $options['ID']=$this->getClientID(); |
|
247 | + $options['EventTarget']=$this->getUniqueID(); |
|
248 | + $options['AutoPostBack']=$this->getAutoPostBack(); |
|
249 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
250 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
251 | + $options['TextMode']=$this->getTextMode(); |
|
252 | 252 | return $options; |
253 | 253 | } |
254 | 254 | |
@@ -261,13 +261,13 @@ discard block |
||
261 | 261 | */ |
262 | 262 | public function loadPostData($key, $values) |
263 | 263 | { |
264 | - $value = $values[$key]; |
|
264 | + $value=$values[$key]; |
|
265 | 265 | if($this->getAutoTrim()) |
266 | - $value = trim($value); |
|
267 | - if(!$this->getReadOnly() && $this->getText() !== $value) |
|
266 | + $value=trim($value); |
|
267 | + if(!$this->getReadOnly() && $this->getText()!==$value) |
|
268 | 268 | { |
269 | 269 | $this->setText($value); |
270 | - return $this->_dataChanged = true; |
|
270 | + return $this->_dataChanged=true; |
|
271 | 271 | } |
272 | 272 | else |
273 | 273 | return false; |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | */ |
308 | 308 | public function setIsValid($value) |
309 | 309 | { |
310 | - $this->_isValid = TPropertyValue::ensureBoolean($value); |
|
310 | + $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | */ |
344 | 344 | public function renderContents($writer) |
345 | 345 | { |
346 | - if($this->getTextMode() === 'MultiLine') |
|
346 | + if($this->getTextMode()==='MultiLine') |
|
347 | 347 | $writer->write(THttpUtility::htmlEncode($this->getText())); |
348 | 348 | } |
349 | 349 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | public function renderBeginTag($writer) |
356 | 356 | { |
357 | 357 | parent::renderBeginTag($writer); |
358 | - if($this->getTextMode() === 'MultiLine') |
|
358 | + if($this->getTextMode()==='MultiLine') |
|
359 | 359 | $writer->write("\n"); |
360 | 360 | } |
361 | 361 | |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | public function setText($value) |
529 | 529 | { |
530 | 530 | $this->setViewState('Text', TPropertyValue::ensureString($value), ''); |
531 | - $this->_safeText = null; |
|
531 | + $this->_safeText=null; |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | /** |
@@ -562,8 +562,8 @@ discard block |
||
562 | 562 | */ |
563 | 563 | public function getSafeText() |
564 | 564 | { |
565 | - if($this->_safeText === null) |
|
566 | - $this->_safeText = $this->getSafeTextParser()->purify($this->getText()); |
|
565 | + if($this->_safeText===null) |
|
566 | + $this->_safeText=$this->getSafeTextParser()->purify($this->getText()); |
|
567 | 567 | return $this->_safeText; |
568 | 568 | } |
569 | 569 | |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | protected function getSafeTextParser() |
574 | 574 | { |
575 | 575 | if(!self::$_safeTextParser) |
576 | - self::$_safeTextParser = new \HTMLPurifier($this->getConfig()); |
|
576 | + self::$_safeTextParser=new \HTMLPurifier($this->getConfig()); |
|
577 | 577 | return self::$_safeTextParser; |
578 | 578 | } |
579 | 579 | |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | */ |
643 | 643 | public function getConfig() |
644 | 644 | { |
645 | - $config = $this->getViewState('Config', null); |
|
646 | - return ($config === null) ? \HTMLPurifier_Config::createDefault() : $config; |
|
645 | + $config=$this->getViewState('Config', null); |
|
646 | + return ($config===null) ? \HTMLPurifier_Config::createDefault() : $config; |
|
647 | 647 | } |
648 | 648 | } |
@@ -121,8 +121,7 @@ discard block |
||
121 | 121 | $writer->addAttribute('cols', "$cols"); |
122 | 122 | if(!$this->getWrap()) |
123 | 123 | $writer->addAttribute('wrap', 'off'); |
124 | - } |
|
125 | - else |
|
124 | + } else |
|
126 | 125 | { |
127 | 126 | switch($textMode) |
128 | 127 | { |
@@ -268,8 +267,7 @@ discard block |
||
268 | 267 | { |
269 | 268 | $this->setText($value); |
270 | 269 | return $this->_dataChanged = true; |
271 | - } |
|
272 | - else |
|
270 | + } else |
|
273 | 271 | return false; |
274 | 272 | } |
275 | 273 |
@@ -138,8 +138,7 @@ |
||
138 | 138 | $ordering[$subs[1][0]] = $subs[2][0]; |
139 | 139 | } |
140 | 140 | //else what? |
141 | - } |
|
142 | - else |
|
141 | + } else |
|
143 | 142 | $ordering[trim($part)] = 'ASC'; |
144 | 143 | } |
145 | 144 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | { |
36 | 36 | if($column->hasSequence()) |
37 | 37 | { |
38 | - $command = $this->getDbConnection()->createCommand('SELECT @@Identity'); |
|
38 | + $command=$this->getDbConnection()->createCommand('SELECT @@Identity'); |
|
39 | 39 | return intval($command->queryScalar()); |
40 | 40 | } |
41 | 41 | } |
@@ -81,14 +81,14 @@ discard block |
||
81 | 81 | * @param integer row offset, -1 to ignore offset. |
82 | 82 | * @return string SQL with limit and offset. |
83 | 83 | */ |
84 | - public function applyLimitOffset($sql, $limit = -1, $offset = -1) |
|
84 | + public function applyLimitOffset($sql, $limit=-1, $offset=-1) |
|
85 | 85 | { |
86 | - $limit = $limit !== null ? intval($limit) : -1; |
|
87 | - $offset = $offset !== null ? intval($offset) : -1; |
|
88 | - if ($limit > 0 && $offset <= 0) //just limit |
|
89 | - $sql = preg_replace('/^([\s(])*SELECT( DISTINCT)?(?!\s*TOP\s*\()/i', "\\1SELECT\\2 TOP $limit", $sql); |
|
86 | + $limit=$limit!==null ? intval($limit) : -1; |
|
87 | + $offset=$offset!==null ? intval($offset) : -1; |
|
88 | + if($limit > 0 && $offset <= 0) //just limit |
|
89 | + $sql=preg_replace('/^([\s(])*SELECT( DISTINCT)?(?!\s*TOP\s*\()/i', "\\1SELECT\\2 TOP $limit", $sql); |
|
90 | 90 | elseif($limit > 0 && $offset > 0) |
91 | - $sql = $this->rewriteLimitOffsetSql($sql, $limit, $offset); |
|
91 | + $sql=$this->rewriteLimitOffsetSql($sql, $limit, $offset); |
|
92 | 92 | return $sql; |
93 | 93 | } |
94 | 94 | |
@@ -102,13 +102,13 @@ discard block |
||
102 | 102 | */ |
103 | 103 | protected function rewriteLimitOffsetSql($sql, $limit, $offset) |
104 | 104 | { |
105 | - $fetch = $limit + $offset; |
|
106 | - $sql = preg_replace('/^([\s(])*SELECT( DISTINCT)?(?!\s*TOP\s*\()/i', "\\1SELECT\\2 TOP $fetch", $sql); |
|
107 | - $ordering = $this->findOrdering($sql); |
|
105 | + $fetch=$limit + $offset; |
|
106 | + $sql=preg_replace('/^([\s(])*SELECT( DISTINCT)?(?!\s*TOP\s*\()/i', "\\1SELECT\\2 TOP $fetch", $sql); |
|
107 | + $ordering=$this->findOrdering($sql); |
|
108 | 108 | |
109 | - $orginalOrdering = $this->joinOrdering($ordering); |
|
110 | - $reverseOrdering = $this->joinOrdering($this->reverseDirection($ordering)); |
|
111 | - $sql = "SELECT * FROM (SELECT TOP {$limit} * FROM ($sql) as [__inner top table__] {$reverseOrdering}) as [__outer top table__] {$orginalOrdering}"; |
|
109 | + $orginalOrdering=$this->joinOrdering($ordering); |
|
110 | + $reverseOrdering=$this->joinOrdering($this->reverseDirection($ordering)); |
|
111 | + $sql="SELECT * FROM (SELECT TOP {$limit} * FROM ($sql) as [__inner top table__] {$reverseOrdering}) as [__outer top table__] {$orginalOrdering}"; |
|
112 | 112 | return $sql; |
113 | 113 | } |
114 | 114 | |
@@ -122,25 +122,25 @@ discard block |
||
122 | 122 | { |
123 | 123 | if(!preg_match('/ORDER BY/i', $sql)) |
124 | 124 | return []; |
125 | - $matches = []; |
|
126 | - $ordering = []; |
|
125 | + $matches=[]; |
|
126 | + $ordering=[]; |
|
127 | 127 | preg_match_all('/(ORDER BY)[\s"\[](.*)(ASC|DESC)?(?:[\s"\[]|$|COMPUTE|FOR)/i', $sql, $matches); |
128 | 128 | if(count($matches) > 1 && count($matches[2]) > 0) |
129 | 129 | { |
130 | - $parts = explode(',', $matches[2][0]); |
|
130 | + $parts=explode(',', $matches[2][0]); |
|
131 | 131 | foreach($parts as $part) |
132 | 132 | { |
133 | - $subs = []; |
|
133 | + $subs=[]; |
|
134 | 134 | if(preg_match_all('/(.*)[\s"\]](ASC|DESC)$/i', trim($part), $subs)) |
135 | 135 | { |
136 | 136 | if(count($subs) > 1 && count($subs[2]) > 0) |
137 | 137 | { |
138 | - $ordering[$subs[1][0]] = $subs[2][0]; |
|
138 | + $ordering[$subs[1][0]]=$subs[2][0]; |
|
139 | 139 | } |
140 | 140 | //else what? |
141 | 141 | } |
142 | 142 | else |
143 | - $ordering[trim($part)] = 'ASC'; |
|
143 | + $ordering[trim($part)]='ASC'; |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | return $ordering; |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | { |
155 | 155 | if(count($orders) > 0) |
156 | 156 | { |
157 | - $str = []; |
|
157 | + $str=[]; |
|
158 | 158 | foreach($orders as $column => $direction) |
159 | - $str[] = $column . ' ' . $direction; |
|
160 | - return 'ORDER BY ' . implode(', ', $str); |
|
159 | + $str[]=$column.' '.$direction; |
|
160 | + return 'ORDER BY '.implode(', ', $str); |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | protected function reverseDirection($orders) |
169 | 169 | { |
170 | 170 | foreach($orders as $column => $direction) |
171 | - $orders[$column] = strtolower(trim($direction)) === 'desc' ? 'ASC' : 'DESC'; |
|
171 | + $orders[$column]=strtolower(trim($direction))==='desc' ? 'ASC' : 'DESC'; |
|
172 | 172 | return $orders; |
173 | 173 | } |
174 | 174 | } |