Changeset 13690 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/urls.php
- Timestamp:
- 05/10/2024 12:42:51 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/urls.php
r13683 r13690 13 13 14 14 public static function event_details( int $event_id ): string { 15 return gp_url( wp_make_link_relative( get_the_permalink( $event_id ) ) ); 15 // Drafts don't yet have a slug, so we need to generate a sample permalink. 16 if ( 'draft' === get_post_status( $event_id ) ) { 17 // get_sample_permalink is only available in the admin, so we need to include the file in case we are elsewhere. 18 require_once ABSPATH . '/wp-admin/includes/post.php'; 19 list( $permalink, $post_name ) = get_sample_permalink( $event_id ); 20 $permalink = str_replace( '%pagename%', $post_name, $permalink ); 21 } else { 22 $permalink = get_permalink( $event_id ); 23 } 24 25 return gp_url( wp_make_link_relative( $permalink ) ); 16 26 } 17 27 18 28 public static function event_details_absolute( int $event_id ): string { 19 list( $permalink, $post_name ) = get_sample_permalink( $event_id ); 20 $permalink = str_replace( '%pagename%', $post_name, $permalink ); 21 22 return get_site_url() . gp_url( wp_make_link_relative( $permalink ) ); 29 return site_url( self::event_details( $event_id ) ); 23 30 } 24 31 … … 58 65 return self::event_details( $event_id ) . 'attendees/'; 59 66 } 67 68 public static function event_remove_attendee( int $event_id, int $user_id ): string { 69 return gp_url( "/events/$event_id/attendees/remove/$user_id" ); 70 } 60 71 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)