Skip to content

Commit

Permalink
Merge branch 'w03_MDL-31213_m22_attributesmess' of git://github.com/s…
Browse files Browse the repository at this point in the history
…kodak/moodle into MOODLE_22_STABLE
  • Loading branch information
stronk7 committed Jan 17, 2012
2 parents 14a49d6 + fc0a719 commit 2aa4f06
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 Original file line Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@ function MoodleQuickForm_password($elementName=null, $elementLabel=null, $attrib
if (empty($CFG->xmlstrictheaders)) { if (empty($CFG->xmlstrictheaders)) {
// no standard mform in moodle should allow autocomplete of passwords // 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 // this is valid attribute in html5, sorry, we have to ignore validation errors in legacy xhtml 1.0
$attributes = (array)$attributes; if (empty($attributes)) {
if (!isset($attributes['autocomplete'])) { $attributes = array('autocomplete'=>'off');
} else if (is_array($attributes)) {
$attributes['autocomplete'] = 'off'; $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 Original file line Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@ function MoodleQuickForm_passwordunmask($elementName=null, $elementLabel=null, $
if (empty($CFG->xmlstrictheaders)) { if (empty($CFG->xmlstrictheaders)) {
// no standard mform in moodle should allow autocomplete of passwords // 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 // this is valid attribute in html5, sorry, we have to ignore validation errors in legacy xhtml 1.0
$attributes = (array)$attributes; if (empty($attributes)) {
if (!isset($attributes['autocomplete'])) { $attributes = array('autocomplete'=>'off');
} else if (is_array($attributes)) {
$attributes['autocomplete'] = 'off'; $attributes['autocomplete'] = 'off';
} else {
if (strpos($attributes, 'autocomplete') === false) {
$attributes .= ' autocomplete="off" ';
}
} }
} }
parent::MoodleQuickForm_password($elementName, $elementLabel, $attributes); parent::MoodleQuickForm_password($elementName, $elementLabel, $attributes);
Expand Down
9 changes: 7 additions & 2 deletions lib/formslib.php
Original file line number Original file line 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)) { if (empty($CFG->xmlstrictheaders)) {
// no standard mform in moodle should allow autocomplete with the exception of user signup // 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 // this is valid attribute in html5, sorry, we have to ignore validation errors in legacy xhtml 1.0
$attributes = (array)$attributes; if (empty($attributes)) {
if (!isset($attributes['autocomplete'])) { $attributes = array('autocomplete'=>'off');
} else if (is_array($attributes)) {
$attributes['autocomplete'] = 'off'; $attributes['autocomplete'] = 'off';
} else {
if (strpos($attributes, 'autocomplete') === false) {
$attributes .= ' autocomplete="off" ';
}
} }
} }


Expand Down

0 comments on commit 2aa4f06

Please sign in to comment.