Skip to content

Commit

Permalink
Merge branch 'raikasdev-fix/php-style-and-allowed-blocks'
Browse files Browse the repository at this point in the history
  • Loading branch information
ronilaukkarinen committed Dec 8, 2023
2 parents 58c0c90 + 2b2a7c8 commit e713fe2
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 14 deletions.
3 changes: 1 addition & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@
// Restrict to only selected blocks
// Set the value to 'all' to allow all blocks everywhere
'allowed_blocks' => [
'default' => [
],
'default' => [],
'post' => [
'core/archives',
'core/audio',
Expand Down
4 changes: 4 additions & 0 deletions inc/hooks/gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ function allowed_block_types( $allowed_blocks, $editor_context ) {

// If there is post type specific blocks, add them to the allowed blocks list
if ( isset( $editor_context->post->post_type ) && isset( THEME_SETTINGS['allowed_blocks'][ $editor_context->post->post_type ] ) ) {
if ( 'all' === THEME_SETTINGS['allowed_blocks'][ $editor_context->post->post_type ] ) {
return $allowed_blocks;
}

$allowed_blocks = array_merge( $allowed_blocks, THEME_SETTINGS['allowed_blocks'][ $editor_context->post->post_type ] );
}

Expand Down
4 changes: 1 addition & 3 deletions inc/includes/nav-walker.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ public function start_lvl( &$output, $depth = 0, $args = null ) {
} else {
$output .= "\n{$n}{$indent}<ul>{$n}";
}

}

/**
Expand Down Expand Up @@ -146,7 +145,7 @@ public function start_el( &$output, $item, $depth = 0, $args = null, $id = 0 ) {

// Updating the CSS classes of a menu item in the WordPress Customizer preview results in all classes defined
// in that particular input box to come in as one big class string.
$split_on_spaces = function ( $class ) {
$split_on_spaces = function( $class ) {
return preg_split( '/\s+/', $class );
};
$classes = $this->flatten( array_map( $split_on_spaces, $classes ) );
Expand Down Expand Up @@ -600,5 +599,4 @@ public function flatten( $array ) {
}
return $result;
}

}
1 change: 0 additions & 1 deletion inc/includes/post-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,4 @@ public function register_wp_post_type( $slug, $args ) {

return register_post_type( $slug, $args );
}

}
1 change: 0 additions & 1 deletion inc/includes/taxonomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,4 @@ protected function register_wp_taxonomy( $slug, $object_types, $args ) {

return $registered_object_types;
}

}
1 change: 0 additions & 1 deletion inc/taxonomies/your-taxonomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,4 @@ public function register( array $post_types = [] ) {

$this->register_wp_taxonomy( $this->slug, $post_types, $args );
}

}
1 change: 0 additions & 1 deletion inc/template-tags/edit-link.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ function air_edit_link() {
</a>
</p>
<?php

}
3 changes: 2 additions & 1 deletion inc/template-tags/single-comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

namespace Air_Light;

function single_comment( $comment, $args, $depth ) { ?>
function single_comment( $comment, $args, $depth ) {
?>
<li id="li-comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
<div id="comment-<?php comment_ID(); ?>">
<?php echo get_avatar( $comment, '62' ); ?>
Expand Down
13 changes: 9 additions & 4 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@
<exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact" />
<exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect" />
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" />
<exclude name="WordPress.WhiteSpace.PrecisionAlignment" />
<exclude name="PEAR.Functions.FunctionCallSignature.Indent" />
<exclude name="WordPress.Arrays.ArrayIndentation.ItemNotAligned" />
<exclude name="WordPress.Arrays.ArrayIndentation.MultiLineArrayItemNotAligned" />
<exclude name="WordPress.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed" />
<exclude name="Universal.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed" />
<exclude name="WordPress.Arrays.ArrayIndentation.CloseBraceNotAligned" />
<exclude name="PEAR.Functions.FunctionCallSignature.OpeningIndent" />

Expand All @@ -58,7 +57,6 @@
<exclude name="WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound" />
<exclude name="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace" />
<exclude name="PHPCompatibility.PHP.NewFunctionArrayDereferencing.Found" />
<exclude name="Generic.Arrays.DisallowShortArraySyntax" />

<!-- General WordPress stuff we like to overrule -->
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
Expand Down Expand Up @@ -97,8 +95,15 @@
<exclude name="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned" />
<exclude name="WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode" />
<exclude name="WordPress.DB.SlowDBQuery.slow_db_query_tax_query" />
<exclude name="WordPress.PHP.DisallowShortTernary.Found" />
<exclude name="Universal.Operators.DisallowShortTernary.Found" />
<exclude name="WordPress.DB.SlowDBQuery.slow_db_query_meta_query" />
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction" />
<exclude name="WordPress.PHP.DisallowShortTernary.Found" />
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found" />

<!-- Whitespace rules -->
<exclude name="WordPress.WhiteSpace.PrecisionAlignment.Found" />
<exclude name="WordPress.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed" />

<!-- Project based -->
<exclude name="Squiz.PHP.CommentedOutCode.Found" />
Expand Down

0 comments on commit e713fe2

Please sign in to comment.