@@ -95,8 +95,7 @@ |
||
95 | 95 | if($this->getHasPreRendered()) { |
96 | 96 | $this->renderRepeater($writer); |
97 | 97 | if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(),$writer); |
98 | - } |
|
99 | - else { |
|
98 | + } else { |
|
100 | 99 | $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
101 | 100 | } |
102 | 101 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | parent::setDataSource($value); |
58 | 58 | if($this->getActiveControl()->canUpdateClientSide()) { |
59 | 59 | $this->renderPager(); |
60 | - $this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter()); |
|
60 | + $this->getPage()->getAdapter()->registerControlToRender($this, $this->getResponse()->createHtmlWriter()); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | public function render($writer) { |
95 | 95 | if($this->getHasPreRendered()) { |
96 | 96 | $this->renderRepeater($writer); |
97 | - if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(),$writer); |
|
97 | + if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(), $writer); |
|
98 | 98 | } |
99 | 99 | else { |
100 | - $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
|
100 | + $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | foreach($pager as $item) { |
112 | 112 | if($item->ControlToPaginate==$this->ID) { |
113 | 113 | $writer=$this->getResponse()->createHtmlWriter(); |
114 | - $this->getPage()->getAdapter()->registerControlToRender($item,$writer); |
|
114 | + $this->getPage()->getAdapter()->registerControlToRender($item, $writer); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param THtmlWriter writer for the rendering purpose |
124 | 124 | */ |
125 | 125 | private function renderRepeater($writer) { |
126 | - $writer->addAttribute('id',$this->getSurroundingTagID()); |
|
126 | + $writer->addAttribute('id', $this->getSurroundingTagID()); |
|
127 | 127 | $writer->renderBeginTag($this->getSurroundingTag()); |
128 | 128 | parent::render($writer); |
129 | 129 | $writer->renderEndTag(); |
@@ -424,13 +424,11 @@ discard block |
||
424 | 424 | { |
425 | 425 | $boundary = $this->getRenderedContentBoundary($content); |
426 | 426 | $content = null; |
427 | - } |
|
428 | - else if($content instanceof THtmlWriter) |
|
427 | + } else if($content instanceof THtmlWriter) |
|
429 | 428 | { |
430 | 429 | $boundary = $this->getResponseContentBoundary($content); |
431 | 430 | $content = null; |
432 | - } |
|
433 | - else |
|
431 | + } else |
|
434 | 432 | $boundary = null; |
435 | 433 | |
436 | 434 | $this->callClientFunction('Prado.Element.replace', array($element, $content, $boundary, $self)); |
@@ -477,8 +475,7 @@ discard block |
||
477 | 475 | if($content instanceof TControl) |
478 | 476 | { |
479 | 477 | $boundary = $this->getRenderedContentBoundary($content); |
480 | - } |
|
481 | - elseif($content instanceof THtmlWriter) |
|
478 | + } elseif($content instanceof THtmlWriter) |
|
482 | 479 | { |
483 | 480 | $boundary = $this->getResponseContentBoundary($content); |
484 | 481 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function __construct() |
70 | 70 | { |
71 | - $this->_actions = new TList; |
|
71 | + $this->_actions=new TList; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | public function callClientFunction($function, $params=array()) |
89 | 89 | { |
90 | 90 | if(!is_array($params)) |
91 | - $params = array($params); |
|
91 | + $params=array($params); |
|
92 | 92 | |
93 | 93 | if(count($params) > 0) |
94 | 94 | { |
95 | - if ($params[0] instanceof ISurroundable) |
|
96 | - $params[0] = $params[0]->getSurroundingTagID(); |
|
95 | + if($params[0] instanceof ISurroundable) |
|
96 | + $params[0]=$params[0]->getSurroundingTagID(); |
|
97 | 97 | elseif($params[0] instanceof TControl) |
98 | - $params[0] = $params[0]->getClientID(); |
|
98 | + $params[0]=$params[0]->getClientID(); |
|
99 | 99 | } |
100 | 100 | $this->_actions->add(array($function => $params)); |
101 | 101 | } |
@@ -108,13 +108,13 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function jQuery($element, $method, $params=array()) |
110 | 110 | { |
111 | - if ($element instanceof ISurroundable) |
|
112 | - $element = $element->getSurroundingTagID(); |
|
111 | + if($element instanceof ISurroundable) |
|
112 | + $element=$element->getSurroundingTagID(); |
|
113 | 113 | elseif($element instanceof TControl) |
114 | - $element = $element->getClientID(); |
|
114 | + $element=$element->getClientID(); |
|
115 | 115 | |
116 | 116 | if(!is_array($params)) |
117 | - $params = array($params); |
|
117 | + $params=array($params); |
|
118 | 118 | |
119 | 119 | $this->_actions->add(array('Prado.Element.j' => array($element, $method, $params))); |
120 | 120 | } |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function select($control, $method='Value', $value=null, $type=null) |
149 | 149 | { |
150 | - $method = TPropertyValue::ensureEnum($method, |
|
150 | + $method=TPropertyValue::ensureEnum($method, |
|
151 | 151 | 'Value', 'Index', 'Clear', 'Indices', 'Values', 'All', 'Invert'); |
152 | - $type = ($type===null) ? $this->getSelectionControlType($control) : $type; |
|
153 | - $total = $this->getSelectionControlIsListType($control) ? $control->getItemCount() : 1; |
|
152 | + $type=($type===null) ? $this->getSelectionControlType($control) : $type; |
|
153 | + $total=$this->getSelectionControlIsListType($control) ? $control->getItemCount() : 1; |
|
154 | 154 | |
155 | 155 | // pass the ID to avoid getting the surrounding elements (ISurroundable) |
156 | 156 | if($control instanceof TControl) |
157 | - $control = $control->getClientID(); |
|
157 | + $control=$control->getClientID(); |
|
158 | 158 | |
159 | 159 | $this->callClientFunction('Prado.Element.select', |
160 | 160 | array($control, $type.$method, $value, $total)); |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | public function setAttribute($control, $name, $value) |
215 | 215 | { |
216 | 216 | // Attributes should be applied on Surrounding tag, except for 'disabled' attribute |
217 | - if ($control instanceof ISurroundable && strtolower($name)!=='disabled') |
|
217 | + if($control instanceof ISurroundable && strtolower($name)!=='disabled') |
|
218 | 218 | $control=$control->getSurroundingTagID(); |
219 | - $this->callClientFunction('Prado.Element.setAttribute',array($control, $name, $value)); |
|
219 | + $this->callClientFunction('Prado.Element.setAttribute', array($control, $name, $value)); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -226,25 +226,25 @@ discard block |
||
226 | 226 | */ |
227 | 227 | public function setListItems($control, $items) |
228 | 228 | { |
229 | - $options = array(); |
|
229 | + $options=array(); |
|
230 | 230 | if($control instanceof TListControl) |
231 | 231 | { |
232 | - $promptText = $control->getPromptText(); |
|
233 | - $promptValue = $control->getPromptValue(); |
|
232 | + $promptText=$control->getPromptText(); |
|
233 | + $promptValue=$control->getPromptValue(); |
|
234 | 234 | |
235 | 235 | if($promptValue==='') |
236 | - $promptValue = $promptText; |
|
236 | + $promptValue=$promptText; |
|
237 | 237 | |
238 | 238 | if($promptValue!=='') |
239 | - $options[] = array($promptText, $promptValue); |
|
239 | + $options[]=array($promptText, $promptValue); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | foreach($items as $item) |
243 | 243 | { |
244 | 244 | if($item->getHasAttributes()) |
245 | - $options[] = array($item->getText(),$item->getValue(), $item->getAttributes()->itemAt('Group')); |
|
245 | + $options[]=array($item->getText(), $item->getValue(), $item->getAttributes()->itemAt('Group')); |
|
246 | 246 | else |
247 | - $options[] = array($item->getText(),$item->getValue()); |
|
247 | + $options[]=array($item->getText(), $item->getValue()); |
|
248 | 248 | } |
249 | 249 | $this->callClientFunction('Prado.Element.setOptions', array($control, $options)); |
250 | 250 | } |
@@ -422,16 +422,16 @@ discard block |
||
422 | 422 | { |
423 | 423 | if($content instanceof TControl) |
424 | 424 | { |
425 | - $boundary = $this->getRenderedContentBoundary($content); |
|
426 | - $content = null; |
|
425 | + $boundary=$this->getRenderedContentBoundary($content); |
|
426 | + $content=null; |
|
427 | 427 | } |
428 | 428 | else if($content instanceof THtmlWriter) |
429 | 429 | { |
430 | - $boundary = $this->getResponseContentBoundary($content); |
|
431 | - $content = null; |
|
430 | + $boundary=$this->getResponseContentBoundary($content); |
|
431 | + $content=null; |
|
432 | 432 | } |
433 | 433 | else |
434 | - $boundary = null; |
|
434 | + $boundary=null; |
|
435 | 435 | |
436 | 436 | $this->callClientFunction('Prado.Element.replace', array($element, $content, $boundary, $self)); |
437 | 437 | } |
@@ -456,11 +456,11 @@ discard block |
||
456 | 456 | { |
457 | 457 | if($writer instanceof THtmlWriter) |
458 | 458 | { |
459 | - $boundary = $this->getResponseContentBoundary($writer); |
|
460 | - $content = null; |
|
459 | + $boundary=$this->getResponseContentBoundary($writer); |
|
460 | + $content=null; |
|
461 | 461 | } else { |
462 | - $boundary = null; |
|
463 | - $content = $writer; |
|
462 | + $boundary=null; |
|
463 | + $content=$writer; |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | $this->callClientFunction('Prado.Element.evaluateScript', array($content, $boundary)); |
@@ -476,11 +476,11 @@ discard block |
||
476 | 476 | { |
477 | 477 | if($content instanceof TControl) |
478 | 478 | { |
479 | - $boundary = $this->getRenderedContentBoundary($content); |
|
479 | + $boundary=$this->getRenderedContentBoundary($content); |
|
480 | 480 | } |
481 | 481 | elseif($content instanceof THtmlWriter) |
482 | 482 | { |
483 | - $boundary = $this->getResponseContentBoundary($content); |
|
483 | + $boundary=$this->getResponseContentBoundary($content); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | $this->callClientFunction('Prado.Element.appendScriptBlock', array($boundary)); |
@@ -496,8 +496,8 @@ discard block |
||
496 | 496 | */ |
497 | 497 | private function getRenderedContentBoundary($control) |
498 | 498 | { |
499 | - $writer = $this->getResponse()->createHtmlWriter(); |
|
500 | - $adapter = $control->getPage()->getAdapter(); |
|
499 | + $writer=$this->getResponse()->createHtmlWriter(); |
|
500 | + $adapter=$control->getPage()->getAdapter(); |
|
501 | 501 | $adapter->registerControlToRender($control, $writer); |
502 | 502 | return $writer->getWriter()->getBoundary(); |
503 | 503 | } |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | */ |
562 | 562 | public function fadeTo($element, $value, $duration=500) |
563 | 563 | { |
564 | - $value = TPropertyValue::ensureFloat($value); |
|
564 | + $value=TPropertyValue::ensureFloat($value); |
|
565 | 565 | $this->visualEffect('fadeTo', $element, array($duration, $value)); |
566 | 566 | } |
567 | 567 |
@@ -94,6 +94,7 @@ discard block |
||
94 | 94 | * Executes a client-side statement. |
95 | 95 | * @param string javascript function name |
96 | 96 | * @param array list of arguments for the function |
97 | + * @param string $function |
|
97 | 98 | */ |
98 | 99 | public function callClientFunction($function, $params=array()) |
99 | 100 | { |
@@ -154,6 +155,7 @@ discard block |
||
154 | 155 | * @param string selection method |
155 | 156 | * @param string|int the value or index to select/check. |
156 | 157 | * @param string selection control type, either 'check' or 'select' |
158 | + * @param string $type |
|
157 | 159 | */ |
158 | 160 | public function select($control, $method='Value', $value=null, $type=null) |
159 | 161 | { |
@@ -423,6 +425,7 @@ discard block |
||
423 | 425 | * @param TControl control element or HTML element id. |
424 | 426 | * @param string HTML fragement or the control to be rendered. |
425 | 427 | * @param boolean whether to fully replace the element or just its inner content. |
428 | + * @param boolean $self |
|
426 | 429 | * @see insertAbout |
427 | 430 | * @see insertBelow |
428 | 431 | * @see insertBefore |
@@ -461,6 +464,7 @@ discard block |
||
461 | 464 | /** |
462 | 465 | * Evaluate a block of javascript enclosed in a boundary. |
463 | 466 | * @param THtmlWriter writer for the content. |
467 | + * @param string $writer |
|
464 | 468 | */ |
465 | 469 | public function evaluateScript($writer) |
466 | 470 | { |
@@ -481,6 +485,7 @@ discard block |
||
481 | 485 | * Similar to to evaluateScript(), but functions declared in the |
482 | 486 | * inline block will be available to page elements. |
483 | 487 | * @param THtmlWriter writer for the content. |
488 | + * @param \Prado\TComponent $content |
|
484 | 489 | */ |
485 | 490 | public function appendScriptBlock($content) |
486 | 491 | { |
@@ -502,6 +507,7 @@ discard block |
||
502 | 507 | * component developers. The render() method is defered to be called in the |
503 | 508 | * TActivePageAdapter class. |
504 | 509 | * @param TControl control to be rendered on callback response. |
510 | + * @param TControl $control |
|
505 | 511 | * @return string the boundary for which the rendered content is wrapped. |
506 | 512 | */ |
507 | 513 | private function getRenderedContentBoundary($control) |
@@ -514,6 +520,7 @@ discard block |
||
514 | 520 | |
515 | 521 | /** |
516 | 522 | * @param THtmlWriter the writer responsible for rendering html content. |
523 | + * @param THtmlWriter $html |
|
517 | 524 | * @return string content boundary. |
518 | 525 | */ |
519 | 526 | private function getResponseContentBoundary($html) |
@@ -533,6 +540,7 @@ discard block |
||
533 | 540 | * @param string visual effect function name. |
534 | 541 | * @param TControl control element or element id |
535 | 542 | * @param array visual effect key-value pair options. |
543 | + * @param string $type |
|
536 | 544 | */ |
537 | 545 | public function visualEffect($type, $element, $options=array()) |
538 | 546 | { |
@@ -640,6 +648,7 @@ discard block |
||
640 | 648 | * @param string visual effect function name. |
641 | 649 | * @param TControl control element or element id |
642 | 650 | * @param array effect options. |
651 | + * @param string $effect |
|
643 | 652 | */ |
644 | 653 | public function juiEffect($element, $effect, $options=array()) |
645 | 654 | { |
@@ -81,8 +81,7 @@ |
||
81 | 81 | $this->_d[]=$item; |
82 | 82 | ++$this->_c; |
83 | 83 | } |
84 | - } |
|
85 | - else if($data!==null) |
|
84 | + } else if($data!==null) |
|
86 | 85 | throw new TInvalidDataTypeException('queue_data_not_iterable'); |
87 | 86 | } |
88 | 87 |
@@ -149,7 +149,7 @@ |
||
149 | 149 | /** |
150 | 150 | * Returns an iterator for traversing the items in the queue. |
151 | 151 | * This method is required by the interface \IteratorAggregate. |
152 | - * @return Iterator an iterator for traversing the items in the queue. |
|
152 | + * @return \ArrayIterator an iterator for traversing the items in the queue. |
|
153 | 153 | */ |
154 | 154 | public function getIterator() |
155 | 155 | { |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function contains($item) |
105 | 105 | { |
106 | - return array_search($item,$this->_d,true)!==false; |
|
106 | + return array_search($item, $this->_d, true)!==false; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | public function enqueue($item) |
144 | 144 | { |
145 | 145 | ++$this->_c; |
146 | - $this->_d[] = $item; |
|
146 | + $this->_d[]=$item; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function getIterator() |
155 | 155 | { |
156 | - return new \ArrayIterator( $this->_d ); |
|
156 | + return new \ArrayIterator($this->_d); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -16,36 +16,36 @@ |
||
16 | 16 | |
17 | 17 | public function generate($sender) |
18 | 18 | { |
19 | - if ($this->IsValid) |
|
19 | + if($this->IsValid) |
|
20 | 20 | { |
21 | - $tableName = $this->table_name->Text; |
|
22 | - $outputFolderNs = $this->output_folder->Text; |
|
23 | - $classPrefix = $this->class_prefix->Text; |
|
24 | - $classSuffix = $this->class_suffix->Text; |
|
21 | + $tableName=$this->table_name->Text; |
|
22 | + $outputFolderNs=$this->output_folder->Text; |
|
23 | + $classPrefix=$this->class_prefix->Text; |
|
24 | + $classSuffix=$this->class_suffix->Text; |
|
25 | 25 | |
26 | 26 | try |
27 | 27 | { |
28 | - $ar_generator = new TWsatARGenerator(); |
|
28 | + $ar_generator=new TWsatARGenerator(); |
|
29 | 29 | $ar_generator->setOpFile($outputFolderNs); |
30 | 30 | $ar_generator->setClasPrefix($classPrefix); |
31 | 31 | $ar_generator->setClassSufix($classSuffix); |
32 | 32 | |
33 | - if ($this->build_rel->Checked) |
|
33 | + if($this->build_rel->Checked) |
|
34 | 34 | $ar_generator->buildRelations(); |
35 | 35 | |
36 | - if ($tableName != "*") |
|
36 | + if($tableName!="*") |
|
37 | 37 | $ar_generator->generate($tableName); |
38 | 38 | else |
39 | 39 | $ar_generator->generateAll(); |
40 | 40 | |
41 | - $this->feedback_panel->CssClass = "green_panel"; |
|
42 | - $this->generation_msg->Text = "The code has been generated successfully."; |
|
43 | - } catch (Exception $ex) |
|
41 | + $this->feedback_panel->CssClass="green_panel"; |
|
42 | + $this->generation_msg->Text="The code has been generated successfully."; |
|
43 | + } catch(Exception $ex) |
|
44 | 44 | { |
45 | - $this->feedback_panel->CssClass = "red_panel"; |
|
46 | - $this->generation_msg->Text = $ex->getMessage(); |
|
45 | + $this->feedback_panel->CssClass="red_panel"; |
|
46 | + $this->generation_msg->Text=$ex->getMessage(); |
|
47 | 47 | } |
48 | - $this->feedback_panel->Visible = true; |
|
48 | + $this->feedback_panel->Visible=true; |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 |
@@ -21,44 +21,44 @@ |
||
21 | 21 | class TWsatGenerateAR extends TPage |
22 | 22 | { |
23 | 23 | |
24 | - public function generate($sender) |
|
25 | - { |
|
26 | - if ($this->IsValid) |
|
27 | - { |
|
28 | - $tableName = $this->table_name->Text; |
|
29 | - $outputFolderNs = $this->output_folder->Text; |
|
30 | - $classPrefix = $this->class_prefix->Text; |
|
31 | - $classSuffix = $this->class_suffix->Text; |
|
24 | + public function generate($sender) |
|
25 | + { |
|
26 | + if ($this->IsValid) |
|
27 | + { |
|
28 | + $tableName = $this->table_name->Text; |
|
29 | + $outputFolderNs = $this->output_folder->Text; |
|
30 | + $classPrefix = $this->class_prefix->Text; |
|
31 | + $classSuffix = $this->class_suffix->Text; |
|
32 | 32 | |
33 | - try |
|
34 | - { |
|
35 | - $ar_generator = new TWsatARGenerator(); |
|
36 | - $ar_generator->setOpFile($outputFolderNs); |
|
37 | - $ar_generator->setClasPrefix($classPrefix); |
|
38 | - $ar_generator->setClassSufix($classSuffix); |
|
33 | + try |
|
34 | + { |
|
35 | + $ar_generator = new TWsatARGenerator(); |
|
36 | + $ar_generator->setOpFile($outputFolderNs); |
|
37 | + $ar_generator->setClasPrefix($classPrefix); |
|
38 | + $ar_generator->setClassSufix($classSuffix); |
|
39 | 39 | |
40 | - if ($this->build_rel->Checked) |
|
41 | - $ar_generator->buildRelations(); |
|
40 | + if ($this->build_rel->Checked) |
|
41 | + $ar_generator->buildRelations(); |
|
42 | 42 | |
43 | - if ($tableName != "*") |
|
44 | - $ar_generator->generate($tableName); |
|
45 | - else |
|
46 | - $ar_generator->generateAll(); |
|
43 | + if ($tableName != "*") |
|
44 | + $ar_generator->generate($tableName); |
|
45 | + else |
|
46 | + $ar_generator->generateAll(); |
|
47 | 47 | |
48 | - $this->feedback_panel->CssClass = "green_panel"; |
|
49 | - $this->generation_msg->Text = "The code has been generated successfully."; |
|
50 | - } catch (Exception $ex) |
|
51 | - { |
|
52 | - $this->feedback_panel->CssClass = "red_panel"; |
|
53 | - $this->generation_msg->Text = $ex->getMessage(); |
|
54 | - } |
|
55 | - $this->feedback_panel->Visible = true; |
|
56 | - } |
|
57 | - } |
|
48 | + $this->feedback_panel->CssClass = "green_panel"; |
|
49 | + $this->generation_msg->Text = "The code has been generated successfully."; |
|
50 | + } catch (Exception $ex) |
|
51 | + { |
|
52 | + $this->feedback_panel->CssClass = "red_panel"; |
|
53 | + $this->generation_msg->Text = $ex->getMessage(); |
|
54 | + } |
|
55 | + $this->feedback_panel->Visible = true; |
|
56 | + } |
|
57 | + } |
|
58 | 58 | |
59 | - public function preview($sender) |
|
60 | - { |
|
61 | - throw new THttpException(500, "Not implemented yet."); |
|
62 | - } |
|
59 | + public function preview($sender) |
|
60 | + { |
|
61 | + throw new THttpException(500, "Not implemented yet."); |
|
62 | + } |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | \ No newline at end of file |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | { |
31 | 31 | $str=''; |
32 | 32 | foreach($files as $file) |
33 | - $str.= self::renderScriptFile($file); |
|
33 | + $str.=self::renderScriptFile($file); |
|
34 | 34 | return $str; |
35 | 35 | } |
36 | 36 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | public static function renderScriptBlocks($scripts) |
53 | 53 | { |
54 | 54 | if(count($scripts)) |
55 | - return "<script type=\"text/javascript\">\n/*<![CDATA[*/\n".implode("\n",$scripts)."\n/*]]>*/\n</script>\n"; |
|
55 | + return "<script type=\"text/javascript\">\n/*<![CDATA[*/\n".implode("\n", $scripts)."\n/*]]>*/\n</script>\n"; |
|
56 | 56 | else |
57 | 57 | return ''; |
58 | 58 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | public static function renderScriptBlocksCallback($scripts) |
66 | 66 | { |
67 | 67 | if(count($scripts)) |
68 | - return implode("\n",$scripts)."\n"; |
|
68 | + return implode("\n", $scripts)."\n"; |
|
69 | 69 | else |
70 | 70 | return ''; |
71 | 71 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public static function quoteString($js) |
91 | 91 | { |
92 | - return self::jsonEncode($js,JSON_HEX_QUOT | JSON_HEX_APOS | JSON_HEX_TAG); |
|
92 | + return self::jsonEncode($js, JSON_HEX_QUOT | JSON_HEX_APOS | JSON_HEX_TAG); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -150,16 +150,16 @@ discard block |
||
150 | 150 | * @param boolean wether to encode empty strings too. Default to false for BC. |
151 | 151 | * @return string the encoded string |
152 | 152 | */ |
153 | - public static function encode($value,$toMap=true,$encodeEmptyStrings=false) |
|
153 | + public static function encode($value, $toMap=true, $encodeEmptyStrings=false) |
|
154 | 154 | { |
155 | 155 | if(is_string($value)) |
156 | 156 | return self::quoteString($value); |
157 | 157 | else if(is_bool($value)) |
158 | - return $value?'true':'false'; |
|
158 | + return $value ? 'true' : 'false'; |
|
159 | 159 | else if(is_array($value)) |
160 | 160 | { |
161 | 161 | $results=''; |
162 | - if(($n=count($value))>0 && array_keys($value)!==range(0,$n-1)) |
|
162 | + if(($n=count($value)) > 0 && array_keys($value)!==range(0, $n - 1)) |
|
163 | 163 | { |
164 | 164 | foreach($value as $k=>$v) |
165 | 165 | { |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | { |
168 | 168 | if($results!=='') |
169 | 169 | $results.=','; |
170 | - $results.="'$k':".self::encode($v,$toMap,$encodeEmptyStrings); |
|
170 | + $results.="'$k':".self::encode($v, $toMap, $encodeEmptyStrings); |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | return '{'.$results.'}'; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | { |
181 | 181 | if($results!=='') |
182 | 182 | $results.=','; |
183 | - $results.=self::encode($v,$toMap, $encodeEmptyStrings); |
|
183 | + $results.=self::encode($v, $toMap, $encodeEmptyStrings); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | return '['.$results.']'; |
@@ -208,10 +208,10 @@ discard block |
||
208 | 208 | } |
209 | 209 | } |
210 | 210 | else if(is_object($value)) |
211 | - if ($value instanceof TJavaScriptLiteral) |
|
211 | + if($value instanceof TJavaScriptLiteral) |
|
212 | 212 | return $value->toJavaScriptLiteral(); |
213 | 213 | else |
214 | - return self::encode(get_object_vars($value),$toMap); |
|
214 | + return self::encode(get_object_vars($value), $toMap); |
|
215 | 215 | else if($value===null) |
216 | 216 | return 'null'; |
217 | 217 | else |
@@ -223,14 +223,14 @@ discard block |
||
223 | 223 | * @param mixed variable to be encoded |
224 | 224 | * @return string encoded string |
225 | 225 | */ |
226 | - public static function jsonEncode($value, $options = 0) |
|
226 | + public static function jsonEncode($value, $options=0) |
|
227 | 227 | { |
228 | - if (($g=Prado::getApplication()->getGlobalization(false))!==null && |
|
228 | + if(($g=Prado::getApplication()->getGlobalization(false))!==null && |
|
229 | 229 | strtoupper($enc=$g->getCharset())!='UTF-8') { |
230 | 230 | self::convertToUtf8($value, $enc); |
231 | 231 | } |
232 | 232 | |
233 | - $s = @json_encode($value,$options); |
|
233 | + $s=@json_encode($value, $options); |
|
234 | 234 | self::checkJsonError(); |
235 | 235 | return $s; |
236 | 236 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | private static function convertToUtf8(&$value, $sourceEncoding) { |
244 | 244 | if(is_string($value)) |
245 | 245 | $value=iconv($sourceEncoding, 'UTF-8', $value); |
246 | - else if (is_array($value)) |
|
246 | + else if(is_array($value)) |
|
247 | 247 | { |
248 | 248 | foreach($value as &$element) |
249 | 249 | self::convertToUtf8($element, $sourceEncoding); |
@@ -258,37 +258,37 @@ discard block |
||
258 | 258 | * @param int recursion depth |
259 | 259 | * @return mixed decoded variable |
260 | 260 | */ |
261 | - public static function jsonDecode($value, $assoc = false, $depth = 512) |
|
261 | + public static function jsonDecode($value, $assoc=false, $depth=512) |
|
262 | 262 | { |
263 | - $s= @json_decode($value, $assoc, $depth); |
|
263 | + $s=@json_decode($value, $assoc, $depth); |
|
264 | 264 | self::checkJsonError(); |
265 | 265 | return $s; |
266 | 266 | } |
267 | 267 | |
268 | 268 | private static function checkJsonError() |
269 | 269 | { |
270 | - switch ($err = json_last_error()) |
|
270 | + switch($err=json_last_error()) |
|
271 | 271 | { |
272 | 272 | case JSON_ERROR_NONE: |
273 | 273 | return; |
274 | 274 | break; |
275 | 275 | case JSON_ERROR_DEPTH: |
276 | - $msg = 'Maximum stack depth exceeded'; |
|
276 | + $msg='Maximum stack depth exceeded'; |
|
277 | 277 | break; |
278 | 278 | case JSON_ERROR_STATE_MISMATCH: |
279 | - $msg = 'Underflow or the modes mismatch'; |
|
279 | + $msg='Underflow or the modes mismatch'; |
|
280 | 280 | break; |
281 | 281 | case JSON_ERROR_CTRL_CHAR: |
282 | - $msg = 'Unexpected control character found'; |
|
282 | + $msg='Unexpected control character found'; |
|
283 | 283 | break; |
284 | 284 | case JSON_ERROR_SYNTAX: |
285 | - $msg = 'Syntax error, malformed JSON'; |
|
285 | + $msg='Syntax error, malformed JSON'; |
|
286 | 286 | break; |
287 | 287 | case JSON_ERROR_UTF8: |
288 | - $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded'; |
|
288 | + $msg='Malformed UTF-8 characters, possibly incorrectly encoded'; |
|
289 | 289 | break; |
290 | 290 | default: |
291 | - $msg = 'Unknown error'; |
|
291 | + $msg='Unknown error'; |
|
292 | 292 | break; |
293 | 293 | } |
294 | 294 | throw new Exception("JSON error ($err): $msg"); |
@@ -171,8 +171,7 @@ discard block |
||
171 | 171 | } |
172 | 172 | } |
173 | 173 | return '{'.$results.'}'; |
174 | - } |
|
175 | - else |
|
174 | + } else |
|
176 | 175 | { |
177 | 176 | foreach($value as $v) |
178 | 177 | { |
@@ -185,8 +184,7 @@ discard block |
||
185 | 184 | } |
186 | 185 | return '['.$results.']'; |
187 | 186 | } |
188 | - } |
|
189 | - else if(is_integer($value)) |
|
187 | + } else if(is_integer($value)) |
|
190 | 188 | return "$value"; |
191 | 189 | else if(is_float($value)) |
192 | 190 | { |
@@ -206,8 +204,7 @@ discard block |
||
206 | 204 | return str_replace($locale['decimal_point'], '.', "$value"); |
207 | 205 | break; |
208 | 206 | } |
209 | - } |
|
210 | - else if(is_object($value)) |
|
207 | + } else if(is_object($value)) |
|
211 | 208 | if ($value instanceof TJavaScriptLiteral) |
212 | 209 | return $value->toJavaScriptLiteral(); |
213 | 210 | else |
@@ -77,6 +77,7 @@ discard block |
||
77 | 77 | /** |
78 | 78 | * Renders javascript block |
79 | 79 | * @param string javascript block |
80 | + * @param string $script |
|
80 | 81 | * @return string rendering result |
81 | 82 | */ |
82 | 83 | public static function renderScriptBlock($script) |
@@ -97,7 +98,7 @@ discard block |
||
97 | 98 | } |
98 | 99 | |
99 | 100 | /** |
100 | - * @return Marks a string as a javascript function. Once marke, the string is considered as a |
|
101 | + * @return TJavaScriptLiteral a string as a javascript function. Once marke, the string is considered as a |
|
101 | 102 | * raw javascript function that is not supposed to be encoded by {@link encode} |
102 | 103 | */ |
103 | 104 | public static function quoteJsLiteral($js) |
@@ -260,6 +261,7 @@ discard block |
||
260 | 261 | * @param string string to be decoded |
261 | 262 | * @param bool whether to convert returned objects to associative arrays |
262 | 263 | * @param int recursion depth |
264 | + * @param string $value |
|
263 | 265 | * @return mixed decoded variable |
264 | 266 | */ |
265 | 267 | public static function jsonDecode($value, $assoc = false, $depth = 512) |
@@ -302,7 +304,8 @@ discard block |
||
302 | 304 | * Minimize the size of a javascript script. |
303 | 305 | * This method is based on Douglas Crockford's JSMin. |
304 | 306 | * @param string code that you want to minimzie |
305 | - * @return minimized version of the code |
|
307 | + * @param string $code |
|
308 | + * @return string version of the code |
|
306 | 309 | */ |
307 | 310 | public static function JSMin($code) |
308 | 311 | { |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | * @return string URL |
65 | 65 | * @see parseUrl |
66 | 66 | */ |
67 | - public function constructUrl($serviceID,$serviceParam,$getItems,$encodeAmpersand,$encodeGetItems) |
|
67 | + public function constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems) |
|
68 | 68 | { |
69 | 69 | $url=$serviceID.'='.urlencode($serviceParam); |
70 | - $amp=$encodeAmpersand?'&':'&'; |
|
70 | + $amp=$encodeAmpersand ? '&' : '&'; |
|
71 | 71 | $request=$this->getRequest(); |
72 | 72 | if(is_array($getItems) || $getItems instanceof Traversable) |
73 | 73 | { |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | switch($request->getUrlFormat()) |
104 | 104 | { |
105 | 105 | case THttpRequestUrlFormat::Path: |
106 | - return $request->getApplicationUrl().'/'.strtr($url,array($amp=>'/','?'=>'/','='=>$request->getUrlParamSeparator())); |
|
106 | + return $request->getApplicationUrl().'/'.strtr($url, array($amp=>'/', '?'=>'/', '='=>$request->getUrlParamSeparator())); |
|
107 | 107 | case THttpRequestUrlFormat::HiddenPath: |
108 | - return rtrim(dirname($request->getApplicationUrl()), '/').'/'.strtr($url,array($amp=>'/','?'=>'/','='=>$request->getUrlParamSeparator())); |
|
108 | + return rtrim(dirname($request->getApplicationUrl()), '/').'/'.strtr($url, array($amp=>'/', '?'=>'/', '='=>$request->getUrlParamSeparator())); |
|
109 | 109 | default: |
110 | 110 | return $request->getApplicationUrl().'?'.$url; |
111 | 111 | } |
@@ -127,24 +127,24 @@ discard block |
||
127 | 127 | public function parseUrl() |
128 | 128 | { |
129 | 129 | $request=$this->getRequest(); |
130 | - $pathInfo=trim($request->getPathInfo(),'/'); |
|
130 | + $pathInfo=trim($request->getPathInfo(), '/'); |
|
131 | 131 | if(($request->getUrlFormat()===THttpRequestUrlFormat::Path || |
132 | 132 | $request->getUrlFormat()===THttpRequestUrlFormat::HiddenPath) && |
133 | 133 | $pathInfo!=='') |
134 | 134 | { |
135 | 135 | $separator=$request->getUrlParamSeparator(); |
136 | - $paths=explode('/',$pathInfo); |
|
136 | + $paths=explode('/', $pathInfo); |
|
137 | 137 | $getVariables=array(); |
138 | 138 | foreach($paths as $path) |
139 | 139 | { |
140 | 140 | if(($path=trim($path))!=='') |
141 | 141 | { |
142 | - if(($pos=strpos($path,$separator))!==false) |
|
142 | + if(($pos=strpos($path, $separator))!==false) |
|
143 | 143 | { |
144 | - $name=substr($path,0,$pos); |
|
145 | - $value=substr($path,$pos+1); |
|
146 | - if(($pos=strpos($name,'[]'))!==false) |
|
147 | - $getVariables[substr($name,0,$pos)][]=$value; |
|
144 | + $name=substr($path, 0, $pos); |
|
145 | + $value=substr($path, $pos + 1); |
|
146 | + if(($pos=strpos($name, '[]'))!==false) |
|
147 | + $getVariables[substr($name, 0, $pos)][]=$value; |
|
148 | 148 | else |
149 | 149 | $getVariables[$name]=$value; |
150 | 150 | } |
@@ -80,12 +80,10 @@ discard block |
||
80 | 80 | $name=urlencode($name.'[]'); |
81 | 81 | foreach($value as $v) |
82 | 82 | $url.=$amp.$name.'='.urlencode($v); |
83 | - } |
|
84 | - else |
|
83 | + } else |
|
85 | 84 | $url.=$amp.urlencode($name).'='.urlencode($value); |
86 | 85 | } |
87 | - } |
|
88 | - else |
|
86 | + } else |
|
89 | 87 | { |
90 | 88 | foreach($getItems as $name=>$value) |
91 | 89 | { |
@@ -93,8 +91,7 @@ discard block |
||
93 | 91 | { |
94 | 92 | foreach($value as $v) |
95 | 93 | $url.=$amp.$name.'[]='.$v; |
96 | - } |
|
97 | - else |
|
94 | + } else |
|
98 | 95 | $url.=$amp.$name.'='.$value; |
99 | 96 | } |
100 | 97 | } |
@@ -147,14 +144,12 @@ discard block |
||
147 | 144 | $getVariables[substr($name,0,$pos)][]=$value; |
148 | 145 | else |
149 | 146 | $getVariables[$name]=$value; |
150 | - } |
|
151 | - else |
|
147 | + } else |
|
152 | 148 | $getVariables[$path]=''; |
153 | 149 | } |
154 | 150 | } |
155 | 151 | return $getVariables; |
156 | - } |
|
157 | - else |
|
152 | + } else |
|
158 | 153 | return array(); |
159 | 154 | } |
160 | 155 | } |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $status=TPropertyValue::ensureInteger($status); |
282 | 282 | if(isset(self::$HTTP_STATUS_CODES[$status])) { |
283 | 283 | $this->_reason=self::$HTTP_STATUS_CODES[$status]; |
284 | - }else{ |
|
284 | + } else{ |
|
285 | 285 | if($reason===null || $reason==='') { |
286 | 286 | throw new TInvalidDataValueException("response_status_reason_missing"); |
287 | 287 | } |
@@ -377,8 +377,7 @@ discard block |
||
377 | 377 | { |
378 | 378 | foreach($headers as $h) |
379 | 379 | header($h); |
380 | - } |
|
381 | - else |
|
380 | + } else |
|
382 | 381 | { |
383 | 382 | header('Pragma: public'); |
384 | 383 | header('Expires: 0'); |
@@ -488,13 +487,11 @@ discard block |
||
488 | 487 | { |
489 | 488 | $this->_bufferOutput = false; |
490 | 489 | ob_end_flush(); |
491 | - } |
|
492 | - else |
|
490 | + } else |
|
493 | 491 | ob_flush(); |
494 | 492 | flush(); |
495 | 493 | } |
496 | - } |
|
497 | - else |
|
494 | + } else |
|
498 | 495 | flush(); |
499 | 496 | } |
500 | 497 | |
@@ -645,8 +642,7 @@ discard block |
||
645 | 642 | $cookie->getSecure(), |
646 | 643 | $cookie->getHttpOnly() |
647 | 644 | ); |
648 | - } |
|
649 | - else { |
|
645 | + } else { |
|
650 | 646 | setcookie( |
651 | 647 | $cookie->getName(), |
652 | 648 | $cookie->getValue(), |
@@ -233,6 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | /** |
235 | 235 | * @param string|boolean output charset. |
236 | + * @param string $charset |
|
236 | 237 | */ |
237 | 238 | public function setCharset($charset) |
238 | 239 | { |
@@ -402,6 +403,7 @@ discard block |
||
402 | 403 | * The current application will be terminated after this method is invoked. |
403 | 404 | * @param string URL to be redirected to. If the URL is a relative one, the base URL of |
404 | 405 | * the current request will be inserted at the beginning. |
406 | + * @param string $url |
|
405 | 407 | */ |
406 | 408 | public function redirect($url) |
407 | 409 | { |
@@ -605,6 +607,7 @@ discard block |
||
605 | 607 | * Sends a header. |
606 | 608 | * @param string header |
607 | 609 | * @param boolean whether the header should replace a previous similar header, or add a second header of the same type |
610 | + * @param string $value |
|
608 | 611 | */ |
609 | 612 | public function appendHeader($value, $replace=true) |
610 | 613 | { |
@@ -630,6 +633,7 @@ discard block |
||
630 | 633 | * Sends a cookie. |
631 | 634 | * Do not call this method directly. Operate with the result of {@link getCookies} instead. |
632 | 635 | * @param THttpCookie cook to be sent |
636 | + * @param THttpCookie $cookie |
|
633 | 637 | */ |
634 | 638 | public function addCookie($cookie) |
635 | 639 | { |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | */ |
66 | 66 | class THttpResponse extends \Prado\TModule implements \Prado\IO\ITextWriter |
67 | 67 | { |
68 | - const DEFAULT_CONTENTTYPE = 'text/html'; |
|
69 | - const DEFAULT_CHARSET = 'UTF-8'; |
|
68 | + const DEFAULT_CONTENTTYPE='text/html'; |
|
69 | + const DEFAULT_CHARSET='UTF-8'; |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * @var The differents defined status code by RFC 2616 {@link http://www.faqs.org/rfcs/rfc2616} |
73 | 73 | */ |
74 | - private static $HTTP_STATUS_CODES = array( |
|
74 | + private static $HTTP_STATUS_CODES=array( |
|
75 | 75 | 100 => 'Continue', 101 => 'Switching Protocols', |
76 | 76 | 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', |
77 | 77 | 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 307 => 'Temporary Redirect', |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function setCacheControl($value) |
204 | 204 | { |
205 | - session_cache_limiter(TPropertyValue::ensureEnum($value,array('none','nocache','private','private_no_expire','public'))); |
|
205 | + session_cache_limiter(TPropertyValue::ensureEnum($value, array('none', 'nocache', 'private', 'private_no_expire', 'public'))); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -210,9 +210,9 @@ discard block |
||
210 | 210 | */ |
211 | 211 | public function setContentType($type) |
212 | 212 | { |
213 | - if ($this->_contentTypeHeaderSent) |
|
213 | + if($this->_contentTypeHeaderSent) |
|
214 | 214 | throw new \Exception('Unable to alter content-type as it has been already sent'); |
215 | - $this->_contentType = $type; |
|
215 | + $this->_contentType=$type; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public function setCharset($charset) |
238 | 238 | { |
239 | - $this->_charset = (strToLower($charset) === 'false') ? false : (string)$charset; |
|
239 | + $this->_charset=(strToLower($charset)==='false') ? false : (string) $charset; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -277,12 +277,12 @@ discard block |
||
277 | 277 | */ |
278 | 278 | public function setStatusCode($status, $reason=null) |
279 | 279 | { |
280 | - if ($this->_httpHeaderSent) |
|
280 | + if($this->_httpHeaderSent) |
|
281 | 281 | throw new \Exception('Unable to alter response as HTTP header already sent'); |
282 | 282 | $status=TPropertyValue::ensureInteger($status); |
283 | 283 | if(isset(self::$HTTP_STATUS_CODES[$status])) { |
284 | 284 | $this->_reason=self::$HTTP_STATUS_CODES[$status]; |
285 | - }else{ |
|
285 | + } else { |
|
286 | 286 | if($reason===null || $reason==='') { |
287 | 287 | throw new TInvalidDataValueException("response_status_reason_missing"); |
288 | 288 | } |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | public function write($str) |
321 | 321 | { |
322 | 322 | // when starting output make sure we send the headers first |
323 | - if (!$this->_bufferOutput and !$this->_httpHeaderSent) |
|
323 | + if(!$this->_bufferOutput and !$this->_httpHeaderSent) |
|
324 | 324 | $this->ensureHeadersSent(); |
325 | 325 | echo $str; |
326 | 326 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | * @param integer size of file or content in bytes if already known. Defaults to 'null' means auto-detect. |
338 | 338 | * @throws TInvalidDataValueException if the file cannot be found |
339 | 339 | */ |
340 | - public function writeFile($fileName,$content=null,$mimeType=null,$headers=null,$forceDownload=true,$clientFileName=null,$fileSize=null) |
|
340 | + public function writeFile($fileName, $content=null, $mimeType=null, $headers=null, $forceDownload=true, $clientFileName=null, $fileSize=null) |
|
341 | 341 | { |
342 | 342 | static $defaultMimeTypes=array( |
343 | 343 | 'css'=>'text/css', |
@@ -357,9 +357,9 @@ discard block |
||
357 | 357 | $mimeType='text/plain'; |
358 | 358 | if(function_exists('mime_content_type')) |
359 | 359 | $mimeType=mime_content_type($fileName); |
360 | - else if(($ext=strrchr($fileName,'.'))!==false) |
|
360 | + else if(($ext=strrchr($fileName, '.'))!==false) |
|
361 | 361 | { |
362 | - $ext=substr($ext,1); |
|
362 | + $ext=substr($ext, 1); |
|
363 | 363 | if(isset($defaultMimeTypes[$ext])) |
364 | 364 | $mimeType=$defaultMimeTypes[$ext]; |
365 | 365 | } |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | $clientFileName=basename($clientFileName); |
372 | 372 | |
373 | 373 | if($fileSize===null || $fileSize < 0) |
374 | - $fileSize = ($content===null?filesize($fileName):strlen($content)); |
|
374 | + $fileSize=($content===null ? filesize($fileName) : strlen($content)); |
|
375 | 375 | |
376 | 376 | $this->sendHttpHeader(); |
377 | 377 | if(is_array($headers)) |
@@ -385,11 +385,11 @@ discard block |
||
385 | 385 | header('Expires: 0'); |
386 | 386 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
387 | 387 | header("Content-Type: $mimeType"); |
388 | - $this->_contentTypeHeaderSent = true; |
|
388 | + $this->_contentTypeHeaderSent=true; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | header('Content-Length: '.$fileSize); |
392 | - header("Content-Disposition: " . ($forceDownload ? 'attachment' : 'inline') . "; filename=\"$clientFileName\""); |
|
392 | + header("Content-Disposition: ".($forceDownload ? 'attachment' : 'inline')."; filename=\"$clientFileName\""); |
|
393 | 393 | header('Content-Transfer-Encoding: binary'); |
394 | 394 | if($content===null) |
395 | 395 | readfile($fileName); |
@@ -429,11 +429,11 @@ discard block |
||
429 | 429 | |
430 | 430 | if($url[0]==='/') |
431 | 431 | $url=$this->getRequest()->getBaseUrl().$url; |
432 | - if ($this->_status >= 300 && $this->_status < 400) |
|
432 | + if($this->_status >= 300 && $this->_status < 400) |
|
433 | 433 | // The status code has been modified to a valid redirection status, send it |
434 | - header('Location: '.str_replace('&','&',$url), true, $this->_status); |
|
434 | + header('Location: '.str_replace('&', '&', $url), true, $this->_status); |
|
435 | 435 | else |
436 | - header('Location: '.str_replace('&','&',$url)); |
|
436 | + header('Location: '.str_replace('&', '&', $url)); |
|
437 | 437 | |
438 | 438 | if(!$this->getApplication()->getRequestCompleted()) |
439 | 439 | $this->getApplication()->onEndRequest(); |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | /** |
455 | 455 | * Flush the response contents and headers. |
456 | 456 | */ |
457 | - public function flush($continueBuffering = true) |
|
457 | + public function flush($continueBuffering=true) |
|
458 | 458 | { |
459 | 459 | if($this->getHasAdapter()) |
460 | 460 | $this->_adapter->flushContent($continueBuffering); |
@@ -476,18 +476,18 @@ discard block |
||
476 | 476 | * This method is used internally. Please use {@link flush} instead. |
477 | 477 | * @param boolean whether to continue buffering after flush if buffering was active |
478 | 478 | */ |
479 | - public function flushContent($continueBuffering = true) |
|
479 | + public function flushContent($continueBuffering=true) |
|
480 | 480 | { |
481 | - Prado::trace("Flushing output",'Prado\Web\THttpResponse'); |
|
481 | + Prado::trace("Flushing output", 'Prado\Web\THttpResponse'); |
|
482 | 482 | $this->ensureHeadersSent(); |
483 | 483 | if($this->_bufferOutput) |
484 | 484 | { |
485 | 485 | // avoid forced send of http headers (ob_flush() does that) if there's no output yet |
486 | - if (ob_get_length()>0) |
|
486 | + if(ob_get_length() > 0) |
|
487 | 487 | { |
488 | - if (!$continueBuffering) |
|
488 | + if(!$continueBuffering) |
|
489 | 489 | { |
490 | - $this->_bufferOutput = false; |
|
490 | + $this->_bufferOutput=false; |
|
491 | 491 | ob_end_flush(); |
492 | 492 | } |
493 | 493 | else |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | */ |
505 | 505 | protected function ensureHttpHeaderSent() |
506 | 506 | { |
507 | - if (!$this->_httpHeaderSent) |
|
507 | + if(!$this->_httpHeaderSent) |
|
508 | 508 | $this->sendHttpHeader(); |
509 | 509 | } |
510 | 510 | |
@@ -514,15 +514,15 @@ discard block |
||
514 | 514 | protected function sendHttpHeader() |
515 | 515 | { |
516 | 516 | $protocol=$this->getRequest()->getHttpProtocolVersion(); |
517 | - if($this->getRequest()->getHttpProtocolVersion() === null) |
|
517 | + if($this->getRequest()->getHttpProtocolVersion()===null) |
|
518 | 518 | $protocol='HTTP/1.1'; |
519 | 519 | |
520 | - $phpSapiName = substr(php_sapi_name(), 0, 3); |
|
521 | - $cgi = $phpSapiName == 'cgi' || $phpSapiName == 'fpm'; |
|
520 | + $phpSapiName=substr(php_sapi_name(), 0, 3); |
|
521 | + $cgi=$phpSapiName=='cgi' || $phpSapiName=='fpm'; |
|
522 | 522 | |
523 | 523 | header(($cgi ? 'Status:' : $protocol).' '.$this->_status.' '.$this->_reason, true, TPropertyValue::ensureInteger($this->_status)); |
524 | 524 | |
525 | - $this->_httpHeaderSent = true; |
|
525 | + $this->_httpHeaderSent=true; |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | /** |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | */ |
531 | 531 | protected function ensureContentTypeHeaderSent() |
532 | 532 | { |
533 | - if (!$this->_contentTypeHeaderSent) |
|
533 | + if(!$this->_contentTypeHeaderSent) |
|
534 | 534 | $this->sendContentTypeHeader(); |
535 | 535 | } |
536 | 536 | |
@@ -539,9 +539,9 @@ discard block |
||
539 | 539 | */ |
540 | 540 | protected function sendContentTypeHeader() |
541 | 541 | { |
542 | - $contentType=$this->_contentType===null?self::DEFAULT_CONTENTTYPE:$this->_contentType; |
|
542 | + $contentType=$this->_contentType===null ? self::DEFAULT_CONTENTTYPE : $this->_contentType; |
|
543 | 543 | $charset=$this->getCharset(); |
544 | - if($charset === false) { |
|
544 | + if($charset===false) { |
|
545 | 545 | $this->appendHeader('Content-Type: '.$contentType); |
546 | 546 | return; |
547 | 547 | } |
@@ -549,10 +549,10 @@ discard block |
||
549 | 549 | if($charset==='' && ($globalization=$this->getApplication()->getGlobalization(false))!==null) |
550 | 550 | $charset=$globalization->getCharset(); |
551 | 551 | |
552 | - if($charset==='') $charset = self::DEFAULT_CHARSET; |
|
552 | + if($charset==='') $charset=self::DEFAULT_CHARSET; |
|
553 | 553 | $this->appendHeader('Content-Type: '.$contentType.';charset='.$charset); |
554 | 554 | |
555 | - $this->_contentTypeHeaderSent = true; |
|
555 | + $this->_contentTypeHeaderSent=true; |
|
556 | 556 | } |
557 | 557 | |
558 | 558 | /** |
@@ -563,8 +563,8 @@ discard block |
||
563 | 563 | */ |
564 | 564 | public function getContents() |
565 | 565 | { |
566 | - Prado::trace("Retrieving output",'Prado\Web\THttpResponse'); |
|
567 | - return $this->_bufferOutput?ob_get_contents():''; |
|
566 | + Prado::trace("Retrieving output", 'Prado\Web\THttpResponse'); |
|
567 | + return $this->_bufferOutput ? ob_get_contents() : ''; |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | /** |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | { |
575 | 575 | if($this->_bufferOutput) |
576 | 576 | ob_clean(); |
577 | - Prado::trace("Clearing output",'Prado\Web\THttpResponse'); |
|
577 | + Prado::trace("Clearing output", 'Prado\Web\THttpResponse'); |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | /** |
@@ -583,19 +583,19 @@ discard block |
||
583 | 583 | */ |
584 | 584 | public function getHeaders($case=null) |
585 | 585 | { |
586 | - $result = array(); |
|
587 | - $headers = headers_list(); |
|
586 | + $result=array(); |
|
587 | + $headers=headers_list(); |
|
588 | 588 | foreach($headers as $header) { |
589 | - $tmp = explode(':', $header); |
|
590 | - $key = trim(array_shift($tmp)); |
|
591 | - $value = trim(implode(':', $tmp)); |
|
589 | + $tmp=explode(':', $header); |
|
590 | + $key=trim(array_shift($tmp)); |
|
591 | + $value=trim(implode(':', $tmp)); |
|
592 | 592 | if(isset($result[$key])) |
593 | - $result[$key] .= ', ' . $value; |
|
593 | + $result[$key].=', '.$value; |
|
594 | 594 | else |
595 | - $result[$key] = $value; |
|
595 | + $result[$key]=$value; |
|
596 | 596 | } |
597 | 597 | |
598 | - if($case !== null) |
|
598 | + if($case!==null) |
|
599 | 599 | return array_change_key_case($result, $case); |
600 | 600 | |
601 | 601 | return $result; |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | */ |
609 | 609 | public function appendHeader($value, $replace=true) |
610 | 610 | { |
611 | - Prado::trace("Sending header '$value'",'Prado\Web\THttpResponse'); |
|
611 | + Prado::trace("Sending header '$value'", 'Prado\Web\THttpResponse'); |
|
612 | 612 | header($value, $replace); |
613 | 613 | } |
614 | 614 | |
@@ -621,9 +621,9 @@ discard block |
||
621 | 621 | * @param string The extra headers. It's used when the message parameter is set to 1. This message type uses the same internal function as mail() does. |
622 | 622 | * @see http://us2.php.net/manual/en/function.error-log.php |
623 | 623 | */ |
624 | - public function appendLog($message,$messageType=0,$destination='',$extraHeaders='') |
|
624 | + public function appendLog($message, $messageType=0, $destination='', $extraHeaders='') |
|
625 | 625 | { |
626 | - error_log($message,$messageType,$destination,$extraHeaders); |
|
626 | + error_log($message, $messageType, $destination, $extraHeaders); |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function setDecayRate($value) |
81 | 81 | { |
82 | - $decay = TPropertyValue::ensureFloat($value); |
|
82 | + $decay=TPropertyValue::ensureFloat($value); |
|
83 | 83 | if($decay < 0) |
84 | 84 | throw new TConfigurationException('callback_decay_be_not_negative', $this->getID()); |
85 | 85 | $this->setViewState('Decay', $decay); |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | */ |
91 | 91 | protected function getTriggerOptions() |
92 | 92 | { |
93 | - $options = parent::getTriggerOptions(); |
|
94 | - $options['PropertyName'] = $this->getPropertyName(); |
|
95 | - $options['Interval'] = $this->getInterval(); |
|
96 | - $options['Decay'] = $this->getDecayRate(); |
|
93 | + $options=parent::getTriggerOptions(); |
|
94 | + $options['PropertyName']=$this->getPropertyName(); |
|
95 | + $options['Interval']=$this->getInterval(); |
|
96 | + $options['Decay']=$this->getDecayRate(); |
|
97 | 97 | return $options; |
98 | 98 | } |
99 | 99 |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | */ |
42 | 42 | protected function renderCustomScriptFile($writer) |
43 | 43 | { |
44 | - if(($scriptUrl = $this->getScriptUrl())!=='') |
|
44 | + if(($scriptUrl=$this->getScriptUrl())!=='') |
|
45 | 45 | { |
46 | 46 | if($this->getPage()->getIsCallback()) |
47 | 47 | { |
48 | - $cs = $this->getPage()->getClientScript(); |
|
48 | + $cs=$this->getPage()->getClientScript(); |
|
49 | 49 | $uniqueid=$this->ClientID.'_custom'; |
50 | 50 | if(!$cs->isScriptFileRegistered($uniqueid)) |
51 | 51 | $cs->registerScriptFile($uniqueid, $scriptUrl); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | { |
66 | 66 | if($this->getPage()->getIsCallback()) |
67 | 67 | { |
68 | - $extWriter= $this->getPage()->getResponse()->createHtmlWriter(); |
|
68 | + $extWriter=$this->getPage()->getResponse()->createHtmlWriter(); |
|
69 | 69 | $extWriter->write("/*<![CDATA[*/\n"); |
70 | 70 | $this->renderChildren($extWriter); |
71 | 71 | $extWriter->write("\n/*]]>*/"); |