Documentation

Documentation

Table of Contents

Packages

Graphic
Application

Classes

Graphic_Data_Admin
The admin-specific functionality of the plugin.
Graphic_Data_Create_SVG
Register class that defines Create SVG functions
Graphic_Data_Deactivation_Cleanup
Asks, on deactivation, whether all Graphic Data plugin data should be permanently deleted if the plugin is later deleted, and performs that wipe from uninstall.php if the answer was yes.
Graphic_Data_Export_Figures
Class Graphic_Data_Export_Figures
Graphic_Data_GitHub_Updater
GitHub Updater - Optimized Version
Graphic_Data_Site_Checker
Class Graphic_Data_Site_Checker.
Graphic_Data_Support
The code for creating the "Graphic Data Support" menu item and page in the plugin.
Graphic_Data_SVG_Validator
Enhanced SVG validation for WordPress plugin
Graphic_Data_Login
Register class that has the functions used to modify the login WordPress scene
Graphic_Data_Media_Manager
Manages custom attachment fields in the WordPress Media Library.
Graphic_Data_Custom_Capabilities
Manages custom user capabilities for the Graphic Data Plugin.
Graphic_Data_Page_Options
Adds a required "Instance" section to the Page options of the Gutenberg page editor.
Graphic_Data_Search
Class Graphic_Data_Search
Graphic_Data_Utility
Utility functions used across the plugin
Graphic_Data_Validation
Handles validation of custom post type fields before saving.
Graphic_Data_About
Register class that defines the About custom content post type as well as associated functions.
Graphic_Data_Figure
Handles the Figure custom post type for the Graphic Data plugin.
Graphic_Data_Instance_Type
Register class that defines the Instance Type functions
Graphic_Data_Instance
Registers the Instance custom post type and manages its admin interface.
Graphic_Data_Loader
Register all actions and filters for the plugin.
Graphic_Data_Modal
Manages the Modal custom post type and its admin interface.
Graphic_Data_Plugin_Only_Content
Class Graphic_Data_Plugin_Only_Content
Graphic_Data_Scene
Manages the Scene custom post type and its admin interface.
Graphic_Data_Settings_Page
Handles the admin settings page for the Graphic Data plugin.
Graphic_Data_Tutorial_Content
Class Graphic_Data_Tutorial_Content
Graphic_Data_Tutorial_Figure_Preview
Class Graphic_Data_Tutorial_Figure_Preview
Graphic_Data_Plugin
The core plugin class.

Constants

GRAPHIC_DATA_DATA_DIR  : mixed = \WP_CONTENT_DIR . '/data'
The data directory inside of wp-content
GRAPHIC_DATA_DATA_DIR  : mixed = \WP_CONTENT_DIR . '/data'
GRAPHIC_DATA_DATA_URL  : mixed = \content_url('data')
GRAPHIC_DATA_IS_ACTIVE_THEME  : mixed = \get_template() === 'graphic_data_theme'
Determine whether the Graphic Data Theme is the active theme.
GRAPHIC_DATA_PLUGIN_DIR  : mixed = \plugin_dir_path(__FILE__)
The directory path of the plugin.
GRAPHIC_DATA_PLUGIN_VERSION  : mixed = $graphic_data_plugin_data['Version']

Functions

graphic_data_activate()  : mixed
Plugin activation callback.
graphic_data_deactivate()  : mixed
Plugin deactivation callback.
graphic_data_ensure_public_data_dir()  : void
Ensure the public data directory exists with correct permissions.
graphic_data_register_blocks()  : mixed
Register the blocks in the plugin.
graphic_data_register_figure_block_meta()  : mixed
Register the figure fields for posts.
graphic_data_register_figure_block_routes()  : void
Registers REST API routes for the figure block.
graphic_data_get_figure_block_meta()  : WP_REST_Response|WP_Error
Retrieves figure block meta fields for a given post via the REST API.
graphic_data_plugin_run()  : mixed
Begins execution of the plugin.
graphic_data_add_figure_shortlink_rewrite()  : array<string|int, mixed>
Force figure shortlinks to the beginning of WordPress rewrite rules.
graphic_data_add_figure_query_var()  : array<string|int, mixed>
Register the custom figure shortlink query variable.
graphic_data_redirect_figure_shortlink()  : void
Redirect a figure shortlink to its actual location.

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_DIR

public mixed GRAPHIC_DATA_DATA_DIR = \WP_CONTENT_DIR . '/data'

GRAPHIC_DATA_IS_ACTIVE_THEME

Determine whether the Graphic Data Theme is the active theme.

public mixed GRAPHIC_DATA_IS_ACTIVE_THEME = \get_template() === 'graphic_data_theme'

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. Creates figure, modal, and scene publishing capabilities for the Author role.

Tags
see
graphic_data_ensure_public_data_dir()

graphic_data_deactivate()

Plugin deactivation callback.

graphic_data_deactivate() : mixed

Removes figure, modal, and scene publishing capabilities from the Author role that were granted on activation.

Tags
see
graphic_data_activate()

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
since
1.0.0

graphic_data_register_figure_block_routes()

Registers REST API routes for the figure block.

graphic_data_register_figure_block_routes() : void

Registers a route at graphic-data/v1/figure/<id> supporting:

Both endpoints require the current user to have edit_post capability for the requested post ID.

Hooked to rest_api_init.

graphic_data_get_figure_block_meta()

Retrieves figure block meta fields for a given post via the REST API.

graphic_data_get_figure_block_meta(WP_REST_Request $request) : WP_REST_Response|WP_Error

Handles GET requests to graphic-data/v1/figure/<id>. Returns a flat object of all figure-related post meta, including fields from the figure_science_info and figure_data_info Exopite fieldsets which are unpacked into top-level keys for easier consumption by React.

Parameters
$request : WP_REST_Request

The REST request. Must contain a numeric id param matching a post of type figure.

Return values
WP_REST_Response|WP_Error

Response containing figure meta on success, or a 400 WP_Error if the post is not of type figure.

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.

Force figure shortlinks to the beginning of WordPress rewrite rules.

graphic_data_add_figure_shortlink_rewrite(array<string|int, mixed> $rules) : array<string|int, mixed>

This prevents the generic:

([^/]+)/([^/]+)/?$

rule from capturing:

/f/127/

before the figure shortlink rule can process it.

Parameters
$rules : array<string|int, mixed>

Existing WordPress rewrite rules.

Return values
array<string|int, mixed>

graphic_data_add_figure_query_var()

Register the custom figure shortlink query variable.

graphic_data_add_figure_query_var(array<string|int, mixed> $vars) : array<string|int, mixed>
Parameters
$vars : array<string|int, mixed>

Existing WordPress query variables.

Return values
array<string|int, mixed>

Redirect a figure shortlink to its actual location.

graphic_data_redirect_figure_shortlink() : void

Search results