Ejemplo n.º 1
0
 /**
  * Allows loading by token string.
  */
 public function unique_key($id)
 {
     if (!empty($id) and is_string($id) and !ctype_digit($id)) {
         return 'token';
     }
     return parent::unique_key($id);
 }
Ejemplo n.º 2
0
 /**
  * Allows a model to be loaded by username.
  */
 public function unique_key($id)
 {
     if (!empty($id) and is_string($id) and !ctype_digit($id)) {
         return $this->columns['username'];
     }
     return parent::unique_key($id);
 }
Ejemplo n.º 3
0
 public function unique_key($id = NULL)
 {
     if (!empty($id) && is_string($id) && !ctype_digit($id)) {
         return 'url_identifier';
     }
     return parent::unique_key($id);
 }
Ejemplo n.º 4
0
 /**
  * Allows finding countries by country code
  */
 public function unique_key($id)
 {
     if (!empty($id) && is_string($id) && !ctype_digit($id)) {
         return 'code';
     }
     return parent::unique_key($id);
 }
Ejemplo n.º 5
0
 /**
  * Allows a model to be loaded by username or email address.
  */
 public function unique_key($id)
 {
     if (!empty($id) and is_string($id) and !ctype_digit($id)) {
         return valid::email($id) ? 'email' : 'username';
     }
     return parent::unique_key($id);
 }
Ejemplo n.º 6
0
 /**
  * Allows a model to be loaded by filename.
  */
 public function unique_key($id)
 {
     if (!empty($id) and is_string($id) and !ctype_digit($id)) {
         if (file_exists($id)) {
             return 'basedir';
         }
         return 'hit_id';
     }
     return parent::unique_key($id);
 }
Ejemplo n.º 7
0
 public function unique_key($id = NULL)
 {
     if (empty($id)) {
         return parent::unique_key($id);
     }
     if (is_string($id)) {
         return 'pkey';
     }
     return parent::unique_key($id);
 }
Ejemplo n.º 8
0
 public function unique_key($id = NULL)
 {
     if (empty($id)) {
         return $this->primary_key;
     }
     /*
     if (is_string($id) && !ctype_digit($id))
         return 'code';
     
     if (is_numeric($id))
         return $this->primary_key;
     */
     return parent::unique_key($id);
 }
Ejemplo n.º 9
0
 public function unique_key($id = NULL)
 {
     if (empty($id)) {
         return $this->primary_key;
     }
     if (is_string($id) && !ctype_digit($id)) {
         return 'email';
     }
     if (is_numeric($id)) {
         return $this->primary_key;
     }
     return parent::unique_key($id);
 }
Ejemplo n.º 10
0
 /**
  * Allows a model to be loaded by user_name, guid, or email address.
  */
 public function unique_key($id)
 {
     if (!empty($id)) {
         if (is_string($id) and !ctype_digit($id)) {
             if (strpos($id, "@") !== FALSE) {
                 return 'email';
             } else {
                 return 'user_name';
             }
         }
     }
     return parent::unique_key($id);
 }
Ejemplo n.º 11
0
 /**
  * Return unique field of table based on id type (int = id, string = name etc)
  *
  * @param   mixed  $id
  * @return  string
  */
 public function unique_key($id)
 {
     if (!empty($id) && is_string($id) && !ctype_digit($id) && $this->primary_val) {
         return $this->primary_val;
     }
     return parent::unique_key($id);
 }