PHP 클래스 Jetpack_Core_Json_Api_Endpoints, jetpack

부터: 4.1.0
파일 보기 프로젝트 열기: automattic/jetpack 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$stats_roles Roles that can access Stats once they're granted access.
$user_permissions_error_msg Generic error message when user is not allowed to perform an action.

공개 메소드들

메소드 설명
activate_plugins_permission_check ( ) : boolean Verify that user can view Jetpack admin page and can activate plugins.
build_connect_url ( ) : string | WP_Error Gets a new connect raw URL with fresh nonce.
cast_value ( mixed $value, array $definition ) : boolean | float | integer | string Perform a casting to the value specified in the option definition.
configure_modules_permission_check ( ) : boolean Verify that user can update Jetpack modules.
confirm_safe_mode ( ) : boolean Handles identity crisis mitigation, confirming safe mode for this site.
connect_url_permission_callback ( ) : boolean | WP_Error Verify that the user can get a connect/link URL
disconnect_site ( $data ) : boolean | WP_Error Disconnects Jetpack from the WordPress.com Servers
disconnect_site_permission_callback ( ) : boolean | WP_Error Verify that the user can disconnect the site.
dismiss_notice ( $data ) : array | wp-error Handles dismissing of Jetpack Notices
get_module_requested ( string $route = '/module/(?P<slug>[a-z\-]+)' ) : array Get the currently accessed route and return the module slug in it.
get_plugin ( WP_REST_Request $data ) : boolean | WP_Error Get data about the queried plugin. Currently it only returns whether the plugin is active or not.
get_plugin_update_count ( ) : mixed | WP_Error Get number of plugin updates available.
get_plugins ( ) : WP_REST_Response | WP_Error Get plugins data in site.
get_remote_value ( string $module, string $option ) : boolean Get a value not saved locally.
get_settings ( ) : object Get miscellaneous settings for this Jetpack installation, like Holiday Snow.
get_site_data ( ) : array Get site data, including for example, the site's current plan.
get_updateable_data_list ( string | array $selector = '' ) : array Returns a list of module options or general settings that can be updated.
get_updateable_parameters ( string $selector = '' ) : array Get the query parameters to update module options or general settings.
get_user_connection_data ( ) : object Get miscellaneous user data related to the connection. Similar data available in old "My Jetpack".
get_user_connection_data_permission_callback ( ) : boolean | WP_Error Verify that a user can get the data about the current user.
holiday_snow_option_name ( ) : string Returns the proper name for Jetpack Holiday Snow setting.
identity_crisis_mitigation_permission_check ( ) : boolean Verify that user can mitigate an identity crisis.
jetpack_connection_status ( ) : boolean Get connection status for this Jetpack site.
jumpstart_activate ( WP_REST_Request $data ) : boolean | WP_Error Activates a series of valid Jetpack modules and initializes some options.
jumpstart_deactivate ( WP_REST_Request $data ) : boolean | WP_Error Dismisses Jumpstart so user is not prompted to go through it again.
jumpstart_toggle ( WP_REST_Request $data ) : boolean | WP_Error Toggles activation or deactivation of the JumpStart
manage_modules_permission_check ( ) : boolean Verify that user can manage Jetpack modules.
migrate_stats_and_subscribers ( ) : boolean Handles identity crisis mitigation, migrating stats and subscribers from old url to this, new url.
prepare_modules_for_response ( string $modules = '', null | string $slug = null ) : array Adds extra information for modules.
prepare_options_for_response ( string $module = '' ) : array Remove 'validate_callback' item from options available for module.
register_endpoints ( ) Declare the Jetpack REST API endpoints.
reset_jetpack_options ( WP_REST_Request $data ) : boolean | WP_Error Reset Jetpack options
rest_authorization_required_code ( ) : integer Contextual HTTP error code for authorization failure.
route ( $path, $classname, $method, $constructor_arguments = NULL, $endpoint_arguments = NULL )
sanitize_stats_allowed_roles ( string | boolean $value ) : boolean If for some reason the roles allowed to see Stats are empty (for example, user tampering with checkboxes), return an array with only 'administrator' as the allowed role and save it for 'roles' option.
split_options ( array $separate_options, array $grouped_options, string $prefix = '' ) : array Splits module options saved as arrays like relatedposts or verification_services_codes into separate options to be returned in the response.
start_fresh_connection ( ) : boolean | WP_Error This IDC resolution will disconnect the site and re-connect to a completely new and separate shadow site than the original.
unlink_user ( $data ) : boolean | WP_Error Unlinks current user from the WordPress.com Servers.
unlink_user_permission_callback ( ) : boolean | WP_Error Verify that a user can use the /connection/user endpoint. Has to be a registered user and be currently linked.
update_setting ( WP_REST_Request $data ) : object Update a single miscellaneous setting for this Jetpack installation, like Holiday Snow.
update_settings_permission_check ( ) : boolean Verify that user can update Jetpack general settings.
validate_alphanum ( string $value = '', WP_REST_Request $request, string $param ) : boolean Validates that the parameter is an alphanumeric or empty string (to be able to clear the field).
validate_boolean ( string | boolean $value, WP_REST_Request $request, string $param ) : boolean Validates that the parameter is either a pure boolean or a numeric string that can be mapped to a boolean.
validate_custom_service ( string | boolean $value, WP_REST_Request $request, string $param ) : boolean Validates that the parameter has enough information to build a custom sharing button.
validate_custom_service_id ( string $value = '', WP_REST_Request $request, string $param ) : boolean Validates that the parameter is a custom sharing service ID like 'custom-1461976264'.
validate_list_item ( string $value = '', WP_REST_Request $request, string $param ) : boolean Validates that the parameter belongs to a list of admitted values.
validate_module_list ( string $value = '', WP_REST_Request $request, string $param ) : boolean Validates that the parameter belongs to a list of admitted values.
validate_posint ( integer $value, WP_REST_Request $request, string $param ) : boolean Validates that the parameter is a positive integer.
validate_services ( string | boolean $value, WP_REST_Request $request, string $param ) : boolean Validates that the parameter is among the views where the Sharing can be displayed.
validate_sharing_show ( string | boolean $value, WP_REST_Request $request, string $param ) : boolean Validates that the parameter is among the views where the Sharing can be displayed.
validate_stats_roles ( string | boolean $value, WP_REST_Request $request, string $param ) : boolean Validates that the parameter is among the roles allowed for Stats.
validate_string ( string $value = '', WP_REST_Request $request, string $param ) : boolean Validates that the parameter is a string.
validate_twitter_username ( string $value = '', WP_REST_Request $request, string $param ) : boolean Validates that the parameter is a Twitter username or empty string (to be able to clear the field).
view_admin_page_permission_check ( ) : boolean Verify that user can view Jetpack admin page.

