Changeset 62100
- Timestamp:
- 03/24/2026 12:18:06 PM (14 hours ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
-
wp-admin/options-writing.php (modified) (1 diff)
-
wp-includes/collaboration.php (modified) (1 diff)
-
wp-includes/default-constants.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/options-writing.php
r62078 r62100 113 113 <th scope="row"><?php _e( 'Collaboration' ); ?></th> 114 114 <td> 115 <?php if ( defined( 'WP_ALLOW_COLLABORATION' ) && false === WP_ALLOW_COLLABORATION ) : ?> 115 <?php if ( wp_is_collaboration_allowed() ) : ?> 116 <label for="wp_collaboration_enabled"> 117 <input name="wp_collaboration_enabled" type="checkbox" id="wp_collaboration_enabled" value="1" <?php checked( '1', (bool) get_option( 'wp_collaboration_enabled' ) ); ?> /> 118 <?php _e( "Enable early access to real-time collaboration. Real-time collaboration may affect your website's performance." ); ?> 119 </label> 120 <?php else : ?> 116 121 <div class="notice notice-warning inline"> 117 122 <p><?php _e( '<strong>Note:</strong> Real-time collaboration has been disabled.' ); ?></p> 118 123 </div> 119 <?php else : ?>120 <label for="wp_collaboration_enabled">121 <input name="wp_collaboration_enabled" type="checkbox" id="wp_collaboration_enabled" value="1" <?php checked( '1', (bool) get_option( 'wp_collaboration_enabled' ) ); ?> />122 <?php _e( 'Enable real-time collaboration' ); ?>123 </label>124 124 <?php endif; ?> 125 125 </td> -
trunk/src/wp-includes/collaboration.php
r62075 r62100 19 19 */ 20 20 function wp_is_collaboration_enabled() { 21 if ( ! defined( 'WP_ALLOW_COLLABORATION' ) || ! WP_ALLOW_COLLABORATION ) { 22 return false; 21 return ( 22 wp_is_collaboration_allowed() && 23 (bool) get_option( 'wp_collaboration_enabled' ) 24 ); 25 } 26 27 /** 28 * Determines whether real-time collaboration is allowed. 29 * 30 * If the WP_ALLOW_COLLABORATION constant is false, 31 * collaboration is not allowed and cannot be enabled. 32 * The constant defaults to true, unless the WP_ALLOW_COLLABORATION 33 * environment variable is set to string "false". 34 * 35 * @since 7.0.0 36 * 37 * @return bool Whether real-time collaboration is enabled. 38 */ 39 function wp_is_collaboration_allowed() { 40 if ( ! defined( 'WP_ALLOW_COLLABORATION' ) ) { 41 $env_value = getenv( 'WP_ALLOW_COLLABORATION' ); 42 if ( false === $env_value ) { 43 // Environment variable is not defined, default to allowing collaboration. 44 define( 'WP_ALLOW_COLLABORATION', true ); 45 } else { 46 /* 47 * Environment variable is defined, let's confirm it is actually set to 48 * "true" as it may still have a string value "false" – the preceeding 49 * `if` branch only tests for the boolean `false`. 50 */ 51 define( 'WP_ALLOW_COLLABORATION', 'true' === $env_value ); 52 } 23 53 } 24 54 25 return (bool) get_option( 'wp_collaboration_enabled' );55 return WP_ALLOW_COLLABORATION; 26 56 } 27 57 -
trunk/src/wp-includes/default-constants.php
r62075 r62100 399 399 define( 'WP_CRON_LOCK_TIMEOUT', MINUTE_IN_SECONDS ); 400 400 } 401 402 /**403 * Whether real time collaboration is permitted to be enabled.404 *405 * @since 7.0.0406 */407 if ( ! defined( 'WP_ALLOW_COLLABORATION' ) ) {408 $env_value = getenv( 'WP_ALLOW_COLLABORATION' );409 if ( false === $env_value ) {410 // Environment variable is not defined, default to allowing collaboration.411 define( 'WP_ALLOW_COLLABORATION', true );412 } else {413 /*414 * Environment variable is defined, let's confirm it is actually set to415 * "true" as it may still have a string value "false" – the preceeding416 * `if` branch only tests for the boolean `false`.417 */418 define( 'WP_ALLOW_COLLABORATION', 'true' === $env_value );419 }420 }421 401 } 422 402
Note: See TracChangeset
for help on using the changeset viewer.