API / Minn\Runtime / PluginFiles

PluginFiles final class

Minn\Runtime\PluginFiles · public/minn/src/Minn/Runtime/PluginFiles.php · 122 lines

A plugin's files as WordPress's plugin functions know them: where a plugin folder really is (a symlinked one noted), a plugin file's name under the plugins folder, its headers as read and as the plugin screens show them, and whether it can be uninstalled.

Constants and properties

privateHEADERS = array ( 'Name' => 'Plugin Name', 'PluginURI' => 'Plugin URI', 'Version' => 'Version', 'Description' => 'Description', 'Author' => 'Author', 'AuthorURI' => 'Author URI', 'TextDomain' => 'Text Domain', 'DomainPath' => 'Domain Path', 'Network' => 'Network', 'RequiresWP' => 'Requires at least', 'RequiresPHP' => 'Requires PHP', 'UpdateURI' => 'Update URI', 'RequiresPlugins' => 'Requires Plugins', )

The headers a plugin's main file may carry, by field.

Public

staticregisterRealpath(mixed $file): bool#

Where a plugin's folder really is, noted under the folder as given (wp_register_plugin_realpath); a file not on disk notes an empty place. The plugins and must-use folders themselves are refused.

staticbasename(mixed $file): string#

A plugin file's name under the plugins or must-use folder (plugin_basename), a symlinked folder read as noted.

staticdata(mixed $pluginFile, mixed $markup = true, mixed $translate = true): array#

A plugin's headers (get_plugin_data), marked up and translated unless asked not to be; a plugin in its own folder that names no text domain uses the folder's name.

@return array<string, mixed>
staticshown(mixed $pluginFile, mixed $data, mixed $markup = true, mixed $translate = true): array#

The headers as the plugin screens show them (_get_plugin_data_markup_translate). Translated: the plugin's domain loaded from its folder unless it is already, then the name, addresses, version, description and author through it. Always: the text cut to a, abbr, acronym, code, em and strong, the addresses escaped. Marked up: the title and author linked, the description texturized with its "By" line.

$dataarray<string, mixed>
@return array<string, mixed>
staticuninstallable(mixed $plugin): bool#

Whether a plugin can be uninstalled (is_uninstallable_plugin): it registered an uninstall callback, or ships an uninstall.php.