비공개 메소드들

메소드 설명
core_get_plugins ( ) : array Returns a list of all plugins in the site.
core_is_plugin_active ( $plugin ) : boolean Checks if the queried plugin is active.

메소드 상세

activate_plugins_permission_check() 공개 정적인 메소드

Verify that user can view Jetpack admin page and can activate plugins.
부터: 4.3.0
public static activate_plugins_permission_check ( ) : boolean
리턴 boolean Whether user has the capability 'jetpack_admin_page' and 'activate_plugins'.

build_connect_url() 공개 정적인 메소드

Gets a new connect raw URL with fresh nonce.
부터: 4.3.0
public static build_connect_url ( ) : string | WP_Error
리턴 string | WP_Error A raw URL if the connection URL could be built; error message otherwise.

cast_value() 공개 정적인 메소드

Perform a casting to the value specified in the option definition.
부터: 4.3.0
public static cast_value ( mixed $value, array $definition ) : boolean | float | integer | string
$value mixed Value to cast to the proper type.
$definition array Type to cast the value to.
리턴 boolean | float | integer | string

configure_modules_permission_check() 공개 정적인 메소드

Verify that user can update Jetpack modules.
부터: 4.3.0
public static configure_modules_permission_check ( ) : boolean
리턴 boolean Whether user has the capability 'jetpack_configure_modules'.

