mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-07 19:54:15 +08:00
code style auto fixes
This commit is contained in:
parent
99d4911581
commit
22ffab2303
3 changed files with 37 additions and 37 deletions
|
@ -8,8 +8,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace WooCommerce\PayPalCommerce\WcGateway\Assets;
|
namespace WooCommerce\PayPalCommerce\WcGateway\Assets;
|
||||||
|
|
||||||
class SettingsPageAssets
|
class SettingsPageAssets {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
@ -17,19 +17,18 @@ class SettingsPageAssets
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assets constructor.
|
* Assets constructor.
|
||||||
|
*
|
||||||
* @param string $module_url The url of this module.
|
* @param string $module_url The url of this module.
|
||||||
*/
|
*/
|
||||||
public function __construct(string $module_url)
|
public function __construct( string $module_url ) {
|
||||||
{
|
|
||||||
$this->module_url = $module_url;
|
$this->module_url = $module_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register assets provided by this module.
|
* Register assets provided by this module.
|
||||||
*/
|
*/
|
||||||
public function register_assets(): void
|
public function register_assets(): void {
|
||||||
{
|
if ( is_admin() && ! is_ajax() ) {
|
||||||
if(is_admin() && ! is_ajax()){
|
|
||||||
$this->register_admin_assets();
|
$this->register_admin_assets();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,16 +36,18 @@ class SettingsPageAssets
|
||||||
/**
|
/**
|
||||||
* Register assets for admin pages.
|
* Register assets for admin pages.
|
||||||
*/
|
*/
|
||||||
private function register_admin_assets(): void
|
private function register_admin_assets(): void {
|
||||||
{
|
add_action(
|
||||||
add_action('admin_enqueue_scripts', function(){
|
'admin_enqueue_scripts',
|
||||||
wp_enqueue_script(
|
function() {
|
||||||
'ppcp-gateway-settings',
|
wp_enqueue_script(
|
||||||
trailingslashit($this->module_url) . 'assets/js/gateway-settings.js',
|
'ppcp-gateway-settings',
|
||||||
[],
|
trailingslashit( $this->module_url ) . 'assets/js/gateway-settings.js',
|
||||||
null,
|
array(),
|
||||||
true
|
null,
|
||||||
);
|
true
|
||||||
});
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,23 +125,23 @@ class SettingsListener {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function listen_for_vaulting_enabled() {
|
public function listen_for_vaulting_enabled() {
|
||||||
if ( ! $this->is_valid_site_request() ) {
|
if ( ! $this->is_valid_site_request() ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( ! isset( $_POST['ppcp']['vault_enabled'] ) && ! isset( $_POST['ppcp']['save_paypal_account'] ) ) {
|
if ( ! isset( $_POST['ppcp']['vault_enabled'] ) && ! isset( $_POST['ppcp']['save_paypal_account'] ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->settings->set( 'message_enabled', false );
|
$this->settings->set( 'message_enabled', false );
|
||||||
$this->settings->set( 'message_product_enabled', false );
|
$this->settings->set( 'message_product_enabled', false );
|
||||||
$this->settings->set( 'message_cart_enabled', false );
|
$this->settings->set( 'message_cart_enabled', false );
|
||||||
$this->settings->persist();
|
$this->settings->persist();
|
||||||
|
|
||||||
$redirect_url = admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway' );
|
$redirect_url = admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway' );
|
||||||
wp_safe_redirect( $redirect_url, 302 );
|
wp_safe_redirect( $redirect_url, 302 );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listens to the request.
|
* Listens to the request.
|
||||||
|
|
|
@ -73,12 +73,11 @@ class WcGatewayModule implements ModuleInterface {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if($container->has('wcgateway.url')) {
|
if ( $container->has( 'wcgateway.url' ) ) {
|
||||||
$assets = new SettingsPageAssets($container->get('wcgateway.url'));
|
$assets = new SettingsPageAssets( $container->get( 'wcgateway.url' ) );
|
||||||
$assets->register_assets();
|
$assets->register_assets();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
add_filter(
|
add_filter(
|
||||||
Repository::NOTICES_FILTER,
|
Repository::NOTICES_FILTER,
|
||||||
static function ( $notices ) use ( $container ): array {
|
static function ( $notices ) use ( $container ): array {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue