web/lib/Zend/View/Helper/FormRadio.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
--- a/web/lib/Zend/View/Helper/FormRadio.php	Thu Mar 21 17:31:31 2013 +0100
+++ b/web/lib/Zend/View/Helper/FormRadio.php	Thu Mar 21 19:50:53 2013 +0100
@@ -15,9 +15,9 @@
  * @category   Zend
  * @package    Zend_View
  * @subpackage Helper
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: FormRadio.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: FormRadio.php 24865 2012-06-02 01:02:32Z adamlundrigan $
  */
 
 
@@ -33,7 +33,7 @@
  * @category   Zend
  * @package    Zend_View
  * @subpackage Helper
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 class Zend_View_Helper_FormRadio extends Zend_View_Helper_FormElement
@@ -123,15 +123,14 @@
         // ensure value is an array to allow matching multiple times
         $value = (array) $value;
 
-        // XHTML or HTML end tag?
-        $endTag = ' />';
-        if (($this->view instanceof Zend_View_Abstract) && !$this->view->doctype()->isXhtml()) {
-            $endTag= '>';
-        }
-
+        // Set up the filter - Alnum + hyphen + underscore
+        require_once 'Zend/Filter/PregReplace.php';
+        $pattern = @preg_match('/\pL/u', 'a') 
+            ? '/[^\p{L}\p{N}\-\_]/u'    // Unicode
+            : '/[^a-zA-Z0-9\-\_]/';     // No Unicode
+        $filter = new Zend_Filter_PregReplace($pattern, "");
+        
         // add radio buttons to the list.
-        require_once 'Zend/Filter/Alnum.php';
-        $filter = new Zend_Filter_Alnum();
         foreach ($options as $opt_value => $opt_label) {
 
             // Should the label be escaped?
@@ -158,7 +157,7 @@
 
             // Wrap the radios in labels
             $radio = '<label'
-                    . $this->_htmlAttribs($label_attribs) . ' for="' . $optId . '">'
+                    . $this->_htmlAttribs($label_attribs) . '>'
                     . (('prepend' == $labelPlacement) ? $opt_label : '')
                     . '<input type="' . $this->_inputType . '"'
                     . ' name="' . $name . '"'
@@ -167,13 +166,18 @@
                     . $checked
                     . $disabled
                     . $this->_htmlAttribs($attribs)
-                    . $endTag
+                    . $this->getClosingBracket()
                     . (('append' == $labelPlacement) ? $opt_label : '')
                     . '</label>';
 
             // add to the array of radio buttons
             $list[] = $radio;
         }
+        
+        // XHTML or HTML for standard list separator?
+        if (!$this->_isXhtml() && false !== strpos($listsep, '<br />')) {
+            $listsep = str_replace('<br />', '<br>', $listsep);
+        }
 
         // done!
         $xhtml .= implode($listsep, $list);