Menu

## Object_Sync_Sf_Logging extends WP_Logging
in package

class-object-sync-sf-logging.php : 14

Object_Sync_Sf_Logging class.

### Table of Contents

$capability : string
  The name of the capability used when registering the logging post type.
$debug : bool
  Whether the plugin is in debug mode
$enabled : bool
  The setting value for whether logging is enabled
$file : string
  The main plugin file
$option_prefix : string
  The plugin's prefix when saving options to the database
$schedule_name : string
  The name of the schedule to prune logs
$slug : string
  The plugin's slug so we can include it when necessary
$statuses_to_log : array<string|int, mixed>
  Which statuses to log, from the settings value
$version : string
  Current version of the plugin
$wpdb : object
  Global object of `$wpdb`, the WordPress database
__construct() : mixed
  Constructor for logging class
add() : int
  Create new log entry
add_prune_interval() : array<string|int, mixed>
  Add interval to wp schedules based on admin settings
check_log_schedule() : mixed
  When the cron settings change, clear the relevant schedule
get_connected_logs() : array<string|int, mixed>
  Retrieve all connected logs
get_log_count() : int
  Retrieves number of log entries connected to particular object ID
get_logs() : array<string|int, mixed>
  Easily retrieves log items for a particular object ID
get_schedule_frequency() : array<string|int, mixed>
  Convert the schedule frequency from the admin settings into an array interval must be in seconds for the class to use it
init() : mixed
  Initialize. This creates a schedule for pruning logs, and also the custom content type
posts_filter() : mixed
  Filter log posts by the taxonomy from the dropdown when a value is present
restrict_logs_by_type() : mixed
  Add a filter form for the log admin so we can filter by wp_log_type taxonomy values
save_log_schedule() : mixed
  Save a cron schedule
set_log_slug() : string
  Create a (probably unique) post name for logs in a more performant manner than wp_unique_post_slug().
set_log_types() : array<string|int, mixed>
  Set terms for Salesforce logs
set_log_visibility() : array<string|int, mixed>
  Set visibility for the post type
set_prune_age() : string
  Set how often to prune the Salesforce logs
set_prune_args() : array<string|int, mixed>
  Set arguments for only getting the Salesforce logs
set_prune_option() : string
  Should logs be pruned at all?
setup() : void
  Setup new log entry
sortable_columns() : array<string|int, mixed>
  Make the Type column in the posts admin for this post type sortable
type_column() : array<string|int, mixed>
  Add a Type column to the posts admin for this post type
type_column_content() : mixed
  Add the content for the Type column in the posts admin for this post type
configure_debugging() : mixed
  Configure log settings based on debug status.

### Properties

#### $capability

class-object-sync-sf-logging.php : 84

The name of the capability used when registering the logging post type.

`public string $capability`

#### $debug

class-object-sync-sf-logging.php : 77

Whether the plugin is in debug mode

`public bool $debug`

#### $enabled

class-object-sync-sf-logging.php : 56

The setting value for whether logging is enabled

`public bool $enabled`

#### $file

class-object-sync-sf-logging.php : 28

The main plugin file

`public string $file`

#### $option_prefix

class-object-sync-sf-logging.php : 49

The plugin's prefix when saving options to the database

`public string $option_prefix`

#### $schedule_name

class-object-sync-sf-logging.php : 70

The name of the schedule to prune logs

`public string $schedule_name`

#### $slug

class-object-sync-sf-logging.php : 42

The plugin's slug so we can include it when necessary

`public string $slug`

#### $statuses_to_log

class-object-sync-sf-logging.php : 63

Which statuses to log, from the settings value

`public array<string|int, mixed> $statuses_to_log`

#### $version

class-object-sync-sf-logging.php : 21

Current version of the plugin

`public string $version`

#### $wpdb

class-object-sync-sf-logging.php : 35

Global object of `$wpdb`, the WordPress database

`public object $wpdb`

### Methods

#### __construct()

class-object-sync-sf-logging.php : 89

