@@ -8,7 +8,6 @@ |
||
| 8 | 8 | /** |
| 9 | 9 | * Class constructor |
| 10 | 10 | * |
| 11 | - * @param string $text raw HTML to add |
|
| 12 | 11 | * @access public |
| 13 | 12 | * @return void |
| 14 | 13 | */ |
@@ -6,12 +6,12 @@ discard block |
||
| 6 | 6 | class HTML_QuickForm_advanced_settings extends HTML_QuickForm_static |
| 7 | 7 | { |
| 8 | 8 | /** |
| 9 | - * Class constructor |
|
| 10 | - * |
|
| 11 | - * @param string $text raw HTML to add |
|
| 12 | - * @access public |
|
| 13 | - * @return void |
|
| 14 | - */ |
|
| 9 | + * Class constructor |
|
| 10 | + * |
|
| 11 | + * @param string $text raw HTML to add |
|
| 12 | + * @access public |
|
| 13 | + * @return void |
|
| 14 | + */ |
|
| 15 | 15 | public function __construct($name = '', $label = '') |
| 16 | 16 | { |
| 17 | 17 | if (empty($label)) { |
@@ -26,13 +26,13 @@ discard block |
||
| 26 | 26 | $this->_type = 'html'; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Accepts a renderer |
|
| 31 | - * |
|
| 32 | - * @param HTML_QuickForm_Renderer renderer object (only works with Default renderer!) |
|
| 33 | - * @access public |
|
| 34 | - * @return void |
|
| 35 | - */ |
|
| 29 | + /** |
|
| 30 | + * Accepts a renderer |
|
| 31 | + * |
|
| 32 | + * @param HTML_QuickForm_Renderer renderer object (only works with Default renderer!) |
|
| 33 | + * @access public |
|
| 34 | + * @return void |
|
| 35 | + */ |
|
| 36 | 36 | function accept(&$renderer, $required = false, $error = null) |
| 37 | 37 | { |
| 38 | 38 | $renderer->renderHtml($this); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | - * @param mixed $class |
|
| 120 | + * @param string|null $class |
|
| 121 | 121 | */ |
| 122 | 122 | public function setClass($class) |
| 123 | 123 | { |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
| 128 | - * @return mixed |
|
| 128 | + * @return string|null |
|
| 129 | 129 | */ |
| 130 | 130 | public function getIcon() |
| 131 | 131 | { |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
| 136 | - * @param mixed $icon |
|
| 136 | + * @param string $icon |
|
| 137 | 137 | */ |
| 138 | 138 | public function setIcon($icon) |
| 139 | 139 | { |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /** |
| 144 | - * @return mixed |
|
| 144 | + * @return string|null |
|
| 145 | 145 | */ |
| 146 | 146 | public function getStyle() |
| 147 | 147 | { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
| 152 | - * @param mixed $style |
|
| 152 | + * @param string $style |
|
| 153 | 153 | */ |
| 154 | 154 | public function setStyle($style) |
| 155 | 155 | { |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $this->columnsSize = $columnsSize; |
| 181 | 181 | } |
| 182 | 182 | /** |
| 183 | - * @param mixed $size |
|
| 183 | + * @param string $size |
|
| 184 | 184 | */ |
| 185 | 185 | public function setSize($size) |
| 186 | 186 | { |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * Freeze the element so that only its value is returned |
| 208 | 208 | * |
| 209 | 209 | * @access public |
| 210 | - * @return void |
|
| 210 | + * @return boolean |
|
| 211 | 211 | */ |
| 212 | 212 | public function freeze() |
| 213 | 213 | { |
@@ -94,14 +94,14 @@ |
||
| 94 | 94 | $icon = $this->getIcon(); |
| 95 | 95 | |
| 96 | 96 | if (!empty($icon)) { |
| 97 | - $icon = '<em class="' . $this->getIcon() . '"></em> '; |
|
| 97 | + $icon = '<em class="'.$this->getIcon().'"></em> '; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $class = $this->getClass().' '.$this->getStyle().' '.$this->getSize(); |
| 101 | 101 | |
| 102 | 102 | return |
| 103 | - $this->_getTabs() . ' |
|
| 104 | - <button class="'.$class.'" ' . $this->_getAttrString($this->_attributes) . '>'. |
|
| 103 | + $this->_getTabs().' |
|
| 104 | + <button class="'.$class.'" '.$this->_getAttrString($this->_attributes).'>'. |
|
| 105 | 105 | $icon. |
| 106 | 106 | $value. |
| 107 | 107 | '</button>'; |
@@ -191,6 +191,7 @@ |
||
| 191 | 191 | * @access public |
| 192 | 192 | * @param HTML_QuickForm_Page The page that failed to handle the action |
| 193 | 193 | * @param string Name of the action |
| 194 | + * @param HTML_QuickForm_Page $page |
|
| 194 | 195 | * @throws PEAR_Error |
| 195 | 196 | */ |
| 196 | 197 | function handle(&$page, $actionName) |
@@ -40,48 +40,48 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | class HTML_QuickForm_Controller |
| 42 | 42 | { |
| 43 | - /** |
|
| 44 | - * Contains the pages (HTML_QuickForm_Page objects) of the miultipage form |
|
| 45 | - * @var array |
|
| 46 | - */ |
|
| 43 | + /** |
|
| 44 | + * Contains the pages (HTML_QuickForm_Page objects) of the miultipage form |
|
| 45 | + * @var array |
|
| 46 | + */ |
|
| 47 | 47 | var $_pages = array(); |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * Contains the mapping of actions to corresponding HTML_QuickForm_Action objects |
|
| 51 | - * @var array |
|
| 52 | - */ |
|
| 49 | + /** |
|
| 50 | + * Contains the mapping of actions to corresponding HTML_QuickForm_Action objects |
|
| 51 | + * @var array |
|
| 52 | + */ |
|
| 53 | 53 | var $_actions = array(); |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Name of the form, used to store the values in session |
|
| 57 | - * @var string |
|
| 58 | - */ |
|
| 55 | + /** |
|
| 56 | + * Name of the form, used to store the values in session |
|
| 57 | + * @var string |
|
| 58 | + */ |
|
| 59 | 59 | var $_name; |
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Whether the form is modal |
|
| 63 | - * @var bool |
|
| 64 | - */ |
|
| 61 | + /** |
|
| 62 | + * Whether the form is modal |
|
| 63 | + * @var bool |
|
| 64 | + */ |
|
| 65 | 65 | var $_modal = true; |
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * The action extracted from HTTP request: array('page', 'action') |
|
| 69 | - * @var array |
|
| 70 | - */ |
|
| 67 | + /** |
|
| 68 | + * The action extracted from HTTP request: array('page', 'action') |
|
| 69 | + * @var array |
|
| 70 | + */ |
|
| 71 | 71 | var $_actionName = null; |
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Class constructor. |
|
| 75 | - * |
|
| 76 | - * Sets the form name and modal/non-modal behaviuor. Different multipage |
|
| 77 | - * forms should have different names, as they are used to store form |
|
| 78 | - * values in session. Modal forms allow passing to the next page only when |
|
| 79 | - * all of the previous pages are valid. |
|
| 80 | - * |
|
| 81 | - * @access public |
|
| 82 | - * @param string form name |
|
| 83 | - * @param bool whether the form is modal |
|
| 84 | - */ |
|
| 73 | + /** |
|
| 74 | + * Class constructor. |
|
| 75 | + * |
|
| 76 | + * Sets the form name and modal/non-modal behaviuor. Different multipage |
|
| 77 | + * forms should have different names, as they are used to store form |
|
| 78 | + * values in session. Modal forms allow passing to the next page only when |
|
| 79 | + * all of the previous pages are valid. |
|
| 80 | + * |
|
| 81 | + * @access public |
|
| 82 | + * @param string form name |
|
| 83 | + * @param bool whether the form is modal |
|
| 84 | + */ |
|
| 85 | 85 | function HTML_QuickForm_Controller($name, $modal = true) |
| 86 | 86 | { |
| 87 | 87 | $this->_name = $name; |
@@ -89,17 +89,17 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Returns a reference to a session variable containing the form-page |
|
| 94 | - * values and pages' validation status. |
|
| 95 | - * |
|
| 96 | - * This is a "low-level" method, use exportValues() if you want just to |
|
| 97 | - * get the form's values. |
|
| 98 | - * |
|
| 99 | - * @access public |
|
| 100 | - * @param bool If true, then reset the container: clear all default, constant and submitted values |
|
| 101 | - * @return array |
|
| 102 | - */ |
|
| 92 | + /** |
|
| 93 | + * Returns a reference to a session variable containing the form-page |
|
| 94 | + * values and pages' validation status. |
|
| 95 | + * |
|
| 96 | + * This is a "low-level" method, use exportValues() if you want just to |
|
| 97 | + * get the form's values. |
|
| 98 | + * |
|
| 99 | + * @access public |
|
| 100 | + * @param bool If true, then reset the container: clear all default, constant and submitted values |
|
| 101 | + * @return array |
|
| 102 | + */ |
|
| 103 | 103 | function &container($reset = false) |
| 104 | 104 | { |
| 105 | 105 | $name = '_' . $this->_name . '_container'; |
@@ -121,15 +121,15 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | |
| 124 | - /** |
|
| 125 | - * Processes the request. |
|
| 126 | - * |
|
| 127 | - * This finds the current page, the current action and passes the action |
|
| 128 | - * to the page's handle() method. |
|
| 129 | - * |
|
| 130 | - * @access public |
|
| 131 | - * @throws PEAR_Error |
|
| 132 | - */ |
|
| 124 | + /** |
|
| 125 | + * Processes the request. |
|
| 126 | + * |
|
| 127 | + * This finds the current page, the current action and passes the action |
|
| 128 | + * to the page's handle() method. |
|
| 129 | + * |
|
| 130 | + * @access public |
|
| 131 | + * @throws PEAR_Error |
|
| 132 | + */ |
|
| 133 | 133 | function run() |
| 134 | 134 | { |
| 135 | 135 | // the names of the action and page should be saved |
@@ -138,25 +138,25 @@ discard block |
||
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | |
| 141 | - /** |
|
| 142 | - * Registers a handler for a specific action. |
|
| 143 | - * |
|
| 144 | - * @access public |
|
| 145 | - * @param string name of the action |
|
| 146 | - * @param HTML_QuickForm_Action the handler for the action |
|
| 147 | - */ |
|
| 141 | + /** |
|
| 142 | + * Registers a handler for a specific action. |
|
| 143 | + * |
|
| 144 | + * @access public |
|
| 145 | + * @param string name of the action |
|
| 146 | + * @param HTML_QuickForm_Action the handler for the action |
|
| 147 | + */ |
|
| 148 | 148 | function addAction($actionName, &$action) |
| 149 | 149 | { |
| 150 | 150 | $this->_actions[$actionName] =& $action; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
| 154 | - /** |
|
| 155 | - * Adds a new page to the form |
|
| 156 | - * |
|
| 157 | - * @access public |
|
| 158 | - * @param HTML_QuickForm_Page |
|
| 159 | - */ |
|
| 154 | + /** |
|
| 155 | + * Adds a new page to the form |
|
| 156 | + * |
|
| 157 | + * @access public |
|
| 158 | + * @param HTML_QuickForm_Page |
|
| 159 | + */ |
|
| 160 | 160 | function addPage(&$page) |
| 161 | 161 | { |
| 162 | 162 | $page->controller =& $this; |
@@ -164,14 +164,14 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | |
| 167 | - /** |
|
| 168 | - * Returns a page |
|
| 169 | - * |
|
| 170 | - * @access public |
|
| 171 | - * @param string Name of a page |
|
| 172 | - * @return HTML_QuickForm_Page A reference to the page |
|
| 173 | - * @throws PEAR_Error |
|
| 174 | - */ |
|
| 167 | + /** |
|
| 168 | + * Returns a page |
|
| 169 | + * |
|
| 170 | + * @access public |
|
| 171 | + * @param string Name of a page |
|
| 172 | + * @return HTML_QuickForm_Page A reference to the page |
|
| 173 | + * @throws PEAR_Error |
|
| 174 | + */ |
|
| 175 | 175 | function &getPage($pageName) |
| 176 | 176 | { |
| 177 | 177 | if (!isset($this->_pages[$pageName])) { |
@@ -181,18 +181,18 @@ discard block |
||
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | |
| 184 | - /** |
|
| 185 | - * Handles an action. |
|
| 186 | - * |
|
| 187 | - * This will be called if the page itself does not have a handler |
|
| 188 | - * to a specific action. The method also loads and uses default handlers |
|
| 189 | - * for common actions, if specific ones were not added. |
|
| 190 | - * |
|
| 191 | - * @access public |
|
| 192 | - * @param HTML_QuickForm_Page The page that failed to handle the action |
|
| 193 | - * @param string Name of the action |
|
| 194 | - * @throws PEAR_Error |
|
| 195 | - */ |
|
| 184 | + /** |
|
| 185 | + * Handles an action. |
|
| 186 | + * |
|
| 187 | + * This will be called if the page itself does not have a handler |
|
| 188 | + * to a specific action. The method also loads and uses default handlers |
|
| 189 | + * for common actions, if specific ones were not added. |
|
| 190 | + * |
|
| 191 | + * @access public |
|
| 192 | + * @param HTML_QuickForm_Page The page that failed to handle the action |
|
| 193 | + * @param string Name of the action |
|
| 194 | + * @throws PEAR_Error |
|
| 195 | + */ |
|
| 196 | 196 | function handle(&$page, $actionName) |
| 197 | 197 | { |
| 198 | 198 | if (isset($this->_actions[$actionName])) { |
@@ -215,26 +215,26 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | |
| 218 | - /** |
|
| 219 | - * Checks whether the form is modal. |
|
| 220 | - * |
|
| 221 | - * @access public |
|
| 222 | - * @return bool |
|
| 223 | - */ |
|
| 218 | + /** |
|
| 219 | + * Checks whether the form is modal. |
|
| 220 | + * |
|
| 221 | + * @access public |
|
| 222 | + * @return bool |
|
| 223 | + */ |
|
| 224 | 224 | function isModal() |
| 225 | 225 | { |
| 226 | 226 | return $this->_modal; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | |
| 230 | - /** |
|
| 231 | - * Checks whether the pages of the controller are valid |
|
| 232 | - * |
|
| 233 | - * @access public |
|
| 234 | - * @param string If set, check only the pages before (not including) that page |
|
| 235 | - * @return bool |
|
| 236 | - * @throws PEAR_Error |
|
| 237 | - */ |
|
| 230 | + /** |
|
| 231 | + * Checks whether the pages of the controller are valid |
|
| 232 | + * |
|
| 233 | + * @access public |
|
| 234 | + * @param string If set, check only the pages before (not including) that page |
|
| 235 | + * @return bool |
|
| 236 | + * @throws PEAR_Error |
|
| 237 | + */ |
|
| 238 | 238 | function isValid($pageName = null) |
| 239 | 239 | { |
| 240 | 240 | $data =& $this->container(); |
@@ -273,13 +273,13 @@ discard block |
||
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | |
| 276 | - /** |
|
| 277 | - * Returns the name of the page before the given. |
|
| 278 | - * |
|
| 279 | - * @access public |
|
| 280 | - * @param string |
|
| 281 | - * @return string |
|
| 282 | - */ |
|
| 276 | + /** |
|
| 277 | + * Returns the name of the page before the given. |
|
| 278 | + * |
|
| 279 | + * @access public |
|
| 280 | + * @param string |
|
| 281 | + * @return string |
|
| 282 | + */ |
|
| 283 | 283 | function getPrevName($pageName) |
| 284 | 284 | { |
| 285 | 285 | $prev = null; |
@@ -292,13 +292,13 @@ discard block |
||
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | |
| 295 | - /** |
|
| 296 | - * Returns the name of the page after the given. |
|
| 297 | - * |
|
| 298 | - * @access public |
|
| 299 | - * @param string |
|
| 300 | - * @return string |
|
| 301 | - */ |
|
| 295 | + /** |
|
| 296 | + * Returns the name of the page after the given. |
|
| 297 | + * |
|
| 298 | + * @access public |
|
| 299 | + * @param string |
|
| 300 | + * @return string |
|
| 301 | + */ |
|
| 302 | 302 | function getNextName($pageName) |
| 303 | 303 | { |
| 304 | 304 | $prev = null; |
@@ -312,12 +312,12 @@ discard block |
||
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | |
| 315 | - /** |
|
| 316 | - * Finds the (first) invalid page |
|
| 317 | - * |
|
| 318 | - * @access public |
|
| 319 | - * @return string Name of an invalid page |
|
| 320 | - */ |
|
| 315 | + /** |
|
| 316 | + * Finds the (first) invalid page |
|
| 317 | + * |
|
| 318 | + * @access public |
|
| 319 | + * @return string Name of an invalid page |
|
| 320 | + */ |
|
| 321 | 321 | function findInvalid() |
| 322 | 322 | { |
| 323 | 323 | $data =& $this->container(); |
@@ -330,13 +330,13 @@ discard block |
||
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | |
| 333 | - /** |
|
| 334 | - * Extracts the names of the current page and the current action from |
|
| 335 | - * HTTP request data. |
|
| 336 | - * |
|
| 337 | - * @access public |
|
| 338 | - * @return array first element is page name, second is action name |
|
| 339 | - */ |
|
| 333 | + /** |
|
| 334 | + * Extracts the names of the current page and the current action from |
|
| 335 | + * HTTP request data. |
|
| 336 | + * |
|
| 337 | + * @access public |
|
| 338 | + * @return array first element is page name, second is action name |
|
| 339 | + */ |
|
| 340 | 340 | function getActionName() |
| 341 | 341 | { |
| 342 | 342 | if (is_array($this->_actionName)) { |
@@ -360,14 +360,14 @@ discard block |
||
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | |
| 363 | - /** |
|
| 364 | - * Initializes default form values. |
|
| 365 | - * |
|
| 366 | - * @access public |
|
| 367 | - * @param array default values |
|
| 368 | - * @param mixed filter(s) to apply to default values |
|
| 369 | - * @throws PEAR_Error |
|
| 370 | - */ |
|
| 363 | + /** |
|
| 364 | + * Initializes default form values. |
|
| 365 | + * |
|
| 366 | + * @access public |
|
| 367 | + * @param array default values |
|
| 368 | + * @param mixed filter(s) to apply to default values |
|
| 369 | + * @throws PEAR_Error |
|
| 370 | + */ |
|
| 371 | 371 | function setDefaults($defaultValues = null, $filter = null) |
| 372 | 372 | { |
| 373 | 373 | if (is_array($defaultValues)) { |
@@ -377,15 +377,15 @@ discard block |
||
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | |
| 380 | - /** |
|
| 381 | - * Initializes constant form values. |
|
| 382 | - * These values won't get overridden by POST or GET vars |
|
| 383 | - * |
|
| 384 | - * @access public |
|
| 385 | - * @param array constant values |
|
| 386 | - * @param mixed filter(s) to apply to constant values |
|
| 387 | - * @throws PEAR_Error |
|
| 388 | - */ |
|
| 380 | + /** |
|
| 381 | + * Initializes constant form values. |
|
| 382 | + * These values won't get overridden by POST or GET vars |
|
| 383 | + * |
|
| 384 | + * @access public |
|
| 385 | + * @param array constant values |
|
| 386 | + * @param mixed filter(s) to apply to constant values |
|
| 387 | + * @throws PEAR_Error |
|
| 388 | + */ |
|
| 389 | 389 | function setConstants($constantValues = null, $filter = null) |
| 390 | 390 | { |
| 391 | 391 | if (is_array($constantValues)) { |
@@ -395,15 +395,15 @@ discard block |
||
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | |
| 398 | - /** |
|
| 399 | - * Adds new values to defaults or constants array |
|
| 400 | - * |
|
| 401 | - * @access private |
|
| 402 | - * @param array array to add values to (either defaults or constants) |
|
| 403 | - * @param array values to add |
|
| 404 | - * @param mixed filters to apply to new values |
|
| 405 | - * @throws PEAR_Error |
|
| 406 | - */ |
|
| 398 | + /** |
|
| 399 | + * Adds new values to defaults or constants array |
|
| 400 | + * |
|
| 401 | + * @access private |
|
| 402 | + * @param array array to add values to (either defaults or constants) |
|
| 403 | + * @param array values to add |
|
| 404 | + * @param mixed filters to apply to new values |
|
| 405 | + * @throws PEAR_Error |
|
| 406 | + */ |
|
| 407 | 407 | function _setDefaultsOrConstants(&$values, $newValues, $filter = null) |
| 408 | 408 | { |
| 409 | 409 | if (isset($filter)) { |
@@ -425,14 +425,14 @@ discard block |
||
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | |
| 428 | - /** |
|
| 429 | - * Recursively applies the callback function to the value |
|
| 430 | - * |
|
| 431 | - * @param mixed Callback function |
|
| 432 | - * @param mixed Value to process |
|
| 433 | - * @access private |
|
| 434 | - * @return mixed Processed values |
|
| 435 | - */ |
|
| 428 | + /** |
|
| 429 | + * Recursively applies the callback function to the value |
|
| 430 | + * |
|
| 431 | + * @param mixed Callback function |
|
| 432 | + * @param mixed Value to process |
|
| 433 | + * @access private |
|
| 434 | + * @return mixed Processed values |
|
| 435 | + */ |
|
| 436 | 436 | function _arrayMapRecursive($callback, $value) |
| 437 | 437 | { |
| 438 | 438 | if (!is_array($value)) { |
@@ -447,12 +447,12 @@ discard block |
||
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | |
| 450 | - /** |
|
| 451 | - * Sets the default values for the given page |
|
| 452 | - * |
|
| 453 | - * @access public |
|
| 454 | - * @param string Name of a page |
|
| 455 | - */ |
|
| 450 | + /** |
|
| 451 | + * Sets the default values for the given page |
|
| 452 | + * |
|
| 453 | + * @access public |
|
| 454 | + * @param string Name of a page |
|
| 455 | + */ |
|
| 456 | 456 | function applyDefaults($pageName) |
| 457 | 457 | { |
| 458 | 458 | $data =& $this->container(); |
@@ -465,13 +465,13 @@ discard block |
||
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | |
| 468 | - /** |
|
| 469 | - * Returns the form's values |
|
| 470 | - * |
|
| 471 | - * @access public |
|
| 472 | - * @param string name of the page, if not set then returns values for all pages |
|
| 473 | - * @return array |
|
| 474 | - */ |
|
| 468 | + /** |
|
| 469 | + * Returns the form's values |
|
| 470 | + * |
|
| 471 | + * @access public |
|
| 472 | + * @param string name of the page, if not set then returns values for all pages |
|
| 473 | + * @return array |
|
| 474 | + */ |
|
| 475 | 475 | function exportValues($pageName = null) |
| 476 | 476 | { |
| 477 | 477 | $data =& $this->container(); |
@@ -497,14 +497,14 @@ discard block |
||
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | |
| 500 | - /** |
|
| 501 | - * Returns the element's value |
|
| 502 | - * |
|
| 503 | - * @access public |
|
| 504 | - * @param string name of the page |
|
| 505 | - * @param string name of the element in the page |
|
| 506 | - * @return mixed value for the element |
|
| 507 | - */ |
|
| 500 | + /** |
|
| 501 | + * Returns the element's value |
|
| 502 | + * |
|
| 503 | + * @access public |
|
| 504 | + * @param string name of the page |
|
| 505 | + * @param string name of the element in the page |
|
| 506 | + * @return mixed value for the element |
|
| 507 | + */ |
|
| 508 | 508 | function exportValue($pageName, $elementName) |
| 509 | 509 | { |
| 510 | 510 | $data =& $this->container(); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | function &container($reset = false) |
| 104 | 104 | { |
| 105 | - $name = '_' . $this->_name . '_container'; |
|
| 105 | + $name = '_'.$this->_name.'_container'; |
|
| 106 | 106 | if (!isset($_SESSION[$name]) || $reset) { |
| 107 | 107 | $_SESSION[$name] = array( |
| 108 | 108 | 'defaults' => array(), |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | function addAction($actionName, &$action) |
| 149 | 149 | { |
| 150 | - $this->_actions[$actionName] =& $action; |
|
| 150 | + $this->_actions[$actionName] = & $action; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
@@ -159,8 +159,8 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | function addPage(&$page) |
| 161 | 161 | { |
| 162 | - $page->controller =& $this; |
|
| 163 | - $this->_pages[$page->getAttribute('id')] =& $page; |
|
| 162 | + $page->controller = & $this; |
|
| 163 | + $this->_pages[$page->getAttribute('id')] = & $page; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | function &getPage($pageName) |
| 176 | 176 | { |
| 177 | 177 | if (!isset($this->_pages[$pageName])) { |
| 178 | - return PEAR::raiseError('HTML_QuickForm_Controller: Unknown page "' . $pageName . '"'); |
|
| 178 | + return PEAR::raiseError('HTML_QuickForm_Controller: Unknown page "'.$pageName.'"'); |
|
| 179 | 179 | } |
| 180 | 180 | return $this->_pages[$pageName]; |
| 181 | 181 | } |
@@ -204,13 +204,13 @@ discard block |
||
| 204 | 204 | case 'submit': |
| 205 | 205 | case 'display': |
| 206 | 206 | case 'jump': |
| 207 | - include_once 'HTML/QuickForm/Action/' . ucfirst($actionName) . '.php'; |
|
| 208 | - $className = 'HTML_QuickForm_Action_' . $actionName; |
|
| 209 | - $this->_actions[$actionName] =& new $className(); |
|
| 207 | + include_once 'HTML/QuickForm/Action/'.ucfirst($actionName).'.php'; |
|
| 208 | + $className = 'HTML_QuickForm_Action_'.$actionName; |
|
| 209 | + $this->_actions[$actionName] = & new $className(); |
|
| 210 | 210 | return $this->_actions[$actionName]->perform($page, $actionName); |
| 211 | 211 | break; |
| 212 | 212 | default: |
| 213 | - return PEAR::raiseError('HTML_QuickForm_Controller: Unhandled action "' . $actionName . '" in page "' . $page->getAttribute('id') . '"'); |
|
| 213 | + return PEAR::raiseError('HTML_QuickForm_Controller: Unhandled action "'.$actionName.'" in page "'.$page->getAttribute('id').'"'); |
|
| 214 | 214 | } // switch |
| 215 | 215 | } |
| 216 | 216 | |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | function isValid($pageName = null) |
| 239 | 239 | { |
| 240 | - $data =& $this->container(); |
|
| 240 | + $data = & $this->container(); |
|
| 241 | 241 | foreach (array_keys($this->_pages) as $key) { |
| 242 | 242 | if (isset($pageName) && $pageName == $key) { |
| 243 | 243 | return true; |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | // We should handle the possible situation when the user has never |
| 246 | 246 | // seen a page of a non-modal multipage form |
| 247 | 247 | if (!$this->isModal() && null === $data['valid'][$key]) { |
| 248 | - $page =& $this->_pages[$key]; |
|
| 248 | + $page = & $this->_pages[$key]; |
|
| 249 | 249 | // Fix for bug #8687: the unseen page was considered |
| 250 | 250 | // submitted, so defaults for checkboxes and multiselects |
| 251 | 251 | // were not used. Shouldn't break anything since this flag |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | function findInvalid() |
| 322 | 322 | { |
| 323 | - $data =& $this->container(); |
|
| 323 | + $data = & $this->container(); |
|
| 324 | 324 | foreach (array_keys($this->_pages) as $key) { |
| 325 | 325 | if (!$data['valid'][$key]) { |
| 326 | 326 | return $key; |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | return $this->_actionName; |
| 344 | 344 | } |
| 345 | 345 | $names = array_map('preg_quote', array_keys($this->_pages)); |
| 346 | - $regex = '/^_qf_(' . implode('|', $names) . ')_(.+?)(_x)?$/'; |
|
| 346 | + $regex = '/^_qf_('.implode('|', $names).')_(.+?)(_x)?$/'; |
|
| 347 | 347 | foreach (array_keys($_REQUEST) as $key) { |
| 348 | 348 | if (preg_match($regex, $key, $matches)) { |
| 349 | 349 | return array($matches[1], $matches[2]); |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | function setDefaults($defaultValues = null, $filter = null) |
| 372 | 372 | { |
| 373 | 373 | if (is_array($defaultValues)) { |
| 374 | - $data =& $this->container(); |
|
| 374 | + $data = & $this->container(); |
|
| 375 | 375 | return $this->_setDefaultsOrConstants($data['defaults'], $defaultValues, $filter); |
| 376 | 376 | } |
| 377 | 377 | } |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | function setConstants($constantValues = null, $filter = null) |
| 390 | 390 | { |
| 391 | 391 | if (is_array($constantValues)) { |
| 392 | - $data =& $this->container(); |
|
| 392 | + $data = & $this->container(); |
|
| 393 | 393 | return $this->_setDefaultsOrConstants($data['constants'], $constantValues, $filter); |
| 394 | 394 | } |
| 395 | 395 | } |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | */ |
| 456 | 456 | function applyDefaults($pageName) |
| 457 | 457 | { |
| 458 | - $data =& $this->container(); |
|
| 458 | + $data = & $this->container(); |
|
| 459 | 459 | if (!empty($data['defaults'])) { |
| 460 | 460 | $this->_pages[$pageName]->setDefaults($data['defaults']); |
| 461 | 461 | } |
@@ -474,8 +474,8 @@ discard block |
||
| 474 | 474 | */ |
| 475 | 475 | function exportValues($pageName = null) |
| 476 | 476 | { |
| 477 | - $data =& $this->container(); |
|
| 478 | - $values = array(); |
|
| 477 | + $data = & $this->container(); |
|
| 478 | + $values = array(); |
|
| 479 | 479 | if (isset($pageName)) { |
| 480 | 480 | $pages = array($pageName); |
| 481 | 481 | } else { |
@@ -507,8 +507,8 @@ discard block |
||
| 507 | 507 | */ |
| 508 | 508 | function exportValue($pageName, $elementName) |
| 509 | 509 | { |
| 510 | - $data =& $this->container(); |
|
| 511 | - return isset($data['values'][$pageName][$elementName])? $data['values'][$pageName][$elementName]: null; |
|
| 510 | + $data = & $this->container(); |
|
| 511 | + return isset($data['values'][$pageName][$elementName]) ? $data['values'][$pageName][$elementName] : null; |
|
| 512 | 512 | } |
| 513 | 513 | } |
| 514 | 514 | ?> |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | * Sets display text for the element |
| 357 | 357 | * |
| 358 | 358 | * @param string $label Display text for the element |
| 359 | - * @param string $label_for Optionally add a "for" attribute |
|
| 359 | + * @param string $labelFor Optionally add a "for" attribute |
|
| 360 | 360 | * @since 1.3 |
| 361 | 361 | * @access public |
| 362 | 362 | * @return void |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | * @param object &$caller calling object |
| 436 | 436 | * @since 1.0 |
| 437 | 437 | * @access public |
| 438 | - * @return void |
|
| 438 | + * @return boolean |
|
| 439 | 439 | */ |
| 440 | 440 | public function onQuickFormEvent($event, $arg, &$caller) |
| 441 | 441 | { |
@@ -259,13 +259,13 @@ discard block |
||
| 259 | 259 | // }}} |
| 260 | 260 | // {{{ unfreeze() |
| 261 | 261 | |
| 262 | - /** |
|
| 263 | - * Unfreezes the element so that it becomes editable |
|
| 264 | - * |
|
| 265 | - * @access public |
|
| 266 | - * @return void |
|
| 267 | - * @since 3.2.4 |
|
| 268 | - */ |
|
| 262 | + /** |
|
| 263 | + * Unfreezes the element so that it becomes editable |
|
| 264 | + * |
|
| 265 | + * @access public |
|
| 266 | + * @return void |
|
| 267 | + * @since 3.2.4 |
|
| 268 | + */ |
|
| 269 | 269 | function unfreeze() |
| 270 | 270 | { |
| 271 | 271 | $this->_flagFrozen = false; |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | // $this->_getPersistantData(); |
| 290 | 290 | |
| 291 | 291 | $value = ('' != $value ? @htmlspecialchars($value, ENT_COMPAT, HTML_Common::charset()): ' ') . |
| 292 | - $this->_getPersistantData(); |
|
| 292 | + $this->_getPersistantData(); |
|
| 293 | 293 | return '<span class="freeze">'.$value.'</span>'; |
| 294 | 294 | // |
| 295 | 295 | } //end func getFrozenHtml |
@@ -297,12 +297,12 @@ discard block |
||
| 297 | 297 | // }}} |
| 298 | 298 | // {{{ _getPersistantData() |
| 299 | 299 | |
| 300 | - /** |
|
| 301 | - * Used by getFrozenHtml() to pass the element's value if _persistantFreeze is on |
|
| 302 | - * |
|
| 303 | - * @access private |
|
| 304 | - * @return string |
|
| 305 | - */ |
|
| 300 | + /** |
|
| 301 | + * Used by getFrozenHtml() to pass the element's value if _persistantFreeze is on |
|
| 302 | + * |
|
| 303 | + * @access private |
|
| 304 | + * @return string |
|
| 305 | + */ |
|
| 306 | 306 | function _getPersistantData() |
| 307 | 307 | { |
| 308 | 308 | if (!$this->_persistantFreeze) { |
@@ -310,10 +310,10 @@ discard block |
||
| 310 | 310 | } else { |
| 311 | 311 | $id = $this->getAttribute('id'); |
| 312 | 312 | return '<input' . $this->_getAttrString(array( |
| 313 | - 'type' => 'hidden', |
|
| 314 | - 'name' => $this->getName(), |
|
| 315 | - 'value' => $this->getValue() |
|
| 316 | - ) + (isset($id)? array('id' => $id): array())) . ' />'; |
|
| 313 | + 'type' => 'hidden', |
|
| 314 | + 'name' => $this->getName(), |
|
| 315 | + 'value' => $this->getValue() |
|
| 316 | + ) + (isset($id)? array('id' => $id): array())) . ' />'; |
|
| 317 | 317 | } |
| 318 | 318 | } |
| 319 | 319 | |
@@ -415,9 +415,9 @@ discard block |
||
| 415 | 415 | return $values[$elementName]; |
| 416 | 416 | } elseif (strpos($elementName, '[')) { |
| 417 | 417 | $myVar = "['" . str_replace( |
| 418 | - array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"), |
|
| 419 | - $elementName |
|
| 420 | - ) . "']"; |
|
| 418 | + array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"), |
|
| 419 | + $elementName |
|
| 420 | + ) . "']"; |
|
| 421 | 421 | return eval("return (isset(\$values$myVar)) ? \$values$myVar : null;"); |
| 422 | 422 | } else { |
| 423 | 423 | return null; |
@@ -471,29 +471,29 @@ discard block |
||
| 471 | 471 | return true; |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | - /** |
|
| 475 | - * Accepts a renderer |
|
| 476 | - * |
|
| 477 | - * @param HTML_QuickForm_Renderer renderer object |
|
| 478 | - * @param bool Whether an element is required |
|
| 479 | - * @param string An error message associated with an element |
|
| 480 | - * @access public |
|
| 481 | - * @return void |
|
| 482 | - */ |
|
| 474 | + /** |
|
| 475 | + * Accepts a renderer |
|
| 476 | + * |
|
| 477 | + * @param HTML_QuickForm_Renderer renderer object |
|
| 478 | + * @param bool Whether an element is required |
|
| 479 | + * @param string An error message associated with an element |
|
| 480 | + * @access public |
|
| 481 | + * @return void |
|
| 482 | + */ |
|
| 483 | 483 | function accept(&$renderer, $required=false, $error=null) |
| 484 | 484 | { |
| 485 | 485 | $renderer->renderElement($this, $required, $error); |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | - /** |
|
| 489 | - * Automatically generates and assigns an 'id' attribute for the element. |
|
| 490 | - * |
|
| 491 | - * Currently used to ensure that labels work on radio buttons and |
|
| 492 | - * checkboxes. Per idea of Alexander Radivanovich. |
|
| 493 | - * |
|
| 494 | - * @access private |
|
| 495 | - * @return void |
|
| 496 | - */ |
|
| 488 | + /** |
|
| 489 | + * Automatically generates and assigns an 'id' attribute for the element. |
|
| 490 | + * |
|
| 491 | + * Currently used to ensure that labels work on radio buttons and |
|
| 492 | + * checkboxes. Per idea of Alexander Radivanovich. |
|
| 493 | + * |
|
| 494 | + * @access private |
|
| 495 | + * @return void |
|
| 496 | + */ |
|
| 497 | 497 | function _generateId() |
| 498 | 498 | { |
| 499 | 499 | static $idx = 1; |
@@ -503,14 +503,14 @@ discard block |
||
| 503 | 503 | } |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | - /** |
|
| 507 | - * Returns a 'safe' element's value |
|
| 508 | - * |
|
| 509 | - * @param array array of submitted values to search |
|
| 510 | - * @param bool whether to return the value as associative array |
|
| 511 | - * @access public |
|
| 512 | - * @return mixed |
|
| 513 | - */ |
|
| 506 | + /** |
|
| 507 | + * Returns a 'safe' element's value |
|
| 508 | + * |
|
| 509 | + * @param array array of submitted values to search |
|
| 510 | + * @param bool whether to return the value as associative array |
|
| 511 | + * @access public |
|
| 512 | + * @return mixed |
|
| 513 | + */ |
|
| 514 | 514 | function exportValue(&$submitValues, $assoc = false) |
| 515 | 515 | { |
| 516 | 516 | $value = $this->_findValue($submitValues); |
@@ -523,14 +523,14 @@ discard block |
||
| 523 | 523 | // }}} |
| 524 | 524 | // {{{ _prepareValue() |
| 525 | 525 | |
| 526 | - /** |
|
| 527 | - * Used by exportValue() to prepare the value for returning |
|
| 528 | - * |
|
| 529 | - * @param mixed the value found in exportValue() |
|
| 530 | - * @param bool whether to return the value as associative array |
|
| 531 | - * @access private |
|
| 532 | - * @return mixed |
|
| 533 | - */ |
|
| 526 | + /** |
|
| 527 | + * Used by exportValue() to prepare the value for returning |
|
| 528 | + * |
|
| 529 | + * @param mixed the value found in exportValue() |
|
| 530 | + * @param bool whether to return the value as associative array |
|
| 531 | + * @access private |
|
| 532 | + * @return mixed |
|
| 533 | + */ |
|
| 534 | 534 | function _prepareValue($value, $assoc) |
| 535 | 535 | { |
| 536 | 536 | if (null === $value) { |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | //return ('' != $value? htmlspecialchars($value): ' ') . |
| 289 | 289 | // $this->_getPersistantData(); |
| 290 | 290 | |
| 291 | - $value = ('' != $value ? @htmlspecialchars($value, ENT_COMPAT, HTML_Common::charset()): ' ') . |
|
| 291 | + $value = ('' != $value ? @htmlspecialchars($value, ENT_COMPAT, HTML_Common::charset()) : ' '). |
|
| 292 | 292 | $this->_getPersistantData(); |
| 293 | 293 | return '<span class="freeze">'.$value.'</span>'; |
| 294 | 294 | // |
@@ -309,11 +309,11 @@ discard block |
||
| 309 | 309 | return ''; |
| 310 | 310 | } else { |
| 311 | 311 | $id = $this->getAttribute('id'); |
| 312 | - return '<input' . $this->_getAttrString(array( |
|
| 312 | + return '<input'.$this->_getAttrString(array( |
|
| 313 | 313 | 'type' => 'hidden', |
| 314 | 314 | 'name' => $this->getName(), |
| 315 | 315 | 'value' => $this->getValue() |
| 316 | - ) + (isset($id)? array('id' => $id): array())) . ' />'; |
|
| 316 | + ) + (isset($id) ? array('id' => $id) : array())).' />'; |
|
| 317 | 317 | } |
| 318 | 318 | } |
| 319 | 319 | |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | * @access public |
| 345 | 345 | * @return void |
| 346 | 346 | */ |
| 347 | - function setPersistantFreeze($persistant=false) |
|
| 347 | + function setPersistantFreeze($persistant = false) |
|
| 348 | 348 | { |
| 349 | 349 | $this->_persistantFreeze = $persistant; |
| 350 | 350 | } //end func setPersistantFreeze |
@@ -414,10 +414,10 @@ discard block |
||
| 414 | 414 | if (isset($values[$elementName])) { |
| 415 | 415 | return $values[$elementName]; |
| 416 | 416 | } elseif (strpos($elementName, '[')) { |
| 417 | - $myVar = "['" . str_replace( |
|
| 417 | + $myVar = "['".str_replace( |
|
| 418 | 418 | array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"), |
| 419 | 419 | $elementName |
| 420 | - ) . "']"; |
|
| 420 | + )."']"; |
|
| 421 | 421 | return eval("return (isset(\$values$myVar)) ? \$values$myVar : null;"); |
| 422 | 422 | } else { |
| 423 | 423 | return null; |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | * @access public |
| 481 | 481 | * @return void |
| 482 | 482 | */ |
| 483 | - function accept(&$renderer, $required=false, $error=null) |
|
| 483 | + function accept(&$renderer, $required = false, $error = null) |
|
| 484 | 484 | { |
| 485 | 485 | $renderer->renderElement($this, $required, $error); |
| 486 | 486 | } |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | static $idx = 1; |
| 500 | 500 | |
| 501 | 501 | if (!$this->getAttribute('id')) { |
| 502 | - $this->updateAttributes(array('id' => 'qf_' . substr(md5(microtime() . $idx++), 0, 6))); |
|
| 502 | + $this->updateAttributes(array('id' => 'qf_'.substr(md5(microtime().$idx++), 0, 6))); |
|
| 503 | 503 | } |
| 504 | 504 | } |
| 505 | 505 | |
@@ -543,10 +543,10 @@ discard block |
||
| 543 | 543 | return array($name => $value); |
| 544 | 544 | } else { |
| 545 | 545 | $valueAry = array(); |
| 546 | - $myIndex = "['" . str_replace( |
|
| 546 | + $myIndex = "['".str_replace( |
|
| 547 | 547 | array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"), |
| 548 | 548 | $name |
| 549 | - ) . "']"; |
|
| 549 | + )."']"; |
|
| 550 | 550 | eval("\$valueAry$myIndex = \$value;"); |
| 551 | 551 | return $valueAry; |
| 552 | 552 | } |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | * |
| 87 | 87 | * @since 1.0 |
| 88 | 88 | * @access public |
| 89 | - * @return int |
|
| 89 | + * @return string|null |
|
| 90 | 90 | */ |
| 91 | 91 | function getSize() |
| 92 | 92 | { |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | // {{{ properties |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Uploaded file data, from $_FILES |
|
| 43 | - * @var array |
|
| 44 | - */ |
|
| 41 | + /** |
|
| 42 | + * Uploaded file data, from $_FILES |
|
| 43 | + * @var array |
|
| 44 | + */ |
|
| 45 | 45 | var $_value = null; |
| 46 | 46 | |
| 47 | 47 | // }}} |
@@ -237,15 +237,15 @@ discard block |
||
| 237 | 237 | // }}} |
| 238 | 238 | // {{{ _ruleCheckMaxFileSize() |
| 239 | 239 | |
| 240 | - /** |
|
| 241 | - * Tries to find the element value from the values array |
|
| 242 | - * |
|
| 243 | - * Needs to be redefined here as $_FILES is populated differently from |
|
| 244 | - * other arrays when element name is of the form foo[bar] |
|
| 245 | - * |
|
| 246 | - * @access private |
|
| 247 | - * @return mixed |
|
| 248 | - */ |
|
| 240 | + /** |
|
| 241 | + * Tries to find the element value from the values array |
|
| 242 | + * |
|
| 243 | + * Needs to be redefined here as $_FILES is populated differently from |
|
| 244 | + * other arrays when element name is of the form foo[bar] |
|
| 245 | + * |
|
| 246 | + * @access private |
|
| 247 | + * @return mixed |
|
| 248 | + */ |
|
| 249 | 249 | function _findValue(&$values = null) |
| 250 | 250 | { |
| 251 | 251 | if (empty($_FILES)) { |
@@ -262,12 +262,12 @@ discard block |
||
| 262 | 262 | $idx = "['" . str_replace( |
| 263 | 263 | array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"), |
| 264 | 264 | substr($elementName, $pos + 1, -1) |
| 265 | - ) . "']"; |
|
| 265 | + ) . "']"; |
|
| 266 | 266 | $props = array('name', 'type', 'size', 'tmp_name', 'error'); |
| 267 | 267 | $code = "if (!isset(\$_FILES['{$base}']['name']{$idx})) {\n" . |
| 268 | - " return null;\n" . |
|
| 269 | - "} else {\n" . |
|
| 270 | - " \$value = array();\n"; |
|
| 268 | + " return null;\n" . |
|
| 269 | + "} else {\n" . |
|
| 270 | + " \$value = array();\n"; |
|
| 271 | 271 | foreach ($props as $prop) { |
| 272 | 272 | $code .= " \$value['{$prop}'] = \$_FILES['{$base}']['{$prop}']{$idx};\n"; |
| 273 | 273 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @since 1.0 |
| 58 | 58 | * @access public |
| 59 | 59 | */ |
| 60 | - public function __construct($elementName=null, $elementLabel=null, $attributes=null) |
|
| 60 | + public function __construct($elementName = null, $elementLabel = null, $attributes = null) |
|
| 61 | 61 | { |
| 62 | 62 | parent::__construct($elementName, $elementLabel, $attributes); |
| 63 | 63 | $this->setType('file'); |
@@ -191,11 +191,11 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | public function moveUploadedFile($dest, $fileName = '') |
| 193 | 193 | { |
| 194 | - if ($dest != '' && substr($dest, -1) != '/') { |
|
| 194 | + if ($dest != '' && substr($dest, -1) != '/') { |
|
| 195 | 195 | $dest .= '/'; |
| 196 | 196 | } |
| 197 | 197 | $fileName = ($fileName != '') ? $fileName : basename($this->_value['name']); |
| 198 | - return move_uploaded_file($this->_value['tmp_name'], $dest . $fileName); |
|
| 198 | + return move_uploaded_file($this->_value['tmp_name'], $dest.$fileName); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -245,23 +245,23 @@ discard block |
||
| 245 | 245 | if (isset($_FILES[$elementName])) { |
| 246 | 246 | return $_FILES[$elementName]; |
| 247 | 247 | } elseif (false !== ($pos = strpos($elementName, '['))) { |
| 248 | - $base = str_replace( |
|
| 248 | + $base = str_replace( |
|
| 249 | 249 | array('\\', '\''), array('\\\\', '\\\''), |
| 250 | 250 | substr($elementName, 0, $pos) |
| 251 | 251 | ); |
| 252 | - $idx = "['" . str_replace( |
|
| 252 | + $idx = "['".str_replace( |
|
| 253 | 253 | array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"), |
| 254 | 254 | substr($elementName, $pos + 1, -1) |
| 255 | - ) . "']"; |
|
| 255 | + )."']"; |
|
| 256 | 256 | $props = array('name', 'type', 'size', 'tmp_name', 'error'); |
| 257 | - $code = "if (!isset(\$_FILES['{$base}']['name']{$idx})) {\n" . |
|
| 258 | - " return null;\n" . |
|
| 259 | - "} else {\n" . |
|
| 257 | + $code = "if (!isset(\$_FILES['{$base}']['name']{$idx})) {\n". |
|
| 258 | + " return null;\n". |
|
| 259 | + "} else {\n". |
|
| 260 | 260 | " \$value = array();\n"; |
| 261 | 261 | foreach ($props as $prop) { |
| 262 | 262 | $code .= " \$value['{$prop}'] = \$_FILES['{$base}']['{$prop}']{$idx};\n"; |
| 263 | 263 | } |
| 264 | - return eval($code . " return \$value;\n}\n"); |
|
| 264 | + return eval($code." return \$value;\n}\n"); |
|
| 265 | 265 | } else { |
| 266 | 266 | return null; |
| 267 | 267 | } |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | * @param object &$caller calling object |
| 346 | 346 | * @since 1.0 |
| 347 | 347 | * @access public |
| 348 | - * @return void |
|
| 348 | + * @return boolean |
|
| 349 | 349 | */ |
| 350 | 350 | public function onQuickFormEvent($event, $arg, &$caller) |
| 351 | 351 | { |
@@ -384,6 +384,7 @@ discard block |
||
| 384 | 384 | * @param HTML_QuickForm_Renderer renderer object |
| 385 | 385 | * @param bool Whether a group is required |
| 386 | 386 | * @param string An error message associated with a group |
| 387 | + * @param HTML_QuickForm_Renderer_Default $renderer |
|
| 387 | 388 | * @access public |
| 388 | 389 | * @return void |
| 389 | 390 | */ |
@@ -68,12 +68,12 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | private $_required = array(); |
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Whether to change elements' names to $groupName[$elementName] or leave them as is |
|
| 73 | - * @var bool |
|
| 74 | - * @since 3.0 |
|
| 75 | - * @access private |
|
| 76 | - */ |
|
| 71 | + /** |
|
| 72 | + * Whether to change elements' names to $groupName[$elementName] or leave them as is |
|
| 73 | + * @var bool |
|
| 74 | + * @since 3.0 |
|
| 75 | + * @access private |
|
| 76 | + */ |
|
| 77 | 77 | private $_appendName = true; |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -378,15 +378,15 @@ discard block |
||
| 378 | 378 | return true; |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - /** |
|
| 382 | - * Accepts a renderer |
|
| 383 | - * |
|
| 384 | - * @param HTML_QuickForm_Renderer renderer object |
|
| 385 | - * @param bool Whether a group is required |
|
| 386 | - * @param string An error message associated with a group |
|
| 387 | - * @access public |
|
| 388 | - * @return void |
|
| 389 | - */ |
|
| 381 | + /** |
|
| 382 | + * Accepts a renderer |
|
| 383 | + * |
|
| 384 | + * @param HTML_QuickForm_Renderer renderer object |
|
| 385 | + * @param bool Whether a group is required |
|
| 386 | + * @param string An error message associated with a group |
|
| 387 | + * @access public |
|
| 388 | + * @return void |
|
| 389 | + */ |
|
| 390 | 390 | function accept(&$renderer, $required = false, $error = null) |
| 391 | 391 | { |
| 392 | 392 | $this->_createElementsIfNotExist(); |
@@ -416,10 +416,10 @@ discard block |
||
| 416 | 416 | $renderer->finishGroup($this); |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - /** |
|
| 420 | - * As usual, to get the group's value we access its elements and call |
|
| 421 | - * their exportValue() methods |
|
| 422 | - */ |
|
| 419 | + /** |
|
| 420 | + * As usual, to get the group's value we access its elements and call |
|
| 421 | + * their exportValue() methods |
|
| 422 | + */ |
|
| 423 | 423 | function exportValue(&$submitValues, $assoc = false) |
| 424 | 424 | { |
| 425 | 425 | $value = null; |
@@ -462,31 +462,31 @@ discard block |
||
| 462 | 462 | return $value; |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | - /** |
|
| 466 | - * Creates the group's elements. |
|
| 467 | - * |
|
| 468 | - * This should be overriden by child classes that need to create their |
|
| 469 | - * elements. The method will be called automatically when needed, calling |
|
| 470 | - * it from the constructor is discouraged as the constructor is usually |
|
| 471 | - * called _twice_ on element creation, first time with _no_ parameters. |
|
| 472 | - * |
|
| 473 | - * @access private |
|
| 474 | - * @abstract |
|
| 475 | - */ |
|
| 465 | + /** |
|
| 466 | + * Creates the group's elements. |
|
| 467 | + * |
|
| 468 | + * This should be overriden by child classes that need to create their |
|
| 469 | + * elements. The method will be called automatically when needed, calling |
|
| 470 | + * it from the constructor is discouraged as the constructor is usually |
|
| 471 | + * called _twice_ on element creation, first time with _no_ parameters. |
|
| 472 | + * |
|
| 473 | + * @access private |
|
| 474 | + * @abstract |
|
| 475 | + */ |
|
| 476 | 476 | function _createElements() |
| 477 | 477 | { |
| 478 | 478 | // abstract |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | - /** |
|
| 482 | - * A wrapper around _createElements() |
|
| 483 | - * |
|
| 484 | - * This method calls _createElements() if the group's _elements array |
|
| 485 | - * is empty. It also performs some updates, e.g. freezes the created |
|
| 486 | - * elements if the group is already frozen. |
|
| 487 | - * |
|
| 488 | - * @access private |
|
| 489 | - */ |
|
| 481 | + /** |
|
| 482 | + * A wrapper around _createElements() |
|
| 483 | + * |
|
| 484 | + * This method calls _createElements() if the group's _elements array |
|
| 485 | + * is empty. It also performs some updates, e.g. freezes the created |
|
| 486 | + * elements if the group is already frozen. |
|
| 487 | + * |
|
| 488 | + * @access private |
|
| 489 | + */ |
|
| 490 | 490 | function _createElementsIfNotExist() |
| 491 | 491 | { |
| 492 | 492 | if (empty($this->_elements)) { |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @access public |
| 92 | 92 | * @return void |
| 93 | 93 | */ |
| 94 | - public function __construct($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true) |
|
| 94 | + public function __construct($elementName = null, $elementLabel = null, $elements = null, $separator = null, $appendName = true) |
|
| 95 | 95 | { |
| 96 | 96 | parent::__construct($elementName, $elementLabel); |
| 97 | 97 | $this->_type = 'group'; |
@@ -174,13 +174,13 @@ discard block |
||
| 174 | 174 | { |
| 175 | 175 | $value = null; |
| 176 | 176 | foreach (array_keys($this->_elements) as $key) { |
| 177 | - $element =& $this->_elements[$key]; |
|
| 177 | + $element = & $this->_elements[$key]; |
|
| 178 | 178 | switch ($element->getType()) { |
| 179 | 179 | case 'radio': |
| 180 | - $v = $element->getChecked()? $element->getValue(): null; |
|
| 180 | + $v = $element->getChecked() ? $element->getValue() : null; |
|
| 181 | 181 | break; |
| 182 | 182 | case 'checkbox': |
| 183 | - $v = $element->getChecked()? true: null; |
|
| 183 | + $v = $element->getChecked() ? true : null; |
|
| 184 | 184 | break; |
| 185 | 185 | default: |
| 186 | 186 | $v = $element->getValue(); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $value = $v; |
| 192 | 192 | } else { |
| 193 | 193 | if (!is_array($value)) { |
| 194 | - $value = is_null($value)? array(): array($value); |
|
| 194 | + $value = is_null($value) ? array() : array($value); |
|
| 195 | 195 | } |
| 196 | 196 | if ('' === $elementName) { |
| 197 | 197 | $value[] = $v; |
@@ -360,9 +360,9 @@ discard block |
||
| 360 | 360 | if (is_null($elementName)) { |
| 361 | 361 | $this->_elements[$key]->setName($this->getName()); |
| 362 | 362 | } elseif ('' === $elementName) { |
| 363 | - $this->_elements[$key]->setName($this->getName() . '[' . $key . ']'); |
|
| 363 | + $this->_elements[$key]->setName($this->getName().'['.$key.']'); |
|
| 364 | 364 | } else { |
| 365 | - $this->_elements[$key]->setName($this->getName() . '[' . $elementName . ']'); |
|
| 365 | + $this->_elements[$key]->setName($this->getName().'['.$elementName.']'); |
|
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | $this->_elements[$key]->onQuickFormEvent('updateValue', $arg, $caller); |
@@ -393,12 +393,12 @@ discard block |
||
| 393 | 393 | $renderer->startGroup($this, $required, $error); |
| 394 | 394 | $name = $this->getName(); |
| 395 | 395 | foreach (array_keys($this->_elements) as $key) { |
| 396 | - $element =& $this->_elements[$key]; |
|
| 396 | + $element = & $this->_elements[$key]; |
|
| 397 | 397 | |
| 398 | 398 | if ($this->_appendName) { |
| 399 | 399 | $elementName = $element->getName(); |
| 400 | 400 | if (isset($elementName)) { |
| 401 | - $element->setName($name . '['. (strlen($elementName)? $elementName: $key) .']'); |
|
| 401 | + $element->setName($name.'['.(strlen($elementName) ? $elementName : $key).']'); |
|
| 402 | 402 | } else { |
| 403 | 403 | $element->setName($name); |
| 404 | 404 | } |
@@ -429,9 +429,9 @@ discard block |
||
| 429 | 429 | if (is_null($elementName)) { |
| 430 | 430 | $this->_elements[$key]->setName($this->getName()); |
| 431 | 431 | } elseif ('' === $elementName) { |
| 432 | - $this->_elements[$key]->setName($this->getName() . '[' . $key . ']'); |
|
| 432 | + $this->_elements[$key]->setName($this->getName().'['.$key.']'); |
|
| 433 | 433 | } else { |
| 434 | - $this->_elements[$key]->setName($this->getName() . '[' . $elementName . ']'); |
|
| 434 | + $this->_elements[$key]->setName($this->getName().'['.$elementName.']'); |
|
| 435 | 435 | } |
| 436 | 436 | } |
| 437 | 437 | $v = $this->_elements[$key]->exportValue($submitValues, $assoc); |
@@ -52,6 +52,10 @@ discard block |
||
| 52 | 52 | * @param string Text to display near the radio |
| 53 | 53 | * @param string Input field value |
| 54 | 54 | * @param mixed Either a typical HTML attribute string or an associative array |
| 55 | + * @param string $elementName |
|
| 56 | + * @param string $elementLabel |
|
| 57 | + * @param string $text |
|
| 58 | + * @param string $value |
|
| 55 | 59 | * @since 1.0 |
| 56 | 60 | * @access public |
| 57 | 61 | * @return void |
@@ -189,7 +193,7 @@ discard block |
||
| 189 | 193 | * @param object &$caller calling object |
| 190 | 194 | * @since 1.0 |
| 191 | 195 | * @access public |
| 192 | - * @return void |
|
| 196 | + * @return boolean |
|
| 193 | 197 | */ |
| 194 | 198 | public function onQuickFormEvent($event, $arg, &$caller) |
| 195 | 199 | { |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | { |
| 151 | 151 | if ($this->getChecked()) { |
| 152 | 152 | return '<code>(x)</code>' . |
| 153 | - $this->_getPersistantData(); |
|
| 153 | + $this->_getPersistantData(); |
|
| 154 | 154 | } else { |
| 155 | 155 | return '<code>( )</code>'; |
| 156 | 156 | } |
@@ -224,9 +224,9 @@ discard block |
||
| 224 | 224 | return true; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - /** |
|
| 228 | - * Returns the value attribute if the radio is checked, null if it is not |
|
| 229 | - */ |
|
| 227 | + /** |
|
| 228 | + * Returns the value attribute if the radio is checked, null if it is not |
|
| 229 | + */ |
|
| 230 | 230 | public function exportValue(&$submitValues, $assoc = false) |
| 231 | 231 | { |
| 232 | 232 | $value = $this->_findValue($submitValues); |
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | } else { |
| 130 | 130 | $labelClass = $this->labelClass; |
| 131 | 131 | $radioClass = $this->radioClass; |
| 132 | - $label = '<div class="'.$radioClass.'"><label class="'.$labelClass.'">' . |
|
| 133 | - HTML_QuickForm_input::toHtml().$this->_text . |
|
| 132 | + $label = '<div class="'.$radioClass.'"><label class="'.$labelClass.'">'. |
|
| 133 | + HTML_QuickForm_input::toHtml().$this->_text. |
|
| 134 | 134 | '</label></div>'; |
| 135 | 135 | |
| 136 | 136 | return $label; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - return HTML_QuickForm_input::toHtml() . $label; |
|
| 139 | + return HTML_QuickForm_input::toHtml().$label; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | public function getFrozenHtml() |
| 150 | 150 | { |
| 151 | 151 | if ($this->getChecked()) { |
| 152 | - return '<code>(x)</code>' . |
|
| 152 | + return '<code>(x)</code>'. |
|
| 153 | 153 | $this->_getPersistantData(); |
| 154 | 154 | } else { |
| 155 | 155 | return '<code>( )</code>'; |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | { |
| 232 | 232 | $value = $this->_findValue($submitValues); |
| 233 | 233 | if (null === $value) { |
| 234 | - $value = $this->getChecked()? $this->getValue(): null; |
|
| 234 | + $value = $this->getChecked() ? $this->getValue() : null; |
|
| 235 | 235 | } elseif ($value != $this->getValue()) { |
| 236 | 236 | $value = null; |
| 237 | 237 | } |
@@ -331,6 +331,7 @@ |
||
| 331 | 331 | * So we use the smarty eval plugin function to do this. |
| 332 | 332 | * |
| 333 | 333 | * @param string The template source |
| 334 | + * @param string $tplSource |
|
| 334 | 335 | * @access private |
| 335 | 336 | * @return void |
| 336 | 337 | */ |
@@ -87,63 +87,63 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | class HTML_QuickForm_Renderer_ArraySmarty extends HTML_QuickForm_Renderer_Array |
| 89 | 89 | { |
| 90 | - /**#@+ |
|
| 90 | + /**#@+ |
|
| 91 | 91 | * @access private |
| 92 | 92 | */ |
| 93 | - /** |
|
| 94 | - * The Smarty template engine instance |
|
| 95 | - * @var object |
|
| 96 | - */ |
|
| 93 | + /** |
|
| 94 | + * The Smarty template engine instance |
|
| 95 | + * @var object |
|
| 96 | + */ |
|
| 97 | 97 | var $_tpl = null; |
| 98 | 98 | |
| 99 | - /** |
|
| 100 | - * Current element index |
|
| 101 | - * @var integer |
|
| 102 | - */ |
|
| 99 | + /** |
|
| 100 | + * Current element index |
|
| 101 | + * @var integer |
|
| 102 | + */ |
|
| 103 | 103 | var $_elementIdx = 0; |
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | - * The current element index inside a group |
|
| 107 | - * @var integer |
|
| 108 | - */ |
|
| 106 | + * The current element index inside a group |
|
| 107 | + * @var integer |
|
| 108 | + */ |
|
| 109 | 109 | var $_groupElementIdx = 0; |
| 110 | 110 | |
| 111 | - /** |
|
| 112 | - * How to handle the required tag for required fields |
|
| 113 | - * @var string |
|
| 114 | - * @see setRequiredTemplate() |
|
| 115 | - */ |
|
| 111 | + /** |
|
| 112 | + * How to handle the required tag for required fields |
|
| 113 | + * @var string |
|
| 114 | + * @see setRequiredTemplate() |
|
| 115 | + */ |
|
| 116 | 116 | var $_required = ''; |
| 117 | 117 | |
| 118 | - /** |
|
| 119 | - * How to handle error messages in form validation |
|
| 120 | - * @var string |
|
| 121 | - * @see setErrorTemplate() |
|
| 122 | - */ |
|
| 118 | + /** |
|
| 119 | + * How to handle error messages in form validation |
|
| 120 | + * @var string |
|
| 121 | + * @see setErrorTemplate() |
|
| 122 | + */ |
|
| 123 | 123 | var $_error = ''; |
| 124 | - /**#@-*/ |
|
| 124 | + /**#@-*/ |
|
| 125 | 125 | |
| 126 | - /** |
|
| 127 | - * Constructor |
|
| 128 | - * |
|
| 129 | - * @param Smarty reference to the Smarty template engine instance |
|
| 130 | - * @param bool true: render an array of labels to many labels, $key 0 to 'label' and the oterh to "label_$key" |
|
| 131 | - * @param bool true: collect all hidden elements into string; false: process them as usual form elements |
|
| 132 | - * @access public |
|
| 133 | - */ |
|
| 126 | + /** |
|
| 127 | + * Constructor |
|
| 128 | + * |
|
| 129 | + * @param Smarty reference to the Smarty template engine instance |
|
| 130 | + * @param bool true: render an array of labels to many labels, $key 0 to 'label' and the oterh to "label_$key" |
|
| 131 | + * @param bool true: collect all hidden elements into string; false: process them as usual form elements |
|
| 132 | + * @access public |
|
| 133 | + */ |
|
| 134 | 134 | function HTML_QuickForm_Renderer_ArraySmarty(&$tpl, $staticLabels = false, $collectHidden = true) |
| 135 | 135 | { |
| 136 | 136 | $this->HTML_QuickForm_Renderer_Array($collectHidden, $staticLabels); |
| 137 | 137 | $this->_tpl =& $tpl; |
| 138 | 138 | } // end constructor |
| 139 | 139 | |
| 140 | - /** |
|
| 141 | - * Called when visiting a header element |
|
| 142 | - * |
|
| 143 | - * @param HTML_QuickForm_header header element being visited |
|
| 144 | - * @access public |
|
| 145 | - * @return void |
|
| 146 | - */ |
|
| 140 | + /** |
|
| 141 | + * Called when visiting a header element |
|
| 142 | + * |
|
| 143 | + * @param HTML_QuickForm_header header element being visited |
|
| 144 | + * @access public |
|
| 145 | + * @return void |
|
| 146 | + */ |
|
| 147 | 147 | function renderHeader(&$header) |
| 148 | 148 | { |
| 149 | 149 | if ($name = $header->getName()) { |
@@ -154,31 +154,31 @@ discard block |
||
| 154 | 154 | $this->_currentSection = $this->_sectionCount++; |
| 155 | 155 | } // end func renderHeader |
| 156 | 156 | |
| 157 | - /** |
|
| 158 | - * Called when visiting a group, before processing any group elements |
|
| 159 | - * |
|
| 160 | - * @param HTML_QuickForm_group group being visited |
|
| 161 | - * @param bool Whether a group is required |
|
| 162 | - * @param string An error message associated with a group |
|
| 163 | - * @access public |
|
| 164 | - * @return void |
|
| 165 | - */ |
|
| 157 | + /** |
|
| 158 | + * Called when visiting a group, before processing any group elements |
|
| 159 | + * |
|
| 160 | + * @param HTML_QuickForm_group group being visited |
|
| 161 | + * @param bool Whether a group is required |
|
| 162 | + * @param string An error message associated with a group |
|
| 163 | + * @access public |
|
| 164 | + * @return void |
|
| 165 | + */ |
|
| 166 | 166 | function startGroup(&$group, $required, $error) |
| 167 | 167 | { |
| 168 | 168 | parent::startGroup($group, $required, $error); |
| 169 | 169 | $this->_groupElementIdx = 1; |
| 170 | 170 | } // end func startGroup |
| 171 | 171 | |
| 172 | - /** |
|
| 173 | - * Creates an array representing an element containing |
|
| 174 | - * the key for storing this |
|
| 175 | - * |
|
| 176 | - * @access private |
|
| 177 | - * @param HTML_QuickForm_element form element being visited |
|
| 178 | - * @param bool Whether an element is required |
|
| 179 | - * @param string Error associated with the element |
|
| 180 | - * @return array |
|
| 181 | - */ |
|
| 172 | + /** |
|
| 173 | + * Creates an array representing an element containing |
|
| 174 | + * the key for storing this |
|
| 175 | + * |
|
| 176 | + * @access private |
|
| 177 | + * @param HTML_QuickForm_element form element being visited |
|
| 178 | + * @param bool Whether an element is required |
|
| 179 | + * @param string Error associated with the element |
|
| 180 | + * @return array |
|
| 181 | + */ |
|
| 182 | 182 | function _elementToArray(&$element, $required, $error) |
| 183 | 183 | { |
| 184 | 184 | $ret = parent::_elementToArray($element, $required, $error); |
@@ -242,13 +242,13 @@ discard block |
||
| 242 | 242 | return $ret; |
| 243 | 243 | } // end func _elementToArray |
| 244 | 244 | |
| 245 | - /** |
|
| 246 | - * Stores an array representation of an element in the form array |
|
| 247 | - * |
|
| 248 | - * @access private |
|
| 249 | - * @param array Array representation of an element |
|
| 250 | - * @return void |
|
| 251 | - */ |
|
| 245 | + /** |
|
| 246 | + * Stores an array representation of an element in the form array |
|
| 247 | + * |
|
| 248 | + * @access private |
|
| 249 | + * @param array Array representation of an element |
|
| 250 | + * @return void |
|
| 251 | + */ |
|
| 252 | 252 | function _storeArray($elAry) |
| 253 | 253 | { |
| 254 | 254 | if ($elAry) { |
@@ -265,20 +265,20 @@ discard block |
||
| 265 | 265 | return; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - /** |
|
| 269 | - * Called when an element is required |
|
| 270 | - * |
|
| 271 | - * This method will add the required tag to the element label and/or the element html |
|
| 272 | - * such as defined with the method setRequiredTemplate. |
|
| 273 | - * |
|
| 274 | - * @param string The element label |
|
| 275 | - * @param string The element html rendering |
|
| 276 | - * @param boolean The element required |
|
| 277 | - * @param string The element error |
|
| 278 | - * @see setRequiredTemplate() |
|
| 279 | - * @access private |
|
| 280 | - * @return void |
|
| 281 | - */ |
|
| 268 | + /** |
|
| 269 | + * Called when an element is required |
|
| 270 | + * |
|
| 271 | + * This method will add the required tag to the element label and/or the element html |
|
| 272 | + * such as defined with the method setRequiredTemplate. |
|
| 273 | + * |
|
| 274 | + * @param string The element label |
|
| 275 | + * @param string The element html rendering |
|
| 276 | + * @param boolean The element required |
|
| 277 | + * @param string The element error |
|
| 278 | + * @see setRequiredTemplate() |
|
| 279 | + * @access private |
|
| 280 | + * @return void |
|
| 281 | + */ |
|
| 282 | 282 | function _renderRequired(&$label, &$html, &$required, &$error) |
| 283 | 283 | { |
| 284 | 284 | $this->_tpl->assign(array( |
@@ -296,20 +296,20 @@ discard block |
||
| 296 | 296 | $this->_tpl->clear_assign(array('label', 'html', 'required')); |
| 297 | 297 | } // end func _renderRequired |
| 298 | 298 | |
| 299 | - /** |
|
| 300 | - * Called when an element has a validation error |
|
| 301 | - * |
|
| 302 | - * This method will add the error message to the element label or the element html |
|
| 303 | - * such as defined with the method setErrorTemplate. If the error placeholder is not found |
|
| 304 | - * in the template, the error will be displayed in the form error block. |
|
| 305 | - * |
|
| 306 | - * @param string The element label |
|
| 307 | - * @param string The element html rendering |
|
| 308 | - * @param string The element error |
|
| 309 | - * @see setErrorTemplate() |
|
| 310 | - * @access private |
|
| 311 | - * @return void |
|
| 312 | - */ |
|
| 299 | + /** |
|
| 300 | + * Called when an element has a validation error |
|
| 301 | + * |
|
| 302 | + * This method will add the error message to the element label or the element html |
|
| 303 | + * such as defined with the method setErrorTemplate. If the error placeholder is not found |
|
| 304 | + * in the template, the error will be displayed in the form error block. |
|
| 305 | + * |
|
| 306 | + * @param string The element label |
|
| 307 | + * @param string The element html rendering |
|
| 308 | + * @param string The element error |
|
| 309 | + * @see setErrorTemplate() |
|
| 310 | + * @access private |
|
| 311 | + * @return void |
|
| 312 | + */ |
|
| 313 | 313 | function _renderError(&$label, &$html, &$error) |
| 314 | 314 | { |
| 315 | 315 | $this->_tpl->assign(array('label' => '', 'html' => '', 'error' => $error)); |
@@ -324,16 +324,16 @@ discard block |
||
| 324 | 324 | $this->_tpl->clear_assign(array('label', 'html', 'error')); |
| 325 | 325 | } // end func _renderError |
| 326 | 326 | |
| 327 | - /** |
|
| 328 | - * Process an template sourced in a string with Smarty |
|
| 329 | - * |
|
| 330 | - * Smarty has no core function to render a template given as a string. |
|
| 331 | - * So we use the smarty eval plugin function to do this. |
|
| 332 | - * |
|
| 333 | - * @param string The template source |
|
| 334 | - * @access private |
|
| 335 | - * @return void |
|
| 336 | - */ |
|
| 327 | + /** |
|
| 328 | + * Process an template sourced in a string with Smarty |
|
| 329 | + * |
|
| 330 | + * Smarty has no core function to render a template given as a string. |
|
| 331 | + * So we use the smarty eval plugin function to do this. |
|
| 332 | + * |
|
| 333 | + * @param string The template source |
|
| 334 | + * @access private |
|
| 335 | + * @return void |
|
| 336 | + */ |
|
| 337 | 337 | function _tplFetch($tplSource) |
| 338 | 338 | { |
| 339 | 339 | if (!function_exists('smarty_function_eval')) { |
@@ -342,54 +342,54 @@ discard block |
||
| 342 | 342 | return smarty_function_eval(array('var' => $tplSource), $this->_tpl); |
| 343 | 343 | }// end func _tplFetch |
| 344 | 344 | |
| 345 | - /** |
|
| 346 | - * Sets the way required elements are rendered |
|
| 347 | - * |
|
| 348 | - * You can use {$label} or {$html} placeholders to let the renderer know where |
|
| 349 | - * where the element label or the element html are positionned according to the |
|
| 350 | - * required tag. They will be replaced accordingly with the right value. You |
|
| 351 | - * can use the full smarty syntax here, especially a custom modifier for I18N. |
|
| 352 | - * For example: |
|
| 353 | - * {if $required}<span style="color: red;">*</span>{/if}{$label|translate} |
|
| 354 | - * will put a red star in front of the label if the element is required and |
|
| 355 | - * translate the label. |
|
| 356 | - * |
|
| 357 | - * |
|
| 358 | - * @param string The required element template |
|
| 359 | - * @access public |
|
| 360 | - * @return void |
|
| 361 | - */ |
|
| 345 | + /** |
|
| 346 | + * Sets the way required elements are rendered |
|
| 347 | + * |
|
| 348 | + * You can use {$label} or {$html} placeholders to let the renderer know where |
|
| 349 | + * where the element label or the element html are positionned according to the |
|
| 350 | + * required tag. They will be replaced accordingly with the right value. You |
|
| 351 | + * can use the full smarty syntax here, especially a custom modifier for I18N. |
|
| 352 | + * For example: |
|
| 353 | + * {if $required}<span style="color: red;">*</span>{/if}{$label|translate} |
|
| 354 | + * will put a red star in front of the label if the element is required and |
|
| 355 | + * translate the label. |
|
| 356 | + * |
|
| 357 | + * |
|
| 358 | + * @param string The required element template |
|
| 359 | + * @access public |
|
| 360 | + * @return void |
|
| 361 | + */ |
|
| 362 | 362 | function setRequiredTemplate($template) |
| 363 | 363 | { |
| 364 | 364 | $this->_required = $template; |
| 365 | 365 | } // end func setRequiredTemplate |
| 366 | 366 | |
| 367 | - /** |
|
| 368 | - * Sets the way elements with validation errors are rendered |
|
| 369 | - * |
|
| 370 | - * You can use {$label} or {$html} placeholders to let the renderer know where |
|
| 371 | - * where the element label or the element html are positionned according to the |
|
| 372 | - * error message. They will be replaced accordingly with the right value. |
|
| 373 | - * The error message will replace the {$error} placeholder. |
|
| 374 | - * For example: |
|
| 375 | - * {if $error}<span style="color: red;">{$error}</span>{/if}<br />{$html} |
|
| 376 | - * will put the error message in red on top of the element html. |
|
| 377 | - * |
|
| 378 | - * If you want all error messages to be output in the main error block, use |
|
| 379 | - * the {$form.errors} part of the rendered array that collects all raw error |
|
| 380 | - * messages. |
|
| 381 | - * |
|
| 382 | - * If you want to place all error messages manually, do not specify {$html} |
|
| 383 | - * nor {$label}. |
|
| 384 | - * |
|
| 385 | - * Groups can have special layouts. With this kind of groups, you have to |
|
| 386 | - * place the formated error message manually. In this case, use {$form.group.error} |
|
| 387 | - * where you want the formated error message to appear in the form. |
|
| 388 | - * |
|
| 389 | - * @param string The element error template |
|
| 390 | - * @access public |
|
| 391 | - * @return void |
|
| 392 | - */ |
|
| 367 | + /** |
|
| 368 | + * Sets the way elements with validation errors are rendered |
|
| 369 | + * |
|
| 370 | + * You can use {$label} or {$html} placeholders to let the renderer know where |
|
| 371 | + * where the element label or the element html are positionned according to the |
|
| 372 | + * error message. They will be replaced accordingly with the right value. |
|
| 373 | + * The error message will replace the {$error} placeholder. |
|
| 374 | + * For example: |
|
| 375 | + * {if $error}<span style="color: red;">{$error}</span>{/if}<br />{$html} |
|
| 376 | + * will put the error message in red on top of the element html. |
|
| 377 | + * |
|
| 378 | + * If you want all error messages to be output in the main error block, use |
|
| 379 | + * the {$form.errors} part of the rendered array that collects all raw error |
|
| 380 | + * messages. |
|
| 381 | + * |
|
| 382 | + * If you want to place all error messages manually, do not specify {$html} |
|
| 383 | + * nor {$label}. |
|
| 384 | + * |
|
| 385 | + * Groups can have special layouts. With this kind of groups, you have to |
|
| 386 | + * place the formated error message manually. In this case, use {$form.group.error} |
|
| 387 | + * where you want the formated error message to appear in the form. |
|
| 388 | + * |
|
| 389 | + * @param string The element error template |
|
| 390 | + * @access public |
|
| 391 | + * @return void |
|
| 392 | + */ |
|
| 393 | 393 | function setErrorTemplate($template) |
| 394 | 394 | { |
| 395 | 395 | $this->_error = $template; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | function HTML_QuickForm_Renderer_ArraySmarty(&$tpl, $staticLabels = false, $collectHidden = true) |
| 135 | 135 | { |
| 136 | 136 | $this->HTML_QuickForm_Renderer_Array($collectHidden, $staticLabels); |
| 137 | - $this->_tpl =& $tpl; |
|
| 137 | + $this->_tpl = & $tpl; |
|
| 138 | 138 | } // end constructor |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | // we don't need the elements, see the array structure |
| 189 | 189 | unset($ret['elements']); |
| 190 | 190 | } |
| 191 | - if (($required || $error) && !empty($this->_required)){ |
|
| 191 | + if (($required || $error) && !empty($this->_required)) { |
|
| 192 | 192 | $this->_renderRequired($ret['label'], $ret['html'], $required, $error); |
| 193 | 193 | } |
| 194 | 194 | if ($error && !empty($this->_error)) { |
@@ -206,13 +206,13 @@ discard block |
||
| 206 | 206 | if (isset($matches[1])) { |
| 207 | 207 | $sKeysSub = substr_replace($ret['name'], '', 0, strlen($matches[1])); |
| 208 | 208 | $sKeysSub = str_replace( |
| 209 | - array('\\', '\'', '[' , ']', '[\'\']'), |
|
| 210 | - array('\\\\', '\\\'', '[\'', '\']', '[]' ), |
|
| 209 | + array('\\', '\'', '[', ']', '[\'\']'), |
|
| 210 | + array('\\\\', '\\\'', '[\'', '\']', '[]'), |
|
| 211 | 211 | $sKeysSub |
| 212 | 212 | ); |
| 213 | - $sKeys = '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $matches[1]) . '\']' . $sKeysSub; |
|
| 213 | + $sKeys = '[\''.str_replace(array('\\', '\''), array('\\\\', '\\\''), $matches[1]).'\']'.$sKeysSub; |
|
| 214 | 214 | } else { |
| 215 | - $sKeys = '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret['name']) . '\']'; |
|
| 215 | + $sKeys = '[\''.str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret['name']).'\']'; |
|
| 216 | 216 | } |
| 217 | 217 | // special handling for elements in native groups |
| 218 | 218 | if ($this->_currentGroup) { |
@@ -228,14 +228,14 @@ discard block |
||
| 228 | 228 | } |
| 229 | 229 | // element without a name |
| 230 | 230 | } elseif ($ret['name'] == '') { |
| 231 | - $sKeys = '[\'element_' . $this->_elementIdx . '\']'; |
|
| 231 | + $sKeys = '[\'element_'.$this->_elementIdx.'\']'; |
|
| 232 | 232 | // other elements |
| 233 | 233 | } else { |
| 234 | - $sKeys = '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret['name']) . '\']'; |
|
| 234 | + $sKeys = '[\''.str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret['name']).'\']'; |
|
| 235 | 235 | } |
| 236 | 236 | // for radios: add extra key from value |
| 237 | 237 | if ('radio' == $ret['type'] and substr($sKeys, -2) != '[]') { |
| 238 | - $sKeys .= '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret['value']) . '\']'; |
|
| 238 | + $sKeys .= '[\''.str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret['value']).'\']'; |
|
| 239 | 239 | } |
| 240 | 240 | $this->_elementIdx++; |
| 241 | 241 | $ret['keys'] = $sKeys; |
@@ -256,9 +256,9 @@ discard block |
||
| 256 | 256 | unset($elAry['keys']); |
| 257 | 257 | // where should we put this element... |
| 258 | 258 | if (is_array($this->_currentGroup) && ('group' != $elAry['type'])) { |
| 259 | - $toEval = '$this->_currentGroup' . $sKeys . ' = $elAry;'; |
|
| 259 | + $toEval = '$this->_currentGroup'.$sKeys.' = $elAry;'; |
|
| 260 | 260 | } else { |
| 261 | - $toEval = '$this->_ary' . $sKeys . ' = $elAry;'; |
|
| 261 | + $toEval = '$this->_ary'.$sKeys.' = $elAry;'; |
|
| 262 | 262 | } |
| 263 | 263 | eval($toEval); |
| 264 | 264 | } |
@@ -287,10 +287,10 @@ discard block |
||
| 287 | 287 | 'required' => $required, |
| 288 | 288 | 'error' => $error |
| 289 | 289 | )); |
| 290 | - if (!empty($label) && strpos($this->_required, $this->_tpl->left_delimiter . '$label') !== false) { |
|
| 290 | + if (!empty($label) && strpos($this->_required, $this->_tpl->left_delimiter.'$label') !== false) { |
|
| 291 | 291 | $label = $this->_tplFetch($this->_required); |
| 292 | 292 | } |
| 293 | - if (!empty($html) && strpos($this->_required, $this->_tpl->left_delimiter . '$html') !== false) { |
|
| 293 | + if (!empty($html) && strpos($this->_required, $this->_tpl->left_delimiter.'$html') !== false) { |
|
| 294 | 294 | $html = $this->_tplFetch($this->_required); |
| 295 | 295 | } |
| 296 | 296 | $this->_tpl->clear_assign(array('label', 'html', 'required')); |
@@ -316,9 +316,9 @@ discard block |
||
| 316 | 316 | $error = $this->_tplFetch($this->_error); |
| 317 | 317 | $this->_tpl->assign(array('label' => $label, 'html' => $html)); |
| 318 | 318 | |
| 319 | - if (!empty($label) && strpos($this->_error, $this->_tpl->left_delimiter . '$label') !== false) { |
|
| 319 | + if (!empty($label) && strpos($this->_error, $this->_tpl->left_delimiter.'$label') !== false) { |
|
| 320 | 320 | $label = $this->_tplFetch($this->_error); |
| 321 | - } elseif (!empty($html) && strpos($this->_error, $this->_tpl->left_delimiter . '$html') !== false) { |
|
| 321 | + } elseif (!empty($html) && strpos($this->_error, $this->_tpl->left_delimiter.'$html') !== false) { |
|
| 322 | 322 | $html = $this->_tplFetch($this->_error); |
| 323 | 323 | } |
| 324 | 324 | $this->_tpl->clear_assign(array('label', 'html', 'error')); |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | function _tplFetch($tplSource) |
| 338 | 338 | { |
| 339 | 339 | if (!function_exists('smarty_function_eval')) { |
| 340 | - require SMARTY_DIR . '/plugins/function.eval.php'; |
|
| 340 | + require SMARTY_DIR.'/plugins/function.eval.php'; |
|
| 341 | 341 | } |
| 342 | 342 | return smarty_function_eval(array('var' => $tplSource), $this->_tpl); |
| 343 | 343 | }// end func _tplFetch |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | private $customElementTemplate; |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | - * @return mixed |
|
| 43 | + * @return string |
|
| 44 | 44 | */ |
| 45 | 45 | public function getCustomElementTemplate() |
| 46 | 46 | { |
@@ -457,6 +457,7 @@ discard block |
||
| 457 | 457 | * |
| 458 | 458 | * @param string The HTML surrounding an element |
| 459 | 459 | * @param string (optional) Name of the element to apply template for |
| 460 | + * @param string $html |
|
| 460 | 461 | * @access public |
| 461 | 462 | * @return void |
| 462 | 463 | */ |
@@ -504,6 +505,7 @@ discard block |
||
| 504 | 505 | * Sets header template |
| 505 | 506 | * |
| 506 | 507 | * @param string The HTML surrounding the header |
| 508 | + * @param string $html |
|
| 507 | 509 | * @access public |
| 508 | 510 | * @return void |
| 509 | 511 | */ |
@@ -516,6 +518,7 @@ discard block |
||
| 516 | 518 | * Sets form template |
| 517 | 519 | * |
| 518 | 520 | * @param string The HTML surrounding the form tags |
| 521 | + * @param string $html |
|
| 519 | 522 | * @access public |
| 520 | 523 | * @return void |
| 521 | 524 | */ |
@@ -527,6 +530,7 @@ discard block |
||
| 527 | 530 | * Sets the note indicating required fields template |
| 528 | 531 | * |
| 529 | 532 | * @param string The HTML surrounding the required note |
| 533 | + * @param string $html |
|
| 530 | 534 | * @access public |
| 531 | 535 | * @return void |
| 532 | 536 | */ |
@@ -56,128 +56,128 @@ discard block |
||
| 56 | 56 | $this->customElementTemplate = $customElementTemplate; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * The HTML of the form |
|
| 61 | - * @var string |
|
| 62 | - * @access private |
|
| 63 | - */ |
|
| 59 | + /** |
|
| 60 | + * The HTML of the form |
|
| 61 | + * @var string |
|
| 62 | + * @access private |
|
| 63 | + */ |
|
| 64 | 64 | var $_html; |
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Header Template string |
|
| 68 | - * @var string |
|
| 69 | - * @access private |
|
| 70 | - */ |
|
| 66 | + /** |
|
| 67 | + * Header Template string |
|
| 68 | + * @var string |
|
| 69 | + * @access private |
|
| 70 | + */ |
|
| 71 | 71 | var $_headerTemplate = |
| 72 | 72 | "\n\t<tr>\n\t\t<td style=\"white-space: nowrap; background-color: #CCCCCC;\" align=\"left\" valign=\"top\" colspan=\"2\"><b>{header}</b></td>\n\t</tr>"; |
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * Element template string |
|
| 76 | - * @var string |
|
| 77 | - * @access private |
|
| 78 | - */ |
|
| 74 | + /** |
|
| 75 | + * Element template string |
|
| 76 | + * @var string |
|
| 77 | + * @access private |
|
| 78 | + */ |
|
| 79 | 79 | var $_elementTemplate = |
| 80 | 80 | "\n\t<tr>\n\t\t<td align=\"right\" valign=\"top\"><!-- BEGIN required --><span style=\"color: #ff0000\">*</span><!-- END required --><b>{label}</b></td>\n\t\t<td valign=\"top\" align=\"left\"><!-- BEGIN error --><span style=\"color: #ff0000\">{error}</span><br /><!-- END error -->\t{element}</td>\n\t</tr>"; |
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * Form template string |
|
| 84 | - * @var string |
|
| 85 | - * @access private |
|
| 86 | - */ |
|
| 82 | + /** |
|
| 83 | + * Form template string |
|
| 84 | + * @var string |
|
| 85 | + * @access private |
|
| 86 | + */ |
|
| 87 | 87 | var $_formTemplate = |
| 88 | 88 | "\n<form{attributes}>\n<div>\n{hidden}<table border=\"0\">\n{content}\n</table>\n</div>\n</form>"; |
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * Required Note template string |
|
| 92 | - * @var string |
|
| 93 | - * @access private |
|
| 94 | - */ |
|
| 90 | + /** |
|
| 91 | + * Required Note template string |
|
| 92 | + * @var string |
|
| 93 | + * @access private |
|
| 94 | + */ |
|
| 95 | 95 | var $_requiredNoteTemplate = |
| 96 | 96 | "\n\t<tr>\n\t\t<td></td>\n\t<td align=\"left\" valign=\"top\">{requiredNote}</td>\n\t</tr>"; |
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * Array containing the templates for customised elements |
|
| 100 | - * @var array |
|
| 101 | - * @access private |
|
| 102 | - */ |
|
| 98 | + /** |
|
| 99 | + * Array containing the templates for customised elements |
|
| 100 | + * @var array |
|
| 101 | + * @access private |
|
| 102 | + */ |
|
| 103 | 103 | var $_templates = array(); |
| 104 | 104 | |
| 105 | - /** |
|
| 106 | - * Array containing the templates for group wraps. |
|
| 107 | - * |
|
| 108 | - * These templates are wrapped around group elements and groups' own |
|
| 109 | - * templates wrap around them. This is set by setGroupTemplate(). |
|
| 110 | - * |
|
| 111 | - * @var array |
|
| 112 | - * @access private |
|
| 113 | - */ |
|
| 105 | + /** |
|
| 106 | + * Array containing the templates for group wraps. |
|
| 107 | + * |
|
| 108 | + * These templates are wrapped around group elements and groups' own |
|
| 109 | + * templates wrap around them. This is set by setGroupTemplate(). |
|
| 110 | + * |
|
| 111 | + * @var array |
|
| 112 | + * @access private |
|
| 113 | + */ |
|
| 114 | 114 | var $_groupWraps = array(); |
| 115 | 115 | |
| 116 | - /** |
|
| 117 | - * Array containing the templates for elements within groups |
|
| 118 | - * @var array |
|
| 119 | - * @access private |
|
| 120 | - */ |
|
| 116 | + /** |
|
| 117 | + * Array containing the templates for elements within groups |
|
| 118 | + * @var array |
|
| 119 | + * @access private |
|
| 120 | + */ |
|
| 121 | 121 | var $_groupTemplates = array(); |
| 122 | 122 | |
| 123 | - /** |
|
| 124 | - * True if we are inside a group |
|
| 125 | - * @var bool |
|
| 126 | - * @access private |
|
| 127 | - */ |
|
| 123 | + /** |
|
| 124 | + * True if we are inside a group |
|
| 125 | + * @var bool |
|
| 126 | + * @access private |
|
| 127 | + */ |
|
| 128 | 128 | var $_inGroup = false; |
| 129 | 129 | |
| 130 | - /** |
|
| 131 | - * Array with HTML generated for group elements |
|
| 132 | - * @var array |
|
| 133 | - * @access private |
|
| 134 | - */ |
|
| 130 | + /** |
|
| 131 | + * Array with HTML generated for group elements |
|
| 132 | + * @var array |
|
| 133 | + * @access private |
|
| 134 | + */ |
|
| 135 | 135 | var $_groupElements = array(); |
| 136 | 136 | |
| 137 | - /** |
|
| 138 | - * Template for an element inside a group |
|
| 139 | - * @var string |
|
| 140 | - * @access private |
|
| 141 | - */ |
|
| 137 | + /** |
|
| 138 | + * Template for an element inside a group |
|
| 139 | + * @var string |
|
| 140 | + * @access private |
|
| 141 | + */ |
|
| 142 | 142 | var $_groupElementTemplate = ''; |
| 143 | 143 | |
| 144 | - /** |
|
| 145 | - * HTML that wraps around the group elements |
|
| 146 | - * @var string |
|
| 147 | - * @access private |
|
| 148 | - */ |
|
| 144 | + /** |
|
| 145 | + * HTML that wraps around the group elements |
|
| 146 | + * @var string |
|
| 147 | + * @access private |
|
| 148 | + */ |
|
| 149 | 149 | var $_groupWrap = ''; |
| 150 | 150 | |
| 151 | - /** |
|
| 152 | - * HTML for the current group |
|
| 153 | - * @var string |
|
| 154 | - * @access private |
|
| 155 | - */ |
|
| 151 | + /** |
|
| 152 | + * HTML for the current group |
|
| 153 | + * @var string |
|
| 154 | + * @access private |
|
| 155 | + */ |
|
| 156 | 156 | var $_groupTemplate = ''; |
| 157 | 157 | |
| 158 | - /** |
|
| 159 | - * Collected HTML of the hidden fields |
|
| 160 | - * @var string |
|
| 161 | - * @access private |
|
| 162 | - */ |
|
| 158 | + /** |
|
| 159 | + * Collected HTML of the hidden fields |
|
| 160 | + * @var string |
|
| 161 | + * @access private |
|
| 162 | + */ |
|
| 163 | 163 | var $_hiddenHtml = ''; |
| 164 | 164 | |
| 165 | - /** |
|
| 166 | - * Constructor |
|
| 167 | - * |
|
| 168 | - * @access public |
|
| 169 | - */ |
|
| 165 | + /** |
|
| 166 | + * Constructor |
|
| 167 | + * |
|
| 168 | + * @access public |
|
| 169 | + */ |
|
| 170 | 170 | public function HTML_QuickForm_Renderer_Default() |
| 171 | 171 | { |
| 172 | 172 | parent::__construct(); |
| 173 | 173 | } // end constructor |
| 174 | 174 | |
| 175 | - /** |
|
| 176 | - * returns the HTML generated for the form |
|
| 177 | - * |
|
| 178 | - * @access public |
|
| 179 | - * @return string |
|
| 180 | - */ |
|
| 175 | + /** |
|
| 176 | + * returns the HTML generated for the form |
|
| 177 | + * |
|
| 178 | + * @access public |
|
| 179 | + * @return string |
|
| 180 | + */ |
|
| 181 | 181 | public function toHtml() |
| 182 | 182 | { |
| 183 | 183 | // _hiddenHtml is cleared in finishForm(), so this only matters when |
@@ -185,13 +185,13 @@ discard block |
||
| 185 | 185 | return $this->_hiddenHtml . $this->_html; |
| 186 | 186 | } // end func toHtml |
| 187 | 187 | |
| 188 | - /** |
|
| 189 | - * Called when visiting a form, before processing any form elements |
|
| 190 | - * |
|
| 191 | - * @param HTML_QuickForm form object being visited |
|
| 192 | - * @access public |
|
| 193 | - * @return void |
|
| 194 | - */ |
|
| 188 | + /** |
|
| 189 | + * Called when visiting a form, before processing any form elements |
|
| 190 | + * |
|
| 191 | + * @param HTML_QuickForm form object being visited |
|
| 192 | + * @access public |
|
| 193 | + * @return void |
|
| 194 | + */ |
|
| 195 | 195 | function startForm(&$form) |
| 196 | 196 | { |
| 197 | 197 | $this->setForm($form); |
@@ -218,14 +218,14 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | |
| 220 | 220 | |
| 221 | - /** |
|
| 222 | - * Called when visiting a form, after processing all form elements |
|
| 223 | - * Adds required note, form attributes, validation javascript and form content. |
|
| 224 | - * |
|
| 225 | - * @param HTML_QuickForm form object being visited |
|
| 226 | - * @access public |
|
| 227 | - * @return void |
|
| 228 | - */ |
|
| 221 | + /** |
|
| 222 | + * Called when visiting a form, after processing all form elements |
|
| 223 | + * Adds required note, form attributes, validation javascript and form content. |
|
| 224 | + * |
|
| 225 | + * @param HTML_QuickForm form object being visited |
|
| 226 | + * @access public |
|
| 227 | + * @return void |
|
| 228 | + */ |
|
| 229 | 229 | public function finishForm(&$form) |
| 230 | 230 | { |
| 231 | 231 | // add a required note, if one is needed |
@@ -248,13 +248,13 @@ discard block |
||
| 248 | 248 | } |
| 249 | 249 | } // end func finishForm |
| 250 | 250 | |
| 251 | - /** |
|
| 252 | - * Called when visiting a header element |
|
| 253 | - * |
|
| 254 | - * @param HTML_QuickForm_header header element being visited |
|
| 255 | - * @access public |
|
| 256 | - * @return void |
|
| 257 | - */ |
|
| 251 | + /** |
|
| 252 | + * Called when visiting a header element |
|
| 253 | + * |
|
| 254 | + * @param HTML_QuickForm_header header element being visited |
|
| 255 | + * @access public |
|
| 256 | + * @return void |
|
| 257 | + */ |
|
| 258 | 258 | function renderHeader(&$header) |
| 259 | 259 | { |
| 260 | 260 | $name = $header->getName(); |
@@ -265,17 +265,17 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | } // end func renderHeader |
| 267 | 267 | |
| 268 | - /** |
|
| 269 | - * Helper method for renderElement |
|
| 270 | - * |
|
| 271 | - * @param HTML_QuickForm_element $element |
|
| 272 | - * @param bool Whether an element is required |
|
| 273 | - * @param string $required Error message associated with the element |
|
| 274 | - * @param string $error Label for ID |
|
| 275 | - * @access private |
|
| 276 | - * @see renderElement() |
|
| 277 | - * @return string Html for element |
|
| 278 | - */ |
|
| 268 | + /** |
|
| 269 | + * Helper method for renderElement |
|
| 270 | + * |
|
| 271 | + * @param HTML_QuickForm_element $element |
|
| 272 | + * @param bool Whether an element is required |
|
| 273 | + * @param string $required Error message associated with the element |
|
| 274 | + * @param string $error Label for ID |
|
| 275 | + * @access private |
|
| 276 | + * @see renderElement() |
|
| 277 | + * @return string Html for element |
|
| 278 | + */ |
|
| 279 | 279 | private function _prepareTemplate(HTML_QuickForm_element $element, $required, $error) |
| 280 | 280 | { |
| 281 | 281 | $name = $element->getName(); |
@@ -343,16 +343,16 @@ discard block |
||
| 343 | 343 | return $html; |
| 344 | 344 | } // end func _prepareTemplate |
| 345 | 345 | |
| 346 | - /** |
|
| 347 | - * Renders an element Html |
|
| 348 | - * Called when visiting an element |
|
| 349 | - * |
|
| 350 | - * @param HTML_QuickForm_element form element being visited |
|
| 351 | - * @param bool Whether an element is required |
|
| 352 | - * @param string An error message associated with an element |
|
| 353 | - * @access public |
|
| 354 | - * @return void |
|
| 355 | - */ |
|
| 346 | + /** |
|
| 347 | + * Renders an element Html |
|
| 348 | + * Called when visiting an element |
|
| 349 | + * |
|
| 350 | + * @param HTML_QuickForm_element form element being visited |
|
| 351 | + * @param bool Whether an element is required |
|
| 352 | + * @param string An error message associated with an element |
|
| 353 | + * @access public |
|
| 354 | + * @return void |
|
| 355 | + */ |
|
| 356 | 356 | public function renderElement(&$element, $required, $error) |
| 357 | 357 | { |
| 358 | 358 | if (!$this->_inGroup) { |
@@ -379,40 +379,40 @@ discard block |
||
| 379 | 379 | } |
| 380 | 380 | } // end func renderElement |
| 381 | 381 | |
| 382 | - /** |
|
| 383 | - * Renders an hidden element |
|
| 384 | - * Called when visiting a hidden element |
|
| 385 | - * |
|
| 386 | - * @param HTML_QuickForm_element form element being visited |
|
| 387 | - * @access public |
|
| 388 | - * @return void |
|
| 389 | - */ |
|
| 382 | + /** |
|
| 383 | + * Renders an hidden element |
|
| 384 | + * Called when visiting a hidden element |
|
| 385 | + * |
|
| 386 | + * @param HTML_QuickForm_element form element being visited |
|
| 387 | + * @access public |
|
| 388 | + * @return void |
|
| 389 | + */ |
|
| 390 | 390 | function renderHidden(&$element) |
| 391 | 391 | { |
| 392 | 392 | $this->_hiddenHtml .= $element->toHtml() . "\n"; |
| 393 | 393 | } // end func renderHidden |
| 394 | 394 | |
| 395 | - /** |
|
| 396 | - * Called when visiting a raw HTML/text pseudo-element |
|
| 397 | - * |
|
| 398 | - * @param HTML_QuickForm_html element being visited |
|
| 399 | - * @access public |
|
| 400 | - * @return void |
|
| 401 | - */ |
|
| 395 | + /** |
|
| 396 | + * Called when visiting a raw HTML/text pseudo-element |
|
| 397 | + * |
|
| 398 | + * @param HTML_QuickForm_html element being visited |
|
| 399 | + * @access public |
|
| 400 | + * @return void |
|
| 401 | + */ |
|
| 402 | 402 | function renderHtml(&$data) |
| 403 | 403 | { |
| 404 | 404 | $this->_html .= $data->toHtml(); |
| 405 | 405 | } // end func renderHtml |
| 406 | 406 | |
| 407 | - /** |
|
| 408 | - * Called when visiting a group, before processing any group elements |
|
| 409 | - * |
|
| 410 | - * @param HTML_QuickForm_group group being visited |
|
| 411 | - * @param bool Whether a group is required |
|
| 412 | - * @param string An error message associated with a group |
|
| 413 | - * @access public |
|
| 414 | - * @return void |
|
| 415 | - */ |
|
| 407 | + /** |
|
| 408 | + * Called when visiting a group, before processing any group elements |
|
| 409 | + * |
|
| 410 | + * @param HTML_QuickForm_group group being visited |
|
| 411 | + * @param bool Whether a group is required |
|
| 412 | + * @param string An error message associated with a group |
|
| 413 | + * @access public |
|
| 414 | + * @return void |
|
| 415 | + */ |
|
| 416 | 416 | function startGroup(&$group, $required, $error) |
| 417 | 417 | { |
| 418 | 418 | $name = $group->getName(); |
@@ -423,13 +423,13 @@ discard block |
||
| 423 | 423 | $this->_inGroup = true; |
| 424 | 424 | } // end func startGroup |
| 425 | 425 | |
| 426 | - /** |
|
| 427 | - * Called when visiting a group, after processing all group elements |
|
| 428 | - * |
|
| 429 | - * @param HTML_QuickForm_group group being visited |
|
| 430 | - * @access public |
|
| 431 | - * @return void |
|
| 432 | - */ |
|
| 426 | + /** |
|
| 427 | + * Called when visiting a group, after processing all group elements |
|
| 428 | + * |
|
| 429 | + * @param HTML_QuickForm_group group being visited |
|
| 430 | + * @access public |
|
| 431 | + * @return void |
|
| 432 | + */ |
|
| 433 | 433 | function finishGroup(&$group) |
| 434 | 434 | { |
| 435 | 435 | $separator = $group->_separator; |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | { |
| 183 | 183 | // _hiddenHtml is cleared in finishForm(), so this only matters when |
| 184 | 184 | // finishForm() was not called (e.g. group::toHtml(), bug #3511) |
| 185 | - return $this->_hiddenHtml . $this->_html; |
|
| 185 | + return $this->_hiddenHtml.$this->_html; |
|
| 186 | 186 | } // end func toHtml |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | $this->_html = str_replace('{content}', $this->_html, $html); |
| 245 | 245 | // add a validation script |
| 246 | 246 | if ('' != ($script = $form->getValidationScript())) { |
| 247 | - $this->_html = $script . "\n" . $this->_html; |
|
| 247 | + $this->_html = $script."\n".$this->_html; |
|
| 248 | 248 | } |
| 249 | 249 | } // end func finishForm |
| 250 | 250 | |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | $nameLabel = $label; |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - $labelFor = !empty($labelForId) ? 'for="' . $labelForId . '"' : 'for="' . $element->getName() . '"'; |
|
| 292 | + $labelFor = !empty($labelForId) ? 'for="'.$labelForId.'"' : 'for="'.$element->getName().'"'; |
|
| 293 | 293 | |
| 294 | 294 | if (isset($this->_templates[$name])) { |
| 295 | 295 | // Custom template |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | } |
| 331 | 331 | if (is_array($label)) { |
| 332 | 332 | foreach ($label as $key => $text) { |
| 333 | - $key = is_int($key)? $key + 2: $key; |
|
| 333 | + $key = is_int($key) ? $key + 2 : $key; |
|
| 334 | 334 | $html = str_replace("{label_{$key}}", $text, $html); |
| 335 | 335 | $html = str_replace("<!-- BEGIN label_{$key} -->", '', $html); |
| 336 | 336 | $html = str_replace("<!-- END label_{$key} -->", '', $html); |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | */ |
| 390 | 390 | function renderHidden(&$element) |
| 391 | 391 | { |
| 392 | - $this->_hiddenHtml .= $element->toHtml() . "\n"; |
|
| 392 | + $this->_hiddenHtml .= $element->toHtml()."\n"; |
|
| 393 | 393 | } // end func renderHidden |
| 394 | 394 | |
| 395 | 395 | /** |
@@ -417,8 +417,8 @@ discard block |
||
| 417 | 417 | { |
| 418 | 418 | $name = $group->getName(); |
| 419 | 419 | $this->_groupTemplate = $this->_prepareTemplate($group, $required, $error); |
| 420 | - $this->_groupElementTemplate = empty($this->_groupTemplates[$name])? '': $this->_groupTemplates[$name]; |
|
| 421 | - $this->_groupWrap = empty($this->_groupWraps[$name])? '': $this->_groupWraps[$name]; |
|
| 420 | + $this->_groupElementTemplate = empty($this->_groupTemplates[$name]) ? '' : $this->_groupTemplates[$name]; |
|
| 421 | + $this->_groupWrap = empty($this->_groupWraps[$name]) ? '' : $this->_groupWraps[$name]; |
|
| 422 | 422 | $this->_groupElements = array(); |
| 423 | 423 | $this->_inGroup = true; |
| 424 | 424 | } // end func startGroup |
@@ -437,13 +437,13 @@ discard block |
||
| 437 | 437 | $count = count($separator); |
| 438 | 438 | $html = ''; |
| 439 | 439 | for ($i = 0; $i < count($this->_groupElements); $i++) { |
| 440 | - $html .= (0 == $i? '': $separator[($i - 1) % $count]) . $this->_groupElements[$i]; |
|
| 440 | + $html .= (0 == $i ? '' : $separator[($i - 1) % $count]).$this->_groupElements[$i]; |
|
| 441 | 441 | } |
| 442 | 442 | } else { |
| 443 | 443 | if (is_null($separator)) { |
| 444 | 444 | $separator = ' '; |
| 445 | 445 | } |
| 446 | - $html = implode((string)$separator, $this->_groupElements); |
|
| 446 | + $html = implode((string) $separator, $this->_groupElements); |
|
| 447 | 447 | } |
| 448 | 448 | if (!empty($this->_groupWrap)) { |
| 449 | 449 | $html = str_replace('{content}', $html, $this->_groupWrap); |