Useful functions for sprout in general
This is the code documentation for the SproutCMS project
Search documentation |
class SproutUseful functions for sprout in general
Functions
public absRootunknown Sprout::absRoot ( [ string $protocol ] ); Returns an absolute URL for the web root of this server Example: 'http://thejosh.info/sprout_test/' public adminEmailsunknown Sprout::adminEmails ( ); Return a list of admins to send emails to. The return value is an array of arrays. The inner arrays contains the keys "name" and "email". public browserDragdropUploadsunknown Sprout::browserDragdropUploads ( ); Return true if the browser supports drag-and-drop uploads. public checkInsertRatebool Sprout::checkInsertRate ( string $table , string $column , string $value , string $limit [, string $time , array $conds ] ); Attempts to put the handbrake on a script which is doing malicious inserts to the database public checkRedirectunknown Sprout::checkRedirect ( mixed $text ); Checks a URL that is to be used for redirection is valid. Will allow remote URLs beginning with 'http://' and local URLs beginning with '/' public colorisedDiffunknown Sprout::colorisedDiff ( mixed $orig , mixed $new ); Takes two strings of text (which will be stripped of HTML tags) and returns HTML which is a table showing the differences in a nice colourful way public condenseArrayunknown Sprout::condenseArray ( array $arr ); Condenses an array into a string public determineFilePathfalse|string Sprout::determineFilePath ( string $class ); Determines the file path for a class, usually for autoloading public etagvoid Sprout::etag ( mixed $etag , mixed $expires ); Set the etag header, and some expiry headers. Checks if the etag matches - if it does, terminates the script with '304 Not Modified'. ETag should be specified as a string. Expires should be specified as a number of seconds, after that time the URL will expire. ETags should be something which is unique for that version of the URL. They should use something which is collission-resistant, such as MD5. They should vary based on the Accept-Encoding header, or any other 'accept' headers, if you are supporting them. public extraPageunknown Sprout::extraPage ( int $type ); Load the text for an extra page. Returns NULL on error. public formatMysqlDatetimeunknown Sprout::formatMysqlDatetime ( mixed $date [, mixed $format ] ); Takes a mysql DATETIME value (will probably also work with a TIME or DATE value) and formats it according to the format codes specified by the PHP date() function. The format is optional, if omittted, uses 'd/m/Y g:i a' = '7/11/2010 5:27 pm' public getMemoryLimitint Sprout::getMemoryLimit ( ); Returns the memory limit in bytes. If there is no limit, returns INT_MAX. public getVersionunknown Sprout::getVersion ( [ bool $git_version ] ); Returns the current version of sprout public instancemixed Sprout::instance ( string $class_name [, string|array $base_class_name ] ); Construct a new instance of a class with a given name public ipaddressInArraybool Sprout::ipaddressInArray ( mixed $needle , mixed $haystack ); Check an IP against a list of IP addresses, with logic for CIDR ranges public iterableFirstarray|null Sprout::iterableFirst ( iterable $iter ); Gets the first key value pair of an iterable This is to replace `reset` which has been deprecated in 7.2. While this lacks the stateful behaviour of the original (i.e. changing the internal pointer) it does recreate the most used feature: fetching the first element without knowing its key. public iterableFirstKeynull|mixed Sprout::iterableFirstKey ( iterable $iter ); Gets the first key of an iterable public iterableFirstValuenull|mixed Sprout::iterableFirstValue ( iterable $iter ); Gets the first value of an iterable public lastModifiedstring|null Sprout::lastModified ( [ string $date_format ] ); Return the last-modified date of all pages on the (sub-)site Returns NULL on error. The date is formatted using the php date function. The default date format is "d/m/Y". public linkCheckervoid Sprout::linkChecker ( ); Back-end for link-checking tool public moduleInstalledunknown Sprout::moduleInstalled ( mixed $module_name ); Returns true if the specified module is currently installed, false otherwise public nsClassstring Sprout::nsClass ( string $class , array $possible_nses ); Gets the full class name (including namespace) for a specified class, with a list of namespaces to search public nsFuncstring Sprout::nsFunc ( string $func , array $possible_nses ); Gets the full name (including namespaced class) for a specified function public nsNewobject Sprout::nsNew ( string $class , array $possible_nses ); Creates an object of a class specified by a string name, with a list of possible namespaces to lookup if the specified class name doesn't contain a namespace public passwordComplexityunknown Sprout::passwordComplexity ( mixed $str ); This function does not have a description public randStrunknown Sprout::randStr ( [ mixed $length [, mixed $chars ]] ); Returns a string of random numbers and letters public readableVarstring Sprout::readableVar ( mixed $var ); Converts a variable into something human readable public removeNsstring Sprout::removeNs ( string $classlike ); Removes the namespaces from a class-like entity, e.g. Sprout\Helpers\Text => Text public simpleBacktracearray Sprout::simpleBacktrace ( array $trace ); Gets a simplified backtrace with fewer elements and no recursion public specialFileLinksunknown Sprout::specialFileLinks ( mixed $html ); Adds classes, analytics and target-blank to file links. Also adds a random string, which prevents caching, solving some problems we were having with some clients. public timeAgounknown Sprout::timeAgo ( int $timediff ); Returns a time in 'x minutes ago' format. Very small times (0, 1 seconds) are considered 'Just now'. Times are represneted in seconds, minutes, hours or days. public translateLinkunknown Sprout::translateLink ( mixed $row ); Translate an array which may contain a page_id, filename or url into the final URL to use |
Powered by Pelzini, version 0.9.0 |
Documentation is made available under the
GNU Free Documentation License 1.2. Generated: Monday, 3rd April, 2023 at 02:59 pm |