PHP Класс Jetpack, jetpack

См. также: Jetpack_Options::get_option_names() jetpack_register (string) Temporary verification secrets. jetpack_activated (int) 1: the plugin was activated normally 2: the plugin was activated on this site because of a network-wide activation 3: the plugin was auto-installed 4: the plugin was manually disconnected (but is still installed) jetpack_active_modules (array) Array of active module slugs. jetpack_do_activate (bool) Flag for "activating" the plugin on sites where the activation hook never fired (auto-installs)
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$HTTP_RAW_POST_DATA
$capability_translations
$concatenated_style_handles The handles of styles that are concatenated into jetpack.css
$error string Error to display in admin_notice
$instance Jetpack Holds the singleton instance of this class
$json_api_authorization_request Verified data for JSON authorization request
$message string Message to display in admin_notice
$plugins_to_deactivate
$privacy_checks string Modules that need more privacy description.
$stats array Stats to record once the page loads
$sync Jetpack_Sync object
$xmlrpc_server

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

Метод Описание
__destruct ( ) If there are any stats that need to be pushed, but haven't been, push them now.
absolutize_css_urls ( $css, $css_file_url ) : mixed | string Converts any url in a stylesheet, to the correct absolute url.
activate_default_modules ( $min_version = false, $max_version = false, $other_modules = [], $redirect = true )
activate_manage ( )
activate_module ( $module, $exit = true, $redirect = true )
activate_module_actions ( $module )
activate_new_modules ( $redirect = false )
active_plan_supports ( $feature ) : boolean Determine whether the active plan supports a particular feature
add_jetpack_pagestyles ( $admin_body_class = '' )
add_nonce ( $timestamp, $nonce )
add_remote_request_handlers ( )
add_token_to_login_redirect_json_api_authorization ( $redirect_to, $original_redirect_to, $user ) Add the Access Code details to the public-api.wordpress.com redirect
admin_banner_styles ( )
admin_body_class ( $admin_body_class = '' )
admin_head ( )
admin_help ( ) : false Add help to the Jetpack page
admin_init ( ) * Admin Pages
admin_jetpack_manage_notice ( ) : null This is the first banner It should be visible only to user that can update the option Are not connected
admin_menu_css ( )
admin_menu_order ( )
admin_notices ( )
admin_page_load ( ) Handles the page load events for the Jetpack admin page
admin_screen_configure_module ( $module_id )
admin_url ( $args = null )
ajax_recheck_ssl ( )
alert_auto_ssl_fail ( ) * Displays an admin_notice, alerting the user to their JETPACK_CLIENT__HTTPS constant being 'AUTO' but SSL isn't working.
allow_wpcom_public_api_domain ( $domains ) Add public-api.wordpress.com to the safe redirect whitelist - only added when someone allows API access
api_url ( $relative_url ) : string Returns the requested Jetpack API URL
authenticate_jetpack ( $user, $username, $password ) Authenticates XML-RPC and other requests from the Jetpack Server
bail_on_activation ( $message, $deactivate = true ) * Installation
build_connect_url ( boolean $raw = false, boolean | string $redirect = false, boolean | string $from = false ) : string Builds a URL to the Jetpack connection auth page
build_raw_urls ( $url ) * Strip http:// or https:// from a url, replaces forward slash with ::, so we can bring them directly to their site in calypso.
build_reconnect_url ( $raw = false )
build_stats_url ( $args ) : string Builds the stats url.
can_display_jetpack_manage_notice ( ) : (bool) Determines whether to show the notice of not true = display notice
catch_errors ( boolean $catch ) Catches PHP errors. Must be used in conjunction with output buffering.
catch_errors_on_shutdown ( ) Saves any generated PHP errors in ::state( 'php_errors', {errors} )
check_identity_crisis ( ) : array | boolean Checks if the site is currently in an identity crisis.
check_open_graph ( ) : null Check if Jetpack's Open Graph tags should be used.
check_privacy ( $file )
check_rest_api_compat ( ) : null Check if Jetpack's REST API compat file should be included
check_twitter_tags ( ) : null Check if Jetpack's Twitter tags should be used.
clean_nonces ( $all = false )
concat_remove_style_loader_tag ( $tag, $handle )
create_nonce ( $name ) Stores two secrets and a timestamp so WordPress.com can make a request back and verify an action Does some extra verification so urls (such as those to public-api, register, etc) can't just be crafted $name must be a registered option name.
current_user_is_connection_owner ( )
dashboard_widget ( )
dashboard_widget_connect_to_wpcom ( )
dashboard_widget_footer ( )
deactivate_module ( $module )
debugger_page ( )
delete_active_modules ( )
delete_option ( string | array $names ) Deletes the given option. May be passed multiple option names as an array.
deprecated_hooks ( ) Throws warnings for deprecated hooks to be removed from Jetpack
devicepx ( ) Device Pixels support This improves the resolution of gravatars and wordpress.com uploads on hi-res and zoomed browsers.
disconnect ( $update_activated_state = true ) Disconnects from the Jetpack servers.
dismiss_jetpack_notice ( )
display_activate_module_link ( string $module_id ) : null Display link to activate the module to see the settings screen.
dns_prefetch ( mixed $new_urls = null ) Stores and prints out domains to prefetch for page speed optimization.
do_server_side_stat ( $args ) : boolean Runs stats code for a one-off, server-side.
do_stats ( $method = '' ) Load stats pixels. $group is auto-prefixed with "x_jetpack-"
do_version_bump ( (string) $version, (string) $old_version ) : null Runs before bumping version numbers up to a new version
enable_module_configurable ( $module )
extra_oembed_providers ( ) Add any extra oEmbed providers that we know about and use on wpcom for feature parity.
featured_images_enabled ( ) : string Determines whether the current theme supports featured images or not.
file_system_write_access ( ) : string Returns true if the site has file write access false otherwise.
filter_default_modules ( array $modules ) : array Checks activated plugins during auto-activation to determine if any of those plugins are in the list with a corresponding module that is not compatible with the plugin. The module will not be allowed to auto-activate.
fix_url_for_bad_hosts ( $url ) Some hosts disable the OpenSSL extension and so cannot make outgoing HTTPS requsets
generate_secrets ( $action, $exp = 600 ) : array Creates two secret tokens and the end of life timestamp for them.
get_active_modules ( ) Get a list of activated modules as an array of module slugs.
get_active_plan ( ) : array Get the plan that this Jetpack site is currently using
get_active_plugins ( ) Gets all plugins currently active in values, regardless of whether they're traditionally activated or network activated.
get_additional_stat_data ( $prefix = '' ) Get additional stat data to sync to WPCOM
get_available_modules ( $min_version = false, $max_version = false ) List available Jetpack modules. Simply lists .php files in /modules/.
get_avatar_url ( integer | string | object $id_or_email, integer $size = 96, string $default = '', boolean $force_display = false ) : array Centralize the function here until it gets added to core.
get_cloud_site_options ( string | array $option_names ) : array Pings the WordPress.com Mirror Site for the specified options.
get_connected_user_data ( $user_id = null ) Get the wpcom user data of the current|specified connected user.
get_connected_user_email ( $user_id = null ) Get the wpcom email of the current|specified connected user.
get_content_width ( ) Get $content_width, but with a twist filter.
get_default_modules ( $min_version = false, $max_version = false ) Default modules loaded on activation.
get_file_data ( $file, $headers ) Like core's get_file_data implementation, but caches the result.
get_jetpack_options_for_reset ( ) * This method is used to organize all options that can be reset without disconnecting Jetpack.
get_jp_emblem ( ) : string Return string containing the Jetpack logo.
get_locale ( ) : string | boolean Get the locale.
get_log ( $event = false, $num = false ) : array Get the internal event log.
get_master_user_email ( ) Get the wpcom email of the master user.
get_module ( $module ) Load module data from module file. Headers differ from WordPress plugin headers to avoid them being identified as standalone plugins on the WordPress plugins page.
get_module_path ( $slug ) Generate a module's path from its slug.
get_module_slug ( $file ) Extract a module's slug from its full path.
get_option ( string $name, mixed $default = false ) Returns the requested option. Looks in jetpack_options or jetpack_$name as appropriate.
get_option_names ( $type = 'compact' ) * Jetpack Options API
get_other_linked_admins ( ) : mixed Checks to see if there are any other users available to become primary Users must both: - Be linked to wpcom - Be an admin
get_parsed_plugin_data ( ) : array Gets and parses additional plugin data to send with the heartbeat data
get_parsed_theme_data ( ) : array Gets and parses theme data to send with the heartbeat data
get_remote_query_timeout_limit ( ) : integer Builds the timeout limit for queries talking with the wpcom servers.
get_stat_data ( $encode = true, $extended = true ) Return stat data for WPCOM sync
get_sync_error_idc_option ( array $response = [] ) : array Gets the value that is to be saved in the jetpack_sync_error_idc option.
get_translated_modules ( array $modules ) : string | void Return module name translation. Uses matching string created in modules/module-headings.php.
get_update_details ( )
get_updates ( ) : array jetpack_updates is saved in the following schema:
get_user_option_meta_box_order_dashboard ( $sorted ) : mixed
glob_php ( string $absolute_path ) : array Returns an array of all PHP files in the specified absolute path.
guess_locale_from_lang ( string $lang ) : string | boolean Guess locale from language code.
handle_deprecated_modules ( array $modules ) : array Checks activated modules during auto-activation to determine if any of those modules are being deprecated. If so, close them out, and add any replacement modules.
implode_frontend_css ( $travis_test = false ) This methods removes all of the registered css files on the front end from Jetpack in favor of using a single file. In effect "imploding" all the files into one file.
init ( ) Singleton
intercept_plugin_error_scrape ( $action, $result )
intercept_plugin_error_scrape_init ( )
is_active ( ) Is Jetpack active?
is_development_mode ( ) Is Jetpack in development (offline) mode?
is_development_version ( ) Whether Jetpack's version maps to a public release, or a development version.
is_main_network_option ( boolean $option ) : boolean Return whether we are dealing with a multi network setup or not.
is_module ( $module )
is_module_active ( string $module ) : boolean Check whether or not a Jetpack module is active.
is_multi_network ( ) : boolean Implemented since there is no core is multi network function Right now there is no way to tell if we which network is the dominant network on the system
is_multisite ( string $option ) : boolean Return true if we are with multi-site or multi-network false if we are dealing with single site.
is_plugin_active ( $plugin = 'jetpack/jetpack.php' ) Checks whether a specific plugin is active.
is_single_user_site ( ) : boolean Get back if the current site is single user site.
is_staging_site ( ) : boolean Checks whether the home and siteurl specifically are whitelisted Written so that we don't have re-check $key and $value params every time we want to check if this site is whitelisted, for example in footer.php
is_user_connected ( $user_id = false ) Is a given user (or the current user if none is specified) linked to a WordPress.com user?
is_version_controlled ( ) : string Finds out if a site is using a version control system.
jetpack_admin_ajax_tracks_callback ( )
jetpack_check_heartbeat_data ( ) * Check the heartbeat data
jetpack_custom_caps ( $caps, $cap, $user_id, $args )
jetpack_getOptions ( $args )
jetpack_icon_user_connected ( $columns ) * Adds a "blank" column in the user admin table to display indication of user connection.
jetpack_jitm_ajax_callback ( ) The callback for the JITM ajax requests.
jetpack_main_network_site_option ( boolean $option ) : string Return the network_site_url so that .com knows what network this site is a part of.
jetpack_menu_order ( $menu_order )
jetpack_show_user_connected_icon ( $val, $col, $user_id ) * Show Jetpack icon if the user is linked.
jetpack_user_col_style ( ) * Style the Jetpack user column
jumpstart_has_updated_module_option ( string $option_name = '' ) : boolean Check if an option of a Jetpack module has been updated.
load_modules ( ) Loads the currently active modules.
load_view ( string $template, array $data = [] ) : boolean Loads a view file from the views
load_xml_rpc_client ( ) Loads the Jetpack XML-RPC client
log ( $code, $data = null ) Tracking an internal event log. Try not to put too much chaff in here.
log_settings_change ( $option, $old_value, $value ) Log modification of important settings.
login_form_json_api_authorization ( ) Handles the login action for Authorizing the JSON API
login_message_json_api_authorization ( $message )
manage_activate_screen ( )
maybe_clear_other_linked_admins_transient ( integer $user_id, string $role, array $old_roles = null ) If a user has been promoted to or demoted from admin, we need to clear the jetpack_other_linked_admins transient.
maybe_inline_style ( string $tag, string $handle ) : string Maybe inlines a stylesheet.
maybe_min_asset ( $url, $path, $plugin ) Maybe Use a .min.css stylesheet, maybe not.
maybe_set_version_option ( ) : bool: If the db version is showing something other that what we've got now, bump it to current.
module_configuration_activation_screen ( $module, $method )
module_configuration_head ( $module, $method )
module_configuration_load ( $module, $method )
module_configuration_screen ( $module, $method )
module_configuration_url ( $module )
network_add_new_users ( $option = null ) : boolian Does the network allow admins to add new users.
network_allow_new_registrations ( $option = null ) : string Does the network allow new user and site registrations.
network_enable_administration_menus ( $option = null ) : array Lets us know if a site allows admins to manage the network.
network_max_upload_file_size ( $option = null ) : number Maximum file upload size set by the network.
network_name ( $option = null ) Network Name.
network_site_upload_space ( $option = null ) : number File upload psace left per site in MB.
network_upload_file_types ( $option = null ) : string Network allowed file types.
nonce_url_no_esc ( $actionurl, $action, $name = '_wpnonce' )
normalize_url_protocol_agnostic ( string $url ) : WP_Error | string Normalizes a url by doing three things: - Strips protocol - Strips www - Adds a trailing slash
opt_in_jetpack_manage_notice ( )
opt_in_jetpack_manage_url ( ) : (string) Returns the url that the user clicks to opt in to Jetpack Manage
opt_out_jetpack_manage_url ( ) : (string) Returns the url that the user clicks to remove the notice for the big banner
permit_ssl ( $force_recheck = false ) : boolean Checks to see if the URL is using SSL to connect with Jetpack
plugin_action_links ( $actions )
plugin_activation ( $network_wide ) Attached to activate_{ plugin_basename( __FILES__ ) } by register_activation_hook()
plugin_deactivation ( ) Removes all connection options
plugin_initialize ( ) Sets the internal version number and activation state.
plugin_textdomain ( ) Load language files
plugin_upgrade ( ) Must never be called statically
post_login_form_to_signed_url ( $url, $path, $scheme ) Make sure the login form is POSTed to the signed URL so we can reverify the request
prepare_manage_jetpack_notice ( ) : null Call this function if you want the Big Jetpack Manage Notice to show up.
preserve_action_in_login_form_for_json_api_authorization ( ) Make sure the POSTed request is handled by the same action
public_xmlrpc_methods ( $methods )
refresh_active_plan_from_wpcom ( ) : boolean Make an API call to WordPress.com for plan status
refresh_theme_data ( )
refresh_update_data ( )
register ( ) : boolean | WP_Error
register_assets ( ) : null Register assets for use in various modules and the Jetpack admin page.
remote_request_handlers ( )
require_jetpack_authentication ( )
restate ( )
show_development_mode_notice ( ) Get Jetpack development mode notice text and notice class.
sign_role ( $role )
sort_modules ( $a, $b )
stat ( $group, $detail ) Record a stat for later output. This will only currently output in the admin_footer.
state ( string $key = null, string $value = null, boolean $restate = false ) State is passed via cookies from one request to the next, but never to subsequent requests.
staticize_subdomain ( $url )
store_json_api_authorization_token ( $user_login, $user ) If someone logs in to approve API access, store the Access Code in usermeta
submit_security_report ( string $type = '', string $plugin_file = '', array $args = [] ) Allows plugins to submit security reports.
sync_idc_optin ( ) : boolean Returns the value of the jetpack_sync_idc_optin filter, or constant.
throw_error_on_activate_plugin ( string $plugin ) Sometimes a plugin can activate without causing errors, but it will cause errors on the next page load.
translate_current_user_to_role ( )
translate_module_tag ( string $tag ) : mixed Return translated module tag.
translate_role_to_cap ( $role )
try_registration ( ) Attempts Jetpack registration. If it fail, a state flag is set: @see ::admin_page_load()
unlink_user ( $user_id = null ) Unlinks the current user from the linked WordPress.com user
update_active_modules ( $modules )
update_jetpack_main_network_site_option ( ) : null Trigger an update to the main_network_site when we update the siteurl of a site.
update_jetpack_network_settings ( ) Triggered after a user updates the network settings via Network Settings Admin Page
update_option ( string $name, mixed $value ) Updates the single given option. Updates jetpack_options or jetpack_$name as appropriate.
update_options ( array $array ) Updates the multiple given options. Updates jetpack_options and/or jetpack_$name as appropriate.
update_user_token ( integer $user_id, string $token, $is_master_user ) Enters a user token into the user_tokens option
upload_handler ( )
user_role_change ( $user_id ) Synchronize connected user role changes
validate_remote_register_response ( $response ) : true Takes the response from the Jetpack register new site endpoint and verifies it worked properly.
validate_sync_error_idc_option ( ) : boolean Checks whether the sync_error_idc option is valid or not, and if not, will do cleanup.
verify_json_api_authorization_request ( ) Verifies the request by checking the signature
verify_xml_rpc_signature ( )
wp_dashboard_setup ( )
xmlrpc_api_url ( ) : string Returns the Jetpack XML-RPC API
xmlrpc_async_call ( ) Helper method for multicall XMLRPC.
xmlrpc_methods ( $methods ) In some setups, $HTTP_RAW_POST_DATA can be emptied during some IXR_Server paths since it is passed by reference to various methods.
xmlrpc_options ( $options )

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

