@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | { |
48 | 48 | $rows = $this->getRows(); |
49 | 49 | $writer->addAttribute('size', "$rows"); |
50 | - if($this->getSelectionMode() === TListSelectionMode::Multiple) |
|
51 | - $writer->addAttribute('name', $this->getUniqueID() . '[]'); |
|
50 | + if ($this->getSelectionMode() === TListSelectionMode::Multiple) |
|
51 | + $writer->addAttribute('name', $this->getUniqueID().'[]'); |
|
52 | 52 | else |
53 | 53 | $writer->addAttribute('name', $this->getUniqueID()); |
54 | 54 | parent::addAttributesToRender($writer); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | public function onPreRender($param) |
73 | 73 | { |
74 | 74 | parent::onPreRender($param); |
75 | - if($this->getEnabled(true)) |
|
75 | + if ($this->getEnabled(true)) |
|
76 | 76 | $this->getPage()->registerRequiresPostData($this); |
77 | 77 | } |
78 | 78 | |
@@ -85,18 +85,18 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function loadPostData($key, $values) |
87 | 87 | { |
88 | - if(!$this->getEnabled(true)) |
|
88 | + if (!$this->getEnabled(true)) |
|
89 | 89 | return false; |
90 | 90 | $this->ensureDataBound(); |
91 | - $selections = isset($values[$key])?$values[$key]:null; |
|
92 | - if($selections !== null) |
|
91 | + $selections = isset($values[$key]) ? $values[$key] : null; |
|
92 | + if ($selections !== null) |
|
93 | 93 | { |
94 | 94 | $items = $this->getItems(); |
95 | - if($this->getSelectionMode() === TListSelectionMode::Single) |
|
95 | + if ($this->getSelectionMode() === TListSelectionMode::Single) |
|
96 | 96 | { |
97 | - $selection = is_array($selections)?$selections[0]:$selections; |
|
97 | + $selection = is_array($selections) ? $selections[0] : $selections; |
|
98 | 98 | $index = $items->findIndexByValue($selection, false); |
99 | - if($this->getSelectedIndex() !== $index) |
|
99 | + if ($this->getSelectedIndex() !== $index) |
|
100 | 100 | { |
101 | 101 | $this->setSelectedIndex($index); |
102 | 102 | return $this->_dataChanged = true; |
@@ -104,20 +104,20 @@ discard block |
||
104 | 104 | else |
105 | 105 | return false; |
106 | 106 | } |
107 | - if(!is_array($selections)) |
|
107 | + if (!is_array($selections)) |
|
108 | 108 | $selections = [$selections]; |
109 | 109 | $list = []; |
110 | - foreach($selections as $selection) |
|
110 | + foreach ($selections as $selection) |
|
111 | 111 | $list[] = $items->findIndexByValue($selection, false); |
112 | 112 | $list2 = $this->getSelectedIndices(); |
113 | 113 | $n = count($list); |
114 | 114 | $flag = false; |
115 | - if($n === count($list2)) |
|
115 | + if ($n === count($list2)) |
|
116 | 116 | { |
117 | 117 | sort($list, SORT_NUMERIC); |
118 | - for($i = 0;$i < $n;++$i) |
|
118 | + for ($i = 0; $i < $n; ++$i) |
|
119 | 119 | { |
120 | - if($list[$i] !== $list2[$i]) |
|
120 | + if ($list[$i] !== $list2[$i]) |
|
121 | 121 | { |
122 | 122 | $flag = true; |
123 | 123 | break; |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | } |
127 | 127 | else |
128 | 128 | $flag = true; |
129 | - if($flag) |
|
129 | + if ($flag) |
|
130 | 130 | { |
131 | 131 | $this->setSelectedIndices($list); |
132 | 132 | $this->_dataChanged = true; |
133 | 133 | } |
134 | 134 | return $flag; |
135 | 135 | } |
136 | - elseif($this->getSelectedIndex() !== -1) |
|
136 | + elseif ($this->getSelectedIndex() !== -1) |
|
137 | 137 | { |
138 | 138 | $this->clearSelection(); |
139 | 139 | return $this->_dataChanged = true; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function raisePostDataChangedEvent() |
153 | 153 | { |
154 | - if($this->getAutoPostBack() && $this->getCausesValidation()) |
|
154 | + if ($this->getAutoPostBack() && $this->getCausesValidation()) |
|
155 | 155 | $this->getPage()->validate($this->getValidationGroup()); |
156 | 156 | $this->onSelectedIndexChanged(null); |
157 | 157 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | public function setRows($value) |
189 | 189 | { |
190 | 190 | $value = TPropertyValue::ensureInteger($value); |
191 | - if($value <= 0) |
|
191 | + if ($value <= 0) |
|
192 | 192 | $value = 4; |
193 | 193 | $this->setViewState('Rows', $value, 4); |
194 | 194 | } |
@@ -47,10 +47,11 @@ discard block |
||
47 | 47 | { |
48 | 48 | $rows = $this->getRows(); |
49 | 49 | $writer->addAttribute('size', "$rows"); |
50 | - if($this->getSelectionMode() === TListSelectionMode::Multiple) |
|
51 | - $writer->addAttribute('name', $this->getUniqueID() . '[]'); |
|
52 | - else |
|
53 | - $writer->addAttribute('name', $this->getUniqueID()); |
|
50 | + if($this->getSelectionMode() === TListSelectionMode::Multiple) { |
|
51 | + $writer->addAttribute('name', $this->getUniqueID() . '[]'); |
|
52 | + } else { |
|
53 | + $writer->addAttribute('name', $this->getUniqueID()); |
|
54 | + } |
|
54 | 55 | parent::addAttributesToRender($writer); |
55 | 56 | } |
56 | 57 | |
@@ -72,8 +73,9 @@ discard block |
||
72 | 73 | public function onPreRender($param) |
73 | 74 | { |
74 | 75 | parent::onPreRender($param); |
75 | - if($this->getEnabled(true)) |
|
76 | - $this->getPage()->registerRequiresPostData($this); |
|
76 | + if($this->getEnabled(true)) { |
|
77 | + $this->getPage()->registerRequiresPostData($this); |
|
78 | + } |
|
77 | 79 | } |
78 | 80 | |
79 | 81 | /** |
@@ -85,8 +87,9 @@ discard block |
||
85 | 87 | */ |
86 | 88 | public function loadPostData($key, $values) |
87 | 89 | { |
88 | - if(!$this->getEnabled(true)) |
|
89 | - return false; |
|
90 | + if(!$this->getEnabled(true)) { |
|
91 | + return false; |
|
92 | + } |
|
90 | 93 | $this->ensureDataBound(); |
91 | 94 | $selections = isset($values[$key])?$values[$key]:null; |
92 | 95 | if($selections !== null) |
@@ -100,15 +103,17 @@ discard block |
||
100 | 103 | { |
101 | 104 | $this->setSelectedIndex($index); |
102 | 105 | return $this->_dataChanged = true; |
106 | + } else { |
|
107 | + return false; |
|
103 | 108 | } |
104 | - else |
|
105 | - return false; |
|
106 | 109 | } |
107 | - if(!is_array($selections)) |
|
108 | - $selections = [$selections]; |
|
110 | + if(!is_array($selections)) { |
|
111 | + $selections = [$selections]; |
|
112 | + } |
|
109 | 113 | $list = []; |
110 | - foreach($selections as $selection) |
|
111 | - $list[] = $items->findIndexByValue($selection, false); |
|
114 | + foreach($selections as $selection) { |
|
115 | + $list[] = $items->findIndexByValue($selection, false); |
|
116 | + } |
|
112 | 117 | $list2 = $this->getSelectedIndices(); |
113 | 118 | $n = count($list); |
114 | 119 | $flag = false; |
@@ -123,23 +128,22 @@ discard block |
||
123 | 128 | break; |
124 | 129 | } |
125 | 130 | } |
131 | + } else { |
|
132 | + $flag = true; |
|
126 | 133 | } |
127 | - else |
|
128 | - $flag = true; |
|
129 | 134 | if($flag) |
130 | 135 | { |
131 | 136 | $this->setSelectedIndices($list); |
132 | 137 | $this->_dataChanged = true; |
133 | 138 | } |
134 | 139 | return $flag; |
135 | - } |
|
136 | - elseif($this->getSelectedIndex() !== -1) |
|
140 | + } elseif($this->getSelectedIndex() !== -1) |
|
137 | 141 | { |
138 | 142 | $this->clearSelection(); |
139 | 143 | return $this->_dataChanged = true; |
144 | + } else { |
|
145 | + return false; |
|
140 | 146 | } |
141 | - else |
|
142 | - return false; |
|
143 | 147 | } |
144 | 148 | |
145 | 149 | /** |
@@ -151,8 +155,9 @@ discard block |
||
151 | 155 | */ |
152 | 156 | public function raisePostDataChangedEvent() |
153 | 157 | { |
154 | - if($this->getAutoPostBack() && $this->getCausesValidation()) |
|
155 | - $this->getPage()->validate($this->getValidationGroup()); |
|
158 | + if($this->getAutoPostBack() && $this->getCausesValidation()) { |
|
159 | + $this->getPage()->validate($this->getValidationGroup()); |
|
160 | + } |
|
156 | 161 | $this->onSelectedIndexChanged(null); |
157 | 162 | } |
158 | 163 | |
@@ -188,8 +193,9 @@ discard block |
||
188 | 193 | public function setRows($value) |
189 | 194 | { |
190 | 195 | $value = TPropertyValue::ensureInteger($value); |
191 | - if($value <= 0) |
|
192 | - $value = 4; |
|
196 | + if($value <= 0) { |
|
197 | + $value = 4; |
|
198 | + } |
|
193 | 199 | $this->setViewState('Rows', $value, 4); |
194 | 200 | } |
195 | 201 |
@@ -76,9 +76,9 @@ |
||
76 | 76 | */ |
77 | 77 | public function getVisible($checkParents = true) |
78 | 78 | { |
79 | - if(($parent = $this->getParent()) === null) |
|
79 | + if (($parent = $this->getParent()) === null) |
|
80 | 80 | return $this->getActive(); |
81 | - elseif($this->getActive()) |
|
81 | + elseif ($this->getActive()) |
|
82 | 82 | return $parent->getVisible($checkParents); |
83 | 83 | else |
84 | 84 | return false; |
@@ -76,12 +76,13 @@ |
||
76 | 76 | */ |
77 | 77 | public function getVisible($checkParents = true) |
78 | 78 | { |
79 | - if(($parent = $this->getParent()) === null) |
|
80 | - return $this->getActive(); |
|
81 | - elseif($this->getActive()) |
|
82 | - return $parent->getVisible($checkParents); |
|
83 | - else |
|
84 | - return false; |
|
79 | + if(($parent = $this->getParent()) === null) { |
|
80 | + return $this->getActive(); |
|
81 | + } elseif($this->getActive()) { |
|
82 | + return $parent->getVisible($checkParents); |
|
83 | + } else { |
|
84 | + return false; |
|
85 | + } |
|
85 | 86 | } |
86 | 87 | |
87 | 88 | /** |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | public function copyFrom($style) |
76 | 76 | { |
77 | 77 | parent::copyFrom($style); |
78 | - if($style instanceof TTableItemStyle) |
|
78 | + if ($style instanceof TTableItemStyle) |
|
79 | 79 | { |
80 | - if($this->_verticalAlign === null && $style->_verticalAlign !== null) |
|
80 | + if ($this->_verticalAlign === null && $style->_verticalAlign !== null) |
|
81 | 81 | $this->_verticalAlign = $style->_verticalAlign; |
82 | - if($this->_horizontalAlign === null && $style->_horizontalAlign !== null) |
|
82 | + if ($this->_horizontalAlign === null && $style->_horizontalAlign !== null) |
|
83 | 83 | $this->_horizontalAlign = $style->_horizontalAlign; |
84 | - if($this->_wrap === null && $style->_wrap !== null) |
|
84 | + if ($this->_wrap === null && $style->_wrap !== null) |
|
85 | 85 | $this->_wrap = $style->_wrap; |
86 | 86 | } |
87 | 87 | } |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | public function mergeWith($style) |
96 | 96 | { |
97 | 97 | parent::mergeWith($style); |
98 | - if($style instanceof TTableItemStyle) |
|
98 | + if ($style instanceof TTableItemStyle) |
|
99 | 99 | { |
100 | - if($style->_verticalAlign !== null) |
|
100 | + if ($style->_verticalAlign !== null) |
|
101 | 101 | $this->_verticalAlign = $style->_verticalAlign; |
102 | - if($style->_horizontalAlign !== null) |
|
102 | + if ($style->_horizontalAlign !== null) |
|
103 | 103 | $this->_horizontalAlign = $style->_horizontalAlign; |
104 | - if($style->_wrap !== null) |
|
104 | + if ($style->_wrap !== null) |
|
105 | 105 | $this->_wrap = $style->_wrap; |
106 | 106 | } |
107 | 107 | } |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function addAttributesToRender($writer) |
115 | 115 | { |
116 | - if(!$this->getWrap()) |
|
116 | + if (!$this->getWrap()) |
|
117 | 117 | $writer->addStyleAttribute('white-space', 'nowrap'); |
118 | 118 | |
119 | - if(($horizontalAlign = $this->getHorizontalAlign()) !== THorizontalAlign::NotSet) |
|
119 | + if (($horizontalAlign = $this->getHorizontalAlign()) !== THorizontalAlign::NotSet) |
|
120 | 120 | $writer->addAttribute('align', strtolower($horizontalAlign)); |
121 | 121 | |
122 | - if(($verticalAlign = $this->getVerticalAlign()) !== TVerticalAlign::NotSet) |
|
122 | + if (($verticalAlign = $this->getVerticalAlign()) !== TVerticalAlign::NotSet) |
|
123 | 123 | $writer->addAttribute('valign', strtolower($verticalAlign)); |
124 | 124 | |
125 | 125 | parent::addAttributesToRender($writer); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function getHorizontalAlign() |
132 | 132 | { |
133 | - return $this->_horizontalAlign === null?THorizontalAlign::NotSet:$this->_horizontalAlign; |
|
133 | + return $this->_horizontalAlign === null ?THorizontalAlign::NotSet : $this->_horizontalAlign; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function getVerticalAlign() |
149 | 149 | { |
150 | - return $this->_verticalAlign === null?TVerticalAlign::NotSet:$this->_verticalAlign; |
|
150 | + return $this->_verticalAlign === null ?TVerticalAlign::NotSet : $this->_verticalAlign; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public function getWrap() |
166 | 166 | { |
167 | - return $this->_wrap === null?true:$this->_wrap; |
|
167 | + return $this->_wrap === null ?true:$this->_wrap; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -45,12 +45,15 @@ discard block |
||
45 | 45 | protected function _getZappableSleepProps(&$exprops) |
46 | 46 | { |
47 | 47 | parent::_getZappableSleepProps($exprops); |
48 | - if ($this->_horizontalAlign === null) |
|
49 | - $exprops[] = "\0Prado\Web\UI\WebControls\TTableItemStyle\0_horizontalAlign"; |
|
50 | - if ($this->_verticalAlign === null) |
|
51 | - $exprops[] = "\0Prado\Web\UI\WebControls\TTableItemStyle\0_verticalAlign"; |
|
52 | - if ($this->_wrap === null) |
|
53 | - $exprops[] = "\0Prado\Web\UI\WebControls\TTableItemStyle\0_wrap"; |
|
48 | + if ($this->_horizontalAlign === null) { |
|
49 | + $exprops[] = "\0Prado\Web\UI\WebControls\TTableItemStyle\0_horizontalAlign"; |
|
50 | + } |
|
51 | + if ($this->_verticalAlign === null) { |
|
52 | + $exprops[] = "\0Prado\Web\UI\WebControls\TTableItemStyle\0_verticalAlign"; |
|
53 | + } |
|
54 | + if ($this->_wrap === null) { |
|
55 | + $exprops[] = "\0Prado\Web\UI\WebControls\TTableItemStyle\0_wrap"; |
|
56 | + } |
|
54 | 57 | } |
55 | 58 | |
56 | 59 | /** |
@@ -77,12 +80,15 @@ discard block |
||
77 | 80 | parent::copyFrom($style); |
78 | 81 | if($style instanceof TTableItemStyle) |
79 | 82 | { |
80 | - if($this->_verticalAlign === null && $style->_verticalAlign !== null) |
|
81 | - $this->_verticalAlign = $style->_verticalAlign; |
|
82 | - if($this->_horizontalAlign === null && $style->_horizontalAlign !== null) |
|
83 | - $this->_horizontalAlign = $style->_horizontalAlign; |
|
84 | - if($this->_wrap === null && $style->_wrap !== null) |
|
85 | - $this->_wrap = $style->_wrap; |
|
83 | + if($this->_verticalAlign === null && $style->_verticalAlign !== null) { |
|
84 | + $this->_verticalAlign = $style->_verticalAlign; |
|
85 | + } |
|
86 | + if($this->_horizontalAlign === null && $style->_horizontalAlign !== null) { |
|
87 | + $this->_horizontalAlign = $style->_horizontalAlign; |
|
88 | + } |
|
89 | + if($this->_wrap === null && $style->_wrap !== null) { |
|
90 | + $this->_wrap = $style->_wrap; |
|
91 | + } |
|
86 | 92 | } |
87 | 93 | } |
88 | 94 | |
@@ -97,12 +103,15 @@ discard block |
||
97 | 103 | parent::mergeWith($style); |
98 | 104 | if($style instanceof TTableItemStyle) |
99 | 105 | { |
100 | - if($style->_verticalAlign !== null) |
|
101 | - $this->_verticalAlign = $style->_verticalAlign; |
|
102 | - if($style->_horizontalAlign !== null) |
|
103 | - $this->_horizontalAlign = $style->_horizontalAlign; |
|
104 | - if($style->_wrap !== null) |
|
105 | - $this->_wrap = $style->_wrap; |
|
106 | + if($style->_verticalAlign !== null) { |
|
107 | + $this->_verticalAlign = $style->_verticalAlign; |
|
108 | + } |
|
109 | + if($style->_horizontalAlign !== null) { |
|
110 | + $this->_horizontalAlign = $style->_horizontalAlign; |
|
111 | + } |
|
112 | + if($style->_wrap !== null) { |
|
113 | + $this->_wrap = $style->_wrap; |
|
114 | + } |
|
106 | 115 | } |
107 | 116 | } |
108 | 117 | |
@@ -113,14 +122,17 @@ discard block |
||
113 | 122 | */ |
114 | 123 | public function addAttributesToRender($writer) |
115 | 124 | { |
116 | - if(!$this->getWrap()) |
|
117 | - $writer->addStyleAttribute('white-space', 'nowrap'); |
|
125 | + if(!$this->getWrap()) { |
|
126 | + $writer->addStyleAttribute('white-space', 'nowrap'); |
|
127 | + } |
|
118 | 128 | |
119 | - if(($horizontalAlign = $this->getHorizontalAlign()) !== THorizontalAlign::NotSet) |
|
120 | - $writer->addAttribute('align', strtolower($horizontalAlign)); |
|
129 | + if(($horizontalAlign = $this->getHorizontalAlign()) !== THorizontalAlign::NotSet) { |
|
130 | + $writer->addAttribute('align', strtolower($horizontalAlign)); |
|
131 | + } |
|
121 | 132 | |
122 | - if(($verticalAlign = $this->getVerticalAlign()) !== TVerticalAlign::NotSet) |
|
123 | - $writer->addAttribute('valign', strtolower($verticalAlign)); |
|
133 | + if(($verticalAlign = $this->getVerticalAlign()) !== TVerticalAlign::NotSet) { |
|
134 | + $writer->addAttribute('valign', strtolower($verticalAlign)); |
|
135 | + } |
|
124 | 136 | |
125 | 137 | parent::addAttributesToRender($writer); |
126 | 138 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function addParsedObject($object) |
45 | 45 | { |
46 | - if($object instanceof TTableCell) |
|
46 | + if ($object instanceof TTableCell) |
|
47 | 47 | $this->getCells()->add($object); |
48 | 48 | } |
49 | 49 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function getHorizontalAlign() |
82 | 82 | { |
83 | - if($this->getHasStyle()) |
|
83 | + if ($this->getHasStyle()) |
|
84 | 84 | return $this->getStyle()->getHorizontalAlign(); |
85 | 85 | else |
86 | 86 | return 'NotSet'; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function getVerticalAlign() |
103 | 103 | { |
104 | - if($this->getHasStyle()) |
|
104 | + if ($this->getHasStyle()) |
|
105 | 105 | return $this->getStyle()->getVerticalAlign(); |
106 | 106 | else |
107 | 107 | return 'NotSet'; |
@@ -139,10 +139,10 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function renderContents($writer) |
141 | 141 | { |
142 | - if($this->getHasControls()) |
|
142 | + if ($this->getHasControls()) |
|
143 | 143 | { |
144 | 144 | $writer->writeLine(); |
145 | - foreach($this->getControls() as $cell) |
|
145 | + foreach ($this->getControls() as $cell) |
|
146 | 146 | { |
147 | 147 | $cell->renderControl($writer); |
148 | 148 | $writer->writeLine(); |
@@ -43,8 +43,9 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function addParsedObject($object) |
45 | 45 | { |
46 | - if($object instanceof TTableCell) |
|
47 | - $this->getCells()->add($object); |
|
46 | + if($object instanceof TTableCell) { |
|
47 | + $this->getCells()->add($object); |
|
48 | + } |
|
48 | 49 | } |
49 | 50 | |
50 | 51 | /** |
@@ -80,10 +81,11 @@ discard block |
||
80 | 81 | */ |
81 | 82 | public function getHorizontalAlign() |
82 | 83 | { |
83 | - if($this->getHasStyle()) |
|
84 | - return $this->getStyle()->getHorizontalAlign(); |
|
85 | - else |
|
86 | - return 'NotSet'; |
|
84 | + if($this->getHasStyle()) { |
|
85 | + return $this->getStyle()->getHorizontalAlign(); |
|
86 | + } else { |
|
87 | + return 'NotSet'; |
|
88 | + } |
|
87 | 89 | } |
88 | 90 | |
89 | 91 | /** |
@@ -101,10 +103,11 @@ discard block |
||
101 | 103 | */ |
102 | 104 | public function getVerticalAlign() |
103 | 105 | { |
104 | - if($this->getHasStyle()) |
|
105 | - return $this->getStyle()->getVerticalAlign(); |
|
106 | - else |
|
107 | - return 'NotSet'; |
|
106 | + if($this->getHasStyle()) { |
|
107 | + return $this->getStyle()->getVerticalAlign(); |
|
108 | + } else { |
|
109 | + return 'NotSet'; |
|
110 | + } |
|
108 | 111 | } |
109 | 112 | |
110 | 113 | /** |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function addParsedObject($object) |
83 | 83 | { |
84 | - if($object instanceof TTableRow) |
|
84 | + if ($object instanceof TTableRow) |
|
85 | 85 | $this->getRows()->add($object); |
86 | 86 | } |
87 | 87 | |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | { |
104 | 104 | parent::addAttributesToRender($writer); |
105 | 105 | $border = 0; |
106 | - if($this->getHasStyle()) |
|
106 | + if ($this->getHasStyle()) |
|
107 | 107 | { |
108 | - if($this->getGridLines() !== TTableGridLines::None) |
|
108 | + if ($this->getGridLines() !== TTableGridLines::None) |
|
109 | 109 | { |
110 | - if(($border = $this->getBorderWidth()) === '') |
|
110 | + if (($border = $this->getBorderWidth()) === '') |
|
111 | 111 | $border = 1; |
112 | 112 | else |
113 | - $border = (int)$border; |
|
113 | + $border = (int) $border; |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | $writer->addAttribute('border', "$border"); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function getCellSpacing() |
173 | 173 | { |
174 | - if($this->getHasStyle()) |
|
174 | + if ($this->getHasStyle()) |
|
175 | 175 | return $this->getStyle()->getCellSpacing(); |
176 | 176 | else |
177 | 177 | return -1; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function getCellPadding() |
192 | 192 | { |
193 | - if($this->getHasStyle()) |
|
193 | + if ($this->getHasStyle()) |
|
194 | 194 | return $this->getStyle()->getCellPadding(); |
195 | 195 | else |
196 | 196 | return -1; |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function getHorizontalAlign() |
211 | 211 | { |
212 | - if($this->getHasStyle()) |
|
212 | + if ($this->getHasStyle()) |
|
213 | 213 | return $this->getStyle()->getHorizontalAlign(); |
214 | 214 | else |
215 | 215 | return THorizontalAlign::NotSet; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function getGridLines() |
230 | 230 | { |
231 | - if($this->getHasStyle()) |
|
231 | + if ($this->getHasStyle()) |
|
232 | 232 | return $this->getStyle()->getGridLines(); |
233 | 233 | else |
234 | 234 | return TTableGridLines::None; |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function getBackImageUrl() |
249 | 249 | { |
250 | - if($this->getHasStyle()) |
|
250 | + if ($this->getHasStyle()) |
|
251 | 251 | return $this->getStyle()->getBackImageUrl(); |
252 | 252 | else |
253 | 253 | return ''; |
@@ -269,9 +269,9 @@ discard block |
||
269 | 269 | public function renderBeginTag($writer) |
270 | 270 | { |
271 | 271 | parent::renderBeginTag($writer); |
272 | - if(($caption = $this->getCaption()) !== '') |
|
272 | + if (($caption = $this->getCaption()) !== '') |
|
273 | 273 | { |
274 | - if(($align = $this->getCaptionAlign()) !== TTableCaptionAlign::NotSet) |
|
274 | + if (($align = $this->getCaptionAlign()) !== TTableCaptionAlign::NotSet) |
|
275 | 275 | $writer->addAttribute('align', strtolower($align)); |
276 | 276 | $writer->renderBeginTag('caption'); |
277 | 277 | $writer->write($caption); |
@@ -285,44 +285,44 @@ discard block |
||
285 | 285 | */ |
286 | 286 | public function renderContents($writer) |
287 | 287 | { |
288 | - if($this->getHasControls()) |
|
288 | + if ($this->getHasControls()) |
|
289 | 289 | { |
290 | 290 | $renderTableSection = false; |
291 | - foreach($this->getControls() as $row) |
|
291 | + foreach ($this->getControls() as $row) |
|
292 | 292 | { |
293 | - if($row->getTableSection() !== TTableRowSection::Body) |
|
293 | + if ($row->getTableSection() !== TTableRowSection::Body) |
|
294 | 294 | { |
295 | 295 | $renderTableSection = true; |
296 | 296 | break; |
297 | 297 | } |
298 | 298 | } |
299 | - if($renderTableSection) |
|
299 | + if ($renderTableSection) |
|
300 | 300 | { |
301 | 301 | $currentSection = TTableRowSection::Header; |
302 | 302 | $writer->writeLine(); |
303 | - foreach($this->getControls() as $index => $row) |
|
303 | + foreach ($this->getControls() as $index => $row) |
|
304 | 304 | { |
305 | - if(($section = $row->getTableSection()) === $currentSection) |
|
305 | + if (($section = $row->getTableSection()) === $currentSection) |
|
306 | 306 | { |
307 | - if($index === 0 && $currentSection === TTableRowSection::Header) |
|
307 | + if ($index === 0 && $currentSection === TTableRowSection::Header) |
|
308 | 308 | $writer->renderBeginTag('thead'); |
309 | 309 | } |
310 | 310 | else |
311 | 311 | { |
312 | - if($currentSection === TTableRowSection::Header) |
|
312 | + if ($currentSection === TTableRowSection::Header) |
|
313 | 313 | { |
314 | - if($index > 0) |
|
314 | + if ($index > 0) |
|
315 | 315 | $writer->renderEndTag(); |
316 | - if($section === TTableRowSection::Body) |
|
316 | + if ($section === TTableRowSection::Body) |
|
317 | 317 | $writer->renderBeginTag('tbody'); |
318 | 318 | else |
319 | 319 | $writer->renderBeginTag('tfoot'); |
320 | 320 | $currentSection = $section; |
321 | 321 | } |
322 | - elseif($currentSection === TTableRowSection::Body) |
|
322 | + elseif ($currentSection === TTableRowSection::Body) |
|
323 | 323 | { |
324 | 324 | $writer->renderEndTag(); |
325 | - if($section === TTableRowSection::Footer) |
|
325 | + if ($section === TTableRowSection::Footer) |
|
326 | 326 | $writer->renderBeginTag('tfoot'); |
327 | 327 | else |
328 | 328 | throw new TConfigurationException('table_tablesection_outoforder'); |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | else |
340 | 340 | { |
341 | 341 | $writer->writeLine(); |
342 | - foreach($this->getControls() as $row) |
|
342 | + foreach ($this->getControls() as $row) |
|
343 | 343 | { |
344 | 344 | $row->renderControl($writer); |
345 | 345 | $writer->writeLine(); |
@@ -81,8 +81,9 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function addParsedObject($object) |
83 | 83 | { |
84 | - if($object instanceof TTableRow) |
|
85 | - $this->getRows()->add($object); |
|
84 | + if($object instanceof TTableRow) { |
|
85 | + $this->getRows()->add($object); |
|
86 | + } |
|
86 | 87 | } |
87 | 88 | |
88 | 89 | /** |
@@ -107,10 +108,11 @@ discard block |
||
107 | 108 | { |
108 | 109 | if($this->getGridLines() !== TTableGridLines::None) |
109 | 110 | { |
110 | - if(($border = $this->getBorderWidth()) === '') |
|
111 | - $border = 1; |
|
112 | - else |
|
113 | - $border = (int)$border; |
|
111 | + if(($border = $this->getBorderWidth()) === '') { |
|
112 | + $border = 1; |
|
113 | + } else { |
|
114 | + $border = (int)$border; |
|
115 | + } |
|
114 | 116 | } |
115 | 117 | } |
116 | 118 | $writer->addAttribute('border', "$border"); |
@@ -171,10 +173,11 @@ discard block |
||
171 | 173 | */ |
172 | 174 | public function getCellSpacing() |
173 | 175 | { |
174 | - if($this->getHasStyle()) |
|
175 | - return $this->getStyle()->getCellSpacing(); |
|
176 | - else |
|
177 | - return -1; |
|
176 | + if($this->getHasStyle()) { |
|
177 | + return $this->getStyle()->getCellSpacing(); |
|
178 | + } else { |
|
179 | + return -1; |
|
180 | + } |
|
178 | 181 | } |
179 | 182 | |
180 | 183 | /** |
@@ -190,10 +193,11 @@ discard block |
||
190 | 193 | */ |
191 | 194 | public function getCellPadding() |
192 | 195 | { |
193 | - if($this->getHasStyle()) |
|
194 | - return $this->getStyle()->getCellPadding(); |
|
195 | - else |
|
196 | - return -1; |
|
196 | + if($this->getHasStyle()) { |
|
197 | + return $this->getStyle()->getCellPadding(); |
|
198 | + } else { |
|
199 | + return -1; |
|
200 | + } |
|
197 | 201 | } |
198 | 202 | |
199 | 203 | /** |
@@ -209,10 +213,11 @@ discard block |
||
209 | 213 | */ |
210 | 214 | public function getHorizontalAlign() |
211 | 215 | { |
212 | - if($this->getHasStyle()) |
|
213 | - return $this->getStyle()->getHorizontalAlign(); |
|
214 | - else |
|
215 | - return THorizontalAlign::NotSet; |
|
216 | + if($this->getHasStyle()) { |
|
217 | + return $this->getStyle()->getHorizontalAlign(); |
|
218 | + } else { |
|
219 | + return THorizontalAlign::NotSet; |
|
220 | + } |
|
216 | 221 | } |
217 | 222 | |
218 | 223 | /** |
@@ -228,10 +233,11 @@ discard block |
||
228 | 233 | */ |
229 | 234 | public function getGridLines() |
230 | 235 | { |
231 | - if($this->getHasStyle()) |
|
232 | - return $this->getStyle()->getGridLines(); |
|
233 | - else |
|
234 | - return TTableGridLines::None; |
|
236 | + if($this->getHasStyle()) { |
|
237 | + return $this->getStyle()->getGridLines(); |
|
238 | + } else { |
|
239 | + return TTableGridLines::None; |
|
240 | + } |
|
235 | 241 | } |
236 | 242 | |
237 | 243 | /** |
@@ -247,10 +253,11 @@ discard block |
||
247 | 253 | */ |
248 | 254 | public function getBackImageUrl() |
249 | 255 | { |
250 | - if($this->getHasStyle()) |
|
251 | - return $this->getStyle()->getBackImageUrl(); |
|
252 | - else |
|
253 | - return ''; |
|
256 | + if($this->getHasStyle()) { |
|
257 | + return $this->getStyle()->getBackImageUrl(); |
|
258 | + } else { |
|
259 | + return ''; |
|
260 | + } |
|
254 | 261 | } |
255 | 262 | |
256 | 263 | /** |
@@ -271,8 +278,9 @@ discard block |
||
271 | 278 | parent::renderBeginTag($writer); |
272 | 279 | if(($caption = $this->getCaption()) !== '') |
273 | 280 | { |
274 | - if(($align = $this->getCaptionAlign()) !== TTableCaptionAlign::NotSet) |
|
275 | - $writer->addAttribute('align', strtolower($align)); |
|
281 | + if(($align = $this->getCaptionAlign()) !== TTableCaptionAlign::NotSet) { |
|
282 | + $writer->addAttribute('align', strtolower($align)); |
|
283 | + } |
|
276 | 284 | $writer->renderBeginTag('caption'); |
277 | 285 | $writer->write($caption); |
278 | 286 | $writer->renderEndTag(); |
@@ -304,39 +312,41 @@ discard block |
||
304 | 312 | { |
305 | 313 | if(($section = $row->getTableSection()) === $currentSection) |
306 | 314 | { |
307 | - if($index === 0 && $currentSection === TTableRowSection::Header) |
|
308 | - $writer->renderBeginTag('thead'); |
|
309 | - } |
|
310 | - else |
|
315 | + if($index === 0 && $currentSection === TTableRowSection::Header) { |
|
316 | + $writer->renderBeginTag('thead'); |
|
317 | + } |
|
318 | + } else |
|
311 | 319 | { |
312 | 320 | if($currentSection === TTableRowSection::Header) |
313 | 321 | { |
314 | - if($index > 0) |
|
315 | - $writer->renderEndTag(); |
|
316 | - if($section === TTableRowSection::Body) |
|
317 | - $writer->renderBeginTag('tbody'); |
|
318 | - else |
|
319 | - $writer->renderBeginTag('tfoot'); |
|
322 | + if($index > 0) { |
|
323 | + $writer->renderEndTag(); |
|
324 | + } |
|
325 | + if($section === TTableRowSection::Body) { |
|
326 | + $writer->renderBeginTag('tbody'); |
|
327 | + } else { |
|
328 | + $writer->renderBeginTag('tfoot'); |
|
329 | + } |
|
320 | 330 | $currentSection = $section; |
321 | - } |
|
322 | - elseif($currentSection === TTableRowSection::Body) |
|
331 | + } elseif($currentSection === TTableRowSection::Body) |
|
323 | 332 | { |
324 | 333 | $writer->renderEndTag(); |
325 | - if($section === TTableRowSection::Footer) |
|
326 | - $writer->renderBeginTag('tfoot'); |
|
327 | - else |
|
328 | - throw new TConfigurationException('table_tablesection_outoforder'); |
|
334 | + if($section === TTableRowSection::Footer) { |
|
335 | + $writer->renderBeginTag('tfoot'); |
|
336 | + } else { |
|
337 | + throw new TConfigurationException('table_tablesection_outoforder'); |
|
338 | + } |
|
329 | 339 | $currentSection = $section; |
330 | - } |
|
331 | - else // Footer |
|
340 | + } else { |
|
341 | + // Footer |
|
332 | 342 | throw new TConfigurationException('table_tablesection_outoforder'); |
343 | + } |
|
333 | 344 | } |
334 | 345 | $row->renderControl($writer); |
335 | 346 | $writer->writeLine(); |
336 | 347 | } |
337 | 348 | $writer->renderEndTag(); |
338 | - } |
|
339 | - else |
|
349 | + } else |
|
340 | 350 | { |
341 | 351 | $writer->writeLine(); |
342 | 352 | foreach($this->getControls() as $row) |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | protected function getControlPromptValue() |
62 | 62 | { |
63 | 63 | $control = $this->getValidationTarget(); |
64 | - if($control instanceof TListControl) |
|
64 | + if ($control instanceof TListControl) |
|
65 | 65 | return $control->getPromptValue(); |
66 | 66 | return ''; |
67 | 67 | } |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | protected function evaluateIsValid() |
90 | 90 | { |
91 | 91 | $control = $this->getValidationTarget(); |
92 | - if($control instanceof TListControl) |
|
92 | + if ($control instanceof TListControl) |
|
93 | 93 | return $this->validateListControl($control); |
94 | - elseif($control instanceof TRadioButton && strlen($control->getGroupName()) > 0) |
|
94 | + elseif ($control instanceof TRadioButton && strlen($control->getGroupName()) > 0) |
|
95 | 95 | return $this->validateRadioButtonGroup($control); |
96 | 96 | else |
97 | 97 | return $this->validateStandardControl($control); |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | { |
102 | 102 | $initial = trim($this->getInitialValue()); |
103 | 103 | $count = 0; |
104 | - foreach($control->getItems() as $item) |
|
104 | + foreach ($control->getItems() as $item) |
|
105 | 105 | { |
106 | - if($item->getSelected() && $item->getValue() != $initial) |
|
106 | + if ($item->getSelected() && $item->getValue() != $initial) |
|
107 | 107 | $count++; |
108 | 108 | } |
109 | 109 | return $count > 0; |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | private function validateRadioButtonGroup($control) |
113 | 113 | { |
114 | 114 | $initial = trim($this->getInitialValue()); |
115 | - foreach($control->getRadioButtonsInGroup() as $radio) |
|
115 | + foreach ($control->getRadioButtonsInGroup() as $radio) |
|
116 | 116 | { |
117 | - if($radio->getChecked()) |
|
117 | + if ($radio->getChecked()) |
|
118 | 118 | { |
119 | - if(strlen($value = $radio->getValue()) > 0) |
|
119 | + if (strlen($value = $radio->getValue()) > 0) |
|
120 | 120 | return $value !== $initial; |
121 | 121 | else |
122 | 122 | return true; |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | $options = parent::getClientScriptOptions(); |
142 | 142 | $options['InitialValue'] = $this->getInitialValue(); |
143 | 143 | $control = $this->getValidationTarget(); |
144 | - if($control instanceof TListControl) |
|
144 | + if ($control instanceof TListControl) |
|
145 | 145 | $options['TotalItems'] = $control->getItemCount(); |
146 | - if($control instanceof TRadioButton && strlen($control->getGroupName()) > 0) |
|
146 | + if ($control instanceof TRadioButton && strlen($control->getGroupName()) > 0) |
|
147 | 147 | $options['GroupName'] = $control->getGroupName(); |
148 | 148 | return $options; |
149 | 149 | } |
@@ -61,8 +61,9 @@ discard block |
||
61 | 61 | protected function getControlPromptValue() |
62 | 62 | { |
63 | 63 | $control = $this->getValidationTarget(); |
64 | - if($control instanceof TListControl) |
|
65 | - return $control->getPromptValue(); |
|
64 | + if($control instanceof TListControl) { |
|
65 | + return $control->getPromptValue(); |
|
66 | + } |
|
66 | 67 | return ''; |
67 | 68 | } |
68 | 69 | /** |
@@ -89,12 +90,13 @@ discard block |
||
89 | 90 | protected function evaluateIsValid() |
90 | 91 | { |
91 | 92 | $control = $this->getValidationTarget(); |
92 | - if($control instanceof TListControl) |
|
93 | - return $this->validateListControl($control); |
|
94 | - elseif($control instanceof TRadioButton && strlen($control->getGroupName()) > 0) |
|
95 | - return $this->validateRadioButtonGroup($control); |
|
96 | - else |
|
97 | - return $this->validateStandardControl($control); |
|
93 | + if($control instanceof TListControl) { |
|
94 | + return $this->validateListControl($control); |
|
95 | + } elseif($control instanceof TRadioButton && strlen($control->getGroupName()) > 0) { |
|
96 | + return $this->validateRadioButtonGroup($control); |
|
97 | + } else { |
|
98 | + return $this->validateStandardControl($control); |
|
99 | + } |
|
98 | 100 | } |
99 | 101 | |
100 | 102 | private function validateListControl($control) |
@@ -103,8 +105,9 @@ discard block |
||
103 | 105 | $count = 0; |
104 | 106 | foreach($control->getItems() as $item) |
105 | 107 | { |
106 | - if($item->getSelected() && $item->getValue() != $initial) |
|
107 | - $count++; |
|
108 | + if($item->getSelected() && $item->getValue() != $initial) { |
|
109 | + $count++; |
|
110 | + } |
|
108 | 111 | } |
109 | 112 | return $count > 0; |
110 | 113 | } |
@@ -116,10 +119,11 @@ discard block |
||
116 | 119 | { |
117 | 120 | if($radio->getChecked()) |
118 | 121 | { |
119 | - if(strlen($value = $radio->getValue()) > 0) |
|
120 | - return $value !== $initial; |
|
121 | - else |
|
122 | - return true; |
|
122 | + if(strlen($value = $radio->getValue()) > 0) { |
|
123 | + return $value !== $initial; |
|
124 | + } else { |
|
125 | + return true; |
|
126 | + } |
|
123 | 127 | } |
124 | 128 | } |
125 | 129 | return false; |
@@ -141,10 +145,12 @@ discard block |
||
141 | 145 | $options = parent::getClientScriptOptions(); |
142 | 146 | $options['InitialValue'] = $this->getInitialValue(); |
143 | 147 | $control = $this->getValidationTarget(); |
144 | - if($control instanceof TListControl) |
|
145 | - $options['TotalItems'] = $control->getItemCount(); |
|
146 | - if($control instanceof TRadioButton && strlen($control->getGroupName()) > 0) |
|
147 | - $options['GroupName'] = $control->getGroupName(); |
|
148 | + if($control instanceof TListControl) { |
|
149 | + $options['TotalItems'] = $control->getItemCount(); |
|
150 | + } |
|
151 | + if($control instanceof TRadioButton && strlen($control->getGroupName()) > 0) { |
|
152 | + $options['GroupName'] = $control->getGroupName(); |
|
153 | + } |
|
148 | 154 | return $options; |
149 | 155 | } |
150 | 156 | } |
@@ -54,14 +54,14 @@ |
||
54 | 54 | */ |
55 | 55 | public function loadPostData($key, $values) |
56 | 56 | { |
57 | - $value = isset($values[$key])?$values[$key]:''; |
|
57 | + $value = isset($values[$key]) ? $values[$key] : ''; |
|
58 | 58 | $oldSelection = $this->getSelectedIndex(); |
59 | 59 | $this->ensureDataBound(); |
60 | - foreach($this->getItems() as $index => $item) |
|
60 | + foreach ($this->getItems() as $index => $item) |
|
61 | 61 | { |
62 | - if($item->getEnabled() && $item->getValue() === $value) |
|
62 | + if ($item->getEnabled() && $item->getValue() === $value) |
|
63 | 63 | { |
64 | - if($index === $oldSelection) |
|
64 | + if ($index === $oldSelection) |
|
65 | 65 | return false; |
66 | 66 | else |
67 | 67 | { |
@@ -61,9 +61,9 @@ |
||
61 | 61 | { |
62 | 62 | if($item->getEnabled() && $item->getValue() === $value) |
63 | 63 | { |
64 | - if($index === $oldSelection) |
|
65 | - return false; |
|
66 | - else |
|
64 | + if($index === $oldSelection) { |
|
65 | + return false; |
|
66 | + } else |
|
67 | 67 | { |
68 | 68 | $this->setSelectedIndex($index); |
69 | 69 | return true; |
@@ -178,8 +178,7 @@ discard block |
||
178 | 178 | |
179 | 179 | public function validate() |
180 | 180 | { |
181 | - if (! |
|
182 | - ( |
|
181 | + if (!( |
|
183 | 182 | ($challenge = @$_POST[$this->getChallengeFieldName()]) |
184 | 183 | and |
185 | 184 | ($response = @$_POST[$this->getResponseFieldName()]) |
@@ -203,9 +202,9 @@ discard block |
||
203 | 202 | { |
204 | 203 | parent::onPreRender($param); |
205 | 204 | |
206 | - if("" == $this->getPublicKey()) |
|
205 | + if ("" == $this->getPublicKey()) |
|
207 | 206 | throw new TConfigurationException('recaptcha_publickey_unknown'); |
208 | - if("" == $this->getPrivateKey()) |
|
207 | + if ("" == $this->getPrivateKey()) |
|
209 | 208 | throw new TConfigurationException('recaptcha_privatekey_unknown'); |
210 | 209 | |
211 | 210 | // need to register captcha fields so they will be sent back also in callbacks |
@@ -225,21 +224,21 @@ discard block |
||
225 | 224 | // if we're in a callback, then schedule re-rendering of the control |
226 | 225 | // if not, don't do anything, because a new challenge will be rendered anyway |
227 | 226 | if ($this->Page->IsCallback) |
228 | - $this->Page->CallbackClient->jQuery($this->getClientID() . ' #recaptcha_reload', 'click'); |
|
227 | + $this->Page->CallbackClient->jQuery($this->getClientID().' #recaptcha_reload', 'click'); |
|
229 | 228 | } |
230 | 229 | |
231 | 230 | public function renderContents($writer) |
232 | 231 | { |
233 | - $readyscript = 'jQuery(document).trigger(' . TJavaScript::quoteString('captchaready:' . $this->getClientID()) . ')'; |
|
232 | + $readyscript = 'jQuery(document).trigger('.TJavaScript::quoteString('captchaready:'.$this->getClientID()).')'; |
|
234 | 233 | $cs = $this->Page->ClientScript; |
235 | 234 | $id = $this->getClientID(); |
236 | - $divid = $id . '_1_recaptchadiv'; |
|
237 | - $writer->write('<div id="' . htmlspecialchars($divid) . '">'); |
|
235 | + $divid = $id.'_1_recaptchadiv'; |
|
236 | + $writer->write('<div id="'.htmlspecialchars($divid).'">'); |
|
238 | 237 | |
239 | 238 | if (!$this->Page->IsCallback) |
240 | 239 | { |
241 | 240 | $writer->write(TJavaScript::renderScriptBlock( |
242 | - 'var RecaptchaOptions = ' . TJavaScript::jsonEncode($this->getClientSideOptions()) . ';' |
|
241 | + 'var RecaptchaOptions = '.TJavaScript::jsonEncode($this->getClientSideOptions()).';' |
|
243 | 242 | )); |
244 | 243 | |
245 | 244 | $html = $this->recaptcha_get_html($this->getPublicKey()); |
@@ -253,20 +252,20 @@ discard block |
||
253 | 252 | */ |
254 | 253 | $writer->write($html); |
255 | 254 | |
256 | - $cs->registerEndScript('ReCaptcha::EventScript', 'jQuery(document).ready(function() { ' . $readyscript . '; } );'); |
|
255 | + $cs->registerEndScript('ReCaptcha::EventScript', 'jQuery(document).ready(function() { '.$readyscript.'; } );'); |
|
257 | 256 | } |
258 | 257 | else |
259 | 258 | { |
260 | 259 | $options = $this->getClientSideOptions(); |
261 | - $options['callback'] = new TJavaScriptLiteral('function() { ' . $readyscript . '; ' . $this->getCallbackScript() . '; }'); |
|
260 | + $options['callback'] = new TJavaScriptLiteral('function() { '.$readyscript.'; '.$this->getCallbackScript().'; }'); |
|
262 | 261 | $cs->registerScriptFile('ReCaptcha::AjaxScript', self::RECAPTCHA_JS); |
263 | - $cs->registerEndScript('ReCaptcha::CreateScript::' . $id, implode(' ', [ |
|
264 | - 'if (!jQuery(' . TJavaScript::quoteString('#' . $this->getResponseFieldName()) . '))', |
|
262 | + $cs->registerEndScript('ReCaptcha::CreateScript::'.$id, implode(' ', [ |
|
263 | + 'if (!jQuery('.TJavaScript::quoteString('#'.$this->getResponseFieldName()).'))', |
|
265 | 264 | '{', |
266 | 265 | 'Recaptcha.destroy();', |
267 | 266 | 'Recaptcha.create(', |
268 | - TJavaScript::quoteString($this->getPublicKey()) . ', ', |
|
269 | - TJavaScript::quoteString($divid) . ', ', |
|
267 | + TJavaScript::quoteString($this->getPublicKey()).', ', |
|
268 | + TJavaScript::quoteString($divid).', ', |
|
270 | 269 | TJavaScript::encode($options), |
271 | 270 | ');', |
272 | 271 | '}', |
@@ -291,11 +290,11 @@ discard block |
||
291 | 290 | $server = $use_ssl ? self::RECAPTCHA_API_SECURE_SERVER : $server = self::RECAPTCHA_API_SERVER; |
292 | 291 | $errorpart = ''; |
293 | 292 | if ($error) |
294 | - $errorpart = "&error=" . $error; |
|
293 | + $errorpart = "&error=".$error; |
|
295 | 294 | |
296 | - return '<script type="text/javascript" src="' . $server . '/challenge?k=' . $pubkey . $errorpart . '"></script> |
|
295 | + return '<script type="text/javascript" src="'.$server.'/challenge?k='.$pubkey.$errorpart.'"></script> |
|
297 | 296 | <noscript> |
298 | - <iframe src="' . $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/> |
|
297 | + <iframe src="' . $server.'/noscript?k='.$pubkey.$errorpart.'" height="300" width="500" frameborder="0"></iframe><br/> |
|
299 | 298 | <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> |
300 | 299 | <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/> |
301 | 300 | </noscript>'; |
@@ -306,10 +305,10 @@ discard block |
||
306 | 305 | * @param $data - array of string elements to be encoded |
307 | 306 | * @return string - encoded request |
308 | 307 | */ |
309 | - private function recaptcha_qsencode ($data) { |
|
308 | + private function recaptcha_qsencode($data) { |
|
310 | 309 | $req = ""; |
311 | 310 | foreach ($data as $key => $value) |
312 | - $req .= $key . '=' . urlencode(stripslashes($value)) . '&'; |
|
311 | + $req .= $key.'='.urlencode(stripslashes($value)).'&'; |
|
313 | 312 | |
314 | 313 | // Cut the last '&' |
315 | 314 | $req = substr($req, 0, strlen($req) - 1); |
@@ -331,13 +330,13 @@ discard block |
||
331 | 330 | $http_request = "POST $path HTTP/1.0\r\n"; |
332 | 331 | $http_request .= "Host: $host\r\n"; |
333 | 332 | $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; |
334 | - $http_request .= "Content-Length: " . strlen($req) . "\r\n"; |
|
333 | + $http_request .= "Content-Length: ".strlen($req)."\r\n"; |
|
335 | 334 | $http_request .= "User-Agent: reCAPTCHA/PHP\r\n"; |
336 | 335 | $http_request .= "\r\n"; |
337 | 336 | $http_request .= $req; |
338 | 337 | |
339 | 338 | $response = ''; |
340 | - if(false == ($fs = @fsockopen($host, $port, $errno, $errstr, 10))) |
|
339 | + if (false == ($fs = @fsockopen($host, $port, $errno, $errstr, 10))) |
|
341 | 340 | die('Could not open socket'); |
342 | 341 | |
343 | 342 | fwrite($fs, $http_request); |
@@ -167,12 +167,15 @@ discard block |
||
167 | 167 | public function getClientSideOptions() |
168 | 168 | { |
169 | 169 | $options = []; |
170 | - if ($theme = $this->getThemeName()) |
|
171 | - $options['theme'] = $theme; |
|
172 | - if ($lang = $this->getLanguage()) |
|
173 | - $options['lang'] = $lang; |
|
174 | - if ($trans = $this->getCustomTranslations()) |
|
175 | - $options['custom_translations'] = $trans; |
|
170 | + if ($theme = $this->getThemeName()) { |
|
171 | + $options['theme'] = $theme; |
|
172 | + } |
|
173 | + if ($lang = $this->getLanguage()) { |
|
174 | + $options['lang'] = $lang; |
|
175 | + } |
|
176 | + if ($trans = $this->getCustomTranslations()) { |
|
177 | + $options['custom_translations'] = $trans; |
|
178 | + } |
|
176 | 179 | return $options; |
177 | 180 | } |
178 | 181 | |
@@ -184,8 +187,9 @@ discard block |
||
184 | 187 | and |
185 | 188 | ($response = @$_POST[$this->getResponseFieldName()]) |
186 | 189 | ) |
187 | - ) |
|
188 | - return false; |
|
190 | + ) { |
|
191 | + return false; |
|
192 | + } |
|
189 | 193 | |
190 | 194 | return $this->recaptcha_check_answer( |
191 | 195 | $this->getPrivateKey(), |
@@ -203,10 +207,12 @@ discard block |
||
203 | 207 | { |
204 | 208 | parent::onPreRender($param); |
205 | 209 | |
206 | - if("" == $this->getPublicKey()) |
|
207 | - throw new TConfigurationException('recaptcha_publickey_unknown'); |
|
208 | - if("" == $this->getPrivateKey()) |
|
209 | - throw new TConfigurationException('recaptcha_privatekey_unknown'); |
|
210 | + if("" == $this->getPublicKey()) { |
|
211 | + throw new TConfigurationException('recaptcha_publickey_unknown'); |
|
212 | + } |
|
213 | + if("" == $this->getPrivateKey()) { |
|
214 | + throw new TConfigurationException('recaptcha_privatekey_unknown'); |
|
215 | + } |
|
210 | 216 | |
211 | 217 | // need to register captcha fields so they will be sent back also in callbacks |
212 | 218 | $page = $this->getPage(); |
@@ -224,8 +230,9 @@ discard block |
||
224 | 230 | { |
225 | 231 | // if we're in a callback, then schedule re-rendering of the control |
226 | 232 | // if not, don't do anything, because a new challenge will be rendered anyway |
227 | - if ($this->Page->IsCallback) |
|
228 | - $this->Page->CallbackClient->jQuery($this->getClientID() . ' #recaptcha_reload', 'click'); |
|
233 | + if ($this->Page->IsCallback) { |
|
234 | + $this->Page->CallbackClient->jQuery($this->getClientID() . ' #recaptcha_reload', 'click'); |
|
235 | + } |
|
229 | 236 | } |
230 | 237 | |
231 | 238 | public function renderContents($writer) |
@@ -254,8 +261,7 @@ discard block |
||
254 | 261 | $writer->write($html); |
255 | 262 | |
256 | 263 | $cs->registerEndScript('ReCaptcha::EventScript', 'jQuery(document).ready(function() { ' . $readyscript . '; } );'); |
257 | - } |
|
258 | - else |
|
264 | + } else |
|
259 | 265 | { |
260 | 266 | $options = $this->getClientSideOptions(); |
261 | 267 | $options['callback'] = new TJavaScriptLiteral('function() { ' . $readyscript . '; ' . $this->getCallbackScript() . '; }'); |
@@ -290,8 +296,9 @@ discard block |
||
290 | 296 | { |
291 | 297 | $server = $use_ssl ? self::RECAPTCHA_API_SECURE_SERVER : $server = self::RECAPTCHA_API_SERVER; |
292 | 298 | $errorpart = ''; |
293 | - if ($error) |
|
294 | - $errorpart = "&error=" . $error; |
|
299 | + if ($error) { |
|
300 | + $errorpart = "&error=" . $error; |
|
301 | + } |
|
295 | 302 | |
296 | 303 | return '<script type="text/javascript" src="' . $server . '/challenge?k=' . $pubkey . $errorpart . '"></script> |
297 | 304 | <noscript> |
@@ -308,8 +315,9 @@ discard block |
||
308 | 315 | */ |
309 | 316 | private function recaptcha_qsencode ($data) { |
310 | 317 | $req = ""; |
311 | - foreach ($data as $key => $value) |
|
312 | - $req .= $key . '=' . urlencode(stripslashes($value)) . '&'; |
|
318 | + foreach ($data as $key => $value) { |
|
319 | + $req .= $key . '=' . urlencode(stripslashes($value)) . '&'; |
|
320 | + } |
|
313 | 321 | |
314 | 322 | // Cut the last '&' |
315 | 323 | $req = substr($req, 0, strlen($req) - 1); |
@@ -337,13 +345,16 @@ discard block |
||
337 | 345 | $http_request .= $req; |
338 | 346 | |
339 | 347 | $response = ''; |
340 | - if(false == ($fs = @fsockopen($host, $port, $errno, $errstr, 10))) |
|
341 | - die('Could not open socket'); |
|
348 | + if(false == ($fs = @fsockopen($host, $port, $errno, $errstr, 10))) { |
|
349 | + die('Could not open socket'); |
|
350 | + } |
|
342 | 351 | |
343 | 352 | fwrite($fs, $http_request); |
344 | 353 | |
345 | - while (!feof($fs)) |
|
346 | - $response .= fgets($fs, 1160); // One TCP-IP packet |
|
354 | + while (!feof($fs)) { |
|
355 | + $response .= fgets($fs, 1160); |
|
356 | + } |
|
357 | + // One TCP-IP packet |
|
347 | 358 | fclose($fs); |
348 | 359 | $response = explode("\r\n\r\n", $response, 2); |
349 | 360 | |
@@ -362,8 +373,9 @@ discard block |
||
362 | 373 | private function recaptcha_check_answer($privkey, $remoteip, $challenge, $response, $extra_params = []) |
363 | 374 | { |
364 | 375 | //discard spam submissions |
365 | - if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) |
|
366 | - return false; |
|
376 | + if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) { |
|
377 | + return false; |
|
378 | + } |
|
367 | 379 | |
368 | 380 | $response = $this->recaptcha_http_post(self::RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify", |
369 | 381 | [ |
@@ -376,9 +388,10 @@ discard block |
||
376 | 388 | |
377 | 389 | $answers = explode("\n", $response [1]); |
378 | 390 | |
379 | - if (trim($answers [0]) == 'true') |
|
380 | - return true; |
|
381 | - else |
|
382 | - return false; |
|
391 | + if (trim($answers [0]) == 'true') { |
|
392 | + return true; |
|
393 | + } else { |
|
394 | + return false; |
|
395 | + } |
|
383 | 396 | } |
384 | 397 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | public function setBold($value) |
89 | 89 | { |
90 | 90 | $this->_flags |= self::IS_SET_BOLD; |
91 | - if(TPropertyValue::ensureBoolean($value)) |
|
91 | + if (TPropertyValue::ensureBoolean($value)) |
|
92 | 92 | $this->_flags |= self::IS_BOLD; |
93 | 93 | else |
94 | 94 | $this->_flags &= ~self::IS_BOLD; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | public function setItalic($value) |
109 | 109 | { |
110 | 110 | $this->_flags |= self::IS_SET_ITALIC; |
111 | - if(TPropertyValue::ensureBoolean($value)) |
|
111 | + if (TPropertyValue::ensureBoolean($value)) |
|
112 | 112 | $this->_flags |= self::IS_ITALIC; |
113 | 113 | else |
114 | 114 | $this->_flags &= ~self::IS_ITALIC; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | public function setOverline($value) |
129 | 129 | { |
130 | 130 | $this->_flags |= self::IS_SET_OVERLINE; |
131 | - if(TPropertyValue::ensureBoolean($value)) |
|
131 | + if (TPropertyValue::ensureBoolean($value)) |
|
132 | 132 | $this->_flags |= self::IS_OVERLINE; |
133 | 133 | else |
134 | 134 | $this->_flags &= ~self::IS_OVERLINE; |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | public function setStrikeout($value) |
166 | 166 | { |
167 | 167 | $this->_flags |= self::IS_SET_STRIKEOUT; |
168 | - if(TPropertyValue::ensureBoolean($value)) |
|
168 | + if (TPropertyValue::ensureBoolean($value)) |
|
169 | 169 | $this->_flags |= self::IS_STRIKEOUT; |
170 | 170 | else |
171 | 171 | $this->_flags &= ~self::IS_STRIKEOUT; |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | public function setUnderline($value) |
186 | 186 | { |
187 | 187 | $this->_flags |= self::IS_SET_UNDERLINE; |
188 | - if(TPropertyValue::ensureBoolean($value)) |
|
188 | + if (TPropertyValue::ensureBoolean($value)) |
|
189 | 189 | $this->_flags |= self::IS_UNDERLINE; |
190 | 190 | else |
191 | 191 | $this->_flags &= ~self::IS_UNDERLINE; |
@@ -234,21 +234,21 @@ discard block |
||
234 | 234 | */ |
235 | 235 | public function mergeWith($font) |
236 | 236 | { |
237 | - if($font === null || $font->_flags === 0) |
|
237 | + if ($font === null || $font->_flags === 0) |
|
238 | 238 | return; |
239 | - if(!($this->_flags & self::IS_SET_BOLD) && ($font->_flags & self::IS_SET_BOLD)) |
|
239 | + if (!($this->_flags & self::IS_SET_BOLD) && ($font->_flags & self::IS_SET_BOLD)) |
|
240 | 240 | $this->setBold($font->getBold()); |
241 | - if(!($this->_flags & self::IS_SET_ITALIC) && ($font->_flags & self::IS_SET_ITALIC)) |
|
241 | + if (!($this->_flags & self::IS_SET_ITALIC) && ($font->_flags & self::IS_SET_ITALIC)) |
|
242 | 242 | $this->setItalic($font->getItalic()); |
243 | - if(!($this->_flags & self::IS_SET_OVERLINE) && ($font->_flags & self::IS_SET_OVERLINE)) |
|
243 | + if (!($this->_flags & self::IS_SET_OVERLINE) && ($font->_flags & self::IS_SET_OVERLINE)) |
|
244 | 244 | $this->setOverline($font->getOverline()); |
245 | - if(!($this->_flags & self::IS_SET_STRIKEOUT) && ($font->_flags & self::IS_SET_STRIKEOUT)) |
|
245 | + if (!($this->_flags & self::IS_SET_STRIKEOUT) && ($font->_flags & self::IS_SET_STRIKEOUT)) |
|
246 | 246 | $this->setStrikeout($font->getStrikeout()); |
247 | - if(!($this->_flags & self::IS_SET_UNDERLINE) && ($font->_flags & self::IS_SET_UNDERLINE)) |
|
247 | + if (!($this->_flags & self::IS_SET_UNDERLINE) && ($font->_flags & self::IS_SET_UNDERLINE)) |
|
248 | 248 | $this->setUnderline($font->getUnderline()); |
249 | - if(!($this->_flags & self::IS_SET_SIZE) && ($font->_flags & self::IS_SET_SIZE)) |
|
249 | + if (!($this->_flags & self::IS_SET_SIZE) && ($font->_flags & self::IS_SET_SIZE)) |
|
250 | 250 | $this->setSize($font->getSize()); |
251 | - if(!($this->_flags & self::IS_SET_NAME) && ($font->_flags & self::IS_SET_NAME)) |
|
251 | + if (!($this->_flags & self::IS_SET_NAME) && ($font->_flags & self::IS_SET_NAME)) |
|
252 | 252 | $this->setName($font->getName()); |
253 | 253 | } |
254 | 254 | |
@@ -260,21 +260,21 @@ discard block |
||
260 | 260 | */ |
261 | 261 | public function copyFrom($font) |
262 | 262 | { |
263 | - if($font === null || $font->_flags === 0) |
|
263 | + if ($font === null || $font->_flags === 0) |
|
264 | 264 | return; |
265 | - if($font->_flags & self::IS_SET_BOLD) |
|
265 | + if ($font->_flags & self::IS_SET_BOLD) |
|
266 | 266 | $this->setBold($font->getBold()); |
267 | - if($font->_flags & self::IS_SET_ITALIC) |
|
267 | + if ($font->_flags & self::IS_SET_ITALIC) |
|
268 | 268 | $this->setItalic($font->getItalic()); |
269 | - if($font->_flags & self::IS_SET_OVERLINE) |
|
269 | + if ($font->_flags & self::IS_SET_OVERLINE) |
|
270 | 270 | $this->setOverline($font->getOverline()); |
271 | - if($font->_flags & self::IS_SET_STRIKEOUT) |
|
271 | + if ($font->_flags & self::IS_SET_STRIKEOUT) |
|
272 | 272 | $this->setStrikeout($font->getStrikeout()); |
273 | - if($font->_flags & self::IS_SET_UNDERLINE) |
|
273 | + if ($font->_flags & self::IS_SET_UNDERLINE) |
|
274 | 274 | $this->setUnderline($font->getUnderline()); |
275 | - if($font->_flags & self::IS_SET_SIZE) |
|
275 | + if ($font->_flags & self::IS_SET_SIZE) |
|
276 | 276 | $this->setSize($font->getSize()); |
277 | - if($font->_flags & self::IS_SET_NAME) |
|
277 | + if ($font->_flags & self::IS_SET_NAME) |
|
278 | 278 | $this->setName($font->getName()); |
279 | 279 | } |
280 | 280 | |
@@ -283,27 +283,27 @@ discard block |
||
283 | 283 | */ |
284 | 284 | public function toString() |
285 | 285 | { |
286 | - if($this->_flags === 0) |
|
286 | + if ($this->_flags === 0) |
|
287 | 287 | return ''; |
288 | 288 | $str = ''; |
289 | - if($this->_flags & self::IS_SET_BOLD) |
|
290 | - $str .= 'font-weight:' . (($this->_flags & self::IS_BOLD)?'bold;':'normal;'); |
|
291 | - if($this->_flags & self::IS_SET_ITALIC) |
|
292 | - $str .= 'font-style:' . (($this->_flags & self::IS_ITALIC)?'italic;':'normal;'); |
|
289 | + if ($this->_flags & self::IS_SET_BOLD) |
|
290 | + $str .= 'font-weight:'.(($this->_flags & self::IS_BOLD) ? 'bold;' : 'normal;'); |
|
291 | + if ($this->_flags & self::IS_SET_ITALIC) |
|
292 | + $str .= 'font-style:'.(($this->_flags & self::IS_ITALIC) ? 'italic;' : 'normal;'); |
|
293 | 293 | $textDec = ''; |
294 | - if($this->_flags & self::IS_UNDERLINE) |
|
294 | + if ($this->_flags & self::IS_UNDERLINE) |
|
295 | 295 | $textDec .= 'underline'; |
296 | - if($this->_flags & self::IS_OVERLINE) |
|
296 | + if ($this->_flags & self::IS_OVERLINE) |
|
297 | 297 | $textDec .= ' overline'; |
298 | - if($this->_flags & self::IS_STRIKEOUT) |
|
298 | + if ($this->_flags & self::IS_STRIKEOUT) |
|
299 | 299 | $textDec .= ' line-through'; |
300 | 300 | $textDec = ltrim($textDec); |
301 | - if($textDec !== '') |
|
302 | - $str .= 'text-decoration:' . $textDec . ';'; |
|
303 | - if($this->_size !== '') |
|
304 | - $str .= 'font-size:' . $this->_size . ';'; |
|
305 | - if($this->_name !== '') |
|
306 | - $str .= 'font-family:' . $this->_name . ';'; |
|
301 | + if ($textDec !== '') |
|
302 | + $str .= 'text-decoration:'.$textDec.';'; |
|
303 | + if ($this->_size !== '') |
|
304 | + $str .= 'font-size:'.$this->_size.';'; |
|
305 | + if ($this->_name !== '') |
|
306 | + $str .= 'font-family:'.$this->_name.';'; |
|
307 | 307 | return $str; |
308 | 308 | } |
309 | 309 | |
@@ -313,25 +313,25 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public function addAttributesToRender($writer) |
315 | 315 | { |
316 | - if($this->_flags === 0) |
|
316 | + if ($this->_flags === 0) |
|
317 | 317 | return; |
318 | - if($this->_flags & self::IS_SET_BOLD) |
|
319 | - $writer->addStyleAttribute('font-weight', (($this->_flags & self::IS_BOLD)?'bold':'normal')); |
|
320 | - if($this->_flags & self::IS_SET_ITALIC) |
|
321 | - $writer->addStyleAttribute('font-style', (($this->_flags & self::IS_ITALIC)?'italic':'normal')); |
|
318 | + if ($this->_flags & self::IS_SET_BOLD) |
|
319 | + $writer->addStyleAttribute('font-weight', (($this->_flags & self::IS_BOLD) ? 'bold' : 'normal')); |
|
320 | + if ($this->_flags & self::IS_SET_ITALIC) |
|
321 | + $writer->addStyleAttribute('font-style', (($this->_flags & self::IS_ITALIC) ? 'italic' : 'normal')); |
|
322 | 322 | $textDec = ''; |
323 | - if($this->_flags & self::IS_UNDERLINE) |
|
323 | + if ($this->_flags & self::IS_UNDERLINE) |
|
324 | 324 | $textDec .= 'underline'; |
325 | - if($this->_flags & self::IS_OVERLINE) |
|
325 | + if ($this->_flags & self::IS_OVERLINE) |
|
326 | 326 | $textDec .= ' overline'; |
327 | - if($this->_flags & self::IS_STRIKEOUT) |
|
327 | + if ($this->_flags & self::IS_STRIKEOUT) |
|
328 | 328 | $textDec .= ' line-through'; |
329 | 329 | $textDec = ltrim($textDec); |
330 | - if($textDec !== '') |
|
330 | + if ($textDec !== '') |
|
331 | 331 | $writer->addStyleAttribute('text-decoration', $textDec); |
332 | - if($this->_size !== '') |
|
332 | + if ($this->_size !== '') |
|
333 | 333 | $writer->addStyleAttribute('font-size', $this->_size); |
334 | - if($this->_name !== '') |
|
334 | + if ($this->_name !== '') |
|
335 | 335 | $writer->addStyleAttribute('font-family', $this->_name); |
336 | 336 | } |
337 | 337 | } |
@@ -66,12 +66,15 @@ discard block |
||
66 | 66 | protected function _getZappableSleepProps(&$exprops) |
67 | 67 | { |
68 | 68 | parent::_getZappableSleepProps($exprops); |
69 | - if ($this->_flags === 0) |
|
70 | - $exprops[] = "\0Prado\Web\UI\WebControls\TFont\0_flags"; |
|
71 | - if ($this->_name === '') |
|
72 | - $exprops[] = "\0Prado\Web\UI\WebControls\TFont\0_name"; |
|
73 | - if ($this->_size === '') |
|
74 | - $exprops[] = "\0Prado\Web\UI\WebControls\TFont\0_size"; |
|
69 | + if ($this->_flags === 0) { |
|
70 | + $exprops[] = "\0Prado\Web\UI\WebControls\TFont\0_flags"; |
|
71 | + } |
|
72 | + if ($this->_name === '') { |
|
73 | + $exprops[] = "\0Prado\Web\UI\WebControls\TFont\0_name"; |
|
74 | + } |
|
75 | + if ($this->_size === '') { |
|
76 | + $exprops[] = "\0Prado\Web\UI\WebControls\TFont\0_size"; |
|
77 | + } |
|
75 | 78 | } |
76 | 79 | |
77 | 80 | /** |
@@ -88,10 +91,11 @@ discard block |
||
88 | 91 | public function setBold($value) |
89 | 92 | { |
90 | 93 | $this->_flags |= self::IS_SET_BOLD; |
91 | - if(TPropertyValue::ensureBoolean($value)) |
|
92 | - $this->_flags |= self::IS_BOLD; |
|
93 | - else |
|
94 | - $this->_flags &= ~self::IS_BOLD; |
|
94 | + if(TPropertyValue::ensureBoolean($value)) { |
|
95 | + $this->_flags |= self::IS_BOLD; |
|
96 | + } else { |
|
97 | + $this->_flags &= ~self::IS_BOLD; |
|
98 | + } |
|
95 | 99 | } |
96 | 100 | |
97 | 101 | /** |
@@ -108,10 +112,11 @@ discard block |
||
108 | 112 | public function setItalic($value) |
109 | 113 | { |
110 | 114 | $this->_flags |= self::IS_SET_ITALIC; |
111 | - if(TPropertyValue::ensureBoolean($value)) |
|
112 | - $this->_flags |= self::IS_ITALIC; |
|
113 | - else |
|
114 | - $this->_flags &= ~self::IS_ITALIC; |
|
115 | + if(TPropertyValue::ensureBoolean($value)) { |
|
116 | + $this->_flags |= self::IS_ITALIC; |
|
117 | + } else { |
|
118 | + $this->_flags &= ~self::IS_ITALIC; |
|
119 | + } |
|
115 | 120 | } |
116 | 121 | |
117 | 122 | /** |
@@ -128,10 +133,11 @@ discard block |
||
128 | 133 | public function setOverline($value) |
129 | 134 | { |
130 | 135 | $this->_flags |= self::IS_SET_OVERLINE; |
131 | - if(TPropertyValue::ensureBoolean($value)) |
|
132 | - $this->_flags |= self::IS_OVERLINE; |
|
133 | - else |
|
134 | - $this->_flags &= ~self::IS_OVERLINE; |
|
136 | + if(TPropertyValue::ensureBoolean($value)) { |
|
137 | + $this->_flags |= self::IS_OVERLINE; |
|
138 | + } else { |
|
139 | + $this->_flags &= ~self::IS_OVERLINE; |
|
140 | + } |
|
135 | 141 | } |
136 | 142 | |
137 | 143 | /** |
@@ -165,10 +171,11 @@ discard block |
||
165 | 171 | public function setStrikeout($value) |
166 | 172 | { |
167 | 173 | $this->_flags |= self::IS_SET_STRIKEOUT; |
168 | - if(TPropertyValue::ensureBoolean($value)) |
|
169 | - $this->_flags |= self::IS_STRIKEOUT; |
|
170 | - else |
|
171 | - $this->_flags &= ~self::IS_STRIKEOUT; |
|
174 | + if(TPropertyValue::ensureBoolean($value)) { |
|
175 | + $this->_flags |= self::IS_STRIKEOUT; |
|
176 | + } else { |
|
177 | + $this->_flags &= ~self::IS_STRIKEOUT; |
|
178 | + } |
|
172 | 179 | } |
173 | 180 | |
174 | 181 | /** |
@@ -185,10 +192,11 @@ discard block |
||
185 | 192 | public function setUnderline($value) |
186 | 193 | { |
187 | 194 | $this->_flags |= self::IS_SET_UNDERLINE; |
188 | - if(TPropertyValue::ensureBoolean($value)) |
|
189 | - $this->_flags |= self::IS_UNDERLINE; |
|
190 | - else |
|
191 | - $this->_flags &= ~self::IS_UNDERLINE; |
|
195 | + if(TPropertyValue::ensureBoolean($value)) { |
|
196 | + $this->_flags |= self::IS_UNDERLINE; |
|
197 | + } else { |
|
198 | + $this->_flags &= ~self::IS_UNDERLINE; |
|
199 | + } |
|
192 | 200 | } |
193 | 201 | |
194 | 202 | /** |
@@ -234,22 +242,30 @@ discard block |
||
234 | 242 | */ |
235 | 243 | public function mergeWith($font) |
236 | 244 | { |
237 | - if($font === null || $font->_flags === 0) |
|
238 | - return; |
|
239 | - if(!($this->_flags & self::IS_SET_BOLD) && ($font->_flags & self::IS_SET_BOLD)) |
|
240 | - $this->setBold($font->getBold()); |
|
241 | - if(!($this->_flags & self::IS_SET_ITALIC) && ($font->_flags & self::IS_SET_ITALIC)) |
|
242 | - $this->setItalic($font->getItalic()); |
|
243 | - if(!($this->_flags & self::IS_SET_OVERLINE) && ($font->_flags & self::IS_SET_OVERLINE)) |
|
244 | - $this->setOverline($font->getOverline()); |
|
245 | - if(!($this->_flags & self::IS_SET_STRIKEOUT) && ($font->_flags & self::IS_SET_STRIKEOUT)) |
|
246 | - $this->setStrikeout($font->getStrikeout()); |
|
247 | - if(!($this->_flags & self::IS_SET_UNDERLINE) && ($font->_flags & self::IS_SET_UNDERLINE)) |
|
248 | - $this->setUnderline($font->getUnderline()); |
|
249 | - if(!($this->_flags & self::IS_SET_SIZE) && ($font->_flags & self::IS_SET_SIZE)) |
|
250 | - $this->setSize($font->getSize()); |
|
251 | - if(!($this->_flags & self::IS_SET_NAME) && ($font->_flags & self::IS_SET_NAME)) |
|
252 | - $this->setName($font->getName()); |
|
245 | + if($font === null || $font->_flags === 0) { |
|
246 | + return; |
|
247 | + } |
|
248 | + if(!($this->_flags & self::IS_SET_BOLD) && ($font->_flags & self::IS_SET_BOLD)) { |
|
249 | + $this->setBold($font->getBold()); |
|
250 | + } |
|
251 | + if(!($this->_flags & self::IS_SET_ITALIC) && ($font->_flags & self::IS_SET_ITALIC)) { |
|
252 | + $this->setItalic($font->getItalic()); |
|
253 | + } |
|
254 | + if(!($this->_flags & self::IS_SET_OVERLINE) && ($font->_flags & self::IS_SET_OVERLINE)) { |
|
255 | + $this->setOverline($font->getOverline()); |
|
256 | + } |
|
257 | + if(!($this->_flags & self::IS_SET_STRIKEOUT) && ($font->_flags & self::IS_SET_STRIKEOUT)) { |
|
258 | + $this->setStrikeout($font->getStrikeout()); |
|
259 | + } |
|
260 | + if(!($this->_flags & self::IS_SET_UNDERLINE) && ($font->_flags & self::IS_SET_UNDERLINE)) { |
|
261 | + $this->setUnderline($font->getUnderline()); |
|
262 | + } |
|
263 | + if(!($this->_flags & self::IS_SET_SIZE) && ($font->_flags & self::IS_SET_SIZE)) { |
|
264 | + $this->setSize($font->getSize()); |
|
265 | + } |
|
266 | + if(!($this->_flags & self::IS_SET_NAME) && ($font->_flags & self::IS_SET_NAME)) { |
|
267 | + $this->setName($font->getName()); |
|
268 | + } |
|
253 | 269 | } |
254 | 270 | |
255 | 271 | /** |
@@ -260,22 +276,30 @@ discard block |
||
260 | 276 | */ |
261 | 277 | public function copyFrom($font) |
262 | 278 | { |
263 | - if($font === null || $font->_flags === 0) |
|
264 | - return; |
|
265 | - if($font->_flags & self::IS_SET_BOLD) |
|
266 | - $this->setBold($font->getBold()); |
|
267 | - if($font->_flags & self::IS_SET_ITALIC) |
|
268 | - $this->setItalic($font->getItalic()); |
|
269 | - if($font->_flags & self::IS_SET_OVERLINE) |
|
270 | - $this->setOverline($font->getOverline()); |
|
271 | - if($font->_flags & self::IS_SET_STRIKEOUT) |
|
272 | - $this->setStrikeout($font->getStrikeout()); |
|
273 | - if($font->_flags & self::IS_SET_UNDERLINE) |
|
274 | - $this->setUnderline($font->getUnderline()); |
|
275 | - if($font->_flags & self::IS_SET_SIZE) |
|
276 | - $this->setSize($font->getSize()); |
|
277 | - if($font->_flags & self::IS_SET_NAME) |
|
278 | - $this->setName($font->getName()); |
|
279 | + if($font === null || $font->_flags === 0) { |
|
280 | + return; |
|
281 | + } |
|
282 | + if($font->_flags & self::IS_SET_BOLD) { |
|
283 | + $this->setBold($font->getBold()); |
|
284 | + } |
|
285 | + if($font->_flags & self::IS_SET_ITALIC) { |
|
286 | + $this->setItalic($font->getItalic()); |
|
287 | + } |
|
288 | + if($font->_flags & self::IS_SET_OVERLINE) { |
|
289 | + $this->setOverline($font->getOverline()); |
|
290 | + } |
|
291 | + if($font->_flags & self::IS_SET_STRIKEOUT) { |
|
292 | + $this->setStrikeout($font->getStrikeout()); |
|
293 | + } |
|
294 | + if($font->_flags & self::IS_SET_UNDERLINE) { |
|
295 | + $this->setUnderline($font->getUnderline()); |
|
296 | + } |
|
297 | + if($font->_flags & self::IS_SET_SIZE) { |
|
298 | + $this->setSize($font->getSize()); |
|
299 | + } |
|
300 | + if($font->_flags & self::IS_SET_NAME) { |
|
301 | + $this->setName($font->getName()); |
|
302 | + } |
|
279 | 303 | } |
280 | 304 | |
281 | 305 | /** |
@@ -283,27 +307,36 @@ discard block |
||
283 | 307 | */ |
284 | 308 | public function toString() |
285 | 309 | { |
286 | - if($this->_flags === 0) |
|
287 | - return ''; |
|
310 | + if($this->_flags === 0) { |
|
311 | + return ''; |
|
312 | + } |
|
288 | 313 | $str = ''; |
289 | - if($this->_flags & self::IS_SET_BOLD) |
|
290 | - $str .= 'font-weight:' . (($this->_flags & self::IS_BOLD)?'bold;':'normal;'); |
|
291 | - if($this->_flags & self::IS_SET_ITALIC) |
|
292 | - $str .= 'font-style:' . (($this->_flags & self::IS_ITALIC)?'italic;':'normal;'); |
|
314 | + if($this->_flags & self::IS_SET_BOLD) { |
|
315 | + $str .= 'font-weight:' . (($this->_flags & self::IS_BOLD)?'bold;':'normal;'); |
|
316 | + } |
|
317 | + if($this->_flags & self::IS_SET_ITALIC) { |
|
318 | + $str .= 'font-style:' . (($this->_flags & self::IS_ITALIC)?'italic;':'normal;'); |
|
319 | + } |
|
293 | 320 | $textDec = ''; |
294 | - if($this->_flags & self::IS_UNDERLINE) |
|
295 | - $textDec .= 'underline'; |
|
296 | - if($this->_flags & self::IS_OVERLINE) |
|
297 | - $textDec .= ' overline'; |
|
298 | - if($this->_flags & self::IS_STRIKEOUT) |
|
299 | - $textDec .= ' line-through'; |
|
321 | + if($this->_flags & self::IS_UNDERLINE) { |
|
322 | + $textDec .= 'underline'; |
|
323 | + } |
|
324 | + if($this->_flags & self::IS_OVERLINE) { |
|
325 | + $textDec .= ' overline'; |
|
326 | + } |
|
327 | + if($this->_flags & self::IS_STRIKEOUT) { |
|
328 | + $textDec .= ' line-through'; |
|
329 | + } |
|
300 | 330 | $textDec = ltrim($textDec); |
301 | - if($textDec !== '') |
|
302 | - $str .= 'text-decoration:' . $textDec . ';'; |
|
303 | - if($this->_size !== '') |
|
304 | - $str .= 'font-size:' . $this->_size . ';'; |
|
305 | - if($this->_name !== '') |
|
306 | - $str .= 'font-family:' . $this->_name . ';'; |
|
331 | + if($textDec !== '') { |
|
332 | + $str .= 'text-decoration:' . $textDec . ';'; |
|
333 | + } |
|
334 | + if($this->_size !== '') { |
|
335 | + $str .= 'font-size:' . $this->_size . ';'; |
|
336 | + } |
|
337 | + if($this->_name !== '') { |
|
338 | + $str .= 'font-family:' . $this->_name . ';'; |
|
339 | + } |
|
307 | 340 | return $str; |
308 | 341 | } |
309 | 342 | |
@@ -313,25 +346,34 @@ discard block |
||
313 | 346 | */ |
314 | 347 | public function addAttributesToRender($writer) |
315 | 348 | { |
316 | - if($this->_flags === 0) |
|
317 | - return; |
|
318 | - if($this->_flags & self::IS_SET_BOLD) |
|
319 | - $writer->addStyleAttribute('font-weight', (($this->_flags & self::IS_BOLD)?'bold':'normal')); |
|
320 | - if($this->_flags & self::IS_SET_ITALIC) |
|
321 | - $writer->addStyleAttribute('font-style', (($this->_flags & self::IS_ITALIC)?'italic':'normal')); |
|
349 | + if($this->_flags === 0) { |
|
350 | + return; |
|
351 | + } |
|
352 | + if($this->_flags & self::IS_SET_BOLD) { |
|
353 | + $writer->addStyleAttribute('font-weight', (($this->_flags & self::IS_BOLD)?'bold':'normal')); |
|
354 | + } |
|
355 | + if($this->_flags & self::IS_SET_ITALIC) { |
|
356 | + $writer->addStyleAttribute('font-style', (($this->_flags & self::IS_ITALIC)?'italic':'normal')); |
|
357 | + } |
|
322 | 358 | $textDec = ''; |
323 | - if($this->_flags & self::IS_UNDERLINE) |
|
324 | - $textDec .= 'underline'; |
|
325 | - if($this->_flags & self::IS_OVERLINE) |
|
326 | - $textDec .= ' overline'; |
|
327 | - if($this->_flags & self::IS_STRIKEOUT) |
|
328 | - $textDec .= ' line-through'; |
|
359 | + if($this->_flags & self::IS_UNDERLINE) { |
|
360 | + $textDec .= 'underline'; |
|
361 | + } |
|
362 | + if($this->_flags & self::IS_OVERLINE) { |
|
363 | + $textDec .= ' overline'; |
|
364 | + } |
|
365 | + if($this->_flags & self::IS_STRIKEOUT) { |
|
366 | + $textDec .= ' line-through'; |
|
367 | + } |
|
329 | 368 | $textDec = ltrim($textDec); |
330 | - if($textDec !== '') |
|
331 | - $writer->addStyleAttribute('text-decoration', $textDec); |
|
332 | - if($this->_size !== '') |
|
333 | - $writer->addStyleAttribute('font-size', $this->_size); |
|
334 | - if($this->_name !== '') |
|
335 | - $writer->addStyleAttribute('font-family', $this->_name); |
|
369 | + if($textDec !== '') { |
|
370 | + $writer->addStyleAttribute('text-decoration', $textDec); |
|
371 | + } |
|
372 | + if($this->_size !== '') { |
|
373 | + $writer->addStyleAttribute('font-size', $this->_size); |
|
374 | + } |
|
375 | + if($this->_name !== '') { |
|
376 | + $writer->addStyleAttribute('font-family', $this->_name); |
|
377 | + } |
|
336 | 378 | } |
337 | 379 | } |