Properties

$enabled

$enabled : 

Type

$statuses_to_log

$statuses_to_log : 

Type

$wpdb

$wpdb : 

Type

$version

$version : 

Type

$slug

$slug : 

Type

$option_prefix

$option_prefix : 

Type

Methods

__construct()

__construct(object  $wpdb, string  $version, string  $slug = '', string  $option_prefix = '') 

Constructor which sets content type and pruning for logs

Parameters

object $wpdb

An instance of the wpdb class.

string $version

The version of this plugin.

string $slug

The plugin slug

string $option_prefix

The plugin's option prefix

Throws

\Exception

set_log_visibility()

set_log_visibility(  $log_args) 

Parameters

$log_args
Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293

add_prune_interval()

add_prune_interval(array  $schedules) : array

Add interval to wp schedules based on admin settings

Parameters

array $schedules

An array of scheduled cron items.

Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293

Returns

array —

$frequency

get_schedule_frequency()

get_schedule_frequency(string  $unit, \number  $number) : array

Convert the schedule frequency from the admin settings into an array interval must be in seconds for the class to use it

Parameters

string $unit

A unit of time.

\number $number

The number of those units.

Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293

Returns

array

set_log_types()

set_log_types(array  $terms) : array

Set terms for Salesforce logs

Parameters

array $terms

An array of string log types in the WP_Logging class.

Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293

Returns

array —

$terms

set_prune_option()

set_prune_option(string  $should_we_prune) : string

Should logs be pruned at all?

Parameters

string $should_we_prune

Whether to prune old log items.

Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293

Returns

string —

$should_we_prune Whether to prune old log items.

set_prune_age()

set_prune_age(string  $how_old) : string

Set how often to prune the Salesforce logs

Parameters

string $how_old

How old the oldest non-pruned log items should be allowed to be.

Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293

Returns

string —

$how_old

set_prune_args()

set_prune_args(array  $args) : array

Set arguments for only getting the Salesforce logs

Parameters

array $args

Argument array for get_posts determining what posts are eligible for pruning.

Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293

Returns

array —

$args

setup()

setup(string|array  $title_or_params, string  $message = '', string  $trigger, integer  $parent, string  $status = '') : void

Setup new log entry

Check and see if we should log anything, and if so, send it to add()

Parameters

string|array $title_or_params

A log post title, or the full array of parameters

string $message

The log message.

string $trigger

The type of log triggered. Usually one of: debug, notice, warning, error.

integer $parent

The parent WordPress object.

string $status

The log status.

Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293

add()

add(string  $title = '', string  $message = '', integer  $parent, string  $type = 'salesforce') : integer

Create new log entry

This is just a simple and fast way to log something. Use self::insert_log() if you need to store custom meta data

Parameters

string $title

A log post title.

string $message

The log message.

integer $parent

The parent WordPress object.

string $type

The type of log message; defaults to 'salesforce'.

Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293

Returns

integer —

The ID of the new log entry

get_logs()

get_logs(integer  $object_id, string  $type = 'salesforce', integer  $paged = null) : array

Easily retrieves log items for a particular object ID

Parameters

integer $object_id

A WordPress object ID.

string $type

The type of log item; defaults to 'salesforce' because that's the type of logs we create.

integer $paged

Which page of results do we want?

Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293

Returns

array

get_connected_logs()

get_connected_logs(Array  $args = array()) : array

Retrieve all connected logs

Used for retrieving logs related to particular items, such as a specific purchase.

Parameters

Array $args

An array of arguments for get_posts().

Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293

Returns

array —

/ false

get_log_count()

get_log_count(integer  $object_id, string  $type = 'salesforce', Array  $meta_query = null) : integer

Retrieves number of log entries connected to particular object ID

Parameters

integer $object_id

A WordPress object ID.

string $type

The type of log item; defaults to 'salesforce' because that's the type of logs we create.

Array $meta_query

A WordPress meta query, parseable by WP_Meta_Query.

Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/jstegall/Sites/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293

Returns

integer

init()

init() 

Start. This creates a schedule for pruning logs, and also the custom content type

Throws

\Exception