pfeifferNet

pfic

Table of Contents

Namespaces

Admin
Common
Core
Public

Constants

OPTION_NAME  = 'pnet_db_version'
DB version option name.
REQUIRED_USER  = 'devmaster'
Required user name.
REQUIRED_VERSION  = '6.8.0'
Required db version.

Functions

autoloader()  : void
Dynamically load the referenced class.
get_plugin_metadata()  : string
Return a metadata value.
get_asset_version()  : string
Return the asset version.
get_asset_path()  : string
Return the fully qualified path to an asset.
get_asset_url()  : string
Return the asset URL.
get_print_url()  : string
Return the print page URL.
run_plugin()  : void
Plugin execution.
delete_post_meta()  : void
Delete post metadata added by this plugin.
delete_terms()  : void
Delete taxonomy terms added by this plugin.
delete_cpt_content()  : void
Delete the CPT content added by this plugin.
delete_options()  : void
Delete wp_options entries.
is_production()  : bool
Check if this is a production site.
is_upgrade_required()  : bool
Check if upgrade is required.
is_correct_user()  : bool
Check if the correct user is running this script.
upgrade_database()  : void
Upgrade the database.
do_upgrades()  : bool
Perform the upgrades.
set_word_count_metadata()  : bool
Set word count metadata for all posts.
delete_jetpack_artefacts()  : bool
Remove Jetpack artefacts.

Constants

OPTION_NAME

DB version option name.

public string OPTION_NAME = 'pnet_db_version'
Tags
since
6.0.0

REQUIRED_USER

Required user name.

public string REQUIRED_USER = 'devmaster'
  • If this is set, the upgrader will only run if the current user matches this name.
  • Only set this if the upgrader calls functions that have user capability checks.
Tags
since
6.8.0

REQUIRED_VERSION

Required db version.

public string REQUIRED_VERSION = '6.8.0'
  • This MUST be set to the plugin version if upgrader is to run. Leave as a value less than the current version to skip upgrade.
Tags
since
6.0.0

Functions

autoloader()

Dynamically load the referenced class.

autoloader(string $required_class) : void

This is the recommended WordPress approach, so if/else is OK.

Parameters
$required_class : string

The fully-qualified name of the class to load.

Tags
SuppressWarnings

(PHPMD.ElseExpression)

since
5.4.0
uses
get_plugin_metadata()

get_plugin_metadata()

Return a metadata value.

get_plugin_metadata(string $field) : string
Parameters
$field : string

The field to search for.

Tags
since
6.3.0
used-by
autoloader()
Return values
string

The metadata value.

get_asset_version()

Return the asset version.

get_asset_version(string $asset) : string
  • Production uses plugin version. Non-production uses resource file last modified time.
  • Use for scripts and styles.
Parameters
$asset : string

The fully qualified file path of the target asset.

Tags
since
5.10.0
Return values
string

The asset version.

get_asset_path()

Return the fully qualified path to an asset.

get_asset_path([string $asset = '' ]) : string

An empty string returns the assets folder path.

Parameters
$asset : string = ''

The partial path of the target asset. A leading slash is required.

Tags
since
6.3.0
Return values
string

The asset path.

get_asset_url()

Return the asset URL.

get_asset_url([string $asset = '' ]) : string

An empty string returns the assets folder URL.

Parameters
$asset : string = ''

The partial path of the target asset. A leading slash is required.

Tags
since
6.3.0
Return values
string

The asset URL.

get_print_url()

Return the print page URL.

get_print_url() : string
Tags
since
5.11.0
Return values
string

The print page URL.

run_plugin()

Plugin execution.

run_plugin() : void
Tags
since
1.0.0

delete_post_meta()

Delete post metadata added by this plugin.

delete_post_meta() : void
Tags
since
6.1.0

delete_terms()

Delete taxonomy terms added by this plugin.

delete_terms() : void
  • SQL manipulation of the tables is used because the taxonomies are not registered when uninstall is called.
  • Most WordPress core taxonomy functions will NOT work.
Tags
since
6.1.0

delete_cpt_content()

Delete the CPT content added by this plugin.

delete_cpt_content() : void
Tags
todo

#75 Determine CPT content deletion strategy on uninstall.

since
6.1.0

delete_options()

Delete wp_options entries.

delete_options() : void
Tags
since
6.1.0

is_production()

Check if this is a production site.

is_production() : bool
Tags
since
6.2.0
Return values
bool

True if this is a production site, false otherwise.

is_upgrade_required()

Check if upgrade is required.

is_upgrade_required() : bool
Tags
since
6.0.0
Return values
bool

True If stored version is less than the required version, false otherwise.

is_correct_user()

Check if the correct user is running this script.

is_correct_user() : bool
  • If REQUIRED_USER is set, the upgrader will only run if the current user matches this name.
Tags
since
6.8.0
Return values
bool

True if the current user matches the required user, false otherwise.

upgrade_database()

Upgrade the database.

upgrade_database() : void
  • Abort if this is a production site.
  • Abort if upgrade is not needed.
  • If REQUIRED_USER is set, the upgrader will only run if the current user matches this name.
  • Delete this file after successful upgrade.
Tags
since
6.0.0
since
6.2.0

Abort if this is a production site.

since
6.8.0

Check if the correct user is running this script.

since
6.8.0

Delete the script after successful upgrade.

do_upgrades()

Perform the upgrades.

do_upgrades() : bool
  • Call functions from here to perform the actual database upgrades.
  • Bail if any function fails.
Tags
since
6.0.0
since
6.2.0

Update chapter term slugs to remove sequence prefix.

since
6.3.0

Add GitHub API token date.

since
6.5.0

Update chapter taxonomy meta data to include has-recipes setting.

since
6.6.0

Update the autoincrement value for the user table.

since
6.7.0

Add related posts to post meta table and define the number of them to display.

since
6.7.0

Add cron jobs to update selected content and transients.

since
6.8.0

Add word count metadata bulk update.

since
6.8.0

Remove Jetpack artefacts.

Return values
bool

True if upgrade was successful, false otherwise.

set_word_count_metadata()

Set word count metadata for all posts.

set_word_count_metadata() : bool
Tags
since
6.8.0
Return values
bool

True if successful, false otherwise.

delete_jetpack_artefacts()

Remove Jetpack artefacts.

delete_jetpack_artefacts() : bool
  • Remove Jetpack comment metadata.
  • Remove Jetpack post metadata.
Tags
since
6.8.0
Return values
bool

True if successful, false otherwise.


        
On this page

Search results