public function clean_shortname()␊ |
{␊ |
$shortname = $this->cleaned_data['shortname'];␊ |
if (preg_match('/[^A-Za-z0-9]/', $shortname)) {␊ |
if (preg_match('/[^\-A-Za-z0-9]/', $shortname)) {␊ |
throw new Pluf_Form_Invalid(__('This shortname contains illegal characters, please use only letters and digits.'));␊ |
}␊ |
if (mb_substr($shortname, 0, 1) == '-') {␊ |
throw new Pluf_Form_Invalid(__('The shortname cannot start with the dash (-) character.'));␊ |
}␊ |
if (mb_substr($shortname, -1) == '-') {␊ |
throw new Pluf_Form_Invalid(__('The shortname cannot end with the dash (-) character.'));␊ |
}␊ |
$sql = new Pluf_SQL('shortname=%s', array($shortname));␊ |
$l = Pluf::factory('IDF_Project')->getList(array('filter'=>$sql->gen()));␊ |
if ($l->count() > 0) {␊ |