PHP Класс Fragen\GitHub_Updater\Base

Class Base
Автор: Andy Fragen
Автор: Gary Jones
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$auth_required boolean Used by class Settings and class Messages.
$config object Store details of all repositories that are installed.
$error_code Holds HTTP error code from API call.
$extra_headers array Variable for holding extra theme and plugin headers.
$extra_repo_headers array Holds extra repo header types.
$git_servers array Holds git server types.
$hours integer Variable for setting update transient hours.
$languages Class Object for Language Packs.
$load_repo_meta boolean Checks user privileges and when to load.
$options array Holds the values to be used in the fields callbacks.
$options_remote mixed Holds the values for remote management settings.
$repo_api object Class Object for API.

Открытые методы

Метод Описание
__construct ( ) Constructor.
add_headers ( $extra_headers ) : array Add extra headers to get_plugins() or wp_get_themes().
admin_pages_update_transient ( ) Ensure update transient is update to date on admin pages.
ajax_update ( ) AJAX endpoint for REST updates.
background_update ( ) Piggyback on built-in update function to get metadata.
can_update ( $type ) : boolean Function to check if plugin or theme object is able to be updated.
delete_all_transients ( ) : boolean Delete all _ghu- transients from database table.
forced_meta_update_plugins ( boolean $true = false ) Performs actual plugin metadata fetching.
forced_meta_update_remote_management ( ) Calls $this->forced_meta_update_plugins() and $this->forced_meta_update_themes() for remote management services.
forced_meta_update_themes ( boolean $true = false ) Performs actual theme metadata fetching.
get_remote_repo_meta ( $repo ) : boolean Get remote repo meta data for plugins or themes.
init ( ) : boolean Instantiate Plugin, Theme, and Settings for proper user capabilities.
load_hooks ( ) Load relevant action/filter hooks.
remove_hooks ( ) Remove hooks after use.
set_options_filter ( ) Allows developers to use 'github_updater_set_options' hook to set access tokens or other settings.
set_rollback ( mixed $update_data ) : mixed Test if rollback and then run set_rollback_transient.
upgrader_post_install ( boolean $true, array $hook_extra, array $result ) : mixed Delete $source when updating from GitLab Release Asset.
upgrader_source_selection ( string $source, string $remote_source, object $upgrader, array $hook_extra = null ) : string Used for renaming of sources to ensure correct directory name.

Защищенные методы

Метод Описание
add_meta_repo_object ( ) Add remote data to type object.
ensure_api_key_is_set ( ) Ensure api key is set.
exit_no_update ( $response, $branch = false ) : boolean Test to exit early if no update available, saves API calls.
get_changelog_filename ( $type ) : boolean | string Get filename of changelog and return.
get_file_headers ( $contents, $type ) : array Take remote file contents as string and parse headers.
get_local_info ( $repo, $file ) : null | string Get local file info if no update available. Save API calls.
get_repo_parts ( $repo, $type ) : mixed Create repo parts.
get_repo_slugs ( string $slug, object $upgrader_object = null ) : array Set array with normal and extended repo names.
get_update_url ( string $type, string $action, string $repo_name ) : string | void Generate update URL.
is_doing_ajax ( ) : boolean Checks to see if DOING_AJAX.
is_heartbeat ( ) : boolean Checks to see if a heartbeat is resulting in activity.
is_private ( object $repo ) : boolean Is this a private repo? Test for whether remote_version is set ( default = 0.0.0 ) or a repo option is set/not empty.
load_options ( ) Load site options.
make_branch_switch_row ( array $data ) : mixed Make branch switch row.
make_rating ( $repo_meta ) : integer Create some sort of rating from 0 to 100 for use in star ratings.
parse_header_uri ( $repo_header ) : array Parse URI param returning array of parts.
parse_tags ( $response, $repo_type ) : boolean Parse tags and set object data.
set_defaults ( $type ) Set default values for plugin/theme.
set_file_info ( $response ) Set repo object file info.
set_readme_info ( $response ) : boolean Set data from readme.txt.
update_row_enclosure ( $repo_name, $type, boolean $branch_switcher = false ) : array Return correct update row opening and closing tags for Shiny Updates.

