diff --git a/src/Api/Admin/Volume.php b/src/Api/Admin/Volume.php index 4aeaab0..7833eb5 100644 --- a/src/Api/Admin/Volume.php +++ b/src/Api/Admin/Volume.php @@ -22,7 +22,9 @@ class Volume extends AbstractApi implements ApiInterface { - public function __construct() {} + public function __construct() + { + } public function get_prefix(): string { @@ -36,8 +38,8 @@ public function register_custom_endpoints(): void $this->get_prefix() . '/index', [ 'methods' => WP_REST_Server::READABLE, - 'callback' => fn(\WP_REST_Request $wprestRequest): \WP_REST_Response => $this->index($wprestRequest), - 'permission_callback' => fn(\WP_REST_Request $wprestRequest): bool => $this->permission_callback($wprestRequest), + 'callback' => fn (\WP_REST_Request $wprestRequest): \WP_REST_Response => $this->index($wprestRequest), + 'permission_callback' => fn (\WP_REST_Request $wprestRequest): bool => $this->permission_callback($wprestRequest), ] ); @@ -46,8 +48,8 @@ public function register_custom_endpoints(): void $this->get_prefix() . '/store', [ 'methods' => WP_REST_Server::CREATABLE, - 'callback' => fn(\WP_REST_Request $wprestRequest): \WP_REST_Response => $this->store($wprestRequest), - 'permission_callback' => fn(\WP_REST_Request $wprestRequest): bool => $this->permission_callback($wprestRequest), + 'callback' => fn (\WP_REST_Request $wprestRequest): \WP_REST_Response => $this->store($wprestRequest), + 'permission_callback' => fn (\WP_REST_Request $wprestRequest): bool => $this->permission_callback($wprestRequest), ] ); } diff --git a/src/Core/Runtime.php b/src/Core/Runtime.php index 993915f..9c38097 100644 --- a/src/Core/Runtime.php +++ b/src/Core/Runtime.php @@ -35,12 +35,16 @@ class Runtime * The Singleton's constructor should always be private to prevent direct * construction calls with the `new` operator. */ - private function __construct() {} + private function __construct() + { + } /** * Singletons should not be cloneable. */ - private function __clone() {} + private function __clone() + { + } /** * Singletons should not be restorable from strings. @@ -89,9 +93,9 @@ public function append_header() $is_exclude_admin = apply_filters('f!windpress/core/runtime:append_header.exclude_admin', $is_exclude_admin); if ($is_cache_enabled && $this->is_cache_exists() && ! $is_exclude_admin) { - add_action('wp_head', fn() => $this->enqueue_css_cache(), 1_000_001); + add_action('wp_head', fn () => $this->enqueue_css_cache(), 1_000_001); } else { - add_action('wp_head', fn() => $this->enqueue_play_cdn(), 1_000_001); + add_action('wp_head', fn () => $this->enqueue_play_cdn(), 1_000_001); } if ( @@ -99,7 +103,7 @@ public function append_header() && current_user_can('manage_options') && ! apply_filters('f!windpress/core/runtime:append_header.ubiquitous_panel.is_prevent_load', false) ) { - add_action('wp_head', fn() => $this->enqueue_front_panel(), 1_000_001); + add_action('wp_head', fn () => $this->enqueue_front_panel(), 1_000_001); } } @@ -136,7 +140,9 @@ public function enqueue_css_cache() public function enqueue_play_cdn($display = true) { - $volumeEntries = array_reduce(Volume::get_entries(), fn($carry, $entry) => $carry + ['/' . $entry['relative_path'] => $entry['content']], []); + $volumeEntries = array_reduce(Volume::get_entries(), fn ($carry, $entry) => $carry + [ + '/' . $entry['relative_path'] => $entry['content'], + ], []); // Script content are base64 encoded to prevent it from being executed by the browser. // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped diff --git a/src/Core/Volume.php b/src/Core/Volume.php index 9d958be..8c8cabf 100644 --- a/src/Core/Volume.php +++ b/src/Core/Volume.php @@ -57,7 +57,7 @@ public static function get_entries(): array $stubs_main_css = file_get_contents(dirname(WIND_PRESS::FILE) . '/stubs/main.css'); // check if 'main.css' already exists and content is not empty, else use the stubs - $main_css_key = array_search('main.css', array_column($entries, 'name')); + $main_css_key = array_search('main.css', array_column($entries, 'name'), true); if ($main_css_key === false) { $entries[] = [ @@ -106,7 +106,7 @@ public static function save_entries($entries) do_action('f!windpress/core/volume:save_entries.entry', $entry); // use specific handler instead for efficient handling - do_action("f!windpress/core/volume:save_entries.entry.{$entry['handler']}", $entry); + do_action('f!windpress/core/volume:save_entries.entry.' . $entry['handler'], $entry); } continue; @@ -122,7 +122,7 @@ public static function save_entries($entries) continue; } - $entry['relative_path'] = "custom/{$file_name}"; + $entry['relative_path'] = 'custom/' . $file_name; $entry['signature'] = wp_create_nonce(sprintf('%s:%s', WIND_PRESS::WP_OPTION, $entry['relative_path'])); } diff --git a/src/Integration/Bricks/Main.php b/src/Integration/Bricks/Main.php index ac7007e..c768174 100644 --- a/src/Integration/Bricks/Main.php +++ b/src/Integration/Bricks/Main.php @@ -30,7 +30,7 @@ public function __construct() add_filter('f!windpress/core/runtime:is_prevent_load', fn (bool $is_prevent_load): bool => $this->is_prevent_load($is_prevent_load)); add_filter('f!windpress/core/runtime:append_header.ubiquitous_panel.is_prevent_load', fn (bool $is_prevent_load): bool => $this->is_prevent_load($is_prevent_load)); add_filter('f!windpress/core/runtime:append_header.exclude_admin', fn (bool $is_exclude_admin): bool => $this->is_exclude_admin($is_exclude_admin)); - + new Editor(); } } diff --git a/src/Utils/Common.php b/src/Utils/Common.php index 78568db..69a9572 100644 --- a/src/Utils/Common.php +++ b/src/Utils/Common.php @@ -149,7 +149,7 @@ public static function save_file($content, string $file_path, int $flags = 0): v /** * Deletes a file or directory. * - * @param string $file Path to the file or directory. + * @param string $file_path Path to the file or directory. * @param bool $recursive Optional. If set to true, deletes files and folders recursively. * Default false. * @param string|false $type Type of resource. 'f' for file, 'd' for directory.