Making WordPress.org

Changeset 13857


Ignore:
Timestamp:
06/25/2024 10:52:51 AM (20 months ago)
Author:
psrpinto
Message:

Translate: Sync "Translation Events" from GitHub

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-form-handler.php

    r13753 r13857  
    44
    55use DateTime;
     6use DateTimeImmutable;
    67use DateTimeZone;
    78use Exception;
     
    1516    private Notifications_Schedule $notifications_schedule;
    1617
    17     public function __construct( Event_Repository_Interface $event_repository ) {
     18    public function __construct( DateTimeImmutable $now, Event_Repository_Interface $event_repository ) {
    1819        $this->event_repository       = $event_repository;
    19         $this->notifications_schedule = new Notifications_Schedule( $this->event_repository );
     20        $this->notifications_schedule = new Notifications_Schedule( $now, $this->event_repository );
    2021    }
    2122
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/home.php

    r13822 r13857  
    2222
    2323<div class="event-page-wrapper">
    24     <div class="notice" style="padding: .5rem">
    25         <?php
    26         echo wp_kses(
    27             sprintf(
    28             // translators: %s is a link to a page about hosting events.
    29                 __( 'Do you want to host your own event? <a href="%s">Find more information here</a>.', 'gp-translation-events' ),
    30                 'https://make.wordpress.org/polyglots/2024/05/29/translation-events-inviting-gtes-to-create-and-manage-events/'
    31             ),
    32             array( 'a' => array( 'href' => array() ) )
    33         );
    34         ?>
    35     </div>
    3624<div class="event-left-col">
    3725<?php
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/new-design/parts/footer.php

    r13801 r13857  
    11<?php
     2namespace Wporg\TranslationEvents\Templates\NewDesign\Parts;
    23
    3 echo 'footer<br>';
    4 // TODO.
     4?>
     5
     6<div class="clear"></div>
     7<?php gp_tmpl_footer(); ?>
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/new-design/parts/header.php

    r13801 r13857  
    11<?php
     2namespace Wporg\TranslationEvents\Templates\NewDesign\Parts;
    23
    3 echo 'header<br>';
    4 // TODO.
     4use Wporg\TranslationEvents\Templates;
     5use Wporg\TranslationEvents\Urls;
     6
     7/** @var string $html_title */
     8/** @var string|callable $page_title */
     9/** @var string $url */
     10/** @var string $image_url */
     11/** @var string $html_description */
     12/** @var ?callable $sub_head */
     13/** @var ?string[] $breadcrumbs */
     14
     15$html_title       = $html_title ?? esc_html__( 'Translation Events', 'gp-translation-events' );
     16$url              = $url ?? Urls::events_home();
     17$html_description = $html_description ?? esc_html__( 'WordPress Translation Events', 'gp-translation-events' );
     18$image_url        = $image_url ?? Urls::event_default_image();
     19
     20gp_title( $html_title );
     21Templates::part( 'site-header', get_defined_vars() );
     22Templates::part( 'breadcrumbs', array( 'extra_items' => $breadcrumbs ?? array() ) );
     23
     24?>
     25
     26<div class="event-list-top-bar">
     27    <h2 class="event-page-title">
     28        <?php if ( is_callable( $page_title ) ) : ?>
     29            <?php $page_title(); ?>
     30        <?php else : ?>
     31            <?php echo esc_html( $page_title ); ?>
     32        <?php endif; ?>
     33    </h2>
     34
     35    <ul class="event-list-nav">
     36        <?php if ( is_user_logged_in() ) : ?>
     37            <?php if ( current_user_can( 'manage_translation_events' ) ) : ?>
     38                <li><a href="<?php echo esc_url( Urls::events_trashed() ); ?>">Deleted Events</a></li>
     39            <?php endif; ?>
     40            <li><a href="<?php echo esc_url( Urls::my_events() ); ?>">My Events</a></li>
     41            <?php if ( current_user_can( 'create_translation_event' ) ) : ?>
     42                <li><a class="button is-primary" href="<?php echo esc_url( Urls::event_create() ); ?>">Create Event</a></li>
     43            <?php endif; ?>
     44        <?php endif; ?>
     45    </ul>
     46
     47    <?php if ( isset( $sub_head ) && is_callable( $sub_head ) ) : ?>
     48        <p class="event-sub-head">
     49            <?php $sub_head(); ?>
     50        </p>
     51    <?php endif; ?>
     52</div>
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/parts/header.php

    r13801 r13857  
    1818$image_url        = $image_url ?? Urls::event_default_image();
    1919
     20// to-do: this action should be deleted when the new design is implemented, because it is in the "site-header" template.
    2021add_action(
    2122    'gp_head',
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/wporg-gp-translation-events.php

    r13800 r13857  
    260260     */
    261261    public function submit_event_ajax() {
    262         $form_handler = new Event_Form_Handler( self::get_event_repository(), self::get_attendee_repository() );
     262        $form_handler = new Event_Form_Handler( self::now(), self::get_event_repository() );
    263263        // Nonce verification is done by the form handler.
    264264        // phpcs:ignore WordPress.Security.NonceVerification.Missing
Note: See TracChangeset for help on using the changeset viewer.