Changeset 12336 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/inc/template-tags.php
- Timestamp:
- 12/15/2022 05:57:02 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/inc/template-tags.php
r11746 r12336 382 382 383 383 /** 384 * Display the Community Zone. 385 * 386 * Only shown if current user can edit the plugin and the plugin is tagged as 387 * 'community' in the plugin_business_model taxonomy. 388 */ 389 function the_plugin_community_zone() { 390 $post = get_post(); 391 $field_name = 'external_repository_url'; 392 393 if ( 'publish' !== $post->post_status ) { 394 return; 395 } 396 397 if ( ! current_user_can( 'plugin_admin_edit', $post ) ) { 398 return; 399 } 400 401 if ( ! has_term( 'community', 'plugin_business_model', $post ) ) { 402 return; 403 } 404 405 echo '<hr>'; 406 407 echo '<h2>' . esc_html__( 'Community Options', 'wporg-plugins' ) . '</h2>'; 408 409 echo '<p>' . esc_html__( 'This plugin is developed and supported by a community.', 'wporg-plugins' ) . '</p>'; 410 411 echo '<form id="community" class="categorization" method="POST">'; 412 echo '<p>'; 413 echo sprintf( '<label for="%s">', esc_attr( $field_name ) ) . esc_attr__( 'Development repository URL', 'wporg-plugins' ) . '</label>'; 414 $value = get_post_meta( $post->ID, $field_name, true ); 415 printf( 416 '<input id="%s" type="text" name="%s" value="%s" data-original-value="%s">', 417 esc_attr( $field_name ), 418 esc_attr( $field_name ), 419 esc_url( $value ), 420 esc_url( $value ) 421 ); 422 echo '<span class="help">' . esc_attr__( 'Optional. The URL where development happens, such as at github.com.', 'wporg-plugins' ) . '</span>'; 423 echo '</p>'; 424 echo '<p>'; 425 echo '<button class="button button-secondary" type="submit">' . esc_attr__( 'Save', 'wporg-plugins' ) . '</button>'; 426 echo '<span class="success-msg">' . __( 'Saved!', 'wporg-plugins' ) . '</span>'; 427 echo '</p>'; 428 echo '</form>'; 429 } 430 431 /** 432 * Display the Commercial Zone. 433 * 434 * Only shown if current user can edit the plugin and the plugin is tagged as 435 * 'commercial' in the plugin_business_model taxonomy. 436 */ 437 function the_plugin_commercial_zone() { 438 $post = get_post(); 439 $field_name = 'external_support_url'; 440 441 if ( ! current_user_can( 'plugin_admin_edit', $post ) ) { 442 return; 443 } 444 445 if ( ! has_term( 'commercial', 'plugin_business_model', $post ) ) { 446 return; 447 } 448 449 $can_edit = 'publish' === $post->post_status; 450 451 echo '<hr>'; 452 453 echo '<h2>' . esc_html__( 'Commercial Options', 'wporg-plugins' ) . '</h2>'; 454 455 echo '<p>' . esc_html__( 'This plugin is free but offers paid upgrades, support, and/or add-ons.', 'wporg-plugins' ) . '</p>'; 456 457 echo '<form id="commercial" class="categorization" method="POST">'; 458 echo '<p>'; 459 echo sprintf( '<label for="%s">', esc_attr( $field_name ) ) . esc_attr__( 'Commercial support URL', 'wporg-plugins' ) . '</label>'; 460 $value = get_post_meta( $post->ID, $field_name, true ); 461 printf( 462 '<input id="%s" type="text" name="%s" value="%s" data-original-value="%s">', 463 esc_attr( $field_name ), 464 esc_attr( $field_name ), 465 esc_url( $value ), 466 esc_url( $value ) 467 ); 468 echo '<span class="help">' . esc_attr__( 'Optional. The URL for plugin support, other than its support forum on wordpress.org.', 'wporg-plugins' ) . '</span>'; 469 echo '</p>'; 470 echo '<p>'; 471 echo '<button class="button button-secondary" type="submit">' . esc_attr__( 'Save', 'wporg-plugins' ) . '</button>'; 472 echo '<span class="success-msg">' . __( 'Saved!', 'wporg-plugins' ) . '</span>'; 473 echo '</p>'; 474 echo '</form>'; 475 } 476 477 /** 384 478 * Display the Danger Zone. 385 479 */
Note: See TracChangeset
for help on using the changeset viewer.