Skip to content

Commit

Permalink
Fix remaining PHPCS issues
Browse files Browse the repository at this point in the history
  • Loading branch information
chriszarate committed Jun 11, 2021
1 parent 39ea70a commit 06f3662
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
19 changes: 10 additions & 9 deletions blocks/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function ( $block ) {
// shoved inside. Set a usable block name and allow the client to use the
// HTML as they see fit.
if ( null === $block['blockName'] ) {
$block['blockName'] = 'core/classic-editor';
$block['blockName'] = 'core/classic-editor';
}

// Map the block attributes to the shape of BlockAttribute.
Expand All @@ -47,24 +47,25 @@ function ( $key ) use ( $block ) {
array_keys( $block['attrs'] )
);

$tagName = null;
$innerHTML = $outerHTML = trim( $block['innerHTML'] );
$tag_name = null;
$inner_html = trim( $block['innerHTML'] );
$outer_html = $inner_html;

// Strip wrapping tags from the content and set as a property on the block.
// This allows the front-end implementor to delegate tag creation to a
// component.
preg_match( '#^<([A-z][A-z0-9]*)\b([^>])*>(.*?)</\1>$#', $innerHTML, $matches );
preg_match( '#^<([A-z][A-z0-9]*)\b([^>])*>(.*?)</\1>$#', $inner_html, $matches );
if ( isset( $matches[1] ) ) {
$innerHTML = $matches[3];
$tagName = $matches[1];
$inner_html = $matches[3];
$tag_name = $matches[1];
}

return [
'attributes' => $attributes,
'innerHTML' => $innerHTML,
'innerHTML' => $inner_html,
'name' => $block['blockName'],
'outerHTML' => $outerHTML,
'tagName' => $tagName,
'outerHTML' => $outer_html,
'tagName' => $tag_name,
];
},
$blocks
Expand Down
3 changes: 1 addition & 2 deletions settings/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

function vip_decoupled_menu_content() {
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
wp_die( esc_html( __( 'You do not have sufficient permissions to access this page.' ) ) );
}

?>
Expand All @@ -26,7 +26,6 @@ function vip_decoupled_plugin_blocks_render( $args ) {
?>
<input type='checkbox' name='vip_decoupled_settings[vip_decoupled_plugin_blocks]' value="1" <?php checked( '1', $vip_decoupled_options['vip_decoupled_plugin_blocks'] ); ?> />
<?php

}

function vip_decoupled_plugin_wpgraphql_render( $args ) {
Expand Down
4 changes: 2 additions & 2 deletions vip-decoupled.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
/**
* WPGraphQL 1.3.8
*/
if ( $vip_decoupled_options['vip_decoupled_plugin_wpgraphql'] == '1' ) {
if ( '1' === $vip_decoupled_options['vip_decoupled_plugin_wpgraphql'] ) {
require_once __DIR__ . '/wp-graphql-1.3.8/wp-graphql.php';
}

/**
* Make Gutenberg blocks available in WPGraphQL
*/
if ( $vip_decoupled_options['vip_decoupled_plugin_blocks'] == '1' ) {
if ( '1' === $vip_decoupled_options['vip_decoupled_plugin_blocks'] ) {
require_once __DIR__ . '/blocks/blocks.php';
}

Expand Down

0 comments on commit 06f3662

Please sign in to comment.