Changeset 12813 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
- Timestamp:
- 08/08/2023 05:14:08 AM (16 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
r12617 r12813 800 800 * Generates a link to confirm a release. 801 801 * 802 * @param string $tag The tag to confirm. 802 803 * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post. 804 * @param string $what Optional. What operation to perform. Default: approve. 803 805 * @return string URL to enable confirmations. 804 806 */ 805 public static function get_release_confirmation_link( $tag, $post = null ) {807 public static function get_release_confirmation_link( $tag, $post = null, $what = 'approve' ) { 806 808 $post = get_post( $post ); 809 810 if ( 'approve' === $what ) { 811 $endpoint = 'plugin/%s/release-confirmation/%s'; 812 } elseif ( 'discard' === $what ) { 813 $endpoint = 'plugin/%s/release-confirmation/%s/discard'; 814 } else { 815 return ''; 816 } 817 818 $url = home_url( 'wp-json/plugins/v1/' . sprintf( $endpoint, urlencode( $post->post_name ), urlencode( $tag ) ) ); 807 819 808 820 return add_query_arg( 809 821 array( '_wpnonce' => wp_create_nonce( 'wp_rest' ) ), 810 home_url( 'wp-json/plugins/v1/plugin/' . $post->post_name . '/release-confirmation/' . $tag )822 $url 811 823 ); 812 824 }
Note: See TracChangeset
for help on using the changeset viewer.