Метод Описание
__construct ( ) Constructor. Initializes WordPress hooks
get_site_user_count ( )

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

__destruct() публичный Метод

If there are any stats that need to be pushed, but haven't been, push them now.
public __destruct ( )

absolutize_css_urls() публичный статический Метод

Considerations: - Normal, relative URLs feh.png - Data URLs data:image/gif;base64,eh129ehiuehjdhsa== - Schema-agnostic URLs //domain.com/feh.png - Absolute URLs http://domain.com/feh.png - Domain root relative URLs /feh.png
public static absolutize_css_urls ( $css, $css_file_url ) : mixed | string
$css string: The raw CSS -- should be read in directly from the file.
$css_file_url : The URL that the file can be accessed at, for calculating paths from.
Результат mixed | string

activate_default_modules() публичный статический Метод

public static activate_default_modules ( $min_version = false, $max_version = false, $other_modules = [], $redirect = true )

activate_manage() статический публичный Метод

static public activate_manage ( )

activate_module() публичный статический Метод

public static activate_module ( $module, $exit = true, $redirect = true )

activate_module_actions() публичный Метод

public activate_module_actions ( $module )

activate_new_modules() публичный статический Метод

public static activate_new_modules ( $redirect = false )

active_plan_supports() публичный статический Метод

