\

Namespaces

TriTan

Constants

CACHE_PATH

CACHE_PATH

CURRENT_RELEASE

CURRENT_RELEASE

REQUEST_TIME

REQUEST_TIME

Functions

__return_false()

__return_false() : boolean

Returns false.

Apply to filters to return false.

Returns

boolean —

False

__return_null()

__return_null() : boolean

Returns null.

Apply to filters to return null.

Returns

boolean —

NULL

__return_post()

__return_post(mixed  $post) : mixed

Return posted data if set.

Parameters

mixed $post

Returns

mixed

__return_true()

__return_true() : boolean

Returns true.

Apply to filters to return true.

Returns

boolean —

True

_autop_newline_preservation_helper()

_autop_newline_preservation_helper(\type  $matches) : \type

Parameters

\type $matches

Returns

\type

_deprecated_argument()

_deprecated_argument(string  $function_name, string  $release, string  $message = null) 

Mark a function argument as deprecated and inform when it has been used.

This function is to be used whenever a deprecated function argument is used. Before this function is called, the argument must be checked for whether it was used by comparing it to its default value or evaluating whether it is empty.

There is a hook deprecated_argument_run that will be called that can be used to get the backtrace up to what file and function used the deprecated argument.

Default behavior is to trigger a user error if APP_ENV is set to DEV.

Example Usage:

 if ( ! empty( $deprecated ) ) {
     _deprecated_argument( __FUNCTION__, '0.9' );
 }

Parameters

string $function_name

The function that was called.

string $release

The release of TriTan CMS that deprecated the argument used.

string $message

Optional. A message regarding the change. Default null.

_deprecated_class()

_deprecated_class(string  $class_name, string  $release, string  $replacement = null) 

Mark a class as deprecated and inform when it has been used.

There is a hook deprecated_class_run that will be called that can be used to get the backtrace up to what file, function/class called the deprecated class.

Default behavior is to trigger a user error if APP_ENV is set to DEV.

This function is to be used in every class that is deprecated.

Parameters

string $class_name

The class that was called.

string $release

The release of TriTan CMS that deprecated the class.

string $replacement

Optional. The class that should have been called. Default null.

_deprecated_class_method()

_deprecated_class_method(string  $method_name, string  $release, string  $replacement = null) 

Mark a class's method as deprecated and inform when it has been used.

There is a hook deprecated_class_method_run that will be called that can be used to get the backtrace up to what file, function/class called the deprecated method.

Default behavior is to trigger a user error if APP_ENV is set to DEV.

This function is to be used in every class's method that is deprecated.

Parameters

string $method_name

The class method that was called.

string $release

The release of TriTan CMS that deprecated the class's method.

string $replacement

Optional. The class method that should have been called. Default null.

_deprecated_function()

_deprecated_function(string  $function_name, string  $release, string  $replacement = null) 

Mark a function as deprecated and inform when it has been used.

There is a hook deprecated_function_run that will be called that can be used to get the backtrace up to what file and function called the deprecated function.

Default behavior is to trigger a user error if APP_ENV is set to DEV.

This function is to be used in every function that is deprecated.

Parameters

string $function_name

The function that was called.

string $release

The release of TriTan CMS that deprecated the function.

string $replacement

Optional. The function that should have been called. Default null.

_deprecated_hook()

_deprecated_hook(string  $hook, string  $release, string  $replacement = null, string  $message = null) 

Marks a deprecated action or filter hook as deprecated and throws a notice.

Default behavior is to trigger a user error if APP_ENV is set to DEV.

Parameters

string $hook

The hook that was used.

string $release

The release of TriTan CMS that deprecated the hook.

string $replacement

Optional. The hook that should have been used.

string $message

Optional. A message regarding the change.

_escape()

_escape(string  $string) : mixed

A wrapper for htmLawed which is a set of functions for html purifier

Parameters

string $string

Returns

mixed

_file_get_contents()

_file_get_contents(string  $filename, boolean  $use_include_path = false, boolean  $context = true) 

Custom function to use curl, fopen, or use file_get_contents if curl is not available.

Uses trigger_include_path_search, resource_context and stream_context_create_options filters.

Parameters

string $filename

Resource to read.

boolean $use_include_path

Whether or not to use include path.

boolean $context

Whether or not to use a context resource.

_include()

_include(string  $file, boolean  $once = false, boolean|\Closure  $show_errors = true) : boolean

Special function for files including

Parameters

string $file
boolean $once
boolean|\Closure $show_errors

If bool error will be processed, if Closure - only Closure will be called

Returns

boolean

_include_once()

_include_once(string  $file, boolean|\Closure  $show_errors = true) : boolean

Special function for files including

Parameters

string $file
boolean|\Closure $show_errors

If bool error will be processed, if Closure - only Closure will be called

Returns

boolean

_incorrectly_called()

_incorrectly_called(string  $function_name, string  $message, string  $release) 

Mark something as being incorrectly called.

There is a hook incorrectly_called_run that will be called that can be used to get the backtrace up to what file and function called the deprecated function.

Default behavior is to trigger a user error if APP_ENV is set to DEV.

Parameters

string $function_name

The function that was called.

string $message

A message explaining what has been done incorrectly.

string $release

The release of TriTan CMS where the message was added.

_require()

_require(string  $file, boolean  $once = false, boolean|\Closure  $show_errors = true) : boolean

Special function for files including

Parameters

string $file
boolean $once
boolean|\Closure $show_errors

If bool error will be processed, if Closure - only Closure will be called

Returns

boolean

_require_once()

_require_once(string  $file, boolean|\Closure  $show_errors = true) : boolean

Special function for files including

Parameters

string $file
boolean|\Closure $show_errors

If bool error will be processed, if Closure - only Closure will be called

Returns

boolean

_rmdir()

_rmdir(string  $dir) 

Removes directory recursively along with any files.

Parameters

string $dir

Directory that should be removed.

_t()

_t(\type  $msgid, \type  $domain = '') : string

Displays the returned translated text.

Parameters

\type $msgid

The translated string.

\type $domain

Domain lookup for translated text.

Returns

string —

Translated text according to current locale.

_trigger_error()

_trigger_error(string  $message, string  $level = E_USER_NOTICE) 

Wrapper function for the core PHP function: trigger_error.

This function makes the error a little more understandable for the end user to track down the issue.

Parameters

string $message

Custom message to print.

string $level

Predefined PHP error constant.

_trim()

_trim(string  $str) : mixed

Removes all whitespace.

Parameters

string $str

Returns

mixed

_ttcms_cache_init()

_ttcms_cache_init() 

Sets up object cache global scope and assigns it based on the type of caching system used.

_ttcms_cleanup_file_header_comment()

_ttcms_cleanup_file_header_comment(string  $str) : string

Strip close comment and close php tags from file headers.

Parameters

string $str

Header comment to clean up.

Returns

string

_ttcms_email()

_ttcms_email() 

Sets up TriTan CMS Email global scope.

_ttcms_flash()

_ttcms_flash() 

Sets up TriTan CMS Flash Messages global scope.

_ttcms_image_optimizer()

_ttcms_image_optimizer(string  $pathToImage, string  $pathToOptimizded) : string

Image optimizer.

Parameters

string $pathToImage

Path to original image.

string $pathToOptimizded

Path to where optimized image should be saved.

Returns

string —

Optimized image.

_ttcms_logger()

_ttcms_logger() 

Sets up TriTan CMS Logger global scope.

_ttcms_phpmailer()

_ttcms_phpmailer(boolean  $bool = true) 

Sets up PHPMailer global scope.

Parameters

boolean $bool

Set whether to use exceptions for error handling. Default: true.

_ttcms_post_router()

_ttcms_post_router() 

Post router function.

_ttcms_random_lib()

_ttcms_random_lib() : \type

Sets up random number and string generator global scope.

Returns

\type

activate_plugin()

activate_plugin(string  $id) : mixed

Wrapper function for PluginsRepository::activate() and activates plugin based on $_GET['id'].

Parameters

string $id

ID of the plugin to be activated.

Returns

mixed —

Activates plugin if it exists.

add_admin_submenu()

add_admin_submenu(string  $location, string  $menu_title, string  $menu_route, string  $screen, string  $permission = null) : false|string

Add an admin submenu page link.

Uses adminsubmenu$location_{$menu_route} filter hook.

Parameters

string $location

Submenu location.

string $menu_title

The text to be used for the menu.

string $menu_route

The route part of the url.

string $screen

Unique name of menu's screen.

string $permission

The permission required for this menu to be displayed to the user.

Returns

false|string —

Return the new menu or false if permission is not met.

add_dashboard_submenu()

add_dashboard_submenu(string  $menu_title, string  $menu_route, string  $screen, string  $permission = null) : false|string

Adds an admin dashboard submenu page link.

Parameters

string $menu_title

The text to be used for the menu.

string $menu_route

The route part of the url.

string $screen

Unique name of menu's screen.

string $permission

The permission required for this menu to be displayed to the user.

Returns

false|string —

Return the new menu or false if permission is not met.

add_files_cache_directory()

add_files_cache_directory() 

Adds missing files to site's cache directory.

add_options_submenu()

add_options_submenu(string  $menu_title, string  $menu_route, string  $screen, string  $permission = null) : false|string

Adds an options submenu page link.

Parameters

string $menu_title

The text to be used for the menu.

string $menu_route

The route part of the url.

string $screen

Unique name of menu's screen.

string $permission

The permission required for this menu to be displayed to the user.

Returns

false|string —

Return the new menu or false if permission is not met.

add_parsecode()

add_parsecode(\type  $tag, \type  $func) : \type

Parameters

\type $tag
\type $func

Returns

\type

add_plugins_submenu()

add_plugins_submenu(string  $menu_title, string  $menu_route, string  $screen, string  $permission = null) : false|string

Adds a plugin submenu page link.

Parameters

string $menu_title

The text to be used for the menu.

string $menu_route

The route part of the url.

string $screen

Unique name of menu's screen.

string $permission

The permission required for this menu to be displayed to the user.

Returns

false|string —

Return the new menu or false if permission is not met.

add_post_meta()

add_post_meta(integer  $post_id, string  $meta_key, mixed  $meta_value, boolean  $unique = false) : integer|false

Add meta data field to a post.

Parameters

integer $post_id

Post ID.

string $meta_key

Metadata name.

mixed $meta_value

Metadata value. Must be serializable if non-scalar.

boolean $unique

Optional. Whether the same key should not be added. Default false.

Returns

integer|false —

Meta ID on success, false on failure.

add_query_arg()

add_query_arg(string  $key, string  $value, string  $url) : string

Retrieves a modified URL query string.

Uses query_arg_port filter hook.

Parameters

string $key

A query variable key.

string $value

A query variable value, or a URL to act upon.

string $url

A URL to act upon.

Returns

string —

Returns modified url query string.

add_site_user_meta()

add_site_user_meta(integer  $site_id, array  $params = array()) 

Adds user meta data for specified site.

Parameters

integer $site_id

Site ID.

array $params

Parameters to set (assign_id or role).

add_sites_submenu()

add_sites_submenu(string  $menu_title, string  $menu_route, string  $screen, string  $permission = null) : false|string

Adds a sites submenu page link.

Parameters

string $menu_title

The text to be used for the menu.

string $menu_route

The route part of the url.

string $screen

Unique name of menu's screen.

string $permission

The permission required for this menu to be displayed to the user.

Returns

false|string —

Return the new menu or false if permission is not met.

add_trailing_slash()

add_trailing_slash(string  $string) : string

Appends a trailing slash.

Will remove trailing forward and backslashes if it exists already before adding a trailing forward slash. This prevents double slashing a string or path.

The primary use of this is for paths and thus should be used for paths. It is not restricted to paths and offers no specific path support.

Parameters

string $string

What to add the trailing slash to.

Returns

string —

String with trailing slash added.

add_user_meta()

add_user_meta(integer  $user_id, string  $meta_key, mixed  $meta_value, boolean  $unique = false) : integer|false

Adds meta data to a user.

Parameters

integer $user_id

User ID.

string $meta_key

Metadata name.

mixed $meta_value

Metadata value.

boolean $unique

Optional. Whether the same key should not be added. Default false.

Returns

integer|false —

Meta ID on success, false on failure.

add_user_to_site()

add_user_to_site(object|integer  $user, object|integer  $site, string  $role) : integer

Add user to a site.

Parameters

object|integer $user

User to add to a site.

object|integer $site

Site to add user to.

string $role

Role to assign to user for this site.

Returns

integer

add_users_submenu()

add_users_submenu(string  $menu_title, string  $menu_route, string  $screen, string  $permission = null) : false|string

Adds a users submenu page link.

Parameters

string $menu_title

The text to be used for the menu.

