Skip to content

Commit

Permalink
Resolve linting issues
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Fusco <[email protected]>
  • Loading branch information
josephfusco committed Dec 1, 2023
1 parent c9894ab commit 5cd554d
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions plugins/faustwp/includes/blocks/callbacks.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,32 @@ function register_custom_blocks() {
$asset_file = trailingslashit( $dir ) . 'index.asset.json';

if ( file_exists( $metadata_file ) ) {
$block_metadata = json_decode( file_get_contents( $metadata_file ), true );
$asset_data = file_exists( $asset_file ) ? json_decode( file_get_contents( $asset_file ), true ) : array();
$block_metadata = json_decode( wp_remote_get( $metadata_file ), true );
$asset_data = file_exists( $asset_file ) ? json_decode( wp_remote_get( $asset_file ), true ) : array();
$block_name = basename( $dir );

$dependencies = $asset_data['dependencies'] ?? array();
$version = $asset_data['version'] ?? '';

$block_args = array();

// Register editor script
// Register editor script.
if ( isset( $block_metadata['editorScript'] ) ) {
$editor_script_handle = register_block_asset( $block_metadata, 'editorScript', $block_name, $dependencies, $version );
if ( $editor_script_handle ) {
$block_args['editor_script'] = $editor_script_handle;
}
}

// Register editor style
// Register editor style.
if ( isset( $block_metadata['editorStyle'] ) ) {
$editor_style_handle = register_block_asset( $block_metadata, 'editorStyle', $block_name, array(), $version );
if ( $editor_style_handle ) {
$block_args['editor_style'] = $editor_style_handle;
}
}

// Register style
// Register style.
if ( isset( $block_metadata['style'] ) ) {
$style_handle = register_block_asset( $block_metadata, 'style', $block_name, array(), $version );
if ( $style_handle ) {
Expand Down Expand Up @@ -100,14 +100,9 @@ function register_custom_blocks() {
function correct_asset_src_for_uploads_dir( $src, $handle ) {
// Check for the presence of "faustwp/blocks" in the src.
if ( strpos( $src, 'faustwp/blocks' ) !== false ) {
error_log( $src );
error_log( $handle );

// Extract the specific block directory.
preg_match( '#faustwp/blocks/([^/]+)#', $src, $matches );

error_log( print_r( $matches, true ) );

if ( isset( $matches[1] ) ) {
$uploads_dir = wp_upload_dir();
$base_url = trailingslashit( $uploads_dir['baseurl'] );
Expand Down

0 comments on commit 5cd554d

Please sign in to comment.