mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +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;
|
||||
|
||||
class SettingsPageAssets
|
||||
{
|
||||
class SettingsPageAssets {
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
@ -17,19 +17,18 @@ class SettingsPageAssets
|
|||
|
||||
/**
|
||||
* Assets constructor.
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register assets provided by this module.
|
||||
*/
|
||||
public function register_assets(): void
|
||||
{
|
||||
if(is_admin() && ! is_ajax()){
|
||||
public function register_assets(): void {
|
||||
if ( is_admin() && ! is_ajax() ) {
|
||||
$this->register_admin_assets();
|
||||
}
|
||||
}
|
||||
|
@ -37,16 +36,18 @@ class SettingsPageAssets
|
|||
/**
|
||||
* Register assets for admin pages.
|
||||
*/
|
||||
private function register_admin_assets(): void
|
||||
{
|
||||
add_action('admin_enqueue_scripts', function(){
|
||||
wp_enqueue_script(
|
||||
'ppcp-gateway-settings',
|
||||
trailingslashit($this->module_url) . 'assets/js/gateway-settings.js',
|
||||
[],
|
||||
null,
|
||||
true
|
||||
);
|
||||
});
|
||||
private function register_admin_assets(): void {
|
||||
add_action(
|
||||
'admin_enqueue_scripts',
|
||||
function() {
|
||||
wp_enqueue_script(
|
||||
'ppcp-gateway-settings',
|
||||
trailingslashit( $this->module_url ) . 'assets/js/gateway-settings.js',
|
||||
array(),
|
||||
null,
|
||||
true
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,23 +125,23 @@ class SettingsListener {
|
|||
exit;
|
||||
}
|
||||
|
||||
public function listen_for_vaulting_enabled() {
|
||||
if ( ! $this->is_valid_site_request() ) {
|
||||
return;
|
||||
}
|
||||
if ( ! isset( $_POST['ppcp']['vault_enabled'] ) && ! isset( $_POST['ppcp']['save_paypal_account'] ) ) {
|
||||
return;
|
||||
}
|
||||
public function listen_for_vaulting_enabled() {
|
||||
if ( ! $this->is_valid_site_request() ) {
|
||||
return;
|
||||
}
|
||||
if ( ! isset( $_POST['ppcp']['vault_enabled'] ) && ! isset( $_POST['ppcp']['save_paypal_account'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->settings->set( 'message_enabled', false );
|
||||
$this->settings->set( 'message_product_enabled', false );
|
||||
$this->settings->set( 'message_cart_enabled', false );
|
||||
$this->settings->persist();
|
||||
$this->settings->set( 'message_enabled', false );
|
||||
$this->settings->set( 'message_product_enabled', false );
|
||||
$this->settings->set( 'message_cart_enabled', false );
|
||||
$this->settings->persist();
|
||||
|
||||
$redirect_url = admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway' );
|
||||
wp_safe_redirect( $redirect_url, 302 );
|
||||
exit;
|
||||
}
|
||||
$redirect_url = admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway' );
|
||||
wp_safe_redirect( $redirect_url, 302 );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Listens to the request.
|
||||
|
|
|
@ -73,12 +73,11 @@ class WcGatewayModule implements ModuleInterface {
|
|||
}
|
||||
);
|
||||
|
||||
if($container->has('wcgateway.url')) {
|
||||
$assets = new SettingsPageAssets($container->get('wcgateway.url'));
|
||||
if ( $container->has( 'wcgateway.url' ) ) {
|
||||
$assets = new SettingsPageAssets( $container->get( 'wcgateway.url' ) );
|
||||
$assets->register_assets();
|
||||
}
|
||||
|
||||
|
||||
add_filter(
|
||||
Repository::NOTICES_FILTER,
|
||||
static function ( $notices ) use ( $container ): array {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue