fix phpcs issues

This commit is contained in:
Matthias Pfefferle 2022-12-02 20:44:56 +01:00
parent 603199c9e8
commit c6a7599737
7 changed files with 104 additions and 40 deletions

View file

@ -1,15 +1,15 @@
<div class="activitypub-settings-header"> <div class="activitypub-settings-header">
<div class="activitypub-settings-title-section"> <div class="activitypub-settings-title-section">
<h1>ActivityPub</h1> <h1><?php \esc_html_e( 'ActivityPub', 'activitypub' ); ?></h1>
</div> </div>
<nav class="activitypub-settings-tabs-wrapper hide-if-no-js" aria-label="<?php esc_attr_e( 'Secondary menu', 'activitypub' ); ?>"> <nav class="activitypub-settings-tabs-wrapper hide-if-no-js" aria-label="<?php \esc_attr_e( 'Secondary menu', 'activitypub' ); ?>">
<a href="<?php echo esc_url( admin_url( 'options-general.php?page=activitypub' ) ); ?>" class="activitypub-settings-tab <?php echo $args['welcome']; ?>"> <a href="<?php echo \esc_url_raw( admin_url( 'options-general.php?page=activitypub' ) ); ?>" class="activitypub-settings-tab <?php echo \esc_attr( $args['welcome'] ); ?>">
<?php _e( 'Welcome', 'activitypub' ); ?> <?php \esc_html_e( 'Welcome', 'activitypub' ); ?>
</a> </a>
<a href="<?php echo esc_url( admin_url( 'options-general.php?page=activitypub-settings' ) ); ?>" class="activitypub-settings-tab <?php echo $args['settings']; ?>"> <a href="<?php echo \esc_url_raw( admin_url( 'options-general.php?page=activitypub-settings' ) ); ?>" class="activitypub-settings-tab <?php echo \esc_attr( $args['settings'] ); ?>">
<?php _e( 'Settings', 'activitypub' ); ?> <?php \esc_html_e( 'Settings', 'activitypub' ); ?>
</a> </a>
</nav> </nav>
</div> </div>

View file

@ -75,12 +75,6 @@ if ( \get_the_author_meta( 'user_url', $author_id ) ) {
); );
} }
/*
$json->endpoints = array(
'sharedInbox' => \get_rest_url( null, '/activitypub/1.0/inbox' ),
);
*/
// filter output // filter output
$json = \apply_filters( 'activitypub_json_author_array', $json, $author_id ); $json = \apply_filters( 'activitypub_json_author_array', $json, $author_id );

View file

@ -27,10 +27,10 @@ if ( \has_header_image() ) {
); );
} }
$json->inbox = \get_rest_url( null, "/activitypub/1.0/blog/inbox" ); $json->inbox = \get_rest_url( null, '/activitypub/1.0/blog/inbox' );
$json->outbox = \get_rest_url( null, "/activitypub/1.0/blog/outbox" ); $json->outbox = \get_rest_url( null, '/activitypub/1.0/blog/outbox' );
$json->followers = \get_rest_url( null, "/activitypub/1.0/blog/followers" ); $json->followers = \get_rest_url( null, '/activitypub/1.0/blog/followers' );
$json->following = \get_rest_url( null, "/activitypub/1.0/blog/following" ); $json->following = \get_rest_url( null, '/activitypub/1.0/blog/following' );
$json->manuallyApprovesFollowers = \apply_filters( 'activitypub_json_manually_approves_followers', \__return_false() ); // phpcs:ignore $json->manuallyApprovesFollowers = \apply_filters( 'activitypub_json_manually_approves_followers', \__return_false() ); // phpcs:ignore
@ -54,12 +54,6 @@ $json->attachment[] = array(
), ),
); );
/*
$json->endpoints = array(
'sharedInbox' => \get_rest_url( null, '/activitypub/1.0/inbox' ),
);
*/
// filter output // filter output
$json = \apply_filters( 'activitypub_json_blog_array', $json ); $json = \apply_filters( 'activitypub_json_blog_array', $json );

View file

