PHP Class WC_Connect_Loader, woocommerce-connect-client

Show file Open project: Automattic/woocommerce-connect-client Class Usage Examples

Protected Properties

Property Type Description
$api_client WC_Connect_API_Client
$help_view WC_Connect_Help_View
$logger WC_Connect_Logger
$payment_methods_store WC_Connect_Payment_Methods_Store
$rest_account_settings_controller WC_REST_Connect_Account_Settings_Controller
$rest_address_normalization_controller WC_REST_Connect_Address_Normalization_Controller
$rest_packages_controller WC_REST_Connect_Packages_Controller
$rest_self_help_controller WC_REST_Connect_Self_Help_Controller
$rest_services_controller WC_REST_Connect_Services_Controller
$rest_shipping_label_controller WC_REST_Connect_Shipping_Label_Controller
$rest_shipping_label_refund_controller WC_REST_Connect_Shipping_Label_Refund_Controller
$rest_shipping_label_status_controller WC_REST_Connect_Shipping_Label_Status_Controller
$rest_shipping_labels_preview_controller WC_REST_Connect_Shipping_Labels_Preview_Controller
$rest_shipping_labels_print_controller WC_REST_Connect_Shipping_Labels_Print_Controller
$rest_shipping_rates_controller WC_REST_Connect_Shipping_Rates_Controller
$service_object_cache
$service_schemas_store WC_Connect_Service_Schemas_Store
$service_schemas_validator WC_Connect_Service_Schemas_Validator
$service_settings_store WC_Connect_Service_Settings_Store
$services
$settings_page WC_Connect_Settings_Page

Public Methods

Method Description
__construct ( )
add_meta_boxes ( )
add_shipping_phone_to_checkout ( $fields )
add_shipping_phone_to_order_fields ( $fields )
admin_banner_styles ( )
admin_enqueue_scripts ( ) Registers the React UI bundle
attach_hooks ( ) Hook plugin classes into WP/WC core.
check_tos ( )
dismiss_tos_notice ( )
get_active_services ( )
get_active_shipping_services ( )
get_api_client ( )
get_help_view ( )
get_logger ( )
get_payment_methods_store ( )
get_rest_account_settings_controller ( )
get_rest_self_help_controller ( )
get_rest_services_controller ( )
get_rest_shipping_label_controller ( )
get_rest_shipping_label_refund_controller ( )
get_rest_shipping_label_status_controller ( )
get_rest_shipping_labels_preview_controller ( )
get_rest_shipping_labels_print_controller ( )
get_service_schemas_store ( )
get_service_schemas_validator ( )
get_service_settings_store ( )
get_settings_pages ( )
get_shipping_phone_from_order ( $fields, $address_type, $order )
get_tracks ( )
hide_wc_connect_order_meta_data ( $protected, $meta_key, $meta_type )
hide_wc_connect_package_meta_data ( $hidden_keys )
init ( ) Bootstrap our plugin and hook into WP/WC core.
init_service ( WC_Connect_Shipping_Method $method, integer | string $id_or_instance_id ) Inject API Client and Logger into WC Connect shipping method instances.
is_wc_connect_shipping_service ( $service_id )
load_admin_dependencies ( ) Load admin-only plugin dependencies.
load_dependencies ( ) Load all plugin dependencies.
load_textdomain ( ) Load our textdomain
load_tracks_for_activation_hooks ( )
localize_and_enqueue_service_script ( $id, $instance = false ) This function is added to the wc_connect_service_admin_options action by this class (see attach_hooks) and then that action is fired by WC_Connect_Shipping_Method::admin_options to get the service instance form layout and settings bundled inside wcConnectData as the form container is emitted into the body's HTML
plugin_activation ( )
plugin_deactivation ( )
rest_api_init ( ) Hook the REST API Note that we cannot load our controller until this time, because prior to rest_api_init firing, WP_REST_Controller is not yet defined
schedule_service_schemas_fetch ( ) Hook fetching the available services from the connect server
set_api_client ( WC_Connect_API_Client $api_client )
set_help_view ( WC_Connect_Help_View $help_view )
set_logger ( WC_Connect_Logger $logger )
set_payment_methods_store ( WC_Connect_Payment_Methods_Store $payment_methods_store )
set_rest_account_settings_controller ( WC_REST_Connect_Account_Settings_Controller $rest_account_settings_controller )
set_rest_address_normalization_controller ( WC_REST_Connect_Address_Normalization_Controller $rest_address_normalization_controller )
set_rest_packages_controller ( WC_REST_Connect_Packages_Controller $rest_packages_controller )
set_rest_self_help_controller ( WC_REST_Connect_Self_Help_Controller $rest_self_help_controller )
set_rest_services_controller ( WC_REST_Connect_Services_Controller $rest_services_controller )
set_rest_shipping_label_controller ( WC_REST_Connect_Shipping_Label_Controller $rest_shipping_label_controller )
set_rest_shipping_label_refund_controller ( WC_REST_Connect_Shipping_Label_Refund_Controller $rest_shipping_label_refund_controller )
set_rest_shipping_label_status_controller ( WC_REST_Connect_Shipping_Label_Status_Controller $rest_shipping_label_status_controller )
set_rest_shipping_labels_preview_controller ( WC_REST_Connect_Shipping_Labels_Preview_Controller $rest_shipping_labels_preview_controller )
set_rest_shipping_labels_print_controller ( WC_REST_Connect_Shipping_Labels_Print_Controller $rest_shipping_labels_print_controller )
set_rest_shipping_rates_controller ( WC_REST_Connect_Shipping_Rates_Controller $rest_shipping_rates_controller )
set_service_schemas_store ( WC_Connect_Service_Schemas_Store $schemas_store )
set_service_schemas_validator ( WC_Connect_Service_Schemas_Validator $validator )
set_service_settings_store ( WC_Connect_Service_Settings_Store $settings_store )
set_settings_pages ( WC_Connect_Settings_Pages $settings_pages )
set_tracks ( WC_Connect_Tracks $tracks )
shipping_zone_method_added ( $instance_id, $service_id, $zone_id )
shipping_zone_method_deleted ( $instance_id, $service_id, $zone_id )
shipping_zone_method_status_toggled ( $instance_id, $service_id, $zone_id, $enabled )
show_tos_notice ( )
woocommerce_load_shipping_methods ( ) Registers shipping methods for use in things like the Add Shipping Method dialog on the Shipping Zones view
woocommerce_payment_gateways ( $payment_gateways )
woocommerce_shipping_methods ( $shipping_methods ) : mixed Filters in shipping methods for things like WC_Shipping::get_shipping_method_class_names

