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