Documentation
Documentation
graphic_data_plugin.php
The plugin bootstrap file
This file is read by WordPress to generate the plugin information in the plugin admin area. This file also includes all of the dependencies used by the plugin, registers the activation and deactivation functions, and defines a function that starts the plugin.
Tags
Table of Contents
Constants
- GRAPHIC_DATA_DATA_DIR = \WP_CONTENT_DIR . '/data'
- The data directory inside of wp-content
- GRAPHIC_DATA_DATA_URL = \content_url('data')
- GRAPHIC_DATA_PLUGIN_DIR = \plugin_dir_path(__FILE__)
- The directory path of the plugin.
- GRAPHIC_DATA_PLUGIN_VERSION = $graphic_data_plugin_data['Version']
Functions
- graphic_data_activate() : mixed
- Plugin activation callback.
- graphic_data_ensure_public_data_dir() : void
- Ensure the public data directory exists with correct permissions.
- graphic_data_plugin_run() : mixed
- Begins execution of the plugin.
Constants
GRAPHIC_DATA_DATA_DIR
The data directory inside of wp-content
public
mixed
GRAPHIC_DATA_DATA_DIR
= \WP_CONTENT_DIR . '/data'
GRAPHIC_DATA_DATA_URL
public
mixed
GRAPHIC_DATA_DATA_URL
= \content_url('data')
GRAPHIC_DATA_PLUGIN_DIR
The directory path of the plugin.
public
mixed
GRAPHIC_DATA_PLUGIN_DIR
= \plugin_dir_path(__FILE__)
GRAPHIC_DATA_PLUGIN_VERSION
public
mixed
GRAPHIC_DATA_PLUGIN_VERSION
= $graphic_data_plugin_data['Version']
Functions
graphic_data_activate()
Plugin activation callback.
graphic_data_activate() : mixed
Ensures the public data directory exists when the plugin is activated.
Tags
graphic_data_ensure_public_data_dir()
Ensure the public data directory exists with correct permissions.
graphic_data_ensure_public_data_dir() : void
Creates GRAPHIC_DATA_DATA_DIR if it does not already exist, sets directory permissions to 0755, and drops an index.php guard file to prevent directory browsing while still allowing direct file access.
On failure the error is persisted to the 'graphic_data_data_dir_error' option so it can be surfaced via admin notices; on success that option is deleted.
Tags
graphic_data_plugin_run()
Begins execution of the plugin.
graphic_data_plugin_run() : mixed
Since everything within the plugin is registered via hooks, then kicking off the plugin from this point in the file does not affect the page life cycle.