Protected Methods

Method Description
get_service_object_by_id ( string $class_name, string $service_id ) : mixed Returns a reference to a service (e.g. WC_Connect_Shipping_Method) of a particular id so we can avoid instantiating them multiple times

Method Details

__construct() public method

public __construct ( )

add_meta_boxes() public method

public add_meta_boxes ( )

add_shipping_phone_to_checkout() public method

public add_shipping_phone_to_checkout ( $fields )

add_shipping_phone_to_order_fields() public method

admin_banner_styles() public method

public admin_banner_styles ( )

admin_enqueue_scripts() public method

Registers the React UI bundle

attach_hooks() public method

Hook plugin classes into WP/WC core.
public attach_hooks ( )

check_tos() public method

public check_tos ( )

dismiss_tos_notice() public method

public dismiss_tos_notice ( )

get_active_services() public method

public get_active_services ( )

get_active_shipping_services() public method

get_api_client() public method

public get_api_client ( )

get_help_view() public method

public get_help_view ( )

get_logger() public method

public get_logger ( )

get_payment_methods_store() public method

get_rest_account_settings_controller() public method

get_rest_self_help_controller() public method

get_rest_services_controller() public method

get_rest_shipping_label_controller() public method

get_rest_shipping_label_refund_controller() public method

get_rest_shipping_label_status_controller() public method

get_rest_shipping_labels_preview_controller() public method

get_rest_shipping_labels_print_controller() public method

get_service_object_by_id() protected method

Returns a reference to a service (e.g. WC_Connect_Shipping_Method) of a particular id so we can avoid instantiating them multiple times
protected get_service_object_by_id ( string $class_name, string $service_id ) : mixed
$class_name string Class name of service to create (e.g. WC_Connect_Shipping_Method)
$service_id string Service id of service to create (e.g. usps)
return mixed

get_service_schemas_store() public method

get_service_schemas_validator() public method

get_service_settings_store() public method

get_settings_pages() public method

public get_settings_pages ( )

get_shipping_phone_from_order() public method

public get_shipping_phone_from_order ( $fields, $address_type, $order )

get_tracks() public method

public get_tracks ( )

hide_wc_connect_order_meta_data() public method

public hide_wc_connect_order_meta_data ( $protected, $meta_key, $meta_type )

hide_wc_connect_package_meta_data() public method

public hide_wc_connect_package_meta_data ( $hidden_keys )

init() public method

Bootstrap our plugin and hook into WP/WC core.
public init ( )

init_service() public method

Inject API Client and Logger into WC Connect shipping method instances.
public init_service ( WC_Connect_Shipping_Method $method, integer | string $id_or_instance_id )
$method WC_Connect_Shipping_Method
$id_or_instance_id integer | string

is_wc_connect_shipping_service() public method