Determine whether the active plan supports a particular feature
public static active_plan_supports ( $feature ) : boolean
Результат boolean True if plan supports feature, false if not

add_jetpack_pagestyles() статический публичный Метод

static public add_jetpack_pagestyles ( $admin_body_class = '' )

add_nonce() публичный Метод

public add_nonce ( $timestamp, $nonce )

add_remote_request_handlers() публичный Метод

add_token_to_login_redirect_json_api_authorization() публичный Метод

Add the Access Code details to the public-api.wordpress.com redirect
public add_token_to_login_redirect_json_api_authorization ( $redirect_to, $original_redirect_to, $user )

admin_banner_styles() публичный Метод

public admin_banner_styles ( )

admin_body_class() публичный Метод

public admin_body_class ( $admin_body_class = '' )

admin_head() публичный Метод

public admin_head ( )

admin_help() публичный Метод

Add help to the Jetpack page
public admin_help ( ) : false
Результат false if not the Jetpack page

admin_init() публичный Метод

* Admin Pages
public admin_init ( )

admin_jetpack_manage_notice() публичный Метод

This is the first banner It should be visible only to user that can update the option Are not connected
public admin_jetpack_manage_notice ( ) : null
Результат null

admin_menu_css() публичный Метод

public admin_menu_css ( )

