public function __get($field) { if ($this->erased) { throw new Exception("Cannot access field '{$field}' of deleted group {$this->id}"); } if (($this->id || $this->libraryID) && !$this->loaded) { $this->load(); } switch ($field) { case 'id': case 'libraryID': case 'name': case 'type': case 'ownerUserID': case 'libraryEnabled': case 'libraryEditing': case 'libraryReading': case 'fileEditing': case 'description': case 'url': case 'hasImage': case 'dateAdded': case 'dateModified': case 'erased': break; case 'slug': if ($this->isPublic()) { return Zotero_Utilities::slugify($this->name); } return null; default: throw new Exception("Invalid group field '{$field}'"); } return $this->{$field}; }
public static function getUserURI($userID, $skipNames = false) { if ($skipNames) { return self::getBaseURI() . "users/{$userID}"; } $username = Zotero_Users::getUsername($userID); return self::getBaseURI() . Zotero_Utilities::slugify($username); }
public static function getUserURI($userID, $www = false, $useSlug = false) { if ($www) { $username = Zotero_Users::getUsername($userID); return self::getBaseWWWURI() . Zotero_Utilities::slugify($username); } if ($useSlug) { $username = Zotero_Users::getUsername($userID); return self::getBaseURI() . Zotero_Utilities::slugify($username); } return self::getBaseURI() . "users/{$userID}"; }
public static function publicNameExists($name) { $slug = Zotero_Utilities::slugify($name); $sql = "SELECT groupID FROM groups WHERE (name=? OR slug=?) AND\n\t\t\t\t\ttype IN ('PublicOpen', 'PublicClosed')"; $groupID = Zotero_DB::valueQuery($sql, array($name, $slug)); return $groupID ? $groupID : false; }