Changeset 3414829
- Timestamp:
- 12/09/2025 02:04:55 AM (4 months ago)
- Location:
- wp-multi-network
- Files:
-
- 12 added
- 28 edited
- 1 copied
-
tags/3.0.0 (copied) (copied from wp-multi-network/trunk)
-
tags/3.0.0/TESTING.md (added)
-
tags/3.0.0/phpunit.xml.legacy (added)
-
tags/3.0.0/readme.txt (modified) (4 diffs)
-
tags/3.0.0/wp-multi-network/assets/css/wp-multi-network-rtl.css (added)
-
tags/3.0.0/wp-multi-network/assets/css/wp-multi-network-rtl.min.css (added)
-
tags/3.0.0/wp-multi-network/assets/css/wp-multi-network.min.css (added)
-
tags/3.0.0/wp-multi-network/assets/js/wp-multi-network.js (modified) (1 diff)
-
tags/3.0.0/wp-multi-network/assets/js/wp-multi-network.min.js (added)
-
tags/3.0.0/wp-multi-network/includes/classes/class-wp-ms-network-command.php (modified) (17 diffs)
-
tags/3.0.0/wp-multi-network/includes/classes/class-wp-ms-networks-admin-bar.php (modified) (3 diffs)
-
tags/3.0.0/wp-multi-network/includes/classes/class-wp-ms-networks-admin.php (modified) (47 diffs)
-
tags/3.0.0/wp-multi-network/includes/classes/class-wp-ms-networks-capabilities.php (modified) (3 diffs)
-
tags/3.0.0/wp-multi-network/includes/classes/class-wp-ms-networks-list-table.php (modified) (22 diffs)
-
tags/3.0.0/wp-multi-network/includes/classes/class-wp-ms-rest-networks-controller.php (modified) (20 diffs)
-
tags/3.0.0/wp-multi-network/includes/compat.php (modified) (3 diffs)
-
tags/3.0.0/wp-multi-network/includes/deprecated.php (modified) (2 diffs)
-
tags/3.0.0/wp-multi-network/includes/functions.php (modified) (14 diffs)
-
tags/3.0.0/wp-multi-network/includes/metaboxes/edit-network.php (modified) (10 diffs)
-
tags/3.0.0/wp-multi-network/includes/metaboxes/move-site.php (modified) (3 diffs)
-
tags/3.0.0/wpmn-loader.php (modified) (9 diffs)
-
trunk/TESTING.md (added)
-
trunk/phpunit.xml.legacy (added)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/wp-multi-network/assets/css/wp-multi-network-rtl.css (added)
-
trunk/wp-multi-network/assets/css/wp-multi-network-rtl.min.css (added)
-
trunk/wp-multi-network/assets/css/wp-multi-network.min.css (added)
-
trunk/wp-multi-network/assets/js/wp-multi-network.js (modified) (1 diff)
-
trunk/wp-multi-network/assets/js/wp-multi-network.min.js (added)
-
trunk/wp-multi-network/includes/classes/class-wp-ms-network-command.php (modified) (17 diffs)
-
trunk/wp-multi-network/includes/classes/class-wp-ms-networks-admin-bar.php (modified) (3 diffs)
-
trunk/wp-multi-network/includes/classes/class-wp-ms-networks-admin.php (modified) (47 diffs)
-
trunk/wp-multi-network/includes/classes/class-wp-ms-networks-capabilities.php (modified) (3 diffs)
-
trunk/wp-multi-network/includes/classes/class-wp-ms-networks-list-table.php (modified) (22 diffs)
-
trunk/wp-multi-network/includes/classes/class-wp-ms-rest-networks-controller.php (modified) (20 diffs)
-
trunk/wp-multi-network/includes/compat.php (modified) (3 diffs)
-
trunk/wp-multi-network/includes/deprecated.php (modified) (2 diffs)
-
trunk/wp-multi-network/includes/functions.php (modified) (14 diffs)
-
trunk/wp-multi-network/includes/metaboxes/edit-network.php (modified) (10 diffs)
-
trunk/wp-multi-network/includes/metaboxes/move-site.php (modified) (3 diffs)
-
trunk/wpmn-loader.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-multi-network/tags/3.0.0/readme.txt
r2788090 r3414829 2 2 Author: Triple J Software, Inc. 3 3 Author URI: https://jjj.software 4 Donate link: https://buy.stripe.com/7sI3cd2tK1Cy2lydQR5 4 Plugin URI: https://wordpress.org/plugins/wp-multi-network/ 6 5 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 9 8 Tags: network, sites, domains, global, admin 10 9 Requires PHP: 5.2 11 Requires at least: 4.912 Tested up to: 6.110 Requires at least: 5.5 11 Tested up to: 7.0 13 12 Stable tag: 2.5.2 14 13 … … 123 122 124 123 == Changelog == 124 125 = 2.5.3 = 126 * Remove filter_input usages 127 125 128 = 2.5.2 = 126 129 * Use get_main_site_id function instead of get_main_site_for_network. … … 128 131 129 132 = 2.5.1 = 130 * Save main site on network as network option. 133 * Save main site on network as network option. 131 134 132 135 = 2.5.0 = -
wp-multi-network/tags/3.0.0/wp-multi-network/assets/js/wp-multi-network.js
r2584493 r3414829 1 jQuery( document ).ready( 2 function ( $ ) { 1 /** 2 * WP Multi Network Admin Script 3 */ 3 4 4 $( '.if-js-closed' )5 .removeClass( 'if-js-closed' )6 .addClass( 'closed' );7 5 8 $( '.postbox' ).children( 'h3' ).click( 9 function () { 10 if ( $( this.parentNode ).hasClass( 'closed' ) ) { 11 $( this.parentNode ).removeClass( 'closed' ); 12 } else { 13 $( this.parentNode ).addClass( 'closed' ); 14 } 15 } 16 ); 6 jQuery( document ).ready( function ( $ ) { 7 $( '.if-js-closed' ).removeClass( 'if-js-closed' ).addClass( 'closed' ); 17 8 18 /* Handle clicks to add/remove sites to/from selected list */ 19 $( 'input[name=assign]' ).click( 20 function () { 21 move( 'from', 'to' ); 22 } 23 ); 9 $( '.postbox' ) 10 .children( 'h3' ) 11 .click( function () { 12 if ( $( this.parentNode ).hasClass( 'closed' ) ) { 13 $( this.parentNode ).removeClass( 'closed' ); 14 } else { 15 $( this.parentNode ).addClass( 'closed' ); 16 } 17 } ); 24 18 25 $( 'input[name=unassign]' ).click( 26 function () { 27 move( 'to', 'from' ); 28 } 29 ); 19 /* Handle clicks to add/remove sites to/from selected list */ 20 $( 'input[name=assign]' ).click( function () { 21 move( 'from', 'to' ); 22 } ); 30 23 31 /* Select all sites in "selected" box when submitting */ 32 $( '#edit-network-form' ).submit( 33 function () { 34 $( '#to' ).children( 'option:enabled' ).attr( 'selected', true ); 35 $( '#from' ).children( 'option:enabled' ).attr( 'selected', true ); 36 } 37 ); 24 $( 'input[name=unassign]' ).click( function () { 25 move( 'to', 'from' ); 26 } ); 38 27 39 function move( from, to ) { 40 jQuery( '#' + from ).children( 'option:selected' ).each( 41 function () { 42 jQuery( '#' + to ).append( jQuery( this ).clone() ); 43 jQuery( this ).remove(); 44 } 45 ); 46 } 28 /* Select all sites in "selected" box when submitting */ 29 $( '#edit-network-form' ).submit( function () { 30 $( '#to' ).children( 'option:enabled' ).attr( 'selected', true ); 31 $( '#from' ).children( 'option:enabled' ).attr( 'selected', true ); 32 } ); 33 34 function move( from, to ) { 35 jQuery( '#' + from ) 36 .children( 'option:selected' ) 37 .each( function () { 38 jQuery( '#' + to ).append( jQuery( this ).clone() ); 39 jQuery( this ).remove(); 40 } ); 47 41 } 48 );42 } ); -
wp-multi-network/tags/3.0.0/wp-multi-network/includes/classes/class-wp-ms-network-command.php
r2584493 r3414829 12 12 * @since 1.3.0 13 13 */ 14 class WP_MS_Network_Command extends WP_CLI_Command{14 class WP_MS_Network_Command { 15 15 16 16 /** … … 18 18 * 19 19 * @since 1.3.0 20 * @var array20 * @var string[] 21 21 */ 22 22 protected $obj_fields = array( … … 55 55 * @since 1.3.0 56 56 * 57 * @param array $args Positional CLI arguments. 58 * @param array $assoc_args Associative CLI arguments. 57 * @param string[] $args Positional CLI arguments. 58 * @param array<string, mixed> $assoc_args Associative CLI arguments. 59 * @return void 59 60 */ 60 61 public function create( $args, $assoc_args ) { 61 list( $domain, $path )= $args;62 [ $domain, $path ] = $args; 62 63 63 64 $assoc_args = wp_parse_args( … … 75 76 $user = $users->get( $assoc_args['network_admin'] ); 76 77 if ( ! $user ) { 77 return new WP_Error( 'network_super_admin','Super user does not exist.' );78 WP_CLI::error( 'Super user does not exist.' ); 78 79 } 79 80 $network_admin_id = $user->ID; … … 82 83 } 83 84 84 $clone_network = $assoc_args['clone_network']; 85 $options_to_clone = false; 86 87 if ( ! empty( $clone_network ) && ! get_network( $clone_network ) ) { 85 $clone_network = $assoc_args['clone_network']; 86 87 if ( ! empty( $clone_network ) && is_numeric( $clone_network ) && ! get_network( $clone_network ) ) { 88 88 WP_CLI::error( sprintf( "Clone network %s doesn't exist.", $clone_network ) ); 89 90 if ( ! empty( $assoc_args['options_to_clone'] ) ) {91 $options_to_clone = explode( ',', $assoc_args['options_to_clone'] );92 }93 89 } 94 90 … … 102 98 'network_admin_id' => $network_admin_id, 103 99 'clone_network' => $clone_network, 104 'options_to_clone' => $ options_to_clone,100 'options_to_clone' => $assoc_args['options_to_clone'], 105 101 ) 106 102 ); … … 127 123 * @since 1.3.0 128 124 * 129 * @param array $args Positional CLI arguments. 130 * @param array $assoc_args Associative CLI arguments. 125 * @param string[] $args Positional CLI arguments. 126 * @param array<string, mixed> $assoc_args Associative CLI arguments. 127 * @return void 131 128 */ 132 129 public function update( $args, $assoc_args ) { 133 list( $id, $domain )= $args;130 [ $id, $domain ] = $args; 134 131 135 132 $defaults = array( … … 138 135 $assoc_args = wp_parse_args( $assoc_args, $defaults ); 139 136 140 $network_id = update_network( $id, $domain, $assoc_args['path'] );137 $network_id = update_network( (int) $id, $domain, $assoc_args['path'] ); 141 138 142 139 if ( is_wp_error( $network_id ) ) { … … 158 155 * @since 1.3.0 159 156 * 160 * @param array $args Positional CLI arguments. 161 * @param array $assoc_args Associative CLI arguments. 157 * @param string[] $args Positional CLI arguments. 158 * @param array<string, mixed> $assoc_args Associative CLI arguments. 159 * @return void 162 160 */ 163 161 public function delete( $args, $assoc_args ) { 164 list( $id )= $args;162 [ $id ] = $args; 165 163 166 164 $assoc_args = wp_parse_args( … … 170 168 ); 171 169 172 $network_id = delete_network( $id, $assoc_args['delete_blogs'] );170 $network_id = delete_network( (int) $id, $assoc_args['delete_blogs'] ); 173 171 174 172 if ( is_wp_error( $network_id ) ) { … … 192 190 * @since 1.3.0 193 191 * 194 * @param array $args Positional CLI arguments. 195 * @param array $assoc_args Associative CLI arguments. 196 */ 197 public function move_site( $args, $assoc_args ) { 198 list( $site_id, $new_network_id ) = $args; 199 200 $network_id = move_site( $site_id, $new_network_id ); 192 * @param string[] $args Positional CLI arguments. 193 * @param array<string, mixed> $assoc_args Associative CLI arguments. 194 * @return void 195 */ 196 public function move_site( $args, $assoc_args ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed 197 [ $site_id, $new_network_id ] = $args; 198 199 $network_id = move_site( (int) $site_id, (int) $new_network_id ); 201 200 202 201 if ( is_wp_error( $network_id ) ) { … … 228 227 * @since 1.3.0 229 228 * 230 * @param array $args Positional CLI arguments. 231 * @param array $assoc_args Associative CLI arguments. 229 * @param string[] $args Positional CLI arguments. 230 * @param array<string, mixed> $assoc_args Associative CLI arguments. 231 * @return void 232 232 */ 233 233 public function list_( $args, $assoc_args ) { … … 257 257 * @since 1.3.0 258 258 * 259 * @param array $args Positional CLI arguments. 260 * @param array $assoc_args Associative CLI arguments. 259 * @param string[] $args Positional CLI arguments. 260 * @param array<string, mixed> $assoc_args Associative CLI arguments. 261 * @return void 261 262 */ 262 263 public function plugin( $args, $assoc_args ) { 263 $this->fetcher = new \WP_CLI\Fetchers\Plugin(); 264 $action = array_shift( $args ); 264 $fetchers_plugin = new \WP_CLI\Fetchers\Plugin(); 265 $action = array_shift( $args ); 266 265 267 if ( ! in_array( $action, array( 'activate', 'deactivate' ), true ) ) { 266 268 WP_CLI::error( sprintf( '%s is not a supported action.', $action ) ); 267 269 } 270 268 271 $network_wide = \WP_CLI\Utils\get_flag_value( $assoc_args, 'network' ); 269 272 $all = \WP_CLI\Utils\get_flag_value( $assoc_args, 'all', false ); … … 281 284 $args = array_map( 282 285 function ( $file ) { 283 return \WP_CLI\Utils\get_plugin_name( $file );286 return \WP_CLI\Utils\get_plugin_name( $file ); 284 287 }, array_keys( get_plugins() ) 285 288 ); 286 289 } 287 foreach ( $ this->fetcher->get_many( $args ) as $plugin ) {290 foreach ( $fetchers_plugin->get_many( $args ) as $plugin ) { 288 291 $status = $this->get_status( $plugin->file ); 289 292 if ( $all && in_array( $status, array( 'active', 'active-network' ), true ) ) { 290 $needing_activation --;293 --$needing_activation; 291 294 continue; 292 295 } … … 311 314 activate_plugins( $plugin->file, '', $network_wide ); 312 315 } else { 313 deactivate_plugins( $plugin->file, '', $network_wide );316 deactivate_plugins( $plugin->file, false, $network_wide ); 314 317 } 315 318 … … 327 330 * @since 1.3.0 328 331 * 329 * @param array $assoc_args Associative CLI arguments. Passed by reference.332 * @param array<string, mixed> $assoc_args Associative CLI arguments. Passed by reference. 330 333 * @return WP_CLI\Formatter WP-CLI formatter instance. 331 334 */ … … 378 381 * @param bool $network_wide Whether to check network-wide or not. 379 382 * @param string $action Action performed. 383 * @return void 380 384 */ 381 385 private function active_output( $name, $file, $network_wide, $action ) { -
wp-multi-network/tags/3.0.0/wp-multi-network/includes/classes/class-wp-ms-networks-admin-bar.php
r2584493 r3414829 18 18 19 19 /** 20 * Constructor.20 * Registers WordPress hooks for the plugin. 21 21 * 22 * Hooks in the necessary methods. 22 * Adds actions to: 23 * - Modify the admin bar menu 24 * - Add custom styles to the admin area 25 * - Add custom styles to the front-end 23 26 * 24 * @ since 2.2.027 * @return void 25 28 */ 26 public function __construct(){29 public function add_hooks(): void { 27 30 add_action( 'admin_bar_menu', array( $this, 'admin_bar' ), 20 ); 28 29 31 add_action( 'admin_print_styles', array( $this, 'admin_print_styles' ) ); 30 32 add_action( 'wp_print_styles', array( $this, 'admin_print_styles' ) ); … … 38 40 * 39 41 * @since 2.2.0 42 * @since 3.0.0 Prevent rendering of CSS if admin bar is not shown. 43 * @return void 40 44 */ 41 45 public function admin_print_styles() { 46 if ( ! is_admin_bar_showing() ) { 47 return; 48 } 42 49 ?> 43 50 <style type="text/css"> … … 56 63 * 57 64 * @param WP_Admin_Bar $wp_admin_bar Admin bar instance. 65 * @return void 58 66 */ 59 67 public function admin_bar( $wp_admin_bar ) { -
wp-multi-network/tags/3.0.0/wp-multi-network/includes/classes/class-wp-ms-networks-admin.php
r2588851 r3414829 21 21 * 22 22 * @since 2.0.0 23 * @var array 23 * @var array<string, array<int, string>> 24 24 */ 25 25 private $feedback_strings = array(); … … 33 33 */ 34 34 public function __construct() { 35 $this->set_feedback_strings();36 37 35 add_action( 'admin_menu', array( $this, 'admin_menu' ) ); 38 36 add_action( 'network_admin_menu', array( $this, 'network_admin_menu' ) ); … … 41 39 add_action( 'admin_init', array( $this, 'route_save_handlers' ) ); 42 40 41 add_action( 'admin_init', array( $this, 'set_feedback_strings' ) ); 43 42 add_action( 'network_admin_notices', array( $this, 'network_admin_notices' ) ); 44 43 … … 53 52 * @since 1.3.0 54 53 * 55 * @param array $actions Array of action links.56 * @param int $blog_id Current site ID.57 * @return array Adjusted action links.54 * @param array<string, string> $actions Array of action links. 55 * @param int $blog_id Current site ID. 56 * @return array<string, string> Adjusted action links. 58 57 */ 59 58 public function add_move_blog_link( $actions = array(), $blog_id = 0 ) { … … 85 84 * 86 85 * @since 1.3.0 86 * @return void 87 87 */ 88 88 public function admin_menu() { … … 103 103 * 104 104 * @since 1.3.0 105 * @return void 105 106 */ 106 107 public function network_admin_menu() { … … 120 121 * 121 122 * @since 1.5.2 123 * @return void 122 124 */ 123 125 public function network_admin_menu_separator() { … … 133 135 * @global string $plugin_page 134 136 * @global string $submenu_file 137 * @return void 135 138 */ 136 139 public function fix_menu_highlight_for_move_page() { … … 138 141 139 142 if ( 'networks' === $plugin_page ) { 140 $action = filter_input( INPUT_GET, 'action' ); 143 // phpcs:disable WordPress.Security.NonceVerification.Recommended 144 $action = ! empty( $_GET['action'] ) 145 ? sanitize_key( $_GET['action'] ) 146 : ''; 147 // phpcs:enable 148 141 149 if ( 'move' === $action ) { 142 150 $submenu_file = 'sites.php'; // phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited … … 151 159 * 152 160 * @param string $page Optional. Current page hook. Default empty string. 161 * @return void 153 162 */ 154 163 public function enqueue_scripts( $page = '' ) { … … 159 168 } 160 169 161 wp_register_style( 'wp-multi-network', wpmn()->plugin_url . 'assets/css/wp-multi-network.css', array(), wpmn()->asset_version, false ); 162 wp_register_script( 'wp-multi-network', wpmn()->plugin_url . 'assets/js/wp-multi-network.js', array( 'jquery', 'post' ), wpmn()->asset_version, true ); 170 // Determine if we should load source or minified assets based on WP_SCRIPT_DEBUG. 171 $suffix = ( defined( 'WP_SCRIPT_DEBUG' ) && WP_SCRIPT_DEBUG ) ? '' : '.min'; 172 $asset_version = ( defined( 'WP_SCRIPT_DEBUG' ) && WP_SCRIPT_DEBUG ) ? time() : wpmn()->asset_version; 173 174 wp_register_style( 'wp-multi-network', wpmn()->plugin_url . 'assets/css/wp-multi-network' . $suffix . '.css', array(), $asset_version ); 175 wp_register_script( 'wp-multi-network', wpmn()->plugin_url . 'assets/js/wp-multi-network' . $suffix . '.js', array( 'jquery', 'post' ), $asset_version, true ); 163 176 164 177 wp_enqueue_style( 'wp-multi-network' ); … … 170 183 * 171 184 * @since 2.1.0 172 */ 173 private function set_feedback_strings() { 185 * @return void 186 */ 187 public function set_feedback_strings() { 174 188 $this->feedback_strings = array( 175 189 'network_updated' => array( … … 195 209 * Prints feedback notices for network admin actions as necessary. 196 210 * 211 * @phpcs:disable WordPress.Security.NonceVerification.Missing 212 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 213 * 197 214 * @since 1.3.0 215 * @return void 198 216 */ 199 217 public function network_admin_notices() { 200 218 $message = ''; 201 219 $type = ''; 220 202 221 foreach ( $this->feedback_strings as $slug => $messages ) { 203 $passed = filter_input( INPUT_GET, $slug ); 204 205 if ( is_string( $passed ) ) { 206 if ( '1' === $passed ) { 207 $message = $messages['1']; 208 $type = 'updated'; 209 } else { 210 $message = $messages['0']; 211 $type = 'error'; 212 } 213 214 break; 222 223 // Skip if not known feedback. 224 if ( ! isset( $_GET[ $slug ] ) || ! is_scalar( $_GET[ $slug ] ) ) { 225 continue; 215 226 } 216 } 217 227 228 // Pass/Fail. 229 $passed = sanitize_key( $_GET[ $slug ] ); 230 231 if ( '1' === $passed ) { 232 // Pass. 233 $message = $messages['1']; 234 $type = 'updated'; 235 } else { 236 // Fail. 237 $message = $messages['0']; 238 $type = 'error'; 239 } 240 241 // Done. 242 break; 243 } 244 245 // Bail if no message or type. 218 246 if ( empty( $message ) || empty( $type ) ) { 219 247 return; … … 234 262 * Routes the current request to the correct page. 235 263 * 236 * @since 2.0.0 264 * @phpcs:disable WordPress.Security.NonceVerification.Missing 265 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 266 * 267 * @since 2.0.0 268 * @return void 237 269 */ 238 270 public function route_pages() { … … 243 275 } 244 276 245 $action = filter_input( INPUT_GET, 'action', FILTER_SANITIZE_STRING ); 246 $action = sanitize_key( $action ); 277 $action = ! empty( $_GET['action'] ) 278 ? sanitize_key( $_GET['action'] ) 279 : ''; 247 280 248 281 switch ( $action ) { … … 265 298 // View the list of networks, with bulk action handling. 266 299 case 'all_networks': 267 $doaction = filter_input( INPUT_POST, 'action', FILTER_SANITIZE_STRING ); 268 if ( empty( $doaction ) || '-1' === $doaction ) { 269 $doaction = filter_input( INPUT_POST, 'action2', FILTER_SANITIZE_STRING ); 300 $doaction = ! empty( $_POST['action'] ) 301 ? sanitize_key( $_POST['action'] ) 302 : ''; 303 304 if ( 305 empty( $doaction ) 306 || 307 ( '-1' === $doaction ) 308 ) { 309 $doaction = ! empty( $_POST['action2'] ) 310 ? sanitize_key( $_POST['action2'] ) 311 : ''; 270 312 } 271 $doaction = sanitize_key( $doaction );272 313 273 314 switch ( $doaction ) { … … 291 332 * Handles network management form submissions. 292 333 * 293 * @since 2.0.0 334 * @phpcs:disable WordPress.Security.NonceVerification.Missing 335 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 336 * 337 * @since 2.0.0 338 * @return void 294 339 */ 295 340 public function route_save_handlers() { … … 301 346 } 302 347 303 $action = filter_input( INPUT_POST, 'action', FILTER_SANITIZE_STRING ); 348 $action = ! empty( $_POST['action'] ) 349 ? sanitize_key( $_POST['action'] ) 350 : ''; 351 304 352 if ( empty( $action ) ) { 305 353 $alternative_actions = array( 'delete', 'delete_multiple', 'move' ); 354 306 355 foreach ( $alternative_actions as $alternative_action ) { 307 if ( filter_input( INPUT_POST, $alternative_action) ) {356 if ( ! empty( $_POST[ $alternative_action ] ) ) { 308 357 $action = $alternative_action; 309 358 break; … … 350 399 * Renders the new network creation dashboard page. 351 400 * 352 * @since 2.0.0 401 * @phpcs:disable WordPress.Security.NonceVerification.Missing 402 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 403 * 404 * @since 2.0.0 405 * @return void 353 406 */ 354 407 public function page_edit_network() { 355 $network_id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT ); 356 $network = $network_id ? get_network( $network_id ) : null; 408 409 $network_id = ! empty( $_GET['id'] ) && is_numeric( $_GET['id'] ) 410 ? (int) $_GET['id'] 411 : 0; 412 413 $network = ! empty( $network_id ) 414 ? get_network( $network_id ) 415 : null; 357 416 358 417 add_meta_box( 'wpmn-edit-network-details', esc_html__( 'Details', 'wp-multi-network' ), 'wpmn_edit_network_details_metabox', get_current_screen()->id, 'normal', 'high', array( $network ) ); … … 392 451 <hr class="wp-header-end"> 393 452 394 <form method="post" id="edit-network-form" action="">453 <form method="post" action="" id="edit-network-form"> 395 454 <div id="poststuff" class="poststuff"> 396 455 <div id="post-body" class="metabox-holder columns-2"> … … 398 457 <div id="titlediv"> 399 458 <div id="titlewrap"> 400 <label class="screen-reader-text" id="title-prompt-text" for="title"><?php e cho esc_html_e( 'Enter network title here', 'wp-multi-network' ); ?></label>459 <label class="screen-reader-text" id="title-prompt-text" for="title"><?php esc_html_e( 'Enter network title here', 'wp-multi-network' ); ?></label> 401 460 <input type="text" name="title" size="30" id="title" spellcheck="true" autocomplete="off" value="<?php echo esc_attr( $network_title ); ?>"> 402 461 </div> … … 423 482 * Renders the network listing dashboard page. 424 483 * 484 * @phpcs:disable WordPress.Security.NonceVerification.Missing 485 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 486 * 425 487 * @since 2.0.0 426 488 * 427 489 * @uses WP_MS_Networks_List_Table List_Table iterator for networks 490 * @return void 428 491 */ 429 492 private function page_all_networks() { … … 435 498 $search_url = $this->admin_url( array( 'action' => 'domains' ) ); 436 499 437 $search_text = filter_input( INPUT_POST, 's', FILTER_SANITIZE_STRING ); 500 $search_text = ! empty( $_POST['s'] ) 501 ? stripslashes( trim( sanitize_text_field( $_POST['s'] ) ) ) 502 : ''; 503 438 504 ?> 439 505 … … 463 529 </form> 464 530 465 <form method="post" id="form-domain-list" action="<?php echo esc_url( $all_networks_url ); ?>">531 <form method="post" action="<?php echo esc_url( $all_networks_url ); ?>" id="form-domain-list"> 466 532 <?php $wp_list_table->display(); ?> 467 533 </form> … … 474 540 * Renders the dashboard screen for moving sites -- accessed from the "Sites" screen. 475 541 * 476 * @since 2.0.0 542 * @phpcs:disable WordPress.Security.NonceVerification.Missing 543 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 544 * 545 * @since 2.0.0 546 * @return void 477 547 */ 478 548 private function page_move_site() { 479 $site_id = filter_input( INPUT_GET, 'blog_id', FILTER_SANITIZE_NUMBER_INT ); 480 $site = $site_id ? get_site( $site_id ) : null; 549 550 $site_id = ! empty( $_GET['blog_id'] ) && is_numeric( $_GET['blog_id'] ) 551 ? (int) $_GET['blog_id'] 552 : 0; 553 554 $site = ! empty( $site_id ) 555 ? get_site( $site_id ) 556 : null; 481 557 482 558 // Bail if invalid site ID. … … 507 583 ); 508 584 509 $add_network_url = $this->admin_url( array( 'page' => 'add-new-network' ) ); 585 // URLs to escape. 586 $add_network_url = $this->admin_url( 587 array( 588 'page' => 'add-new-network', 589 ) 590 ); 591 $form_action_url = $this->admin_url( 592 array( 593 'action' => 'move', 594 'blog_id' => $site_id, 595 ) 596 ); 510 597 ?> 511 598 … … 525 612 <hr class="wp-header-end"> 526 613 527 <form method="post" action="<?php echo esc_ attr( filter_input( INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_STRING )); ?>">614 <form method="post" action="<?php echo esc_url( $form_action_url ); ?>"> 528 615 <div id="poststuff"> 529 616 <div id="post-body" class="metabox-holder columns-2"> … … 547 634 * Renders the delete network page. 548 635 * 549 * @since 2.0.0 636 * @phpcs:disable WordPress.Security.NonceVerification.Missing 637 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 638 * 639 * @since 2.0.0 640 * @return void 550 641 */ 551 642 private function page_delete_network() { 552 $network_id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT ); 553 $network = $network_id ? get_network( $network_id ) : null; 643 644 $network_id = ! empty( $_GET['id'] ) && is_numeric( $_GET['id'] ) 645 ? (int) $_GET['id'] 646 : 0; 647 648 $network = ! empty( $network_id ) 649 ? get_network( $network_id ) 650 : null; 554 651 555 652 // Bail if invalid network ID. … … 578 675 <hr class="wp-header-end"> 579 676 580 <form method="post" action="<?php echo esc_ attr( remove_query_arg( 'action' ) ); ?>">677 <form method="post" action="<?php echo esc_url( remove_query_arg( 'action' ) ); ?>"> 581 678 <?php 582 679 … … 638 735 * Renders the delete multiple networks page. 639 736 * 640 * @since 2.0.0 737 * @phpcs:disable WordPress.Security.NonceVerification.Missing 738 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 739 * 740 * @since 2.0.0 741 * @return void 641 742 */ 642 743 private function page_delete_networks() { 643 $network_id = get_main_network_id(); 644 $all_networks = filter_input( INPUT_POST, 'all_networks', FILTER_SANITIZE_NUMBER_INT, FILTER_FORCE_ARRAY ); 645 $all_networks = array_map( 'absint', $all_networks ); 744 745 $network_id = get_main_network_id(); 746 747 $all_networks = ! empty( $_POST['all_networks'] ) && is_array( $_POST['all_networks'] ) 748 ? wp_parse_id_list( (array) $_POST['all_networks'] ) 749 : array(); 750 646 751 $all_networks = array_diff( $all_networks, array( $network_id ) ); 647 752 … … 758 863 * 759 864 * @global wpdb $wpdb WordPress database abstraction object. 865 * @return void 760 866 */ 761 867 public function page_my_networks() { … … 794 900 $num_rows = ceil( $num / $cols ); 795 901 $split = 0; 902 $rows = array(); 796 903 for ( $i = 1; $i <= $num_rows; $i++ ) { 797 904 $rows[] = array_slice( $my_networks, $split, $cols ); … … 827 934 * @param WP_Network $network Current network object. 828 935 */ 829 echo apply_filters( 'mynetworks_network_actions', $network_actions, $network ); // phpcs:ignore WordPress. XSS.EscapeOutput.OutputNotEscaped936 echo apply_filters( 'mynetworks_network_actions', $network_actions, $network ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 830 937 ?> 831 938 </p> … … 834 941 <?php 835 942 restore_current_network(); 836 $i++;943 ++$i; 837 944 } 838 945 echo '</tr>'; … … 848 955 * Handles the request to add a new network. 849 956 * 850 * @since 2.0.0 957 * @phpcs:disable WordPress.Security.NonceVerification.Missing 958 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 959 * 960 * @since 2.0.0 961 * @return void 851 962 */ 852 963 private function handle_add_network() { 853 964 854 965 // Sanitize options to clone. 855 $options_to_clone = filter_input( INPUT_POST, 'options_to_clone', FILTER_DEFAULT, FILTER_FORCE_ARRAY ); 966 $options_to_clone = ! empty( $_POST['options_to_clone'] ) && is_array( $_POST['options_to_clone'] ) 967 ? $_POST['options_to_clone'] 968 : array(); 969 856 970 $options_to_clone = ! empty( $options_to_clone ) 857 971 ? array_keys( $options_to_clone ) … … 859 973 860 974 // Sanitize network ID to clone. 861 $clone = filter_input( INPUT_POST, 'clone_network', FILTER_SANITIZE_NUMBER_INT ); 975 $clone = ! empty( $_GET['clone_network'] ) 976 ? (int) $_GET['clone_network'] 977 : 0; 978 862 979 if ( empty( $clone ) ) { 863 980 $clone = get_current_site()->id; 864 981 } 865 982 866 // Sanitize values. 867 $network_title = wp_unslash( filter_input( INPUT_POST, 'title', FILTER_SANITIZE_STRING ) ); 868 $network_domain = wp_unslash( filter_input( INPUT_POST, 'domain', FILTER_SANITIZE_STRING ) ); 869 $network_path = wp_unslash( filter_input( INPUT_POST, 'path', FILTER_SANITIZE_STRING ) ); 870 $site_name = wp_unslash( filter_input( INPUT_POST, 'new_site', FILTER_SANITIZE_STRING ) ); 871 872 // Additional formatting. 873 $network_title = wp_strip_all_tags( $network_title ); 983 // Unslash posted values. 984 $network_title = ! empty( $_POST['title'] ) 985 ? wp_unslash( $_POST['title'] ) 986 : ''; 987 $network_domain = ! empty( $_POST['domain'] ) 988 ? wp_unslash( $_POST['domain'] ) 989 : ''; 990 $network_path = ! empty( $_POST['path'] ) 991 ? wp_unslash( $_POST['path'] ) 992 : ''; 993 $site_name = ! empty( $_POST['new_site'] ) 994 ? wp_unslash( $_POST['new_site'] ) 995 : ''; 996 997 // Additional sanitization. 998 $network_title = sanitize_text_field( $network_title ); 874 999 $network_domain = str_replace( ' ', '', strtolower( sanitize_text_field( $network_domain ) ) ); 875 1000 $network_path = str_replace( ' ', '', strtolower( sanitize_text_field( $network_path ) ) ); … … 877 1002 // Fallback to network title if not explicitly set. 878 1003 $site_name = ! empty( $site_name ) 879 ? wp_strip_all_tags( $site_name )1004 ? sanitize_text_field( $site_name ) 880 1005 : $network_title; 881 1006 … … 940 1065 * Handles the request to update a network. 941 1066 * 942 * @since 2.0.0 1067 * @phpcs:disable WordPress.Security.NonceVerification.Missing 1068 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 1069 * 1070 * @since 2.0.0 1071 * @return void 943 1072 */ 944 1073 private function handle_update_network() { 945 1074 946 1075 // Sanitize network ID. 947 $network_id = filter_input( INPUT_POST, 'network_id', FILTER_SANITIZE_NUMBER_INT ); 1076 $network_id = ! empty( $_GET['id'] ) && is_numeric( $_GET['id'] ) 1077 ? (int) $_GET['id'] 1078 : 0; 948 1079 949 1080 // Bail if invalid network. … … 952 1083 } 953 1084 954 // Sanitize values. 955 $network_title = wp_unslash( filter_input( INPUT_POST, 'title', FILTER_SANITIZE_STRING ) ); 956 $network_domain = wp_unslash( filter_input( INPUT_POST, 'domain', FILTER_SANITIZE_STRING ) ); 957 $network_path = wp_unslash( filter_input( INPUT_POST, 'path', FILTER_SANITIZE_STRING ) ); 958 959 // Additional formatting. 1085 // Unslash posted values. 1086 $network_title = ! empty( $_POST['title'] ) 1087 ? wp_unslash( $_POST['title'] ) 1088 : ''; 1089 $network_domain = ! empty( $_POST['domain'] ) 1090 ? wp_unslash( $_POST['domain'] ) 1091 : ''; 1092 $network_path = ! empty( $_POST['path'] ) 1093 ? wp_unslash( $_POST['path'] ) 1094 : ''; 1095 1096 // Additional sanitization. 960 1097 $network_title = sanitize_text_field( $network_title ); 961 $network_domain = Requests_IDNAEncoder::encode( str_replace( ' ', '', strtolower( sanitize_text_field( $network_domain )) ) );1098 $network_domain = str_replace( ' ', '', strtolower( sanitize_text_field( $network_domain ) ) ); 962 1099 $network_path = str_replace( ' ', '', strtolower( sanitize_text_field( $network_path ) ) ); 963 1100 … … 1002 1139 * Handles the request to move a site to another network. 1003 1140 * 1004 * @since 2.0.0 1141 * @phpcs:disable WordPress.Security.NonceVerification.Missing 1142 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 1143 * 1144 * @since 2.0.0 1145 * @return void 1005 1146 */ 1006 1147 private function handle_move_site() { 1007 1148 1008 1149 // Sanitize values. 1009 $site_id = filter_input( INPUT_GET, 'blog_id', FILTER_SANITIZE_NUMBER_INT ); 1010 $new_network = filter_input( INPUT_POST, 'to', FILTER_SANITIZE_NUMBER_INT ); 1150 $site_id = ! empty( $_GET['blog_id'] ) && is_numeric( $_GET['blog_id'] ) 1151 ? (int) $_GET['blog_id'] 1152 : 0; 1153 1154 $new_network = ! empty( $_POST['to'] ) && is_numeric( $_POST['to'] ) 1155 ? (int) $_POST['to'] 1156 : 0; 1011 1157 1012 1158 // Bail if no site ID. … … 1062 1208 * Handles the request to reassign sites to another network. 1063 1209 * 1064 * @since 2.0.0 1210 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 1211 * 1212 * @since 2.0.0 1213 * @return void 1065 1214 */ 1066 1215 private function handle_reassign_sites() { 1067 1216 1068 1217 // Sanitize values. 1069 $to = array_map( 'absint', (array) filter_input( INPUT_POST, 'to', FILTER_SANITIZE_NUMBER_INT, FILTER_FORCE_ARRAY ) ); 1070 $from = array_map( 'absint', (array) filter_input( INPUT_POST, 'from', FILTER_SANITIZE_NUMBER_INT, FILTER_FORCE_ARRAY ) ); 1218 $to = ! empty( $_POST['to'] ) && is_array( $_POST['to'] ) 1219 ? wp_parse_id_list( (array) $_POST['to'] ) 1220 : array(); 1221 1222 $from = ! empty( $_POST['from'] ) && is_array( $_POST['from'] ) 1223 ? wp_parse_id_list( (array) $_POST['from'] ) 1224 : array(); 1071 1225 1072 1226 // Bail early if no movement. … … 1076 1230 1077 1231 // Sanitize network ID. 1078 $network_id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT ); 1232 $network_id = ! empty( $_GET['id'] ) && is_numeric( $_GET['id'] ) 1233 ? (int) $_GET['id'] 1234 : 0; 1079 1235 1080 1236 // Default to/from arrays. … … 1126 1282 * Handles the request to delete a network. 1127 1283 * 1128 * @since 2.0.0 1284 * @phpcs:disable WordPress.Security.NonceVerification.Missing 1285 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 1286 * 1287 * @since 2.0.0 1288 * @return void 1129 1289 */ 1130 1290 private function handle_delete_network() { 1131 1291 1132 1292 // Sanitize values. 1133 $network_id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT ); 1134 $override = (bool) filter_input( INPUT_POST, 'override' ); 1293 $network_id = ! empty( $_GET['id'] ) && is_numeric( $_GET['id'] ) 1294 ? (int) $_GET['id'] 1295 : 0; 1296 1297 $override = ! empty( $_POST['override'] ); 1135 1298 1136 1299 // Attempt to delete network. … … 1153 1316 * Handles the request to delete multiple networks. 1154 1317 * 1155 * @since 2.0.0 1318 * @phpcs:disable WordPress.Security.NonceVerification.Missing 1319 * 1320 * @since 2.0.0 1321 * @return void 1156 1322 */ 1157 1323 private function handle_delete_networks() { 1158 1324 1159 1325 // Sanitize values. 1160 $deleted_networks = array_map( 'absint', filter_input( INPUT_POST, 'deleted_networks', FILTER_SANITIZE_NUMBER_INT, FILTER_FORCE_ARRAY ) ); 1161 $override = (bool) filter_input( INPUT_POST, 'override' ); 1326 $deleted_networks = ! empty( $_POST['deleted_networks'] ) && is_array( $_POST['deleted_networks'] ) 1327 ? wp_parse_id_list( (array) $_POST['deleted_networks'] ) 1328 : array(); 1329 1330 $override = (bool) ! empty( $_POST['override'] ); 1162 1331 1163 1332 // Loop through deleted networks. … … 1188 1357 * @since 2.0.0 1189 1358 * 1190 * @param array $args Optional. URL query arguments. Default empty array. 1359 * @param array<string, int|string> $args Optional. URL query arguments. Default empty array. 1360 * @return void 1191 1361 */ 1192 1362 private function handle_redirect( $args = array() ) { … … 1200 1370 * @since 1.3.0 1201 1371 * 1202 * @param array $args Optional. URL query arguments. Default empty array.1372 * @param array<string, int|string> $args Optional. URL query arguments. Default empty array. 1203 1373 * @return string Absolute URL to the networks page. 1204 1374 */ … … 1237 1407 * 1238 1408 * @since 2.1.0 1409 * @return void 1239 1410 */ 1240 1411 private function check_nonce() { -
wp-multi-network/tags/3.0.0/wp-multi-network/includes/classes/class-wp-ms-networks-capabilities.php
r2584493 r3414829 21 21 * 22 22 * @since 2.3.0 23 * @return void 23 24 */ 24 25 public function add_hooks() { … … 31 32 * @since 2.3.0 32 33 * 33 * @param array $capsArray of required capabilities.34 * @param string $capCapability to map.35 * @param int $user_id User ID.36 * @param array $argsAdditional context for the capability check.37 * @return arrayFiltered required capabilities.34 * @param string[] $caps Array of required capabilities. 35 * @param string $cap Capability to map. 36 * @param int $user_id User ID. 37 * @param mixed[] $args Additional context for the capability check. 38 * @return string[] Filtered required capabilities. 38 39 */ 39 public function map_meta_cap( $caps, $cap, $user_id, $args ) { 40 public function map_meta_cap( $caps, $cap, $user_id, $args ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed 40 41 41 42 // Map our meta capabilities to primitive capabilities first. … … 68 69 * @since 2.3.0 69 70 * 70 * @return arrayList of primitive global capabilities.71 * @return string[] List of primitive global capabilities. 71 72 */ 72 73 private function get_global_capabilities() { -
wp-multi-network/tags/3.0.0/wp-multi-network/includes/classes/class-wp-ms-networks-list-table.php
r2588851 r3414829 47 47 * Prepares the list table items. 48 48 * 49 * @since 1.3.0 49 * @phpcs:disable WordPress.Security.NonceVerification.Missing 50 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 51 * 52 * @since 1.3.0 53 * @return void 50 54 */ 51 55 public function prepare_items() { … … 53 57 $pagenum = $this->get_pagenum(); 54 58 55 $order_by = filter_input( INPUT_GET, 'orderby', FILTER_SANITIZE_STRING ); 56 $order_by = ! empty( $order_by ) ? sanitize_key( $order_by ) : ''; 57 $order = filter_input( INPUT_GET, 'order', FILTER_SANITIZE_STRING ); 58 $order = ! empty( $order ) ? strtoupper( $order ) : 'ASC'; 59 $search = filter_input( INPUT_GET, 's', FILTER_SANITIZE_STRING ); 60 if ( ! $search ) { 61 $search = filter_input( INPUT_POST, 's', FILTER_SANITIZE_STRING ); 62 } 63 64 $search = stripslashes( trim( $search ) ); 59 $order_by = ! empty( $_GET['orderby'] ) 60 ? sanitize_key( $_GET['orderby'] ) 61 : ''; 62 63 $order = ! empty( $_GET['order'] ) 64 ? strtoupper( sanitize_key( $_GET['order'] ) ) 65 : 'ASC'; 66 67 $search = ! empty( $_REQUEST['s'] ) 68 ? stripslashes( sanitize_text_field( $_REQUEST['s'] ) ) 69 : ''; 70 65 71 if ( false !== strpos( $search, '*' ) ) { 66 72 $search = trim( $search, '*' ); … … 97 103 * 98 104 * @since 1.3.0 105 * @return void 99 106 */ 100 107 public function no_items() { … … 107 114 * @since 1.3.0 108 115 * 109 * @return array Bulk actions as $slug => $label pairs.116 * @return array<string, string> Bulk actions as $slug => $label pairs. 110 117 */ 111 118 public function get_bulk_actions() { … … 124 131 * @since 1.3.0 125 132 * 126 * @param type$which Where to display the pagination. Either 'top' or 'bottom'.133 * @param string $which Where to display the pagination. Either 'top' or 'bottom'. 127 134 */ 128 135 public function pagination( $which ) { // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod.Found … … 146 153 * @since 1.3.0 147 154 * 148 * @return array Columns as $slug => $label pairs.155 * @return array<string, string> Columns as $slug => $label pairs. 149 156 */ 150 157 public function get_columns() { … … 173 180 * @since 1.3.0 174 181 * 175 * @return array Columns as $slug => $orderby_field pairs.182 * @return array<string, string> Columns as $slug => $orderby_field pairs. 176 183 */ 177 184 public function get_sortable_columns() { … … 189 196 * 190 197 * @param object $network The current network item. 198 * @return void 191 199 */ 192 200 public function single_row( $network ) { … … 271 279 * 272 280 * @param WP_Network $network The current network object. 281 * @return void 273 282 */ 274 283 public function column_cb( $network ) { … … 280 289 281 290 ?> 282 <label class="screen-reader-text" for="network_<?php echo esc_attr( $network->id); ?>">291 <label class="screen-reader-text" for="network_<?php echo esc_attr( strval( $network->id ) ); ?>"> 283 292 <?php 284 293 printf( … … 289 298 ?> 290 299 </label> 291 <input type="checkbox" id="network_<?php echo esc_attr( $network->id ); ?>" name="all_networks[]" value="<?php echo esc_attr( $network->id); ?>">300 <input type="checkbox" id="network_<?php echo esc_attr( strval( $network->id ) ); ?>" name="all_networks[]" value="<?php echo esc_attr( strval( $network->id ) ); ?>"> 292 301 <?php 293 302 } … … 299 308 * 300 309 * @param WP_Network $network The current network object. 310 * @return void 301 311 */ 302 312 public function column_title( $network ) { … … 327 337 <strong> 328 338 <?php 329 echo $link; // phpcs:ignore WordPress. XSS.EscapeOutput.OutputNotEscaped330 echo $network_states; // phpcs:ignore WordPress. XSS.EscapeOutput.OutputNotEscaped339 echo $link; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 340 echo $network_states; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 331 341 ?> 332 342 </strong> … … 341 351 * 342 352 * @param WP_Network $network The current network object. 353 * @return void 343 354 */ 344 355 public function column_domain( $network ) { … … 352 363 * 353 364 * @param WP_Network $network The current network object. 365 * @return void 354 366 */ 355 367 public function column_path( $network ) { … … 363 375 * 364 376 * @param WP_Network $network The current network object. 377 * @return void 365 378 */ 366 379 public function column_blogs( $network ) { … … 380 393 * 381 394 * @param WP_Network $network The current network object. 395 * @return void 382 396 */ 383 397 public function column_admins( $network ) { … … 395 409 * 396 410 * @param WP_Network $network The current network object. 411 * @return void 397 412 */ 398 413 public function column_id( $network ) { 399 echo esc_html( $network->id);414 echo esc_html( strval( $network->id ) ); 400 415 } 401 416 … … 415 430 // Bail if not primary column. 416 431 if ( $primary !== $column_name ) { 417 return ;432 return ''; 418 433 } 419 434 … … 444 459 // Edit the network. 445 460 if ( current_user_can( 'edit_network', $network->id ) ) { 446 $edit_network_url = add_query_arg( 447 array( 448 'action' => 'edit_network', 449 ), 450 $base_url 451 ); 461 $edit_network_url = add_query_arg( array( 'action' => 'edit_network' ), $base_url ); 452 462 453 463 $actions['edit'] = '<span class="edit"><a href="' . esc_url( $edit_network_url ) . '">' . esc_html__( 'Edit', 'wp-multi-network' ) . '</a></span>'; … … 465 475 if ( $this->can_delete( $network ) ) { 466 476 $delete_network_url = wp_nonce_url( 467 add_query_arg( 468 array( 469 'action' => 'delete_network', 470 ), $base_url 471 ) 477 add_query_arg( array( 'action' => 'delete_network' ), $base_url ) 472 478 ); 473 479 … … 480 486 * @since 2.0.0 481 487 * 482 * @param array Action links as $slug => $link_markup pairs.483 * @param int The current network ID.484 * @param string The current network name.488 * @param array $filtered_acions Action links as $slug => $link_markup pairs. 489 * @param int $network_id The current network ID. 490 * @param string $network_sitename The current network name. 485 491 */ 486 $actions = apply_filters( 'manage_networks_action_links', array_filter( $actions ), $network->id, $network->sitename );492 $actions = apply_filters( 'manage_networks_action_links', $actions, $network->id, $network->site_name ); 487 493 488 494 // Return all row actions. -
wp-multi-network/tags/3.0.0/wp-multi-network/includes/classes/class-wp-ms-rest-networks-controller.php
r2584493 r3414829 31 31 * 32 32 * @since 2.4.0 33 * @return void 33 34 */ 34 35 public function register_routes() { … … 100 101 * @since 2.4.0 101 102 * 102 * @param WP_REST_Request $request Full details about the request. 103 * @template T of WP_REST_Request 104 * @param T $request Full details about the request. 103 105 * 104 106 * @return WP_Error|bool True if the request has read access, error object otherwise. … … 113 115 * @since 2.4.0 114 116 * 115 * @param WP_REST_Request $request Full details about the request. 117 * @template T of WP_REST_Request 118 * @param T $request Full details about the request. 116 119 * 117 120 * @return WP_Error|WP_REST_Response Response object on success, or error object on failure. … … 194 197 } 195 198 196 $total_networks = (int)$query->found_networks;197 $max_pages = (int)$query->max_num_pages;199 $total_networks = $query->found_networks; 200 $max_pages = $query->max_num_pages; 198 201 199 202 if ( $total_networks < 1 ) { … … 204 207 $prepared_args['count'] = true; 205 208 206 $total_networks = $query->query( $prepared_args );207 $max_pages = ceil( $total_networks / $request['per_page'] );209 $total_networks = (int) $query->query( $prepared_args ); 210 $max_pages = (int) ceil( $total_networks / $request['per_page'] ); 208 211 } 209 212 210 213 $response = rest_ensure_response( $networks ); 211 $response->header( 'X-WP-Total', $total_networks);212 $response->header( 'X-WP-TotalPages', $max_pages);214 $response->header( 'X-WP-Total', strval( $total_networks ) ); 215 $response->header( 'X-WP-TotalPages', strval( $max_pages ) ); 213 216 214 217 $base = add_query_arg( $request->get_query_params(), rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ) ); … … 268 271 * @since 2.4.0 269 272 * 270 * @param WP_REST_Request $request Full details about the request. 273 * @template T of WP_REST_Request 274 * @param T $request Full details about the request. 271 275 * 272 276 * @return WP_Error|bool True if the request has read access for the item, error object otherwise. … … 286 290 * @since 2.4.0 287 291 * 288 * @param WP_REST_Request $request Full details about the request. 292 * @template T of WP_REST_Request 293 * @param T $request Full details about the request. 289 294 * 290 295 * @return WP_Error|WP_REST_Response Response object on success, or error object on failure. … … 307 312 * @since 2.4.0 308 313 * 309 * @param WP_REST_Request $request Full details about the request. 314 * @template T of WP_REST_Request 315 * @param T $request Full details about the request. 310 316 * 311 317 * @return WP_Error|bool True if the request has access to create items, error object otherwise. … … 320 326 * @since 2.4.0 321 327 * 322 * @param WP_REST_Request $request Full details about the request. 328 * @template T of WP_REST_Request 329 * @param T $request Full details about the request. 323 330 * 324 331 * @return WP_Error|WP_REST_Response Response object on success, or error object on failure. … … 405 412 * @since 2.4.0 406 413 * 407 * @param WP_REST_Request $request Full details about the request. 414 * @template T of WP_REST_Request 415 * @param T $request Full details about the request. 408 416 * 409 417 * @return WP_Error|bool True if the request has access to update the item, error object otherwise. … … 431 439 * @since 2.4.0 432 440 * 433 * @param WP_REST_Request $request Full details about the request. 441 * @template T of WP_REST_Request 442 * @param T $request Full details about the request. 434 443 * 435 444 * @return WP_Error|WP_REST_Response Response object on success, or error object on failure. … … 450 459 451 460 if ( ! empty( $prepared_args ) ) { 452 if ( is_wp_error( $prepared_args ) ) {453 return $prepared_args;454 }455 456 461 $domain = $prepared_args['domain']; 457 462 $path = $prepared_args['path']; … … 493 498 * @since 2.4.0 494 499 * 495 * @param WP_REST_Request $request Full details about the request. 500 * @template T of WP_REST_Request 501 * @param T $request Full details about the request. 496 502 * 497 503 * @return WP_Error|bool True if the request has access to delete the item, error object otherwise. … … 511 517 * @since 2.4.0 512 518 * 513 * @param WP_REST_Request $request Full details about the request. 519 * @template T of WP_REST_Request 520 * @param T $request Full details about the request. 514 521 * 515 522 * @return WP_Error|WP_REST_Response Response object on success, or error object on failure. … … 564 571 * @since 2.4.0 565 572 * 566 * @param WP_Network $network Network object. 567 * @param WP_REST_Request $request Request object. 573 * @template T of WP_REST_Request 574 * @param WP_Network $network Network object. 575 * @param T $request Request object. 568 576 * 569 577 * @return WP_REST_Response Response object. … … 609 617 * @param WP_Network $network Network object. 610 618 * 611 * @return array Links for the given network.619 * @return array<string, array<string, string>> Links for the given network. 612 620 */ 613 621 protected function prepare_links( $network ) { … … 651 659 * @since 2.4.0 652 660 * 653 * @param WP_REST_Request $request Request object. 654 * 655 * @return array|WP_Error Prepared network, otherwise WP_Error object. 661 * @template T of WP_REST_Request 662 * @param T $request Request object. 663 * 664 * @return array<string, string>|WP_Error Prepared network, otherwise WP_Error object. 656 665 */ 657 666 protected function prepare_item_for_database( $request ) { … … 688 697 * @since 2.4.0 689 698 * 690 * @return array 699 * @return array<string, mixed> 691 700 */ 692 701 public function get_item_schema() { … … 736 745 * @since 2.4.0 737 746 * 738 * @return array Networks collection parameters.747 * @return array<string, mixed> Networks collection parameters. 739 748 */ 740 749 public function get_collection_params() { … … 842 851 * @since 2.4.0 843 852 * 844 * @param WP_Network $network Network object. 845 * @param WP_REST_Request $request Request data to check. 853 * @template T of WP_REST_Request 854 * @param WP_Network $network Network object. 855 * @param T $request Request data to check. 846 856 * 847 857 * @return bool Whether the network can be read. -
wp-multi-network/tags/3.0.0/wp-multi-network/includes/compat.php
r2584493 r3414829 57 57 * @param string $path Site path. 58 58 * @param string $site_id Optional. Site ID, if an existing site. Default 0. 59 * 59 60 * @return bool True if the site URL is valid, false otherwise. 60 61 */ 61 function wp_validate_site_url( $domain, $path, $site_id = 0) {62 function wp_validate_site_url( $domain, $path, $site_id = '0' ) { 62 63 global $wpdb; 63 64 … … 67 68 return true; 68 69 } 69 if ( true === $exists ) { 70 71 if ( true === (bool) $exists ) { 70 72 return false; 71 73 } … … 87 89 $pieces = array_filter( array_merge( $domains, $paths ) ); 88 90 foreach ( $pieces as $slug ) { 89 90 // Bail if empty.91 if ( empty( $slug ) ) {92 return false;93 }94 95 91 // Bail if not lowercase or numbers. 96 92 if ( preg_match( '/[^a-z0-9]+/', $slug ) ) { -
wp-multi-network/tags/3.0.0/wp-multi-network/includes/deprecated.php
r2584493 r3414829 37 37 * @param string $value Upload path option value. 38 38 * @param int $blog_id Site ID. 39 * @return string 39 40 */ 40 41 function wpmn_fix_subsite_upload_path( $value, $blog_id ) { … … 55 56 add_filter( 'blog_option_upload_path', 'wpmn_fix_subsite_upload_path', 10, 2 ); 56 57 } 57 58 if ( ! function_exists( 'get_network_option' ) ) :59 /**60 * Gets an option from a given network.61 *62 * Switches to the specified network internally to operate on it.63 *64 * @since 1.0.065 * @deprecated66 *67 * @param int $network_id ID of network.68 * @param string $key Option key.69 * @param mixed $default Default value if option doesn't exist.70 * @return mixed Value set for the option if it exists, `$default` if it doesn't.71 * `WP_Error` instance if invalid network ID is passed.72 */73 function get_network_option( $network_id, $key, $default = false ) {74 if ( ! switch_to_network( $network_id, true ) ) {75 return new WP_Error(76 'wpmn.network_missing', __( 'Network does not exist', 'wp-multi-network' ), array(77 'status' => 400,78 )79 );80 }81 82 $result = get_site_option( $key, $default );83 84 restore_current_network();85 86 return $result;87 }88 endif;89 90 if ( ! function_exists( 'add_network_option' ) ) :91 /**92 * Adds an option from a given network.93 *94 * Switches to the specified network internally to operate on it.95 *96 * @since 1.0.097 * @deprecated98 *99 * @param int $network_id ID of network.100 * @param string $key Option key.101 * @param mixed $value Option value, can be anything.102 * @return bool|WP_Error True if the option is added, false if not added.103 * `WP_Error` instance if invalid network ID is passed.104 */105 function add_network_option( $network_id, $key, $value ) {106 if ( ! switch_to_network( $network_id, true ) ) {107 return new WP_Error(108 'wpmn.network_missing', __( 'Network does not exist', 'wp-multi-network' ), array(109 'status' => 400,110 )111 );112 }113 114 $result = add_site_option( $key, $value );115 116 restore_current_network();117 118 return $result;119 }120 endif;121 122 if ( ! function_exists( 'update_network_option' ) ) :123 /**124 * Updates an option from a given network.125 *126 * Switches to the specified network internally to operate on it.127 *128 * @since 1.0.0129 * @deprecated130 *131 * @param int $network_id ID of network.132 * @param string $key Option key.133 * @param mixed $value Option value, can be anything.134 * @return bool|WP_Error True if the option is updated, false if not updated.135 * `WP_Error` instance if invalid network ID is passed.136 */137 function update_network_option( $network_id, $key, $value ) {138 if ( ! switch_to_network( $network_id, true ) ) {139 return new WP_Error(140 'wpmn.network_missing', __( 'Network does not exist', 'wp-multi-network' ), array(141 'status' => 400,142 )143 );144 }145 146 $result = update_site_option( $key, $value );147 148 restore_current_network();149 150 return $result;151 }152 endif;153 154 if ( ! function_exists( 'delete_network_option' ) ) :155 /**156 * Deletes an option from a given network.157 *158 * Switches to the specified network internally to operate on it.159 *160 * @since 1.0.0161 * @deprecated162 *163 * @param int $network_id ID of network.164 * @param string $key Option key.165 * @return bool|WP_Error True if the option is deleted, false if not deleted.166 * `WP_Error` instance if invalid network ID is passed.167 */168 function delete_network_option( $network_id, $key ) {169 if ( ! switch_to_network( $network_id, true ) ) {170 return new WP_Error(171 'wpmn.network_missing', __( 'Network does not exist', 'wp-multi-network' ), array(172 'status' => 400,173 )174 );175 }176 177 $result = delete_site_option( $key );178 179 restore_current_network();180 181 return $result;182 }183 endif;184 185 if ( ! function_exists( 'get_networks' ) ) :186 /**187 * Gets all networks.188 *189 * @since 1.0.0190 * @deprecated191 *192 * @param array $args Optional. Network query arguments. Default empty array.193 * @return array Networks available on the installation.194 */195 function get_networks( $args = array() ) {196 197 // Support for WordPress 4.6.0, if you're doing something really weird.198 if ( class_exists( 'WP_Network_Query' ) ) {199 $query = new WP_Network_Query();200 201 return $query->query( $args );202 }203 204 // The original get_networks() function.205 return $GLOBALS['wpdb']->get_results( "SELECT * FROM {$GLOBALS['wpdb']->site}" );206 }207 endif; -
wp-multi-network/tags/3.0.0/wp-multi-network/includes/functions.php
r2788090 r3414829 55 55 * 56 56 * @param int $user_id Optional. User ID. Default is the current user. 57 * @return array|bool Array of network IDs, or false if none.57 * @return int[]|bool Array of network IDs, or false if none. 58 58 */ 59 59 function user_has_networks( $user_id = 0 ) { … … 75 75 * @since 2.0.0 76 76 * 77 * @param array|bool|null List of network IDs or false. Anything but null will short-circuit78 * the process.79 * @param int User ID for which the networks should be returned.77 * @param array|bool|null $my_networks List of network IDs or false. Anything but null will short-circuit 78 * the process. 79 * @param int $user_id User ID for which the networks should be returned. 80 80 */ 81 81 $my_networks = apply_filters( 'networks_pre_user_is_network_admin', null, $user_id ); … … 90 90 * @since 2.0.0 91 91 * 92 * @param array|bool List of network IDs or false if no networks for the user.93 * @param int User ID for which the networks should be returned.92 * @param array|bool $my_networks List of network IDs or false if no networks for the user. 93 * @param int $user_id User ID for which the networks should be returned. 94 94 */ 95 95 return apply_filters( 'networks_user_is_network_admin', $my_networks, $user_id ); … … 121 121 * 122 122 * @param int|WP_Network $network Optional. Network ID or object. Default is the current network. 123 * @return int Main site ID for the network.123 * @return int|bool Main site ID for the network or false if network not found. 124 124 */ 125 125 function get_main_site_for_network( $network = null ) { … … 219 219 global $wpdb, $switched_network, $switched_network_stack, $current_site; 220 220 221 if ( empty( $new_network ) ) { 221 // Maybe fallback to current network. 222 if ( empty( $new_network ) || ! is_numeric( $new_network ) ) { 222 223 $new_network = $current_site->id; 223 224 } … … 250 251 } 251 252 252 $prev_site_id = $current_site->id; 253 $current_site = get_network( $new_network ); // phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited 253 $prev_site_id = $current_site->id; 254 $new_network_obj = get_network( $new_network ); 255 $current_site = $new_network_obj; // phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited 254 256 255 257 // Populate extra properties if not set already. … … 413 415 * @global wpdb $wpdb WordPress database abstraction object. 414 416 * 415 * @param array $args {417 * @param array<string, mixed> $args { 416 418 * Array of network arguments. 417 419 * … … 577 579 } 578 580 581 /** 582 * Fires after a new network blog has been added. 583 * 584 * @param int $new_blog_id ID of the added network blog. 585 * @param int $new_network_id ID of the added network. 586 * @param array $r Full associative array of network arguments. 587 * 588 * @since 2.5.3 589 */ 590 do_action( 'added_network_blog', $new_blog_id, $new_network_id, $r ); 591 592 // add new blog id as network meta data against the new network. 579 593 $r['network_meta']['main_site'] = $new_blog_id; 580 594 … … 601 615 $current_siteurl = get_option( 'siteurl' ); 602 616 $new_siteurl = untrailingslashit( get_blogaddress_by_id( $new_blog_id ) ); 603 $upload_url = str_replace( $current_siteurl, $new_siteurl, WP_CONTENT_URL);617 $upload_url = str_replace( $current_siteurl, $new_siteurl, content_url() ); 604 618 $upload_url = $upload_url . '/uploads'; 605 606 $ upload_dir = WP_CONTENT_DIR;607 if ( 0 === strpos( $upload_dir, ABSPATH) ) {608 $upload_dir = substr( $upload_dir, strlen( ABSPATH) );619 $upload_dir = WP_CONTENT_DIR; 620 $needle = strval( ABSPATH ); 621 if ( 0 === strpos( $upload_dir, $needle ) ) { 622 $upload_dir = substr( $upload_dir, strlen( $needle ) ); 609 623 } 610 624 $upload_dir .= '/uploads'; 611 625 612 if ( defined( 'MULTISITE' ) ) { 613 $ms_dir = '/sites/' . $new_blog_id; 614 } else { 615 $ms_dir = '/' . $new_blog_id; 626 // Check if wpmu_create_blog() already set the site-specific path. 627 $existing_upload_path = get_blog_option( $new_blog_id, 'upload_path' ); 628 $site_path_suffix = defined( 'MULTISITE' ) ? '/sites/' . $new_blog_id : '/' . $new_blog_id; 629 630 // Only add the site-specific path if it's not already present. 631 if ( empty( $existing_upload_path ) || false === strpos( $existing_upload_path, $site_path_suffix ) ) { 632 $upload_dir .= $site_path_suffix; 633 $upload_url .= $site_path_suffix; 634 update_blog_option( $new_blog_id, 'upload_path', $upload_dir ); 635 update_blog_option( $new_blog_id, 'upload_url_path', $upload_url ); 616 636 } 617 618 $upload_dir .= $ms_dir;619 $upload_url .= $ms_dir;620 621 update_blog_option( $new_blog_id, 'upload_path', $upload_dir );622 update_blog_option( $new_blog_id, 'upload_url_path', $upload_url );623 637 } 624 638 … … 664 678 clean_network_cache( $new_network_id ); 665 679 680 // Self-activate on new network. 681 $existing_plugins = get_network_option( $new_network_id, 'active_sitewide_plugins', array() ); 682 if ( ! isset( $existing_plugins['wp-multi-network/wpmn-loader.php'] ) ) { 683 $existing_plugins['wp-multi-network/wpmn-loader.php'] = time(); 684 update_network_option( $new_network_id, 'active_sitewide_plugins', $existing_plugins ); 685 } 686 666 687 /** 667 688 * Fires after a new network has been added. … … 706 727 707 728 // Bail if site URL is invalid. 708 if ( ! wp_validate_site_url( $domain, $path, $site_id) ) {729 if ( ! wp_validate_site_url( $domain, $path, strval( $site_id ) ) ) { 709 730 /* translators: %s: site domain and path */ 710 731 return new WP_Error( 'blog_bad', sprintf( __( 'The site "%s" is invalid, not available, or already exists.', 'wp-multi-network' ), $domain . $path ) ); … … 830 851 } 831 852 832 if ( true === $delete_blogs ) { 833 foreach ( $sites as $site ) { 834 if ( wp_should_rescue_orphaned_sites() ) { 835 move_site( $site->id, 0 ); 836 continue; 837 } 838 839 wpmu_delete_blog( $site->id, true ); 853 foreach ( $sites as $site ) { 854 if ( wp_should_rescue_orphaned_sites() ) { 855 move_site( $site->id, 0 ); 856 continue; 840 857 } 858 859 wpmu_delete_blog( $site->id, true ); 841 860 } 842 861 } … … 961 980 * @since 1.3.0 962 981 * 963 * @return arrayList of network option names.982 * @return string[] List of network option names. 964 983 */ 965 984 function network_options_list() { … … 986 1005 * @since 1.3.0 987 1006 * 988 * @return array List of network $option_name => $option_label pairs.1007 * @return array<string, string> List of network $option_name => $option_label pairs. 989 1008 */ 990 1009 function network_options_to_copy() { -
wp-multi-network/tags/3.0.0/wp-multi-network/includes/metaboxes/edit-network.php
r2588851 r3414829 16 16 * 17 17 * @param WP_Network $network Optional. Network object. Default null. 18 * @return void 18 19 */ 19 20 function wpmn_edit_network_details_metabox( $network = null ) { 20 $domain = ! empty( $network->domain ) ? Requests_IDNAEncoder::encode( $network->domain ) : ''; 21 $path = ! empty( $network->path ) ? $network->path : '/'; 21 22 $domain = ! empty( $network->domain ) 23 ? $network->domain 24 : ''; 25 26 $path = ! empty( $network->path ) 27 ? $network->path 28 : '/'; 22 29 23 30 ?> 24 31 25 32 <table class="edit-network form-table"> 33 <?php do_action( 'wpmn_edit_network_details_metabox_before_group', $network ); ?> 34 26 35 <tr class="form-field form-required"> 27 36 <th scope="row"> … … 44 53 </td> 45 54 </tr> 55 56 <?php do_action( 'wpmn_edit_network_details_metabox_after_group', $network ); ?> 46 57 </table> 47 58 … … 53 64 * 54 65 * @since 1.7.0 66 * @return void 55 67 */ 56 68 function wpmn_edit_network_new_site_metabox() { … … 58 70 59 71 <table class="edit-network form-table"> 72 <?php do_action( 'wpmn_edit_network_new_site_metabox_before_group' ); ?> 73 60 74 <tr class="form-field form-required"> 61 75 <th scope="row"> … … 67 81 </td> 68 82 </tr> 83 84 <?php do_action( 'wpmn_edit_network_new_site_metabox_after_group' ); ?> 69 85 </table> 70 86 … … 78 94 * 79 95 * @param WP_Network $network Optional. Network object. Default null. 96 * @return void 80 97 */ 81 98 function wpmn_edit_network_assign_sites_metabox( $network = null ) { 82 99 $to = get_sites( 83 100 array( 84 'site__not_in' => get_main_site_id( $network->id),101 'site__not_in' => array( get_main_site_id( $network->id ) ), 85 102 'network_id' => $network->id, 86 103 ) … … 111 128 <?php if ( ( (int) $site->network_id !== (int) $network->id ) && ! is_main_site_for_network( $site->id ) ) : ?> 112 129 113 <option value="<?php echo esc_attr( $site->id); ?>">114 <?php echo esc_html( sprintf( '%1$s (%2$s%3$s)', $site-> name, $site->domain, $site->path ) ); ?>130 <option value="<?php echo esc_attr( strval( $site->id ) ); ?>"> 131 <?php echo esc_html( sprintf( '%1$s (%2$s%3$s)', $site->blogname, $site->domain, $site->path ) ); ?> 115 132 </option> 116 133 … … 132 149 <?php if ( (int) $site->network_id === (int) $network->id ) : ?> 133 150 134 <option value="<?php echo esc_attr( $site->id); ?>" <?php disabled( is_main_site_for_network( $site->id ) ); ?>>135 <?php echo esc_html( sprintf( '%1$s (%2$s%3$s)', $site-> name, $site->domain, $site->path ) ); ?>151 <option value="<?php echo esc_attr( strval( $site->id ) ); ?>" <?php disabled( is_main_site_for_network( $site->id ) ); ?>> 152 <?php echo esc_html( sprintf( '%1$s (%2$s%3$s)', $site->blogname, $site->domain, $site->path ) ); ?> 136 153 </option> 137 154 … … 154 171 * 155 172 * @param WP_Network $network Optional. Network object. Default null. 173 * @return void 156 174 */ 157 175 function wpmn_edit_network_publish_metabox( $network = null ) { … … 234 252 ?> 235 253 <input type="hidden" name="action" value="<?php echo esc_attr( $action ); ?>"> 236 <input type="hidden" name="network_id" value="<?php echo esc_attr( $network_id); ?>">254 <input type="hidden" name="network_id" value="<?php echo esc_attr( strval( $network_id ) ); ?>"> 237 255 </div> 238 256 <div class="clear"></div> -
wp-multi-network/tags/3.0.0/wp-multi-network/includes/metaboxes/move-site.php
r2588851 r3414829 16 16 * 17 17 * @param WP_Site $site Optional. Site object. Default null. 18 * @return void 18 19 */ 19 20 function wpmn_move_site_list_metabox( $site = null ) { … … 78 79 * 79 80 * @param WP_Site $site Optional. Site object. Default null. 81 * @return void 80 82 */ 81 83 function wpmn_move_site_assign_metabox( $site = null ) { … … 139 141 ?> 140 142 <input type="hidden" name="action" value="move"> 141 <input type="hidden" name="from" value="<?php echo esc_attr( $site->network_id); ?>">143 <input type="hidden" name="from" value="<?php echo esc_attr( strval( $site->network_id ) ); ?>"> 142 144 </div> 143 145 <div class="clear"></div> -
wp-multi-network/tags/3.0.0/wpmn-loader.php
r2788090 r3414829 16 16 * Text Domain: wp-multi-network 17 17 * Network: true 18 * Requires at least: 4.919 * Requires PHP: 5.220 * Tested up to: 6.118 * Requires at least: 5.5 19 * Requires PHP: 7.2 20 * Tested up to: 7.0 21 21 * Version: 2.5.2 22 22 */ … … 70 70 * @var string 71 71 */ 72 public $asset_version = 202108250001;72 public $asset_version = '202108250001'; 73 73 74 74 /** … … 111 111 * 112 112 * @since 1.3.0 113 * @return void 113 114 */ 114 115 private function constants() { … … 126 127 * 127 128 * @since 1.3.0 129 * @return void 128 130 */ 129 131 private function setup_globals() { … … 138 140 * 139 141 * @since 1.3.0 142 * @return void 140 143 */ 141 144 private function includes() { … … 166 169 167 170 $this->admin_bar = new WP_MS_Networks_Admin_Bar(); 171 $this->admin_bar->add_hooks(); 168 172 169 173 if ( defined( 'WPMN_DEPRECATED' ) && ( true === WPMN_DEPRECATED ) ) { … … 186 190 * 187 191 * @since 1.3.0 188 */ 189 function setup_multi_network() { 192 * @return void 193 */ 194 function setup_multi_network() { // phpcs:ignore Universal.Files.SeparateFunctionsFromOO.Mixed 190 195 wpmn(); 191 196 } … … 196 201 * 197 202 * @since 2.3.0 203 * @return void 198 204 */ 199 205 function setup_multi_network_endpoints() { … … 209 215 * 210 216 * @since 1.7.0 211 *212 217 * @return WPMN_Loader WP Multi Network instance to use. 213 218 */ -
wp-multi-network/trunk/readme.txt
r2788090 r3414829 2 2 Author: Triple J Software, Inc. 3 3 Author URI: https://jjj.software 4 Donate link: https://buy.stripe.com/7sI3cd2tK1Cy2lydQR5 4 Plugin URI: https://wordpress.org/plugins/wp-multi-network/ 6 5 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 9 8 Tags: network, sites, domains, global, admin 10 9 Requires PHP: 5.2 11 Requires at least: 4.912 Tested up to: 6.110 Requires at least: 5.5 11 Tested up to: 7.0 13 12 Stable tag: 2.5.2 14 13 … … 123 122 124 123 == Changelog == 124 125 = 2.5.3 = 126 * Remove filter_input usages 127 125 128 = 2.5.2 = 126 129 * Use get_main_site_id function instead of get_main_site_for_network. … … 128 131 129 132 = 2.5.1 = 130 * Save main site on network as network option. 133 * Save main site on network as network option. 131 134 132 135 = 2.5.0 = -
wp-multi-network/trunk/wp-multi-network/assets/js/wp-multi-network.js
r2584493 r3414829 1 jQuery( document ).ready( 2 function ( $ ) { 1 /** 2 * WP Multi Network Admin Script 3 */ 3 4 4 $( '.if-js-closed' )5 .removeClass( 'if-js-closed' )6 .addClass( 'closed' );7 5 8 $( '.postbox' ).children( 'h3' ).click( 9 function () { 10 if ( $( this.parentNode ).hasClass( 'closed' ) ) { 11 $( this.parentNode ).removeClass( 'closed' ); 12 } else { 13 $( this.parentNode ).addClass( 'closed' ); 14 } 15 } 16 ); 6 jQuery( document ).ready( function ( $ ) { 7 $( '.if-js-closed' ).removeClass( 'if-js-closed' ).addClass( 'closed' ); 17 8 18 /* Handle clicks to add/remove sites to/from selected list */ 19 $( 'input[name=assign]' ).click( 20 function () { 21 move( 'from', 'to' ); 22 } 23 ); 9 $( '.postbox' ) 10 .children( 'h3' ) 11 .click( function () { 12 if ( $( this.parentNode ).hasClass( 'closed' ) ) { 13 $( this.parentNode ).removeClass( 'closed' ); 14 } else { 15 $( this.parentNode ).addClass( 'closed' ); 16 } 17 } ); 24 18 25 $( 'input[name=unassign]' ).click( 26 function () { 27 move( 'to', 'from' ); 28 } 29 ); 19 /* Handle clicks to add/remove sites to/from selected list */ 20 $( 'input[name=assign]' ).click( function () { 21 move( 'from', 'to' ); 22 } ); 30 23 31 /* Select all sites in "selected" box when submitting */ 32 $( '#edit-network-form' ).submit( 33 function () { 34 $( '#to' ).children( 'option:enabled' ).attr( 'selected', true ); 35 $( '#from' ).children( 'option:enabled' ).attr( 'selected', true ); 36 } 37 ); 24 $( 'input[name=unassign]' ).click( function () { 25 move( 'to', 'from' ); 26 } ); 38 27 39 function move( from, to ) { 40 jQuery( '#' + from ).children( 'option:selected' ).each( 41 function () { 42 jQuery( '#' + to ).append( jQuery( this ).clone() ); 43 jQuery( this ).remove(); 44 } 45 ); 46 } 28 /* Select all sites in "selected" box when submitting */ 29 $( '#edit-network-form' ).submit( function () { 30 $( '#to' ).children( 'option:enabled' ).attr( 'selected', true ); 31 $( '#from' ).children( 'option:enabled' ).attr( 'selected', true ); 32 } ); 33 34 function move( from, to ) { 35 jQuery( '#' + from ) 36 .children( 'option:selected' ) 37 .each( function () { 38 jQuery( '#' + to ).append( jQuery( this ).clone() ); 39 jQuery( this ).remove(); 40 } ); 47 41 } 48 );42 } ); -
wp-multi-network/trunk/wp-multi-network/includes/classes/class-wp-ms-network-command.php
r2584493 r3414829 12 12 * @since 1.3.0 13 13 */ 14 class WP_MS_Network_Command extends WP_CLI_Command{14 class WP_MS_Network_Command { 15 15 16 16 /** … … 18 18 * 19 19 * @since 1.3.0 20 * @var array20 * @var string[] 21 21 */ 22 22 protected $obj_fields = array( … … 55 55 * @since 1.3.0 56 56 * 57 * @param array $args Positional CLI arguments. 58 * @param array $assoc_args Associative CLI arguments. 57 * @param string[] $args Positional CLI arguments. 58 * @param array<string, mixed> $assoc_args Associative CLI arguments. 59 * @return void 59 60 */ 60 61 public function create( $args, $assoc_args ) { 61 list( $domain, $path )= $args;62 [ $domain, $path ] = $args; 62 63 63 64 $assoc_args = wp_parse_args( … … 75 76 $user = $users->get( $assoc_args['network_admin'] ); 76 77 if ( ! $user ) { 77 return new WP_Error( 'network_super_admin','Super user does not exist.' );78 WP_CLI::error( 'Super user does not exist.' ); 78 79 } 79 80 $network_admin_id = $user->ID; … … 82 83 } 83 84 84 $clone_network = $assoc_args['clone_network']; 85 $options_to_clone = false; 86 87 if ( ! empty( $clone_network ) && ! get_network( $clone_network ) ) { 85 $clone_network = $assoc_args['clone_network']; 86 87 if ( ! empty( $clone_network ) && is_numeric( $clone_network ) && ! get_network( $clone_network ) ) { 88 88 WP_CLI::error( sprintf( "Clone network %s doesn't exist.", $clone_network ) ); 89 90 if ( ! empty( $assoc_args['options_to_clone'] ) ) {91 $options_to_clone = explode( ',', $assoc_args['options_to_clone'] );92 }93 89 } 94 90 … … 102 98 'network_admin_id' => $network_admin_id, 103 99 'clone_network' => $clone_network, 104 'options_to_clone' => $ options_to_clone,100 'options_to_clone' => $assoc_args['options_to_clone'], 105 101 ) 106 102 ); … … 127 123 * @since 1.3.0 128 124 * 129 * @param array $args Positional CLI arguments. 130 * @param array $assoc_args Associative CLI arguments. 125 * @param string[] $args Positional CLI arguments. 126 * @param array<string, mixed> $assoc_args Associative CLI arguments. 127 * @return void 131 128 */ 132 129 public function update( $args, $assoc_args ) { 133 list( $id, $domain )= $args;130 [ $id, $domain ] = $args; 134 131 135 132 $defaults = array( … … 138 135 $assoc_args = wp_parse_args( $assoc_args, $defaults ); 139 136 140 $network_id = update_network( $id, $domain, $assoc_args['path'] );137 $network_id = update_network( (int) $id, $domain, $assoc_args['path'] ); 141 138 142 139 if ( is_wp_error( $network_id ) ) { … … 158 155 * @since 1.3.0 159 156 * 160 * @param array $args Positional CLI arguments. 161 * @param array $assoc_args Associative CLI arguments. 157 * @param string[] $args Positional CLI arguments. 158 * @param array<string, mixed> $assoc_args Associative CLI arguments. 159 * @return void 162 160 */ 163 161 public function delete( $args, $assoc_args ) { 164 list( $id )= $args;162 [ $id ] = $args; 165 163 166 164 $assoc_args = wp_parse_args( … … 170 168 ); 171 169 172 $network_id = delete_network( $id, $assoc_args['delete_blogs'] );170 $network_id = delete_network( (int) $id, $assoc_args['delete_blogs'] ); 173 171 174 172 if ( is_wp_error( $network_id ) ) { … … 192 190 * @since 1.3.0 193 191 * 194 * @param array $args Positional CLI arguments. 195 * @param array $assoc_args Associative CLI arguments. 196 */ 197 public function move_site( $args, $assoc_args ) { 198 list( $site_id, $new_network_id ) = $args; 199 200 $network_id = move_site( $site_id, $new_network_id ); 192 * @param string[] $args Positional CLI arguments. 193 * @param array<string, mixed> $assoc_args Associative CLI arguments. 194 * @return void 195 */ 196 public function move_site( $args, $assoc_args ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed 197 [ $site_id, $new_network_id ] = $args; 198 199 $network_id = move_site( (int) $site_id, (int) $new_network_id ); 201 200 202 201 if ( is_wp_error( $network_id ) ) { … … 228 227 * @since 1.3.0 229 228 * 230 * @param array $args Positional CLI arguments. 231 * @param array $assoc_args Associative CLI arguments. 229 * @param string[] $args Positional CLI arguments. 230 * @param array<string, mixed> $assoc_args Associative CLI arguments. 231 * @return void 232 232 */ 233 233 public function list_( $args, $assoc_args ) { … … 257 257 * @since 1.3.0 258 258 * 259 * @param array $args Positional CLI arguments. 260 * @param array $assoc_args Associative CLI arguments. 259 * @param string[] $args Positional CLI arguments. 260 * @param array<string, mixed> $assoc_args Associative CLI arguments. 261 * @return void 261 262 */ 262 263 public function plugin( $args, $assoc_args ) { 263 $this->fetcher = new \WP_CLI\Fetchers\Plugin(); 264 $action = array_shift( $args ); 264 $fetchers_plugin = new \WP_CLI\Fetchers\Plugin(); 265 $action = array_shift( $args ); 266 265 267 if ( ! in_array( $action, array( 'activate', 'deactivate' ), true ) ) { 266 268 WP_CLI::error( sprintf( '%s is not a supported action.', $action ) ); 267 269 } 270 268 271 $network_wide = \WP_CLI\Utils\get_flag_value( $assoc_args, 'network' ); 269 272 $all = \WP_CLI\Utils\get_flag_value( $assoc_args, 'all', false ); … … 281 284 $args = array_map( 282 285 function ( $file ) { 283 return \WP_CLI\Utils\get_plugin_name( $file );286 return \WP_CLI\Utils\get_plugin_name( $file ); 284 287 }, array_keys( get_plugins() ) 285 288 ); 286 289 } 287 foreach ( $ this->fetcher->get_many( $args ) as $plugin ) {290 foreach ( $fetchers_plugin->get_many( $args ) as $plugin ) { 288 291 $status = $this->get_status( $plugin->file ); 289 292 if ( $all && in_array( $status, array( 'active', 'active-network' ), true ) ) { 290 $needing_activation --;293 --$needing_activation; 291 294 continue; 292 295 } … … 311 314 activate_plugins( $plugin->file, '', $network_wide ); 312 315 } else { 313 deactivate_plugins( $plugin->file, '', $network_wide );316 deactivate_plugins( $plugin->file, false, $network_wide ); 314 317 } 315 318 … … 327 330 * @since 1.3.0 328 331 * 329 * @param array $assoc_args Associative CLI arguments. Passed by reference.332 * @param array<string, mixed> $assoc_args Associative CLI arguments. Passed by reference. 330 333 * @return WP_CLI\Formatter WP-CLI formatter instance. 331 334 */ … … 378 381 * @param bool $network_wide Whether to check network-wide or not. 379 382 * @param string $action Action performed. 383 * @return void 380 384 */ 381 385 private function active_output( $name, $file, $network_wide, $action ) { -
wp-multi-network/trunk/wp-multi-network/includes/classes/class-wp-ms-networks-admin-bar.php
r2584493 r3414829 18 18 19 19 /** 20 * Constructor.20 * Registers WordPress hooks for the plugin. 21 21 * 22 * Hooks in the necessary methods. 22 * Adds actions to: 23 * - Modify the admin bar menu 24 * - Add custom styles to the admin area 25 * - Add custom styles to the front-end 23 26 * 24 * @ since 2.2.027 * @return void 25 28 */ 26 public function __construct(){29 public function add_hooks(): void { 27 30 add_action( 'admin_bar_menu', array( $this, 'admin_bar' ), 20 ); 28 29 31 add_action( 'admin_print_styles', array( $this, 'admin_print_styles' ) ); 30 32 add_action( 'wp_print_styles', array( $this, 'admin_print_styles' ) ); … … 38 40 * 39 41 * @since 2.2.0 42 * @since 3.0.0 Prevent rendering of CSS if admin bar is not shown. 43 * @return void 40 44 */ 41 45 public function admin_print_styles() { 46 if ( ! is_admin_bar_showing() ) { 47 return; 48 } 42 49 ?> 43 50 <style type="text/css"> … … 56 63 * 57 64 * @param WP_Admin_Bar $wp_admin_bar Admin bar instance. 65 * @return void 58 66 */ 59 67 public function admin_bar( $wp_admin_bar ) { -
wp-multi-network/trunk/wp-multi-network/includes/classes/class-wp-ms-networks-admin.php
r2588851 r3414829 21 21 * 22 22 * @since 2.0.0 23 * @var array 23 * @var array<string, array<int, string>> 24 24 */ 25 25 private $feedback_strings = array(); … … 33 33 */ 34 34 public function __construct() { 35 $this->set_feedback_strings();36 37 35 add_action( 'admin_menu', array( $this, 'admin_menu' ) ); 38 36 add_action( 'network_admin_menu', array( $this, 'network_admin_menu' ) ); … … 41 39 add_action( 'admin_init', array( $this, 'route_save_handlers' ) ); 42 40 41 add_action( 'admin_init', array( $this, 'set_feedback_strings' ) ); 43 42 add_action( 'network_admin_notices', array( $this, 'network_admin_notices' ) ); 44 43 … … 53 52 * @since 1.3.0 54 53 * 55 * @param array $actions Array of action links.56 * @param int $blog_id Current site ID.57 * @return array Adjusted action links.54 * @param array<string, string> $actions Array of action links. 55 * @param int $blog_id Current site ID. 56 * @return array<string, string> Adjusted action links. 58 57 */ 59 58 public function add_move_blog_link( $actions = array(), $blog_id = 0 ) { … … 85 84 * 86 85 * @since 1.3.0 86 * @return void 87 87 */ 88 88 public function admin_menu() { … … 103 103 * 104 104 * @since 1.3.0 105 * @return void 105 106 */ 106 107 public function network_admin_menu() { … … 120 121 * 121 122 * @since 1.5.2 123 * @return void 122 124 */ 123 125 public function network_admin_menu_separator() { … … 133 135 * @global string $plugin_page 134 136 * @global string $submenu_file 137 * @return void 135 138 */ 136 139 public function fix_menu_highlight_for_move_page() { … … 138 141 139 142 if ( 'networks' === $plugin_page ) { 140 $action = filter_input( INPUT_GET, 'action' ); 143 // phpcs:disable WordPress.Security.NonceVerification.Recommended 144 $action = ! empty( $_GET['action'] ) 145 ? sanitize_key( $_GET['action'] ) 146 : ''; 147 // phpcs:enable 148 141 149 if ( 'move' === $action ) { 142 150 $submenu_file = 'sites.php'; // phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited … … 151 159 * 152 160 * @param string $page Optional. Current page hook. Default empty string. 161 * @return void 153 162 */ 154 163 public function enqueue_scripts( $page = '' ) { … … 159 168 } 160 169 161 wp_register_style( 'wp-multi-network', wpmn()->plugin_url . 'assets/css/wp-multi-network.css', array(), wpmn()->asset_version, false ); 162 wp_register_script( 'wp-multi-network', wpmn()->plugin_url . 'assets/js/wp-multi-network.js', array( 'jquery', 'post' ), wpmn()->asset_version, true ); 170 // Determine if we should load source or minified assets based on WP_SCRIPT_DEBUG. 171 $suffix = ( defined( 'WP_SCRIPT_DEBUG' ) && WP_SCRIPT_DEBUG ) ? '' : '.min'; 172 $asset_version = ( defined( 'WP_SCRIPT_DEBUG' ) && WP_SCRIPT_DEBUG ) ? time() : wpmn()->asset_version; 173 174 wp_register_style( 'wp-multi-network', wpmn()->plugin_url . 'assets/css/wp-multi-network' . $suffix . '.css', array(), $asset_version ); 175 wp_register_script( 'wp-multi-network', wpmn()->plugin_url . 'assets/js/wp-multi-network' . $suffix . '.js', array( 'jquery', 'post' ), $asset_version, true ); 163 176 164 177 wp_enqueue_style( 'wp-multi-network' ); … … 170 183 * 171 184 * @since 2.1.0 172 */ 173 private function set_feedback_strings() { 185 * @return void 186 */ 187 public function set_feedback_strings() { 174 188 $this->feedback_strings = array( 175 189 'network_updated' => array( … … 195 209 * Prints feedback notices for network admin actions as necessary. 196 210 * 211 * @phpcs:disable WordPress.Security.NonceVerification.Missing 212 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 213 * 197 214 * @since 1.3.0 215 * @return void 198 216 */ 199 217 public function network_admin_notices() { 200 218 $message = ''; 201 219 $type = ''; 220 202 221 foreach ( $this->feedback_strings as $slug => $messages ) { 203 $passed = filter_input( INPUT_GET, $slug ); 204 205 if ( is_string( $passed ) ) { 206 if ( '1' === $passed ) { 207 $message = $messages['1']; 208 $type = 'updated'; 209 } else { 210 $message = $messages['0']; 211 $type = 'error'; 212 } 213 214 break; 222 223 // Skip if not known feedback. 224 if ( ! isset( $_GET[ $slug ] ) || ! is_scalar( $_GET[ $slug ] ) ) { 225 continue; 215 226 } 216 } 217 227 228 // Pass/Fail. 229 $passed = sanitize_key( $_GET[ $slug ] ); 230 231 if ( '1' === $passed ) { 232 // Pass. 233 $message = $messages['1']; 234 $type = 'updated'; 235 } else { 236 // Fail. 237 $message = $messages['0']; 238 $type = 'error'; 239 } 240 241 // Done. 242 break; 243 } 244 245 // Bail if no message or type. 218 246 if ( empty( $message ) || empty( $type ) ) { 219 247 return; … … 234 262 * Routes the current request to the correct page. 235 263 * 236 * @since 2.0.0 264 * @phpcs:disable WordPress.Security.NonceVerification.Missing 265 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 266 * 267 * @since 2.0.0 268 * @return void 237 269 */ 238 270 public function route_pages() { … … 243 275 } 244 276 245 $action = filter_input( INPUT_GET, 'action', FILTER_SANITIZE_STRING ); 246 $action = sanitize_key( $action ); 277 $action = ! empty( $_GET['action'] ) 278 ? sanitize_key( $_GET['action'] ) 279 : ''; 247 280 248 281 switch ( $action ) { … … 265 298 // View the list of networks, with bulk action handling. 266 299 case 'all_networks': 267 $doaction = filter_input( INPUT_POST, 'action', FILTER_SANITIZE_STRING ); 268 if ( empty( $doaction ) || '-1' === $doaction ) { 269 $doaction = filter_input( INPUT_POST, 'action2', FILTER_SANITIZE_STRING ); 300 $doaction = ! empty( $_POST['action'] ) 301 ? sanitize_key( $_POST['action'] ) 302 : ''; 303 304 if ( 305 empty( $doaction ) 306 || 307 ( '-1' === $doaction ) 308 ) { 309 $doaction = ! empty( $_POST['action2'] ) 310 ? sanitize_key( $_POST['action2'] ) 311 : ''; 270 312 } 271 $doaction = sanitize_key( $doaction );272 313 273 314 switch ( $doaction ) { … … 291 332 * Handles network management form submissions. 292 333 * 293 * @since 2.0.0 334 * @phpcs:disable WordPress.Security.NonceVerification.Missing 335 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 336 * 337 * @since 2.0.0 338 * @return void 294 339 */ 295 340 public function route_save_handlers() { … … 301 346 } 302 347 303 $action = filter_input( INPUT_POST, 'action', FILTER_SANITIZE_STRING ); 348 $action = ! empty( $_POST['action'] ) 349 ? sanitize_key( $_POST['action'] ) 350 : ''; 351 304 352 if ( empty( $action ) ) { 305 353 $alternative_actions = array( 'delete', 'delete_multiple', 'move' ); 354 306 355 foreach ( $alternative_actions as $alternative_action ) { 307 if ( filter_input( INPUT_POST, $alternative_action) ) {356 if ( ! empty( $_POST[ $alternative_action ] ) ) { 308 357 $action = $alternative_action; 309 358 break; … … 350 399 * Renders the new network creation dashboard page. 351 400 * 352 * @since 2.0.0 401 * @phpcs:disable WordPress.Security.NonceVerification.Missing 402 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 403 * 404 * @since 2.0.0 405 * @return void 353 406 */ 354 407 public function page_edit_network() { 355 $network_id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT ); 356 $network = $network_id ? get_network( $network_id ) : null; 408 409 $network_id = ! empty( $_GET['id'] ) && is_numeric( $_GET['id'] ) 410 ? (int) $_GET['id'] 411 : 0; 412 413 $network = ! empty( $network_id ) 414 ? get_network( $network_id ) 415 : null; 357 416 358 417 add_meta_box( 'wpmn-edit-network-details', esc_html__( 'Details', 'wp-multi-network' ), 'wpmn_edit_network_details_metabox', get_current_screen()->id, 'normal', 'high', array( $network ) ); … … 392 451 <hr class="wp-header-end"> 393 452 394 <form method="post" id="edit-network-form" action="">453 <form method="post" action="" id="edit-network-form"> 395 454 <div id="poststuff" class="poststuff"> 396 455 <div id="post-body" class="metabox-holder columns-2"> … … 398 457 <div id="titlediv"> 399 458 <div id="titlewrap"> 400 <label class="screen-reader-text" id="title-prompt-text" for="title"><?php e cho esc_html_e( 'Enter network title here', 'wp-multi-network' ); ?></label>459 <label class="screen-reader-text" id="title-prompt-text" for="title"><?php esc_html_e( 'Enter network title here', 'wp-multi-network' ); ?></label> 401 460 <input type="text" name="title" size="30" id="title" spellcheck="true" autocomplete="off" value="<?php echo esc_attr( $network_title ); ?>"> 402 461 </div> … … 423 482 * Renders the network listing dashboard page. 424 483 * 484 * @phpcs:disable WordPress.Security.NonceVerification.Missing 485 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 486 * 425 487 * @since 2.0.0 426 488 * 427 489 * @uses WP_MS_Networks_List_Table List_Table iterator for networks 490 * @return void 428 491 */ 429 492 private function page_all_networks() { … … 435 498 $search_url = $this->admin_url( array( 'action' => 'domains' ) ); 436 499 437 $search_text = filter_input( INPUT_POST, 's', FILTER_SANITIZE_STRING ); 500 $search_text = ! empty( $_POST['s'] ) 501 ? stripslashes( trim( sanitize_text_field( $_POST['s'] ) ) ) 502 : ''; 503 438 504 ?> 439 505 … … 463 529 </form> 464 530 465 <form method="post" id="form-domain-list" action="<?php echo esc_url( $all_networks_url ); ?>">531 <form method="post" action="<?php echo esc_url( $all_networks_url ); ?>" id="form-domain-list"> 466 532 <?php $wp_list_table->display(); ?> 467 533 </form> … … 474 540 * Renders the dashboard screen for moving sites -- accessed from the "Sites" screen. 475 541 * 476 * @since 2.0.0 542 * @phpcs:disable WordPress.Security.NonceVerification.Missing 543 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 544 * 545 * @since 2.0.0 546 * @return void 477 547 */ 478 548 private function page_move_site() { 479 $site_id = filter_input( INPUT_GET, 'blog_id', FILTER_SANITIZE_NUMBER_INT ); 480 $site = $site_id ? get_site( $site_id ) : null; 549 550 $site_id = ! empty( $_GET['blog_id'] ) && is_numeric( $_GET['blog_id'] ) 551 ? (int) $_GET['blog_id'] 552 : 0; 553 554 $site = ! empty( $site_id ) 555 ? get_site( $site_id ) 556 : null; 481 557 482 558 // Bail if invalid site ID. … … 507 583 ); 508 584 509 $add_network_url = $this->admin_url( array( 'page' => 'add-new-network' ) ); 585 // URLs to escape. 586 $add_network_url = $this->admin_url( 587 array( 588 'page' => 'add-new-network', 589 ) 590 ); 591 $form_action_url = $this->admin_url( 592 array( 593 'action' => 'move', 594 'blog_id' => $site_id, 595 ) 596 ); 510 597 ?> 511 598 … … 525 612 <hr class="wp-header-end"> 526 613 527 <form method="post" action="<?php echo esc_ attr( filter_input( INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_STRING )); ?>">614 <form method="post" action="<?php echo esc_url( $form_action_url ); ?>"> 528 615 <div id="poststuff"> 529 616 <div id="post-body" class="metabox-holder columns-2"> … … 547 634 * Renders the delete network page. 548 635 * 549 * @since 2.0.0 636 * @phpcs:disable WordPress.Security.NonceVerification.Missing 637 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 638 * 639 * @since 2.0.0 640 * @return void 550 641 */ 551 642 private function page_delete_network() { 552 $network_id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT ); 553 $network = $network_id ? get_network( $network_id ) : null; 643 644 $network_id = ! empty( $_GET['id'] ) && is_numeric( $_GET['id'] ) 645 ? (int) $_GET['id'] 646 : 0; 647 648 $network = ! empty( $network_id ) 649 ? get_network( $network_id ) 650 : null; 554 651 555 652 // Bail if invalid network ID. … … 578 675 <hr class="wp-header-end"> 579 676 580 <form method="post" action="<?php echo esc_ attr( remove_query_arg( 'action' ) ); ?>">677 <form method="post" action="<?php echo esc_url( remove_query_arg( 'action' ) ); ?>"> 581 678 <?php 582 679 … … 638 735 * Renders the delete multiple networks page. 639 736 * 640 * @since 2.0.0 737 * @phpcs:disable WordPress.Security.NonceVerification.Missing 738 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 739 * 740 * @since 2.0.0 741 * @return void 641 742 */ 642 743 private function page_delete_networks() { 643 $network_id = get_main_network_id(); 644 $all_networks = filter_input( INPUT_POST, 'all_networks', FILTER_SANITIZE_NUMBER_INT, FILTER_FORCE_ARRAY ); 645 $all_networks = array_map( 'absint', $all_networks ); 744 745 $network_id = get_main_network_id(); 746 747 $all_networks = ! empty( $_POST['all_networks'] ) && is_array( $_POST['all_networks'] ) 748 ? wp_parse_id_list( (array) $_POST['all_networks'] ) 749 : array(); 750 646 751 $all_networks = array_diff( $all_networks, array( $network_id ) ); 647 752 … … 758 863 * 759 864 * @global wpdb $wpdb WordPress database abstraction object. 865 * @return void 760 866 */ 761 867 public function page_my_networks() { … … 794 900 $num_rows = ceil( $num / $cols ); 795 901 $split = 0; 902 $rows = array(); 796 903 for ( $i = 1; $i <= $num_rows; $i++ ) { 797 904 $rows[] = array_slice( $my_networks, $split, $cols ); … … 827 934 * @param WP_Network $network Current network object. 828 935 */ 829 echo apply_filters( 'mynetworks_network_actions', $network_actions, $network ); // phpcs:ignore WordPress. XSS.EscapeOutput.OutputNotEscaped936 echo apply_filters( 'mynetworks_network_actions', $network_actions, $network ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 830 937 ?> 831 938 </p> … … 834 941 <?php 835 942 restore_current_network(); 836 $i++;943 ++$i; 837 944 } 838 945 echo '</tr>'; … … 848 955 * Handles the request to add a new network. 849 956 * 850 * @since 2.0.0 957 * @phpcs:disable WordPress.Security.NonceVerification.Missing 958 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 959 * 960 * @since 2.0.0 961 * @return void 851 962 */ 852 963 private function handle_add_network() { 853 964 854 965 // Sanitize options to clone. 855 $options_to_clone = filter_input( INPUT_POST, 'options_to_clone', FILTER_DEFAULT, FILTER_FORCE_ARRAY ); 966 $options_to_clone = ! empty( $_POST['options_to_clone'] ) && is_array( $_POST['options_to_clone'] ) 967 ? $_POST['options_to_clone'] 968 : array(); 969 856 970 $options_to_clone = ! empty( $options_to_clone ) 857 971 ? array_keys( $options_to_clone ) … … 859 973 860 974 // Sanitize network ID to clone. 861 $clone = filter_input( INPUT_POST, 'clone_network', FILTER_SANITIZE_NUMBER_INT ); 975 $clone = ! empty( $_GET['clone_network'] ) 976 ? (int) $_GET['clone_network'] 977 : 0; 978 862 979 if ( empty( $clone ) ) { 863 980 $clone = get_current_site()->id; 864 981 } 865 982 866 // Sanitize values. 867 $network_title = wp_unslash( filter_input( INPUT_POST, 'title', FILTER_SANITIZE_STRING ) ); 868 $network_domain = wp_unslash( filter_input( INPUT_POST, 'domain', FILTER_SANITIZE_STRING ) ); 869 $network_path = wp_unslash( filter_input( INPUT_POST, 'path', FILTER_SANITIZE_STRING ) ); 870 $site_name = wp_unslash( filter_input( INPUT_POST, 'new_site', FILTER_SANITIZE_STRING ) ); 871 872 // Additional formatting. 873 $network_title = wp_strip_all_tags( $network_title ); 983 // Unslash posted values. 984 $network_title = ! empty( $_POST['title'] ) 985 ? wp_unslash( $_POST['title'] ) 986 : ''; 987 $network_domain = ! empty( $_POST['domain'] ) 988 ? wp_unslash( $_POST['domain'] ) 989 : ''; 990 $network_path = ! empty( $_POST['path'] ) 991 ? wp_unslash( $_POST['path'] ) 992 : ''; 993 $site_name = ! empty( $_POST['new_site'] ) 994 ? wp_unslash( $_POST['new_site'] ) 995 : ''; 996 997 // Additional sanitization. 998 $network_title = sanitize_text_field( $network_title ); 874 999 $network_domain = str_replace( ' ', '', strtolower( sanitize_text_field( $network_domain ) ) ); 875 1000 $network_path = str_replace( ' ', '', strtolower( sanitize_text_field( $network_path ) ) ); … … 877 1002 // Fallback to network title if not explicitly set. 878 1003 $site_name = ! empty( $site_name ) 879 ? wp_strip_all_tags( $site_name )1004 ? sanitize_text_field( $site_name ) 880 1005 : $network_title; 881 1006 … … 940 1065 * Handles the request to update a network. 941 1066 * 942 * @since 2.0.0 1067 * @phpcs:disable WordPress.Security.NonceVerification.Missing 1068 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 1069 * 1070 * @since 2.0.0 1071 * @return void 943 1072 */ 944 1073 private function handle_update_network() { 945 1074 946 1075 // Sanitize network ID. 947 $network_id = filter_input( INPUT_POST, 'network_id', FILTER_SANITIZE_NUMBER_INT ); 1076 $network_id = ! empty( $_GET['id'] ) && is_numeric( $_GET['id'] ) 1077 ? (int) $_GET['id'] 1078 : 0; 948 1079 949 1080 // Bail if invalid network. … … 952 1083 } 953 1084 954 // Sanitize values. 955 $network_title = wp_unslash( filter_input( INPUT_POST, 'title', FILTER_SANITIZE_STRING ) ); 956 $network_domain = wp_unslash( filter_input( INPUT_POST, 'domain', FILTER_SANITIZE_STRING ) ); 957 $network_path = wp_unslash( filter_input( INPUT_POST, 'path', FILTER_SANITIZE_STRING ) ); 958 959 // Additional formatting. 1085 // Unslash posted values. 1086 $network_title = ! empty( $_POST['title'] ) 1087 ? wp_unslash( $_POST['title'] ) 1088 : ''; 1089 $network_domain = ! empty( $_POST['domain'] ) 1090 ? wp_unslash( $_POST['domain'] ) 1091 : ''; 1092 $network_path = ! empty( $_POST['path'] ) 1093 ? wp_unslash( $_POST['path'] ) 1094 : ''; 1095 1096 // Additional sanitization. 960 1097 $network_title = sanitize_text_field( $network_title ); 961 $network_domain = Requests_IDNAEncoder::encode( str_replace( ' ', '', strtolower( sanitize_text_field( $network_domain )) ) );1098 $network_domain = str_replace( ' ', '', strtolower( sanitize_text_field( $network_domain ) ) ); 962 1099 $network_path = str_replace( ' ', '', strtolower( sanitize_text_field( $network_path ) ) ); 963 1100 … … 1002 1139 * Handles the request to move a site to another network. 1003 1140 * 1004 * @since 2.0.0 1141 * @phpcs:disable WordPress.Security.NonceVerification.Missing 1142 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 1143 * 1144 * @since 2.0.0 1145 * @return void 1005 1146 */ 1006 1147 private function handle_move_site() { 1007 1148 1008 1149 // Sanitize values. 1009 $site_id = filter_input( INPUT_GET, 'blog_id', FILTER_SANITIZE_NUMBER_INT ); 1010 $new_network = filter_input( INPUT_POST, 'to', FILTER_SANITIZE_NUMBER_INT ); 1150 $site_id = ! empty( $_GET['blog_id'] ) && is_numeric( $_GET['blog_id'] ) 1151 ? (int) $_GET['blog_id'] 1152 : 0; 1153 1154 $new_network = ! empty( $_POST['to'] ) && is_numeric( $_POST['to'] ) 1155 ? (int) $_POST['to'] 1156 : 0; 1011 1157 1012 1158 // Bail if no site ID. … … 1062 1208 * Handles the request to reassign sites to another network. 1063 1209 * 1064 * @since 2.0.0 1210 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 1211 * 1212 * @since 2.0.0 1213 * @return void 1065 1214 */ 1066 1215 private function handle_reassign_sites() { 1067 1216 1068 1217 // Sanitize values. 1069 $to = array_map( 'absint', (array) filter_input( INPUT_POST, 'to', FILTER_SANITIZE_NUMBER_INT, FILTER_FORCE_ARRAY ) ); 1070 $from = array_map( 'absint', (array) filter_input( INPUT_POST, 'from', FILTER_SANITIZE_NUMBER_INT, FILTER_FORCE_ARRAY ) ); 1218 $to = ! empty( $_POST['to'] ) && is_array( $_POST['to'] ) 1219 ? wp_parse_id_list( (array) $_POST['to'] ) 1220 : array(); 1221 1222 $from = ! empty( $_POST['from'] ) && is_array( $_POST['from'] ) 1223 ? wp_parse_id_list( (array) $_POST['from'] ) 1224 : array(); 1071 1225 1072 1226 // Bail early if no movement. … … 1076 1230 1077 1231 // Sanitize network ID. 1078 $network_id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT ); 1232 $network_id = ! empty( $_GET['id'] ) && is_numeric( $_GET['id'] ) 1233 ? (int) $_GET['id'] 1234 : 0; 1079 1235 1080 1236 // Default to/from arrays. … … 1126 1282 * Handles the request to delete a network. 1127 1283 * 1128 * @since 2.0.0 1284 * @phpcs:disable WordPress.Security.NonceVerification.Missing 1285 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 1286 * 1287 * @since 2.0.0 1288 * @return void 1129 1289 */ 1130 1290 private function handle_delete_network() { 1131 1291 1132 1292 // Sanitize values. 1133 $network_id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT ); 1134 $override = (bool) filter_input( INPUT_POST, 'override' ); 1293 $network_id = ! empty( $_GET['id'] ) && is_numeric( $_GET['id'] ) 1294 ? (int) $_GET['id'] 1295 : 0; 1296 1297 $override = ! empty( $_POST['override'] ); 1135 1298 1136 1299 // Attempt to delete network. … … 1153 1316 * Handles the request to delete multiple networks. 1154 1317 * 1155 * @since 2.0.0 1318 * @phpcs:disable WordPress.Security.NonceVerification.Missing 1319 * 1320 * @since 2.0.0 1321 * @return void 1156 1322 */ 1157 1323 private function handle_delete_networks() { 1158 1324 1159 1325 // Sanitize values. 1160 $deleted_networks = array_map( 'absint', filter_input( INPUT_POST, 'deleted_networks', FILTER_SANITIZE_NUMBER_INT, FILTER_FORCE_ARRAY ) ); 1161 $override = (bool) filter_input( INPUT_POST, 'override' ); 1326 $deleted_networks = ! empty( $_POST['deleted_networks'] ) && is_array( $_POST['deleted_networks'] ) 1327 ? wp_parse_id_list( (array) $_POST['deleted_networks'] ) 1328 : array(); 1329 1330 $override = (bool) ! empty( $_POST['override'] ); 1162 1331 1163 1332 // Loop through deleted networks. … … 1188 1357 * @since 2.0.0 1189 1358 * 1190 * @param array $args Optional. URL query arguments. Default empty array. 1359 * @param array<string, int|string> $args Optional. URL query arguments. Default empty array. 1360 * @return void 1191 1361 */ 1192 1362 private function handle_redirect( $args = array() ) { … … 1200 1370 * @since 1.3.0 1201 1371 * 1202 * @param array $args Optional. URL query arguments. Default empty array.1372 * @param array<string, int|string> $args Optional. URL query arguments. Default empty array. 1203 1373 * @return string Absolute URL to the networks page. 1204 1374 */ … … 1237 1407 * 1238 1408 * @since 2.1.0 1409 * @return void 1239 1410 */ 1240 1411 private function check_nonce() { -
wp-multi-network/trunk/wp-multi-network/includes/classes/class-wp-ms-networks-capabilities.php
r2584493 r3414829 21 21 * 22 22 * @since 2.3.0 23 * @return void 23 24 */ 24 25 public function add_hooks() { … … 31 32 * @since 2.3.0 32 33 * 33 * @param array $capsArray of required capabilities.34 * @param string $capCapability to map.35 * @param int $user_id User ID.36 * @param array $argsAdditional context for the capability check.37 * @return arrayFiltered required capabilities.34 * @param string[] $caps Array of required capabilities. 35 * @param string $cap Capability to map. 36 * @param int $user_id User ID. 37 * @param mixed[] $args Additional context for the capability check. 38 * @return string[] Filtered required capabilities. 38 39 */ 39 public function map_meta_cap( $caps, $cap, $user_id, $args ) { 40 public function map_meta_cap( $caps, $cap, $user_id, $args ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed 40 41 41 42 // Map our meta capabilities to primitive capabilities first. … … 68 69 * @since 2.3.0 69 70 * 70 * @return arrayList of primitive global capabilities.71 * @return string[] List of primitive global capabilities. 71 72 */ 72 73 private function get_global_capabilities() { -
wp-multi-network/trunk/wp-multi-network/includes/classes/class-wp-ms-networks-list-table.php
r2588851 r3414829 47 47 * Prepares the list table items. 48 48 * 49 * @since 1.3.0 49 * @phpcs:disable WordPress.Security.NonceVerification.Missing 50 * @phpcs:disable WordPress.Security.NonceVerification.Recommended 51 * 52 * @since 1.3.0 53 * @return void 50 54 */ 51 55 public function prepare_items() { … … 53 57 $pagenum = $this->get_pagenum(); 54 58 55 $order_by = filter_input( INPUT_GET, 'orderby', FILTER_SANITIZE_STRING ); 56 $order_by = ! empty( $order_by ) ? sanitize_key( $order_by ) : ''; 57 $order = filter_input( INPUT_GET, 'order', FILTER_SANITIZE_STRING ); 58 $order = ! empty( $order ) ? strtoupper( $order ) : 'ASC'; 59 $search = filter_input( INPUT_GET, 's', FILTER_SANITIZE_STRING ); 60 if ( ! $search ) { 61 $search = filter_input( INPUT_POST, 's', FILTER_SANITIZE_STRING ); 62 } 63 64 $search = stripslashes( trim( $search ) ); 59 $order_by = ! empty( $_GET['orderby'] ) 60 ? sanitize_key( $_GET['orderby'] ) 61 : ''; 62 63 $order = ! empty( $_GET['order'] ) 64 ? strtoupper( sanitize_key( $_GET['order'] ) ) 65 : 'ASC'; 66 67 $search = ! empty( $_REQUEST['s'] ) 68 ? stripslashes( sanitize_text_field( $_REQUEST['s'] ) ) 69 : ''; 70 65 71 if ( false !== strpos( $search, '*' ) ) { 66 72 $search = trim( $search, '*' ); … … 97 103 * 98 104 * @since 1.3.0 105 * @return void 99 106 */ 100 107 public function no_items() { … … 107 114 * @since 1.3.0 108 115 * 109 * @return array Bulk actions as $slug => $label pairs.116 * @return array<string, string> Bulk actions as $slug => $label pairs. 110 117 */ 111 118 public function get_bulk_actions() { … … 124 131 * @since 1.3.0 125 132 * 126 * @param type$which Where to display the pagination. Either 'top' or 'bottom'.133 * @param string $which Where to display the pagination. Either 'top' or 'bottom'. 127 134 */ 128 135 public function pagination( $which ) { // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod.Found … … 146 153 * @since 1.3.0 147 154 * 148 * @return array Columns as $slug => $label pairs.155 * @return array<string, string> Columns as $slug => $label pairs. 149 156 */ 150 157 public function get_columns() { … … 173 180 * @since 1.3.0 174 181 * 175 * @return array Columns as $slug => $orderby_field pairs.182 * @return array<string, string> Columns as $slug => $orderby_field pairs. 176 183 */ 177 184 public function get_sortable_columns() { … … 189 196 * 190 197 * @param object $network The current network item. 198 * @return void 191 199 */ 192 200 public function single_row( $network ) { … … 271 279 * 272 280 * @param WP_Network $network The current network object. 281 * @return void 273 282 */ 274 283 public function column_cb( $network ) { … … 280 289 281 290 ?> 282 <label class="screen-reader-text" for="network_<?php echo esc_attr( $network->id); ?>">291 <label class="screen-reader-text" for="network_<?php echo esc_attr( strval( $network->id ) ); ?>"> 283 292 <?php 284 293 printf( … … 289 298 ?> 290 299 </label> 291 <input type="checkbox" id="network_<?php echo esc_attr( $network->id ); ?>" name="all_networks[]" value="<?php echo esc_attr( $network->id); ?>">300 <input type="checkbox" id="network_<?php echo esc_attr( strval( $network->id ) ); ?>" name="all_networks[]" value="<?php echo esc_attr( strval( $network->id ) ); ?>"> 292 301 <?php 293 302 } … … 299 308 * 300 309 * @param WP_Network $network The current network object. 310 * @return void 301 311 */ 302 312 public function column_title( $network ) { … … 327 337 <strong> 328 338 <?php 329 echo $link; // phpcs:ignore WordPress. XSS.EscapeOutput.OutputNotEscaped330 echo $network_states; // phpcs:ignore WordPress. XSS.EscapeOutput.OutputNotEscaped339 echo $link; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 340 echo $network_states; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 331 341 ?> 332 342 </strong> … … 341 351 * 342 352 * @param WP_Network $network The current network object. 353 * @return void 343 354 */ 344 355 public function column_domain( $network ) { … … 352 363 * 353 364 * @param WP_Network $network The current network object. 365 * @return void 354 366 */ 355 367 public function column_path( $network ) { … … 363 375 * 364 376 * @param WP_Network $network The current network object. 377 * @return void 365 378 */ 366 379 public function column_blogs( $network ) { … … 380 393 * 381 394 * @param WP_Network $network The current network object. 395 * @return void 382 396 */ 383 397 public function column_admins( $network ) { … … 395 409 * 396 410 * @param WP_Network $network The current network object. 411 * @return void 397 412 */ 398 413 public function column_id( $network ) { 399 echo esc_html( $network->id);414 echo esc_html( strval( $network->id ) ); 400 415 } 401 416 … … 415 430 // Bail if not primary column. 416 431 if ( $primary !== $column_name ) { 417 return ;432 return ''; 418 433 } 419 434 … … 444 459 // Edit the network. 445 460 if ( current_user_can( 'edit_network', $network->id ) ) { 446 $edit_network_url = add_query_arg( 447 array( 448 'action' => 'edit_network', 449 ), 450 $base_url 451 ); 461 $edit_network_url = add_query_arg( array( 'action' => 'edit_network' ), $base_url ); 452 462 453 463 $actions['edit'] = '<span class="edit"><a href="' . esc_url( $edit_network_url ) . '">' . esc_html__( 'Edit', 'wp-multi-network' ) . '</a></span>'; … … 465 475 if ( $this->can_delete( $network ) ) { 466 476 $delete_network_url = wp_nonce_url( 467 add_query_arg( 468 array( 469 'action' => 'delete_network', 470 ), $base_url 471 ) 477 add_query_arg( array( 'action' => 'delete_network' ), $base_url ) 472 478 ); 473 479 … … 480 486 * @since 2.0.0 481 487 * 482 * @param array Action links as $slug => $link_markup pairs.483 * @param int The current network ID.484 * @param string The current network name.488 * @param array $filtered_acions Action links as $slug => $link_markup pairs. 489 * @param int $network_id The current network ID. 490 * @param string $network_sitename The current network name. 485 491 */ 486 $actions = apply_filters( 'manage_networks_action_links', array_filter( $actions ), $network->id, $network->sitename );492 $actions = apply_filters( 'manage_networks_action_links', $actions, $network->id, $network->site_name ); 487 493 488 494 // Return all row actions. -
wp-multi-network/trunk/wp-multi-network/includes/classes/class-wp-ms-rest-networks-controller.php
r2584493 r3414829 31 31 * 32 32 * @since 2.4.0 33 * @return void 33 34 */ 34 35 public function register_routes() { … … 100 101 * @since 2.4.0 101 102 * 102 * @param WP_REST_Request $request Full details about the request. 103 * @template T of WP_REST_Request 104 * @param T $request Full details about the request. 103 105 * 104 106 * @return WP_Error|bool True if the request has read access, error object otherwise. … … 113 115 * @since 2.4.0 114 116 * 115 * @param WP_REST_Request $request Full details about the request. 117 * @template T of WP_REST_Request 118 * @param T $request Full details about the request. 116 119 * 117 120 * @return WP_Error|WP_REST_Response Response object on success, or error object on failure. … … 194 197 } 195 198 196 $total_networks = (int)$query->found_networks;197 $max_pages = (int)$query->max_num_pages;199 $total_networks = $query->found_networks; 200 $max_pages = $query->max_num_pages; 198 201 199 202 if ( $total_networks < 1 ) { … … 204 207 $prepared_args['count'] = true; 205 208 206 $total_networks = $query->query( $prepared_args );207 $max_pages = ceil( $total_networks / $request['per_page'] );209 $total_networks = (int) $query->query( $prepared_args ); 210 $max_pages = (int) ceil( $total_networks / $request['per_page'] ); 208 211 } 209 212 210 213 $response = rest_ensure_response( $networks ); 211 $response->header( 'X-WP-Total', $total_networks);212 $response->header( 'X-WP-TotalPages', $max_pages);214 $response->header( 'X-WP-Total', strval( $total_networks ) ); 215 $response->header( 'X-WP-TotalPages', strval( $max_pages ) ); 213 216 214 217 $base = add_query_arg( $request->get_query_params(), rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ) ); … … 268 271 * @since 2.4.0 269 272 * 270 * @param WP_REST_Request $request Full details about the request. 273 * @template T of WP_REST_Request 274 * @param T $request Full details about the request. 271 275 * 272 276 * @return WP_Error|bool True if the request has read access for the item, error object otherwise. … … 286 290 * @since 2.4.0 287 291 * 288 * @param WP_REST_Request $request Full details about the request. 292 * @template T of WP_REST_Request 293 * @param T $request Full details about the request. 289 294 * 290 295 * @return WP_Error|WP_REST_Response Response object on success, or error object on failure. … … 307 312 * @since 2.4.0 308 313 * 309 * @param WP_REST_Request $request Full details about the request. 314 * @template T of WP_REST_Request 315 * @param T $request Full details about the request. 310 316 * 311 317 * @return WP_Error|bool True if the request has access to create items, error object otherwise. … … 320 326 * @since 2.4.0 321 327 * 322 * @param WP_REST_Request $request Full details about the request. 328 * @template T of WP_REST_Request 329 * @param T $request Full details about the request. 323 330 * 324 331 * @return WP_Error|WP_REST_Response Response object on success, or error object on failure. … … 405 412 * @since 2.4.0 406 413 * 407 * @param WP_REST_Request $request Full details about the request. 414 * @template T of WP_REST_Request 415 * @param T $request Full details about the request. 408 416 * 409 417 * @return WP_Error|bool True if the request has access to update the item, error object otherwise. … … 431 439 * @since 2.4.0 432 440 * 433 * @param WP_REST_Request $request Full details about the request. 441 * @template T of WP_REST_Request 442 * @param T $request Full details about the request. 434 443 * 435 444 * @return WP_Error|WP_REST_Response Response object on success, or error object on failure. … … 450 459 451 460 if ( ! empty( $prepared_args ) ) { 452 if ( is_wp_error( $prepared_args ) ) {453 return $prepared_args;454 }455 456 461 $domain = $prepared_args['domain']; 457 462 $path = $prepared_args['path']; … … 493 498 * @since 2.4.0 494 499 * 495 * @param WP_REST_Request $request Full details about the request. 500 * @template T of WP_REST_Request 501 * @param T $request Full details about the request. 496 502 * 497 503 * @return WP_Error|bool True if the request has access to delete the item, error object otherwise. … … 511 517 * @since 2.4.0 512 518 * 513 * @param WP_REST_Request $request Full details about the request. 519 * @template T of WP_REST_Request 520 * @param T $request Full details about the request. 514 521 * 515 522 * @return WP_Error|WP_REST_Response Response object on success, or error object on failure. … … 564 571 * @since 2.4.0 565 572 * 566 * @param WP_Network $network Network object. 567 * @param WP_REST_Request $request Request object. 573 * @template T of WP_REST_Request 574 * @param WP_Network $network Network object. 575 * @param T $request Request object. 568 576 * 569 577 * @return WP_REST_Response Response object. … … 609 617 * @param WP_Network $network Network object. 610 618 * 611 * @return array Links for the given network.619 * @return array<string, array<string, string>> Links for the given network. 612 620 */ 613 621 protected function prepare_links( $network ) { … … 651 659 * @since 2.4.0 652 660 * 653 * @param WP_REST_Request $request Request object. 654 * 655 * @return array|WP_Error Prepared network, otherwise WP_Error object. 661 * @template T of WP_REST_Request 662 * @param T $request Request object. 663 * 664 * @return array<string, string>|WP_Error Prepared network, otherwise WP_Error object. 656 665 */ 657 666 protected function prepare_item_for_database( $request ) { … … 688 697 * @since 2.4.0 689 698 * 690 * @return array 699 * @return array<string, mixed> 691 700 */ 692 701 public function get_item_schema() { … … 736 745 * @since 2.4.0 737 746 * 738 * @return array Networks collection parameters.747 * @return array<string, mixed> Networks collection parameters. 739 748 */ 740 749 public function get_collection_params() { … … 842 851 * @since 2.4.0 843 852 * 844 * @param WP_Network $network Network object. 845 * @param WP_REST_Request $request Request data to check. 853 * @template T of WP_REST_Request 854 * @param WP_Network $network Network object. 855 * @param T $request Request data to check. 846 856 * 847 857 * @return bool Whether the network can be read. -
wp-multi-network/trunk/wp-multi-network/includes/compat.php
r2584493 r3414829 57 57 * @param string $path Site path. 58 58 * @param string $site_id Optional. Site ID, if an existing site. Default 0. 59 * 59 60 * @return bool True if the site URL is valid, false otherwise. 60 61 */ 61 function wp_validate_site_url( $domain, $path, $site_id = 0) {62 function wp_validate_site_url( $domain, $path, $site_id = '0' ) { 62 63 global $wpdb; 63 64 … … 67 68 return true; 68 69 } 69 if ( true === $exists ) { 70 71 if ( true === (bool) $exists ) { 70 72 return false; 71 73 } … … 87 89 $pieces = array_filter( array_merge( $domains, $paths ) ); 88 90 foreach ( $pieces as $slug ) { 89 90 // Bail if empty.91 if ( empty( $slug ) ) {92 return false;93 }94 95 91 // Bail if not lowercase or numbers. 96 92 if ( preg_match( '/[^a-z0-9]+/', $slug ) ) { -
wp-multi-network/trunk/wp-multi-network/includes/deprecated.php
r2584493 r3414829 37 37 * @param string $value Upload path option value. 38 38 * @param int $blog_id Site ID. 39 * @return string 39 40 */ 40 41 function wpmn_fix_subsite_upload_path( $value, $blog_id ) { … … 55 56 add_filter( 'blog_option_upload_path', 'wpmn_fix_subsite_upload_path', 10, 2 ); 56 57 } 57 58 if ( ! function_exists( 'get_network_option' ) ) :59 /**60 * Gets an option from a given network.61 *62 * Switches to the specified network internally to operate on it.63 *64 * @since 1.0.065 * @deprecated66 *67 * @param int $network_id ID of network.68 * @param string $key Option key.69 * @param mixed $default Default value if option doesn't exist.70 * @return mixed Value set for the option if it exists, `$default` if it doesn't.71 * `WP_Error` instance if invalid network ID is passed.72 */73 function get_network_option( $network_id, $key, $default = false ) {74 if ( ! switch_to_network( $network_id, true ) ) {75 return new WP_Error(76 'wpmn.network_missing', __( 'Network does not exist', 'wp-multi-network' ), array(77 'status' => 400,78 )79 );80 }81 82 $result = get_site_option( $key, $default );83 84 restore_current_network();85 86 return $result;87 }88 endif;89 90 if ( ! function_exists( 'add_network_option' ) ) :91 /**92 * Adds an option from a given network.93 *94 * Switches to the specified network internally to operate on it.95 *96 * @since 1.0.097 * @deprecated98 *99 * @param int $network_id ID of network.100 * @param string $key Option key.101 * @param mixed $value Option value, can be anything.102 * @return bool|WP_Error True if the option is added, false if not added.103 * `WP_Error` instance if invalid network ID is passed.104 */105 function add_network_option( $network_id, $key, $value ) {106 if ( ! switch_to_network( $network_id, true ) ) {107 return new WP_Error(108 'wpmn.network_missing', __( 'Network does not exist', 'wp-multi-network' ), array(109 'status' => 400,110 )111 );112 }113 114 $result = add_site_option( $key, $value );115 116 restore_current_network();117 118 return $result;119 }120 endif;121 122 if ( ! function_exists( 'update_network_option' ) ) :123 /**124 * Updates an option from a given network.125 *126 * Switches to the specified network internally to operate on it.127 *128 * @since 1.0.0129 * @deprecated130 *131 * @param int $network_id ID of network.132 * @param string $key Option key.133 * @param mixed $value Option value, can be anything.134 * @return bool|WP_Error True if the option is updated, false if not updated.135 * `WP_Error` instance if invalid network ID is passed.136 */137 function update_network_option( $network_id, $key, $value ) {138 if ( ! switch_to_network( $network_id, true ) ) {139 return new WP_Error(140 'wpmn.network_missing', __( 'Network does not exist', 'wp-multi-network' ), array(141 'status' => 400,142 )143 );144 }145 146 $result = update_site_option( $key, $value );147 148 restore_current_network();149 150 return $result;151 }152 endif;153 154 if ( ! function_exists( 'delete_network_option' ) ) :155 /**156 * Deletes an option from a given network.157 *158 * Switches to the specified network internally to operate on it.159 *160 * @since 1.0.0161 * @deprecated162 *163 * @param int $network_id ID of network.164 * @param string $key Option key.165 * @return bool|WP_Error True if the option is deleted, false if not deleted.166 * `WP_Error` instance if invalid network ID is passed.167 */168 function delete_network_option( $network_id, $key ) {169 if ( ! switch_to_network( $network_id, true ) ) {170 return new WP_Error(171 'wpmn.network_missing', __( 'Network does not exist', 'wp-multi-network' ), array(172 'status' => 400,173 )174 );175 }176 177 $result = delete_site_option( $key );178 179 restore_current_network();180 181 return $result;182 }183 endif;184 185 if ( ! function_exists( 'get_networks' ) ) :186 /**187 * Gets all networks.188 *189 * @since 1.0.0190 * @deprecated191 *192 * @param array $args Optional. Network query arguments. Default empty array.193 * @return array Networks available on the installation.194 */195 function get_networks( $args = array() ) {196 197 // Support for WordPress 4.6.0, if you're doing something really weird.198 if ( class_exists( 'WP_Network_Query' ) ) {199 $query = new WP_Network_Query();200 201 return $query->query( $args );202 }203 204 // The original get_networks() function.205 return $GLOBALS['wpdb']->get_results( "SELECT * FROM {$GLOBALS['wpdb']->site}" );206 }207 endif; -
wp-multi-network/trunk/wp-multi-network/includes/functions.php
r2788090 r3414829 55 55 * 56 56 * @param int $user_id Optional. User ID. Default is the current user. 57 * @return array|bool Array of network IDs, or false if none.57 * @return int[]|bool Array of network IDs, or false if none. 58 58 */ 59 59 function user_has_networks( $user_id = 0 ) { … … 75 75 * @since 2.0.0 76 76 * 77 * @param array|bool|null List of network IDs or false. Anything but null will short-circuit78 * the process.79 * @param int User ID for which the networks should be returned.77 * @param array|bool|null $my_networks List of network IDs or false. Anything but null will short-circuit 78 * the process. 79 * @param int $user_id User ID for which the networks should be returned. 80 80 */ 81 81 $my_networks = apply_filters( 'networks_pre_user_is_network_admin', null, $user_id ); … … 90 90 * @since 2.0.0 91 91 * 92 * @param array|bool List of network IDs or false if no networks for the user.93 * @param int User ID for which the networks should be returned.92 * @param array|bool $my_networks List of network IDs or false if no networks for the user. 93 * @param int $user_id User ID for which the networks should be returned. 94 94 */ 95 95 return apply_filters( 'networks_user_is_network_admin', $my_networks, $user_id ); … … 121 121 * 122 122 * @param int|WP_Network $network Optional. Network ID or object. Default is the current network. 123 * @return int Main site ID for the network.123 * @return int|bool Main site ID for the network or false if network not found. 124 124 */ 125 125 function get_main_site_for_network( $network = null ) { … … 219 219 global $wpdb, $switched_network, $switched_network_stack, $current_site; 220 220 221 if ( empty( $new_network ) ) { 221 // Maybe fallback to current network. 222 if ( empty( $new_network ) || ! is_numeric( $new_network ) ) { 222 223 $new_network = $current_site->id; 223 224 } … … 250 251 } 251 252 252 $prev_site_id = $current_site->id; 253 $current_site = get_network( $new_network ); // phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited 253 $prev_site_id = $current_site->id; 254 $new_network_obj = get_network( $new_network ); 255 $current_site = $new_network_obj; // phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited 254 256 255 257 // Populate extra properties if not set already. … … 413 415 * @global wpdb $wpdb WordPress database abstraction object. 414 416 * 415 * @param array $args {417 * @param array<string, mixed> $args { 416 418 * Array of network arguments. 417 419 * … … 577 579 } 578 580 581 /** 582 * Fires after a new network blog has been added. 583 * 584 * @param int $new_blog_id ID of the added network blog. 585 * @param int $new_network_id ID of the added network. 586 * @param array $r Full associative array of network arguments. 587 * 588 * @since 2.5.3 589 */ 590 do_action( 'added_network_blog', $new_blog_id, $new_network_id, $r ); 591 592 // add new blog id as network meta data against the new network. 579 593 $r['network_meta']['main_site'] = $new_blog_id; 580 594 … … 601 615 $current_siteurl = get_option( 'siteurl' ); 602 616 $new_siteurl = untrailingslashit( get_blogaddress_by_id( $new_blog_id ) ); 603 $upload_url = str_replace( $current_siteurl, $new_siteurl, WP_CONTENT_URL);617 $upload_url = str_replace( $current_siteurl, $new_siteurl, content_url() ); 604 618 $upload_url = $upload_url . '/uploads'; 605 606 $ upload_dir = WP_CONTENT_DIR;607 if ( 0 === strpos( $upload_dir, ABSPATH) ) {608 $upload_dir = substr( $upload_dir, strlen( ABSPATH) );619 $upload_dir = WP_CONTENT_DIR; 620 $needle = strval( ABSPATH ); 621 if ( 0 === strpos( $upload_dir, $needle ) ) { 622 $upload_dir = substr( $upload_dir, strlen( $needle ) ); 609 623 } 610 624 $upload_dir .= '/uploads'; 611 625 612 if ( defined( 'MULTISITE' ) ) { 613 $ms_dir = '/sites/' . $new_blog_id; 614 } else { 615 $ms_dir = '/' . $new_blog_id; 626 // Check if wpmu_create_blog() already set the site-specific path. 627 $existing_upload_path = get_blog_option( $new_blog_id, 'upload_path' ); 628 $site_path_suffix = defined( 'MULTISITE' ) ? '/sites/' . $new_blog_id : '/' . $new_blog_id; 629 630 // Only add the site-specific path if it's not already present. 631 if ( empty( $existing_upload_path ) || false === strpos( $existing_upload_path, $site_path_suffix ) ) { 632 $upload_dir .= $site_path_suffix; 633 $upload_url .= $site_path_suffix; 634 update_blog_option( $new_blog_id, 'upload_path', $upload_dir ); 635 update_blog_option( $new_blog_id, 'upload_url_path', $upload_url ); 616 636 } 617 618 $upload_dir .= $ms_dir;619 $upload_url .= $ms_dir;620 621 update_blog_option( $new_blog_id, 'upload_path', $upload_dir );622 update_blog_option( $new_blog_id, 'upload_url_path', $upload_url );623 637 } 624 638 … … 664 678 clean_network_cache( $new_network_id ); 665 679 680 // Self-activate on new network. 681 $existing_plugins = get_network_option( $new_network_id, 'active_sitewide_plugins', array() ); 682 if ( ! isset( $existing_plugins['wp-multi-network/wpmn-loader.php'] ) ) { 683 $existing_plugins['wp-multi-network/wpmn-loader.php'] = time(); 684 update_network_option( $new_network_id, 'active_sitewide_plugins', $existing_plugins ); 685 } 686 666 687 /** 667 688 * Fires after a new network has been added. … … 706 727 707 728 // Bail if site URL is invalid. 708 if ( ! wp_validate_site_url( $domain, $path, $site_id) ) {729 if ( ! wp_validate_site_url( $domain, $path, strval( $site_id ) ) ) { 709 730 /* translators: %s: site domain and path */ 710 731 return new WP_Error( 'blog_bad', sprintf( __( 'The site "%s" is invalid, not available, or already exists.', 'wp-multi-network' ), $domain . $path ) ); … … 830 851 } 831 852 832 if ( true === $delete_blogs ) { 833 foreach ( $sites as $site ) { 834 if ( wp_should_rescue_orphaned_sites() ) { 835 move_site( $site->id, 0 ); 836 continue; 837 } 838 839 wpmu_delete_blog( $site->id, true ); 853 foreach ( $sites as $site ) { 854 if ( wp_should_rescue_orphaned_sites() ) { 855 move_site( $site->id, 0 ); 856 continue; 840 857 } 858 859 wpmu_delete_blog( $site->id, true ); 841 860 } 842 861 } … … 961 980 * @since 1.3.0 962 981 * 963 * @return arrayList of network option names.982 * @return string[] List of network option names. 964 983 */ 965 984 function network_options_list() { … … 986 1005 * @since 1.3.0 987 1006 * 988 * @return array List of network $option_name => $option_label pairs.1007 * @return array<string, string> List of network $option_name => $option_label pairs. 989 1008 */ 990 1009 function network_options_to_copy() { -
wp-multi-network/trunk/wp-multi-network/includes/metaboxes/edit-network.php
r2588851 r3414829 16 16 * 17 17 * @param WP_Network $network Optional. Network object. Default null. 18 * @return void 18 19 */ 19 20 function wpmn_edit_network_details_metabox( $network = null ) { 20 $domain = ! empty( $network->domain ) ? Requests_IDNAEncoder::encode( $network->domain ) : ''; 21 $path = ! empty( $network->path ) ? $network->path : '/'; 21 22 $domain = ! empty( $network->domain ) 23 ? $network->domain 24 : ''; 25 26 $path = ! empty( $network->path ) 27 ? $network->path 28 : '/'; 22 29 23 30 ?> 24 31 25 32 <table class="edit-network form-table"> 33 <?php do_action( 'wpmn_edit_network_details_metabox_before_group', $network ); ?> 34 26 35 <tr class="form-field form-required"> 27 36 <th scope="row"> … … 44 53 </td> 45 54 </tr> 55 56 <?php do_action( 'wpmn_edit_network_details_metabox_after_group', $network ); ?> 46 57 </table> 47 58 … … 53 64 * 54 65 * @since 1.7.0 66 * @return void 55 67 */ 56 68 function wpmn_edit_network_new_site_metabox() { … … 58 70 59 71 <table class="edit-network form-table"> 72 <?php do_action( 'wpmn_edit_network_new_site_metabox_before_group' ); ?> 73 60 74 <tr class="form-field form-required"> 61 75 <th scope="row"> … … 67 81 </td> 68 82 </tr> 83 84 <?php do_action( 'wpmn_edit_network_new_site_metabox_after_group' ); ?> 69 85 </table> 70 86 … … 78 94 * 79 95 * @param WP_Network $network Optional. Network object. Default null. 96 * @return void 80 97 */ 81 98 function wpmn_edit_network_assign_sites_metabox( $network = null ) { 82 99 $to = get_sites( 83 100 array( 84 'site__not_in' => get_main_site_id( $network->id),101 'site__not_in' => array( get_main_site_id( $network->id ) ), 85 102 'network_id' => $network->id, 86 103 ) … … 111 128 <?php if ( ( (int) $site->network_id !== (int) $network->id ) && ! is_main_site_for_network( $site->id ) ) : ?> 112 129 113 <option value="<?php echo esc_attr( $site->id); ?>">114 <?php echo esc_html( sprintf( '%1$s (%2$s%3$s)', $site-> name, $site->domain, $site->path ) ); ?>130 <option value="<?php echo esc_attr( strval( $site->id ) ); ?>"> 131 <?php echo esc_html( sprintf( '%1$s (%2$s%3$s)', $site->blogname, $site->domain, $site->path ) ); ?> 115 132 </option> 116 133 … … 132 149 <?php if ( (int) $site->network_id === (int) $network->id ) : ?> 133 150 134 <option value="<?php echo esc_attr( $site->id); ?>" <?php disabled( is_main_site_for_network( $site->id ) ); ?>>135 <?php echo esc_html( sprintf( '%1$s (%2$s%3$s)', $site-> name, $site->domain, $site->path ) ); ?>151 <option value="<?php echo esc_attr( strval( $site->id ) ); ?>" <?php disabled( is_main_site_for_network( $site->id ) ); ?>> 152 <?php echo esc_html( sprintf( '%1$s (%2$s%3$s)', $site->blogname, $site->domain, $site->path ) ); ?> 136 153 </option> 137 154 … … 154 171 * 155 172 * @param WP_Network $network Optional. Network object. Default null. 173 * @return void 156 174 */ 157 175 function wpmn_edit_network_publish_metabox( $network = null ) { … … 234 252 ?> 235 253 <input type="hidden" name="action" value="<?php echo esc_attr( $action ); ?>"> 236 <input type="hidden" name="network_id" value="<?php echo esc_attr( $network_id); ?>">254 <input type="hidden" name="network_id" value="<?php echo esc_attr( strval( $network_id ) ); ?>"> 237 255 </div> 238 256 <div class="clear"></div> -
wp-multi-network/trunk/wp-multi-network/includes/metaboxes/move-site.php
r2588851 r3414829 16 16 * 17 17 * @param WP_Site $site Optional. Site object. Default null. 18 * @return void 18 19 */ 19 20 function wpmn_move_site_list_metabox( $site = null ) { … … 78 79 * 79 80 * @param WP_Site $site Optional. Site object. Default null. 81 * @return void 80 82 */ 81 83 function wpmn_move_site_assign_metabox( $site = null ) { … … 139 141 ?> 140 142 <input type="hidden" name="action" value="move"> 141 <input type="hidden" name="from" value="<?php echo esc_attr( $site->network_id); ?>">143 <input type="hidden" name="from" value="<?php echo esc_attr( strval( $site->network_id ) ); ?>"> 142 144 </div> 143 145 <div class="clear"></div> -
wp-multi-network/trunk/wpmn-loader.php
r2788090 r3414829 16 16 * Text Domain: wp-multi-network 17 17 * Network: true 18 * Requires at least: 4.919 * Requires PHP: 5.220 * Tested up to: 6.118 * Requires at least: 5.5 19 * Requires PHP: 7.2 20 * Tested up to: 7.0 21 21 * Version: 2.5.2 22 22 */ … … 70 70 * @var string 71 71 */ 72 public $asset_version = 202108250001;72 public $asset_version = '202108250001'; 73 73 74 74 /** … … 111 111 * 112 112 * @since 1.3.0 113 * @return void 113 114 */ 114 115 private function constants() { … … 126 127 * 127 128 * @since 1.3.0 129 * @return void 128 130 */ 129 131 private function setup_globals() { … … 138 140 * 139 141 * @since 1.3.0 142 * @return void 140 143 */ 141 144 private function includes() { … … 166 169 167 170 $this->admin_bar = new WP_MS_Networks_Admin_Bar(); 171 $this->admin_bar->add_hooks(); 168 172 169 173 if ( defined( 'WPMN_DEPRECATED' ) && ( true === WPMN_DEPRECATED ) ) { … … 186 190 * 187 191 * @since 1.3.0 188 */ 189 function setup_multi_network() { 192 * @return void 193 */ 194 function setup_multi_network() { // phpcs:ignore Universal.Files.SeparateFunctionsFromOO.Mixed 190 195 wpmn(); 191 196 } … … 196 201 * 197 202 * @since 2.3.0 203 * @return void 198 204 */ 199 205 function setup_multi_network_endpoints() { … … 209 215 * 210 216 * @since 1.7.0 211 *212 217 * @return WPMN_Loader WP Multi Network instance to use. 213 218 */
Note: See TracChangeset
for help on using the changeset viewer.