confirm_safe_mode() 공개 정적인 메소드

Handles identity crisis mitigation, confirming safe mode for this site.
부터: 4.4.0
public static confirm_safe_mode ( ) : boolean
리턴 boolean | WP_Error True if option is properly set.

connect_url_permission_callback() 공개 정적인 메소드

Verify that the user can get a connect/link URL
부터: 4.3.0
public static connect_url_permission_callback ( ) : boolean | WP_Error
리턴 boolean | WP_Error True if user is able to disconnect the site.

disconnect_site() 공개 정적인 메소드

Disconnects Jetpack from the WordPress.com Servers
부터: 4.3.0
public static disconnect_site ( $data ) : boolean | WP_Error
리턴 boolean | WP_Error True if Jetpack successfully disconnected.

disconnect_site_permission_callback() 공개 정적인 메소드

Verify that the user can disconnect the site.
부터: 4.3.0
public static disconnect_site_permission_callback ( ) : boolean | WP_Error
리턴 boolean | WP_Error True if user is able to disconnect the site.

dismiss_notice() 공개 정적인 메소드

Handles dismissing of Jetpack Notices
부터: 4.3.0
public static dismiss_notice ( $data ) : array | wp-error
리턴 array | wp-error

get_module_requested() 공개 정적인 메소드

Get the currently accessed route and return the module slug in it.
부터: 4.3.0
public static get_module_requested ( string $route = '/module/(?P<slug>[a-z\-]+)' ) : array
$route string Regular expression for the endpoint with the module slug to return.
리턴 array

get_plugin() 공개 정적인 메소드

Get data about the queried plugin. Currently it only returns whether the plugin is active or not.
부터: 4.2.0
public static get_plugin ( WP_REST_Request $data ) : boolean | WP_Error
$data WP_REST_Request { Array of parameters received by request. @type string $slug Plugin slug with the syntax 'plugin-directory/plugin-main-file.php'. }
리턴 boolean | WP_Error True if module was activated. Otherwise, a WP_Error instance with the corresponding error.

get_plugin_update_count() 공개 정적인 메소드

Get number of plugin updates available.
부터: 4.3.0
public static get_plugin_update_count ( ) : mixed | WP_Error
리턴 mixed | WP_Error Number of plugin updates available. Otherwise, a WP_Error instance with the corresponding error.

get_plugins() 공개 정적인 메소드

Get plugins data in site.
부터: 4.2.0
public static get_plugins ( ) : WP_REST_Response | WP_Error
리턴 WP_REST_Response | WP_Error List of plugins in the site. Otherwise, a WP_Error instance with the corresponding error.

get_remote_value() 공개 정적인 메소드

Get a value not saved locally.
부터: 4.3.0
public static get_remote_value ( string $module, string $option ) : boolean
$module string Module slug.
$option string Option name.
리턴 boolean Whether user is receiving notifications or not.

get_settings() 공개 정적인 메소드

Get miscellaneous settings for this Jetpack installation, like Holiday Snow.
부터: 4.3.0
public static get_settings ( ) : object
리턴 object $response { Array of miscellaneous settings. @type bool $holiday-snow Did Jack steal Christmas? }

get_site_data() 공개 정적인 메소드

Get site data, including for example, the site's current plan.
부터: 4.3.0
public static get_site_data ( ) : array
리턴 array Array of Jetpack modules.

get_updateable_data_list() 공개 정적인 메소드

Returns a list of module options or general settings that can be updated.
부터: 4.3.0
부터: 4.4.0 Accepts 'any' as a parameter which will make it return the entire list.
public static get_updateable_data_list ( string | array $selector = '' ) : array
$selector string | array Module slug, 'any', or an array of parameters. If empty, it's assumed we're updating a module and we'll try to get its slug. If 'any' the full list is returned. If it's an array of parameters, includes the elements by matching keys.
리턴 array

