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,8 +22,8 @@ function init() {
\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_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_DIR', plugin_dir_path( __FILE__ ) );
\define( 'ACTIVITYPUB_PLUGIN', __FILE__ );
\define( 'ACTIVITYPUB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
\define( 'ACTIVITYPUB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
\define( 'ACTIVITYPUB_PLUGIN_FILE', plugin_dir_path( __FILE__ ) . '/' . basename( __FILE__ ) );

View file

@ -232,8 +232,8 @@ class Admin {
wp_enqueue_style( 'activitypub-admin-styles', plugins_url( 'assets/css/activitypub-admin.css', ACTIVITYPUB_PLUGIN_FILE ), array(), '1.0.0' );
wp_enqueue_script( 'activitypub-admin-styles', plugins_url( 'assets/js/activitypub-admin.js', ACTIVITYPUB_PLUGIN_FILE ), array( 'jquery' ), '1.0.0', false );
}
if ( 'edit-comments.php' === $hook_suffix || 'tools_page_activitypub_tools' === $hook_suffix ) {
if ( 'edit-comments.php' === $hook_suffix || 'tools_page_activitypub_tools' === $hook_suffix ) {
\wp_enqueue_script(
'activitypub_actions',
\plugin_dir_url( ACTIVITYPUB_PLUGIN ) . '/assets/js/activitypub.js',

View file

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

View file

@ -490,9 +490,9 @@ class Inbox {
//found a local comment id
$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_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_last_modified'] = $object['object']['updated'];
$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' );
$view_count = count( $view_slugs );
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];
if ( $post_status_temp != '' ) {
if ( ! empty( $post_status_temp ) ) {
$post_status_temp = '&comments=' . $view_slugs[ $x ][1];
}
$views[ $view_slugs[ $x ][0] ] = sprintf(
__(
'<a href="' .
$activitypub_tools_page .
$post_status_temp . '"' .
$class .
' >' .
$view_slugs[ $x ][2] .
' <span class="count">(%d)</span></a>'
),
'<a href="' . $activitypub_tools_page . $post_status_temp . '"' . $class . ' >' . $view_slugs[ $x ][2] . ' <span class="count">(%s)</span></a>',
$view_slugs[ $x ][3]
);
}
@ -137,7 +129,7 @@ class Migrate_List extends \WP_List_Table {
public function single_row( $item ) {
$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
}