admin_menu_order() публичный Метод

public admin_menu_order ( )

admin_notices() публичный Метод

public admin_notices ( )

admin_page_load() публичный Метод

Handles the page load events for the Jetpack admin page
public admin_page_load ( )

admin_screen_configure_module() публичный статический Метод

public static admin_screen_configure_module ( $module_id )

admin_url() публичный статический Метод

public static admin_url ( $args = null )

ajax_recheck_ssl() публичный Метод

public ajax_recheck_ssl ( )

alert_auto_ssl_fail() публичный Метод

* Displays an admin_notice, alerting the user to their JETPACK_CLIENT__HTTPS constant being 'AUTO' but SSL isn't working.
public alert_auto_ssl_fail ( )

allow_wpcom_public_api_domain() публичный Метод

Add public-api.wordpress.com to the safe redirect whitelist - only added when someone allows API access
public allow_wpcom_public_api_domain ( $domains )

api_url() публичный статический Метод

Returns the requested Jetpack API URL
public static api_url ( $relative_url ) : string
Результат string

authenticate_jetpack() публичный Метод

Authenticates XML-RPC and other requests from the Jetpack Server
public authenticate_jetpack ( $user, $username, $password )

bail_on_activation() публичный статический Метод

* Installation
public static bail_on_activation ( $message, $deactivate = true )

build_connect_url() публичный Метод

Builds a URL to the Jetpack connection auth page
С версии: 3.9.5
public build_connect_url ( boolean $raw = false, boolean | string $redirect = false, boolean | string $from = false ) : string
$raw boolean If true, URL will not be escaped.
$redirect boolean | string If true, will redirect back to Jetpack wp-admin landing page after connection. If string, will be a custom redirect.
$from boolean | string If not false, adds 'from=$from' param to the connect URL.
Результат string Connect URL

build_raw_urls() публичный статический Метод

* Strip http:// or https:// from a url, replaces forward slash with ::, so we can bring them directly to their site in calypso.
public static build_raw_urls ( $url )

build_reconnect_url() публичный Метод

public build_reconnect_url ( $raw = false )

build_stats_url() статический публичный Метод

Builds the stats url.
static public build_stats_url ( $args ) : string
$args array|string The arguments to append to the URL.
Результат string The URL to be pinged.

can_display_jetpack_manage_notice() публичный Метод

Determines whether to show the notice of not true = display notice
public can_display_jetpack_manage_notice ( ) : (bool)
Результат (bool)

catch_errors() публичный статический Метод

Catches PHP errors. Must be used in conjunction with output buffering.
public static catch_errors ( boolean $catch )
$catch boolean True to start catching, False to stop.

catch_errors_on_shutdown() публичный статический Метод

Saves any generated PHP errors in ::state( 'php_errors', {errors} )
public static catch_errors_on_shutdown ( )

check_identity_crisis() публичный статический Метод

Checks if the site is currently in an identity crisis.
public static check_identity_crisis ( ) : array | boolean
Результат array | boolean Array of options that are in a crisis, or false if everything is OK.

check_open_graph() публичный Метод

If certain plugins are active, Jetpack's og tags are suppressed.
public check_open_graph ( ) : null
Результат null

check_privacy() публичный статический Метод

public static check_privacy ( $file )

check_rest_api_compat() публичный Метод

Check if Jetpack's REST API compat file should be included
public check_rest_api_compat ( ) : null
Результат null

check_twitter_tags() публичный Метод

If certain plugins are active, Jetpack's twitter tags are suppressed.
public check_twitter_tags ( ) : null
Результат null

clean_nonces() публичный статический Метод

public static clean_nonces ( $all = false )

concat_remove_style_loader_tag() публичный Метод

public concat_remove_style_loader_tag ( $tag, $handle )

create_nonce() публичный статический Метод

Stores two secrets and a timestamp so WordPress.com can make a request back and verify an action Does some extra verification so urls (such as those to public-api, register, etc) can't just be crafted $name must be a registered option name.
public static create_nonce ( $name )

current_user_is_connection_owner() публичный Метод

dashboard_widget() публичный статический Метод

public static dashboard_widget ( )

dashboard_widget_connect_to_wpcom() публичный Метод

deactivate_module() публичный статический Метод

public static deactivate_module ( $module )

debugger_page() публичный Метод

public debugger_page ( )

delete_active_modules() статический публичный Метод

static public delete_active_modules ( )

delete_option() публичный статический Метод

Updates jetpack_options and/or deletes jetpack_$name as appropriate.
Устаревший: 3.4 use Jetpack_Options::delete_option() instead.
public static delete_option ( string | array $names )
$names string | array

deprecated_hooks() публичный Метод

Throws warnings for deprecated hooks to be removed from Jetpack
public deprecated_hooks ( )

devicepx() публичный Метод