string $menu_route

The route part of the url.

string $screen

Unique name of menu's screen.

string $permission

The permission required for this menu to be displayed to the user.

Returns

false|string —

Return the new menu or false if permission is not met.

admin_dashboard_js()

admin_dashboard_js() 

Loads javascript for backend dashboard.

admin_footer()

admin_footer() 

Fires the admin_footer action via backend.

admin_head()

admin_head() 

Fires the admin_head action.

admin_top_widgets()

admin_top_widgets() 

Fires the admin_top_widgets action.

admin_url()

admin_url(string  $path = '', string  $scheme = 'admin') : string

Returns the url to the admin area for a given site.

Parameters

string $path

Optional. Path relative to the admin url. Default empty.

string $scheme

Optional. The scheme to use. Accepts 'http' or 'https', to force those schemes. Default 'admin'.

Returns

string —

Admin url link with optional path appended.

ae()

ae(string  $perm) : string

Checks if logged in user can access menu, tab, or page.

Parameters

string $perm

Permission to check for.

Returns

string

all()

all(array  $ps) 

Example usage:

it("should do a bunch of calculations", all([ 1+1 == 2, 1+2 == 1249 ]);

Parameters

array $ps

Array of callables.

app()

app() : object

Call the application global scope.

Returns

object

array_to_object()

array_to_object(array  $array) 

Takes an array and turns it into an object.

Parameters

array $array

Array of data.

array_unique_compact()

array_unique_compact(mixed  $a) : mixed

Strips out all duplicate values and compact the array.

Parameters

mixed $a

An array that be compacted.

Returns

mixed

auto_increment()

auto_increment(string  $table = 'deprecated', integer  $pk = 'deprecated') : integer

Auto increments the table's primary key.

Parameters

string $table

Table in the document.

integer $pk

Primary key field name.

Returns

integer

beautify_filename()

beautify_filename(string  $filename) : string

Beautifies a filename for use.

Parameters

string $filename

Filename to beautify.

Returns

string —

Beautified filename.

blacklisted_usernames()

blacklisted_usernames() : array

An extensive list of blacklisted usernames.

Uses blacklisted_usernames filter.

Returns

array —

Array of blacklisted usernames.

check_mime_type()

check_mime_type(string  $file, integer  $mode) : boolean

Checks the mime type of a file.

Parameters

string $file

File to check.

integer $mode

Perform a full check or extension check only.

Returns

boolean

checked()

checked(mixed  $checked, mixed  $current = true, boolean  $echo = true) : string

Outputs the html checked attribute.

Compares the first two arguments and if identical marks as checked

Parameters

mixed $checked

One of the values to compare

mixed $current

(true) The other value to compare if not just true

boolean $echo

Whether to echo or just return the string

Returns

string —

html attribute or empty string

checked_selected_helper()

checked_selected_helper(\any  $helper, \any  $current, boolean  $echo, string  $type) : string

Private helper function for checked, selected, and disabled.

Compares the first two arguments and if identical marks as $type

Parameters

\any $helper

One of the values to compare

\any $current

(true) The other value to compare if not just true

boolean $echo

Whether to echo or just return the string

string $type

The type of checked|selected|disabled we are doing

Returns

string —

html attribute or empty string

clean_pre()

clean_pre(\type  $matches) : \type

Parameters

\type $matches

Returns

\type

compare_releases()

compare_releases(string  $current, string  $latest, string  $operator = '>') : boolean

Compares release values.

Parameters

string $current

Current release value.

string $latest

Latest release value.

string $operator

Operand use to compare current and latest release values.

Returns

boolean

concat_ws()

concat_ws(string  $separator, \type  $string1, \type  $string2) : \type

Concatenation with separator.

Parameters

string $separator

Delimeter to used between strings.

\type $string1

Left string.

\type $string2

Right string.

Returns

\type

create_site_directories()

create_site_directories(integer  $site_id, object  $site, boolean  $update) : boolean

Create the needed directories when a new site is created.

Parameters

integer $site_id

Site ID.

object $site

Site object.

boolean $update

Whether the site is being created or updated.

Returns

boolean —

Returns true on success and false otherwise.

current_user_can()

current_user_can(string  $perm) : boolean

Checks the permission of the logged in user.

Parameters

string $perm

Permission to check for.

Returns

boolean —

Return true if permission matches or false otherwise.

current_user_has_role()

current_user_has_role(string  $role) : boolean

Checks the role of the logged in user.

Parameters

string $role

The role to check for.

Returns

boolean —

True if user has role, false otherwise.

deactivate_plugin()

deactivate_plugin(string  $id) : mixed

Wrapper function for PluginsRepository::deactivate() and deactivates plugin based on $_GET['id'].

Parameters

string $id

ID of the plugin to be deactivated.

Returns

mixed —

Deactivates plugin if it exists and is active.

delete_post_meta()

delete_post_meta(integer  $post_id, string  $meta_key, mixed  $meta_value = '') : boolean

Remove metadata matching criteria from a post.

You can match based on the key, or key and value. Removing based on key and value, will keep from removing duplicate metadata with the same key. It also allows removing all metadata matching key, if needed.

Parameters

integer $post_id

Post ID.

string $meta_key

Metadata name.

mixed $meta_value

Optional. Metadata value. Must be serializable if non-scalar. Default empty.

Returns

boolean —

True on success, false on failure.

delete_post_meta_by_mid()

delete_post_meta_by_mid(integer  $mid) : boolean

Delete post meta data by meta ID.

Parameters

integer $mid

Returns

boolean

delete_site_directories()

delete_site_directories(integer  $site_id, object  $old_site) : boolean

Deletes the site directory when the site is deleted.

Parameters

integer $site_id

Site ID.

object $old_site

Site object.

Returns

boolean —

Returns true on success and false otherwise.

delete_site_tables()

delete_site_tables(integer  $site_id, object  $old_site) 

Deletes site tables when site is deleted.

Parameters

integer $site_id

Site ID.

object $old_site

Site object.

delete_site_user_meta()

delete_site_user_meta(integer  $site_id, object  $old_site) 

Deletes user meta data when site/user is deleted.

Parameters

integer $site_id

Site ID.

object $old_site

Site object of site that was deleted.

delete_user_meta()

delete_user_meta(integer  $user_id, string  $meta_key, mixed  $meta_value = '') : boolean

Remove metadata matching criteria from a user.

You can match based on the key, or key and value. Removing based on key and value, will keep from removing duplicate metadata with the same key. It also allows removing all metadata matching key, if needed.

Parameters

integer $user_id

User ID

string $meta_key

Metadata name.

mixed $meta_value

Optional. Metadata value.

Returns

boolean —

True on success, false on failure.

delete_user_meta_by_mid()

delete_user_meta_by_mid(integer  $mid) : boolean

Delete user meta data by meta ID.

Parameters

integer $mid

Returns

boolean

delete_user_option()

delete_user_option(integer  $user_id, string  $option_name, boolean  $global = false) : boolean

Delete user option with global site capability.

User options are just like user metadata except that they have support for global site options. If the 'global' parameter is false, which it is by default it will prepend the TriTan CMS table prefix to the option name.

Parameters

integer $user_id

User ID

string $option_name

User option name.

boolean $global

Optional. Whether option name is global or site specific. Default false (site specific).

Returns

boolean —

True on success, false on failure.

directory_listing()

directory_listing(string  $dir, string  $bool = "dirs") 

Get an array that represents directory tree.

Parameters

string $dir

Directory path

string $bool

Include sub directories

disabled()

disabled(mixed  $disabled, mixed  $current = true, boolean  $echo = true) : string

Outputs the html disabled attribute.

Compares the first two arguments and if identical marks as disabled

Parameters

mixed $disabled

One of the values to compare

mixed $current

(true) The other value to compare if not just true

boolean $echo

Whether to echo or just return the string

Returns

string —

html attribute or empty string

do_parsecode()

do_parsecode(string  $content) : string

Search content for parsecodes and filter parsecodes through their hooks.

If there are no parsecode tags defined, then the content will be returned without any filtering. This might cause issues when plugins are disabled but the parsecode will still show up in the post or content.

Parameters

string $content

Content to search for parsecodes

Returns

string —

Content with parsecodes filtered out.

do_parsecode_tag()

do_parsecode_tag(array  $m = 'deprecated') : mixed

Regular Expression callable for do_parsecode() for calling parsecode hook.

Parameters

array $m

Regular expression match array

Returns

mixed —

False on failure.

does_option_exist()

does_option_exist(string  $option_key = 'deprecated') : boolean

Checks if a key exists in the option table.

Parameters

string $option_key

Key to check against.

Returns

boolean

does_site_exist()

does_site_exist() 

Checks if site exists or is archived.

does_user_have_sites()

does_user_have_sites(integer  $user_id) : boolean

Checks if the requested user is an admin of any sites or has any admin roles.

Parameters

integer $user_id

ID of user to check.

Returns

boolean —

Returns true if user has sites and false otherwise.

email_exists()

email_exists(string  $email) : string|false

Checks whether the given email exists.

Uses email_exists filter.

Parameters

string $email

Email to check.

Returns

string|false —

The user's ID on success, and false on failure.

esc_attr()

esc_attr(string  $string) : string

Escaping for HTML attributes.

Parameters

string $string

Returns

string —

Escaped HTML attribute.

esc_attr__()

esc_attr__(string  $string, \type  $domain = 'tritan-cms') : string

Retrieve the translation of a string and escapes it for safe use in an attribute.

Parameters

string $string

String to translate.

\type $domain

Optional. Unique identifier for retrieving translated string. Default: 'tritan-cms'.

Returns

string —

Translated string.

esc_html()

esc_html(string  $string) : string

Escaping for HTML blocks.

Parameters

string $string

Returns

string —

Escaped HTML block.

esc_html__()

esc_html__(string  $string, \type  $domain = 'tritan-cms') : string

Retrieve the translation of a string and escapes it for safe use in HTML blocks.

Parameters

string $string

String to translate.

\type $domain

Optional. Unique identifier for retrieving translated string. Default: 'tritan-cms'.

Returns

string —

Translated string.

esc_js()

esc_js(string  $string) : string

Escaping for inline javascript.

Example usage:

 $esc_js = json_encode("Joshua's \"code\"");
 $attribute = esc_js("alert($esc_js);");
 echo '<input type="button" value="push" onclick="'.$attribute.'" />';

Parameters

string $string

Returns

string —

Escaped inline javascript.

esc_textarea()

esc_textarea(string  $string) : string

Escaping for textarea.

Parameters

string $string

Returns

string —

Escaped string.

esc_url()

esc_url(string  $url, array  $scheme = array('http', 'https'), boolean  $encode = false) : string

Escaping for url.

Parameters

string $url

The url to be escaped.

array $scheme

Optional. An array of acceptable schemes.

boolean $encode

Whether url params should be encoded.

Returns

string —

The escaped $url after the esc_url filter is applied.

file_mod_time()

file_mod_time(string  $file) 

Returns the datetime of when the content of file was changed.

file app/functions/deprecated-function.php

Parameters

string $file

Absolute path to file.

flatten_array()

flatten_array(array  $array) : array

Turns multi-dimensional array into a regular array.

Parameters

array $array

The array to convert.

Returns

array

foot_release()

foot_release() : string

Prints installed TriTan release in admin footer.

Returns

string

generate_php_encryption()

generate_php_encryption() : boolean

Generates the encryption table if it does not exist.

Returns

boolean

generate_timezone_list()

generate_timezone_list() : array

Prints a list of timezones which includes current time.

Returns

array

get_age()

get_age(string  $birthdate = '0000-00-00') : mixed

Get age by birthdate.

Parameters

string $birthdate

User's birth date.

Returns

mixed

get_all_post_types()

get_all_post_types() : array

Function used to dynamically generate post screens based on post type.

Returns

array

get_all_posts()

get_all_posts(string  $post_type = null, integer  $limit, null|integer  $offset = null,   $status = 'all') : array

Retrieve all published posts or all published posts by post type.

Parameters

string $post_type

Post type.

integer $limit

Number of posts to show.

null|integer $offset

The offset of the first row to be returned.

$status

Returns

array

get_base_url()

get_base_url() : string

Retrieves TriTan CMS site root url.

Returns

string —

TriTan CMS root url.

get_css_directory_uri()

get_css_directory_uri() : string

Retrieve css directory uri.

Returns

string —

TriTan CMS css url.

get_current_site_id()

get_current_site_id() : integer

Retrieve the current site id.

Returns

integer —

Site ID.

get_current_user_id()

get_current_user_id() : integer

Get the current user's ID

Returns

integer —

The current user's ID, or 0 if no user is logged in.

get_domain_name()

get_domain_name() : string

Retrieve the domain name.

Returns

string

get_file_ext()

get_file_ext(string  $filename) : string

Return the file extension of the given filename.

Parameters

string $filename

Returns

string

get_file_size()

get_file_size(string  $file, integer  $digits = 2) : string|boolean

Parameters

string $file

Filepath

integer $digits

Digits to display

Returns

string|boolean —

Size (KB, MB, GB, TB) or boolean

get_footer_release()

get_footer_release() : \mixed.

Frontend portal footer powered by and release.

Returns

\mixed.

get_functions_in_file()

get_functions_in_file(string  $filename, boolean  $sort = false) 

Returns an array of function names in a file.

Parameters

string $filename

The path to the file.

boolean $sort

If true, sort results by function name.

get_http_response_code()

get_http_response_code(string  $url) : integer

Retrieves a response code from the header of a given resource.

Parameters

string $url

URL of resource/website.

Returns

integer —

HTTP response code.

get_image_directory_uri()

get_image_directory_uri() : string

Retrieve image directory uri.

Returns

string —

TriTan CMS image url.

get_initials()

get_initials(integer  $id, integer  $initials = 2) : string

Shows selected user's initials instead of his/her's full name.

Uses get_initials filter.

Parameters

integer $id

User ID

integer $initials

Number of initials to show.

Returns

string

get_javascript_directory_uri()

get_javascript_directory_uri() : string

Retrieve javascript directory uri.

Returns

string —

TriTan CMS javascript url.

get_layouts_header()

get_layouts_header(  $layout_dir = '') : mixed

Returns the layout header information

Parameters

$layout_dir

Returns

mixed

get_less_directory_uri()

get_less_directory_uri() : string

Retrieve less directory uri.

Returns

string —

TriTan CMS less url.

get_logo_large()

get_logo_large() : string

Large logo. Filterable.

Returns

string

get_logo_mini()

get_logo_mini() : string

Mini logo. Filterable.

Returns

string

get_mu_plugin_url()

get_mu_plugin_url() : string

Returns full base url of MU Plugins.

Returns

string —

MU Plugin base url.

get_multisite_users()

get_multisite_users() : array

Retrieve a list of users based on site.

Returns

array —

Users data.

get_name()

get_name(integer  $id, \bool  $reverse = false) : string

Returns the name of a particular user.

Uses get_name filter.

Parameters

integer $id

User ID.

\bool $reverse

Returns

string

get_parsecode_regex()

get_parsecode_regex() : string

Retrieve the parsecode regular expression for searching.

The regular expression combines the parsecode tags in the regular expression in a regex class.

The regular expression contains 6 different sub matches to help with parsing.

1 - An extra [ to allow for escaping parsecodes with double [[]] 2 - The parsecode name 3 - The parsecode argument list 4 - The self closing / 5 - The content of a parsecode when it wraps some content. 6 - An extra ] to allow for escaping parsecodes with double [[]]

Returns

string —

The parsecode search regular expression

get_path_info()

get_path_info(\type  $relative) : \type

Parameters

\type $relative

Returns

\type

get_perm_roles()

get_perm_roles() : mixed

Retrieves a list of roles from the roles table.

Returns

mixed

get_permalink()

get_permalink(integer|\TriTan\Common\Post\Post  $post) : string

A function which retrieves a TriTan CMS post's permalink.

Purpose of this function is for the {$posttype}_link filter.

Parameters

integer|\TriTan\Common\Post\Post $post

Post id or Post.

Returns

string

get_plugin_data()

get_plugin_data(string  $plugin_file, boolean  $markup = true, boolean  $translate = true) : array

Parses the plugin contents to retrieve plugin's metadata.

The metadata of the plugin's data searches for the following in the plugin's header. All plugin data must be on its own line. For plugin description, it must not have any newlines or only parts of the description will be displayed and the same goes for the plugin data. The below is formatted for printing.

/* Plugin Name: Name of Plugin Plugin URI: Link to plugin information Description: Plugin Description Author: Plugin author's name Author URI: Link to the author's web site Version: Plugin version value. Text Domain: Optional. Unique identifier, should be same as the one used in load_plugin_textdomain()

The first 8kB of the file will be pulled in and if the plugin data is not within that first 8kB, then the plugin author should correct their plugin and move the plugin data headers to the top.

The plugin file is assumed to have permissions to allow for scripts to read the file. This is not checked however and the file is only opened for reading.

Parameters

string $plugin_file

Path to the plugin file

boolean $markup

Optional. If the returned data should have HTML markup applied. Default true.

boolean $translate

Optional. If the returned data should be translated. Default true.

Returns

array —

{ Plugin data. Values will be empty if not supplied by the plugin.

    @type string $Name Name of the plugin. Should be unique.
    @type string $Title Title of the plugin and link to the plugin's site (if set).
    @type string $Description Plugin description.
    @type string $Author Author's name.
    @type string $AuthorURI Author's website address (if set).
    @type string $Version Plugin version.
    @type string $TextDomain Plugin textdomain.
    @type string $DomainPath Plugins relative directory path to .mo files.
    @type bool $Network Whether the plugin can only be activated network-wide.
    }

get_plugin_url()

get_plugin_url() : string

Returns full base url of Plugins.

Returns

string —

Plugin base url.

get_post()

get_post(integer|\TriTan\Common\Post\Post|null  $post, boolean  $object = true) : array|object

Retrieves post data given a post ID or post array.

Parameters

integer|\TriTan\Common\Post\Post|null $post

Post ID or post object.

boolean $object

If set to true, data will return as an object, else as an array. Default: true.

Returns

array|object

get_post_author()

get_post_author(integer  $post_id, boolean  $reverse = false) : string

A function which retrieves a TriTan CMS post author.

Purpose of this function is for the post_author filter.

Parameters

integer $post_id

The unique id of a post.

boolean $reverse

If first name should appear first or not. Default is false.

Returns

string

get_post_author_id()

get_post_author_id(integer  $post_id) : string

A function which retrieves a TriTan CMS post author id.

Purpose of this function is for the post_author_id filter.

Parameters

integer $post_id

The unique id of a post.

Returns

string

get_post_by()

get_post_by(string  $field, integer|string  $value) 

Retrieve post by a given field from the post table.

Parameters

string $field

The field to retrieve the post with.

integer|string $value

A value for $field (_id, post_id, post_slug).

get_post_content()

get_post_content(integer  $post_id) : string

A function which retrieves a TriTan CMS post content.

Purpose of this function is for the post_content filter.

Parameters

integer $post_id

The unique id of a post.

Returns

string

get_post_created_date()

get_post_created_date(string  $format = 'U', \bool  $gmt = false, integer  $post = null, \bool  $translate = false) : string

Retrieves TriTan CMS post created date.

Parameters

string $format
\bool $gmt
integer $post

The unique id of a post.

\bool $translate

Returns

string

get_post_created_time()

get_post_created_time(\string  $format = 'U', \bool  $gmt = false,   $post = null, \bool  $translate = false) : string

A function which retrieves TriTan CMS post created time.

Purpose of this function is for the post_created_time filter.

Parameters

\string $format
\bool $gmt
$post
\bool $translate

Returns

string

get_post_custom()

get_post_custom(integer  $post_id) : array

Retrieve post meta fields, based on post ID.

The post meta fields are retrieved from the cache where possible, so the function is optimized to be called more than once.

Parameters

integer $post_id

The post's id.

Returns

array —

Post meta for the given post.

get_post_custom_keys()

get_post_custom_keys(integer  $post_id) : array|void

Retrieve meta field names for a post.

If there are no meta fields, then nothing (null) will be returned.

Parameters

integer $post_id

The post's id.

Returns

array|void —

Array of the keys, if retrieved.

get_post_custom_values()

get_post_custom_values(string  $key = '', integer  $post_id) : array|null

Retrieve values for a custom post field.

The parameters must not be considered optional. All of the post meta fields will be retrieved and only the meta field key values returned.

Parameters

string $key

Optional. Meta field key. Default empty.

integer $post_id

The post's id.

Returns

array|null —

Meta field values.

get_post_date()

get_post_date(integer  $post_id, string  $type = 'published') : string

A function which retrieves TriTan CMS post date.

Uses call_user_func_array() function to return appropriate post date function. Dynamic part is the variable $type, which calls the date function you need.

Parameters

integer $post_id

The unique id of a post.

string $type

Type of date to return: created, published, modified. Default: published.

Returns

string

get_post_datetime()

get_post_datetime(integer  $post_id) : string

A function which retrieves TriTan CMS post datetime.

Purpose of this function is for the post_datetime filter.

Parameters

integer $post_id

The unique id of a post.

Returns

string

get_post_dropdown_list()

get_post_dropdown_list(string  $slug = null, integer  $post_id) : array

Retrieves all posts

Parameters

string $slug

Post slug.

integer $post_id

Post id.

Returns

array

get_post_id()

get_post_id(string  $post_slug = null) : integer

A function which retrieves a TriTan CMS post id.

Parameters

string $post_slug

The unique slug of a post.

Returns

integer

get_post_meta()

get_post_meta(integer  $post_id, string  $key = '', boolean  $single = false) : mixed

Retrieve post meta field for a post.

Parameters

integer $post_id

Post ID.

string $key

Optional. The meta key to retrieve. By default, returns data for all keys. Default empty.

boolean $single

Optional. Whether to return a single value. Default false.

Returns

mixed —

Will be an array if $single is false. Will be value of meta data field if $single is true.

get_post_meta_by_mid()

get_post_meta_by_mid(integer  $mid) : array|boolean

Get post meta data by meta ID.

Parameters

integer $mid

Returns

array|boolean

get_post_modified()

get_post_modified(integer  $post_id) : string

A function which retrieves TriTan CMS post modified datetime.

Purpose of this function is for the post_modified filter.

Parameters

integer $post_id

The unique id of a post.

Returns

string

get_post_modified_date()

get_post_modified_date(\string  $format = 'U', \bool  $gmt = false,   $post = null, \bool  $translate = false) : string

A function which retrieves TriTan CMS post modified date.

Parameters

\string $format
\bool $gmt
$post
\bool $translate

Returns

string

get_post_modified_time()

get_post_modified_time(\string  $format = 'U', \bool  $gmt = false,   $post = null, \bool  $translate = false) : string

A function which retrieves TriTan CMS post modified time.

Parameters

\string $format
\bool $gmt
$post
\bool $translate

Returns

string

get_post_parent()

get_post_parent(integer  $post_id) : string

A function which retrieves TriTan CMS post parent.

Purpose of this function is for the post_parent filter.

Parameters

integer $post_id

The unique id of a post.

Returns

string

get_post_parent_id()

get_post_parent_id(integer  $post_id) : string

A function which retrieves TriTan CMS post parent id.

Purpose of this function is for the post_parent_id filter.

Parameters

integer $post_id

The unique id of a post.

Returns

string

get_post_posttype()

get_post_posttype(integer  $post_id) : string

A function which retrieves TriTan CMS post posttype.

Purpose of this function is for the post_posttype filter.

Parameters

integer $post_id

The unique id of a post.

Returns

string

get_post_posttype_id()

get_post_posttype_id(integer  $post_id) : string

A function which retrieves TriTan CMS post posttype id.

Purpose of this function is for the post_posttype_id filter.

Parameters

integer $post_id

The unique id of a post.

Returns

string

get_post_posttype_link()

get_post_posttype_link(\into  $post_id) : string

A function which retrieves a TriTan CMS post posttype link.

Purpose of this function is for the post_posttype_link filter.

Parameters

\into $post_id

The unique id of a post.

Returns

string

get_post_posttype_slug()

get_post_posttype_slug(integer  $post_id) : string

A function which retrieves a TriTan CMS post posttype slug.

Purpose of this function is for the post_posttype_slug filter.

Parameters

integer $post_id

The unique id of a post.

Returns

string

get_post_published_date()

get_post_published_date(\string  $format = 'U', \bool  $gmt = false,   $post = null, \bool  $translate = false) : string

A function which retrieves TriTan CMS post published date.

Parameters

\string $format
\bool $gmt
$post
\bool $translate

Returns

string

get_post_published_time()

get_post_published_time(\string  $format = 'U', \bool  $gmt = false,   $post = null, \bool  $translate = false) : string

A function which retrieves TriTan CMS post published time.

Parameters

\string $format
\bool $gmt
$post
\bool $translate

Returns

string

get_post_show_in_menu()

get_post_show_in_menu(integer  $post_id) : string

A function which retrieves TriTan CMS post show in menu.

Purpose of this function is for the post_show_in_menu filter.

Parameters

integer $post_id

The unique id of a post.

Returns

string

get_post_show_in_search()

get_post_show_in_search(integer  $post_id) : string

A function which retrieves TriTan CMS post show in search.

Purpose of this function is for the post_show_in_search filter.

Parameters

integer $post_id

The unique id of a post.

Returns

string

get_post_sidebar()

get_post_sidebar(integer  $post_id) : string

A function which retrieves TriTan CMS post sidebar.

Purpose of this function is for the post_sidebar filter.

Parameters

integer $post_id

The unique id of a post.

Returns

string

get_post_slug()

get_post_slug(integer  $post_id) : string

A function which retrieves a TriTan CMS post slug.

Purpose of this function is for the post_slug filter.

Parameters

integer $post_id

The unique id of a post.

Returns

string

get_post_status()

get_post_status(integer  $post_id) : string

A function which retrieves a TriTan CMS post status.

Purpose of this function is for the post_status filter.

Parameters

integer $post_id

The unique id of a post.

Returns

string

get_post_time()

get_post_time(integer  $post_id, string  $type = 'published') : string

A function which retrieves TriTan CMS post time.

Uses call_user_func_array() function to return appropriate post time function. Dynamic part is the variable $type, which calls the date function you need.

Parameters

integer $post_id

The unique id of a post.

string $type

Type of date to return: created, published, modified. Default: published.

Returns

string

get_post_title()

get_post_title(integer  $post_id) : string

A function which retrieves a TriTan CMS post title.

Purpose of this function is for the post_title filter.

Parameters

integer $post_id

The unique id of a post.

Returns

string

get_post_type_name()

get_post_type_name(integer  $post_id) : string

A function which retrieves a TriTan CMS post posttype name.

Purpose of this function is for the post_posttype_name filter.

Parameters

integer $post_id

The unique id of a post.

Returns

string

get_posttype()

get_posttype(integer|\TriTan\Common\Posttype\Posttype  $posttype, boolean  $object = true) : array|object

Retrieves post type data given a post type ID or post type array.

Parameters

integer|\TriTan\Common\Posttype\Posttype $posttype

Posttype ID or postttype object.

boolean $object

If set to true, data will return as an object, else as an array. Default: true.

Returns

array|object

get_posttype_by()

get_posttype_by(string  $field, integer|string  $value) 

Retrieve post type by a given field from the post type table.

Parameters

string $field

The field to retrieve the post type with.

integer|string $value

A value for $field (_id, post_id, posttype_slug).

get_posttype_description()

get_posttype_description(integer  $posttype_id) : string

A function which retrieves a TriTan CMS posttype description.

Purpose of this function is for the posttype_description filter.

Parameters

integer $posttype_id

The unique id of a posttype.

Returns

string

get_posttype_permalink()

get_posttype_permalink(integer  $posttype_id) : string

A function which retrieves a TriTan CMS posttype's permalink.

Purpose of this function is for the posttype_permalink filter.

Parameters

integer $posttype_id

Posttype id.

Returns

string

get_posttype_slug()

get_posttype_slug(integer  $posttype_id) : string

A function which retrieves a TriTan CMS posttype slug.

Purpose of this function is for the posttype_slug filter.

Parameters

integer $posttype_id

The unique id of a posttype.

Returns

string

get_posttype_title()

get_posttype_title(integer  $posttype_id) : string

A function which retrieves a TriTan CMS post type title.

Purpose of this function is for the posttype_title filter.

Parameters

integer $posttype_id

The unique id of a posttype.

Returns

string

get_private_site_upload_url()

get_private_site_upload_url(  $path = '') : string

Returns full base url of a site's private upload url.

Parameters

$path

Returns

string —

Site's private upload base url.

get_private_site_url()

get_private_site_url(  $path = '') : string

Returns full base url of a site's private url.

Parameters

$path

Returns

string —

Site's private base url.

get_relative_url()

get_relative_url(integer|\TriTan\Common\Post\Post  $post) : string

A function which retrieves a TriTan CMS post's relative url.

Purpose of this function is for the {$posttype}_relative_url filter.

Parameters

integer|\TriTan\Common\Post\Post $post

Post id or Post.

Returns

string

get_role_by_id()

get_role_by_id(integer  $role) : array

Returns the values of a requested role.

Parameters

integer $role

The id of the role to check for.

Returns

array —

Returned values of the role.

get_secure_cookie_data()

get_secure_cookie_data(string  $key) : mixed

Retrieves data from a secure cookie.

Parameters

string $key

COOKIE key.

Returns

mixed

get_site()

get_site(integer|\TriTan\Common\Site\Site|null  $site, boolean  $object = true) : array|object

Retrieves site data given a site ID or post array.

Parameters

integer|\TriTan\Common\Site\Site|null $site

Site ID or object.

boolean $object

If set to true, data will return as an object, else as an array. Default: true.

Returns

array|object

get_site_details()

get_site_details(integer|string|array  $fields = null, boolean  $get_all = true) : boolean|\TriTan\Error|\TriTan\Site

Retrieve the details of a site from the site document and site options.

Parameters

integer|string|array $fields

A site's id or an array of site data.

boolean $get_all

Whether to retrieve all data or only data from site document.

Returns

boolean|\TriTan\Error|\TriTan\Site —

Site details on success or false.

get_site_domain()

get_site_domain(integer  $site_id) : string

A function which retrieves TriTan CMS site domain.

Purpose of this function is for the site_domain filter.

Parameters

integer $site_id

The unique id of a site.

Returns

string

get_site_name()

get_site_name(integer  $site_id) : string

A function which retrieves TriTan CMS site name.

Purpose of this function is for the site_name filter.

Parameters

integer $site_id

The unique id of a site.

Returns

string

get_site_owner()

get_site_owner(integer  $site_id) : string

A function which retrieves TriTan CMS site owner.

Purpose of this function is for the site_owner filter.

Parameters

integer $site_id

The unique id of a site.

Returns

string

get_site_path()

get_site_path(integer  $site_id) : string

A function which retrieves TriTan CMS site path.

Purpose of this function is for the site_path filter.

Parameters

integer $site_id

The unique id of a site.

Returns

string

get_site_status()

get_site_status(integer  $site_id) : string

A function which retrieves TriTan CMS site status.

Purpose of this function is for the site_status filter.

Parameters

integer $site_id

The unique id of a site.

Returns

string

get_site_themes()

get_site_themes(string  $active = null) : array

Get a list of themes available for a specific site.

Parameters

string $active

The name to check against.

Returns

array —

Theme options to choose from.

get_theme()

get_theme() : string

Retrieve name of the current theme.

Returns

string —

Theme name.

get_theme_directory_uri()

get_theme_directory_uri() : string

Retrieve theme directory URI.

Returns

string —

TriTan CMS theme directory uri.

get_theme_url()

get_theme_url() : string

Returns full base url of a site's theme.

Returns

string —

Site's theme base url.

get_user_avatar()

get_user_avatar(string  $email, integer  $s = 80, string  $class = '') : string

Retrieve the avatar `<img>` tag for user.

Parameters

string $email

User's email address.

integer $s

Height and width of the avatar image file in pixels. Default 80.

string $class

Class to add to <img> element.

Returns

string —

<img> tag for user's avatar or default otherwise.

get_user_avatar_url()

get_user_avatar_url(string  $email) : string

Retrieves the avatar url.

Parameters

string $email

Email address of user.

Returns

string —

The url of the avatar that was found, or default if not found.

get_user_by()

get_user_by(string  $field, integer|string  $value) 

Retrieve user info by a given field from the user's table.

Parameters

string $field

The field to retrieve the user with.

integer|string $value

A value for $field (id, uname or email).

get_user_meta()

get_user_meta(integer  $user_id, string  $key = '', boolean  $single = false) : mixed

Retrieve user meta field for a user.

Parameters

integer $user_id

User ID.

string $key

Optional. The meta key to retrieve. By default, returns data for all keys.

boolean $single

Whether to return a single value.

Returns

mixed —

Will be an array if $single is false. Will be value of meta data field if $single is true.

get_user_meta_by_mid()

get_user_meta_by_mid(integer  $mid) : array|boolean

Get user meta data by meta ID.

Parameters

integer $mid

Returns

array|boolean

get_user_option()

get_user_option(string  $option, integer  $user) : mixed

Retrieve user option that can be either per Site or global.

If the user ID is not given, then the current user will be used instead. If the user ID is given, then the user data will be retrieved. The filter for the result, will also pass the original option name and finally the user data object as the third parameter.

The option will first check for the per site name and then the global name.

Uses get_user_option_$option filter.

Parameters

string $option

User option name.

integer $user

Optional. User ID.

Returns

mixed —

User option value on success, false on failure.

get_user_roles()

get_user_roles(integer  $active = null) 

Retrieve a list of available user roles.

Parameters

integer $active

get_user_value()

get_user_value(string  $id, string  $field) : mixed

Retrieve requested field from usermeta document based on user's id.

Parameters

string $id

User ID.

string $field

Data requested of particular user.

Returns

mixed

get_userdata()

get_userdata(mixed  $user_id) : \User|false

Retrieve user info by user_id.

Parameters

mixed $user_id

User's id.

Returns

\User|false —

User array on success, false on failure.

get_users_by_siteid()

get_users_by_siteid(integer  $site_id) : object

Retrieves a list of users by site_id

Parameters

integer $site_id

Site id. Default: 0.

Returns

object —

User object.

get_users_dropdown()

get_users_dropdown(integer  $active = null) : array

Print a dropdown list of users.

Parameters

integer $active

If working with active record, it will be the user's id.

Returns

array —

Dropdown list of users.

get_users_list()

get_users_list(\type  $active = null) 

Retrieve a list of all users.

Parameters

\type $active

get_users_reassign()

get_users_reassign(integer  $user_id) : array

Print a dropdown list of users.

Parameters

integer $user_id

If working with active record, it will be the user's id.

Returns

array —

Dropdown list of users.

get_users_sites()

get_users_sites(integer  $user_id) : array

Get an array of sites by user.

Parameters

integer $user_id

The user's id.

Returns

array

has_posts()

has_posts() : integer|null

This function checks to see if the current TriTan CMS query has any results to loop over.

Returns

integer|null

hash_equals()

hash_equals(string  $known_string, string  $user_string) : boolean

Timing attack safe string comparison

Compares two strings using the same time whether they're equal or not. This function should be used to mitigate timing attacks; for instance, when testing crypt() password hashes.

Parameters

string $known_string

The string of known length to compare against

string $user_string

The user-supplied string

Returns

boolean —

Returns TRUE when the two strings are equal, FALSE otherwise.

hasPermission()

hasPermission(string  $perm) : boolean

Checks the permission of the logged in user.

Parameters

string $perm

Permission to check for.

Returns

boolean —

Return true if permission matches or false otherwise.

head_release_meta()

head_release_meta() : string

Prints generator meta tag in admin head.

Returns

string

home_url()

home_url(string  $path = '', string|null  $scheme = null) : string

Returns the url for a given site where the front end is accessible.

The protocol will be 'https' if is_ssl() evaluates to true; If $scheme is 'http' or 'https', is_ssl() is overridden.

Parameters

string $path

Optional. Path relative to the home url. Default empty.

string|null $scheme

Optional. Scheme to give the home URL context. Accepts 'http', 'https', 'relative', or null. Default null.

Returns

string —

Home url link with optional path appended.

html_purify()

html_purify(string  $string, boolean  $is_image = false) : string

Makes content safe to print on screen.

This function should only be used on output. With the exception of uploading images, never use this function on input. All inputted data should be accepted and then purified on output for optimal results. For output of images, make sure to escape with esc_url().

Parameters

string $string

Text to purify.

boolean $is_image

Returns

string

is_admin()

is_admin() : boolean

Whether the current request is for an administrative interface.

Returns

boolean —

True if an admin screen, otherwise false.

is_apache()

is_apache() : boolean

Determines if the server is running Apache.

Returns

boolean

is_duplicate_function()

is_duplicate_function(string  $filename) 

Checks a given file for any duplicated named user functions.

Parameters

string $filename

is_login()

is_login() : boolean

Whether the current request is for a login interface.

Returns

boolean —

True if login screen, otherwise false.

is_plugin_activated()

is_plugin_activated(string  $plugin) : boolean

Wrapper function for PluginsRepository::isActivated() and checks if a particular plugin is activated

Parameters

string $plugin

Name of plugin file.

Returns

boolean —

False if plugin is not activated and true if it is activated.

is_post_parent()

is_post_parent(integer  $post_id) : boolean|array

Checks if a post has any children.

Parameters

integer $post_id

Post id to check.

Returns

boolean|array —

False if not, array of children if true.

is_post_posttype_exist()

is_post_posttype_exist(integer  $posttype_id) : boolean

Checks if a given posttype exists on posts.

Parameters

integer $posttype_id

Posttype id to check for.

Returns

boolean —

True if exists, false otherwise;

is_ssl()

is_ssl() : boolean

Determines if SSL is used.

Checks if base_url filter hook is present.

Returns

boolean —

True if SSL, otherwise false.

is_ttcms_error()

is_ttcms_error(mixed  $object) : boolean

Check whether variable is an TriTan CMS Error.

Returns true if $object is an object of the \TriTan\Error class.

Parameters

mixed $object

Check if unknown variable is an \TriTan\Error object.

Returns

boolean —

True, if \TriTan\Error. False, if not \TriTan\Error.

is_ttcms_exception()

is_ttcms_exception(mixed  $object) : boolean

Check whether variable is an TriTan CMS Exception.

Returns true if $object is an object of the \TriTan\Exception\BaseException class.

Parameters

mixed $object

Check if unknown variable is an \TriTan\Exception\BaseException object.

Returns

boolean —

True, if \TriTan\Exception\BaseException. False, if not \TriTan\Exception\BaseException.

is_user_logged_in()

is_user_logged_in() : boolean

Checks if a visitor is logged in or not.

Returns

boolean

it()

it(string  $m, mixed  $p) 

Example usage:

it("should sum two numbers", 1+1==2); it("should display an red X for a failing test", 1+1==3);

Parameters

string $m

Message.

mixed $p

Callable.

load_activated_plugins()

load_activated_plugins(string  $plugins_dir = '') : mixed

Wrapper function for PluginsRepository::load() and loads all activated plugins for inclusion.

Parameters

string $plugins_dir

Loads plugins from specified folder

Returns

mixed

load_core_locale()

load_core_locale() : string

Loads the current or default locale.

Returns

string —

The locale.

load_default_textdomain()

load_default_textdomain(string  $domain, string  $path) : boolean

Load default translated strings based on locale.

Parameters

string $domain

Text domain. Unique identifier for retrieving translated strings.

string $path

Path to the .mo file.

Returns

boolean —

True on success, false on failure.

load_plugin_textdomain()

load_plugin_textdomain(string  $domain, string  $plugin_rel_path = false) : boolean

Load a plugin's translated strings.

If the path is not given then it will be the root of the plugin directory.

Parameters

string $domain

Unique identifier for retrieving translated strings

string $plugin_rel_path

Optional. Relative path to TTCMS_PLUGIN_DIR where the locale directory resides. Default false.

Returns

boolean —

True when textdomain is successfully loaded, false otherwise.

load_textdomain()

load_textdomain(string  $domain, string  $path) : boolean

Load a .mo file into the text domain.

Parameters

string $domain

Text domain. Unique identifier for retrieving translated strings.

string $path

Path to the .mo file.

Returns

boolean —

True on success, false on failure.

login_url()

login_url(string  $redirect = '', string  $path = '', string|null  $scheme = 'login') : string

Returns the login url for a given site.

Parameters

string $redirect

Path to redirect to on log in.

string $path

Optional. Path relative to the login url. Default empty.

string|null $scheme

Optional. Scheme to give the home URL context. Accepts 'http', 'https', 'relative', or null. Default 'login'.

Returns

string —

Returns the login url.

make_clickable()

make_clickable(string  $value, array  $protocols = array('http', 'mail'), array  $attributes = array()) : string

Turn all URLs into clickable links.

Parameters

string $value
array $protocols

http/https, ftp, mail, twitter

array $attributes

Returns

string

new_site_data()

new_site_data(integer  $site_id, object  $site, boolean  $update) : integer|boolean

Populates site options and user meta for site admin after new site is created.

Parameters

integer $site_id

Site id of the newly created site.

object $site

Site object of newly created site.

boolean $update

Whether the site is being created or updated.

Returns

integer|boolean —

Returns the site id if successful and false otherwise.

nocache_headers()

nocache_headers() 

number_posts_per_type()

number_posts_per_type(string  $slug) : integer

Returns the number of posts within a given post type.

Parameters

string $slug

Post type slug.

Returns

integer

parsecode_atts()

parsecode_atts(array  $pairs, array  $atts) : array

Combine user attributes with known attributes and fill in defaults when needed.

The pairs should be considered to be all of the attributes which are supported by the caller and given as a list. The returned attributes will only contain the attributes in the $pairs list.

If the $atts list has unsupported attributes, then they will be ignored and removed from the final returned list.

Parameters

array $pairs

Entire list of supported attributes and their defaults.

array $atts

User defined attributes in parsecode tag.

Returns

array —

Combined and filtered attribute list.

parsecode_parse_atts()

parsecode_parse_atts(string  $text) : array

Retrieve all attributes from the parsecodes tag.

The attributes list has the attribute name as the key and the value of the attribute as the value in the key/value pair. This allows for easier retrieval of the attributes, since all attributes have to be known.

Parameters

string $text

Returns

array —

List of attributes and their value.

parsecode_unautop()

parsecode_unautop(\type  $pee) : \type

Parameters

\type $pee

Returns

\type

percent()

percent(  $num_amount,   $num_total) 

Parameters

$num_amount
$num_total

php_like()

php_like(string  $pattern, string  $subject) : boolean

SQL Like operator in PHP.

Returns true if match else false.

Example Usage:

 php_like('%uc%','Lucy'); //true
 php_like('%cy', 'Lucy'); //true
 php_like('lu%', 'Lucy'); //true
 php_like('%lu', 'Lucy'); //false
 php_like('cy%', 'Lucy'); //false

Parameters

string $pattern
string $subject

Returns

boolean

plugin_basename()

plugin_basename(string  $filename) 

Wrapper function for PluginFile::basename() method and extracts the file name of a specific plugin.

Parameters

string $filename

Plugin's file name.

plugin_dir_path()

plugin_dir_path(string  $filename) : string

Wrapper function for PluginFile::path() method.

Get the filesystem directory path (with trailing slash) for the plugin FILE passed in.

Parameters

string $filename

The filename of the plugin (FILE).

Returns

string —

The filesystem path of the directory that contains the plugin.

plugin_dir_url()

plugin_dir_url(string  $file) : string

Get the URL directory path (with trailing slash) for the plugin __FILE__ passed in.

Parameters

string $file

The filename of the plugin (FILE).

Returns

string —

the URL path of the directory that contains the plugin.

plugins_url()

plugins_url(string  $path = '', string  $plugin = '') : string

Retrieves a URL within the plugins or mu-plugins directory.

Defaults to the plugins directory URL if no arguments are supplied.

Parameters

string $path

Optional. Extra path appended to the end of the URL, including the relative directory if $plugin is supplied. Default empty.

string $plugin

Optional. A full path to a file inside a plugin or mu-plugin. The URL will be relative to its directory. Default empty. Typically this is done by passing __FILE__ as the argument.

Returns

string —

Plugins URL link with optional paths appended.

populate_options_cache()

populate_options_cache() 

Populate the option cache.

populate_usermeta_cache()

populate_usermeta_cache() 

Populate the user cache.

print_gzipped_page()

print_gzipped_page() 

process_email_html()

process_email_html(string  $text, string  $title) : string

Process the HTML version of the text.

Uses email_template_body filter hook.

Parameters

string $text
string $title

Returns

string

reassign_posts()

reassign_posts(integer  $user_id, integer  $assign_id) 

Reassigns posts to a different user.

Parameters

integer $user_id

ID of user being removed.

integer $assign_id

ID of user to whom posts will be assigned.

reassign_sites()

reassign_sites(integer  $user_id, array  $params = array()) 

Reassigns sites to a different user.

Parameters

integer $user_id

ID of user being removed.

array $params

User parameters (assign_id and role).

recently_published_widget()

recently_published_widget() : \5

Recently published widget.

Returns

\5 —

recently published posts.

register_activation_hook()

register_activation_hook(string  $filename, string  $function) 

Wrapper function for PluginRegisterActivationHook::activation() method.

When a plugin is activated, the action activate_pluginname hook is called. pluginname is replaced by the actually file name of the plugin being activated. So if the plugin is located at 'plugin/sample/sample.plugin.php', then the hook will call 'activate_sample.plugin.php'.

Parameters

string $filename

Plugin's filename.

string $function

The function that should be triggered by the hook.

register_deactivation_hook()

register_deactivation_hook(string  $filename, string  $function) 

Wrapper function for PluginRegisterActivationHook::deactivation() method.

When a plugin is deactivated, the action deactivate_pluginname hook is called. pluginname is replaced by the actually file name of the plugin being deactivated. So if the plugin is located at 'plugin/sample/sample.plugin.php', then the hook will call 'deactivate_sample.plugin.php'.

Parameters

string $filename

Plugin's filename.

string $function

The function that should be triggered by the hook.

remote_file_exists()

remote_file_exists(  $url) : boolean

Parameters

$url

Returns

boolean

remove_all_parsecodes()

remove_all_parsecodes() 

Clear all parsecodes.

This function is simple, it clears all of the parsecode tags by replacing the parsecodes global by a empty array. This is actually a very efficient method for removing all parsecodes.

remove_parsecode()

remove_parsecode(string  $tag) 

Removes hook for parsecode.

Parameters

string $tag

parsecode tag to remove hook for.

remove_trailing_slash()

remove_trailing_slash(string  $string) : string

Removes trailing forward slashes and backslashes if they exist.

The primary use of this is for paths and thus should be used for paths. It is not restricted to paths and offers no specific path support.

Parameters

string $string

What to remove the trailing slashes from.

Returns

string —

String without the trailing slashes.

reset_password()

reset_password(integer  $user_id) : integer|\TriTan\Exception\Exception

Resets a user's password.

Parameters

integer $user_id

ID of user who's password is to be reset. Default: 0.

Returns

integer|\TriTan\Exception\Exception

User id on success or Exception on failure.

role_perm()

role_perm(integer  $id) 

Used on the Role screen for permissions.

Parameters

integer $id

Role id.

safe_truncate()

safe_truncate(string  $string, integer  $length, string  $append = '...') : string

Truncate a string to a specified length without cutting a word off

Parameters

string $string

The string to truncate

integer $length

The length to truncate the string to

string $append

Text to append to the string IF it gets truncated, defaults to '...'

Returns

string

sanitize_filename()

sanitize_filename(string  $filename, boolean  $beautify = true) : string

Sanitizes a filename.

Parameters

string $filename

Name of file to sanitize.

boolean $beautify

Whether or not to beautify the sanitized filename.

Returns

string —

Sanitized filename for use.

sanitize_url()

sanitize_url(string  $url, boolean  $encode = false) : string

Sanitizes a url to be used safely.

Example usage:

 $url = "http://www.example.com/?message=test&<script>alert('XSS');</script>";

 sanitize_url($url); //returns 'http://www.example.com/?message=test&38;';

Parameters

string $url

The url to be sanitized.

boolean $encode

Whether url params should be encoded.

Returns

string —

The sanitized $url after the sanitize_url filter is applied.

selected()

selected(mixed  $selected, mixed  $current = true, boolean  $echo = true) : string

Outputs the html selected attribute.

Compares the first two arguments and if identical marks as selected

Parameters

mixed $selected

One of the values to compare

mixed $current

(true) The other value to compare if not just true

boolean $echo

Whether to echo or just return the string

Returns

string —

html attribute or empty string

send_email_change_email()

send_email_change_email(array  $user, array  $userdata) : boolean|\PHPMailer\PHPMailer\Exception

Email sent to user with changed/updated email.

Parameters

array $user

Original user array.

array $userdata

Updated user array.

Returns

boolean|\PHPMailer\PHPMailer\Exception

send_new_user_email()

send_new_user_email(integer  $user_id, string  $pass) : boolean|\PHPMailer\PHPMailer\Exception

Email sent to new user when account is created.

Parameters

integer $user_id

User id.

string $pass

Plaintext password.

Returns

boolean|\PHPMailer\PHPMailer\Exception

send_password_change_email()

send_password_change_email(integer  $user, string  $password, array  $userdata) : boolean|\PHPMailer\PHPMailer\Exception

Email sent to user with changed/updated password.

Parameters

integer $user

User array.

string $password

Plaintext password.

array $userdata

Updated user array.

Returns

boolean|\PHPMailer\PHPMailer\Exception

send_reset_password_email()

send_reset_password_email(integer  $user, string  $password) : boolean|\PHPMailer\PHPMailer\Exception

Email sent to user with new generated password.

Parameters

integer $user

User array.

string $password

Plaintext password.

Returns

boolean|\PHPMailer\PHPMailer\Exception

set_email_template()

set_email_template(string  $body) : string

Add the template to the message body.

Looks for {content} into the template and replaces it with the message.

Uses email_template filter hook.

Parameters

string $body

The message to templatize.

Returns

string —

$email The email surrounded by template.

set_url_scheme()

set_url_scheme(string  $url, string|null  $scheme = null) : string

Sets the scheme for a URL.

Parameters

string $url

Absolute URL that includes a scheme

string|null $scheme

Optional. Scheme to give $url. Currently 'http', 'https', 'login', 'admin', 'relative', 'rest' or null. Default null.

Returns

string —

$url URL with chosen scheme.

site_domain_exists()

site_domain_exists(string  $sitedomain) : boolean

Checks whether the given site domain exists.

Parameters

string $sitedomain

Site domain to check against.

Returns

boolean —

If site domain exists, return true otherwise return false.

site_exists()

site_exists(string  $site_domain, string  $site_path) : boolean

Checks whether the given site exists.

Parameters

string $site_domain

Site domain to check against.

string $site_path

Site path to check against.

Returns

boolean —

If site exists, return true otherwise return false.

site_url()

site_url(string  $path = '', string  $scheme = null) : string

Returns the url for a given site.

Returns 'https' if is_ssl() evaluates to true and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is overridden.

Parameters

string $path

Optional. Route relative to the site url. Default '/'.

string $scheme

Optional. Scheme to give the site URL context. Accepts 'http', 'https', 'login', 'admin', or 'relative'. Default null.

Returns

string —

Site url link.

strip_parsecode_tag()

strip_parsecode_tag(\type  $m) : \type

Parameters

\type $m

Returns

\type

strip_parsecodes()

strip_parsecodes(string  $content) : string

Remove all parsecode tags from the given content.

Parameters

string $content

Content to remove parsecode tags.

Returns

string —

Content without parsecode tags.

subdomain_as_directory()

subdomain_as_directory() : string

Subdomain as directory function uses the subdomain of the install as a directory.

Returns

string

t__()

t__(\type  $msgid, \type  $domain = '') : string

Displays the returned translated text.

Parameters

\type $msgid

The translated string.

\type $domain

Domain lookup for translated text.

Returns

string —

Translated text according to current locale.

template_vars_replacement()

template_vars_replacement(string  $template) : string

Replace variables in the template.

Uses email_template_tags filter hook.

Parameters

string $template

Template with variables.

Returns

string —

Template with variables replaced.

the_content()

the_content(integer  $post_id) : string

The TriTan CMS post filter.

Uses the_content filter.

Parameters

integer $post_id

The unique id of a post.

Returns

string

the_created_date()

the_created_date(string  $format = '', integer|\TriTan\Common\Post\Post  $post = null) : string|integer|false

Retrieves TriTan CMS post created date.

Parameters

string $format

Format to use for retrieving the date the post was written. Accepts 'G', 'U', or php date format value specified in 'date_format' option. Default empty.

integer|\TriTan\Common\Post\Post $post

Post array or post id.

Returns

string|integer|false —

Formatted date string or Unix timestamp if $format is 'U' or 'G'. False on failure.

the_created_time()

the_created_time(string  $format = '', integer|\TriTan\Common\Post\Post  $post = null) : string|integer|false

Retrieves TriTan CMS post created time.

Parameters

string $format

Format to use for retrieving the time the post was written. Accepts 'G', 'U', or php date format value specified in 'time_format' option. Default empty.

integer|\TriTan\Common\Post\Post $post

Post array or post id.

Returns

string|integer|false —

Formatted date string or Unix timestamp if $format is 'U' or 'G'. False on failure.

the_modified_date()

the_modified_date(string  $format = '', integer|\TriTan\Common\Post\Post  $post = null) : string|integer|false

Retrieves TriTan CMS post published date.

Parameters

string $format

Format to use for retrieving the date the post was published. Accepts 'G', 'U', or php date format value specified in 'date_format' option. Default empty.

integer|\TriTan\Common\Post\Post $post

Post array or post id.

Returns

string|integer|false —

Formatted date string or Unix timestamp if $format is 'U' or 'G'. False on failure.

the_modified_time()

the_modified_time(string  $format = '', integer|\TriTan\Common\Post\Post  $post = null) : string|integer|false

Retrieves TriTan CMS post modified time.

Parameters

string $format

Format to use for retrieving the time the post was modified. Accepts 'G', 'U', or php date format value specified in 'time_format' option. Default empty.

integer|\TriTan\Common\Post\Post $post

Post array or post id.

Returns

string|integer|false —

Formatted date string or Unix timestamp if $format is 'U' or 'G'. False on failure.

the_permalink()

the_permalink(integer|array  $post) 

Displays the permalink for the current post.

Uses the_permalink filter.

Parameters

integer|array $post

Post ID or post array.

the_post()

the_post() : object

Returns

object

the_posts()

the_posts(string  $post_type = null, integer  $limit, null|integer  $offset = null, string  $status = 'all') : object

Wrapper function for get_all_posts.

Parameters

string $post_type

The post type.

integer $limit

Number of posts to show.

null|integer $offset

The offset of the first row to be returned.

string $status

Should it retrieve all statuses, published, draft, etc.?

Returns

object

the_published_date()

the_published_date(string  $format = '', integer|\TriTan\Common\Post\Post  $post = null) : string|integer|false

Retrieves TriTan CMS post published date.

Parameters

string $format

Format to use for retrieving the date the post was published. Accepts 'G', 'U', or php date format value specified in 'date_format' option. Default empty.

integer|\TriTan\Common\Post\Post $post

Post array or post id.

Returns

string|integer|false —

Formatted date string or Unix timestamp if $format is 'U' or 'G'. False on failure.

the_published_time()

the_published_time(string  $format = '', integer|\TriTan\Common\Post\Post  $post = null) : string|integer|false

Retrieves TriTan CMS post published time.

Parameters

string $format

Format to use for retrieving the time the post was published. Accepts 'G', 'U', or php date format value specified in 'time_format' option. Default empty.

integer|\TriTan\Common\Post\Post $post

Post array or post id.

Returns

string|integer|false —

Formatted date string or Unix timestamp if $format is 'U' or 'G'. False on failure.

themes_url()

themes_url(string  $path = '', string  $theme = '') : string

Retrieves a URL within a site's theme directory.

Defaults to the site's theme directory URL if no arguments are supplied.

Parameters

string $path

Optional. Extra path appended to the end of the URL, including the relative directory if $theme is supplied. Default empty.

string $theme

Optional. A full path to a file inside a theme. The URL will be relative to its directory. Default empty. Typically this is done by passing __FILE__ as the argument.

Returns

string —

Site's theme URL link with optional paths appended.

throws()

throws(string  $exp, \Closure  $cb) : boolean

Example usage:

it("should pass when the expected exception is thrown", throws("InvalidArgumentException", function () { throw new InvalidArgumentException; }));

Parameters

string $exp

Exception to check for.

\Closure $cb

Returns

boolean

time_ago()

time_ago(  $original) 

Parameters

$original

tinymce_link_list()

tinymce_link_list() : array

Returns a list of internal links for TinyMCE.

Returns

array

tritan_cms_feed_widget()

tritan_cms_feed_widget() 

TriTan CMS feed widget.

ttcms()

ttcms() 

ttcms_admin_copyright_footer()

ttcms_admin_copyright_footer() 

Prints copyright in the admin footer.

ttcms_admin_url()

ttcms_admin_url(string  $path = '', string  $scheme = 'admin') : string

Returns the url to the admin area for a given site.

Parameters

string $path

Optional. Path relative to the admin url. Default empty.

string $scheme

Optional. The scheme to use. Accepts 'http' or 'https', to force those schemes. Default 'admin'.

Returns

string —

Admin url link with optional path appended.

ttcms_authenticate()

ttcms_authenticate(string  $login, string  $password, string  $rememberme) 

Logs a user in after the login information has checked out.

Parameters

string $login

User's username or email address.

string $password

User's password.

string $rememberme

Whether to remember the user.

ttcms_authenticate_user()

ttcms_authenticate_user(string  $login, string  $password, string  $rememberme) 

Checks a user's login information.

Parameters

string $login

User's username or email address.

string $password

User's password.

string $rememberme

Whether to remember the user.

ttcms_autop()

ttcms_autop(\unknown  $pee, \number  $br = 1) : string|mixed

Parameters

\unknown $pee
\number $br

Returns

string|mixed

ttcms_between()

ttcms_between(mixed  $val, mixed  $min, mixed  $max) : boolean

Used to retrieve values within a range.

Parameters

mixed $val
mixed $min
mixed $max

Returns

boolean

ttcms_clear_auth_cookie()

ttcms_clear_auth_cookie() 

Removes all cookies associated with authentication.

ttcms_delete_post()

ttcms_delete_post(integer  $post_id) : boolean|\TriTan\Common\Post\Post

Deletes a post from the post document.

Parameters

integer $post_id

The id of the post to delete.

Returns

boolean|\TriTan\Common\Post\Post

Post on success, false otherwise.

ttcms_delete_posttype()

ttcms_delete_posttype(integer  $posttype_id) : boolean

Deletes a posttype from the posttype document.

Parameters

integer $posttype_id

The id of the posttype to delete.

Returns

boolean

ttcms_delete_site()

ttcms_delete_site(integer  $site_id, boolean  $exception = false) : boolean|\TriTan\Error

Deletes a site.

Parameters

integer $site_id

ID of site to delete.

boolean $exception

Whether to throw an exception.

Throws

\TriTan\Exception\Exception

Returns

boolean|\TriTan\Error

Returns true on delete or throw an Exception or Error if failed.

ttcms_delete_site_user()

ttcms_delete_site_user(integer  $user_id, array  $params = array(), boolean  $exception = false) : boolean|\TriTan\Exception\Exception|\TriTan\Error

Delete site user.

Parameters

integer $user_id

The id of user to be deleted.

array $params

User parameters (assign_id and role).

boolean $exception

Whether or not to throw an exception.

Returns

boolean|\TriTan\Exception\Exception|\TriTan\Error

Returns true if successful or will throw and exception or error otherwise.

ttcms_delete_user()

ttcms_delete_user(integer  $user_id, integer  $assign_id = null) : boolean

Deletes a user from the usermeta document. To delete user entirely from the system, see `ttcms_delete_site_user`.

Parameters

integer $user_id

ID of user being deleted.

integer $assign_id

ID of user to whom posts will be assigned. Default: NULL.

Returns

boolean

ttcms_dev_mode()

ttcms_dev_mode() 

Shows an error message when system is in DEV mode.

ttcms_dropdown_languages()

ttcms_dropdown_languages(string  $active = '') 

Retrieves a list of available locales.

Parameters

string $active

ttcms_editor()

ttcms_editor(string  $selector = null) 

Renders an editor.

Parameters

string $selector

HTML ID attribute value for the textarea and TinyMCE. Can only be /[a-z]+/.

ttcms_encode_email()

ttcms_encode_email(string  $string) : string

Searches for plain email addresses in given $string and encodes them (by default) with the help of ttcms_encode_email_str().

Regular expression is based on based on John Gruber's Markdown. http://daringfireball.net/projects/markdown/

Parameters

string $string

Text with email addresses to encode

Returns

string —

$string Given text with encoded email addresses

ttcms_encode_email_str()

ttcms_encode_email_str(string  $string) : string

Encodes each character of the given string as either a decimal or hexadecimal entity, in the hopes of foiling most email address harvesting bots.

Based on Michel Fortin's PHP Markdown: http://michelf.com/projects/php-markdown/ Which is based on John Gruber's original Markdown: http://daringfireball.net/projects/markdown/ Whose code is based on a filter by Matthew Wickline, posted to the BBEdit-Talk with some optimizations by Milian Wolff.

Parameters

string $string

Text with email addresses to encode

Returns

string —

$string Given text with encoded email addresses

ttcms_enqueue_css()

ttcms_enqueue_css(string  $config, string|array  $asset, boolean|string  $minify = false, string|null  $plugin_slug = null) : string

Enqueues stylesheets.

Uses default_css_pipeline, plugin_css_pipeline and theme_css_pipeline filter hooks.

Example Usage:

 ttcms_enqueue_css('default', '//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css')
 ttcms_enqueue_css('plugin', ['fontawesome','select2-css'], false, plugin_basename( dirname(__FILE__) ))
 ttcms_enqueue_css('theme', 'style.css')

Parameters

string $config

Set whether to use default config or plugin config.

string|array $asset

Relative path or URL to stylesheet(s) to enqueue.

boolean|string $minify

Enable css assets pipeline (concatenation and minification). Use a string that evaluates to true to provide the salt of the pipeline hash. Use 'auto' to automatically calculate the salt from your assets last modification time.

string|null $plugin_slug

Plugin slug to set plugin's asset location

Returns

string —

Stylesheet asset(s).

ttcms_enqueue_js()

ttcms_enqueue_js(string  $config, string|array  $asset, boolean|string  $minify = false, string|null  $plugin_slug = null) : string

Enqueues javascript.

Uses default_js_pipeline, plugin_js_pipeline and theme_js_pipeline filter hooks.

Example Usage:

 ttcms_enqueue_js('default', 'jquery-ui')
 ttcms_enqueue_js('plugin', 'select2-js', false, plugin_basename( dirname(__FILE__) ))
 ttcms_enqueue_js('theme', 'config.js')

Parameters

string $config

Set whether to use default, plugin or theme config.

string|array $asset

Relative path or URL to javascripts(s) to enqueue.

boolean|string $minify

Enable js assets pipeline (concatenation and minification). Use a string that evaluates to true to provide the salt of the pipeline hash. Use 'auto' to automatically calculate the salt from your assets last modification time.

string|null $plugin_slug

Plugin slug to set plugin's asset location.

Returns

string —

Javascript asset(s).

ttcms_error_handler()

ttcms_error_handler(  $type,   $string,   $file,   $line) 

Default Error Handler

Sets the default error handler to handle PHP errors and exceptions.

Parameters

$type
$string
$file
$line

ttcms_error_log()

ttcms_error_log(string|array  $value) 

Set Error Log for Debugging.

Parameters

string|array $value

The data to be catched.

ttcms_file_exists()

ttcms_file_exists(string  $filename, boolean  $throw = true) : boolean

Checks whether a file or directory exists.

Parameters

string $filename

Path to the file or directory.

boolean $throw

Determines whether to do a simple check or throw an exception. Default: true.

Throws

\NotFoundException

If file does not exist.

Returns

boolean —

true if the file or directory specified by $filename exists; false otherwise.

ttcms_footer()

ttcms_footer() 

Fires the ttcms_footer action via the admin.

ttcms_generate_password()

ttcms_generate_password(integer  $length = 12, boolean  $special_chars = true, boolean  $extra_special_chars = false) : string

Generates a random password drawn from the defined set of characters.

Uses random_lib library to create passwords with far less predictability.

Parameters

integer $length

Optional. The length of password to generate. Default 12.

boolean $special_chars

Optional. Whether to include standard special characters. Default true.

boolean $extra_special_chars

Optional. Whether to include other special characters. Default false.

Returns

string —

The system generated password.

ttcms_get_current_user()

ttcms_get_current_user() : object

Returns object of data for current user.

Returns

object

ttcms_get_file_data()

ttcms_get_file_data(string  $file, array  $default_headers, string  $context = '') : array

Retrieve metadata from a file.

Searches for metadata in the first 8kB of a file, such as a plugin or layout. Each piece of metadata must be on its own line. Fields can not span multiple lines, the value will get cut at the end of the first line.

If the file data is not within that first 8kB, then the author should correct their plugin file and move the data headers to the top.

Parameters

string $file

Path to the file.

array $default_headers

List of headers, in the format array('HeaderKey' => 'Header Name').

string $context

Optional. If specified adds filter hook "extra_{$context}_headers". Default empty.

Returns

array —

Array of file headers in HeaderKey => Header Value format.

ttcms_get_mu_plugins()

ttcms_get_mu_plugins() : array

Load an array of must-use plugin files

Returns

array —

Files to include

ttcms_get_site_dropins()

ttcms_get_site_dropins() : array

Load an array of dropin files per site.

Returns

array —

Files to include

ttcms_get_theme_routers()

ttcms_get_theme_routers() : array

Load an array of theme routers per site.

Returns

array —

Files to include

ttcms_head()

ttcms_head() 

Fires the ttcms_head action.

ttcms_home_url()

ttcms_home_url(string  $path = '', string|null  $scheme = null) : string

Returns the url for a given site where the front end is accessible.

The protocol will be 'https' if is_ssl() evaluates to true; If $scheme is 'http' or 'https', is_ssl() is overridden.

Parameters

string $path

Optional. Path relative to the home url. Default empty.

string|null $scheme

Optional. Scheme to give the home URL context. Accepts 'http', 'https', 'relative', or null. Default null.

Returns

string —

Home url link with optional path appended.

ttcms_insert_post()

ttcms_insert_post(array  $postdata, boolean  $exception = false) : integer|\TriTan\Exception\Exception|null

Insert or update a post.

All of the $postdata array fields have filters associated with the values. The filters have the prefix 'pre_' followed by the field name. An example using 'post_status' would have the filter called, 'pre_post_status' that can be hooked into.

Parameters

array $postdata

An array of data that is used for insert or update.

 @type string $post_title            The post's title.
 @type string $post_slug             The post's slug.
 @type string $post_author           The post's author.
 @type string $post_posttype         The post's posttype.
 @type string $post_parent           The post's parent.
 @type string $post_sidebar          The post's sidebar.
 @type string $post_show_in_menu     Whether to show post in menu.
 @type string $post_show_in_search   Whether to show post in search.
 @type string $post_relative_url     The post's relative url.
 @type string $post_featured_image   THe post's featured image.
 @type string $post_status           THe post's status.
 @type string $post_published        Timestamp describing the moment when the post
                                     was published. Defaults to Y-m-d h:i A.
boolean $exception

Whether or not to throw an exception.

Returns

integer|\TriTan\Exception\Exception|null —

The newly created post's post_id or throws an exception or returns null if the post could not be created or updated.

ttcms_insert_posttype()

ttcms_insert_posttype(array  $posttypedata,   $exception = false) : integer|\Exception|null

Insert or update a posttype.

All of the $posttypedata array fields have filters associated with the values. The filters have the prefix 'pre_' followed by the field name. An example using 'posttype_title' would have the filter called, 'pre_posttype_title' that can be hooked into.

Parameters

array $posttypedata

An array of data that is used for insert or update.

 @type string $posttype_title        The posttype's title.
 @type string $posttype_slug         The posttype's slug.
 @type string $posttype_description  The posttype's description.
$exception

Returns

integer|\Exception|null —

The newly created posttype's posttype_id, Exception or returns null if the posttype could not be created or updated.

ttcms_insert_site()

ttcms_insert_site(array|\TriTan\Common\Site\Site  $sitedata, boolean  $exception = false) : integer|\TriTan\Exception\Exception|\TriTan\Error

Insert a site into the database.

Some of the $sitedata array fields have filters associated with the values. Exceptions are 'site_owner', 'site_registered' and 'sitemodified' The filters have the prefix 'pre' followed by the field name. An example using 'site_name' would have the filter called, 'pre_site_name' that can be hooked into.

Parameters

array|\TriTan\Common\Site\Site $sitedata

{ An array or Site array of user data arguments.

@type int        $site_id            Sites's ID. If supplied, the site will be updated.
@type string     $site_domain        The site's domain.
@type string     $site_name          The site's name/title.
@type string     $site_path          The site's path.
@type int        $site_owner         The site's owner.
@type string     $site_status        The site's status.
@type string     $site_registered    Date the site registered. Format is 'Y-m-d H:i:s'.
@type string     $site_modified      Date the site's record was updated. Format is 'Y-m-d H:i:s'.

}

boolean $exception

Whether to throw and exception or error.

Returns

integer|\TriTan\Exception\Exception|\TriTan\Error

The newly created site's site_id or throws an Exception or Error if the site could not be created.

ttcms_insert_user()

ttcms_insert_user(array|object|\TriTan\Common\User\User  $userdata) : integer|\TriTan\Exception\Exception

Insert a user into the database.

Most of the $userdata array fields have filters associated with the values. Exceptions are 'user_id', 'user_url', 'user_admin_layout', 'user_admin_sidebar', 'user_admin_skin', 'user_registered' and 'usermodified'. The filters have the prefix 'pre' followed by the field name. An example using 'user_bio' would have the filter called, 'pre_user_bio' that can be hooked into.

Parameters

array|object|\TriTan\Common\User\User $userdata

{ An array, object or User object of user data arguments.

@type int        $user_id               User's ID. If supplied, the user will be updated.
@type string     $user_pass             The plain-text user password.
@type string     $user_login            The user's login username.
@type string     $user_fname            The user's first name.
@type string     $user_lname            The user's last name.
@type string     $user_bio              The user's biographical description.
@type string     $user_email            The user's email address.
@type string     $user_url              The user's url.
@type int        $user_role             The User's role.
@type string     $user_status           The user's status.
@type int        $user_admin_layout     The user's admin layout option.
@type int        $user_admin_sidebar    The user's admin sidebar option
@type string     $user_admin_skin       The user's admin skin option.
@type string     $user_registered       Date the user registered. Format is 'Y-m-d H:i:s'.
@type string     $user_modified         Date the user's account was updated. Format is 'Y-m-d H:i:s'.

}

Returns

integer|\TriTan\Exception\Exception

The newly created user's user_id or throws an exception if the user could not be created.

ttcms_is_writable()

ttcms_is_writable(string  $path) 

Alternative to PHP's native is_writable function due to a Window's bug.

Parameters

string $path

Path to check.

ttcms_list_sort()

ttcms_list_sort(array  $objects, \string/array  $orderby = array(), string  $order = 'ASC', boolean  $preserve_keys = false) : array

Sort array of objects by field.

Example Usage:

 ttcms_list_sort($post,'post_id','ASC', false);

Parameters

array $objects

Array of objects to sort.

\string/array $orderby

Name of field or array of fields to filter by.

string $order

(ASC|DESC)

boolean $preserve_keys

Whether to preserve keys.

Returns

array —

Returns a sorted array.

ttcms_load_file()

ttcms_load_file(string  $file, boolean  $once = true, boolean|\Closure  $show_errors = true) : mixed

Special function for file includes.

Parameters

string $file

File which should be included/required.

boolean $once

File should be included/required once. Default true.

boolean|\Closure $show_errors

If true error will be processed, if Closure - only Closure will be called. Default true.

Returns

mixed

ttcms_logger_activity_log_purge()

ttcms_logger_activity_log_purge() 

Purges the activity log of old records.

ttcms_logger_activity_log_write()

ttcms_logger_activity_log_write(  $action,   $process,   $record,   $uname) 

Write Activity Logs to Database.

Parameters

$action
$process
$record
$uname

ttcms_logger_error_log_purge()

ttcms_logger_error_log_purge() 

Purges the error log of old records.

ttcms_login_form_show_message()

ttcms_login_form_show_message() 

Shows error messages on login form.

ttcms_login_url()

ttcms_login_url(string  $redirect = '', string  $path = '', string|null  $scheme = 'login') : string

Returns the login url for a given site.

Parameters

string $redirect

Path to redirect to on log in.

string $path

Optional. Path relative to the login url. Default empty.

string|null $scheme

Optional. Scheme to give the home URL context. Accepts 'http', 'https', 'relative', or null. Default 'login'.

Returns

string —

Returns the login url.

ttcms_maintenance_mode()

ttcms_maintenance_mode(object  $app) : boolean|\route

Returns the maintenance mode route.

Parameters

object $app

The application object.

Returns

boolean|\route

ttcms_monolog()

ttcms_monolog(string  $name, string  $message) 

Custom error log function for better PHP logging.

Parameters

string $name

Log channel and log file prefix.

string $message

Message printed to log.

ttcms_nodeq_login_details()

ttcms_nodeq_login_details() 

Login Details Email

Function used to send login details to new user.

ttcms_normalize_path()

ttcms_normalize_path(string  $path) : string

Normalize a filesystem path.

Parameters

string $path

Path to normalize.

Returns

string —

Normalized path.

ttcms_optimized_image_upload()

ttcms_optimized_image_upload(string  $image) : string

Returns an optimized image for use.

Parameters

string $image

Original image file.

Returns

string —

Optimized image file.

ttcms_php_check_includes()

ttcms_php_check_includes(string  $filename) 

Performs a check within a php script and returns any other files that might have been required or included.

Parameters

string $filename

PHP script to check.

ttcms_php_check_syntax()

ttcms_php_check_syntax(string  $filename, boolean  $check_includes = true) : void|\TriTan\Exception\Exception

Performs a syntax and error check of a given PHP script.

Parameters

string $filename

PHP script/file to check.

boolean $check_includes

If set to true, will check if other files have been included.

Throws

\NotFoundException

If file does not exist or is not readable.

\Exception

If file contains duplicate function names.

Returns

void|\TriTan\Exception\Exception

ttcms_plugin_activate_message()

ttcms_plugin_activate_message(string  $plugin_name) 

Plugin success message when plugin is activated successfully.

Parameters

string $plugin_name

The name of the plugin that was just activated.

ttcms_plugin_deactivate_message()

ttcms_plugin_deactivate_message(string  $plugin_name) 

Plugin success message when plugin is deactivated successfully.

Parameters

string $plugin_name

The name of the plugin that was just deactivated.

ttcms_pluralize()

ttcms_pluralize(integer  $quantity, string  $singular, string  $plural = null) : string

Pluralizes a word if quantity is not one.

Example Usage:

 ttcms_pluralize(4, 'cat'); // cats
 ttcms_pluralize(3, 'kitty'); // kitties
 ttcms_pluralize(2, 'octopus', 'octopii'); // octopii
 ttcms_pluralize(1, 'mouse', 'mice'); // mouse

Parameters

integer $quantity

Number of items.

string $singular

Singular form of word.

string $plural

Plural form of word; function will attempt to deduce plural form from singular if not provided.

Returns

string —

Pluralized word if quantity is not one, otherwise singular.

ttcms_post_slug_exist()

ttcms_post_slug_exist(integer|null  $post_id, string  $slug, string  $post_type) : boolean

Checks if a slug exists among records from the post document.

Parameters

integer|null $post_id

Post id to check against or null.

string $slug

Slug to search for.

string $post_type

The post type to filter.

Returns

boolean

ttcms_post_status_label()

ttcms_post_status_label(string  $status) : string

Adds label to post's status.

Parameters

string $status

Returns

string

ttcms_posttype_slug_exist()

ttcms_posttype_slug_exist(integer  $posttype_id, string  $slug) : boolean

Checks if a slug exists among records from the posttype document.

Parameters

integer $posttype_id

Posttype id to check against.

string $slug

Slug to search for.

Returns

boolean

ttcms_release()

ttcms_release() 

Fires the ttcms_release action.

ttcms_remove_accents()

ttcms_remove_accents(string  $string) : string

Converts all accent characters to ASCII characters.

If there are no accent characters, then the string given is just returned.

Parameters

string $string

Text that might have accent characters

Returns

string —

Filtered string with replaced "nice" characters.

ttcms_sanitize_string()

ttcms_sanitize_string(string  $string, string  $fallback_string = 'deprecated', string  $context = 'save') : string

Sanitizes a string, or returns a fallback string.

Specifically, HTML and PHP tags are stripped. Further actions can be added via the plugin API. If $string is empty and $fallback_string is set, the latter will be used.

Parameters

string $string

The string to be sanitized.

string $fallback_string

Optional. A string to use if $string is empty.

string $context

Optional. The operation for which the string is sanitized

Returns

string —

The sanitized string.

ttcms_seconds_to_time()

ttcms_seconds_to_time(\numeric  $seconds) 

Converts seconds to time format.

Parameters

\numeric $seconds

ttcms_set_auth_cookie()

ttcms_set_auth_cookie(array  $user, string  $rememberme = '') 

Sets auth cookie.

Parameters

array $user

User data array.

string $rememberme

Should user be remembered for a length of time?

Throws

\TriTan\Exception\UnauthorizedException

ttcms_set_environment()

ttcms_set_environment() 

Set the system environment.

ttcms_site_slug_exist()

ttcms_site_slug_exist(integer|null  $site_id, string  $slug) : boolean

Checks if a slug exists among records from the site document.

Parameters

integer|null $site_id

Site id to check against or null.

string $slug

Slug to search for.

Returns

boolean

ttcms_site_status_label()

ttcms_site_status_label(string  $status) : string

Adds status label for site's table.

Parameters

string $status

Status to check for.

Returns

string —

Sites status.

ttcms_site_url()

ttcms_site_url(string  $path = '', string  $scheme = null) : string

Returns the url for a given site.

Returns 'https' if is_ssl() evaluates to true and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is overridden.

Parameters

string $path

Optional. Route relative to the site url. Default '/'.

string $scheme

Optional. Scheme to give the site URL context. Accepts 'http', 'https', 'login', 'admin', or 'relative'. Default null.

Returns

string —

Site url link.

ttcms_slugify()

ttcms_slugify(string  $title, string  $table = null) : string

Creates unique slug based on title

Parameters

string $title

Text to be slugified.

string $table

Table the text is saved to (i.e. post, posttype)

Returns

string

ttcms_system_backup()

ttcms_system_backup(\type  $source, \type  $destination) : mixed

Create a backup of TriTan CMS install.

Parameters

\type $source

Path/directory to zip.

\type $destination

Target for zipped file.

Returns

mixed

ttcms_unique_post_slug()

ttcms_unique_post_slug(string  $original_slug, string  $original_title, integer|null  $post_id, string  $post_type) : string

Creates a unique post slug.

Parameters

string $original_slug

Original slug of post.

string $original_title

Original title of post.

integer|null $post_id

Unique post id or null.

string $post_type

Post type of post.

Returns

string —

Unique post slug.

ttcms_unique_posttype_slug()

ttcms_unique_posttype_slug(string  $original_slug, string  $original_title, integer  $posttype_id) : string

Creates a unique posttype slug.

Parameters

string $original_slug

Original slug of posttype.

string $original_title

Original title of posttype.

integer $posttype_id

Unique posttype id.

Returns

string —

Unique posttype slug.

ttcms_unique_site_slug()

ttcms_unique_site_slug(string  $original_slug, string  $original_title, integer|null  $site_id) : string

Creates a unique site slug.

Parameters

string $original_slug

Original slug of site.

string $original_title

Original title of site.

integer|null $site_id

Unique site id or null.

Returns

string —

Unique site slug.

ttcms_update_post()

ttcms_update_post(array|object  $postdata, \bool  $exception = false) : integer|\TriTan\Exception\Exception|null

Update a post in the post document.

See \ttcms_insert_post() For what fields can be set in $postdata.

Parameters

array|object $postdata

An array of post data or a post object.

\bool $exception

Returns

integer|\TriTan\Exception\Exception|null —

The updated post's id or throw an Exception or return null if post could not be updated.

ttcms_update_posttype()

ttcms_update_posttype(array|object  $posttypedata = array(),   $exception = false) : integer|\Exception|null

Update a posttype in the post document.

See \ttcms_insert_posttype() For what fields can be set in $posttypedata.

Parameters

array|object $posttypedata

An array of posttype data or a posttype object.

$exception

Returns

integer|\Exception|null —

The updated posttype's id, Exception or return null if posttype could not be updated.

ttcms_update_site()

ttcms_update_site(integer|object|\TriTan\Common\Site\Site  $sitedata, \bool  $exception = false) : integer|\TriTan\Exception\Exception|\TriTan\Error

Update a site in the database.

See ttcms_insert_site() For what fields can be set in $sitedata.

Parameters

integer|object|\TriTan\Common\Site\Site $sitedata

An array of site data or a site object or site id.

\bool $exception

Throws

\TriTan\Exception\Exception

Returns

integer|\TriTan\Exception\Exception|\TriTan\Error

The updated site's id or throw an Exception or Error if the site could not be updated.

ttcms_update_user()

ttcms_update_user(object|\TriTan\Common\User\User  $userdata) : integer|\TriTan\Exception\Exception

Update a user in the database.

It is possible to update a user's password by specifying the 'user_pass' value in the $userdata parameter array.

See \ttcms_insert_user() For what fields can be set in $userdata.

Parameters

object|\TriTan\Common\User\User $userdata

An array of user data or a user object of type stdClass or User.

Returns

integer|\TriTan\Exception\Exception

The updated user's id or throw an Exception if the user could not be updated.

ttcms_upload_image()

ttcms_upload_image() 

Upload image button.

ttcms_user_status_label()

ttcms_user_status_label(string  $status) : string

Adds label to user's status.

Parameters

string $status

Returns

string

ttcms_validate_plugin()

ttcms_validate_plugin(string  $plugin_name) 

Validates a plugin and checks to make sure there are no syntax and/or parsing errors.

Uses activate_plugin, activate_$plugin_name, and activated_plugin actions hooks.

Parameters

string $plugin_name

Name of the plugin file (i.e. disqus.plugin.php).

ttcms_validation_check()

ttcms_validation_check(mixed  $data) 

Checks data to make sure it is a valid request.

Parameters

mixed $data

unicoder()

unicoder(string  $string) : mixed

Converts a string into unicode values.

Parameters

string $string

Returns

mixed

update_main_site()

update_main_site() : boolean

Update main site based Constants in config file.

Returns

boolean

update_meta_cache()

update_meta_cache(string  $meta_type, integer|array  $array_ids) : array|false

Update the metadata cache for the specified arrays.

Parameters

string $meta_type

Type of array metadata is for (e.g., post or user)

integer|array $array_ids

Array or comma delimited list of array IDs to update cache for

Returns

array|false —

Metadata cache for the specified arrays, or false on failure.

update_post_meta()

update_post_meta(integer  $post_id, string  $meta_key, mixed  $meta_value, mixed  $prev_value = '') : integer|boolean

Update post meta field based on post ID.

Use the $prev_value parameter to differentiate between meta fields with the same key and post ID.

If the meta field for the post does not exist, it will be added.

Parameters

integer $post_id

Post ID.

string $meta_key

Metadata key.

mixed $meta_value

Metadata value. Must be serializable if non-scalar.

mixed $prev_value

Optional. Previous value to check before removing. Default empty.

Returns

integer|boolean —

Meta ID if the key didn't exist, true on successful update, false on failure.

update_post_meta_by_mid()

update_post_meta_by_mid(integer  $mid, string  $meta_key, string  $meta_value) : boolean

Update post meta data by meta ID.

Parameters

integer $mid
string $meta_key
string $meta_value

Returns

boolean

update_post_relative_url_posttype()

update_post_relative_url_posttype(integer  $id, string  $old_slug, string  $new_slug) 

Update post's relative url if posttype slug has been updated.

Parameters

integer $id

Unique Posttype id.

string $old_slug

Old posttype slug.

string $new_slug

New posttype slug.

update_user_meta()

update_user_meta(integer  $user_id, string  $meta_key, mixed  $meta_value, mixed  $prev_value = '') : integer|boolean

Update user meta field based on user ID.

Use the $prev_value parameter to differentiate between meta fields with the same key and user ID.

If the meta field for the user does not exist, it will be added.

Parameters

integer $user_id

User ID.

string $meta_key

Metadata key.

mixed $meta_value

Metadata value.

mixed $prev_value

Optional. Previous value to check before removing.

Returns

integer|boolean —

Meta ID if the key didn't exist, true on successful update, false on failure.

update_user_meta_by_mid()

update_user_meta_by_mid(integer  $mid, string  $meta_key, mixed  $meta_value) : boolean

Update user meta data by meta ID.

Parameters

integer $mid
string $meta_key
mixed $meta_value

Returns

boolean

update_user_option()

update_user_option(integer  $user_id, string  $option_name, mixed  $newvalue, boolean  $global = false) : integer|boolean

Update user option with global site capability.

User options are just like user metadata except that they have support for global site options. If the 'global' parameter is false, which it is by default it will prepend the TriTan CMS table prefix to the option name.

Deletes the user option if $newvalue is empty.

Parameters

integer $user_id

User ID.

string $option_name

User option name.

mixed $newvalue

User option value.

boolean $global

Optional. Whether option name is global or site specific. Default false (site specific).

Returns

integer|boolean —

User meta ID if the option didn't exist, true on successful update, false on failure.

url()

url(  $route) 

Returns the url based on route.

Parameters

$route

user_perm()

user_perm(\int  $id) 

Parameters

\int $id

username_exists()

username_exists(string  $username) : string|false

Checks whether the given username exists.

Uses username_exists filter.

Parameters

string $username

Username to check.

Returns

string|false —

The user's ID on success, and false on failure.

validate_email()

validate_email(string  $email) : boolean

Validates an email address.

Uses validate_email filter.

Example Usage:

 if(validate_email('email@gmail.com')) {
     //do something;
 }

Parameters

string $email

Email address to validate.

Returns

boolean —

True if valid, false otherwise.

validate_url()

validate_url(string  $url) : boolean

Validates a url.

Example Usage:

 if(validate_url('https://google.com/')) {
     //do something;
 }

Parameters

string $url

Url to validate.

Returns

boolean —

True if valid, false otherwise.

validate_username()

validate_username(string  $username) : boolean

Checks whether the given username is valid.

Uses validate_username filter.

Example Usage:

 if(validate_username('batman')) {
     //do something;
 }

Parameters

string $username

Username to check.

Returns

boolean —

Whether given username is valid.

win_is_writable()

win_is_writable(string  $path) : true

Single file writable atribute check.

Thanks to legolas558.users.sf.net

Parameters

string $path

Returns

true

withMock()

withMock(\Closure  $cb) : boolean

Example usage:

it('should use SomeInterface to do Something', withMock(function () { $mock = Mockery::mock('SomeInterface'); $mock->shouldReceive('someMethod') ->with('someValue') ->once() ->andReturn(true);

     $sut = new SystemToTest($mock);
     $sut->test();
 }));

Parameters

\Closure $cb

Returns

boolean