some phpcs fixes (#590)

* some phpcs fixes

* add default $hashalg
This commit is contained in:
Matthias Pfefferle 2023-12-07 12:30:44 +01:00 committed by GitHub
parent 93b2f1ee7d
commit e5fe4f20b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 29 additions and 28 deletions

View file

@ -171,7 +171,7 @@ function plugin_settings_link( $actions ) {
*/ */
add_action( add_action(
'bp_include', 'bp_include',
function() { function () {
require_once __DIR__ . '/integration/class-buddypress.php'; require_once __DIR__ . '/integration/class-buddypress.php';
Integration\Buddypress::init(); Integration\Buddypress::init();
}, },

View file

@ -1 +1 @@
<?php return array('dependencies' => array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '6aeec6336fd28aa836a7'); <?php return array( 'dependencies' => array( 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives' ), 'version' => '6aeec6336fd28aa836a7' );

View file

@ -1 +1 @@
<?php return array('dependencies' => array('wp-api-fetch', 'wp-components', 'wp-compose', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '5b48281e37700a970a66'); <?php return array( 'dependencies' => array( 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-primitives' ), 'version' => '5b48281e37700a970a66' );

View file

@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-url'), 'version' => '59d9702e06860a6d13e4'); <?php return array( 'dependencies' => array( 'react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-url' ), 'version' => '59d9702e06860a6d13e4' );

View file

@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '04e51e7562fe28b0b2c3'); <?php return array( 'dependencies' => array( 'react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url' ), 'version' => '04e51e7562fe28b0b2c3' );

View file

@ -374,7 +374,7 @@ class Activitypub {
array( array(
'type' => 'string', 'type' => 'string',
'single' => false, 'single' => false,
'sanitize_callback' => function( $value ) { 'sanitize_callback' => function ( $value ) {
if ( ! is_string( $value ) ) { if ( ! is_string( $value ) ) {
throw new Exception( 'Error message is no valid string' ); throw new Exception( 'Error message is no valid string' );
} }
@ -390,7 +390,7 @@ class Activitypub {
array( array(
'type' => 'string', 'type' => 'string',
'single' => false, 'single' => false,
'sanitize_callback' => function( $value ) { 'sanitize_callback' => function ( $value ) {
return esc_sql( $value ); return esc_sql( $value );
}, },
) )
@ -402,7 +402,7 @@ class Activitypub {
array( array(
'type' => 'string', 'type' => 'string',
'single' => true, 'single' => true,
'sanitize_callback' => function( $value ) { 'sanitize_callback' => function ( $value ) {
return sanitize_text_field( $value ); return sanitize_text_field( $value );
}, },
) )

View file

@ -172,7 +172,7 @@ class Admin {
'description' => \esc_html__( 'The Identifier of the Blog-User', 'activitypub' ), 'description' => \esc_html__( 'The Identifier of the Blog-User', 'activitypub' ),
'show_in_rest' => true, 'show_in_rest' => true,
'default' => Blog_User::get_default_username(), 'default' => Blog_User::get_default_username(),
'sanitize_callback' => function( $value ) { 'sanitize_callback' => function ( $value ) {
// hack to allow dots in the username // hack to allow dots in the username
$parts = explode( '.', $value ); $parts = explode( '.', $value );
$sanitized = array(); $sanitized = array();

View file

@ -96,7 +96,7 @@ class Blocks {
$attrs['followerData']['total'] = $follower_data['total']; $attrs['followerData']['total'] = $follower_data['total'];
$attrs['followerData']['followers'] = array_map( $attrs['followerData']['followers'] = array_map(
function( $follower ) { function ( $follower ) {
return self::filter_array_by_keys( return self::filter_array_by_keys(
$follower->to_array(), $follower->to_array(),
array( 'icon', 'name', 'preferredUsername', 'url' ) array( 'icon', 'name', 'preferredUsername', 'url' )

View file

@ -292,6 +292,7 @@ class Signature {
if ( is_array( $headers['digest'] ) ) { if ( is_array( $headers['digest'] ) ) {
$headers['digest'] = $headers['digest'][0]; $headers['digest'] = $headers['digest'][0];
} }
$hashalg = 'sha256';
$digest = explode( '=', $headers['digest'], 2 ); $digest = explode( '=', $headers['digest'], 2 );
if ( 'SHA-256' === $digest[0] ) { if ( 'SHA-256' === $digest[0] ) {
$hashalg = 'sha256'; $hashalg = 'sha256';

View file

@ -182,7 +182,7 @@ class Followers {
$query = new WP_Query( $args ); $query = new WP_Query( $args );
$total = $query->found_posts; $total = $query->found_posts;
$followers = array_map( $followers = array_map(
function( $post ) { function ( $post ) {
return Follower::init_from_cpt( $post ); return Follower::init_from_cpt( $post );
}, },
$query->get_posts() $query->get_posts()

View file

@ -77,7 +77,7 @@ class Interactions {
// No nonce possible for this submission route // No nonce possible for this submission route
\add_filter( \add_filter(
'akismet_comment_nonce', 'akismet_comment_nonce',
function() { function () {
return 'inactive'; return 'inactive';
} }
); );
@ -125,7 +125,7 @@ class Interactions {
// No nonce possible for this submission route // No nonce possible for this submission route
\add_filter( \add_filter(
'akismet_comment_nonce', 'akismet_comment_nonce',
function() { function () {
return 'inactive'; return 'inactive';
} }
); );

View file

@ -94,7 +94,7 @@ class Followers {
// phpcs:ignore // phpcs:ignore
$json->orderedItems = array_map( $json->orderedItems = array_map(
function( $item ) use ( $context ) { function ( $item ) use ( $context ) {
if ( 'full' === $context ) { if ( 'full' === $context ) {
return $item->to_array(); return $item->to_array();
} }

View file

@ -237,7 +237,7 @@ class Inbox {
$params['actor'] = array( $params['actor'] = array(
'required' => true, 'required' => true,
'sanitize_callback' => function( $param, $request, $key ) { 'sanitize_callback' => function ( $param, $request, $key ) {
return object_to_uri( $param ); return object_to_uri( $param );
}, },
); );
@ -246,7 +246,7 @@ class Inbox {
'required' => true, 'required' => true,
//'type' => 'enum', //'type' => 'enum',
//'enum' => array( 'Create' ), //'enum' => array( 'Create' ),
//'sanitize_callback' => function( $param, $request, $key ) { //'sanitize_callback' => function ( $param, $request, $key ) {
// return \strtolower( $param ); // return \strtolower( $param );
//}, //},
); );
@ -279,7 +279,7 @@ class Inbox {
$params['actor'] = array( $params['actor'] = array(
'required' => true, 'required' => true,
//'type' => array( 'object', 'string' ), //'type' => array( 'object', 'string' ),
'sanitize_callback' => function( $param, $request, $key ) { 'sanitize_callback' => function ( $param, $request, $key ) {
return object_to_uri( $param ); return object_to_uri( $param );
}, },
); );
@ -288,7 +288,7 @@ class Inbox {
'required' => true, 'required' => true,
//'type' => 'enum', //'type' => 'enum',
//'enum' => array( 'Create' ), //'enum' => array( 'Create' ),
//'sanitize_callback' => function( $param, $request, $key ) { //'sanitize_callback' => function ( $param, $request, $key ) {
// return \strtolower( $param ); // return \strtolower( $param );
//}, //},
); );
@ -300,7 +300,7 @@ class Inbox {
$params['to'] = array( $params['to'] = array(
'required' => false, 'required' => false,
'sanitize_callback' => function( $param, $request, $key ) { 'sanitize_callback' => function ( $param, $request, $key ) {
if ( \is_string( $param ) ) { if ( \is_string( $param ) ) {
$param = array( $param ); $param = array( $param );
} }
@ -310,7 +310,7 @@ class Inbox {
); );
$params['cc'] = array( $params['cc'] = array(
'sanitize_callback' => function( $param, $request, $key ) { 'sanitize_callback' => function ( $param, $request, $key ) {
if ( \is_string( $param ) ) { if ( \is_string( $param ) ) {
$param = array( $param ); $param = array( $param );
} }
@ -320,7 +320,7 @@ class Inbox {
); );
$params['bcc'] = array( $params['bcc'] = array(
'sanitize_callback' => function( $param, $request, $key ) { 'sanitize_callback' => function ( $param, $request, $key ) {
if ( \is_string( $param ) ) { if ( \is_string( $param ) ) {
$param = array( $param ); $param = array( $param );
} }

View file

@ -12,7 +12,7 @@ class ActivityPub_TestCase_Cache_HTTP extends \WP_UnitTestCase {
add_filter( add_filter(
'rest_url', 'rest_url',
function() { function () {
return get_option( 'home' ) . '/wp-json/'; return get_option( 'home' ) . '/wp-json/';
} }
); );

View file

@ -70,7 +70,7 @@ class Test_Activitypub_Activity_Dispatcher extends ActivityPub_TestCase_Cache_HT
add_filter( add_filter(
'activitypub_extract_mentions', 'activitypub_extract_mentions',
function( $mentions ) { function ( $mentions ) {
$mentions[] = 'https://example.com/alex'; $mentions[] = 'https://example.com/alex';
return $mentions; return $mentions;
}, },
@ -134,7 +134,7 @@ class Test_Activitypub_Activity_Dispatcher extends ActivityPub_TestCase_Cache_HT
add_filter( add_filter(
'activitypub_is_user_type_disabled', 'activitypub_is_user_type_disabled',
function( $value, $type ) { function ( $value, $type ) {
if ( 'blog' === $type ) { if ( 'blog' === $type ) {
return false; return false;
} else { } else {

View file

@ -12,7 +12,7 @@ class Test_Activitypub_Activity extends WP_UnitTestCase {
add_filter( add_filter(
'activitypub_extract_mentions', 'activitypub_extract_mentions',
function( $mentions ) { function ( $mentions ) {
$mentions['@alex'] = 'https://example.com/alex'; $mentions['@alex'] = 'https://example.com/alex';
return $mentions; return $mentions;
}, },

View file

@ -76,7 +76,7 @@ class Test_Activitypub_Followers extends WP_UnitTestCase {
$this->assertEquals( 3, \count( $db_followers ) ); $this->assertEquals( 3, \count( $db_followers ) );
$db_followers = array_map( $db_followers = array_map(
function( $item ) { function ( $item ) {
return $item->get_url(); return $item->get_url();
}, },
$db_followers $db_followers

View file

@ -55,7 +55,7 @@ class Test_Activitypub_Signature_Verification extends WP_UnitTestCase {
public function test_rest_activity_signature() { public function test_rest_activity_signature() {
add_filter( add_filter(
'pre_get_remote_metadata_by_actor', 'pre_get_remote_metadata_by_actor',
function( $json, $actor ) { function ( $json, $actor ) {
$user = Activitypub\Collection\Users::get_by_id( 1 ); $user = Activitypub\Collection\Users::get_by_id( 1 );
$public_key = Activitypub\Signature::get_public_key_for( $user->get__id() ); $public_key = Activitypub\Signature::get_public_key_for( $user->get__id() );
// return ActivityPub Profile with signature // return ActivityPub Profile with signature