Приватные методы

Метод Описание
set_rollback_transient ( string $type, object $repo ) Update transient for rollback or branch switch.

Описание методов

__construct() публичный метод

Loads options to private static variable.
public __construct ( )

add_headers() публичный метод

Add extra headers to get_plugins() or wp_get_themes().
public add_headers ( $extra_headers ) : array
$extra_headers
Результат array

add_meta_repo_object() защищенный метод

Add remote data to type object.
protected add_meta_repo_object ( )

admin_pages_update_transient() публичный метод

Ensure update transient is update to date on admin pages.

ajax_update() публичный метод

AJAX endpoint for REST updates.
public ajax_update ( )

background_update() публичный метод

Piggyback on built-in update function to get metadata.
public background_update ( )

can_update() публичный метод

Function to check if plugin or theme object is able to be updated.
public can_update ( $type ) : boolean
$type
Результат boolean

delete_all_transients() публичный метод

Delete all _ghu- transients from database table.
public delete_all_transients ( ) : boolean
Результат boolean

ensure_api_key_is_set() защищенный метод

Ensure api key is set.
protected ensure_api_key_is_set ( )

exit_no_update() защищенный метод

Test to exit early if no update available, saves API calls.
protected exit_no_update ( $response, $branch = false ) : boolean
$response array|bool
$branch bool
Результат boolean

forced_meta_update_plugins() публичный метод

Performs actual plugin metadata fetching.
public forced_meta_update_plugins ( boolean $true = false )
$true boolean Only used from API::wp_update_response()

forced_meta_update_remote_management() публичный метод

Calls $this->forced_meta_update_plugins() and $this->forced_meta_update_themes() for remote management services.

forced_meta_update_themes() публичный метод

Performs actual theme metadata fetching.
public forced_meta_update_themes ( boolean $true = false )
$true boolean Only used from API::wp_update_response()

get_changelog_filename() защищенный метод

Get filename of changelog and return.
protected get_changelog_filename ( $type ) : boolean | string
$type
Результат boolean | string

get_file_headers() защищенный метод

Take remote file contents as string and parse headers.
protected get_file_headers ( $contents, $type ) : array
$contents
$type
Результат array

get_local_info() защищенный метод

Get local file info if no update available. Save API calls.
protected get_local_info ( $repo, $file ) : null | string
$repo
$file
Результат null | string

get_remote_repo_meta() публичный метод

Calls remote APIs for data.
public get_remote_repo_meta ( $repo ) : boolean
$repo
Результат boolean

get_repo_parts() защищенный метод

Create repo parts.
protected get_repo_parts ( $repo, $type ) : mixed
$repo
$type
Результат mixed

get_repo_slugs() защищенный метод

Fix name even if installed without renaming originally.
protected get_repo_slugs ( string $slug, object $upgrader_object = null ) : array
$slug string
$upgrader_object object
Результат array

get_update_url() защищенный метод

Generate update URL.
protected get_update_url ( string $type, string $action, string $repo_name ) : string | void
$type string ( plugin or theme )
$action string
$repo_name string
Результат string | void

init() публичный метод

Instantiate Plugin, Theme, and Settings for proper user capabilities.
public init ( ) : boolean
Результат boolean

is_doing_ajax() защищенный статический метод

Checks to see if DOING_AJAX.
protected static is_doing_ajax ( ) : boolean
Результат boolean

is_heartbeat() защищенный статический метод

Checks to see if a heartbeat is resulting in activity.
protected static is_heartbeat ( ) : boolean
Результат boolean

is_private() защищенный метод

