/** * constructor * * @param string $elementName (optional) name of the password element * @param string $elementLabel (optional) label for password element * @param mixed $attributes (optional) Either a typical HTML attribute string * or an associative array */ public function __construct($elementName = null, $elementLabel = null, $attributes = null) { global $CFG; // no standard mform in moodle should allow autocomplete of passwords 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::__construct($elementName, $elementLabel, $attributes); }
/** * constructor * * @param string $elementName (optional) name of the password element * @param string $elementLabel (optional) label for password element * @param mixed $attributes (optional) Either a typical HTML attribute string * or an associative array */ function MoodleQuickForm_passwordunmask($elementName=null, $elementLabel=null, $attributes=null) { global $CFG; 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 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); }
function MoodleQuickForm_passwordunmask($elementName = null, $elementLabel = null, $attributes = null) { parent::MoodleQuickForm_password($elementName, $elementLabel, $attributes); }
/** * Function to export the renderer data in a format that is suitable for a mustache template. * * @param renderer_base $output Used to do a final render of any components that need to be rendered for export. * @return stdClass|array */ public function export_for_template(renderer_base $output) { $context = parent::export_for_template($output); $context['valuechars'] = array_fill(0, strlen($context['value']), 'x'); return $context; }