get_updateable_parameters() 공개 정적인 메소드

Get the query parameters to update module options or general settings.
부터: 4.3.0
부터: 4.4.0 Accepts a $selector parameter.
public static get_updateable_parameters ( string $selector = '' ) : array
$selector string Selects a set of options to update, Can be empty, a module slug or 'any'.
리턴 array

get_user_connection_data() 공개 정적인 메소드

Information about the master/primary user. Information about the current user.
부터: 4.3.0
public static get_user_connection_data ( ) : object
리턴 object

get_user_connection_data_permission_callback() 공개 정적인 메소드

Only those who can connect.
부터: 4.3.0
public static get_user_connection_data_permission_callback ( ) : boolean | WP_Error
리턴 boolean | WP_Error True if user is able to unlink.

holiday_snow_option_name() 공개 정적인 메소드

When the REST route starts, the holiday-snow.php file where jetpack_holiday_snow_option_name() function is defined is not loaded, so where using this to replicate it and have the same functionality.
부터: 4.4.0
public static holiday_snow_option_name ( ) : string
리턴 string

identity_crisis_mitigation_permission_check() 공개 정적인 메소드

Verify that user can mitigate an identity crisis.
부터: 4.4.0
public static identity_crisis_mitigation_permission_check ( ) : boolean
리턴 boolean Whether user has capability 'jetpack_disconnect'.

jetpack_connection_status() 공개 정적인 메소드

Get connection status for this Jetpack site.
부터: 4.3.0
public static jetpack_connection_status ( ) : boolean
리턴 boolean True if site is connected

jumpstart_activate() 공개 정적인 메소드

Activates a series of valid Jetpack modules and initializes some options.
부터: 4.3.0
public static jumpstart_activate ( WP_REST_Request $data ) : boolean | WP_Error
$data WP_REST_Request { Array of parameters received by request. }
리턴 boolean | WP_Error True if Jumpstart succeeded. Otherwise, a WP_Error instance with the corresponding error.

jumpstart_deactivate() 공개 정적인 메소드

Dismisses Jumpstart so user is not prompted to go through it again.
부터: 4.3.0
public static jumpstart_deactivate ( WP_REST_Request $data ) : boolean | WP_Error
$data WP_REST_Request { Array of parameters received by request. }
리턴 boolean | WP_Error True if Jumpstart was disabled or was nothing to dismiss. Otherwise, a WP_Error instance with a message.

jumpstart_toggle() 공개 정적인 메소드

Toggles activation or deactivation of the JumpStart
부터: 4.3.0
public static jumpstart_toggle ( WP_REST_Request $data ) : boolean | WP_Error
$data WP_REST_Request { Array of parameters received by request. }
리턴 boolean | WP_Error True if toggling Jumpstart succeeded. Otherwise, a WP_Error instance with the corresponding error.

manage_modules_permission_check() 공개 정적인 메소드

Verify that user can manage Jetpack modules.
부터: 4.3.0
public static manage_modules_permission_check ( ) : boolean
리턴 boolean Whether user has the capability 'jetpack_manage_modules'.

migrate_stats_and_subscribers() 공개 정적인 메소드

Handles identity crisis mitigation, migrating stats and subscribers from old url to this, new url.
부터: 4.4.0
public static migrate_stats_and_subscribers ( ) : boolean
리턴 boolean | WP_Error True if option is properly set.

prepare_modules_for_response() 공개 정적인 메소드

Adds extra information for modules.
부터: 4.3.0
public static prepare_modules_for_response ( string $modules = '', null | string $slug = null ) : array
$modules string Can be a single module or a list of modules.
$slug null | string Slug of the module in the first parameter.
리턴 array

prepare_options_for_response() 공개 정적인 메소드

