Changeset 13906
- Timestamp:
- 07/17/2024 11:19:52 AM (22 months ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events
- Files:
-
- 24 added
- 4 deleted
- 19 edited
-
assets/css/new-design.css (deleted)
-
assets/css/new-dotorg-design.css (deleted)
-
assets/css/translation-events.css (modified) (2 diffs)
-
autoload.php (modified) (2 diffs)
-
includes/attendee/attendee-repository.php (modified) (7 diffs)
-
includes/attendee/attendee.php (modified) (5 diffs)
-
includes/event/event-capabilities.php (modified) (4 diffs)
-
includes/event/event-form-handler.php (modified) (3 diffs)
-
includes/event/event-repository.php (modified) (5 diffs)
-
includes/event/event.php (modified) (6 diffs)
-
includes/routes/route.php (modified) (1 diff)
-
includes/routes/user/attend-event.php (modified) (3 diffs)
-
includes/routes/user/attendance-mode.php (added)
-
includes/routes/user/my-events.php (modified) (1 diff)
-
includes/templates.php (modified) (2 diffs)
-
includes/theme-loader.php (added)
-
includes/upgrade.php (modified) (2 diffs)
-
includes/urls.php (modified) (1 diff)
-
templates/event-attendees.php (modified) (3 diffs)
-
templates/event-details.php (modified) (2 diffs)
-
templates/home.php (modified) (1 diff)
-
templates/new-design (deleted)
-
templates/partials (deleted)
-
templates/parts/event-form.php (modified) (1 diff)
-
themes (added)
-
themes/wporg-translate-events-2024 (added)
-
themes/wporg-translate-events-2024/README.md (added)
-
themes/wporg-translate-events-2024/blocks (added)
-
themes/wporg-translate-events-2024/blocks/footer (added)
-
themes/wporg-translate-events-2024/blocks/footer/index.php (added)
-
themes/wporg-translate-events-2024/blocks/footer/render.php (added)
-
themes/wporg-translate-events-2024/blocks/header (added)
-
themes/wporg-translate-events-2024/blocks/header/index.php (added)
-
themes/wporg-translate-events-2024/blocks/header/render.php (added)
-
themes/wporg-translate-events-2024/blocks/header/site-header.php (added)
-
themes/wporg-translate-events-2024/blocks/pages (added)
-
themes/wporg-translate-events-2024/blocks/pages/events (added)
-
themes/wporg-translate-events-2024/blocks/pages/events/my-events (added)
-
themes/wporg-translate-events-2024/blocks/pages/events/my-events/index.php (added)
-
themes/wporg-translate-events-2024/blocks/pages/events/my-events/render.php (added)
-
themes/wporg-translate-events-2024/functions.php (added)
-
themes/wporg-translate-events-2024/index.php (added)
-
themes/wporg-translate-events-2024/style.css (added)
-
themes/wporg-translate-events-2024/templates (added)
-
themes/wporg-translate-events-2024/templates/index.html (added)
-
themes/wporg-translate-events-2024/theme.json (added)
-
wporg-gp-translation-events.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/assets/css/translation-events.css
r13800 r13906 89 89 margin-right: 1em; 90 90 margin-bottom: .5em; 91 width: 15em;91 width: 20em; 92 92 } 93 93 … … 472 472 border-color: var(----gp-color-btn-danger-hover-border); 473 473 } 474 form.add-remove-user-as-host .button { 475 margin-bottom: 4px; 476 } 477 478 p.onsite-btn-note { 479 font-size: .8em; 480 } 481 482 label.event-radio-label { 483 width: auto; 484 } 474 485 475 486 /* show the event-details-right below instead of on the right on mobile */ -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/autoload.php
r13800 r13906 3 3 require_once __DIR__ . '/includes/upgrade.php'; 4 4 require_once __DIR__ . '/includes/urls.php'; 5 require_once __DIR__ . '/includes/theme-loader.php'; 5 6 require_once __DIR__ . '/includes/templates.php'; 6 7 require_once __DIR__ . '/includes/routes/route.php'; … … 36 37 require_once __DIR__ . '/includes/routes/attendee/list.php'; 37 38 require_once __DIR__ . '/includes/routes/attendee/remove.php'; 39 require_once __DIR__ . '/includes/routes/user/attendance-mode.php'; -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/attendee/attendee-repository.php
r13753 r13906 16 16 $wpdb->query( 17 17 $wpdb->prepare( 18 "insert ignore into {$gp_table_prefix}event_attendees (event_id, user_id, is_host, is_new_contributor ) values (%d, %d, %d, %d)",18 "insert ignore into {$gp_table_prefix}event_attendees (event_id, user_id, is_host, is_new_contributor, is_remote) values (%d, %d, %d, %d, %d)", 19 19 array( 20 20 'event_id' => $attendee->event_id(), … … 22 22 'is_host' => $attendee->is_host() ? 1 : 0, 23 23 'is_new_contributor' => $attendee->is_new_contributor() ? 1 : 0, 24 'is_remote' => $attendee->is_remote() ? 1 : 0, 24 25 ), 25 26 ), … … 43 44 $wpdb->update( 44 45 "{$gp_table_prefix}event_attendees", 45 array( 'is_host' => $attendee->is_host() ? 1 : 0 ), 46 array( 47 'is_host' => $attendee->is_host() ? 1 : 0, 48 'is_remote' => $attendee->is_remote() ? 1 : 0, 49 ), 46 50 array( 47 51 'event_id' => $attendee->event_id(), … … 132 136 is_host, 133 137 is_new_contributor, 138 is_remote, 134 139 ( 135 140 select group_concat( distinct locale ) … … 159 164 '1' === $row->is_new_contributor, 160 165 null === $row->locales ? array() : explode( ',', $row->locales ), 166 '1' === $row->is_remote, 161 167 ); 162 168 }, … … 184 190 is_host, 185 191 is_new_contributor, 192 is_remote, 186 193 ( 187 194 select group_concat( distinct locale ) … … 209 216 '1' === $row->is_new_contributor, 210 217 null === $row->locales ? array() : explode( ',', $row->locales ), 218 '1' === $row->is_remote, 211 219 ); 212 220 }, -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/attendee/attendee.php
r13739 r13906 10 10 private bool $is_host; 11 11 private bool $is_new_contributor; 12 private bool $is_remote; 12 13 13 14 /** … … 19 20 * @throws Exception 20 21 */ 21 public function __construct( int $event_id, int $user_id, bool $is_host = false, $is_new_contributor = false, array $contributed_locales = array() ) {22 public function __construct( int $event_id, int $user_id, bool $is_host = false, $is_new_contributor = false, array $contributed_locales = array(), $is_remote = false ) { 22 23 if ( $event_id < 1 ) { 23 24 throw new Exception( 'invalid event id' ); … … 31 32 $this->is_host = $is_host; 32 33 $this->is_new_contributor = $is_new_contributor; 34 $this->is_remote = $is_remote; 33 35 $this->contributed_locales = $contributed_locales; 34 36 } … … 54 56 } 55 57 58 public function is_remote(): bool { 59 return $this->is_remote; 60 } 61 56 62 public function mark_as_host(): void { 57 63 $this->is_host = true; … … 66 72 } 67 73 74 public function mark_as_remote_attendee(): void { 75 $this->is_remote = true; 76 } 77 78 public function mark_as_in_person_attendee(): void { 79 $this->is_remote = false; 80 } 81 68 82 /** 69 83 * @return string[] -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-capabilities.php
r13800 r13906 13 13 14 14 class Event_Capabilities { 15 private const MANAGE = 'manage_translation_events'; 16 private const CREATE = 'create_translation_event'; 17 private const VIEW = 'view_translation_event'; 18 private const EDIT = 'edit_translation_event'; 19 private const TRASH = 'trash_translation_event'; 20 private const DELETE = 'delete_translation_event'; 21 private const EDIT_ATTENDEES = 'edit_translation_event_attendees'; 22 private const EDIT_TITLE = 'edit_translation_event_title'; 23 private const EDIT_DESCRIPTION = 'edit_translation_event_description'; 24 private const EDIT_START = 'edit_translation_event_start'; 25 private const EDIT_END = 'edit_translation_event_end'; 26 private const EDIT_TIMEZONE = 'edit_translation_event_timezone'; 15 private const MANAGE = 'manage_translation_events'; 16 private const CREATE = 'create_translation_event'; 17 private const VIEW = 'view_translation_event'; 18 private const EDIT = 'edit_translation_event'; 19 private const TRASH = 'trash_translation_event'; 20 private const DELETE = 'delete_translation_event'; 21 private const EDIT_ATTENDEES = 'edit_translation_event_attendees'; 22 private const EDIT_TITLE = 'edit_translation_event_title'; 23 private const EDIT_DESCRIPTION = 'edit_translation_event_description'; 24 private const EDIT_START = 'edit_translation_event_start'; 25 private const EDIT_END = 'edit_translation_event_end'; 26 private const EDIT_TIMEZONE = 'edit_translation_event_timezone'; 27 private const EDIT_ATTENDANCE_MODE = 'edit_translation_event_attendance_mode'; 27 28 28 29 /** … … 42 43 self::EDIT_END, 43 44 self::EDIT_TIMEZONE, 45 self::EDIT_ATTENDANCE_MODE, 44 46 ); 45 47 … … 85 87 case self::EDIT_END: 86 88 case self::EDIT_TIMEZONE: 89 case self::EDIT_ATTENDANCE_MODE: 87 90 if ( ! isset( $args[2] ) || ! is_numeric( $args[2] ) ) { 88 91 return false; … … 108 111 return $this->has_edit_attendees( $user, $event ); 109 112 } 110 if ( self::EDIT_TITLE === $cap || self::EDIT_DESCRIPTION === $cap || self::EDIT_START === $cap || self::EDIT_END === $cap || self::EDIT_TIMEZONE === $cap ) {113 if ( self::EDIT_TITLE === $cap || self::EDIT_DESCRIPTION === $cap || self::EDIT_START === $cap || self::EDIT_END === $cap || self::EDIT_TIMEZONE === $cap || self::EDIT_ATTENDANCE_MODE === $cap ) { 111 114 return $this->has_edit_field( $user, $event, $cap ); 112 115 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-form-handler.php
r13857 r13906 152 152 if ( current_user_can( 'edit_translation_event_end', $event->id() ) ) { 153 153 $event->set_end( $new_event->end() ); 154 } 155 if ( current_user_can( 'edit_translation_event_attendance_mode', $event->id() ) ) { 156 $event->set_attendance_mode( $new_event->attendance_mode() ); 154 157 } 155 158 } catch ( Exception $e ) { … … 198 201 // This will be sanitized by sanitize_post which is called in wp_insert_post. 199 202 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized 200 $description = isset( $data['event_description'] ) ? force_balance_tags( wp_unslash( $data['event_description'] ) ) : ''; 201 $event_start = isset( $data['event_start'] ) ? sanitize_text_field( wp_unslash( $data['event_start'] ) ) : ''; 202 $event_end = isset( $data['event_end'] ) ? sanitize_text_field( wp_unslash( $data['event_end'] ) ) : ''; 203 $event_timezone = isset( $data['event_timezone'] ) ? sanitize_text_field( wp_unslash( $data['event_timezone'] ) ) : ''; 203 $description = isset( $data['event_description'] ) ? force_balance_tags( wp_unslash( $data['event_description'] ) ) : ''; 204 $event_start = isset( $data['event_start'] ) ? sanitize_text_field( wp_unslash( $data['event_start'] ) ) : ''; 205 $event_end = isset( $data['event_end'] ) ? sanitize_text_field( wp_unslash( $data['event_end'] ) ) : ''; 206 $event_timezone = isset( $data['event_timezone'] ) ? sanitize_text_field( wp_unslash( $data['event_timezone'] ) ) : ''; 207 $attendance_mode = isset( $data['event_attendance_mode'] ) ? sanitize_text_field( wp_unslash( $data['event_attendance_mode'] ) ) : 'onsite'; 204 208 205 209 $event_status = ''; … … 234 238 $title, 235 239 $description, 240 $attendance_mode, 236 241 ); 237 242 $event->set_id( intval( $event_id ) ); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-repository.php
r13800 r13906 145 145 $post->post_title, 146 146 $post->post_content, 147 $meta['attendance_mode'], 147 148 ); 148 149 $event->set_id( $post->ID ); … … 532 533 $title = ' '; 533 534 } 535 if ( empty( $meta['attendance_mode'] ) ) { 536 $meta['attendance_mode'] = 'onsite'; 537 } 534 538 535 539 $event = new Event( … … 541 545 $title, 542 546 $post->post_content, 547 $meta['attendance_mode'], 543 548 ); 544 549 $event->set_id( $post->ID ); … … 577 582 578 583 return array( 579 'start' => new Event_Start_Date( $meta['_event_start'][0], $utc ), 580 'end' => new Event_End_Date( $meta['_event_end'][0], $utc ), 581 'timezone' => new DateTimeZone( $meta['_event_timezone'][0] ), 584 'start' => new Event_Start_Date( $meta['_event_start'][0], $utc ), 585 'end' => new Event_End_Date( $meta['_event_end'][0], $utc ), 586 'timezone' => new DateTimeZone( $meta['_event_timezone'][0] ), 587 'attendance_mode' => ! isset( $meta['_event_attendance_mode'][0] ) ? 'onsite' : $meta['_event_attendance_mode'][0], 582 588 ); 583 589 } … … 596 602 update_post_meta( $event->id(), '_event_timezone', $event->timezone()->getName() ); 597 603 update_post_meta( $event->id(), '_hosts', $hosts_ids ); 604 update_post_meta( $event->id(), '_event_attendance_mode', $event->attendance_mode() ); 598 605 } 599 606 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event.php
r13800 r13906 43 43 private string $title; 44 44 private string $description; 45 private string $attendance_mode; 45 46 46 47 /** … … 56 57 string $status, 57 58 string $title, 58 string $description 59 string $description, 60 string $attendance_mode = 'onsite' 59 61 ) { 60 62 $this->author_id = $author_id; … … 66 68 $this->set_title( $title ); 67 69 $this->set_description( $description ); 70 $this->set_attendance_mode( $attendance_mode ); 68 71 } 69 72 … … 103 106 public function is_past(): bool { 104 107 return $this->end->is_in_the_past(); 108 } 109 110 public function is_remote(): bool { 111 return 'remote' === $this->attendance_mode; 112 } 113 114 public function is_hybrid(): bool { 115 return 'hybrid' === $this->attendance_mode; 105 116 } 106 117 … … 145 156 } 146 157 158 public function attendance_mode(): string { 159 return $this->attendance_mode; 160 } 161 147 162 /** 148 163 * @throws InvalidStatus … … 163 178 } 164 179 180 public function set_attendance_mode( string $attendance_mode ): void { 181 $this->attendance_mode = $attendance_mode; 182 } 183 165 184 /** 166 185 * @throws InvalidStart -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/route.php
r13739 r13906 5 5 use GP_Route; 6 6 use Wporg\TranslationEvents\Templates; 7 use Wporg\TranslationEvents\Theme_Loader; 7 8 8 9 abstract class Route extends GP_Route { 10 private Theme_Loader $theme_loader; 11 private bool $use_theme = false; 12 13 public function __construct() { 14 parent::__construct(); 15 $this->theme_loader = new Theme_Loader( 'wporg-translate-events-2024' ); 16 } 17 9 18 public function tmpl( $template, $args = array(), $honor_api = true ) { 10 19 $this->set_notices_and_errors(); 11 20 $this->header( 'Content-Type: text/html; charset=utf-8' ); 12 21 13 Templates::render( $template, $args ); 22 if ( ! $this->use_theme ) { 23 $this->enqueue_legacy_styles(); 24 Templates::render( $template, $args ); 25 return; 26 } 27 28 $json = wp_json_encode( $args ); 29 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 30 echo do_blocks( "<!-- wp:wporg-translate-events-2024/page-events-$template $json /-->" ); 31 } 32 33 protected function use_theme( bool $also_in_production = false ): void { 34 if ( $also_in_production ) { 35 $this->use_theme = true; 36 } else { 37 // Only enable if new design has been explicitly enabled. 38 $this->use_theme = defined( 'TRANSLATION_EVENTS_NEW_DESIGN' ) && TRANSLATION_EVENTS_NEW_DESIGN; 39 } 40 41 if ( ! $this->use_theme ) { 42 return; 43 } 44 45 $this->theme_loader->load(); 46 } 47 48 private function enqueue_legacy_styles(): void { 49 wp_register_style( 50 'translation-events-css', 51 plugins_url( '/assets/css/translation-events.css', realpath( __DIR__ . '/../' ) ), 52 array( 'dashicons' ), 53 filemtime( __DIR__ . '/../../assets/css/translation-events.css' ) 54 ); 55 wp_enqueue_style( 'translation-events-css' ); 14 56 } 15 57 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/user/attend-event.php
r13753 r13906 32 32 33 33 public function handle( int $event_id ): void { 34 $nonce_name = '_attendee_nonce'; 35 if ( isset( $_POST['_attendee_nonce'] ) ) { 36 $nonce_value = sanitize_text_field( wp_unslash( $_POST['_attendee_nonce'] ) ); 37 if ( ! wp_verify_nonce( $nonce_value, $nonce_name ) ) { 38 $this->die_with_error( esc_html__( 'You are not authorized to change the attendance mode of this attendee', 'gp-translation-events' ), 403 ); 39 } 40 } 34 41 $user = wp_get_current_user(); 35 42 if ( ! $user ) { … … 47 54 } 48 55 49 $attendee = $this->attendee_repository->get_attendee_for_event_for_user( $event->id(), $user_id ); 56 $attendee = $this->attendee_repository->get_attendee_for_event_for_user( $event->id(), $user_id ); 57 $is_remote_attendee = isset( $_POST['attend_remotely'] ); 58 50 59 if ( $attendee instanceof Attendee ) { 51 60 if ( $attendee->is_contributor() ) { … … 54 63 $this->attendee_repository->remove_attendee( $event->id(), $user_id ); 55 64 } else { 56 $attendee = new Attendee( $event->id(), $user_id );65 $attendee = new Attendee( $event->id(), $user_id, false, false, array(), $is_remote_attendee ); 57 66 $this->attendee_adder->add_to_event( $event, $attendee ); 58 67 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/user/my-events.php
r13800 r13906 52 52 $current_user_attendee_per_event = $this->attendee_repository->get_attendees_for_events_for_user( $event_ids, $user_id ); 53 53 54 Templates::use_new_design();54 $this->use_theme(); 55 55 $this->tmpl( 56 56 'my-events', -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/templates.php
r13800 r13906 3 3 namespace Wporg\TranslationEvents; 4 4 5 /** 6 * Legacy (non-theme) templates. 7 */ 5 8 class Templates { 6 private static bool $use_new_design = false; 7 8 public static function use_new_design( bool $also_in_production = false ): void { 9 if ( $also_in_production ) { 10 // If it's enabled for production, it's also enabled for development, so it's always enabled. 11 self::$use_new_design = true; 12 } else { 13 // Only enable if new design has been explicitly enabled. 14 self::$use_new_design = defined( 'TRANSLATION_EVENTS_NEW_DESIGN' ) && TRANSLATION_EVENTS_NEW_DESIGN; 15 } 16 17 if ( self::$use_new_design ) { 18 wp_register_style( 19 'translation-events-new-design-css', 20 plugins_url( 'assets/css/new-design.css', __DIR__ ), 21 array( 'dashicons' ), 22 filemtime( __DIR__ . '/../assets/css/new-design.css' ) 23 ); 24 gp_enqueue_styles( 'translation-events-new-design-css' ); 25 } 26 } 27 28 public static function render( string $template, array $data = array() ) { 29 $template_path = __DIR__ . '/../templates/'; 30 if ( self::$use_new_design ) { 31 $template_path = $template_path . 'new-design/'; 32 } 33 34 gp_tmpl_load( $template, $data, $template_path ); 35 } 9 private const LEGACY_TEMPLATE_DIRECTORY = __DIR__ . '/../templates/'; 36 10 37 11 public static function header( array $data = array() ) { … … 43 17 } 44 18 45 public static function part( string $template, array $data ) {19 public static function part( string $template, array $data = array() ) { 46 20 self::render( "parts/$template", $data ); 47 21 } 22 23 public static function render( string $template, array $data = array() ) { 24 gp_tmpl_load( $template, $data, self::LEGACY_TEMPLATE_DIRECTORY ); 25 } 48 26 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/upgrade.php
r13739 r13906 7 7 8 8 class Upgrade { 9 private const VERSION = 3;9 private const VERSION = 4; 10 10 private const VERSION_OPTION = 'wporg_gp_translations_events_version'; 11 11 … … 63 63 `is_host` tinyint(1) default 0 not null comment 'Whether the user is a host of the event', 64 64 `is_new_contributor` tinyint(1) default 0 not null comment 'Whether the user is a new translation contributor', 65 `is_remote` tinyint(1) default 0 not null comment 'Whether the user attends the event remotely', 65 66 PRIMARY KEY (`translate_event_attendees_id`), 66 67 UNIQUE KEY `event_per_user` (`event_id`,`user_id`), -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/urls.php
r13753 r13906 89 89 return gp_url( "/events/$event_id/attendees/remove/$user_id" ); 90 90 } 91 92 public static function event_toggle_attendance_mode( int $event_id, int $user_id ): string { 93 return gp_url( "/events/attendance-mode/$event_id/$user_id" ); 94 } 91 95 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/event-attendees.php
r13801 r13906 32 32 <tr> 33 33 <th scope="col"><?php esc_html_e( 'Name', 'gp-translation-events' ); ?></th> 34 <th><?php esc_html_e( 'Remote', 'gp-translation-events' ); ?></th> 34 35 <th><?php esc_html_e( 'Host', 'gp-translation-events' ); ?></th> 35 36 <th><?php esc_html_e( 'Action', 'gp-translation-events' ); ?></th> … … 42 43 <a class="attendee-avatar" href="<?php echo esc_url( get_author_posts_url( $attendee->user_id() ) ); ?>" class="avatar"><?php echo get_avatar( $attendee->user_id(), 48 ); ?></a> 43 44 <a href="<?php echo esc_url( get_author_posts_url( $attendee->user_id() ) ); ?>" class="name"><?php echo esc_html( get_the_author_meta( 'display_name', $attendee->user_id() ) ); ?></a> 45 <?php if ( $attendee->is_new_contributor() ) : ?> 46 <span class="first-time-contributor-tada" title="<?php esc_attr_e( 'New Translation Contributor', 'gp-translation-events' ); ?>"></span> 47 <?php endif; ?> 48 </td> 49 <td> 50 <?php if ( $attendee->is_remote() ) : ?> 51 <span><?php esc_html_e( 'Yes', 'gp-translation-events' ); ?></span> 52 <?php endif; ?> 44 53 </td> 45 54 <td> … … 54 63 <?php else : ?> 55 64 <input type="submit" class="button is-secondary convert-to-host" value="<?php echo esc_attr__( 'Make co-host', 'gp-translation-events' ); ?>"/> 65 <?php endif; ?> 66 <?php if ( $event->is_hybrid() ) : ?> 67 <a href="<?php echo esc_url( Urls::event_toggle_attendance_mode( $event->id(), $attendee->user_id() ) ); ?>" class="button set-attendance-mode"><?php $attendee->is_remote() ? esc_html_e( 'Set as on-site', 'gp-translation-events' ) : esc_html_e( 'Set as remote', 'gp-translation-events' ); ?></a> 56 68 <?php endif; ?> 57 69 <?php if ( ! $attendee->is_host() ) : ?> -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/event-details.php
r13801 r13906 102 102 <a href="<?php echo esc_url( get_author_posts_url( $contributor->user_id() ) ); ?>" class="name"><?php echo esc_html( get_the_author_meta( 'display_name', $contributor->user_id() ) ); ?></a> 103 103 <?php if ( $contributor->is_new_contributor() ) : ?> 104 <span class="first-time-contributor-tada" title="<?php esc_ html_e( 'New Translation Contributor', 'gp-translation-events' ); ?>"></span>104 <span class="first-time-contributor-tada" title="<?php esc_attr_e( 'New Translation Contributor', 'gp-translation-events' ); ?>"></span> 105 105 <?php endif; ?> 106 106 </li> … … 285 285 <?php else : ?> 286 286 <form class="event-details-attend" method="post" action="<?php echo esc_url( Urls::event_toggle_attendee( $event->id() ) ); ?>"> 287 <?php wp_nonce_field( '_attendee_nonce', '_attendee_nonce' ); ?> 287 288 <?php if ( $user_is_attending ) : ?> 288 289 <input type="submit" class="button is-secondary attending-btn" value="<?php esc_attr_e( "You're attending", 'gp-translation-events' ); ?>" /> 289 290 <?php else : ?> 290 <input type="submit" class="button is-primary attend-btn" value="<?php esc_attr_e( 'Attend Event', 'gp-translation-events' ); ?>"/> 291 <?php if ( ! $event->is_remote() ) : ?> 292 <input type="submit" class="button is-primary attend-btn" value="<?php esc_attr_e( 'Attend Event On-site', 'gp-translation-events' ); ?>"/> 293 <?php if ( ! $event->is_hybrid() ) : ?> 294 <p class="onsite-btn-note"> 295 <?php echo wp_kses_post( __( '<strong>Note:</strong> This is an onsite-only event. Please only click attend if you are at the event. The host might otherwise remove you.', 'gp-translation-events' ) ); ?> 296 </p> 297 <?php endif; ?> 298 <?php endif; ?> 299 <?php if ( $event->is_remote() || $event->is_hybrid() ) : ?> 300 <input type="submit" name="attend_remotely" class="button is-primary attend-btn" value="<?php esc_attr_e( 'Attend Event Remotely', 'gp-translation-events' ); ?>"/> 301 <?php endif; ?> 291 302 <?php endif; ?> 292 303 </form> -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/home.php
r13857 r13906 20 20 ); 21 21 ?> 22 23 22 <div class="event-page-wrapper"> 23 <div class="notice" style="padding: .5rem"> 24 <?php 25 echo wp_kses( 26 sprintf( 27 // translators: %s is a link to a page about hosting events. 28 __( 'Do you want to host your own event? <a href="%s">Find more information here</a>.', 'gp-translation-events' ), 29 'https://make.wordpress.org/polyglots/2024/05/29/translation-events-inviting-gtes-to-create-and-manage-events/' 30 ), 31 array( 'a' => array( 'href' => array() ) ) 32 ); 33 ?> 34 </div> 24 35 <div class="event-left-col"> 25 36 <?php -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/parts/event-form.php
r13801 r13906 72 72 </select> 73 73 </div> 74 <div> 75 <label for="event-attendance-mode"><?php esc_html_e( 'Attendance Mode', 'gp-translation-events' ); ?></label> 76 <label class="event-radio-label" title="Attendees can attend remotely and on-site"> 77 <input type="radio" id="event-attendance-mode-hybrid" name="event_attendance_mode" <?php echo $event->is_hybrid() ? esc_attr( 'checked' ) : ''; ?> value="hybrid" required> 78 <?php esc_html_e( 'Hybrid (Remote and On-site)', 'gp-translation-events' ); ?> 79 </label> 80 <label class="event-radio-label" title="Attendees can only attend remotely"> 81 <input type="radio" id="event-attendance-mode-remote" name="event_attendance_mode" <?php echo $event->is_remote() ? esc_attr( 'checked' ) : ''; ?> value="remote" required> 82 <?php esc_html_e( 'Remote', 'gp-translation-events' ); ?> 83 </label> 84 <label class="event-radio-label" title="Attendees can only attend on-site"> 85 <input type="radio" id="event-attendance-mode-onsite" name="event_attendance_mode" <?php echo ! $event->is_hybrid() && ! $event->is_remote() ? esc_attr( 'checked' ) : ''; ?> value="onsite" required> 86 <?php esc_html_e( 'On-site', 'gp-translation-events' ); ?> 87 </label> 88 </div> 74 89 <div class="submit-btn-group"> 75 90 <label for="event-status"></label> -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/wporg-gp-translation-events.php
r13857 r13906 83 83 84 84 public function __construct() { 85 register_theme_directory( __DIR__ . '/themes' ); 86 85 87 add_action( 'wp_ajax_submit_event_ajax', array( $this, 'submit_event_ajax' ) ); 86 88 add_action( 'wp_ajax_nopriv_submit_event_ajax', array( $this, 'submit_event_ajax' ) ); … … 132 134 GP::$router->add( "/events/$slug/attendees", array( 'Wporg\TranslationEvents\Routes\Attendee\List_Route', 'handle' ) ); 133 135 GP::$router->add( "/events/$id/attendees/remove/$id", array( 'Wporg\TranslationEvents\Routes\Attendee\Remove_Attendee_Route', 'handle' ) ); 136 GP::$router->add( "/events/attendance-mode/$id/$id", array( 'Wporg\TranslationEvents\Routes\User\Attendance_Mode_Route', 'handle' ), 'get' ); 134 137 135 138 $stats_listener = new Stats_Listener( self::get_event_repository() ); 136 139 $stats_listener->start(); 140 } 141 142 public function register_translation_event_js() { 143 wp_register_script( 144 'translation-events-js', 145 plugins_url( 'assets/js/translation-events.js', __FILE__ ), 146 array( 'jquery', 'gp-common' ), 147 filemtime( __DIR__ . '/assets/js/translation-events.js' ), 148 false 149 ); 150 gp_enqueue_script( 'translation-events-js' ); 151 wp_localize_script( 152 'translation-events-js', 153 '$translation_event', 154 array( 155 'url' => admin_url( 'admin-ajax.php' ), 156 '_event_nonce' => wp_create_nonce( self::CPT ), 157 ) 158 ); 137 159 } 138 160 … … 266 288 } 267 289 268 public function register_translation_event_js() {269 wp_register_style( 'translation-events-css', plugins_url( 'assets/css/translation-events.css', __FILE__ ), array( 'dashicons' ), filemtime( __DIR__ . '/assets/css/translation-events.css' ) );270 gp_enqueue_styles( 'translation-events-css' );271 wp_register_script( 'translation-events-js', plugins_url( 'assets/js/translation-events.js', __FILE__ ), array( 'jquery', 'gp-common' ), filemtime( __DIR__ . '/assets/js/translation-events.js' ), false );272 gp_enqueue_script( 'translation-events-js' );273 wp_localize_script(274 'translation-events-js',275 '$translation_event',276 array(277 'url' => admin_url( 'admin-ajax.php' ),278 '_event_nonce' => wp_create_nonce( self::CPT ),279 )280 );281 }282 283 290 /** 284 291 * Handle the event status transition. … … 431 438 */ 432 439 public function wp_post_revision_meta_keys( array $keys ): array { 433 $meta_keys_to_keep = array( '_event_start', '_event_end', '_event_timezone', '_hosts' );440 $meta_keys_to_keep = array( '_event_start', '_event_end', '_event_timezone', '_hosts', '_event_attendance_mode' ); 434 441 return array_merge( $keys, $meta_keys_to_keep ); 435 442 }
Note: See TracChangeset
for help on using the changeset viewer.