public is_wc_connect_shipping_service ( $service_id )

load_admin_dependencies() public method

Load admin-only plugin dependencies.

load_dependencies() public method

Load all plugin dependencies.
public load_dependencies ( )

load_textdomain() public method

Load our textdomain
public load_textdomain ( )

load_tracks_for_activation_hooks() static public method

localize_and_enqueue_service_script() public method

This function is added to the wc_connect_service_admin_options action by this class (see attach_hooks) and then that action is fired by WC_Connect_Shipping_Method::admin_options to get the service instance form layout and settings bundled inside wcConnectData as the form container is emitted into the body's HTML
public localize_and_enqueue_service_script ( $id, $instance = false )

plugin_activation() static public method

static public plugin_activation ( )

plugin_deactivation() static public method

static public plugin_deactivation ( )

rest_api_init() public method

Hook the REST API Note that we cannot load our controller until this time, because prior to rest_api_init firing, WP_REST_Controller is not yet defined
public rest_api_init ( )

schedule_service_schemas_fetch() public method

Hook fetching the available services from the connect server

set_api_client() public method

public set_api_client ( WC_Connect_API_Client $api_client )
$api_client WC_Connect_API_Client

set_help_view() public method

public set_help_view ( WC_Connect_Help_View $help_view )
$help_view WC_Connect_Help_View

set_logger() public method

public set_logger ( WC_Connect_Logger $logger )
$logger WC_Connect_Logger

set_payment_methods_store() public method

public set_payment_methods_store ( WC_Connect_Payment_Methods_Store $payment_methods_store )
$payment_methods_store WC_Connect_Payment_Methods_Store

set_rest_account_settings_controller() public method

public set_rest_account_settings_controller ( WC_REST_Connect_Account_Settings_Controller $rest_account_settings_controller )
$rest_account_settings_controller WC_REST_Connect_Account_Settings_Controller

set_rest_address_normalization_controller() public method

public set_rest_address_normalization_controller ( WC_REST_Connect_Address_Normalization_Controller $rest_address_normalization_controller )
$rest_address_normalization_controller WC_REST_Connect_Address_Normalization_Controller

set_rest_packages_controller() public method

public set_rest_packages_controller ( WC_REST_Connect_Packages_Controller $rest_packages_controller )
$rest_packages_controller WC_REST_Connect_Packages_Controller

set_rest_self_help_controller() public method

public set_rest_self_help_controller ( WC_REST_Connect_Self_Help_Controller $rest_self_help_controller )
$rest_self_help_controller WC_REST_Connect_Self_Help_Controller

set_rest_services_controller() public method

public set_rest_services_controller ( WC_REST_Connect_Services_Controller $rest_services_controller )
$rest_services_controller WC_REST_Connect_Services_Controller

set_rest_shipping_label_controller() public method

public set_rest_shipping_label_controller ( WC_REST_Connect_Shipping_Label_Controller $rest_shipping_label_controller )
$rest_shipping_label_controller WC_REST_Connect_Shipping_Label_Controller

set_rest_shipping_label_refund_controller() public method

public set_rest_shipping_label_refund_controller ( WC_REST_Connect_Shipping_Label_Refund_Controller $rest_shipping_label_refund_controller )
$rest_shipping_label_refund_controller WC_REST_Connect_Shipping_Label_Refund_Controller

set_rest_shipping_label_status_controller() public method

public set_rest_shipping_label_status_controller ( WC_REST_Connect_Shipping_Label_Status_Controller $rest_shipping_label_status_controller )
$rest_shipping_label_status_controller WC_REST_Connect_Shipping_Label_Status_Controller

set_rest_shipping_labels_preview_controller() public method

public set_rest_shipping_labels_preview_controller ( WC_REST_Connect_Shipping_Labels_Preview_Controller $rest_shipping_labels_preview_controller )
$rest_shipping_labels_preview_controller WC_REST_Connect_Shipping_Labels_Preview_Controller

set_rest_shipping_labels_print_controller() public method

public set_rest_shipping_labels_print_controller ( WC_REST_Connect_Shipping_Labels_Print_Controller $rest_shipping_labels_print_controller )
$rest_shipping_labels_print_controller WC_REST_Connect_Shipping_Labels_Print_Controller

set_rest_shipping_rates_controller() public method

public set_rest_shipping_rates_controller ( WC_REST_Connect_Shipping_Rates_Controller $rest_shipping_rates_controller )
$rest_shipping_rates_controller WC_REST_Connect_Shipping_Rates_Controller

set_service_schemas_store() public method

public set_service_schemas_store ( WC_Connect_Service_Schemas_Store $schemas_store )
$schemas_store WC_Connect_Service_Schemas_Store

set_service_schemas_validator() public method