Is this a private repo? Test for whether remote_version is set ( default = 0.0.0 ) or a repo option is set/not empty.
protected is_private ( object $repo ) : boolean
$repo object
Результат boolean

load_hooks() публичный метод

Use 'init' hook for user capabilities.
public load_hooks ( )

load_options() защищенный метод

Load site options.
protected load_options ( )

make_branch_switch_row() защищенный метод

Make branch switch row.
protected make_branch_switch_row ( array $data ) : mixed
$data array Parameters for creating branch switching row.
Результат mixed

make_rating() защищенный метод

I'm really just making this up, more based upon popularity.
protected make_rating ( $repo_meta ) : integer
$repo_meta
Результат integer

parse_header_uri() защищенный метод

Parse URI param returning array of parts.
protected parse_header_uri ( $repo_header ) : array
$repo_header
Результат array

parse_tags() защищенный метод

Parse tags and set object data.
protected parse_tags ( $response, $repo_type ) : boolean
$response
$repo_type
Результат boolean

remove_hooks() публичный метод

Remove hooks after use.
public remove_hooks ( )

set_defaults() защищенный метод

Set default values for plugin/theme.
protected set_defaults ( $type )
$type

set_file_info() защищенный метод

Set repo object file info.
protected set_file_info ( $response )
$response

set_options_filter() публичный метод

Saves results of filter hook to self::$options. Hook requires return of associative element array. $key === repo-name and $value === token e.g. array( 'repo-name' => 'access_token' );
public set_options_filter ( )

set_readme_info() защищенный метод

Prefer changelog from CHANGES.md.
protected set_readme_info ( $response ) : boolean
$response
Результат boolean

set_rollback() публичный метод

Test if rollback and then run set_rollback_transient.
public set_rollback ( mixed $update_data ) : mixed
$update_data mixed
Результат mixed $update_data

update_row_enclosure() защищенный метод

Return correct update row opening and closing tags for Shiny Updates.
protected update_row_enclosure ( $repo_name, $type, boolean $branch_switcher = false ) : array
$repo_name
$type
$branch_switcher boolean
Результат array

upgrader_post_install() публичный метод

Delete $source when updating from GitLab Release Asset.
public upgrader_post_install ( boolean $true, array $hook_extra, array $result ) : mixed
$true boolean
$hook_extra array
$result array
Результат mixed

upgrader_source_selection() публичный метод

Used for renaming of sources to ensure correct directory name.
public upgrader_source_selection ( string $source, string $remote_source, object $upgrader, array $hook_extra = null ) : string
$source string
$remote_source string
$upgrader object
$hook_extra array
Результат string

Описание свойств

$auth_required защищенное статическое свойство

Used by class Settings and class Messages.
protected static bool $auth_required
Результат boolean

$config защищенное свойство

Store details of all repositories that are installed.
protected object $config
Результат object

$error_code защищенное статическое свойство

Holds HTTP error code from API call.
protected static $error_code

$extra_headers защищенное статическое свойство

Variable for holding extra theme and plugin headers.
protected static array $extra_headers
Результат array

$extra_repo_headers защищенное статическое свойство

Holds extra repo header types.
protected static array $extra_repo_headers
Результат array

$git_servers защищенное статическое свойство

Holds git server types.
protected static array $git_servers
Результат array

$hours защищенное статическое свойство

Variable for setting update transient hours.
protected static int $hours
Результат integer

$languages защищенное свойство

Class Object for Language Packs.
protected $languages

$load_repo_meta защищенное статическое свойство

Checks user privileges and when to load.
protected static bool $load_repo_meta
Результат boolean

$options защищенное статическое свойство

Holds the values to be used in the fields callbacks.
protected static array $options
Результат array

$options_remote защищенное статическое свойство

Holds the values for remote management settings.
protected static mixed $options_remote
Результат mixed

$repo_api защищенное свойство

Class Object for API.
protected object $repo_api
Результат object