Device Pixels support This improves the resolution of gravatars and wordpress.com uploads on hi-res and zoomed browsers.
public devicepx ( )

disconnect() публичный статический Метод

Forgets all connection details and tells the Jetpack servers to do the same.
public static disconnect ( $update_activated_state = true )

dismiss_jetpack_notice() публичный Метод

dns_prefetch() публичный статический Метод

Stores and prints out domains to prefetch for page speed optimization.
public static dns_prefetch ( mixed $new_urls = null )
$new_urls mixed

do_server_side_stat() статический публичный Метод

Runs stats code for a one-off, server-side.
static public do_server_side_stat ( $args ) : boolean
$args array|string The arguments to append to the URL. Should include `x_jetpack-{$group}={$stats}` or whatever we want to store.
Результат boolean If it worked.

do_stats() публичный Метод

Load stats pixels. $group is auto-prefixed with "x_jetpack-"
public do_stats ( $method = '' )

do_version_bump() публичный статический Метод

Runs before bumping version numbers up to a new version
public static do_version_bump ( (string) $version, (string) $old_version ) : null
$version (string)
$old_version (string)
Результат null [description]

enable_module_configurable() публичный статический Метод

public static enable_module_configurable ( $module )

extra_oembed_providers() публичный Метод

Add any extra oEmbed providers that we know about and use on wpcom for feature parity.

file_system_write_access() публичный статический Метод

Returns true if the site has file write access false otherwise.
public static file_system_write_access ( ) : string
Результат string ( '1' | '0' )

filter_default_modules() публичный Метод

Checks activated plugins during auto-activation to determine if any of those plugins are in the list with a corresponding module that is not compatible with the plugin. The module will not be allowed to auto-activate.
С версии: 2.6
public filter_default_modules ( array $modules ) : array
$modules array
Результат array

fix_url_for_bad_hosts() публичный статический Метод

Some hosts disable the OpenSSL extension and so cannot make outgoing HTTPS requsets
public static fix_url_for_bad_hosts ( $url )

generate_secrets() публичный Метод

Note these tokens are unique per call, NOT static per site for connecting.
С версии: 2.6
public generate_secrets ( $action, $exp = 600 ) : array
Результат array

get_active_modules() публичный статический Метод

Get a list of activated modules as an array of module slugs.
public static get_active_modules ( )

get_active_plan() публичный статический Метод

Get the plan that this Jetpack site is currently using
public static get_active_plan ( ) : array
Результат array Active Jetpack plan details

get_active_plugins() публичный статический Метод

Gets all plugins currently active in values, regardless of whether they're traditionally activated or network activated.
public static get_active_plugins ( )

get_additional_stat_data() публичный статический Метод

Get additional stat data to sync to WPCOM
public static get_additional_stat_data ( $prefix = '' )

get_available_modules() публичный статический Метод

Make sure to tuck away module "library" files in a sub-directory.
public static get_available_modules ( $min_version = false, $max_version = false )

get_avatar_url() публичный статический Метод

Centralize the function here until it gets added to core.
public static get_avatar_url ( integer | string | object $id_or_email, integer $size = 96, string $default = '', boolean $force_display = false ) : array
$id_or_email integer | string | object A user ID, email address, or comment object
$size integer Size of the avatar image
$default string URL to a default image to use if no avatar is available
$force_display boolean Whether to force it to return an avatar even if show_avatars is disabled
Результат array First element is the URL, second is the class.

get_cloud_site_options() публичный Метод

Pings the WordPress.com Mirror Site for the specified options.
public get_cloud_site_options ( string | array $option_names ) : array
$option_names string | array The option names to request from the WordPress.com Mirror Site
Результат array An associative array of the option values as stored in the WordPress.com Mirror Site

get_connected_user_data() публичный статический Метод

Get the wpcom user data of the current|specified connected user.
public static get_connected_user_data ( $user_id = null )

get_connected_user_email() публичный статический Метод

Get the wpcom email of the current|specified connected user.
public static get_connected_user_email ( $user_id = null )

get_content_width() публичный статический Метод

Get $content_width, but with a twist filter.
public static get_content_width ( )

get_default_modules() публичный статический Метод

Default modules loaded on activation.
public static get_default_modules ( $min_version = false, $max_version = false )

get_file_data() публичный статический Метод

Like core's get_file_data implementation, but caches the result.
public static get_file_data ( $file, $headers )

get_jetpack_options_for_reset() публичный статический Метод

It is used in class.jetpack-cli.php to reset options
public static get_jetpack_options_for_reset ( )

get_jp_emblem() публичный статический Метод

Return string containing the Jetpack logo.
С версии: 3.9.0
public static get_jp_emblem ( ) : string
Результат string

get_locale() публичный Метод

Get the locale.
public get_locale ( ) : string | boolean
Результат string | boolean

get_log() публичный статический Метод

Get the internal event log.
public static get_log ( $event = false, $num = false ) : array
$event (string) - only return the specific log events
$num (int) - get specific number of latest results, limited to 200
Результат array of log events || WP_Error for invalid params

get_master_user_email() публичный статический Метод

Get the wpcom email of the master user.
public static get_master_user_email ( )

get_module() публичный статический Метод

Load module data from module file. Headers differ from WordPress plugin headers to avoid them being identified as standalone plugins on the WordPress plugins page.
public static get_module ( $module )

get_module_path() публичный статический Метод

Generate a module's path from its slug.
public static get_module_path ( $slug )

get_module_slug() публичный статический Метод

Extract a module's slug from its full path.
public static get_module_slug ( $file )

get_option() публичный статический Метод

Returns the requested option. Looks in jetpack_options or jetpack_$name as appropriate.
public static get_option ( string $name, mixed $default = false )
$name string Option name
$default mixed (optional)

get_option_names() публичный статический Метод

* Jetpack Options API
public static get_option_names ( $type = 'compact' )

get_other_linked_admins() статический публичный Метод

Checks to see if there are any other users available to become primary Users must both: - Be linked to wpcom - Be an admin
static public get_other_linked_admins ( ) : mixed
Результат mixed False if no other users are linked, Int if there are.

get_parsed_plugin_data() публичный статический Метод

Gets and parses additional plugin data to send with the heartbeat data
С версии: 3.8.1
public static get_parsed_plugin_data ( ) : array
Результат array Array of plugin data

get_parsed_theme_data() публичный статический Метод

