PHP Class Fragen\GitHub_Updater\Rest_Update

Updates a single plugin or theme, in a way suitable for rest requests. This class inherits from Base in order to be able to call the set_defaults function.
Inheritance: extends Base
Mostra file Open project: afragen/github-updater

Protected Properties

Property Type Description
$upgrader_skin Rest_Upgrader_Skin Holds REST Upgrader Skin.

Public Methods

Method Description
__construct ( ) Constructor.
get_messages ( ) Get messages during update.
is_error ( ) Is there an error?
process_request ( ) Process request.
show_updates ( $response ) : mixed Return listing of available updates.
update_plugin ( string $plugin_slug, string $tag = 'master' ) Update plugin.
update_theme ( string $theme_slug, string $tag = 'master' ) Update a single theme.

Private Methods

Method Description
get_webhook_data ( ) : boolean | array Checks the headers of the request and sends webhook data to be parsed.
parse_bitbucket_webhook ( array $request_data ) : boolean | array Parses Bitbucket webhook data.
parse_github_webhook ( array $request_data ) : array Parses GitHub webhook data.
parse_gitlab_webhook ( array $request_data ) : array Parses GitLab webhook data.

Method Details

__construct() public method

Constructor.
public __construct ( )

get_messages() public method

Get messages during update.
public get_messages ( )

is_error() public method

Is there an error?
public is_error ( )

process_request() public method

Relies on data in $_REQUEST, prints out json and exits. If the request came through a webhook, and if the branch in the webhook matches the branch specified by the url, use the latest update available as specified in the webhook payload.
public process_request ( )

show_updates() public method

Return listing of available updates.
public show_updates ( $response ) : mixed
$response
return mixed

update_plugin() public method

Update plugin.
public update_plugin ( string $plugin_slug, string $tag = 'master' )
$plugin_slug string
$tag string

update_theme() public method

Update a single theme.
public update_theme ( string $theme_slug, string $tag = 'master' )
$theme_slug string
$tag string

Property Details

$upgrader_skin protected_oe property

Holds REST Upgrader Skin.
protected Rest_Upgrader_Skin,Fragen\GitHub_Updater $upgrader_skin
return Rest_Upgrader_Skin