Documentation
Documentation
API Documentation
Table of Contents
Classes
- Graphic_Data_Admin
- The admin-specific functionality of the plugin.
- Graphic_Data_Content_Transfer
- Class Graphic_Data_Content_Transfer.
- 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_Figure_Html_Rebuild
- Class Graphic_Data_Figure_Html_Rebuild.
- 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_Revisions
- Class Graphic_Data_Revisions.
- Graphic_Data_Search
- Class Graphic_Data_Search
- Graphic_Data_Transfer_Exporter
- Class Graphic_Data_Transfer_Exporter.
- Graphic_Data_Transfer_Importer
- Class Graphic_Data_Transfer_Importer.
- Graphic_Data_Transfer_Schema
- Class Graphic_Data_Transfer_Schema.
- Graphic_Data_Transfer_Tsv_Exporter
- Class Graphic_Data_Transfer_Tsv_Exporter.
- Graphic_Data_Transfer_Tsv
- Class Graphic_Data_Transfer_Tsv.
- Graphic_Data_Transfer_Validator
- Class Graphic_Data_Transfer_Validator.
- 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_hide_list_archive_link() : void
- Hide the archive toolbar link only on Graphic Data post list screens.
- graphic_data_admin_bar_preview() : void
- Launch the existing live preview from the post editor's toolbar.
- graphic_data_figure_edit_link_config() : void
- Expose the permission lookup only on signed-in frontend pages.
- graphic_data_modal_edit_link() : void
- Use the same access checks for modal edit links.
- graphic_data_figure_edit_link() : void
- Set the figure type explicitly rather than accepting AJAX hook arguments.
- graphic_data_send_post_edit_link() : void
- Return an edit URL only when both capabilities and instance access allow it.
- 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.
- graphic_data_delete_figure_folder() : mixed
- graphic_data_add_modal_shortlink_rewrite() : array<string, string>
- Keep modal shortlinks ahead of generic instance/scene rules.
- graphic_data_add_modal_query_var() : array<string|int, string>
- Register the modal shortlink query variable.
- graphic_data_parse_modal_shortlink() : void
- Support existing installations before their next rewrite-rule refresh.
- graphic_data_get_modal_shortlink_destination() : string
- Resolve a publicly available modal and its parent scene.
- graphic_data_redirect_modal_shortlink() : void
- Redirect before WordPress attempts to canonicalize the shortlink.
- graphic_data_admin_bar_content_shortlink() : void
- Point the editor toolbar's View action at the frontend scene.
- graphic_data_sanitize_page_title_align() : mixed
- Validate alignment without allowing arbitrary CSS.
- graphic_data_sanitize_page_title_padding() : mixed
- Empty means theme default; otherwise accept whole pixels from 0 to 200.
- graphic_data_register_page_title_meta() : mixed
- Register REST metadata so settings participate in the normal editor save.
- graphic_data_enqueue_page_title_editor() : mixed
- Native WordPress components; this script does not need a build step.
- graphic_data_page_title_declarations() : mixed
- Build only explicitly selected overrides; empty values preserve theme CSS.
- graphic_data_enqueue_page_title_style() : mixed
- Target only the main Page title, never navigation, scenes, or modal titles.
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_DATA_URL
public
mixed
GRAPHIC_DATA_DATA_URL
= \content_url('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
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
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_register_blocks()
Register the blocks in the plugin.
graphic_data_register_blocks() : mixed
Ensures the public data directory exists when the plugin is activated.
Tags
graphic_data_register_figure_block_meta()
Register the figure fields for posts.
graphic_data_register_figure_block_meta() : mixed
Ensures the public data directory exists when the plugin is activated.
Tags
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:
- GET: retrieves figure block meta via graphic_data_get_figure_block_meta()
- POST/PUT/PATCH: saves figure block meta via graphic_data_save_figure_block_meta()
GET allows public access to publicly viewable figures marked as published.
Editors may also read drafts. Saving requires edit_post capability.
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
idparam matching a post of typefigure.
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.
graphic_data_hide_list_archive_link()
Hide the archive toolbar link only on Graphic Data post list screens.
graphic_data_hide_list_archive_link(WP_Admin_Bar $admin_bar) : void
Parameters
- $admin_bar : WP_Admin_Bar
-
The admin bar instance.
graphic_data_admin_bar_preview()
Launch the existing live preview from the post editor's toolbar.
graphic_data_admin_bar_preview(WP_Admin_Bar $admin_bar) : void
Parameters
- $admin_bar : WP_Admin_Bar
-
The admin bar instance.
graphic_data_figure_edit_link_config()
Expose the permission lookup only on signed-in frontend pages.
graphic_data_figure_edit_link_config() : void
graphic_data_modal_edit_link()
Use the same access checks for modal edit links.
graphic_data_modal_edit_link() : void
graphic_data_figure_edit_link()
Set the figure type explicitly rather than accepting AJAX hook arguments.
graphic_data_figure_edit_link() : void
graphic_data_send_post_edit_link()
Return an edit URL only when both capabilities and instance access allow it.
graphic_data_send_post_edit_link(string $post_type) : void
Parameters
- $post_type : string
-
The post type the requested post must have ('figure' or 'modal').
graphic_data_add_figure_shortlink_rewrite()
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>graphic_data_redirect_figure_shortlink()
Redirect a figure shortlink to its actual location.
graphic_data_redirect_figure_shortlink() : void
graphic_data_delete_figure_folder()
graphic_data_delete_figure_folder(mixed $post_id) : mixed
Parameters
- $post_id : mixed
graphic_data_add_modal_shortlink_rewrite()
Keep modal shortlinks ahead of generic instance/scene rules.
graphic_data_add_modal_shortlink_rewrite(array<string, string> $rules) : array<string, string>
Parameters
- $rules : array<string, string>
-
Rewrite rules, regex => query string.
Return values
array<string, string>graphic_data_add_modal_query_var()
Register the modal shortlink query variable.
graphic_data_add_modal_query_var(array<string|int, string> $vars) : array<string|int, string>
Parameters
- $vars : array<string|int, string>
-
Public query variables.
Return values
array<string|int, string>graphic_data_parse_modal_shortlink()
Support existing installations before their next rewrite-rule refresh.
graphic_data_parse_modal_shortlink(WP $wp) : void
Parameters
- $wp : WP
-
The current WordPress environment instance.
graphic_data_get_modal_shortlink_destination()
Resolve a publicly available modal and its parent scene.
graphic_data_get_modal_shortlink_destination(int $modal_id) : string
Parameters
- $modal_id : int
-
The modal post ID.
Return values
string —The scene URL with the modal's hash, or '' when the modal can't be linked.
graphic_data_redirect_modal_shortlink()
Redirect before WordPress attempts to canonicalize the shortlink.
graphic_data_redirect_modal_shortlink() : void
graphic_data_admin_bar_content_shortlink()
Point the editor toolbar's View action at the frontend scene.
graphic_data_admin_bar_content_shortlink(WP_Admin_Bar $admin_bar) : void
Parameters
- $admin_bar : WP_Admin_Bar
-
The admin bar instance.
graphic_data_sanitize_page_title_align()
Validate alignment without allowing arbitrary CSS.
graphic_data_sanitize_page_title_align(mixed $value) : mixed
Parameters
- $value : mixed
graphic_data_sanitize_page_title_padding()
Empty means theme default; otherwise accept whole pixels from 0 to 200.
graphic_data_sanitize_page_title_padding(mixed $value) : mixed
Parameters
- $value : mixed
graphic_data_register_page_title_meta()
Register REST metadata so settings participate in the normal editor save.
graphic_data_register_page_title_meta() : mixed
graphic_data_enqueue_page_title_editor()
Native WordPress components; this script does not need a build step.
graphic_data_enqueue_page_title_editor() : mixed
graphic_data_page_title_declarations()
Build only explicitly selected overrides; empty values preserve theme CSS.
graphic_data_page_title_declarations(mixed $post_id) : mixed
Parameters
- $post_id : mixed
graphic_data_enqueue_page_title_style()
Target only the main Page title, never navigation, scenes, or modal titles.
graphic_data_enqueue_page_title_style() : mixed