PluginProbe
ActivityPub / 7.8.2
ActivityPub v7.8.2
9.3.1 9.3.0 9.2.2 9.2.1 9.2.0 9.1.0 9.0.2 9.0.1 9.0.0 8.3.0 8.2.1 8.2.0 8.1.1 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.2.0 1.3.0 2.0.0 2.0.1 2.1.0 2.1.1 All 160 releases
← All changes | includes/wp-admin/class-settings.php +15 -39 9.2.0 → 7.8.2 View file →
@@ -21,9 +21,8 @@
21 21 public static function init() {
22 22 \add_action( 'admin_menu', array( self::class, 'add_settings_page' ) );
23 23
24 24 \add_action( 'load-settings_page_activitypub', array( self::class, 'handle_welcome_query_arg' ) );
25 - \add_action( 'load-settings_page_activitypub', array( self::class, 'handle_switch_object_type' ) );
26 25 }
27 26
28 27 /**
29 28 * Load settings page.
@@ -32,15 +31,15 @@
32 31 $show_welcome_tab = \get_user_meta( \get_current_user_id(), 'activitypub_show_welcome_tab', true );
33 32 $show_advanced_tab = \get_user_meta( \get_current_user_id(), 'activitypub_show_advanced_tab', true );
34 33 $settings_tabs = array();
35 34 $settings_tab = array(
36 - 'label' => \__( 'Settings', 'activitypub' ),
35 + 'label' => __( 'Settings', 'activitypub' ),
37 36 'template' => ACTIVITYPUB_PLUGIN_DIR . 'templates/settings.php',
38 37 );
39 38
40 39 if ( $show_welcome_tab ) {
41 40 $settings_tabs['welcome'] = array(
42 - 'label' => \__( 'Welcome', 'activitypub' ),
41 + 'label' => __( 'Welcome', 'activitypub' ),
43 42 'template' => ACTIVITYPUB_PLUGIN_DIR . 'templates/welcome.php',
44 43 );
45 44 }
46 45
@@ -61,19 +60,19 @@
61 60 );
62 61
63 62 if ( user_can_activitypub( Actors::BLOG_USER_ID ) ) {
64 63 $settings_tabs['blog-profile'] = array(
65 - 'label' => \__( 'Blog Profile', 'activitypub' ),
64 + 'label' => __( 'Blog Profile', 'activitypub' ),
66 65 'template' => ACTIVITYPUB_PLUGIN_DIR . 'templates/blog-settings.php',
67 66 );
68 67 $settings_tabs['followers'] = array(
69 - 'label' => \__( 'Followers', 'activitypub' ),
68 + 'label' => __( 'Followers', 'activitypub' ),
70 69 'template' => ACTIVITYPUB_PLUGIN_DIR . 'templates/followers-list.php',
71 70 );
72 71
73 72 if ( '1' === \get_option( 'activitypub_following_ui', '0' ) ) {
74 73 $settings_tabs['following'] = array(
75 - 'label' => \__( 'Following', 'activitypub' ),
74 + 'label' => __( 'Following', 'activitypub' ),
76 75 'template' => ACTIVITYPUB_PLUGIN_DIR . 'templates/following-list.php',
77 76 );
78 77 }
79 78 }
@@ -85,14 +84,14 @@
85 84 */
86 85 $settings_tabs = \apply_filters( 'activitypub_admin_settings_tabs', $settings_tabs );
87 86
88 87 if ( empty( $settings_tabs ) ) {
89 - \_doing_it_wrong( __FUNCTION__, 'No settings tabs found. There should be at least one tab to show a settings page.', '7.0.0' );
88 + _doing_it_wrong( __FUNCTION__, 'No settings tabs found. There should be at least one tab to show a settings page.', '7.0.0' );
90 89 $settings_tabs['settings'] = $settings_tab;
91 90 }
92 91
93 - $tab_keys = \array_keys( $settings_tabs );
94 - $default_tab = \reset( $tab_keys );
92 + $tab_keys = array_keys( $settings_tabs );
93 + $default_tab = reset( $tab_keys );
95 94 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
96 95 $tab = isset( $_GET['tab'] ) ? \sanitize_key( $_GET['tab'] ) : $default_tab;
97 96
98 97 if ( ! isset( $settings_tabs[ $tab ] ) ) {
@@ -192,12 +191,12 @@
192 191 if ( ! empty( self::get_recommended_plugins() ) ) {
193 192 \get_current_screen()->add_help_tab(
194 193 array(
195 194 'id' => 'recommended-plugins',
196 - 'title' => \__( 'Recommended Plugins', 'activitypub' ),
195 + 'title' => __( 'Recommended Plugins', 'activitypub' ),
197 196 'content' =>
198 - '<h2>' . \esc_html__( 'Supercharge Your Fediverse Experience', 'activitypub' ) . '</h2>' .
199 - '<p>' . \esc_html__( 'Enhance your WordPress ActivityPub setup with these hand-picked plugins, each adding unique capabilities for a richer Fediverse experience.', 'activitypub' ) . '</p>' .
197 + '<h2>' . esc_html__( 'Supercharge Your Fediverse Experience', 'activitypub' ) . '</h2>' .
198 + '<p>' . esc_html__( 'Enhance your WordPress ActivityPub setup with these hand-picked plugins, each adding unique capabilities for a richer Fediverse experience.', 'activitypub' ) . '</p>' .
200 199 self::render_recommended_plugins_list(),
201 200 )
202 201 );
203 202 }
@@ -289,31 +288,8 @@
289 288 }
290 289 }
291 290
292 291 /**
293 - * Handle switching from legacy template mode to automatic object type.
294 - *
295 - * @since 8.0.0
296 - */
297 - public static function handle_switch_object_type() {
298 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended
299 - if ( ! isset( $_GET['activitypub_update_object_type'] ) ) {
300 - return;
301 - }
302 -
303 - \check_admin_referer( 'activitypub_switch_object_type' );
304 -
305 - if ( ! \current_user_can( 'manage_options' ) ) {
306 - return;
307 - }
308 -
309 - \update_option( 'activitypub_object_type', ACTIVITYPUB_DEFAULT_OBJECT_TYPE );
310 -
311 - \wp_safe_redirect( \admin_url( 'options-general.php?page=activitypub&tab=settings' ) );
312 - exit;
313 - }
314 -
315 - /**
316 292 * Returns an array of recommended plugins for ActivityPub.
317 293 */
318 294 public static function get_recommended_plugins() {
319 295 $plugins = array();
@@ -443,13 +419,13 @@
443 419 * @return string Rendered template output.
444 420 */
445 421 private static function get_help_tab_template( $template_name ) {
446 422 $template_path = ACTIVITYPUB_PLUGIN_DIR . 'templates/help-tab/' . $template_name . '.php';
447 - if ( ! \file_exists( $template_path ) ) {
423 + if ( ! file_exists( $template_path ) ) {
448 424 return '';
449 425 }
450 426
451 - \ob_start();
452 - \load_template( $template_path, false );
453 - return \ob_get_clean();
427 + ob_start();
428 + load_template( $template_path, false );
429 + return ob_get_clean();
454 430 }
455 431 }