Skip to content

Commit

Permalink
Merge branch 'w03_MDL-31213_m23_attributesmess' of git://github.com/s…
Browse files Browse the repository at this point in the history
…kodak/moodle
  • Loading branch information
stronk7 committed Jan 17, 2012
2 parents dc978ce + 48cbe43 commit ae92487
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
9 changes: 7 additions & 2 deletions lib/form/password.php
Original file line number Diff line number Diff line change
Expand Up @@ -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" ';
}
}
}

Expand Down
9 changes: 7 additions & 2 deletions lib/form/passwordunmask.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 7 additions & 2 deletions lib/formslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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" ';
}
}
}

Expand Down

0 comments on commit ae92487

Please sign in to comment.