[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-forums/bbpress/bb-admin/includes/ -> functions.bb-plugin.php (summary)

(no description)

File Size: 441 lines (15 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 9 functions

  bb_get_plugins_callback()
  bb_get_plugins()
  bb_plugins_sort()
  bb_get_plugin_counts()
  bb_get_plugin_data()
  _bb_get_plugin_data_translate()
  bb_activate_plugin()
  bb_deactivate_plugins()
  bb_validate_plugin()

Functions
Functions that are not part of a class:

bb_get_plugins_callback( $type = 'normal', $path, $filename )   X-Ref
No description

bb_get_plugins( $location = 'all', $type = 'normal', $status = 'all' )   X-Ref
No description

bb_plugins_sort( $a, $b )   X-Ref
No description

bb_get_plugin_counts()   X-Ref
No description

bb_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
Requires at least: Optional.  Minimum bbPress version this plugin requires
Tested up to: Optional. Maximum bbPress version this plugin has been tested with
Text Domain: Optional. Unique identifier, should be same as the one used in
bb_load_plugin_textdomain()
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.
* / # You must remove the space to close comment (the space is here only for documentation purposes).
</code>

Plugin data returned array contains the following:
'location' - Location of plugin file
'name' - Name of the plugin, must be unique.
'uri' - Plugin's web site.
'plugin_link' - Title of plugin linked to plugin's web site.
'description' - Description of what the plugin does and/or notes
from the author.
'author' - The author's name
'author_uri' - The author's web site address.
'author_link' - The author's name linked to the author's web site.
'version' - The plugin version number.
'requires' - Minimum bbPress version plugin requires
'tested' - Maximum bbPress version plugin has been tested with
'text_domain' - Plugin's text domain for localization.
'domain_path' - Plugin's relative directory path to .mo files.

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 If the returned data should have HTML markup applied
param: bool $translate If the returned data should be translated
return: array See above for description.
since: 1.5.0

_bb_get_plugin_data_translate( $plugin_data, $plugin_file )   X-Ref
No description

bb_activate_plugin( $plugin, $redirect = '' )   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.

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.
return: WP_Error|null WP_Error on invalid file or null on success.
since: 1.0

bb_deactivate_plugins( $plugins, $silent = false )   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 Optional, default is false. Prevent calling deactivate hook.
since: unknown

bb_validate_plugin( $plugin, $location = 'all', $type = 'all' )   X-Ref
Validate the plugin path.

Checks that the file exists and is valid file.

param: string $plugin Plugin Path
param: string $location The location of plugin, one of 'user', 'core' or 'all'
param: string $type The type of plugin, one of 'all', 'autoload' or 'normal'
return: WP_Error|int 0 on success, WP_Error on failure.
since: 1.0



Generated: Thu Dec 7 01:01:35 2017 Cross-referenced by PHPXref 0.7.1