Skip to content

Commit

Permalink
made changes for code_sniffer error on rest_api file
Browse files Browse the repository at this point in the history
  • Loading branch information
rishishah-multidots committed Aug 22, 2024
1 parent cf605d5 commit f115c3b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 37 deletions.
22 changes: 11 additions & 11 deletions lib/compat/wordpress-6.6/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,28 +166,28 @@ function update_comment_meta_from_rest_request( $response, $comment, $request )
}
}

if( isset( $request['comment_type'] ) && !empty( $request['comment_type'] ) ){
if ( isset( $request['comment_type'] ) && ! empty( $request['comment_type'] ) ) {
$comment_data = array(
'comment_ID' => $comment->comment_ID,
'comment_type' => $request['comment_type'],
'comment_ID' => $comment->comment_ID,

Check failure on line 171 in lib/compat/wordpress-6.6/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Spaces must be used for mid-line alignment; tabs are not allowed

Check warning on line 171 in lib/compat/wordpress-6.6/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Array double arrow not aligned correctly; expected 3 space(s) between "'comment_ID'" and double arrow, but found 4.
'comment_type' => $request['comment_type'],

Check failure on line 172 in lib/compat/wordpress-6.6/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Spaces must be used for mid-line alignment; tabs are not allowed

Check warning on line 172 in lib/compat/wordpress-6.6/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Array double arrow not aligned correctly; expected 1 space(s) between "'comment_type'" and double arrow, but found 2.
);
wp_update_comment($comment_data);

wp_update_comment( $comment_data );
}

$author = get_user_by('login', $response->data['author_name']);
$author = get_user_by( 'login', $response->data['author_name'] );
if ($author) {

Check failure on line 179 in lib/compat/wordpress-6.6/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

No space after opening parenthesis is prohibited

Check failure on line 179 in lib/compat/wordpress-6.6/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

No space before closing parenthesis is prohibited
$avatar_url = get_avatar_url($author->ID);
$avatar_url = get_avatar_url( $author->ID );

Check warning on line 180 in lib/compat/wordpress-6.6/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Equals sign not aligned with surrounding assignments; expected 27 spaces but found 1 space
$response->data['author_avatar_urls'] = array(
'default' => $avatar_url,
'48' => add_query_arg( 's', 48, $avatar_url ),
'96' => add_query_arg( 's', 96, $avatar_url ),
'default' => $avatar_url,

Check failure on line 182 in lib/compat/wordpress-6.6/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Spaces must be used for mid-line alignment; tabs are not allowed

Check warning on line 182 in lib/compat/wordpress-6.6/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Array double arrow not aligned correctly; expected 1 space(s) between "'default'" and double arrow, but found 3.
'48' => add_query_arg( 's', 48, $avatar_url ),

Check failure on line 183 in lib/compat/wordpress-6.6/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Spaces must be used for mid-line alignment; tabs are not allowed

Check warning on line 183 in lib/compat/wordpress-6.6/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Array double arrow not aligned correctly; expected 6 space(s) between "'48'" and double arrow, but found 8.
'96' => add_query_arg( 's', 96, $avatar_url ),

Check failure on line 184 in lib/compat/wordpress-6.6/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Spaces must be used for mid-line alignment; tabs are not allowed

Check warning on line 184 in lib/compat/wordpress-6.6/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Array double arrow not aligned correctly; expected 6 space(s) between "'96'" and double arrow, but found 8.
);
}

$comment_id = $comment->comment_ID;
$meta_key = 'block_comment';

Check warning on line 189 in lib/compat/wordpress-6.6/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
$meta_value = get_comment_meta($comment_id, $meta_key, true);
$meta_value = get_comment_meta( $comment_id, $meta_key, true );

if( !empty( $meta_value ) ){

Check failure on line 192 in lib/compat/wordpress-6.6/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Space after opening control structure is required

Check failure on line 192 in lib/compat/wordpress-6.6/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

No space before opening parenthesis is prohibited

Check failure on line 192 in lib/compat/wordpress-6.6/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Expected 1 space after IF keyword; 0 found
$response->data['meta'] = $meta_value;
Expand Down
53 changes: 27 additions & 26 deletions lib/experimental/editor-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,33 @@
*/
function gutenberg_enable_experiments() {
$gutenberg_experiments = get_option( 'gutenberg-experiments' );
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-sync-collaboration', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableSync = true', 'before' );
}
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-custom-dataviews', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalCustomViews = true', 'before' );
}
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-color-randomizer', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableColorRandomizer = true', 'before' );
}
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-grid-interactivity', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableGridInteractivity = true', 'before' );
}
if ( gutenberg_is_experiment_enabled( 'gutenberg-no-tinymce' ) ) {
wp_add_inline_script( 'wp-block-library', 'window.__experimentalDisableTinymce = true', 'before' );
}
if ( gutenberg_is_experiment_enabled( 'gutenberg-full-page-client-side-navigation' ) ) {
wp_add_inline_script( 'wp-block-library', 'window.__experimentalFullPageClientSideNavigation = true', 'before' );
}
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-zoomed-out-patterns-tab', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableZoomedOutPatternsTab = true', 'before' );
}
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-block-comment', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableBlockComment = true', 'before' );
}
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-quick-edit-dataviews', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalQuickEditDataViews = true', 'before' );
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-sync-collaboration', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableSync = true', 'before' );
}
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-custom-dataviews', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalCustomViews = true', 'before' );
}
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-color-randomizer', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableColorRandomizer = true', 'before' );
}
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-grid-interactivity', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableGridInteractivity = true', 'before' );
}
if ( gutenberg_is_experiment_enabled( 'gutenberg-no-tinymce' ) ) {
wp_add_inline_script( 'wp-block-library', 'window.__experimentalDisableTinymce = true', 'before' );
}
if ( gutenberg_is_experiment_enabled( 'gutenberg-full-page-client-side-navigation' ) ) {
wp_add_inline_script( 'wp-block-library', 'window.__experimentalFullPageClientSideNavigation = true', 'before' );
}
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-zoomed-out-patterns-tab', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableZoomedOutPatternsTab = true', 'before' );
}
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-block-comment', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableBlockComment = true', 'before' );
}
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-quick-edit-dataviews', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalQuickEditDataViews = true', 'before' );
}
}

add_action( 'admin_init', 'gutenberg_enable_experiments' );
Expand Down

0 comments on commit f115c3b

Please sign in to comment.