Admin
class Admin
Model for admin interface operations.
Traits
Methods
Returns a list of template names used by specific content types.
URL-encode and escape a query string for use in a URL.
Check that a string is comprised solely of alphanumeric characters.
Check that a string is comprised solely of alphanumeric characters and underscores.
Check that a string is comprised solely of alphabetical characters.
Cast to string, check UTF-8 encoding and strip trailing whitespace and control characters.
Constructor.
Delete content object.
Get content objects.
Toggle a content object online or offline.
Count the number of content objects that match the filter criteria.
Return a list of options to build a select box.
Get tags associated with a content object.
Return the admin-side pagination limit.
Returns the template for formatting the date from preferences.
Return the title of a given content object.
Details
in ContentTypes at line 36
array
listTemplates()
Returns a list of template names used by specific content types.
in ContentTypes at line 62
array
listTypes()
Returns a whitelist of permitted content object types.
Use this whitelist when dynamically instantiating content objects. If you create additional types of content object (which must be descendants of the TfContentObject class) you must add them to the whitelist below. Otherwise their use will be denied in many parts of the Tuskfish system.
in ValidateString at line 41
string
encodeEscapeUrl(string $url)
URL-encode and escape a query string for use in a URL.
Trims, checks for UTF-8 compliance, rawurlencodes and then escapes with htmlspecialchars(). If you wish to use the data on a landing page you must decode it with htmlspecialchars_decode() followed by rawurldecode() in that order. But really, if you are using any characters that need to be encoded in the first place you should probably just stop.
in ValidateString at line 59
bool
isAlnum(string $alnum)
Check that a string is comprised solely of alphanumeric characters.
Accented regional characters are rejected. This method is designed to be used to check database identifiers or object property names.
in ValidateString at line 77
bool
isAlnumUnderscore(string $alnumUnderscore)
Check that a string is comprised solely of alphanumeric characters and underscores.
Accented regional characters are rejected. This method is designed to be used to check database identifiers or object property names.
in ValidateString at line 95
bool
isAlpha(string $alpha)
Check that a string is comprised solely of alphabetical characters.
Tolerates vanilla ASCII only. Accented regional characters are rejected. This method is designed to be used to check database identifiers or object property names.
in ValidateString at line 113
bool
isUtf8(string $text)
Check if the character encoding of text is UTF-8.
All strings received from external sources must be passed through this function, particularly prior to storage in the database.
in ValidateString at line 131
string
trimString(mixed $text)
Cast to string, check UTF-8 encoding and strip trailing whitespace and control characters.
Removes trailing whitespace and control characters (ASCII <= 32 / UTF-8 points 0-32 inclusive), checks for UTF-8 character set and casts input to a string. Note that the data returned by this function still requires escaping at the point of use; it is not database or XSS safe.
As the input is cast to a string do NOT apply this function to non-string types (int, float, bool, object, resource, null, array, etc).
at line 58
__construct(Database $database, CriteriaFactory $criteriaFactory, Preference $preference, FileHandler $fileHandler, Cache $cache)
Constructor.
at line 80
bool
delete(int $id)
Delete content object.
at line 134
array
getObjects(array $params)
Get content objects.
at line 148
bool
toggleOnlineStatus(int $id)
Toggle a content object online or offline.
at line 167
int
getCount(array $params)
Count the number of content objects that match the filter criteria.
at line 191
array
getOptions(array $params, array $columns = [])
Return a list of options to build a select box.
at line 236
array
getTagsForObject(int $id)
Get tags associated with a content object.
at line 282
int
adminlimit()
Return the admin-side pagination limit.
at line 290
string
dateFormat()
Returns the template for formatting the date from preferences.
at line 343
string
getTitle(int $id)
Return the title of a given content object.