Gets and parses theme data to send with the heartbeat data
С версии: 3.8.1
public static get_parsed_theme_data ( ) : array
Результат array Array of theme data

get_remote_query_timeout_limit() публичный Метод

Based on local php max_execution_time in php.ini
С версии: 2.6
public get_remote_query_timeout_limit ( ) : integer
Результат integer

get_stat_data() публичный статический Метод

Return stat data for WPCOM sync
public static get_stat_data ( $encode = true, $extended = true )

get_sync_error_idc_option() публичный статический Метод

Gets the value that is to be saved in the jetpack_sync_error_idc option.
С версии: 4.4.0
public static get_sync_error_idc_option ( array $response = [] ) : array
$response array
Результат array Array of the local urls, wpcom urls, and error code

get_translated_modules() публичный статический Метод

Return module name translation. Uses matching string created in modules/module-headings.php.
С версии: 3.9.2
public static get_translated_modules ( array $modules ) : string | void
$modules array
Результат string | void

get_update_details() публичный статический Метод

public static get_update_details ( )

get_updates() публичный статический Метод

array ( 'plugins' => (int) Number of plugin updates available. 'themes' => (int) Number of theme updates available. 'wordpress' => (int) Number of WordPress core updates available. 'translations' => (int) Number of translation updates available. 'total' => (int) Total of all available updates. 'wp_update_version' => (string) The latest available version of WordPress, only present if a WordPress update is needed. )
public static get_updates ( ) : array
Результат array

get_user_option_meta_box_order_dashboard() публичный Метод

public get_user_option_meta_box_order_dashboard ( $sorted ) : mixed
Результат mixed

glob_php() публичный статический Метод

Equivalent to glob( "$absolute_path/*.php" ).
public static glob_php ( string $absolute_path ) : array
$absolute_path string The absolute path of the directory to search.
Результат array Array of absolute paths to the PHP files.

guess_locale_from_lang() публичный Метод

Guess locale from language code.
public guess_locale_from_lang ( string $lang ) : string | boolean
$lang string Language code.
Результат string | boolean

handle_deprecated_modules() публичный Метод

Runs at priority 99 by default. This is run late, so that it can still activate a module if the new module is a replacement for another that the user currently has active, even if something at the normal priority would kibosh everything.
С версии: 2.6
public handle_deprecated_modules ( array $modules ) : array
$modules array
Результат array

implode_frontend_css() публичный Метод

Pros: - Uses only ONE css asset connection instead of 15 - Saves a minimum of 56k - Reduces server load - Reduces time to first painted byte Cons: - Loads css for ALL modules. However all selectors are prefixed so it should not cause any issues with themes. - Plugins/themes dequeuing styles no longer do anything. See jetpack_implode_frontend_css filter for a workaround For some situations developers may wish to disable css imploding and instead operate in legacy mode where each file loads seperately and can be edited individually or dequeued. This can be accomplished with the following line: add_filter( 'jetpack_implode_frontend_css', '__return_false' );
С версии: 3.2
public implode_frontend_css ( $travis_test = false )

init() публичный статический Метод

Singleton
public static init ( )

intercept_plugin_error_scrape() публичный Метод

public intercept_plugin_error_scrape ( $action, $result )

intercept_plugin_error_scrape_init() публичный Метод

is_active() публичный статический Метод

Is Jetpack active?
public static is_active ( )

is_development_mode() публичный статический Метод

Is Jetpack in development (offline) mode?
public static is_development_mode ( )

is_development_version() публичный статический Метод

Whether Jetpack's version maps to a public release, or a development version.
public static is_development_version ( )

is_main_network_option() публичный Метод

The reason we are type casting this is because we want to avoid the situation where the result is false since when is_main_network_option return false it cases the rest the get_option( 'jetpack_is_multi_network' ); to return the value that is set in the database which could be set to anything as opposed to what this function returns.
public is_main_network_option ( boolean $option ) : boolean
$option boolean
Результат boolean

is_module() публичный статический Метод

public static is_module ( $module )

is_module_active() публичный статический Метод

Check whether or not a Jetpack module is active.
public static is_module_active ( string $module ) : boolean
$module string The slug of a Jetpack module.
Результат boolean

is_multi_network() публичный статический Метод

Implemented since there is no core is multi network function Right now there is no way to tell if we which network is the dominant network on the system
С версии: 3.3
public static is_multi_network ( ) : boolean
Результат boolean

is_multisite() публичный Метод

Return true if we are with multi-site or multi-network false if we are dealing with single site.
public is_multisite ( string $option ) : boolean
$option string
Результат boolean

is_plugin_active() публичный статический Метод

We don't want to store these in a static variable, in case there are switch_to_blog() calls involved.
public static is_plugin_active ( $plugin = 'jetpack/jetpack.php' )

is_single_user_site() публичный статический Метод

Get back if the current site is single user site.
public static is_single_user_site ( ) : boolean
Результат boolean

is_staging_site() публичный статический Метод

Checks whether the home and siteurl specifically are whitelisted Written so that we don't have re-check $key and $value params every time we want to check if this site is whitelisted, for example in footer.php
С версии: 3.8.0
public static is_staging_site ( ) : boolean
Результат boolean True = already whitelisted False = not whitelisted

is_user_connected() публичный статический Метод

Is a given user (or the current user if none is specified) linked to a WordPress.com user?
public static is_user_connected ( $user_id = false )

is_version_controlled() публичный статический Метод

Finds out if a site is using a version control system.
public static is_version_controlled ( ) : string
Результат string ( '1' | '0' )

jetpack_admin_ajax_tracks_callback() публичный Метод

jetpack_check_heartbeat_data() публичный статический Метод

Organizes the heartbeat data by severity. For example, if the site is in an ID crisis, it will be in the $filtered_data['bad'] array. Data will be added to "caution" array, if it either: - Out of date Jetpack version - Out of date WP version - Out of date PHP version $return array $filtered_data
public static jetpack_check_heartbeat_data ( )

jetpack_custom_caps() публичный Метод

public jetpack_custom_caps ( $caps, $cap, $user_id, $args )

jetpack_getOptions() публичный Метод

public jetpack_getOptions ( $args )

jetpack_icon_user_connected() публичный Метод

* Adds a "blank" column in the user admin table to display indication of user connection.
public jetpack_icon_user_connected ( $columns )

jetpack_jitm_ajax_callback() публичный Метод

The callback for the JITM ajax requests.