Constructor for logging class

`public __construct() : mixed`

##### Return values

mixed —

#### add()

class-object-sync-sf-logging.php : 555

Create new log entry

`public static add([string $title = '' ][, string $message = '' ], int $parent[, string $type = 'salesforce' ]) : int`

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

##### Parameters

$title : string = ''

  A log post title.

$message : string = ''

  The log message.

$parent : int

  The parent WordPress object.

$type : string = 'salesforce'

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

##### Tags

access

  public

since
  1.0
uses
  self::insert_log()

##### Return values

int —

The ID of the new log entry

#### add_prune_interval()

class-object-sync-sf-logging.php : 390

Add interval to wp schedules based on admin settings

`public add_prune_interval(array<string|int, mixed> $schedules) : array<string|int, mixed>`

##### Parameters

$schedules : array<string|int, mixed>

  An array of scheduled cron items.

##### Return values

array<string|int, mixed> —

$frequency

#### check_log_schedule()

class-object-sync-sf-logging.php : 334

When the cron settings change, clear the relevant schedule

`public check_log_schedule(string $old_value, string $new_value, string $option) : mixed`

##### Parameters

$old_value : string

  Previous option value.

$new_value : string

  New option value.

$option : string

  Name of option.

##### Return values

mixed —

#### get_connected_logs()

class-object-sync-sf-logging.php : 611

Retrieve all connected logs

`public static get_connected_logs([array<string|int, mixed> $args = array() ]) : array<string|int, mixed>`

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

##### Parameters

$args : array<string|int, mixed> = array()

  An array of arguments for get_posts().

##### Tags

access

  private

since
  1.0
uses
  wp_parse_args()
uses
  get_posts()
uses
  get_query_var()
uses
  self::valid_type()

##### Return values

array<string|int, mixed> —

/ false

#### get_log_count()

class-object-sync-sf-logging.php : 663

Retrieves number of log entries connected to particular object ID

`public static get_log_count(int $object_id[, string $type = 'salesforce' ][, array<string|int, mixed> $meta_query = null ]) : int`

##### Parameters

$object_id : int

  A WordPress object ID.

$type : string = 'salesforce'

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

$meta_query : array<string|int, mixed> = null

  A WordPress meta query, parseable by WP_Meta_Query.

##### Tags

access

  private

since
  1.0
uses
  WP_Query()
uses
  self::valid_type()

##### Return values

int —

#### get_logs()

class-object-sync-sf-logging.php : 583

Easily retrieves log items for a particular object ID

`public static get_logs(int $object_id[, string $type = 'salesforce' ][, int $paged = null ]) : array<string|int, mixed>`

##### Parameters

$object_id : int

  A WordPress object ID.

$type : string = 'salesforce'

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

$paged : int = null

  show which page of results we want.

##### Tags

access

  private

since
  1.0
uses
  self::get_connected_logs()

##### Return values

array<string|int, mixed> —

#### get_schedule_frequency()

class-object-sync-sf-logging.php : 415

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

`public get_schedule_frequency(string $unit, string $number) : array<string|int, mixed>`

##### Parameters

$unit : string

  A unit of time.

$number : string

  The number of those units.

##### Return values

array<string|int, mixed> —

#### init()

class-object-sync-sf-logging.php : 114

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

`public init() : mixed`

##### Return values

mixed —

#### posts_filter()

class-object-sync-sf-logging.php : 267

Filter log posts by the taxonomy from the dropdown when a value is present

`public posts_filter(object $query) : mixed`

##### Parameters

$query : object

  the current WP query for the list table.

##### Return values

mixed —

#### restrict_logs_by_type()

class-object-sync-sf-logging.php : 292

Add a filter form for the log admin so we can filter by wp_log_type taxonomy values

`public restrict_logs_by_type(string $post_type) : mixed`

##### Parameters

$post_type : string

  what type of log we want to show.

##### Return values

mixed —

#### save_log_schedule()

class-object-sync-sf-logging.php : 370

Save a cron schedule

