mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-09 07:00:01 +00:00
Docs: Simplify get_plugin_data()
and get_file_data()
description.
See #47110. Built from https://develop.svn.wordpress.org/trunk@45917 git-svn-id: http://core.svn.wordpress.org/trunk@45728 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3f048f5ace
commit
d26191eb03
@ -9,10 +9,9 @@
|
|||||||
/**
|
/**
|
||||||
* Parses the plugin contents to retrieve plugin's metadata.
|
* Parses the plugin contents to retrieve plugin's metadata.
|
||||||
*
|
*
|
||||||
* The metadata of the plugin's data searches for the following in the plugin's
|
* All plugin headers must be on their own line. Plugin description must not have
|
||||||
* header. All plugin data must be on its own line. For plugin description, it
|
* any newlines, otherwise only parts of the description will be displayed.
|
||||||
* must not have any newlines or only parts of the description will be displayed
|
* The below is formatted for printing.
|
||||||
* and the same goes for the plugin data. The below is formatted for printing.
|
|
||||||
*
|
*
|
||||||
* /*
|
* /*
|
||||||
* Plugin Name: Name of the plugin.
|
* Plugin Name: Name of the plugin.
|
||||||
@ -33,14 +32,10 @@
|
|||||||
* activated on a single site when Multisite is enabled.
|
* activated on a single site when Multisite is enabled.
|
||||||
* Requires at least: Optional. Specify the minimum required WordPress version.
|
* Requires at least: Optional. Specify the minimum required WordPress version.
|
||||||
* Requires PHP: Optional. Specify the minimum required PHP version.
|
* Requires PHP: Optional. Specify the minimum required PHP version.
|
||||||
* * / # Remove the space to close comment
|
* * / # Remove the space to close comment.
|
||||||
*
|
*
|
||||||
* Some users have issues with opening large files and manipulating the contents
|
* The first 8 KB of the file will be pulled in and if the plugin data is not
|
||||||
* for want is usually the first 1kiB or 2kiB. This function stops pulling in
|
* within that first 8 KB, then the plugin author should correct their plugin
|
||||||
* the plugin contents when it has all of the required plugin data.
|
|
||||||
*
|
|
||||||
* The first 8kiB of the file will be pulled in and if the plugin data is not
|
|
||||||
* within that first 8kiB, then the plugin author should correct their plugin
|
|
||||||
* and move the plugin data headers to the top.
|
* and move the plugin data headers to the top.
|
||||||
*
|
*
|
||||||
* The plugin file is assumed to have permissions to allow for scripts to read
|
* The plugin file is assumed to have permissions to allow for scripts to read
|
||||||
@ -48,7 +43,7 @@
|
|||||||
* reading.
|
* reading.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 5.3.0 Added support for `Requires at least` and `Requires PHP`.
|
* @since 5.3.0 Added support for `Requires at least` and `Requires PHP` headers.
|
||||||
*
|
*
|
||||||
* @param string $plugin_file Absolute path to the main plugin file.
|
* @param string $plugin_file Absolute path to the main plugin file.
|
||||||
* @param bool $markup Optional. If the returned data should have HTML markup applied.
|
* @param bool $markup Optional. If the returned data should have HTML markup applied.
|
||||||
|
@ -5684,11 +5684,11 @@ function wp_scheduled_delete() {
|
|||||||
/**
|
/**
|
||||||
* Retrieve metadata from a file.
|
* Retrieve metadata from a file.
|
||||||
*
|
*
|
||||||
* Searches for metadata in the first 8kiB of a file, such as a plugin or theme.
|
* Searches for metadata in the first 8 KB of a file, such as a plugin or theme.
|
||||||
* Each piece of metadata must be on its own line. Fields can not span multiple
|
* Each piece of metadata must be on its own line. Fields can not span multiple
|
||||||
* lines, the value will get cut at the end of the first line.
|
* lines, the value will get cut at the end of the first line.
|
||||||
*
|
*
|
||||||
* If the file data is not within that first 8kiB, then the author should correct
|
* If the file data is not within that first 8 KB, then the author should correct
|
||||||
* their plugin file and move the data headers to the top.
|
* their plugin file and move the data headers to the top.
|
||||||
*
|
*
|
||||||
* @link https://codex.wordpress.org/File_Header
|
* @link https://codex.wordpress.org/File_Header
|
||||||
@ -5705,7 +5705,7 @@ function get_file_data( $file, $default_headers, $context = '' ) {
|
|||||||
// We don't need to write to the file, so just open for reading.
|
// We don't need to write to the file, so just open for reading.
|
||||||
$fp = fopen( $file, 'r' );
|
$fp = fopen( $file, 'r' );
|
||||||
|
|
||||||
// Pull only the first 8kiB of the file in.
|
// Pull only the first 8 KB of the file in.
|
||||||
$file_data = fread( $fp, 8 * KB_IN_BYTES );
|
$file_data = fread( $fp, 8 * KB_IN_BYTES );
|
||||||
|
|
||||||
// PHP will close file handle, but we are good citizens.
|
// PHP will close file handle, but we are good citizens.
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.3-alpha-45916';
|
$wp_version = '5.3-alpha-45917';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user