jetpack_main_network_site_option() публичный Метод

Return the network_site_url so that .com knows what network this site is a part of.
public jetpack_main_network_site_option ( boolean $option ) : string
$option boolean
Результат string

jetpack_menu_order() публичный Метод

public jetpack_menu_order ( $menu_order )

jetpack_show_user_connected_icon() публичный Метод

* Show Jetpack icon if the user is linked.
public jetpack_show_user_connected_icon ( $val, $col, $user_id )

jetpack_user_col_style() публичный Метод

* Style the Jetpack user column

jumpstart_has_updated_module_option() публичный статический Метод

If any module option has been updated before Jump Start has been dismissed, update the 'jumpstart' option so we can hide Jump Start.
public static jumpstart_has_updated_module_option ( string $option_name = '' ) : boolean
$option_name string
Результат boolean

load_modules() публичный статический Метод

Loads the currently active modules.
public static load_modules ( )

load_view() публичный Метод

Data passed in with the $data parameter will be available in the template file as $data['value']
public load_view ( string $template, array $data = [] ) : boolean
$template string - Template file to load
$data array - Any data to pass along to the template
Результат boolean - If template file was found

load_xml_rpc_client() публичный статический Метод

Loads the Jetpack XML-RPC client
public static load_xml_rpc_client ( )

log() публичный статический Метод

public static log ( $code, $data = null )

log_settings_change() публичный статический Метод

Log modification of important settings.
public static log_settings_change ( $option, $old_value, $value )

login_form_json_api_authorization() публичный Метод

Handles the login action for Authorizing the JSON API

login_message_json_api_authorization() публичный Метод

manage_activate_screen() публичный Метод

maybe_clear_other_linked_admins_transient() публичный Метод

If a user has been promoted to or demoted from admin, we need to clear the jetpack_other_linked_admins transient.
С версии: 4.3.2
С версии: 4.4.0 $old_roles is null by default and if it's not passed, the transient is cleared.
public maybe_clear_other_linked_admins_transient ( integer $user_id, string $role, array $old_roles = null )
$user_id integer The user ID whose role changed.
$role string The new role.
$old_roles array An array of the user's previous roles.

maybe_inline_style() публичный статический Метод

If you'd like to inline a stylesheet instead of printing a link to it, wp_style_add_data( 'handle', 'jetpack-inline', true ); Attached to style_loader_tag filter.
public static maybe_inline_style ( string $tag, string $handle ) : string
$tag string The tag that would link to the external asset.
$handle string The registered handle of the script in question.
Результат string

maybe_min_asset() публичный статический Метод

Hooks onto plugins_url filter at priority 1, and accepts all 3 args.
public static maybe_min_asset ( $url, $path, $plugin )

maybe_set_version_option() публичный статический Метод

If the db version is showing something other that what we've got now, bump it to current.
public static maybe_set_version_option ( ) : bool:
Результат bool:

module_configuration_activation_screen() публичный статический Метод

public static module_configuration_activation_screen ( $module, $method )

module_configuration_head() публичный статический Метод

public static module_configuration_head ( $module, $method )

module_configuration_load() публичный статический Метод

public static module_configuration_load ( $module, $method )

module_configuration_screen() публичный статический Метод

public static module_configuration_screen ( $module, $method )

module_configuration_url() публичный статический Метод

public static module_configuration_url ( $module )

network_add_new_users() статический публичный Метод

Does the network allow admins to add new users.
static public network_add_new_users ( $option = null ) : boolian
Результат boolian

network_allow_new_registrations() статический публичный Метод

Does the network allow new user and site registrations.
static public network_allow_new_registrations ( $option = null ) : string
Результат string

network_enable_administration_menus() статический публичный Метод

Lets us know if a site allows admins to manage the network.
static public network_enable_administration_menus ( $option = null ) : array
Результат array

network_max_upload_file_size() статический публичный Метод

Maximum file upload size set by the network.
static public network_max_upload_file_size ( $option = null ) : number
Результат number

network_name() статический публичный Метод

Network Name.
static public network_name ( $option = null )

network_site_upload_space() статический публичный Метод

-1 means NO LIMIT.
static public network_site_upload_space ( $option = null ) : number
Результат number

network_upload_file_types() статический публичный Метод

Network allowed file types.
static public network_upload_file_types ( $option = null ) : string
Результат string

nonce_url_no_esc() публичный статический Метод

public static nonce_url_no_esc ( $actionurl, $action, $name = '_wpnonce' )

normalize_url_protocol_agnostic() публичный статический Метод

Normalizes a url by doing three things: - Strips protocol - Strips www - Adds a trailing slash
С версии: 4.4.0
public static normalize_url_protocol_agnostic ( string $url ) : WP_Error | string
$url string
Результат WP_Error | string

opt_in_jetpack_manage_notice() публичный Метод

opt_in_jetpack_manage_url() публичный Метод

Returns the url that the user clicks to opt in to Jetpack Manage
public opt_in_jetpack_manage_url ( ) : (string)
Результат (string)

opt_out_jetpack_manage_url() публичный Метод

Returns the url that the user clicks to remove the notice for the big banner
public opt_out_jetpack_manage_url ( ) : (string)
Результат (string)

permit_ssl() публичный статический Метод

Checks to see if the URL is using SSL to connect with Jetpack
С версии: 2.3.3
public static permit_ssl ( $force_recheck = false ) : boolean
Результат boolean

plugin_activation() публичный статический Метод

Attached to activate_{ plugin_basename( __FILES__ ) } by register_activation_hook()
public static plugin_activation ( $network_wide )

plugin_deactivation() публичный статический Метод

Removes all connection options
public static plugin_deactivation ( )

plugin_initialize() публичный статический Метод

Sets the internal version number and activation state.
public static plugin_initialize ( )

plugin_textdomain() публичный статический Метод

Load language files
public static plugin_textdomain ( )

plugin_upgrade() публичный Метод

Must never be called statically
public plugin_upgrade ( )

post_login_form_to_signed_url() публичный Метод

Make sure the login form is POSTed to the signed URL so we can reverify the request
public post_login_form_to_signed_url ( $url, $path, $scheme )

prepare_manage_jetpack_notice() публичный Метод

Call this function if you want the Big Jetpack Manage Notice to show up.
public prepare_manage_jetpack_notice ( ) : null
Результат null

preserve_action_in_login_form_for_json_api_authorization() публичный Метод

