@@ -7,6 +7,6 @@ |
||
7 | 7 | exit(1); |
8 | 8 | } |
9 | 9 | |
10 | -require_once __DIR__ . '/composer/autoload_real.php'; |
|
10 | +require_once __DIR__.'/composer/autoload_real.php'; |
|
11 | 11 | |
12 | 12 | return ComposerAutoloaderInit3d5ab0830c7bf52ba5addfd65f37fd54::getLoader(); |
@@ -6,60 +6,60 @@ |
||
6 | 6 | use Wordlift\Modules\Include_Exclude_Push_Config\Include_Exclude_API; |
7 | 7 | |
8 | 8 | if ( ! defined( 'ABSPATH' ) ) { |
9 | - exit; |
|
9 | + exit; |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | // Bail out if the feature isn't enabled. |
13 | 13 | if ( ! apply_filters( 'wl_feature__enable__include-exclude', false ) ) { // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
14 | - return; |
|
14 | + return; |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | // Autoloader for dependencies. |
18 | 18 | if ( file_exists( __DIR__ . '/third-party/vendor/scoper-autoload.php' ) ) { |
19 | - require __DIR__ . '/third-party/vendor/scoper-autoload.php'; |
|
19 | + require __DIR__ . '/third-party/vendor/scoper-autoload.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | // Autoloader for plugin itself. |
23 | 23 | if ( file_exists( __DIR__ . '/includes/vendor/autoload.php' ) ) { |
24 | - require __DIR__ . '/includes/vendor/autoload.php'; |
|
24 | + require __DIR__ . '/includes/vendor/autoload.php'; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | function __wl_include_exclude_push_config() { |
28 | - // Get the configuration. |
|
29 | - $config = get_option( 'wl_exclude_include_urls_settings', array() ); |
|
28 | + // Get the configuration. |
|
29 | + $config = get_option( 'wl_exclude_include_urls_settings', array() ); |
|
30 | 30 | |
31 | - // Set the default data. |
|
32 | - if ( ! is_array( $config ) || empty( $config ) || ! isset( $config['include_exclude'] ) || ! isset( $config['urls'] ) ) { |
|
33 | - $config = get_option( |
|
34 | - 'wl_exclude_include_urls_settings', |
|
35 | - array( |
|
36 | - 'include_exclude' => 'exclude', |
|
37 | - 'urls' => '', |
|
38 | - ) |
|
39 | - ); |
|
40 | - } |
|
31 | + // Set the default data. |
|
32 | + if ( ! is_array( $config ) || empty( $config ) || ! isset( $config['include_exclude'] ) || ! isset( $config['urls'] ) ) { |
|
33 | + $config = get_option( |
|
34 | + 'wl_exclude_include_urls_settings', |
|
35 | + array( |
|
36 | + 'include_exclude' => 'exclude', |
|
37 | + 'urls' => '', |
|
38 | + ) |
|
39 | + ); |
|
40 | + } |
|
41 | 41 | |
42 | - // Map the configuration to the payload. |
|
43 | - $payload = array_map( |
|
44 | - function ( $item ) use ( $config ) { |
|
45 | - return array( |
|
46 | - 'url' => |
|
47 | - ( 1 === preg_match( '@^https?://.*$@', $item ) ? $item : get_home_url( null, $item ) ), |
|
48 | - 'flag' => strtoupper( $config['include_exclude'] ), |
|
49 | - ); |
|
50 | - }, |
|
51 | - array_filter( preg_split( '/[\r\n]+/', $config['urls'] ) ) |
|
52 | - ); |
|
42 | + // Map the configuration to the payload. |
|
43 | + $payload = array_map( |
|
44 | + function ( $item ) use ( $config ) { |
|
45 | + return array( |
|
46 | + 'url' => |
|
47 | + ( 1 === preg_match( '@^https?://.*$@', $item ) ? $item : get_home_url( null, $item ) ), |
|
48 | + 'flag' => strtoupper( $config['include_exclude'] ), |
|
49 | + ); |
|
50 | + }, |
|
51 | + array_filter( preg_split( '/[\r\n]+/', $config['urls'] ) ) |
|
52 | + ); |
|
53 | 53 | |
54 | - // Load the service. |
|
55 | - $container_builder = new ContainerBuilder(); |
|
56 | - $loader = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) ); |
|
57 | - $loader->load( 'services.yml' ); |
|
58 | - $container_builder->compile(); |
|
54 | + // Load the service. |
|
55 | + $container_builder = new ContainerBuilder(); |
|
56 | + $loader = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) ); |
|
57 | + $loader->load( 'services.yml' ); |
|
58 | + $container_builder->compile(); |
|
59 | 59 | |
60 | - /** @var Include_Exclude_API $api */ |
|
61 | - $api = $container_builder->get( 'Wordlift\Modules\Include_Exclude_Push_Config\Include_Exclude_API' ); |
|
62 | - $api->update( $payload ); |
|
60 | + /** @var Include_Exclude_API $api */ |
|
61 | + $api = $container_builder->get( 'Wordlift\Modules\Include_Exclude_Push_Config\Include_Exclude_API' ); |
|
62 | + $api->update( $payload ); |
|
63 | 63 | |
64 | 64 | } |
65 | 65 |
@@ -5,31 +5,31 @@ discard block |
||
5 | 5 | use Wordlift\Modules\Common\Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
6 | 6 | use Wordlift\Modules\Include_Exclude_Push_Config\Include_Exclude_API; |
7 | 7 | |
8 | -if ( ! defined( 'ABSPATH' ) ) { |
|
8 | +if ( ! defined('ABSPATH')) { |
|
9 | 9 | exit; |
10 | 10 | } |
11 | 11 | |
12 | 12 | // Bail out if the feature isn't enabled. |
13 | -if ( ! apply_filters( 'wl_feature__enable__include-exclude', false ) ) { // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
13 | +if ( ! apply_filters('wl_feature__enable__include-exclude', false)) { // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Autoloader for dependencies. |
18 | -if ( file_exists( __DIR__ . '/third-party/vendor/scoper-autoload.php' ) ) { |
|
19 | - require __DIR__ . '/third-party/vendor/scoper-autoload.php'; |
|
18 | +if (file_exists(__DIR__.'/third-party/vendor/scoper-autoload.php')) { |
|
19 | + require __DIR__.'/third-party/vendor/scoper-autoload.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | // Autoloader for plugin itself. |
23 | -if ( file_exists( __DIR__ . '/includes/vendor/autoload.php' ) ) { |
|
24 | - require __DIR__ . '/includes/vendor/autoload.php'; |
|
23 | +if (file_exists(__DIR__.'/includes/vendor/autoload.php')) { |
|
24 | + require __DIR__.'/includes/vendor/autoload.php'; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | function __wl_include_exclude_push_config() { |
28 | 28 | // Get the configuration. |
29 | - $config = get_option( 'wl_exclude_include_urls_settings', array() ); |
|
29 | + $config = get_option('wl_exclude_include_urls_settings', array()); |
|
30 | 30 | |
31 | 31 | // Set the default data. |
32 | - if ( ! is_array( $config ) || empty( $config ) || ! isset( $config['include_exclude'] ) || ! isset( $config['urls'] ) ) { |
|
32 | + if ( ! is_array($config) || empty($config) || ! isset($config['include_exclude']) || ! isset($config['urls'])) { |
|
33 | 33 | $config = get_option( |
34 | 34 | 'wl_exclude_include_urls_settings', |
35 | 35 | array( |
@@ -41,34 +41,34 @@ discard block |
||
41 | 41 | |
42 | 42 | // Map the configuration to the payload. |
43 | 43 | $payload = array_map( |
44 | - function ( $item ) use ( $config ) { |
|
44 | + function($item) use ($config) { |
|
45 | 45 | return array( |
46 | 46 | 'url' => |
47 | - ( 1 === preg_match( '@^https?://.*$@', $item ) ? $item : get_home_url( null, $item ) ), |
|
48 | - 'flag' => strtoupper( $config['include_exclude'] ), |
|
47 | + (1 === preg_match('@^https?://.*$@', $item) ? $item : get_home_url(null, $item)), |
|
48 | + 'flag' => strtoupper($config['include_exclude']), |
|
49 | 49 | ); |
50 | 50 | }, |
51 | - array_filter( preg_split( '/[\r\n]+/', $config['urls'] ) ) |
|
51 | + array_filter(preg_split('/[\r\n]+/', $config['urls'])) |
|
52 | 52 | ); |
53 | 53 | |
54 | 54 | // Load the service. |
55 | 55 | $container_builder = new ContainerBuilder(); |
56 | - $loader = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) ); |
|
57 | - $loader->load( 'services.yml' ); |
|
56 | + $loader = new YamlFileLoader($container_builder, new FileLocator(__DIR__)); |
|
57 | + $loader->load('services.yml'); |
|
58 | 58 | $container_builder->compile(); |
59 | 59 | |
60 | 60 | /** @var Include_Exclude_API $api */ |
61 | - $api = $container_builder->get( 'Wordlift\Modules\Include_Exclude_Push_Config\Include_Exclude_API' ); |
|
62 | - $api->update( $payload ); |
|
61 | + $api = $container_builder->get('Wordlift\Modules\Include_Exclude_Push_Config\Include_Exclude_API'); |
|
62 | + $api->update($payload); |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Fires after the value of a specific option has been successfully updated. |
68 | 68 | */ |
69 | -add_action( 'update_option_wl_exclude_include_urls_settings', '__wl_include_exclude_push_config', 10, 0 ); |
|
69 | +add_action('update_option_wl_exclude_include_urls_settings', '__wl_include_exclude_push_config', 10, 0); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Fires daily. |
73 | 73 | */ |
74 | -add_action( 'wl_daily_cron', '__wl_include_exclude_push_config', 10, 0 ); |
|
74 | +add_action('wl_daily_cron', '__wl_include_exclude_push_config', 10, 0); |