Permalink
Browse files

Merge branch 'w03_MDL-31213_m22_attributesmess' of git://github.com/s…

…kodak/moodle into MOODLE_22_STABLE
  • Loading branch information...
2 parents 14a49d6 + fc0a719 commit 2aa4f06a884404293e274ea03428b2e857101578 @stronk7 stronk7 committed Jan 17, 2012
Showing with 21 additions and 6 deletions.
  1. +7 −2 lib/form/password.php
  2. +7 −2 lib/form/passwordunmask.php
  3. +7 −2 lib/formslib.php
View
@@ -19,9 +19,14 @@ function MoodleQuickForm_password($elementName=null, $elementLabel=null, $attrib
if (empty($CFG->xmlstrictheaders)) {
// no standard mform in moodle should allow autocomplete of passwords
// this is valid attribute in html5, sorry, we have to ignore validation errors in legacy xhtml 1.0
- $attributes = (array)$attributes;
- if (!isset($attributes['autocomplete'])) {
+ if (empty($attributes)) {
+ $attributes = array('autocomplete'=>'off');
+ } else if (is_array($attributes)) {
$attributes['autocomplete'] = 'off';
+ } else {
+ if (strpos($attributes, 'autocomplete') === false) {
+ $attributes .= ' autocomplete="off" ';
+ }
}
}
@@ -19,9 +19,14 @@ function MoodleQuickForm_passwordunmask($elementName=null, $elementLabel=null, $
if (empty($CFG->xmlstrictheaders)) {
// no standard mform in moodle should allow autocomplete of passwords
// this is valid attribute in html5, sorry, we have to ignore validation errors in legacy xhtml 1.0
- $attributes = (array)$attributes;
- if (!isset($attributes['autocomplete'])) {
+ if (empty($attributes)) {
+ $attributes = array('autocomplete'=>'off');
+ } else if (is_array($attributes)) {
$attributes['autocomplete'] = 'off';
+ } else {
+ if (strpos($attributes, 'autocomplete') === false) {
+ $attributes .= ' autocomplete="off" ';
+ }
}
}
parent::MoodleQuickForm_password($elementName, $elementLabel, $attributes);
View
@@ -143,9 +143,14 @@ function moodleform($action=null, $customdata=null, $method='post', $target='',
if (empty($CFG->xmlstrictheaders)) {
// no standard mform in moodle should allow autocomplete with the exception of user signup
// this is valid attribute in html5, sorry, we have to ignore validation errors in legacy xhtml 1.0
- $attributes = (array)$attributes;
- if (!isset($attributes['autocomplete'])) {
+ if (empty($attributes)) {
+ $attributes = array('autocomplete'=>'off');
+ } else if (is_array($attributes)) {
$attributes['autocomplete'] = 'off';
+ } else {
+ if (strpos($attributes, 'autocomplete') === false) {
+ $attributes .= ' autocomplete="off" ';
+ }
}
}

0 comments on commit 2aa4f06

Please sign in to comment.