Changeset 14503
- Timestamp:
- 07/31/2025 03:56:58 AM (6 months ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 3 edited
-
api/routes/class-plugin-release-confirmation.php (modified) (2 diffs)
-
class-template.php (modified) (1 diff)
-
shortcodes/class-release-confirmation.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin-release-confirmation.php
r14495 r14503 207 207 'location' => wp_get_referer() ?: home_url( '/developers/releases/' ), 208 208 ]; 209 210 $result['location'] = preg_replace( 211 '/(#.+)?$/', 212 '#releases-' . urlencode( $plugin->post_name ), 213 $result['location'] 214 ); 215 209 216 header( 'Location: ' . $result['location'] ); 210 217 … … 223 230 $release['confirmed'] = true; 224 231 $result['fully_confirmed'] = true; 232 } 233 234 // Store the release strategy if provided, overwriting any previous choice. 235 if ( isset( $request['rollout_strategy'] ) ) { 236 $release['rollout_strategy'] = wp_unslash( $request['rollout_strategy'] ); 225 237 } 226 238 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
r14262 r14503 1370 1370 return $sorted; 1371 1371 } 1372 1373 /** 1374 * Get the available rollout strategies for plugin updates. 1375 * 1376 * @return array 1377 */ 1378 static function get_rollout_strategies() { 1379 return [ 1380 '' => [ 1381 'name' => __( 'Immediate (default)', 'wporg-plugins' ), 1382 'description' => __( 'Plugin updates will be released to all sites as soon as they check for updates.', 'wporg-plugins' ), 1383 ], 1384 'manual-updates-24hr' => [ 1385 'name' => __( 'Manual updates only (24 hours)', 'wporg-plugins' ), 1386 'description' => __( 'Plugin updates will be released to all sites, but automatic updates will be disabled for 24 hours. After that, sites will receive the update as normal.', 'wporg-plugins' ), 1387 ], 1388 ]; 1389 } 1372 1390 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-release-confirmation.php
r14499 r14503 176 176 ), 177 177 self::get_actions( $plugin, $data ), 178 self::get_approval_text( $plugin, $data ) 178 self::get_approval_text( $plugin, $data ) . 179 self::get_rollout_strategy( $plugin, $data ) 179 180 ); 180 181 } … … 342 343 } 343 344 345 /** 346 * Display the Rollout Strategy options for a given plugin release. 347 * 348 * @param WP_Post $plugin The plugin post object. 349 * @param array $data The release data. 350 * @return string HTML for the rollout strategy options. 351 */ 352 static function get_rollout_strategy( $plugin, $data ) { 353 if ( ! current_user_can( 'plugin_manage_releases', $plugin ) ) { 354 return ''; 355 } 356 357 if ( ! $data['confirmations_required'] || ! empty( $data['discarded'] ) ) { 358 return ''; 359 } 360 361 $rollout = $data['rollout_strategy'] ?? ''; 362 if ( $data['confirmed'] && ! $rollout ) { 363 // If the release is confirmed, but no rollout strategy was set for the release, don't display the UI. 364 return ''; 365 } 366 367 ob_start(); 368 echo '<div class="release-strategy">'; 369 echo '<h3>' . __( 'Rollout Strategy', 'wporg-plugins' ) . '</h3>'; 370 371 echo '<select 372 id="rollout_strategy" 373 name="rollout_strategy" 374 onchange="this.nextElementSibling.innerText = this.options[this.selectedIndex].dataset.description;"' 375 . disabled( $data['confirmed'], true, false ) . 376 '>'; 377 foreach ( Template::get_rollout_strategies() as $slug => $set ) { 378 printf( 379 '<option value="%s" data-description="%s" %s>%s</option>', 380 esc_attr( $slug ), 381 esc_attr( $set['description'] ), 382 selected( $rollout, $slug, false ), 383 esc_html( $set['name'] ) 384 ); 385 } 386 echo '</select>'; 387 echo '<div class="help">' . esc_html( Template::get_rollout_strategies()[ $rollout ]['description'] ?? '' ) . '</div>'; 388 389 echo '</div>'; 390 391 return ob_get_clean(); 392 } 393 344 394 static function generate_access_url( $user = null ) { 345 395 return home_url( '/developers/releases/' );
Note: See TracChangeset
for help on using the changeset viewer.