@ -1,7 +1,8 @@
<div class="wrap"> <div class="wrap">
<h1><?php \esc_html_e( 'Followers (Fediverse)', 'activitypub' ); ?></h1> <h1><?php \esc_html_e( 'Followers (Fediverse)', 'activitypub' ); ?></h1>
<p><?php \printf( \__( 'You currently have %s followers.', 'activitypub' ), \esc_attr( \Activitypub\Peer\Followers::count_followers( \get_current_user_id() ) ) ); ?></p> <?php // translators: ?>
<p><?php \printf( \esc_html__( 'You currently have %s followers.', 'activitypub' ), \esc_attr( \Activitypub\Peer\Followers::count_followers( \get_current_user_id() ) ) ); ?></p>
<?php $token_table = new \Activitypub\Table\Followers_List(); ?> <?php $token_table = new \Activitypub\Table\Followers_List(); ?>

View file

@ -1,4 +1,5 @@
<?php <?php
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
$post = \get_post(); $post = \get_post();
$activitypub_post = new \Activitypub\Model\Post( $post ); $activitypub_post = new \Activitypub\Model\Post( $post );

View file

@ -1,11 +1,32 @@
<?php \load_template( \dirname( __FILE__ ) . '/admin-header.php', true, array( 'settings' => 'active', 'welcome' => '' ) ); ?> <?php
\load_template(
\dirname( __FILE__ ) . '/admin-header.php',
true,
array(
'settings' => 'active',
'welcome' => '',
)
);
?>
<div class="privacy-settings-body hide-if-no-js"> <div class="privacy-settings-body hide-if-no-js">
<div class="notice notice-info"> <div class="notice notice-info">
<p><?php \printf( __( 'If you have problems using this plugin, please check the <a href="%s">Site Health</a> to ensure that your site is compatible and/or use the "Help" tab (in the top right of the settings pages).', 'activitypub' ), admin_url( '/wp-admin/site-health.php' ) ); ?></p> <p>
<?php
\printf(
// translators:
\esc_html__( 'If you have problems using this plugin, please check the %1$sSite Health%2$s to ensure that your site is compatible and/or use the "Help" tab (in the top right of the settings pages).', 'activitypub' ),
\sprintf(
'<a href="%s">',
\esc_url_raw( \admin_url( '/wp-admin/site-health.php' ) )
),
'</a>'
);
?>
</p>
</div> </div>
<p><?php \esc_html_e( 'Customize your ActivityPub settings to suit your needs.', 'activitypub' ) ?></p> <p><?php \esc_html_e( 'Customize your ActivityPub settings to suit your needs.', 'activitypub' ); ?></p>
<form method="post" action="options.php"> <form method="post" action="options.php">
<?php \settings_fields( 'activitypub' ); ?> <?php \settings_fields( 'activitypub' ); ?>
@ -36,20 +57,22 @@
<p> <p>
<textarea name="activitypub_custom_post_content" id="activitypub_custom_post_content" rows="10" cols="50" class="large-text" placeholder="<?php echo ACTIVITYPUB_CUSTOM_POST_CONTENT; ?>"><?php echo \get_option( 'activitypub_custom_post_content', ACTIVITYPUB_CUSTOM_POST_CONTENT ); ?></textarea> <textarea name="activitypub_custom_post_content" id="activitypub_custom_post_content" rows="10" cols="50" class="large-text" placeholder="<?php echo ACTIVITYPUB_CUSTOM_POST_CONTENT; ?>"><?php echo \get_option( 'activitypub_custom_post_content', ACTIVITYPUB_CUSTOM_POST_CONTENT ); ?></textarea>
<details> <details>
<summary><?php _e( 'See the complete list of template patterns.', 'activitypub' ); ?></summary> <summary><?php esc_html_e( 'See the complete list of template patterns.', 'activitypub' ); ?></summary>
<div class="description"> <div class="description">
<ul> <ul>
<li><code>%title%</code> - <?php \esc_html_e( 'The Post-Title.', 'activitypub' ); ?></li> <li><code>%title%</code> - <?php \esc_html_e( 'The Post-Title.', 'activitypub' ); ?></li>
<li><code>%content%</code> - <?php \esc_html_e( 'The Post-Content.', 'activitypub' ); ?></li> <li><code>%content%</code> - <?php \esc_html_e( 'The Post-Content.', 'activitypub' ); ?></li>
<li><code>%excerpt%</code> - <?php \esc_html_e( 'The Post-Excerpt (default 400 Chars).', 'activitypub' ); ?></li> <li><code>%excerpt%</code> - <?php \esc_html_e( 'The Post-Excerpt (default 400 Chars).', 'activitypub' ); ?></li>
<li><code>%permalink%</code> - <?php \esc_html_e( 'The Post-Permalink.', 'activitypub' ); ?></li> <li><code>%permalink%</code> - <?php \esc_html_e( 'The Post-Permalink.', 'activitypub' ); ?></li>
<li><code>%shortlink%</code> - <?php \printf( \esc_html( 'The Post-Shortlink. I can recommend %sHum%s, to prettify the Shortlinks', 'activitypub' ), '<a href="https://wordpress.org/plugins/hum/" target="_blank">', '</a>' ); ?></li> <?php // translators: ?>
<li><code>%shortlink%</code> - <?php \printf( \esc_html__( 'The Post-Shortlink. I can recommend %1$sHum%2$s, to prettify the Shortlinks', 'activitypub' ), '<a href="https://wordpress.org/plugins/hum/" target="_blank">', '</a>' ); ?></li>
<li><code>%hashtags%</code> - <?php \esc_html_e( 'The Tags as Hashtags.', 'activitypub' ); ?></li> <li><code>%hashtags%</code> - <?php \esc_html_e( 'The Tags as Hashtags.', 'activitypub' ); ?></li>
</ul> </ul>
</div> </div>
</details> </details>
</p> </p>
<p><?php \printf( \__( '%sLet me know%s if you miss a template pattern.', 'activitypub' ), '<a href="https://github.com/pfefferle/wordpress-activitypub/issues/new" target="_blank">', '</a>' ); ?></p> <?php // translators: ?>
<p><?php \printf( \esc_html__( '%1$sLet me know%2$s if you miss a template pattern.', 'activitypub' ), '<a href="https://github.com/pfefferle/wordpress-activitypub/issues/new" target="_blank">', '</a>' ); ?></p>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -77,6 +100,7 @@
<?php $post_types = \get_post_types( array( 'public' => true ), 'objects' ); ?> <?php $post_types = \get_post_types( array( 'public' => true ), 'objects' ); ?>
<?php $support_post_types = \get_option( 'activitypub_support_post_types', array( 'post', 'page' ) ) ? \get_option( 'activitypub_support_post_types', array( 'post', 'page' ) ) : array(); ?> <?php $support_post_types = \get_option( 'activitypub_support_post_types', array( 'post', 'page' ) ) ? \get_option( 'activitypub_support_post_types', array( 'post', 'page' ) ) : array(); ?>
<ul> <ul>
<?php // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited ?>
<?php foreach ( $post_types as $post_type ) { ?> <?php foreach ( $post_types as $post_type ) { ?>
<li> <li>
<input type="checkbox" id="activitypub_support_post_types" name="activitypub_support_post_types[]" value="<?php echo \esc_attr( $post_type->name ); ?>" <?php echo \checked( true, \in_array( $post_type->name, $support_post_types, true ) ); ?> /> <input type="checkbox" id="activitypub_support_post_types" name="activitypub_support_post_types[]" value="<?php echo \esc_attr( $post_type->name ); ?>" <?php echo \checked( true, \in_array( $post_type->name, $support_post_types, true ) ); ?> />
@ -102,8 +126,21 @@
<?php \esc_html_e( 'HTML Whitelist', 'activitypub' ); ?> <?php \esc_html_e( 'HTML Whitelist', 'activitypub' ); ?>
</th> </th>
<td> <td>
<textarea name="activitypub_allowed_html" id="activitypub_allowed_html" rows="3" cols="50" class="large-text"><?php echo \get_option( 'activitypub_allowed_html', ACTIVITYPUB_ALLOWED_HTML ); ?></textarea> <textarea name="activitypub_allowed_html" id="activitypub_allowed_html" rows="3" cols="50" class="large-text"><?php echo esc_html( \get_option( 'activitypub_allowed_html', ACTIVITYPUB_ALLOWED_HTML ) ); ?></textarea>
<p class="description"><?php \_e( \sprintf( 'A list of HTML elements, you want to whitelist for your activities. <strong>Leave list empty to support all HTML elements.</strong> Default: <code>%s</code>.', \esc_html( ACTIVITYPUB_ALLOWED_HTML ) ), 'activitypub' ); ?></p> <p class="description">
<?php
\printf(
// translators:
\esc_html__( 'A list of HTML elements, you want to whitelist for your activities. %1$sLeave list empty to support all HTML elements.%2$s Default: %3$s.', 'activitypub' ),
'<strong>',
'</strong>',
\sprintf(
'<code>%s</code>',
\esc_html( ACTIVITYPUB_ALLOWED_HTML )
)
);
?>
</p>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -122,7 +159,19 @@
<?php \esc_html_e( 'Blocklist', 'activitypub' ); ?> <?php \esc_html_e( 'Blocklist', 'activitypub' ); ?>
</th> </th>
<td> <td>
<p class="description"><?php \printf( \__( 'To block servers, add the host of the server to the "<a href="%s">Disallowed Comment Keys</a>" list.', 'activitypub' ), admin_url( 'options-discussion.php#disallowed_keys' ) ); ?></p> <p class="description">
<?php
\printf(
// translators:
\esc_html__( 'To block servers, add the host of the server to the "%1$sDisallowed Comment Keys%2$s" list.', 'activitypub' ),
\sprintf(
'<a href="%s">',
esc_url_raw( admin_url( 'options-discussion.php#disallowed_keys' ) )
),
'</a>'
);
?>
</p>
</td> </td>
</tr> </tr>
</tbody> </tbody>

View file

@ -1,4 +1,13 @@
<?php \load_template( \dirname( __FILE__ ) . '/admin-header.php', true, array( 'settings' => '', 'welcome' => 'active' ) ); ?> <?php
\load_template(
\dirname( __FILE__ ) . '/admin-header.php',
true,
array(
'settings' => '',
'welcome' => 'active',
)
);
?>
<div class="privacy-settings-body hide-if-no-js"> <div class="privacy-settings-body hide-if-no-js">
<h2><?php \esc_html_e( 'Welcome', 'activitypub' ); ?></h2> <h2><?php \esc_html_e( 'Welcome', 'activitypub' ); ?></h2>
@ -7,21 +16,37 @@
<p> <p>
<?php <?php
\printf( \printf(
\__( // translators:
'People can follow you by using the username <code>%s</code> or the URL <code>%s</code>. Users who can not access this settings page will find their username on the <a href="%s">Edit Profile</a> page.', \esc_html__(
'People can follow you by using the username %1$s or the URL %2$s. Users who can not access this settings page will find their username on the %3$sEdit Profile%4$s page.',
'activitypub' 'activitypub'
), ),
\esc_attr( \Activitypub\get_webfinger_resource( wp_get_current_user()->ID ) ), \sprintf(
\esc_url_raw( \get_author_posts_url( wp_get_current_user()->ID ) ), '<code>%s</code>',
\esc_attr( \Activitypub\get_webfinger_resource( wp_get_current_user()->ID ) )
),
\sprintf(
'<code>%s</code>',
\esc_url_raw( \get_author_posts_url( wp_get_current_user()->ID ) )
),
\sprintf(
'<a href="%s">',
\esc_url_raw( \admin_url( 'profile.php#activitypub' ) ) \esc_url_raw( \admin_url( 'profile.php#activitypub' ) )
),
'</a>'
); );
?> ?>
</p> </p>
<p> <p>
<?php <?php
\printf( \printf(
\__( 'If you have problems using this plugin, please check the <a href="%s">Site Health</a> to ensure that your site is compatible and/or use the "Help" tab (in the top right of the settings pages).', 'activitypub' ), // translators:
\esc_html__( 'If you have problems using this plugin, please check the %1$sSite Health%2$s to ensure that your site is compatible and/or use the "Help" tab (in the top right of the settings pages).', 'activitypub' ),
\sprintf(
'<a href="%s">',
\esc_url_raw( admin_url( '/wp-admin/site-health.php' ) ) \esc_url_raw( admin_url( '/wp-admin/site-health.php' ) )
),
'</a>'
); );
?> ?>
</p> </p>