Fetch current option value and add to array of module options. Prepare values of module options that need special handling, like those saved in wpcom.
부터: 4.3.0
public static prepare_options_for_response ( string $module = '' ) : array
$module string Module slug.
리턴 array

register_endpoints() 공개 정적인 메소드

Declare the Jetpack REST API endpoints.
부터: 4.3.0
public static register_endpoints ( )

reset_jetpack_options() 공개 정적인 메소드

Reset Jetpack options
부터: 4.3.0
public static reset_jetpack_options ( WP_REST_Request $data ) : boolean | WP_Error
$data WP_REST_Request { Array of parameters received by request. @type string $options Available options to reset are options|modules }
리턴 boolean | WP_Error True if options were reset. Otherwise, a WP_Error instance with the corresponding error.

rest_authorization_required_code() 공개 정적인 메소드

Taken from rest_authorization_required_code() in WP-API plugin until is added to core.
또한 보기: https://github.com/WP-API/WP-API/commit/7ba0ae6fe4f605d5ffe4ee85b1cd5f9fb46900a6
부터: 4.3.0
public static rest_authorization_required_code ( ) : integer
리턴 integer

route() 공개 정적인 메소드

public static route ( $path, $classname, $method, $constructor_arguments = NULL, $endpoint_arguments = NULL )

sanitize_stats_allowed_roles() 공개 정적인 메소드

If for some reason the roles allowed to see Stats are empty (for example, user tampering with checkboxes), return an array with only 'administrator' as the allowed role and save it for 'roles' option.
부터: 4.3.0
public static sanitize_stats_allowed_roles ( string | boolean $value ) : boolean
$value string | boolean Value to check.
리턴 boolean

split_options() 공개 정적인 메소드

Splits module options saved as arrays like relatedposts or verification_services_codes into separate options to be returned in the response.
부터: 4.3.0
public static split_options ( array $separate_options, array $grouped_options, string $prefix = '' ) : array
$separate_options array Array of options admitted by the module.
$grouped_options array Option saved as array to be splitted.
$prefix string Optional prefix for the separate option keys.
리턴 array

start_fresh_connection() 공개 정적인 메소드

It will first will disconnect the site without phoning home as to not disturb the production site. It then builds a fresh connection URL and sends it back along with the response.
부터: 4.4.0
public static start_fresh_connection ( ) : boolean | WP_Error
리턴 boolean | WP_Error

update_setting() 공개 정적인 메소드

Update a single miscellaneous setting for this Jetpack installation, like Holiday Snow.
부터: 4.3.0
public static update_setting ( WP_REST_Request $data ) : object
$data WP_REST_Request
리턴 object Jetpack miscellaneous settings.

update_settings_permission_check() 공개 정적인 메소드

Verify that user can update Jetpack general settings.
부터: 4.3.0
public static update_settings_permission_check ( ) : boolean
리턴 boolean Whether user has the capability 'update_settings_permission_check'.

validate_alphanum() 공개 정적인 메소드

Validates that the parameter is an alphanumeric or empty string (to be able to clear the field).
부터: 4.3.0
public static validate_alphanum ( string $value = '', WP_REST_Request $request, string $param ) : boolean
$value string Value to check.
$request WP_REST_Request
$param string Name of the parameter passed to endpoint holding $value.
리턴 boolean

validate_boolean() 공개 정적인 메소드

Validates that the parameter is either a pure boolean or a numeric string that can be mapped to a boolean.
부터: 4.3.0
public static validate_boolean ( string | boolean $value, WP_REST_Request $request, string $param ) : boolean
$value string | boolean Value to check.
$request WP_REST_Request
$param string Name of the parameter passed to endpoint holding $value.
리턴 boolean

validate_custom_service() 공개 정적인 메소드

Validates that the parameter has enough information to build a custom sharing button.
부터: 4.3.0
public static validate_custom_service ( string | boolean $value, WP_REST_Request $request, string $param ) : boolean
$value string | boolean Value to check.
$request WP_REST_Request
$param string Name of the parameter passed to endpoint holding $value.
리턴 boolean

