fix phpcs issues

This commit is contained in:
Matthias Pfefferle 2022-12-23 13:17:12 +01:00
parent 6b15d8d158
commit 45b6e63f32
5 changed files with 12 additions and 20 deletions

View file

@ -22,7 +22,7 @@ function init() {
\defined( 'ACTIVITYPUB_HASHTAGS_REGEXP' ) || \define( 'ACTIVITYPUB_HASHTAGS_REGEXP', '(?:(?<=\s)|(?<=<p>)|(?<=<br>)|^)#([A-Za-z0-9_]+)(?:(?=\s|[[:punct:]]|$))' ); \defined( 'ACTIVITYPUB_HASHTAGS_REGEXP' ) || \define( 'ACTIVITYPUB_HASHTAGS_REGEXP', '(?:(?<=\s)|(?<=<p>)|(?<=<br>)|^)#([A-Za-z0-9_]+)(?:(?=\s|[[:punct:]]|$))' );
\defined( 'ACTIVITYPUB_ALLOWED_HTML' ) || \define( 'ACTIVITYPUB_ALLOWED_HTML', '<strong><a><p><ul><ol><li><code><blockquote><pre><img>' ); \defined( 'ACTIVITYPUB_ALLOWED_HTML' ) || \define( 'ACTIVITYPUB_ALLOWED_HTML', '<strong><a><p><ul><ol><li><code><blockquote><pre><img>' );
\defined( 'ACTIVITYPUB_CUSTOM_POST_CONTENT' ) || \define( 'ACTIVITYPUB_CUSTOM_POST_CONTENT', "<p><strong>%title%</strong></p>\n\n%content%\n\n<p>%hashtags%</p>\n\n<p>%shortlink%</p>" ); \defined( 'ACTIVITYPUB_CUSTOM_POST_CONTENT' ) || \define( 'ACTIVITYPUB_CUSTOM_POST_CONTENT', "<p><strong>%title%</strong></p>\n\n%content%\n\n<p>%hashtags%</p>\n\n<p>%shortlink%</p>" );
\define( 'ACTIVITYPUB_PLUGIN', __FILE__ );
\define( 'ACTIVITYPUB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); \define( 'ACTIVITYPUB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
\define( 'ACTIVITYPUB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); \define( 'ACTIVITYPUB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
\define( 'ACTIVITYPUB_PLUGIN_FILE', plugin_dir_path( __FILE__ ) . '/' . basename( __FILE__ ) ); \define( 'ACTIVITYPUB_PLUGIN_FILE', plugin_dir_path( __FILE__ ) . '/' . basename( __FILE__ ) );

View file

@ -373,7 +373,7 @@ function url_to_authorid( $url ) {
* @return int post_id * @return int post_id
*/ */
function url_to_postid( $in_replyto_url ) { function url_to_postid( $in_replyto_url ) {
if ( !empty( $in_replyto_url ) ) { if ( ! empty( $in_replyto_url ) ) {
$tentative_postid = \url_to_postid( $in_replyto_url ); $tentative_postid = \url_to_postid( $in_replyto_url );
if ( is_null( $tentative_postid ) ) { if ( is_null( $tentative_postid ) ) {
$post_types = \get_option( 'activitypub_support_post_types', array( 'post', 'page' ) ); $post_types = \get_option( 'activitypub_support_post_types', array( 'post', 'page' ) );
@ -431,7 +431,7 @@ function url_to_commentid( $in_replyto_url ) {
'type' => 'activitypub', 'type' => 'activitypub',
'meta_query' => array( 'meta_query' => array(
array( array(
'key' => 'source_url', //$object['object']['id'] 'key' => 'source_url', // $object['object']['id']
'value' => $in_replyto_url, 'value' => $in_replyto_url,
), ),
), ),

View file

@ -492,7 +492,7 @@ class Inbox {
$commentdata = \get_comment( $object_comment_id, ARRAY_A ); $commentdata = \get_comment( $object_comment_id, ARRAY_A );
$commentdata['comment_author'] = \esc_attr( $meta['name'] ? $meta['name'] : $meta['preferredUsername'] ); $commentdata['comment_author'] = \esc_attr( $meta['name'] ? $meta['name'] : $meta['preferredUsername'] );
$commentdata['comment_content'] = \wp_filter_kses( $object['object']['content'] ); $commentdata['comment_content'] = \wp_filter_kses( $object['object']['content'] );
$commentdata['comment_meta']['avatar_url'] = \esc_url_raw($meta['icon']['url']); $commentdata['comment_meta']['avatar_url'] = \esc_url_raw( $meta['icon']['url'] );
$commentdata['comment_meta']['ap_published'] = \wp_date( 'Y-m-d H:i:s', strtotime( $object['object']['published'] ) ); $commentdata['comment_meta']['ap_published'] = \wp_date( 'Y-m-d H:i:s', strtotime( $object['object']['published'] ) );
$commentdata['comment_meta']['ap_last_modified'] = $object['object']['updated']; $commentdata['comment_meta']['ap_last_modified'] = $object['object']['updated'];
$commentdata['comment_meta']['ap_object'] = \serialize( $object ); $commentdata['comment_meta']['ap_object'] = \serialize( $object );

View file

@ -40,21 +40,13 @@ class Migrate_List extends \WP_List_Table {
$post_status_var = get_query_var( 'comments' ); $post_status_var = get_query_var( 'comments' );
$view_count = count( $view_slugs ); $view_count = count( $view_slugs );
for ( $x = 0; $x < $view_count; $x++ ) { for ( $x = 0; $x < $view_count; $x++ ) {
$class = ( $post_status_var == $view_slugs[ $x ][1] ) ? ' class="current"' : ''; $class = ( $post_status_var === $view_slugs[ $x ][1] ) ? ' class="current"' : '';
$post_status_temp = $view_slugs[ $x ][1]; $post_status_temp = $view_slugs[ $x ][1];
if ( $post_status_temp != '' ) { if ( ! empty( $post_status_temp ) ) {
$post_status_temp = '&comments=' . $view_slugs[ $x ][1]; $post_status_temp = '&comments=' . $view_slugs[ $x ][1];
} }
$views[ $view_slugs[ $x ][0] ] = sprintf( $views[ $view_slugs[ $x ][0] ] = sprintf(
__( '<a href="' . $activitypub_tools_page . $post_status_temp . '"' . $class . ' >' . $view_slugs[ $x ][2] . ' <span class="count">(%s)</span></a>',
'<a href="' .
$activitypub_tools_page .
$post_status_temp . '"' .
$class .
' >' .
$view_slugs[ $x ][2] .
' <span class="count">(%d)</span></a>'
),
$view_slugs[ $x ][3] $view_slugs[ $x ][3]
); );
} }
@ -137,7 +129,7 @@ class Migrate_List extends \WP_List_Table {
public function single_row( $item ) { public function single_row( $item ) {
$inline_styles = ( $item['comments'] > 0 ) ? 'warning' : ''; ?> $inline_styles = ( $item['comments'] > 0 ) ? 'warning' : ''; ?>
<tr class="<?php echo $inline_styles; ?>"><?php $this->single_row_columns( $item ); ?></tr> <tr class="<?php echo esc_attr( $inline_styles ); ?>"><?php $this->single_row_columns( $item ); ?></tr>
<?php <?php
} }