diff --git a/.github/workflows/wpcs.yml b/.github/workflows/wpcs.yml index 7213dd2..c90215b 100644 --- a/.github/workflows/wpcs.yml +++ b/.github/workflows/wpcs.yml @@ -18,7 +18,7 @@ jobs: standard_repo: '' # Public (git) repository URL of the coding standard repo_branch: 'master' # Branch of Standard repository phpcs_bin_path: 'phpcs' # Custom PHPCS bin path - use_local_config: 'false' # Use local config if available + use_local_config: 'true' # Use local config if available extra_args: '--report-json=./phpcs.json' - name: Update summary run: | diff --git a/pattern-wrangler.php b/pattern-wrangler.php index d0c0659..cb9bc52 100644 --- a/pattern-wrangler.php +++ b/pattern-wrangler.php @@ -65,8 +65,6 @@ public function plugins_loaded() { basename( __DIR__ ) . '/languages' ); - // Blocks::run(); - $admin = new Admin(); $admin->run(); diff --git a/php/Admin.php b/php/Admin.php index 77aa5b7..57a8529 100644 --- a/php/Admin.php +++ b/php/Admin.php @@ -386,8 +386,8 @@ public function output_pattern_sync_column( $column, $post_id ) { * Add the admin menu. */ public function add_admin_menu() { - $options = Options::get_options(); - $hide_all_patterns = (bool) $options['hideAllPatterns'] ?? false; + $options = Options::get_options(); + $hide_all_patterns = (bool) $options['hideAllPatterns'] ?? false; $hide_patterns_menu = (bool) $options['hidePatternsMenu'] ?? false; if ( $hide_all_patterns && $hide_patterns_menu ) { diff --git a/php/Blocks.php b/php/Blocks.php index d2d7f7b..8cc6a6e 100644 --- a/php/Blocks.php +++ b/php/Blocks.php @@ -310,7 +310,6 @@ public function init() { ); // Enqueue block assets. - // add_action( 'enqueue_block_assets', array( $this, 'register_block_styles' ) ); add_action( 'enqueue_block_editor_assets', array( $this, 'register_block_editor_scripts' ) ); } diff --git a/php/Functions.php b/php/Functions.php index 34c938b..5a9d9bf 100644 --- a/php/Functions.php +++ b/php/Functions.php @@ -182,6 +182,31 @@ function ( $a, $b ) { return $all_categories; } + /** + * Get the plugin's supported file extensions. + * + * @since 1.0.0 + * + * @return array The supported file extensions. + */ + public static function get_supported_file_extensions() { + $file_extensions = array( + 'jpeg', + 'jpg', + 'gif', + 'png', + 'webp', + ); + /** + * Filter the valid file extensions for the photo block. + * + * @param array $file_extensions The valid mime types. + */ + $file_extensions = apply_filters( 'wppic_block_file_extensions', $file_extensions ); + + return $file_extensions; + } + /** * Get the current admin tab. * diff --git a/php/Options.php b/php/Options.php index 430d16c..fcfc0bc 100644 --- a/php/Options.php +++ b/php/Options.php @@ -1,5 +1,4 @@ $pattern ) { if ( ! isset( $pattern['categories'] ) || empty( $pattern['categories'] ) ) { unregister_block_pattern( $pattern['slug'] ); + } else { + $found = false; + $block_categories = $pattern['categories'] ?? array(); + foreach ( $block_categories as $block_category ) { + $categories = \WP_Block_Pattern_Categories_Registry::get_instance(); + if ( $categories->is_registered( $block_category ) ) { + $found = true; + } + } + if ( ! $found ) { + unregister_block_pattern( $pattern['name'] ); + } } } } diff --git a/php/Plugin_License.php b/php/Plugin_License.php index 8f3dd04..909babc 100644 --- a/php/Plugin_License.php +++ b/php/Plugin_License.php @@ -78,8 +78,8 @@ public function perform_action( string $action, string $license = '', bool $forc */ private function perform_license_action( string $action, bool $force ) { - $options = Options::get_options(); - $maybe_check = get_site_transient( 'dlxgbhacks_core_license_check' ); + $options = Options::get_options(); + $maybe_check = get_site_transient( 'dlxgbhacks_core_license_check' ); if ( 'check_license' === $action && ! $force && $maybe_check ) { return $maybe_check; diff --git a/phpcs.xml.dist b/phpcs.xml.dist index e0fad5e..5b922d8 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -16,4 +16,8 @@ /node_modules/ /vendor/ + /lib/ + /build/ + /dist/ + /php/Plugin_Updater.php