| @@ -9,9 +9,8 @@ | ||
| 9 | 9 | |
| 10 | 10 | use Activitypub\Blocklist_Subscriptions; |
| 11 | 11 | use Activitypub\Moderation; |
| 12 | 12 | |
| 13 | -use function Activitypub\get_post_type_description; | |
| 14 | 13 | use function Activitypub\home_host; |
| 15 | 14 | |
| 16 | 15 | /** |
| 17 | 16 | * Class Settings_Fields. |
| @@ -20,9 +19,9 @@ | ||
| 20 | 19 | /** |
| 21 | 20 | * Initialize the settings fields. |
| 22 | 21 | */ |
| 23 | 22 | public static function init() { |
| 24 | - \add_action( 'load-settings_page_activitypub', array( self::class, 'register_settings_fields' ) ); | |
| 23 | + add_action( 'load-settings_page_activitypub', array( self::class, 'register_settings_fields' ) ); | |
| 25 | 24 | } |
| 26 | 25 | |
| 27 | 26 | /** |
| 28 | 27 | * Register settings fields. |
| @@ -28,37 +27,37 @@ | ||
| 28 | 27 | * Register settings fields. |
| 29 | 28 | */ |
| 30 | 29 | public static function register_settings_fields() { |
| 31 | 30 | // Add settings sections. |
| 32 | - \add_settings_section( | |
| 31 | + add_settings_section( | |
| 33 | 32 | 'activitypub_profiles', |
| 34 | - \__( 'Profiles', 'activitypub' ), | |
| 33 | + __( 'Profiles', 'activitypub' ), | |
| 35 | 34 | '__return_empty_string', |
| 36 | 35 | 'activitypub_settings' |
| 37 | 36 | ); |
| 38 | 37 | |
| 39 | - \add_settings_section( | |
| 38 | + add_settings_section( | |
| 40 | 39 | 'activitypub_activities', |
| 41 | - \__( 'Activities', 'activitypub' ), | |
| 40 | + __( 'Activities', 'activitypub' ), | |
| 42 | 41 | '__return_empty_string', |
| 43 | 42 | 'activitypub_settings' |
| 44 | 43 | ); |
| 45 | 44 | |
| 46 | - \add_settings_section( | |
| 45 | + add_settings_section( | |
| 47 | 46 | 'activitypub_general', |
| 48 | - \__( 'General', 'activitypub' ), | |
| 47 | + __( 'General', 'activitypub' ), | |
| 49 | 48 | '__return_empty_string', |
| 50 | 49 | 'activitypub_settings' |
| 51 | 50 | ); |
| 52 | 51 | |
| 53 | - \add_settings_section( | |
| 52 | + add_settings_section( | |
| 54 | 53 | 'activitypub_server', |
| 55 | - \__( 'Server', 'activitypub' ), | |
| 54 | + __( 'Server', 'activitypub' ), | |
| 56 | 55 | '__return_empty_string', |
| 57 | 56 | 'activitypub_settings' |
| 58 | 57 | ); |
| 59 | 58 | |
| 60 | - \add_settings_section( | |
| 59 | + add_settings_section( | |
| 61 | 60 | 'activitypub_moderation', |
| 62 | 61 | \esc_html__( 'Moderation', 'activitypub' ), |
| 63 | 62 | array( self::class, 'render_moderation_section_description' ), |
| 64 | 63 | 'activitypub_settings', |
| @@ -68,11 +67,11 @@ | ||
| 68 | 67 | ) |
| 69 | 68 | ); |
| 70 | 69 | |
| 71 | 70 | // Add settings fields. |
| 72 | - \add_settings_field( | |
| 71 | + add_settings_field( | |
| 73 | 72 | 'activitypub_actor_mode', |
| 74 | - \__( 'Enable profiles by type', 'activitypub' ), | |
| 73 | + __( 'Enable profiles by type', 'activitypub' ), | |
| 75 | 74 | array( self::class, 'render_actor_mode_field' ), |
| 76 | 75 | 'activitypub_settings', |
| 77 | 76 | 'activitypub_profiles' |
| 78 | 77 | ); |
| @@ -78,11 +77,11 @@ | ||
| 78 | 77 | ); |
| 79 | 78 | |
| 80 | 79 | $object_type = \get_option( 'activitypub_object_type', ACTIVITYPUB_DEFAULT_OBJECT_TYPE ); |
| 81 | 80 | if ( 'note' === $object_type ) { |
| 82 | - \add_settings_field( | |
| 81 | + add_settings_field( | |
| 83 | 82 | 'activitypub_custom_post_content', |
| 84 | - \__( 'Post content', 'activitypub' ), | |
| 83 | + __( 'Post content', 'activitypub' ), | |
| 85 | 84 | array( self::class, 'render_custom_post_content_field' ), |
| 86 | 85 | 'activitypub_settings', |
| 87 | 86 | 'activitypub_activities', |
| 88 | 87 | array( 'label_for' => 'activitypub_custom_post_content' ) |
| @@ -88,11 +87,11 @@ | ||
| 88 | 87 | array( 'label_for' => 'activitypub_custom_post_content' ) |
| 89 | 88 | ); |
| 90 | 89 | } |
| 91 | 90 | |
| 92 | - \add_settings_field( | |
| 91 | + add_settings_field( | |
| 93 | 92 | 'activitypub_max_image_attachments', |
| 94 | - \__( 'Media attachments', 'activitypub' ), | |
| 93 | + __( 'Media attachments', 'activitypub' ), | |
| 95 | 94 | array( self::class, 'render_max_image_attachments_field' ), |
| 96 | 95 | 'activitypub_settings', |
| 97 | 96 | 'activitypub_activities', |
| 98 | 97 | array( 'label_for' => 'activitypub_max_image_attachments' ) |
| @@ -97,27 +96,27 @@ | ||
| 97 | 96 | 'activitypub_activities', |
| 98 | 97 | array( 'label_for' => 'activitypub_max_image_attachments' ) |
| 99 | 98 | ); |
| 100 | 99 | |
| 101 | - \add_settings_field( | |
| 100 | + add_settings_field( | |
| 102 | 101 | 'activitypub_support_post_types', |
| 103 | - \__( 'Supported post types', 'activitypub' ), | |
| 102 | + __( 'Supported post types', 'activitypub' ), | |
| 104 | 103 | array( self::class, 'render_support_post_types_field' ), |
| 105 | 104 | 'activitypub_settings', |
| 106 | 105 | 'activitypub_activities' |
| 107 | 106 | ); |
| 108 | 107 | |
| 109 | - \add_settings_field( | |
| 108 | + add_settings_field( | |
| 110 | 109 | 'activitypub_allow_interactions', |
| 111 | - \__( 'Post interactions', 'activitypub' ), | |
| 110 | + __( 'Post interactions', 'activitypub' ), | |
| 112 | 111 | array( self::class, 'render_allow_interactions_field' ), |
| 113 | 112 | 'activitypub_settings', |
| 114 | 113 | 'activitypub_activities' |
| 115 | 114 | ); |
| 116 | 115 | |
| 117 | - \add_settings_field( | |
| 116 | + add_settings_field( | |
| 118 | 117 | 'activitypub_default_quote_policy', |
| 119 | - \__( 'Default quote policy', 'activitypub' ), | |
| 118 | + __( 'Default quote policy', 'activitypub' ), | |
| 120 | 119 | array( self::class, 'render_default_quote_policy_field' ), |
| 121 | 120 | 'activitypub_settings', |
| 122 | 121 | 'activitypub_activities', |
| 123 | 122 | array( 'label_for' => 'activitypub_default_quote_policy' ) |
| @@ -122,20 +121,11 @@ | ||
| 122 | 121 | 'activitypub_activities', |
| 123 | 122 | array( 'label_for' => 'activitypub_default_quote_policy' ) |
| 124 | 123 | ); |
| 125 | 124 | |
| 126 | - \add_settings_field( | |
| 127 | - 'activitypub_default_feature_policy', | |
| 128 | - \__( 'Default Starter Kit policy', 'activitypub' ), | |
| 129 | - array( self::class, 'render_default_feature_policy_field' ), | |
| 130 | - 'activitypub_settings', | |
| 131 | - 'activitypub_activities', | |
| 132 | - array( 'label_for' => 'activitypub_default_feature_policy' ) | |
| 133 | - ); | |
| 134 | - | |
| 135 | - \add_settings_field( | |
| 125 | + add_settings_field( | |
| 136 | 126 | 'activitypub_use_hashtags', |
| 137 | - \__( 'Hashtags', 'activitypub' ), | |
| 127 | + __( 'Hashtags', 'activitypub' ), | |
| 138 | 128 | array( self::class, 'render_use_hashtags_field' ), |
| 139 | 129 | 'activitypub_settings', |
| 140 | 130 | 'activitypub_activities', |
| 141 | 131 | array( 'label_for' => 'activitypub_use_hashtags' ) |
| @@ -140,11 +130,11 @@ | ||
| 140 | 130 | 'activitypub_activities', |
| 141 | 131 | array( 'label_for' => 'activitypub_use_hashtags' ) |
| 142 | 132 | ); |
| 143 | 133 | |
| 144 | - \add_settings_field( | |
| 134 | + add_settings_field( | |
| 145 | 135 | 'activitypub_use_opengraph', |
| 146 | - \__( 'OpenGraph', 'activitypub' ), | |
| 136 | + __( 'OpenGraph', 'activitypub' ), | |
| 147 | 137 | array( self::class, 'render_use_opengraph_field' ), |
| 148 | 138 | 'activitypub_settings', |
| 149 | 139 | 'activitypub_general', |
| 150 | 140 | array( 'label_for' => 'activitypub_use_opengraph' ) |
| @@ -149,11 +139,11 @@ | ||
| 149 | 139 | 'activitypub_general', |
| 150 | 140 | array( 'label_for' => 'activitypub_use_opengraph' ) |
| 151 | 141 | ); |
| 152 | 142 | |
| 153 | - \add_settings_field( | |
| 143 | + add_settings_field( | |
| 154 | 144 | 'activitypub_attribution_domains', |
| 155 | - \__( 'Attribution Domains', 'activitypub' ), | |
| 145 | + __( 'Attribution Domains', 'activitypub' ), | |
| 156 | 146 | array( self::class, 'render_attribution_domains_field' ), |
| 157 | 147 | 'activitypub_settings', |
| 158 | 148 | 'activitypub_general', |
| 159 | 149 | array( 'label_for' => 'activitypub_attribution_domains' ) |
| @@ -158,11 +148,11 @@ | ||
| 158 | 148 | 'activitypub_general', |
| 159 | 149 | array( 'label_for' => 'activitypub_attribution_domains' ) |
| 160 | 150 | ); |
| 161 | 151 | |
| 162 | - \add_settings_field( | |
| 152 | + add_settings_field( | |
| 163 | 153 | 'activitypub_relays', |
| 164 | - \__( 'Relays', 'activitypub' ), | |
| 154 | + __( 'Relays', 'activitypub' ), | |
| 165 | 155 | array( self::class, 'render_relays_field' ), |
| 166 | 156 | 'activitypub_settings', |
| 167 | 157 | 'activitypub_server', |
| 168 | 158 | array( 'label_for' => 'activitypub_relays' ) |
| @@ -167,9 +157,9 @@ | ||
| 167 | 157 | 'activitypub_server', |
| 168 | 158 | array( 'label_for' => 'activitypub_relays' ) |
| 169 | 159 | ); |
| 170 | 160 | |
| 171 | - \add_settings_field( | |
| 161 | + add_settings_field( | |
| 172 | 162 | 'activitypub_site_blocked_domains', |
| 173 | 163 | \esc_html__( 'Blocked Domains', 'activitypub' ), |
| 174 | 164 | array( self::class, 'render_site_blocked_domains_field' ), |
| 175 | 165 | 'activitypub_settings', |
| @@ -175,9 +165,9 @@ | ||
| 175 | 165 | 'activitypub_settings', |
| 176 | 166 | 'activitypub_moderation' |
| 177 | 167 | ); |
| 178 | 168 | |
| 179 | - \add_settings_field( | |
| 169 | + add_settings_field( | |
| 180 | 170 | 'activitypub_site_blocked_keywords', |
| 181 | 171 | \esc_html__( 'Blocked Keywords', 'activitypub' ), |
| 182 | 172 | array( self::class, 'render_site_blocked_keywords_field' ), |
| 183 | 173 | 'activitypub_settings', |
| @@ -183,9 +173,9 @@ | ||
| 183 | 173 | 'activitypub_settings', |
| 184 | 174 | 'activitypub_moderation' |
| 185 | 175 | ); |
| 186 | 176 | |
| 187 | - \add_settings_field( | |
| 177 | + add_settings_field( | |
| 188 | 178 | 'activitypub_blocklist_subscriptions', |
| 189 | 179 | \esc_html__( 'Blocklist Subscriptions', 'activitypub' ), |
| 190 | 180 | array( self::class, 'render_blocklist_subscriptions_field' ), |
| 191 | 181 | 'activitypub_settings', |
| @@ -203,54 +193,54 @@ | ||
| 203 | 193 | |
| 204 | 194 | if ( $disabled ) : |
| 205 | 195 | ?> |
| 206 | 196 | <p class="description"> |
| 207 | - <?php \esc_html_e( 'âš This setting is defined through server configuration by your blog’s administrator.', 'activitypub' ); ?> | |
| 197 | + <?php esc_html_e( 'âš This setting is defined through server configuration by your blog’s administrator.', 'activitypub' ); ?> | |
| 208 | 198 | </p> |
| 209 | 199 | <?php |
| 210 | 200 | return; |
| 211 | 201 | endif; |
| 212 | 202 | |
| 213 | - $value = \get_option( 'activitypub_actor_mode', ACTIVITYPUB_ACTOR_MODE ); | |
| 203 | + $value = get_option( 'activitypub_actor_mode', ACTIVITYPUB_ACTOR_MODE ); | |
| 214 | 204 | ?> |
| 215 | 205 | <fieldset class="actor-mode-selection"> |
| 216 | 206 | <div class="row"> |
| 217 | - <input type="radio" id="actor-mode" name="activitypub_actor_mode" value="<?php echo \esc_attr( ACTIVITYPUB_ACTOR_MODE ); ?>" <?php \checked( ACTIVITYPUB_ACTOR_MODE, $value ); ?> /> | |
| 207 | + <input type="radio" id="actor-mode" name="activitypub_actor_mode" value="<?php echo esc_attr( ACTIVITYPUB_ACTOR_MODE ); ?>" <?php checked( ACTIVITYPUB_ACTOR_MODE, $value ); ?> /> | |
| 218 | 208 | <div> |
| 219 | - <label for="actor-mode"><strong><?php \esc_html_e( 'Author Profiles Only', 'activitypub' ); ?></strong></label> | |
| 209 | + <label for="actor-mode"><strong><?php esc_html_e( 'Author Profiles Only', 'activitypub' ); ?></strong></label> | |
| 220 | 210 | <p class="description"> |
| 221 | - <?php echo \wp_kses( \__( 'Every author on this blog (with the <code>activitypub</code> capability) gets their own ActivityPub profile.', 'activitypub' ), array( 'code' => array() ) ); ?> | |
| 211 | + <?php echo wp_kses( __( 'Every author on this blog (with the <code>activitypub</code> capability) gets their own ActivityPub profile.', 'activitypub' ), array( 'code' => array() ) ); ?> | |
| 222 | 212 | <strong> |
| 223 | 213 | <?php |
| 224 | - echo \wp_kses( | |
| 225 | - \sprintf( | |
| 214 | + echo wp_kses( | |
| 215 | + sprintf( | |
| 226 | 216 | // translators: %s is a URL. |
| 227 | - \__( 'You can add/remove the capability in the <a href="%s">user settings.</a>', 'activitypub' ), | |
| 228 | - \admin_url( '/users.php' ) | |
| 217 | + __( 'You can add/remove the capability in the <a href="%s">user settings.</a>', 'activitypub' ), | |
| 218 | + admin_url( '/users.php' ) | |
| 229 | 219 | ), |
| 230 | 220 | array( 'a' => array( 'href' => array() ) ) |
| 231 | 221 | ); |
| 232 | 222 | ?> |
| 233 | 223 | </strong> |
| 234 | - <?php echo \wp_kses( \__( 'Select all the users you want to update, choose the method from the drop-down list and click on the "Apply" button.', 'activitypub' ), array( 'code' => array() ) ); ?> | |
| 224 | + <?php echo wp_kses( __( 'Select all the users you want to update, choose the method from the drop-down list and click on the "Apply" button.', 'activitypub' ), array( 'code' => array() ) ); ?> | |
| 235 | 225 | </p> |
| 236 | 226 | </div> |
| 237 | 227 | </div> |
| 238 | 228 | <div class="row"> |
| 239 | - <input type="radio" id="blog-mode" name="activitypub_actor_mode" value="<?php echo \esc_attr( ACTIVITYPUB_BLOG_MODE ); ?>" <?php \checked( ACTIVITYPUB_BLOG_MODE, $value ); ?> /> | |
| 229 | + <input type="radio" id="blog-mode" name="activitypub_actor_mode" value="<?php echo esc_attr( ACTIVITYPUB_BLOG_MODE ); ?>" <?php checked( ACTIVITYPUB_BLOG_MODE, $value ); ?> /> | |
| 240 | 230 | <div> |
| 241 | - <label for="blog-mode"><strong><?php \esc_html_e( 'Blog profile only', 'activitypub' ); ?></strong></label> | |
| 231 | + <label for="blog-mode"><strong><?php esc_html_e( 'Blog profile only', 'activitypub' ); ?></strong></label> | |
| 242 | 232 | <p class="description"> |
| 243 | - <?php \esc_html_e( 'Your blog becomes a single ActivityPub profile and every post will be published under this profile instead of the individual author profiles.', 'activitypub' ); ?> | |
| 233 | + <?php esc_html_e( 'Your blog becomes a single ActivityPub profile and every post will be published under this profile instead of the individual author profiles.', 'activitypub' ); ?> | |
| 244 | 234 | </p> |
| 245 | 235 | </div> |
| 246 | 236 | </div> |
| 247 | 237 | <div class="row"> |
| 248 | - <input type="radio" id="actor-blog-mode" name="activitypub_actor_mode" value="<?php echo \esc_attr( ACTIVITYPUB_ACTOR_AND_BLOG_MODE ); ?>" <?php \checked( ACTIVITYPUB_ACTOR_AND_BLOG_MODE, $value ); ?> /> | |
| 238 | + <input type="radio" id="actor-blog-mode" name="activitypub_actor_mode" value="<?php echo esc_attr( ACTIVITYPUB_ACTOR_AND_BLOG_MODE ); ?>" <?php checked( ACTIVITYPUB_ACTOR_AND_BLOG_MODE, $value ); ?> /> | |
| 249 | 239 | <div> |
| 250 | - <label for="actor-blog-mode"><strong><?php \esc_html_e( 'Both author and blog profiles', 'activitypub' ); ?></strong></label> | |
| 240 | + <label for="actor-blog-mode"><strong><?php esc_html_e( 'Both author and blog profiles', 'activitypub' ); ?></strong></label> | |
| 251 | 241 | <p class="description"> |
| 252 | - <?php \esc_html_e( "This combines both modes. Users can be followed individually, while following the blog will show boosts of individual user's posts.", 'activitypub' ); ?> | |
| 242 | + <?php esc_html_e( "This combines both modes. Users can be followed individually, while following the blog will show boosts of individual user's posts.", 'activitypub' ); ?> | |
| 253 | 243 | </p> |
| 254 | 244 | </div> |
| 255 | 245 | </div> |
| 256 | 246 | </fieldset> |
| @@ -281,24 +271,24 @@ | ||
| 281 | 271 | <?php \esc_html_e( 'Switch to Automatic Mode', 'activitypub' ); ?> |
| 282 | 272 | </a> |
| 283 | 273 | </p> |
| 284 | 274 | <?php |
| 285 | - $value = \get_option( 'activitypub_custom_post_content', ACTIVITYPUB_CUSTOM_POST_CONTENT ); | |
| 275 | + $value = get_option( 'activitypub_custom_post_content', ACTIVITYPUB_CUSTOM_POST_CONTENT ); | |
| 286 | 276 | ?> |
| 287 | 277 | <p> |
| 288 | - <textarea id="activitypub_custom_post_content" name="activitypub_custom_post_content" rows="10" cols="50" class="large-text" placeholder="<?php echo \esc_attr( ACTIVITYPUB_CUSTOM_POST_CONTENT ); ?>"><?php echo \esc_textarea( \wp_kses( $value, 'post' ) ); ?></textarea> | |
| 278 | + <textarea id="activitypub_custom_post_content" name="activitypub_custom_post_content" rows="10" cols="50" class="large-text" placeholder="<?php echo esc_attr( ACTIVITYPUB_CUSTOM_POST_CONTENT ); ?>"><?php echo esc_textarea( wp_kses( $value, 'post' ) ); ?></textarea> | |
| 289 | 279 | <details> |
| 290 | - <summary><?php \esc_html_e( 'See a list of ActivityPub Template Tags.', 'activitypub' ); ?></summary> | |
| 280 | + <summary><?php esc_html_e( 'See a list of ActivityPub Template Tags.', 'activitypub' ); ?></summary> | |
| 291 | 281 | <div class="description"> |
| 292 | 282 | <ul> |
| 293 | - <li><code>[ap_title]</code> - <?php \esc_html_e( 'The post’s title.', 'activitypub' ); ?></li> | |
| 294 | - <li><code>[ap_content]</code> - <?php \esc_html_e( 'The post’s content.', 'activitypub' ); ?></li> | |
| 295 | - <li><code>[ap_excerpt]</code> - <?php \esc_html_e( 'The post’s excerpt (may be truncated).', 'activitypub' ); ?></li> | |
| 296 | - <li><code>[ap_permalink]</code> - <?php \esc_html_e( 'The post’s permalink.', 'activitypub' ); ?></li> | |
| 297 | - <li><code>[ap_shortlink]</code> - <?php echo \wp_kses( \__( 'The post’s shortlink. I can recommend <a href="https://wordpress.org/plugins/hum/" target="_blank">Hum</a>.', 'activitypub' ), 'default' ); ?></li> | |
| 298 | - <li><code>[ap_hashtags]</code> - <?php \esc_html_e( 'The post’s tags as hashtags.', 'activitypub' ); ?></li> | |
| 283 | + <li><code>[ap_title]</code> - <?php esc_html_e( 'The post’s title.', 'activitypub' ); ?></li> | |
| 284 | + <li><code>[ap_content]</code> - <?php esc_html_e( 'The post’s content.', 'activitypub' ); ?></li> | |
| 285 | + <li><code>[ap_excerpt]</code> - <?php esc_html_e( 'The post’s excerpt (may be truncated).', 'activitypub' ); ?></li> | |
| 286 | + <li><code>[ap_permalink]</code> - <?php esc_html_e( 'The post’s permalink.', 'activitypub' ); ?></li> | |
| 287 | + <li><code>[ap_shortlink]</code> - <?php echo wp_kses( __( 'The post’s shortlink. I can recommend <a href="https://wordpress.org/plugins/hum/" target="_blank">Hum</a>.', 'activitypub' ), 'default' ); ?></li> | |
| 288 | + <li><code>[ap_hashtags]</code> - <?php esc_html_e( 'The post’s tags as hashtags.', 'activitypub' ); ?></li> | |
| 299 | 289 | </ul> |
| 300 | - <p><?php \esc_html_e( 'You can find the full list with all possible attributes in the help section on the top-right of the screen.', 'activitypub' ); ?></p> | |
| 290 | + <p><?php esc_html_e( 'You can find the full list with all possible attributes in the help section on the top-right of the screen.', 'activitypub' ); ?></p> | |
| 301 | 291 | </div> |
| 302 | 292 | </details> |
| 303 | 293 | </p> |
| 304 | 294 | <?php |
| @@ -307,18 +297,18 @@ | ||
| 307 | 297 | /** |
| 308 | 298 | * Render max image attachments field. |
| 309 | 299 | */ |
| 310 | 300 | public static function render_max_image_attachments_field() { |
| 311 | - $value = \get_option( 'activitypub_max_image_attachments', ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS ); | |
| 301 | + $value = get_option( 'activitypub_max_image_attachments', ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS ); | |
| 312 | 302 | ?> |
| 313 | - <input id="activitypub_max_image_attachments" value="<?php echo \esc_attr( $value ); ?>" name="activitypub_max_image_attachments" type="number" min="0" max="10" class="small-text" /> | |
| 303 | + <input id="activitypub_max_image_attachments" value="<?php echo esc_attr( $value ); ?>" name="activitypub_max_image_attachments" type="number" min="0" max="10" class="small-text" /> | |
| 314 | 304 | <p class="description"> |
| 315 | 305 | <?php |
| 316 | - echo \wp_kses( | |
| 317 | - \sprintf( | |
| 306 | + echo wp_kses( | |
| 307 | + sprintf( | |
| 318 | 308 | // translators: %s is a number. |
| 319 | - \__( 'The number of media (images, audio, video) to attach to posts. Default: <code>%s</code>', 'activitypub' ), | |
| 320 | - \esc_html( ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS ) | |
| 309 | + __( 'The number of media (images, audio, video) to attach to posts. Default: <code>%s</code>', 'activitypub' ), | |
| 310 | + esc_html( ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS ) | |
| 321 | 311 | ), |
| 322 | 312 | 'default' |
| 323 | 313 | ); |
| 324 | 314 | ?> |
| @@ -324,9 +314,9 @@ | ||
| 324 | 314 | ?> |
| 325 | 315 | </p> |
| 326 | 316 | <p class="description"> |
| 327 | 317 | <em> |
| 328 | - <?php \esc_html_e( 'Note: audio and video attachments are only supported from Block Editor.', 'activitypub' ); ?> | |
| 318 | + <?php esc_html_e( 'Note: audio and video attachments are only supported from Block Editor.', 'activitypub' ); ?> | |
| 329 | 319 | </em> |
| 330 | 320 | </p> |
| 331 | 321 | <?php |
| 332 | 322 | } |
| @@ -338,16 +328,16 @@ | ||
| 338 | 328 | $post_types = \get_post_types( array( 'public' => true ), 'objects' ); |
| 339 | 329 | $supported_post_types = \get_option( 'activitypub_support_post_types', array( 'post' ) ); |
| 340 | 330 | ?> |
| 341 | 331 | <fieldset> |
| 342 | - <?php \esc_html_e( 'Automatically publish items of the selected post types to the fediverse:', 'activitypub' ); ?> | |
| 332 | + <?php esc_html_e( 'Automatically publish items of the selected post types to the fediverse:', 'activitypub' ); ?> | |
| 343 | 333 | <ul> |
| 344 | 334 | <?php foreach ( $post_types as $post_type ) : ?> |
| 345 | 335 | <li> |
| 346 | - <input type="checkbox" id="activitypub_support_post_type_<?php echo \esc_attr( $post_type->name ); ?>" name="activitypub_support_post_types[]" value="<?php echo \esc_attr( $post_type->name ); ?>" <?php \checked( \in_array( $post_type->name, $supported_post_types, true ) ); ?> /> | |
| 347 | - <label for="activitypub_support_post_type_<?php echo \esc_attr( $post_type->name ); ?>"><?php echo \esc_html( $post_type->label ); ?></label> | |
| 336 | + <input type="checkbox" id="activitypub_support_post_type_<?php echo esc_attr( $post_type->name ); ?>" name="activitypub_support_post_types[]" value="<?php echo esc_attr( $post_type->name ); ?>" <?php checked( in_array( $post_type->name, $supported_post_types, true ) ); ?> /> | |
| 337 | + <label for="activitypub_support_post_type_<?php echo esc_attr( $post_type->name ); ?>"><?php echo esc_html( $post_type->label ); ?></label> | |
| 348 | 338 | <span class="description"> |
| 349 | - <?php echo \esc_html( get_post_type_description( $post_type ) ); ?> | |
| 339 | + <?php echo esc_html( \Activitypub\get_post_type_description( $post_type ) ); ?> | |
| 350 | 340 | </span> |
| 351 | 341 | </li> |
| 352 | 342 | <?php endforeach; ?> |
| 353 | 343 | </ul> |
| @@ -358,35 +348,35 @@ | ||
| 358 | 348 | /** |
| 359 | 349 | * Render allow interactions field. |
| 360 | 350 | */ |
| 361 | 351 | public static function render_allow_interactions_field() { |
| 362 | - if ( \defined( 'ACTIVITYPUB_DISABLE_INCOMING_INTERACTIONS' ) && ACTIVITYPUB_DISABLE_INCOMING_INTERACTIONS ) { | |
| 352 | + if ( defined( 'ACTIVITYPUB_DISABLE_INCOMING_INTERACTIONS' ) && ACTIVITYPUB_DISABLE_INCOMING_INTERACTIONS ) { | |
| 363 | 353 | echo '<p class="description">' . \esc_html__( 'âš This setting is defined through server configuration by your blog’s administrator.', 'activitypub' ) . '</p>'; |
| 364 | 354 | return; |
| 365 | 355 | } |
| 366 | 356 | |
| 367 | - $allow_likes = \get_option( 'activitypub_allow_likes', '1' ); | |
| 368 | - $allow_reposts = \get_option( 'activitypub_allow_reposts', '1' ); | |
| 369 | - $auto_approve = \get_option( 'activitypub_auto_approve_reactions', '0' ); | |
| 357 | + $allow_likes = get_option( 'activitypub_allow_likes', '1' ); | |
| 358 | + $allow_reposts = get_option( 'activitypub_allow_reposts', '1' ); | |
| 359 | + $auto_approve = get_option( 'activitypub_auto_approve_reactions', '0' ); | |
| 370 | 360 | ?> |
| 371 | 361 | <fieldset> |
| 372 | 362 | <p> |
| 373 | 363 | <label> |
| 374 | - <input type="checkbox" name="activitypub_allow_likes" value="1" <?php \checked( '1', $allow_likes ); ?> /> | |
| 375 | - <?php \esc_html_e( 'Receive likes', 'activitypub' ); ?> | |
| 364 | + <input type="checkbox" name="activitypub_allow_likes" value="1" <?php checked( '1', $allow_likes ); ?> /> | |
| 365 | + <?php esc_html_e( 'Receive likes', 'activitypub' ); ?> | |
| 376 | 366 | </label> |
| 377 | 367 | </p> |
| 378 | 368 | <p> |
| 379 | 369 | <label> |
| 380 | - <input type="checkbox" name="activitypub_allow_reposts" value="1" <?php \checked( '1', $allow_reposts ); ?> /> | |
| 381 | - <?php \esc_html_e( 'Receive reblogs (boosts)', 'activitypub' ); ?> | |
| 370 | + <input type="checkbox" name="activitypub_allow_reposts" value="1" <?php checked( '1', $allow_reposts ); ?> /> | |
| 371 | + <?php esc_html_e( 'Receive reblogs (boosts)', 'activitypub' ); ?> | |
| 382 | 372 | </label> |
| 383 | 373 | </p> |
| 384 | - <p class="interactions description"><?php \esc_html_e( 'Types of interactions from the Fediverse your blog should accept.', 'activitypub' ); ?></p> | |
| 374 | + <p class="interactions description"><?php esc_html_e( 'Types of interactions from the Fediverse your blog should accept.', 'activitypub' ); ?></p> | |
| 385 | 375 | <p> |
| 386 | 376 | <label> |
| 387 | - <input type="checkbox" name="activitypub_auto_approve_reactions" value="1" <?php \checked( '1', $auto_approve ); ?> /> | |
| 388 | - <?php \esc_html_e( 'Auto approve reactions', 'activitypub' ); ?> | |
| 377 | + <input type="checkbox" name="activitypub_auto_approve_reactions" value="1" <?php checked( '1', $auto_approve ); ?> /> | |
| 378 | + <?php esc_html_e( 'Auto approve reactions', 'activitypub' ); ?> | |
| 389 | 379 | </label> |
| 390 | 380 | </p> |
| 391 | 381 | </fieldset> |
| 392 | 382 | <?php |
| @@ -395,48 +385,31 @@ | ||
| 395 | 385 | /** |
| 396 | 386 | * Render default quote policy field. |
| 397 | 387 | */ |
| 398 | 388 | public static function render_default_quote_policy_field() { |
| 399 | - $value = \get_option( 'activitypub_default_quote_policy', ACTIVITYPUB_INTERACTION_POLICY_ANYONE ); | |
| 389 | + $value = get_option( 'activitypub_default_quote_policy', ACTIVITYPUB_INTERACTION_POLICY_ANYONE ); | |
| 400 | 390 | ?> |
| 401 | 391 | <select id="activitypub_default_quote_policy" name="activitypub_default_quote_policy" class="regular-text"> |
| 402 | - <option value="<?php echo \esc_attr( ACTIVITYPUB_INTERACTION_POLICY_ANYONE ); ?>" <?php \selected( $value, ACTIVITYPUB_INTERACTION_POLICY_ANYONE ); ?>><?php \esc_html_e( 'Anyone', 'activitypub' ); ?></option> | |
| 403 | - <option value="<?php echo \esc_attr( ACTIVITYPUB_INTERACTION_POLICY_FOLLOWERS ); ?>" <?php \selected( $value, ACTIVITYPUB_INTERACTION_POLICY_FOLLOWERS ); ?>><?php \esc_html_e( 'Followers only', 'activitypub' ); ?></option> | |
| 404 | - <option value="<?php echo \esc_attr( ACTIVITYPUB_INTERACTION_POLICY_ME ); ?>" <?php \selected( $value, ACTIVITYPUB_INTERACTION_POLICY_ME ); ?>><?php \esc_html_e( 'Just me', 'activitypub' ); ?></option> | |
| 392 | + <option value="<?php echo esc_attr( ACTIVITYPUB_INTERACTION_POLICY_ANYONE ); ?>" <?php selected( $value, ACTIVITYPUB_INTERACTION_POLICY_ANYONE ); ?>><?php esc_html_e( 'Anyone', 'activitypub' ); ?></option> | |
| 393 | + <option value="<?php echo esc_attr( ACTIVITYPUB_INTERACTION_POLICY_FOLLOWERS ); ?>" <?php selected( $value, ACTIVITYPUB_INTERACTION_POLICY_FOLLOWERS ); ?>><?php esc_html_e( 'Followers only', 'activitypub' ); ?></option> | |
| 394 | + <option value="<?php echo esc_attr( ACTIVITYPUB_INTERACTION_POLICY_ME ); ?>" <?php selected( $value, ACTIVITYPUB_INTERACTION_POLICY_ME ); ?>><?php esc_html_e( 'Just me', 'activitypub' ); ?></option> | |
| 405 | 395 | </select> |
| 406 | 396 | <p class="description"> |
| 407 | - <?php \esc_html_e( 'Default setting for who can quote new posts. This can be overridden per post.', 'activitypub' ); ?> | |
| 397 | + <?php esc_html_e( 'Default setting for who can quote new posts. This can be overridden per post.', 'activitypub' ); ?> | |
| 408 | 398 | </p> |
| 409 | 399 | <?php |
| 410 | 400 | } |
| 411 | 401 | |
| 412 | 402 | /** |
| 413 | - * Render default feature policy field. | |
| 414 | - */ | |
| 415 | - public static function render_default_feature_policy_field() { | |
| 416 | - $value = \get_option( 'activitypub_default_feature_policy', ACTIVITYPUB_INTERACTION_POLICY_ME ); | |
| 417 | - ?> | |
| 418 | - <select id="activitypub_default_feature_policy" name="activitypub_default_feature_policy" class="regular-text"> | |
| 419 | - <option value="<?php echo \esc_attr( ACTIVITYPUB_INTERACTION_POLICY_ANYONE ); ?>" <?php \selected( $value, ACTIVITYPUB_INTERACTION_POLICY_ANYONE ); ?>><?php \esc_html_e( 'Anyone', 'activitypub' ); ?></option> | |
| 420 | - <option value="<?php echo \esc_attr( ACTIVITYPUB_INTERACTION_POLICY_FOLLOWERS ); ?>" <?php \selected( $value, ACTIVITYPUB_INTERACTION_POLICY_FOLLOWERS ); ?>><?php \esc_html_e( 'Followers only', 'activitypub' ); ?></option> | |
| 421 | - <option value="<?php echo \esc_attr( ACTIVITYPUB_INTERACTION_POLICY_ME ); ?>" <?php \selected( $value, ACTIVITYPUB_INTERACTION_POLICY_ME ); ?>><?php \esc_html_e( 'Just me', 'activitypub' ); ?></option> | |
| 422 | - </select> | |
| 423 | - <p class="description"> | |
| 424 | - <?php \esc_html_e( 'Default setting for who can include this site\'s actors in a Starter Kit (also called a Starter Pack or Featured Collection).', 'activitypub' ); ?> | |
| 425 | - </p> | |
| 426 | - <?php | |
| 427 | - } | |
| 428 | - | |
| 429 | - /** | |
| 430 | 403 | * Render use hashtags field. |
| 431 | 404 | */ |
| 432 | 405 | public static function render_use_hashtags_field() { |
| 433 | - $value = \get_option( 'activitypub_use_hashtags', '0' ); | |
| 406 | + $value = get_option( 'activitypub_use_hashtags', '0' ); | |
| 434 | 407 | ?> |
| 435 | 408 | <p> |
| 436 | 409 | <label> |
| 437 | - <input type="checkbox" id="activitypub_use_hashtags" name="activitypub_use_hashtags" value="1" <?php \checked( '1', $value ); ?> /> | |
| 438 | - <?php echo \wp_kses( \__( 'Add hashtags in the content as native tags and replace the <code>#tag</code> with the tag link.', 'activitypub' ), 'default' ); ?> | |
| 410 | + <input type="checkbox" id="activitypub_use_hashtags" name="activitypub_use_hashtags" value="1" <?php checked( '1', $value ); ?> /> | |
| 411 | + <?php echo wp_kses( __( 'Add hashtags in the content as native tags and replace the <code>#tag</code> with the tag link.', 'activitypub' ), 'default' ); ?> | |
| 439 | 412 | </label> |
| 440 | 413 | </p> |
| 441 | 414 | <?php |
| 442 | 415 | } |
| @@ -444,14 +417,14 @@ | ||
| 444 | 417 | /** |
| 445 | 418 | * Render use OpenGraph field. |
| 446 | 419 | */ |
| 447 | 420 | public static function render_use_opengraph_field() { |
| 448 | - $value = \get_option( 'activitypub_use_opengraph', '1' ); | |
| 421 | + $value = get_option( 'activitypub_use_opengraph', '1' ); | |
| 449 | 422 | ?> |
| 450 | 423 | <p> |
| 451 | 424 | <label> |
| 452 | - <input type="checkbox" id="activitypub_use_opengraph" name="activitypub_use_opengraph" value="1" <?php \checked( '1', $value ); ?> /> | |
| 453 | - <?php echo \wp_kses( \__( 'Automatically add <code><meta name="fediverse:creator" /></code> tags for Authors and the Blog-User. You can read more about the feature on the <a href="https://blog.joinmastodon.org/2024/07/highlighting-journalism-on-mastodon/" target="_blank">Mastodon Blog</a>.', 'activitypub' ), 'post' ); ?> | |
| 425 | + <input type="checkbox" id="activitypub_use_opengraph" name="activitypub_use_opengraph" value="1" <?php checked( '1', $value ); ?> /> | |
| 426 | + <?php echo wp_kses( __( 'Automatically add <code><meta name="fediverse:creator" /></code> tags for Authors and the Blog-User. You can read more about the feature on the <a href="https://blog.joinmastodon.org/2024/07/highlighting-journalism-on-mastodon/" target="_blank">Mastodon Blog</a>.', 'activitypub' ), 'post' ); ?> | |
| 454 | 427 | </label> |
| 455 | 428 | </p> |
| 456 | 429 | <?php |
| 457 | 430 | } |
| @@ -459,9 +432,9 @@ | ||
| 459 | 432 | /** |
| 460 | 433 | * Render attribution domains field. |
| 461 | 434 | */ |
| 462 | 435 | public static function render_attribution_domains_field() { |
| 463 | - $value = \get_option( 'activitypub_attribution_domains', home_host() ); | |
| 436 | + $value = get_option( 'activitypub_attribution_domains', home_host() ); | |
| 464 | 437 | ?> |
| 465 | 438 | <textarea |
| 466 | 439 | id="activitypub_attribution_domains" |
| 467 | 440 | name="activitypub_attribution_domains" |
| @@ -466,11 +439,11 @@ | ||
| 466 | 439 | id="activitypub_attribution_domains" |
| 467 | 440 | name="activitypub_attribution_domains" |
| 468 | 441 | class="large-text" |
| 469 | 442 | cols="50" rows="5" |
| 470 | - placeholder="<?php echo \esc_attr( home_host() ); ?>" | |
| 471 | - ><?php echo \esc_textarea( $value ); ?></textarea> | |
| 472 | - <p class="description"><?php \esc_html_e( 'Websites allowed to credit you, one per line. Protects from false attributions.', 'activitypub' ); ?></p> | |
| 443 | + placeholder="<?php echo esc_attr( home_host() ); ?>" | |
| 444 | + ><?php echo esc_textarea( $value ); ?></textarea> | |
| 445 | + <p class="description"><?php esc_html_e( 'Websites allowed to credit you, one per line. Protects from false attributions.', 'activitypub' ); ?></p> | |
| 473 | 446 | <?php |
| 474 | 447 | } |
| 475 | 448 | |
| 476 | 449 | /** |
| @@ -484,9 +457,9 @@ | ||
| 484 | 457 | name="activitypub_relays" |
| 485 | 458 | class="large-text" |
| 486 | 459 | cols="50" |
| 487 | 460 | rows="5" |
| 488 | - ><?php echo \esc_textarea( \implode( PHP_EOL, $value ) ); ?></textarea> | |
| 461 | + ><?php echo \esc_textarea( implode( PHP_EOL, $value ) ); ?></textarea> | |
| 489 | 462 | <p class="description"> |
| 490 | 463 | <?php echo \wp_kses( \__( 'A <strong>Fediverse-Relay</strong> distributes content across instances, expanding reach, engagement, and discoverability, especially for smaller instances.', 'activitypub' ), 'default' ); ?> |
| 491 | 464 | </p> |
| 492 | 465 | <p class="description"> |