11<?php
2+ /**
3+ * Super Admin Performance Boost.
4+ *
5+ * @package Super_Admin_Performance_Boost
6+ * @author Per Soderlind
7+ * @since 1.0.0
8+ */
29
310declare ( strict_types = 1 );
411
12+ /**
13+ * Super Admin Performance Boost.
14+ */
515class Super_Admin_Performance_Boost {
616
17+ /**
18+ * Constructor.
19+ */
720 public function __construct () {
821 add_filter ( 'pre_get_blogs_of_user ' , [ $ this , 'super_admin_get_blogs_of_user ' ], 9 , 3 );
922 add_filter ( 'wp_list_table_class_name ' , [ $ this , 'super_admin_wp_list_table_class_name ' ], 10 , 2 );
@@ -32,7 +45,7 @@ public function filter_wpmu_users_columns( array $users_columns ) : array {
3245 }
3346
3447 /**
35- * For the Super Admin, use a custom list table classes
48+ * For the Super Admin, use a custom list table class.
3649 *
3750 * @param string $class_name The list table class to use.
3851 * @param array $args An array containing _get_list_table() arguments.
@@ -49,16 +62,16 @@ public function super_admin_wp_list_table_class_name( string $class_name, array
4962 return $ class_name ;
5063 }
5164
52- /**
53- * For the superadmin, speed up the loading of the get_blogs_of_user() function.
54- *
55- * Stores the blogname, siteurl, home, and post_count in the wp_blogmeta table.
56- *
57- * @param null|object[] $sites An array of site objects of which the user is a member.
58- * @param int $user_id User ID.
59- * @param bool $all Whether the returned array should contain all sites, including those marked 'deleted', 'archived', or 'spam'. Default false.
60- * @return null|object[] An array of site objects of which the user is a member.
61- */
65+ /**
66+ * For the superadmin, speed up the loading of the get_blogs_of_user() function.
67+ *
68+ * Stores the blogname, siteurl, home, and post_count in the wp_blogmeta table.
69+ *
70+ * @param null|object[] $sites An array of site objects of which the user is a member.
71+ * @param int $user_id User ID.
72+ * @param bool $all Whether the returned array should contain all sites, including those marked 'deleted', 'archived', or 'spam'. Default false.
73+ * @return null|object[] An array of site objects of which the user is a member.
74+ */
6275 public function super_admin_get_blogs_of_user ( ?array $ sites , int $ user_id , bool $ all ) : ?array {
6376
6477 if ( ! \is_super_admin () ) {
@@ -126,7 +139,12 @@ public function super_admin_get_blogs_of_user( ?array $sites, int $user_id, bool
126139 }
127140
128141
129-
142+ /**
143+ * Get the admin URL for a given blog ID.
144+ *
145+ * @param int $blog_id The blog ID.
146+ * @return string The admin URL.
147+ */
130148 public static function get_admin_url ( int $ blog_id ) : string {
131149 $ admin_url = get_site_meta ( $ blog_id , 'siteurl ' , true );
132150 if ( false === $ admin_url ) {
@@ -136,6 +154,12 @@ public static function get_admin_url( int $blog_id ) : string {
136154 return $ admin_url ;
137155 }
138156
157+ /**
158+ * Get the home URL for a given blog ID.
159+ *
160+ * @param int $blog_id The blog ID.
161+ * @return string The home URL.
162+ */
139163 public static function get_home_url ( int $ blog_id ) : string {
140164 $ home_url = get_site_meta ( $ blog_id , 'home ' , true );
141165 if ( false === $ home_url ) {
0 commit comments