`public save_log_schedule() : mixed`

##### Return values

mixed —

#### set_log_slug()

class-object-sync-sf-logging.php : 210

Create a (probably unique) post name for logs in a more performant manner than wp_unique_post_slug().

`public set_log_slug(string $override_slug, string $slug, int $post_ID, string $post_status, string $post_type) : string`

##### Parameters

$override_slug : string

  Short-circuit return value.

$slug : string

  The desired slug (post_name).

$post_ID : int

  The post ID.

$post_status : string

  The post status.

$post_type : string

  The post type.

##### Return values

string —

#### set_log_types()

class-object-sync-sf-logging.php : 446

Set terms for Salesforce logs

`public set_log_types(array<string|int, mixed> $terms) : array<string|int, mixed>`

##### Parameters

$terms : array<string|int, mixed>

  An array of string log types in the WP_Logging class.

##### Return values

array<string|int, mixed> —

$terms

#### set_log_visibility()

class-object-sync-sf-logging.php : 176

Set visibility for the post type

`public set_log_visibility(array<string|int, mixed> $log_args) : array<string|int, mixed>`

##### Parameters

$log_args : array<string|int, mixed>

  The post arguments.

##### Return values

array<string|int, mixed> —

$log_args

#### set_prune_age()

class-object-sync-sf-logging.php : 469

Set how often to prune the Salesforce logs

`public set_prune_age(string $how_old) : string`

##### Parameters

$how_old : string

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

##### Return values

string —

$how_old

#### set_prune_args()

class-object-sync-sf-logging.php : 484

Set arguments for only getting the Salesforce logs

`public set_prune_args(array<string|int, mixed> $args) : array<string|int, mixed>`

##### Parameters

$args : array<string|int, mixed>

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

##### Return values

array<string|int, mixed> —

$args

#### set_prune_option()

class-object-sync-sf-logging.php : 457

Should logs be pruned at all?

`public set_prune_option(string $should_we_prune) : string`

##### Parameters

$should_we_prune : string

  Whether to prune old log items.

##### Return values

string —

$should_we_prune Whether to prune old log items.

#### setup()

class-object-sync-sf-logging.php : 512

Setup new log entry

`public setup(string|array<string|int, mixed> $title_or_params[, string $message = '' ], mixed $trigger, int $parent[, string $status = '' ]) : void`

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

##### Parameters

$title_or_params : string|array<string|int, mixed>

  A log post title, or the full array of parameters.

$message : string = ''

  The log message.

$trigger : mixed
$parent : int

  The parent WordPress object.

$status : string = ''

  The log status.

##### Tags

access

  public

since
  1.0
uses
  self::add()
see
  Object_Sync_Sf_Mapping::__construct()

  the location of the parameters that define the logging triggers.

##### Return values

void —

#### sortable_columns()

class-object-sync-sf-logging.php : 234

Make the Type column in the posts admin for this post type sortable

`public sortable_columns(array<string|int, mixed> $columns) : array<string|int, mixed>`

##### Parameters

$columns : array<string|int, mixed>

  the sortable columns for the post list table.

##### Return values

array<string|int, mixed> —

$columns

#### type_column()

class-object-sync-sf-logging.php : 223

Add a Type column to the posts admin for this post type

`public type_column(array<string|int, mixed> $columns) : array<string|int, mixed>`

##### Parameters

$columns : array<string|int, mixed>

  the columns for the post list table.

##### Return values

array<string|int, mixed> —

$columns

#### type_column_content()

class-object-sync-sf-logging.php : 245

Add the content for the Type column in the posts admin for this post type

`public type_column_content(string $column_name, int $post_id) : mixed`

##### Parameters

$column_name : string

  the value for the type column on the list table.

$post_id : int

  the ID of the currently listed post in the table.

##### Return values

mixed —

#### configure_debugging()

class-object-sync-sf-logging.php : 151

Configure log settings based on debug status.

`private configure_debugging() : mixed`

##### Return values

mixed —

## Search results