[ Index ]

WordPress Cross Reference

title

Body

[close]

/wp-admin/includes/ -> plugin.php (summary)

WordPress Plugin Administration API

File Size: 1861 lines (65 kb)
Included or required: 2 times
Referenced: 0 times
Includes or requires: 2 files
 wp-admin/admin-header.php
 wp-admin/admin-footer.php

Defines 50 functions

  get_plugin_data()
  _get_plugin_data_markup_translate()
  get_plugin_files()
  get_plugins()
  get_mu_plugins()
  _sort_uname_callback()
  get_dropins()
  _get_dropins()
  is_plugin_active()
  is_plugin_inactive()
  is_plugin_active_for_network()
  is_network_only_plugin()
  activate_plugin()
  deactivate_plugins()
  activate_plugins()
  delete_plugins()
  validate_active_plugins()
  validate_plugin()
  is_uninstallable_plugin()
  uninstall_plugin()
  add_menu_page()
  add_object_page()
  add_utility_page()
  add_submenu_page()
  add_management_page()
  add_options_page()
  add_theme_page()
  add_plugins_page()
  add_users_page()
  add_dashboard_page()
  add_posts_page()
  add_media_page()
  add_links_page()
  add_pages_page()
  add_comments_page()
  remove_menu_page()
  remove_submenu_page()
  menu_page_url()
  get_admin_page_parent()
  get_admin_page_title()
  get_plugin_page_hook()
  get_plugin_page_hookname()
  user_can_access_admin_page()
  register_setting()
  unregister_setting()
  option_update_filter()
  add_option_whitelist()
  remove_option_whitelist()
  settings_fields()
  wp_clean_plugins_cache()

Functions
Functions that are not part of a class:

get_plugin_data( $plugin_file, $markup = true, $translate = true )   X-Ref
Parse the plugin contents to retrieve plugin's metadata.

The metadata of the plugin's data searches for the following in the plugin's
header. All plugin data must be on its own line. For plugin description, it
must not have any newlines or only parts of the description will be displayed
and the same goes for the plugin data. The below is formatted for printing.