validate_custom_service_id() 공개 정적인 메소드

Validates that the parameter is a custom sharing service ID like 'custom-1461976264'.
부터: 4.3.0
public static validate_custom_service_id ( string $value = '', WP_REST_Request $request, string $param ) : boolean
$value string Value to check.
$request WP_REST_Request
$param string Name of the parameter passed to endpoint holding $value.
리턴 boolean

validate_list_item() 공개 정적인 메소드

Validates that the parameter belongs to a list of admitted values.
부터: 4.3.0
public static validate_list_item ( string $value = '', WP_REST_Request $request, string $param ) : boolean
$value string Value to check.
$request WP_REST_Request
$param string Name of the parameter passed to endpoint holding $value.
리턴 boolean

validate_module_list() 공개 정적인 메소드

Validates that the parameter belongs to a list of admitted values.
부터: 4.3.0
public static validate_module_list ( string $value = '', WP_REST_Request $request, string $param ) : boolean
$value string Value to check.
$request WP_REST_Request
$param string Name of the parameter passed to endpoint holding $value.
리턴 boolean

validate_posint() 공개 정적인 메소드

Validates that the parameter is a positive integer.
부터: 4.3.0
public static validate_posint ( integer $value, WP_REST_Request $request, string $param ) : boolean
$value integer Value to check.
$request WP_REST_Request
$param string Name of the parameter passed to endpoint holding $value.
리턴 boolean

validate_services() 공개 정적인 메소드

Validates that the parameter is among the views where the Sharing can be displayed.
부터: 4.3.0
public static validate_services ( string | boolean $value, WP_REST_Request $request, string $param ) : boolean
$value string | boolean { Value to check received by request. @type array $visible List of slug of services to share to that are displayed directly in the page. @type array $hidden List of slug of services to share to that are concealed in a folding menu. }
$request WP_REST_Request
$param string Name of the parameter passed to endpoint holding $value.
리턴 boolean

validate_sharing_show() 공개 정적인 메소드

Validates that the parameter is among the views where the Sharing can be displayed.
부터: 4.3.0
public static validate_sharing_show ( string | boolean $value, WP_REST_Request $request, string $param ) : boolean
$value string | boolean Value to check.
$request WP_REST_Request
$param string Name of the parameter passed to endpoint holding $value.
리턴 boolean

validate_stats_roles() 공개 정적인 메소드

Validates that the parameter is among the roles allowed for Stats.
부터: 4.3.0
public static validate_stats_roles ( string | boolean $value, WP_REST_Request $request, string $param ) : boolean
$value string | boolean Value to check.
$request WP_REST_Request
$param string Name of the parameter passed to endpoint holding $value.
리턴 boolean

validate_string() 공개 정적인 메소드

Validates that the parameter is a string.
부터: 4.3.0
public static validate_string ( string $value = '', WP_REST_Request $request, string $param ) : boolean
$value string Value to check.
$request WP_REST_Request
$param string Name of the parameter passed to endpoint holding $value.
리턴 boolean

validate_twitter_username() 공개 정적인 메소드

Validates that the parameter is a Twitter username or empty string (to be able to clear the field).
부터: 4.3.0
public static validate_twitter_username ( string $value = '', WP_REST_Request $request, string $param ) : boolean
$value string Value to check.
$request WP_REST_Request
$param string Name of the parameter passed to endpoint holding $value.
리턴 boolean

view_admin_page_permission_check() 공개 정적인 메소드

Verify that user can view Jetpack admin page.
부터: 4.3.0
public static view_admin_page_permission_check ( ) : boolean
리턴 boolean Whether user has the capability 'jetpack_admin_page'.

프로퍼티 상세

$stats_roles 공개적으로 정적으로 프로퍼티

Roles that can access Stats once they're granted access.
public static $stats_roles

$user_permissions_error_msg 공개적으로 정적으로 프로퍼티

Generic error message when user is not allowed to perform an action.
public static $user_permissions_error_msg