Make sure the POSTed request is handled by the same action

public_xmlrpc_methods() публичный Метод

public public_xmlrpc_methods ( $methods )

refresh_active_plan_from_wpcom() публичный статический Метод

Make an API call to WordPress.com for plan status
public static refresh_active_plan_from_wpcom ( ) : boolean
Результат boolean True if plan is updated, false if no update

refresh_theme_data() публичный статический Метод

public static refresh_theme_data ( )

refresh_update_data() публичный статический Метод

public static refresh_update_data ( )

register() публичный статический Метод

public static register ( ) : boolean | WP_Error
Результат boolean | WP_Error

register_assets() публичный Метод

Register assets for use in various modules and the Jetpack admin page.
public register_assets ( ) : null
Результат null

remote_request_handlers() публичный Метод

require_jetpack_authentication() публичный Метод

restate() публичный статический Метод

public static restate ( )

show_development_mode_notice() публичный статический Метод

Mirrors the checks made in Jetpack::is_development_mode
public static show_development_mode_notice ( )

sign_role() статический публичный Метод

static public sign_role ( $role )

sort_modules() публичный статический Метод

public static sort_modules ( $a, $b )

stat() публичный Метод

Record a stat for later output. This will only currently output in the admin_footer.
public stat ( $group, $detail )

state() публичный статический Метод

SET: state( $key, $value ); GET: $value = state( $key );
public static state ( string $key = null, string $value = null, boolean $restate = false )
$key string
$value string
$restate boolean private

staticize_subdomain() публичный статический Метод

public static staticize_subdomain ( $url )

store_json_api_authorization_token() публичный Метод

If someone logs in to approve API access, store the Access Code in usermeta
public store_json_api_authorization_token ( $user_login, $user )

submit_security_report() публичный статический Метод

Allows plugins to submit security reports.
public static submit_security_report ( string $type = '', string $plugin_file = '', array $args = [] )
$type string Report type (login_form, backup, file_scanning, spam)
$plugin_file string Plugin __FILE__, so that we can pull plugin data
$args array See definitions above

sync_idc_optin() публичный статический Метод

If set to true, the site will be put into staging mode.
С версии: 4.3.2
public static sync_idc_optin ( ) : boolean
Результат boolean

throw_error_on_activate_plugin() публичный Метод

This function artificially throws errors for such cases (whitelisted).
public throw_error_on_activate_plugin ( string $plugin )
$plugin string The activated plugin.

translate_current_user_to_role() статический публичный Метод

static public translate_current_user_to_role ( )

translate_module_tag() публичный статический Метод

Return translated module tag.
public static translate_module_tag ( string $tag ) : mixed
$tag string Tag as it appears in each module heading.
Результат mixed

translate_role_to_cap() статический публичный Метод

static public translate_role_to_cap ( $role )

try_registration() публичный статический Метод

Attempts Jetpack registration. If it fail, a state flag is set: @see ::admin_page_load()
public static try_registration ( )

update_active_modules() статический публичный Метод

static public update_active_modules ( $modules )

update_jetpack_main_network_site_option() публичный Метод

Trigger an update to the main_network_site when we update the siteurl of a site.
public update_jetpack_main_network_site_option ( ) : null
Результат null

update_jetpack_network_settings() публичный Метод

Triggered after a user updates the network settings via Network Settings Admin Page

update_option() публичный статический Метод

Updates the single given option. Updates jetpack_options or jetpack_$name as appropriate.
Устаревший: 3.4 use Jetpack_Options::update_option() instead.
public static update_option ( string $name, mixed $value )
$name string Option name
$value mixed Option value

update_options() публичный статический Метод

Updates the multiple given options. Updates jetpack_options and/or jetpack_$name as appropriate.
Устаревший: 3.4 use Jetpack_Options::update_options() instead.
public static update_options ( array $array )
$array array array( option name => option value, ... )

update_user_token() публичный статический Метод

Enters a user token into the user_tokens option
public static update_user_token ( integer $user_id, string $token, $is_master_user )
$user_id integer
$token string return bool

upload_handler() публичный Метод

public upload_handler ( )

user_role_change() публичный Метод

Synchronize connected user role changes
public user_role_change ( $user_id )

validate_remote_register_response() публичный Метод

Takes the response from the Jetpack register new site endpoint and verifies it worked properly.
С версии: 2.6
public validate_remote_register_response ( $response ) : true
Результат true or Jetpack_Error

validate_sync_error_idc_option() публичный статический Метод

Checks whether the sync_error_idc option is valid or not, and if not, will do cleanup.
public static validate_sync_error_idc_option ( ) : boolean
Результат boolean

verify_json_api_authorization_request() публичный Метод

Verifies the request by checking the signature

verify_xml_rpc_signature() публичный Метод

wp_dashboard_setup() публичный Метод

public wp_dashboard_setup ( )

xmlrpc_api_url() публичный статический Метод

Returns the Jetpack XML-RPC API
public static xmlrpc_api_url ( ) : string
Результат string

xmlrpc_async_call() публичный статический Метод

Helper method for multicall XMLRPC.
public static xmlrpc_async_call ( )

xmlrpc_methods() публичный Метод

Capture it here so we can verify the signature later.
public xmlrpc_methods ( $methods )

xmlrpc_options() публичный Метод

public xmlrpc_options ( $options )

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

$HTTP_RAW_POST_DATA публичное свойство

public $HTTP_RAW_POST_DATA

$capability_translations статическое публичное свойство

static public $capability_translations

$concatenated_style_handles публичное свойство

The handles of styles that are concatenated into jetpack.css
public $concatenated_style_handles

$error публичное свойство

Error to display in admin_notice
public string $error
Результат string

$instance статическое публичное свойство

Holds the singleton instance of this class
С версии: 2.3.3
static public Jetpack $instance
Результат Jetpack

$json_api_authorization_request публичное свойство

Verified data for JSON authorization request
public $json_api_authorization_request

$message публичное свойство

Message to display in admin_notice
public string $message
Результат string

$plugins_to_deactivate публичное свойство

public $plugins_to_deactivate

$privacy_checks публичное свойство

Modules that need more privacy description.
public string $privacy_checks
Результат string

$stats публичное свойство

Stats to record once the page loads
public array $stats
Результат array

$sync публичное свойство

Jetpack_Sync object
public $sync

$xmlrpc_server публичное свойство

public $xmlrpc_server