Example #1
0
 /**
  * Validates a user password & ensures an encrypted password is set
  *
  * @see \CMF\Model\User::_event_before_save()
  */
 private function _ensure_and_validate_password()
 {
     if (!empty($this->password)) {
         $this->encrypted_password = Auth::encrypt_password($this->password);
     }
     if (empty($this->encrypted_password)) {
         throw new \Exception(\Lang::get('admin.validation.required', array('field' => 'Password')));
     }
 }
Example #2
0
 public function display()
 {
     return \Lang::get("languages.{$this->code}");
 }
Example #3
0
 /**
  * @see \CMF\Model\Base::$_plural
  * @return string The plural verbose name for the model (eg. Categories)
  */
 public static function plural()
 {
     $autosave = \Lang::$autosave;
     \Lang::$autosave = false;
     $called_class = get_called_class();
     $output = \Lang::get("admin.models.{$called_class}.plural", array(), "__NOT__FOUND__");
     \Lang::$autosave = $autosave;
     if (empty($output) || $output == "__NOT__FOUND__") {
         if ($called_class::$_plural !== null) {
             return $called_class::$_plural;
         }
         $metadata = $called_class::metadata();
         return \Inflector::pluralize(\Inflector::humanize($metadata->table['name']));
     }
     return $output;
 }