PHP 클래스 Fragen\GitHub_Updater\Base

Class Base
저자: Andy Fragen
저자: Gary Jones
파일 보기 프로젝트 열기: afragen/github-updater

보호된 프로퍼티들

프로퍼티 타입 설명
$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