Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions build/followers/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ function ( $follower ) {
return array(
'handle' => '@' . $username,
'icon' => $actor->get_icon(),
// phpcs:ignore Universal.Operators.DisallowShortTernary.Found
'name' => $actor->get_name() ?: $username,
// phpcs:ignore Universal.Operators.DisallowShortTernary.Found
'url' => object_to_uri( $actor->get_url() ) ?: $actor->get_id(),
);
},
Expand Down
2 changes: 1 addition & 1 deletion includes/class-avatars.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static function pre_get_avatar_data( $args, $id_or_email ) {
* @param array $allowed_comment_types Array of allowed comment types.
*/
$allowed_comment_types = \apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
if ( ! \in_array( $id_or_email->comment_type ?: 'comment', $allowed_comment_types, true ) ) { // phpcs:ignore Universal.Operators.DisallowShortTernary
if ( ! \in_array( $id_or_email->comment_type ?: 'comment', $allowed_comment_types, true ) ) {
return $args;
}

Expand Down
8 changes: 4 additions & 4 deletions includes/class-moderation.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public static function add_user_block( $user_id, $type, $value ) {

case self::TYPE_DOMAIN:
case self::TYPE_KEYWORD:
$blocks = \get_user_meta( $user_id, self::USER_META_KEYS[ $type ], true ) ?: array(); // phpcs:ignore Universal.Operators.DisallowShortTernary.Found
$blocks = \get_user_meta( $user_id, self::USER_META_KEYS[ $type ], true ) ?: array();

if ( ! \in_array( $value, $blocks, true ) ) {
/**
Expand Down Expand Up @@ -152,7 +152,7 @@ public static function remove_user_block( $user_id, $type, $value ) {

case self::TYPE_DOMAIN:
case self::TYPE_KEYWORD:
$blocks = \get_user_meta( $user_id, self::USER_META_KEYS[ $type ], true ) ?: array(); // phpcs:ignore Universal.Operators.DisallowShortTernary.Found
$blocks = \get_user_meta( $user_id, self::USER_META_KEYS[ $type ], true ) ?: array();
$key = \array_search( $value, $blocks, true );

if ( false !== $key ) {
Expand Down Expand Up @@ -183,8 +183,8 @@ public static function remove_user_block( $user_id, $type, $value ) {
public static function get_user_blocks( $user_id ) {
return array(
'actors' => \wp_list_pluck( Blocked_Actors::get_many( $user_id ), 'guid' ),
'domains' => \get_user_meta( $user_id, self::USER_META_KEYS[ self::TYPE_DOMAIN ], true ) ?: array(), // phpcs:ignore Universal.Operators.DisallowShortTernary.Found
'keywords' => \get_user_meta( $user_id, self::USER_META_KEYS[ self::TYPE_KEYWORD ], true ) ?: array(), // phpcs:ignore Universal.Operators.DisallowShortTernary.Found
'domains' => \get_user_meta( $user_id, self::USER_META_KEYS[ self::TYPE_DOMAIN ], true ) ?: array(),
'keywords' => \get_user_meta( $user_id, self::USER_META_KEYS[ self::TYPE_KEYWORD ], true ) ?: array(),
);
}

Expand Down
1 change: 0 additions & 1 deletion includes/class-move.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ public static function internally( $from, $to ) {
* @param string $from The current account URL.
*/
private static function update_user_also_known_as( $user_id, $from ) {
// phpcs:ignore Universal.Operators.DisallowShortTernary.Found
$also_known_as = \get_user_option( 'activitypub_also_known_as', $user_id ) ?: array();
$also_known_as[] = $from;

Expand Down
2 changes: 0 additions & 2 deletions includes/collection/class-inbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,9 @@ private static function get_object_title( $activity_object ) {
return $post_id ? \get_the_title( $post_id ) : '';
}

// phpcs:ignore Universal.Operators.DisallowShortTernary.Found
$title = $activity_object->get_name() ?: $activity_object->get_content();

if ( ! $title && $activity_object->get_object() instanceof Base_Object ) {
// phpcs:ignore Universal.Operators.DisallowShortTernary.Found
$title = $activity_object->get_object()->get_name() ?: $activity_object->get_object()->get_content();
}

Expand Down
2 changes: 0 additions & 2 deletions includes/collection/class-outbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,9 @@ private static function get_object_title( $activity_object ) {
return $post_id ? get_the_title( $post_id ) : '';
}

// phpcs:ignore Universal.Operators.DisallowShortTernary.Found
$title = $activity_object->get_name() ?: $activity_object->get_content();

if ( ! $title && $activity_object->get_object() instanceof Base_Object ) {
// phpcs:ignore Universal.Operators.DisallowShortTernary.Found
$title = $activity_object->get_object()->get_name() ?: $activity_object->get_object()->get_content();
}

Expand Down
1 change: 0 additions & 1 deletion includes/collection/class-remote-actors.php
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,6 @@ private static function prepare_custom_post_type( $actor ) {

return array(
'guid' => \esc_url_raw( $actor->get_id() ),
// phpcs:ignore Universal.Operators.DisallowShortTernary.Found
'post_title' => \wp_strip_all_tags( \wp_slash( $actor->get_name() ?: $actor->get_preferred_username() ) ),
'post_author' => 0,
'post_type' => self::POST_TYPE,
Expand Down
1 change: 0 additions & 1 deletion includes/model/class-user.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ public function get_also_known_as() {
$this->get_alternate_url(),
);

// phpcs:ignore Universal.Operators.DisallowShortTernary.Found
$also_known_as = array_merge( $also_known_as, \get_user_option( 'activitypub_also_known_as', $this->_id ) ?: array() );

return array_unique( $also_known_as );
Expand Down
2 changes: 1 addition & 1 deletion includes/transformer/class-post.php
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ protected function get_context() {
*/
protected function get_post_content_template() {
$content = \get_option( 'activitypub_custom_post_content', ACTIVITYPUB_CUSTOM_POST_CONTENT );
$template = $content ?: ACTIVITYPUB_CUSTOM_POST_CONTENT; // phpcs:ignore Universal.Operators.DisallowShortTernary.Found
$template = $content ?: ACTIVITYPUB_CUSTOM_POST_CONTENT;

$post_format_setting = \get_option( 'activitypub_object_type', ACTIVITYPUB_DEFAULT_OBJECT_TYPE );
$type = $this->get_type();
Expand Down
2 changes: 0 additions & 2 deletions includes/wp-admin/table/class-blocked-actors.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,8 @@ public function prepare_items() {
$this->items[] = array(
'id' => $blocked_actor_post->ID,
'icon' => object_to_uri( $actor->get_icon() ?? ACTIVITYPUB_PLUGIN_URL . 'assets/img/mp.jpg' ),
// phpcs:ignore Universal.Operators.DisallowShortTernary.Found
'post_title' => $actor->get_name() ?: $actor->get_preferred_username(),
'username' => $actor->get_preferred_username(),
// phpcs:ignore Universal.Operators.DisallowShortTernary.Found
'url' => object_to_uri( $actor->get_url() ?: $actor->get_id() ),
'webfinger' => Remote_Actors::get_acct( $blocked_actor_post->ID ),
'identifier' => $actor->get_id(),
Expand Down
2 changes: 0 additions & 2 deletions includes/wp-admin/table/class-followers.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,8 @@ public function prepare_items() {
$this->items[] = array(
'id' => $follower->ID,
'icon' => object_to_uri( $actor->get_icon() ?? ACTIVITYPUB_PLUGIN_URL . 'assets/img/mp.jpg' ),
// phpcs:ignore Universal.Operators.DisallowShortTernary.Found
'post_title' => $actor->get_name() ?: $actor->get_preferred_username(),
'username' => $actor->get_preferred_username(),
// phpcs:ignore Universal.Operators.DisallowShortTernary.Found
'url' => object_to_uri( $actor->get_url() ?: $actor->get_id() ),
'webfinger' => Remote_Actors::get_acct( $follower->ID ),
'identifier' => $actor->get_id(),
Expand Down
2 changes: 0 additions & 2 deletions includes/wp-admin/table/class-following.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,8 @@ public function prepare_items() {
$this->items[] = array(
'id' => $following->ID,
'icon' => object_to_uri( $actor->get_icon() ?? ACTIVITYPUB_PLUGIN_URL . 'assets/img/mp.jpg' ),
// phpcs:ignore Universal.Operators.DisallowShortTernary.Found
'post_title' => $actor->get_name() ?: $actor->get_preferred_username(),
'username' => $actor->get_preferred_username(),
// phpcs:ignore Universal.Operators.DisallowShortTernary.Found
'url' => object_to_uri( $actor->get_url() ?: $actor->get_id() ),
'webfinger' => Remote_Actors::get_acct( $following->ID ),
'status' => Following_Collection::check_status( $this->user_id, $following->ID ),
Expand Down
2 changes: 1 addition & 1 deletion integration/class-classic-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public static function render_meta_box( $post ) {
$content_warning = \get_post_meta( $post->ID, 'activitypub_content_warning', true );
$max_image_attachments = \get_post_meta( $post->ID, 'activitypub_max_image_attachments', true );
$content_visibility = self::get_default_visibility( $post );
$quote_interaction = \get_post_meta( $post->ID, 'activitypub_interaction_policy_quote', true ) ?: ACTIVITYPUB_INTERACTION_POLICY_ANYONE; // phpcs:ignore Universal.Operators.DisallowShortTernary
$quote_interaction = \get_post_meta( $post->ID, 'activitypub_interaction_policy_quote', true ) ?: ACTIVITYPUB_INTERACTION_POLICY_ANYONE;

?>
<p>
Expand Down
2 changes: 1 addition & 1 deletion integration/class-wp-rest-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public static function transition_comment_status( $new_status, $old_status, $com
$comment_types = Comment::get_comment_type_slugs();
$comment_types[] = 'comment';

if ( ! \in_array( $comment->comment_type ?: 'comment', $comment_types, true ) ) { // phpcs:ignore Universal.Operators.DisallowShortTernary
if ( ! \in_array( $comment->comment_type ?: 'comment', $comment_types, true ) ) {
return;
}

Expand Down
8 changes: 4 additions & 4 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
<arg name="colors"/>
<arg name="parallel" value="50"/>

<rule ref="PHPCompatibility"/>
<config name="testVersion" value="7.2-"/>
<rule ref="PHPCompatibilityWP"/>
<config name="minimum_supported_wp_version" value="6.5"/>

<config name="text_domain" value="activitypub,default"/>

<rule ref="WordPress"/>
<rule ref="PHPCompatibilityWP"/>
<rule ref="WordPress">
<exclude name="Universal.Operators.DisallowShortTernary" />
</rule>
<rule ref="VariableAnalysis"/>

<rule ref="WordPress.WP.Capabilities">
Expand Down
2 changes: 0 additions & 2 deletions src/followers/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ function ( $follower ) {
return array(
'handle' => '@' . $username,
'icon' => $actor->get_icon(),
// phpcs:ignore Universal.Operators.DisallowShortTernary.Found
'name' => $actor->get_name() ?: $username,
// phpcs:ignore Universal.Operators.DisallowShortTernary.Found
'url' => object_to_uri( $actor->get_url() ) ?: $actor->get_id(),
);
},
Expand Down