Properties

$_instance

$_instance : object

Plugin singleton

Type

object

$_version

$_version : string

Plugin version

Type

string

$_file

$_file : string

Plugin's file path

Type

string

$_dir

$_dir : string

Plugin directory

Type

string

$_assets_url

$_assets_url : string

Plugin assets web path

Type

string

$_assets_dir

$_assets_dir : string

Plugin assets file path

Type

string

$_languages_dir

$_languages_dir : string

Plugin languages path

Type

string

$_className

$_className

Methods

get_instance()

get_instance( $file,  $version) : \plugin

Gets a singleton of this plugin

Retrieves or creates the plugin singleton.

Parameters

$file
$version

Returns

\plugin —

singleton

install_database()

install_database() : void

Creates the database table that contains the redact rules and patterns.

getRedactedContent()

getRedactedContent( $strContent) : array

Accepts a string to have content redacted. Queries the database for matching redactions and returns a multidimensional array of content, redacted content, pattern, and permissions. Each row in the array was a matching redaction rule in the database.

Parameters

$strContent

Returns

array —

$arrMatches The matches array for filtering content.

__construct()

__construct( $file,  $version) : void

Create and initializes the plugin

The plugin is a singleton so the constructor remains private

Parameters

$file
$version

is_script_debug()

is_script_debug() : boolean

Helper function on whether SCRIPT_DEBUG is set

Returns whether or not SCRIPT_DEBUG is set or not

Returns

boolean

_createURLs()

_createURLs( $file) : void

Create and initializes paths for the plugin

Stores all of the paths that the plugin will use to access the world

Parameters

$file

__clone()

__clone() : void

Not allowed

The plugin is a singleton so don't allow cloning.

_getMatchingStringsAndPermissions()

_getMatchingStringsAndPermissions(array $dbMatchingRows, string $strContent) : array

Translates the raw rows of the database and string content into a redaction array of matching text and the permissions around the redaction. The array is in the form of array(matches[], permissions, redacted[], pattern) foreach matching row of the database.

Parameters

array $dbMatchingRows

Raw rows from the database

string $strContent

String content to match against.

Returns

array —

$arrResults An array of results in the form of array(matches[], permissions[] , redacted[]) foreach matching row of the database.

_getMatchingRedactsFromDatabase()

_getMatchingRedactsFromDatabase(string $strContent) : array

Queries the database for matching redactions and returns the raw row object array.

Parameters

string $strContent

Returns

array —

$rows Raw records of matching redactions.

_convertToRedactStrings()

_convertToRedactStrings(array $arrMatches) : array

Accepts an array of strings and translates them into what should be used as the redacted text. This returns redacted versions of the content no matter what the permissions are.

Parameters

array $arrMatches

The array of strings that are content that matches redacted text.

Returns

array —

$arrRedacted The array of strings translated into what should be used as redacted text.