public set_service_schemas_validator ( WC_Connect_Service_Schemas_Validator $validator )
$validator WC_Connect_Service_Schemas_Validator

set_service_settings_store() public method

public set_service_settings_store ( WC_Connect_Service_Settings_Store $settings_store )
$settings_store WC_Connect_Service_Settings_Store

set_settings_pages() public method

public set_settings_pages ( WC_Connect_Settings_Pages $settings_pages )
$settings_pages WC_Connect_Settings_Pages

set_tracks() public method

public set_tracks ( WC_Connect_Tracks $tracks )
$tracks WC_Connect_Tracks

shipping_zone_method_added() public method

public shipping_zone_method_added ( $instance_id, $service_id, $zone_id )

shipping_zone_method_deleted() public method

public shipping_zone_method_deleted ( $instance_id, $service_id, $zone_id )

shipping_zone_method_status_toggled() public method

public shipping_zone_method_status_toggled ( $instance_id, $service_id, $zone_id, $enabled )

show_tos_notice() public method

public show_tos_notice ( )

woocommerce_load_shipping_methods() public method

Registers shipping methods for use in things like the Add Shipping Method dialog on the Shipping Zones view

woocommerce_payment_gateways() public method

public woocommerce_payment_gateways ( $payment_gateways )

woocommerce_shipping_methods() public method

Filters in shipping methods for things like WC_Shipping::get_shipping_method_class_names
public woocommerce_shipping_methods ( $shipping_methods ) : mixed
$shipping_methods
return mixed

Property Details

$api_client protected property

protected WC_Connect_API_Client $api_client
return WC_Connect_API_Client

$help_view protected property

protected WC_Connect_Help_View $help_view
return WC_Connect_Help_View

$logger protected property

protected WC_Connect_Logger $logger
return WC_Connect_Logger

$payment_methods_store protected property

protected WC_Connect_Payment_Methods_Store $payment_methods_store
return WC_Connect_Payment_Methods_Store

$rest_account_settings_controller protected property

protected WC_REST_Connect_Account_Settings_Controller $rest_account_settings_controller
return WC_REST_Connect_Account_Settings_Controller

$rest_address_normalization_controller protected property

protected WC_REST_Connect_Address_Normalization_Controller $rest_address_normalization_controller
return WC_REST_Connect_Address_Normalization_Controller

$rest_packages_controller protected property

protected WC_REST_Connect_Packages_Controller $rest_packages_controller
return WC_REST_Connect_Packages_Controller

$rest_self_help_controller protected property

protected WC_REST_Connect_Self_Help_Controller $rest_self_help_controller
return WC_REST_Connect_Self_Help_Controller

$rest_services_controller protected property

protected WC_REST_Connect_Services_Controller $rest_services_controller
return WC_REST_Connect_Services_Controller

$rest_shipping_label_controller protected property

protected WC_REST_Connect_Shipping_Label_Controller $rest_shipping_label_controller
return WC_REST_Connect_Shipping_Label_Controller

$rest_shipping_label_refund_controller protected property

protected WC_REST_Connect_Shipping_Label_Refund_Controller $rest_shipping_label_refund_controller
return WC_REST_Connect_Shipping_Label_Refund_Controller

$rest_shipping_label_status_controller protected property

protected WC_REST_Connect_Shipping_Label_Status_Controller $rest_shipping_label_status_controller
return WC_REST_Connect_Shipping_Label_Status_Controller

$rest_shipping_labels_preview_controller protected property

protected WC_REST_Connect_Shipping_Labels_Preview_Controller $rest_shipping_labels_preview_controller
return WC_REST_Connect_Shipping_Labels_Preview_Controller

$rest_shipping_labels_print_controller protected property

protected WC_REST_Connect_Shipping_Labels_Print_Controller $rest_shipping_labels_print_controller
return WC_REST_Connect_Shipping_Labels_Print_Controller

$rest_shipping_rates_controller protected property

protected WC_REST_Connect_Shipping_Rates_Controller $rest_shipping_rates_controller
return WC_REST_Connect_Shipping_Rates_Controller

$service_object_cache protected property

protected $service_object_cache

$service_schemas_store protected property

protected WC_Connect_Service_Schemas_Store $service_schemas_store
return WC_Connect_Service_Schemas_Store

$service_schemas_validator protected property

protected WC_Connect_Service_Schemas_Validator $service_schemas_validator
return WC_Connect_Service_Schemas_Validator

$service_settings_store protected property

protected WC_Connect_Service_Settings_Store $service_settings_store
return WC_Connect_Service_Settings_Store

$services protected property

protected $services

$settings_page protected property

protected WC_Connect_Settings_Page $settings_page
return WC_Connect_Settings_Page