<code>
/*
Plugin Name: Name of Plugin
Plugin URI: Link to plugin information
Description: Plugin Description
Author: Plugin author's name
Author URI: Link to the author's web site
Version: Must be set in the plugin for WordPress 2.3+
Text Domain: Optional. Unique identifier, should be same as the one used in
plugin_text_domain()
Domain Path: Optional. Only useful if the translations are located in a
folder above the plugin's base path. For example, if .mo files are
located in the locale folder then Domain Path will be "/locale/" and
must have the first slash. Defaults to the base folder the plugin is
located in.
Network: Optional. Specify "Network: true" to require that a plugin is activated
across all sites in an installation. This will prevent a plugin from being
activated on a single site when Multisite is enabled.
* / # Remove the space to close comment
</code>

Plugin data returned array contains the following:
'Name' - Name of the plugin, must be unique.
'Title' - Title of the plugin and the link to the plugin's web site.
'Description' - Description of what the plugin does and/or notes
from the author.
'Author' - The author's name
'AuthorURI' - The authors web site address.
'Version' - The plugin version number.
'PluginURI' - Plugin web site address.
'TextDomain' - Plugin's text domain for localization.
'DomainPath' - Plugin's relative directory path to .mo files.
'Network' - Boolean. Whether the plugin can only be activated network wide.

Some users have issues with opening large files and manipulating the contents
for want is usually the first 1kiB or 2kiB. This function stops pulling in
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.

The plugin file is assumed to have permissions to allow for scripts to read
the file. This is not checked however and the file is only opened for
reading.

param: string $plugin_file Path to the plugin file
param: bool $markup Optional. If the returned data should have HTML markup applied. Defaults to true.
param: bool $translate Optional. If the returned data should be translated. Defaults to true.
return: array See above for description.

_get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup = true, $translate = true )   X-Ref
Sanitizes plugin data, optionally adds markup, optionally translates.


get_plugin_files($plugin)   X-Ref
Get a list of a plugin's files.

param: string $plugin Plugin ID
return: array List of files relative to the plugin root.

get_plugins($plugin_folder = '')   X-Ref
Check the plugins directory and retrieve all plugin files with plugin data.

WordPress only supports plugin files in the base plugins directory
(wp-content/plugins) and in one directory above the plugins directory
(wp-content/plugins/my-plugin). The file it looks for has the plugin data and
must be found in those two locations. It is recommended that do keep your
plugin files in directories.

The file with the plugin data is the file that will be included and therefore
needs to have the main execution for the plugin. This does not mean
everything must be contained in the file and it is recommended that the file
be split for maintainability. Keep everything in one file for extreme
optimization purposes.

param: string $plugin_folder Optional. Relative path to single plugin folder.
return: array Key is the plugin file path and the value is an array of the plugin data.

get_mu_plugins()   X-Ref
Check the mu-plugins directory and retrieve all mu-plugin files with any plugin data.

WordPress only includes mu-plugin files in the base mu-plugins directory (wp-content/mu-plugins).

return: array Key is the mu-plugin file path and the value is an array of the mu-plugin data.

_sort_uname_callback( $a, $b )   X-Ref
Callback to sort array by a 'Name' key.


get_dropins()   X-Ref
Check the wp-content directory and retrieve all drop-ins with any plugin data.

return: array Key is the file path and the value is an array of the plugin data.

_get_dropins()   X-Ref
Returns drop-ins that WordPress uses.

Includes Multisite drop-ins only when is_multisite()

return: array Key is file name. The value is an array, with the first value the

is_plugin_active( $plugin )   X-Ref
Check whether the plugin is active by checking the active_plugins list.

param: string $plugin Base plugin path from plugins directory.
return: bool True, if in the active plugins list. False, not in the list.

is_plugin_inactive( $plugin )   X-Ref
Check whether the plugin is inactive.

Reverse of is_plugin_active(). Used as a callback.

param: string $plugin Base plugin path from plugins directory.
return: bool True if inactive. False if active.

is_plugin_active_for_network( $plugin )   X-Ref
Check whether the plugin is active for the entire network.

param: string $plugin Base plugin path from plugins directory.
return: bool True, if active for the network, otherwise false.

is_network_only_plugin( $plugin )   X-Ref
Checks for "Network: true" in the plugin header to see if this should
be activated only as a network wide plugin. The plugin would also work
when Multisite is not enabled.

Checks for "Site Wide Only: true" for backwards compatibility.

param: string $plugin Plugin to check
return: bool True if plugin is network only, false otherwise.

activate_plugin( $plugin, $redirect = '', $network_wide = false, $silent = false )   X-Ref
Attempts activation of plugin in a "sandbox" and redirects on success.

A plugin that is already activated will not attempt to be activated again.

The way it works is by setting the redirection to the error before trying to
include the plugin file. If the plugin fails, then the redirection will not
be overwritten with the success message. Also, the options will not be
updated and the activation hook will not be called on plugin error.

It should be noted that in no way the below code will actually prevent errors
within the file. The code should not be used elsewhere to replicate the
"sandbox", which uses redirection to work.
{@source 13 1}

If any errors are found or text is outputted, then it will be captured to
ensure that the success redirection will update the error redirection.

param: string $plugin Plugin path to main plugin file with plugin data.
param: string $redirect Optional. URL to redirect to.
param: bool $network_wide Whether to enable the plugin for all sites in the
param: bool $silent Prevent calling activation hooks. Optional, default is false.
return: WP_Error|null WP_Error on invalid file or null on success.

deactivate_plugins( $plugins, $silent = false, $network_wide = null )   X-Ref
Deactivate a single plugin or multiple plugins.

The deactivation hook is disabled by the plugin upgrader by using the $silent
parameter.

param: string|array $plugins Single plugin or list of plugins to deactivate.
param: bool $silent Prevent calling deactivation hooks. Default is false.
param: mixed $network_wide Whether to deactivate the plugin for all sites in the network.

activate_plugins( $plugins, $redirect = '', $network_wide = false, $silent = false )   X-Ref
Activate multiple plugins.

When WP_Error is returned, it does not mean that one of the plugins had
errors. It means that one or more of the plugins file path was invalid.

The execution will be halted as soon as one of the plugins has an error.

param: string|array $plugins
param: string $redirect Redirect to page after successful activation.
param: bool $network_wide Whether to enable the plugin for all sites in the network.
param: bool $silent Prevent calling activation hooks. Default is false.
return: bool|WP_Error True when finished or WP_Error if there were errors during a plugin activation.

delete_plugins($plugins, $redirect = '' )   X-Ref
Remove directory and files of a plugin for a single or list of plugin(s).

If the plugins parameter list is empty, false will be returned. True when
completed.

param: array $plugins List of plugin
param: string $redirect Redirect to page when complete.
return: mixed

validate_active_plugins()   X-Ref
Validate active plugins

Validate all active plugins, deactivates invalid and
returns an array of deactivated ones.

return: array invalid plugins, plugin as key, error as value

validate_plugin($plugin)   X-Ref
Validate the plugin path.

Checks that the file exists and {@link validate_file() is valid file}.

param: string $plugin Plugin Path
return: WP_Error|int 0 on success, WP_Error on failure.

is_uninstallable_plugin($plugin)   X-Ref
Whether the plugin can be uninstalled.

param: string $plugin Plugin path to check.
return: bool Whether plugin can be uninstalled.

uninstall_plugin($plugin)   X-Ref
Uninstall a single plugin.

Calls the uninstall hook, if it is available.

param: string $plugin Relative plugin path from Plugin Directory.

add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '', $position = null )   X-Ref
Add a top level menu page

This function takes a capability which will be used to determine whether
or not a page is included in the menu.

The function which is hooked in to handle the output of the page must check
that the user has the required capability as well.

param: string $page_title The text to be displayed in the title tags of the page when the menu is selected
param: string $menu_title The text to be used for the menu
param: string $capability The capability required for this menu to be displayed to the user.
param: string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
param: callback $function The function to be called to output the content for this page.
param: string $icon_url The url to the icon to be used for this menu.
param: int $position The position in the menu order this one should appear
return: string The resulting page's hook_suffix

add_object_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '')   X-Ref
Add a top level menu page in the 'objects' section

This function takes a capability which will be used to determine whether
or not a page is included in the menu.

The function which is hooked in to handle the output of the page must check
that the user has the required capability as well.

param: string $page_title The text to be displayed in the title tags of the page when the menu is selected
param: string $menu_title The text to be used for the menu
param: string $capability The capability required for this menu to be displayed to the user.
param: string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
param: callback $function The function to be called to output the content for this page.
param: string $icon_url The url to the icon to be used for this menu
return: string The resulting page's hook_suffix

add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '')   X-Ref
Add a top level menu page in the 'utility' section

This function takes a capability which will be used to determine whether
or not a page is included in the menu.

The function which is hooked in to handle the output of the page must check
that the user has the required capability as well.

param: string $page_title The text to be displayed in the title tags of the page when the menu is selected
param: string $menu_title The text to be used for the menu
param: string $capability The capability required for this menu to be displayed to the user.
param: string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
param: callback $function The function to be called to output the content for this page.
param: string $icon_url The url to the icon to be used for this menu
return: string The resulting page's hook_suffix

add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function = '' )   X-Ref
Add a sub menu page

This function takes a capability which will be used to determine whether
or not a page is included in the menu.

The function which is hooked in to handle the output of the page must check
that the user has the required capability as well.

param: string $parent_slug The slug name for the parent menu (or the file name of a standard WordPress admin page)
param: string $page_title The text to be displayed in the title tags of the page when the menu is selected
param: string $menu_title The text to be used for the menu
param: string $capability The capability required for this menu to be displayed to the user.
param: string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
param: callback $function The function to be called to output the content for this page.
return: string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.

add_management_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' )   X-Ref
Add sub menu page to the tools main menu.

This function takes a capability which will be used to determine whether
or not a page is included in the menu.

The function which is hooked in to handle the output of the page must check
that the user has the required capability as well.

param: string $page_title The text to be displayed in the title tags of the page when the menu is selected
param: string $menu_title The text to be used for the menu
param: string $capability The capability required for this menu to be displayed to the user.
param: string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
param: callback $function The function to be called to output the content for this page.
return: string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.

add_options_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' )   X-Ref
Add sub menu page to the options main menu.

This function takes a capability which will be used to determine whether
or not a page is included in the menu.

The function which is hooked in to handle the output of the page must check
that the user has the required capability as well.

param: string $page_title The text to be displayed in the title tags of the page when the menu is selected
param: string $menu_title The text to be used for the menu
param: string $capability The capability required for this menu to be displayed to the user.
param: string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
param: callback $function The function to be called to output the content for this page.
return: string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.

add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' )   X-Ref
Add sub menu page to the themes main menu.

This function takes a capability which will be used to determine whether
or not a page is included in the menu.

The function which is hooked in to handle the output of the page must check
that the user has the required capability as well.

param: string $page_title The text to be displayed in the title tags of the page when the menu is selected
param: string $menu_title The text to be used for the menu
param: string $capability The capability required for this menu to be displayed to the user.
param: string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
param: callback $function The function to be called to output the content for this page.
return: string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.

add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' )   X-Ref
Add sub menu page to the plugins main menu.

This function takes a capability which will be used to determine whether
or not a page is included in the menu.

The function which is hooked in to handle the output of the page must check
that the user has the required capability as well.

param: string $page_title The text to be displayed in the title tags of the page when the menu is selected
param: string $menu_title The text to be used for the menu
param: string $capability The capability required for this menu to be displayed to the user.
param: string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
param: callback $function The function to be called to output the content for this page.
return: string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.

add_users_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' )   X-Ref
Add sub menu page to the Users/Profile main menu.

This function takes a capability which will be used to determine whether
or not a page is included in the menu.

The function which is hooked in to handle the output of the page must check
that the user has the required capability as well.

param: string $page_title The text to be displayed in the title tags of the page when the menu is selected
param: string $menu_title The text to be used for the menu
param: string $capability The capability required for this menu to be displayed to the user.
param: string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
param: callback $function The function to be called to output the content for this page.
return: string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.

add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' )   X-Ref
Add sub menu page to the Dashboard main menu.

This function takes a capability which will be used to determine whether
or not a page is included in the menu.

The function which is hooked in to handle the output of the page must check
that the user has the required capability as well.

param: string $page_title The text to be displayed in the title tags of the page when the menu is selected
param: string $menu_title The text to be used for the menu
param: string $capability The capability required for this menu to be displayed to the user.
param: string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
param: callback $function The function to be called to output the content for this page.
return: string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.

add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' )   X-Ref
Add sub menu page to the posts main menu.

This function takes a capability which will be used to determine whether
or not a page is included in the menu.

The function which is hooked in to handle the output of the page must check
that the user has the required capability as well.

param: string $page_title The text to be displayed in the title tags of the page when the menu is selected
param: string $menu_title The text to be used for the menu
param: string $capability The capability required for this menu to be displayed to the user.
param: string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
param: callback $function The function to be called to output the content for this page.
return: string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.

add_media_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' )   X-Ref
Add sub menu page to the media main menu.

This function takes a capability which will be used to determine whether
or not a page is included in the menu.

The function which is hooked in to handle the output of the page must check
that the user has the required capability as well.

param: string $page_title The text to be displayed in the title tags of the page when the menu is selected
param: string $menu_title The text to be used for the menu
param: string $capability The capability required for this menu to be displayed to the user.
param: string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
param: callback $function The function to be called to output the content for this page.
return: string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.

add_links_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' )   X-Ref
Add sub menu page to the links main menu.

This function takes a capability which will be used to determine whether
or not a page is included in the menu.

The function which is hooked in to handle the output of the page must check
that the user has the required capability as well.

param: string $page_title The text to be displayed in the title tags of the page when the menu is selected
param: string $menu_title The text to be used for the menu
param: string $capability The capability required for this menu to be displayed to the user.
param: string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
param: callback $function The function to be called to output the content for this page.
return: string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.

add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' )   X-Ref
Add sub menu page to the pages main menu.

This function takes a capability which will be used to determine whether
or not a page is included in the menu.

The function which is hooked in to handle the output of the page must check
that the user has the required capability as well.

param: string $page_title The text to be displayed in the title tags of the page when the menu is selected
param: string $menu_title The text to be used for the menu
param: string $capability The capability required for this menu to be displayed to the user.
param: string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
param: callback $function The function to be called to output the content for this page.
return: string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.

add_comments_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' )   X-Ref
Add sub menu page to the comments main menu.

This function takes a capability which will be used to determine whether
or not a page is included in the menu.

The function which is hooked in to handle the output of the page must check
that the user has the required capability as well.

param: string $page_title The text to be displayed in the title tags of the page when the menu is selected
param: string $menu_title The text to be used for the menu
param: string $capability The capability required for this menu to be displayed to the user.
param: string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
param: callback $function The function to be called to output the content for this page.
return: string|bool The resulting page's hook_suffix, or false if the user does not have the capability required.

remove_menu_page( $menu_slug )   X-Ref
Remove a top level admin menu

param: string $menu_slug The slug of the menu
return: array|bool The removed menu on success, False if not found

remove_submenu_page( $menu_slug, $submenu_slug )   X-Ref
Remove an admin submenu

param: string $menu_slug The slug for the parent menu
param: string $submenu_slug The slug of the submenu
return: array|bool The removed submenu on success, False if not found

menu_page_url($menu_slug, $echo = true)   X-Ref
Get the url to access a particular menu page based on the slug it was registered with.

If the slug hasn't been registered properly no url will be returned

param: string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
param: bool $echo Whether or not to echo the url - default is true
return: string the url

get_admin_page_parent( $parent = '' )   X-Ref
No description

get_admin_page_title()   X-Ref
No description

get_plugin_page_hook( $plugin_page, $parent_page )   X-Ref
No description

get_plugin_page_hookname( $plugin_page, $parent_page )   X-Ref
No description

user_can_access_admin_page()   X-Ref
No description

register_setting( $option_group, $option_name, $sanitize_callback = '' )   X-Ref
Register a setting and its sanitization callback

param: string $option_group A settings group name. Should correspond to a whitelisted option key name.
param: string $option_name The name of an option to sanitize and save.
param: unknown_type $sanitize_callback A callback function that sanitizes the option's value.
return: unknown

unregister_setting( $option_group, $option_name, $sanitize_callback = '' )   X-Ref
Unregister a setting

param: unknown_type $option_group
param: unknown_type $option_name
param: unknown_type $sanitize_callback
return: unknown

option_update_filter( $options )   X-Ref
{@internal Missing Short Description}}

param: unknown_type $options
return: unknown

add_option_whitelist( $new_options, $options = '' )   X-Ref
{@internal Missing Short Description}}

param: unknown_type $new_options
param: unknown_type $options
return: unknown

remove_option_whitelist( $del_options, $options = '' )   X-Ref
{@internal Missing Short Description}}

param: unknown_type $del_options
param: unknown_type $options
return: unknown

settings_fields($option_group)   X-Ref
Output nonce, action, and option_page fields for a settings page.

param: string $option_group A settings group name. This should match the group name used in register_setting().

wp_clean_plugins_cache( $clear_update_cache = true )   X-Ref
Clears the Plugins cache used by get_plugins() and by default, the Plugin Update cache.

param: bool $clear_update_cache Whether to clear the Plugin updates cache



Generated: Tue Mar 25 01:41:18 2014 WordPress honlapkészítés: online1.hu