<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[13739] sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events: Translate: Sync "Translation Events" from GitHub</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/13739">13739</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/13739","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>amieiro</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2024-05-21 11:43:05 +0000 (Tue, 21 May 2024)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Translate: Sync "Translation Events" from GitHub</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsREADMEmd">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/README.md</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsassetscsstranslationeventscss">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/assets/css/translation-events.css</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsautoloadphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/autoload.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesattendeeattendeerepositoryphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/attendee/attendee-repository.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesattendeeattendeephp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/attendee/attendee.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludeseventeventcapabilitiesphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-capabilities.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludeseventeventformhandlerphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-form-handler.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludeseventeventrepositoryphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-repository.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludeseventeventphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesroutesattendeelistphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/attendee/list.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesrouteseventcreatephp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/create.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesrouteseventdeletephp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/delete.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesrouteseventdetailsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/details.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesrouteseventeditphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/edit.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesrouteseventlisttrashedphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/list-trashed.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesrouteseventlistphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/list.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesrouteseventtrashphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/trash.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesroutesroutephp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/route.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesroutesuserattendeventphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/user/attend-event.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesroutesusermyeventsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/user/my-events.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesstatsstatscalculatorphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/stats/stats-calculator.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesupgradephp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/upgrade.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateseventtranslationsfooterphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/event-translations-footer.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateseventtranslationsheaderphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/event-translations-header.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateseventphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/event.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateseventsattendeesphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-attendees.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateseventsformphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-form.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateseventslisttrashedphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-list-trashed.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateseventslistphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-list.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateseventsmyeventsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-my-events.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateshelperfunctionsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/helper-functions.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplatestranslationsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/translations.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventswporggptranslationeventsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/wporg-gp-translation-events.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesattendeeattendeeadderphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/attendee/attendee-adder.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludestemplatesphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/templates.php</a></li>
<li>sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/partials/</li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplatespartialseventlistphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/partials/event-list.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplatespartialsfooterphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/partials/footer.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplatespartialsheaderphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/partials/header.php</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesstatsstatsimporterphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/stats/stats-importer.php</a></li>
<li>sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/translation/</li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateseventsheaderphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-header.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsREADMEmd"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/README.md</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/README.md    2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/README.md      2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -42,3 +42,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ```shell
</span><span class="cx" style="display: block; padding: 0 10px"> composer dev:test
</span><span class="cx" style="display: block; padding: 0 10px"> ```
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+If you want to run only one test, you can use the following command:
+
+```shell
+composer dev:test -- --filter methods_name
+```
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsassetscsstranslationeventscss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/assets/css/translation-events.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/assets/css/translation-events.css    2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/assets/css/translation-events.css      2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -135,7 +135,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">        font-weight: normal;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.event-list-item a {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/* Event title. */
+.event-list-item a:first-child {
</ins><span class="cx" style="display: block; padding: 0 10px">         font-weight: bold;
</span><span class="cx" style="display: block; padding: 0 10px">        font-size: 1.2em;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -145,6 +146,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">        margin-bottom: .5em;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.event-list-item-button {
+       text-decoration: none;
+       vertical-align: bottom;
+}
+.event-list-item-button:nth-child(2) { /* The first button. */
+       margin-left: .3em;
+}
+.event-list-item-button.is-destructive {
+       color: var(--gp-color-btn-danger-text);
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> li.event-list-item p {
</span><span class="cx" style="display: block; padding: 0 10px">        margin-top: 0;
</span><span class="cx" style="display: block; padding: 0 10px">        color: #5a5a5a;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -181,6 +193,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">        content: " | ";
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.events-links-to-anchors {
+       width: 80%;
+       margin: 0 auto;
+}
+
+.events-links-to-anchors li {
+       list-style-type: square;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> .event-left-col {
</span><span class="cx" style="display: block; padding: 0 10px">        width: 75%;
</span><span class="cx" style="display: block; padding: 0 10px">        float: left;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -333,11 +354,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        display: block;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.event-host {
-       display: flex;
-       grid-column: 1;
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> p.event-sub-head {
</span><span class="cx" style="display: block; padding: 0 10px">        grid-column: 1 / -1;
</span><span class="cx" style="display: block; padding: 0 10px">        margin-top: 0;
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsautoloadphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/autoload.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/autoload.php 2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/autoload.php   2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,6 +2,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/upgrade.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/urls.php';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+require_once __DIR__ . '/includes/templates.php';
</ins><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/templates/helper-functions.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/routes/route.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/routes/attendee/list.php';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,6 +19,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/routes/user/my-events.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/attendee/attendee.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/attendee/attendee-repository.php';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+require_once __DIR__ . '/includes/attendee/attendee-adder.php';
</ins><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/event/event-date.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/event/event.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/event/event-repository-interface.php';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -28,10 +30,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/notifications/notifications-send.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/event/event-capabilities.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/stats/stats-calculator.php';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-require_once __DIR__ . '/includes/stats/stats-importer.php';
</del><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/stats/stats-listener.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/project/project-repository.php';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-require_once __DIR__ . '/includes/translation/translation-repository.php';
</del><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/event-text-snippet.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/routes/attendee/list.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/routes/attendee/remove.php';
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesattendeeattendeeadderphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/attendee/attendee-adder.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/attendee/attendee-adder.php                         (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/attendee/attendee-adder.php   2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,92 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+namespace Wporg\TranslationEvents\Attendee;
+
+use Exception;
+use Wporg\TranslationEvents\Event\Event;
+use Wporg\TranslationEvents\Stats\Stats_Listener;
+
+class Attendee_Adder {
+       private Attendee_Repository $attendee_repository;
+
+       public function __construct( Attendee_Repository $attendee_repository ) {
+               $this->attendee_repository = $attendee_repository;
+       }
+
+       /**
+        * Add an attendee to an event.
+        *
+        * @param Event    $event    Event to which to add the attendee.
+        * @param Attendee $attendee Attendee to add to the event.
+        *
+        * @throws Exception
+        */
+       public function add_to_event( Event $event, Attendee $attendee ): void {
+               if ( $this->check_is_new_contributor( $event, $attendee->user_id() ) ) {
+                       $attendee->mark_as_new_contributor();
+               }
+
+               $this->attendee_repository->insert_attendee( $attendee );
+
+               // If the event is active right now,
+               // import stats for translations the user created since the event started.
+               if ( $event->is_active() ) {
+                       $this->import_stats( $event, $attendee );
+               }
+       }
+
+       private function import_stats( Event $event, Attendee $attendee ): void {
+               global $wpdb, $gp_table_prefix;
+               // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
+               // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery
+               // phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching
+               $wpdb->query(
+                       $wpdb->prepare(
+                               "
+                               insert ignore into {$gp_table_prefix}event_actions
+                                   (event_id, user_id, original_id, locale, action, happened_at)
+                               select %d, t.user_id, t.original_id, ts.locale, %s, t.date_added
+                               from {$gp_table_prefix}translations t,
+                                    {$gp_table_prefix}translation_sets ts
+                               where t.user_id = %d
+                                 and t.translation_set_id = ts.id
+                                 and t.status in ( 'current', 'waiting', 'changesrequested', 'fuzzy' )
+                                 and date_added between %s and %s
+                               ",
+                               array(
+                                       'event_id'          => $event->id(),
+                                       'action'            => Stats_Listener::ACTION_CREATE,
+                                       'user_id'           => $attendee->user_id(),
+                                       'date_added_after'  => $event->start()->utc()->format( 'Y-m-d H:i:s' ),
+                                       'date_added_before' => $event->end()->utc()->format( 'Y-m-d H:i:s' ),
+                               ),
+                       ),
+               );
+               // phpcs:enable
+       }
+
+       private function check_is_new_contributor( Event $event, int $user_id ): bool {
+               global $wpdb, $gp_table_prefix;
+
+               // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
+               // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery
+               // phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching
+               $translation_count = $wpdb->get_var(
+                       $wpdb->prepare(
+                               "
+                                       select count(*) as cnt
+                                       from {$gp_table_prefix}translations
+                                       where user_id = %d
+                                         and date_added < %s
+                               ",
+                               array(
+                                       $user_id,
+                                       $event->start()->format( 'Y-m-d H:i:s' ),
+                               ),
+                       )
+               );
+               // phpcs:enable
+
+               return intval( $translation_count ) <= 10;
+       }
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/attendee/attendee-adder.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesattendeeattendeerepositoryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/attendee/attendee-repository.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/attendee/attendee-repository.php    2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/attendee/attendee-repository.php      2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -15,11 +15,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">                // phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching
</span><span class="cx" style="display: block; padding: 0 10px">                $wpdb->query(
</span><span class="cx" style="display: block; padding: 0 10px">                        $wpdb->prepare(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                "insert ignore into {$gp_table_prefix}event_attendees (event_id, user_id, is_host) values (%d, %d, %d)",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         "insert ignore into {$gp_table_prefix}event_attendees (event_id, user_id, is_host, is_new_contributor) values (%d, %d, %d, %d)",
</ins><span class="cx" style="display: block; padding: 0 10px">                                 array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        'event_id' => $attendee->event_id(),
-                                       'user_id'  => $attendee->user_id(),
-                                       'is_host'  => $attendee->is_host() ? 1 : 0,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 'event_id'           => $attendee->event_id(),
+                                       'user_id'            => $attendee->user_id(),
+                                       'is_host'            => $attendee->is_host() ? 1 : 0,
+                                       'is_new_contributor' => $attendee->is_new_contributor() ? 1 : 0,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 ),
</span><span class="cx" style="display: block; padding: 0 10px">                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -97,6 +98,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                select
</span><span class="cx" style="display: block; padding: 0 10px">                                        user_id,
</span><span class="cx" style="display: block; padding: 0 10px">                                        is_host,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        is_new_contributor,
</ins><span class="cx" style="display: block; padding: 0 10px">                                         (
</span><span class="cx" style="display: block; padding: 0 10px">                                                select group_concat( distinct locale )
</span><span class="cx" style="display: block; padding: 0 10px">                                                from {$gp_table_prefix}event_actions
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -123,6 +125,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $event_id,
</span><span class="cx" style="display: block; padding: 0 10px">                        $row->user_id,
</span><span class="cx" style="display: block; padding: 0 10px">                        '1' === $row->is_host,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        '1' === $row->is_new_contributor,
</ins><span class="cx" style="display: block; padding: 0 10px">                         null === $row->locales ? array() : explode( ',', $row->locales ),
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -145,6 +148,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                select
</span><span class="cx" style="display: block; padding: 0 10px">                                        user_id,
</span><span class="cx" style="display: block; padding: 0 10px">                                        is_host,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        is_new_contributor,
</ins><span class="cx" style="display: block; padding: 0 10px">                                         (
</span><span class="cx" style="display: block; padding: 0 10px">                                                select group_concat( distinct locale )
</span><span class="cx" style="display: block; padding: 0 10px">                                                from {$gp_table_prefix}event_actions
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -168,6 +172,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $event_id,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $row->user_id,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '1' === $row->is_host,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        '1' === $row->is_new_contributor,
</ins><span class="cx" style="display: block; padding: 0 10px">                                         null === $row->locales ? array() : explode( ',', $row->locales ),
</span><span class="cx" style="display: block; padding: 0 10px">                                );
</span><span class="cx" style="display: block; padding: 0 10px">                        },
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesattendeeattendeephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/attendee/attendee.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/attendee/attendee.php       2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/attendee/attendee.php 2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,6 +8,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        private int $event_id;
</span><span class="cx" style="display: block; padding: 0 10px">        private int $user_id;
</span><span class="cx" style="display: block; padding: 0 10px">        private bool $is_host;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        private bool $is_new_contributor;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="cx" style="display: block; padding: 0 10px">         * @var string[]
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -17,7 +18,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="cx" style="display: block; padding: 0 10px">         * @throws Exception
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        public function __construct( int $event_id, int $user_id, bool $is_host = false, array $contributed_locales = array() ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function __construct( int $event_id, int $user_id, bool $is_host = false, $is_new_contributor = false, array $contributed_locales = array() ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 if ( $event_id < 1 ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        throw new Exception( 'invalid event id' );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -28,6 +29,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->event_id            = $event_id;
</span><span class="cx" style="display: block; padding: 0 10px">                $this->user_id             = $user_id;
</span><span class="cx" style="display: block; padding: 0 10px">                $this->is_host             = $is_host;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $this->is_new_contributor  = $is_new_contributor;
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->contributed_locales = $contributed_locales;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -43,6 +45,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                return $this->is_host;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        public function is_new_contributor(): bool {
+               return $this->is_new_contributor;
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         public function is_contributor(): bool {
</span><span class="cx" style="display: block; padding: 0 10px">                return ! empty( $this->contributed_locales );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -55,6 +61,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->is_host = false;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        public function mark_as_new_contributor(): void {
+               $this->is_new_contributor = true;
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         /**
</span><span class="cx" style="display: block; padding: 0 10px">         * @return string[]
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludeseventeventcapabilitiesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-capabilities.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-capabilities.php        2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-capabilities.php  2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -100,7 +100,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @return bool
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        private function has_manage( WP_User $user ): bool {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return $this->is_gp_admin( $user );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return apply_filters( 'gp_translation_events_can_crud_event', GP::$permission->user_can( $user, 'admin' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -110,7 +110,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @return bool
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        private function has_create( WP_User $user ): bool {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return $this->is_gp_admin( $user );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return $this->has_manage( $user );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -121,7 +121,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @return bool
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        private function has_view( WP_User $user, Event $event ): bool {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( $this->is_gp_admin( $user ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $this->has_manage( $user ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return true;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -157,7 +157,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        return true;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( $this->is_gp_admin( $user ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $this->has_manage( $user ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return true;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -174,6 +174,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @throws Exception
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        private function has_trash( WP_User $user, Event $event ): bool {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                if ( $this->has_manage( $user ) ) {
+                       return true;
+               }
+
+               if ( $this->stats_calculator->event_has_stats( $event->id() ) ) {
+                       return false;
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 if ( $event->author_id() === $user->ID ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        return true;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -183,10 +191,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        return true;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( $this->is_gp_admin( $user ) ) {
-                       return true;
-               }
-
</del><span class="cx" style="display: block; padding: 0 10px">                 return false;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -205,7 +209,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        return false;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( $this->is_gp_admin( $user ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $this->has_manage( $user ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return true;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -220,7 +224,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @return bool
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        private function has_edit_attendees( WP_User $user, Event $event ): bool {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( $this->is_gp_admin( $user ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $this->has_manage( $user ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return true;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -236,16 +240,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                return false;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        /**
-        * Evaluate whether a user is a GlotPress admin.
-        *
-        * @param WP_User $user User for which we're evaluating the capability.
-        * @return bool
-        */
-       private function is_gp_admin( WP_User $user ): bool {
-               return apply_filters( 'gp_translation_events_can_crud_event', GP::$permission->user_can( $user, 'admin' ) );
-       }
-
</del><span class="cx" style="display: block; padding: 0 10px">         public function register_hooks(): void {
</span><span class="cx" style="display: block; padding: 0 10px">                add_action(
</span><span class="cx" style="display: block; padding: 0 10px">                        'user_has_cap',
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludeseventeventformhandlerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-form-handler.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-form-handler.php        2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-form-handler.php  2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -97,10 +97,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        } catch ( InvalidStatus $e ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                wp_send_json_error( esc_html__( 'Invalid status.', 'gp-translation-events' ), 422 );
</span><span class="cx" style="display: block; padding: 0 10px">                                return;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        } catch ( InvalidTitle $e ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 }
+
+                       if ( empty( $new_event->title() ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 wp_send_json_error( esc_html__( 'Invalid title.', 'gp-translation-events' ), 422 );
</span><span class="cx" style="display: block; padding: 0 10px">                                return;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                         if ( $new_event->end() < new DateTime( 'now', new DateTimeZone( 'UTC' ) ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                wp_send_json_error( esc_html__( 'Past events cannot be created or edited.', 'gp-translation-events' ), 422 );
</span><span class="cx" style="display: block; padding: 0 10px">                                return;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -169,7 +172,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @throws InvalidStart
</span><span class="cx" style="display: block; padding: 0 10px">         * @throws InvalidEnd
</span><span class="cx" style="display: block; padding: 0 10px">         * @throws InvalidTimeZone
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * @throws InvalidTitle
</del><span class="cx" style="display: block; padding: 0 10px">          * @throws InvalidStatus
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        // phpcs:enable
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludeseventeventrepositoryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-repository.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-repository.php  2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-repository.php    2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -431,7 +431,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="cx" style="display: block; padding: 0 10px">         * @throws InvalidStart
</span><span class="cx" style="display: block; padding: 0 10px">         * @throws InvalidEnd
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * @throws InvalidTitle
</del><span class="cx" style="display: block; padding: 0 10px">          * @throws InvalidStatus
</span><span class="cx" style="display: block; padding: 0 10px">         * @throws Exception
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludeseventeventphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event.php     2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event.php       2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -25,12 +25,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class InvalidTitle extends Exception {
-       public function __construct( Throwable $previous = null ) {
-               parent::__construct( 'Event title is invalid', 0, $previous );
-       }
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> class InvalidStatus extends Exception {
</span><span class="cx" style="display: block; padding: 0 10px">        public function __construct( Throwable $previous = null ) {
</span><span class="cx" style="display: block; padding: 0 10px">                parent::__construct( 'Event status is invalid', 0, $previous );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -52,7 +46,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @throws InvalidStart
</span><span class="cx" style="display: block; padding: 0 10px">         * @throws InvalidEnd
</span><span class="cx" style="display: block; padding: 0 10px">         * @throws InvalidStatus
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * @throws InvalidTitle
</del><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        public function __construct(
</span><span class="cx" style="display: block; padding: 0 10px">                int $author_id,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -87,6 +80,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                return $this->end;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        public function is_published(): bool {
+               return 'publish' === $this->status;
+       }
+
+       public function is_draft(): bool {
+               return 'draft' === $this->status;
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         public function is_trashed(): bool {
</span><span class="cx" style="display: block; padding: 0 10px">                return 'trash' === $this->status;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -151,13 +152,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->status = $status;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        /**
-        * @throws InvalidTitle
-        */
</del><span class="cx" style="display: block; padding: 0 10px">         public function set_title( string $title ): void {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( ! $title ) {
-                       throw new InvalidTitle();
-               }
</del><span class="cx" style="display: block; padding: 0 10px">                 $this->title = $title;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesroutesattendeelistphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/attendee/list.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/attendee/list.php    2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/attendee/list.php      2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -27,7 +27,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                global $wp;
</span><span class="cx" style="display: block; padding: 0 10px">                $user             = wp_get_current_user();
</span><span class="cx" style="display: block; padding: 0 10px">                $is_active_filter = false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $hide_sub_head    = true;
</del><span class="cx" style="display: block; padding: 0 10px">                 if ( ! is_user_logged_in() ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        wp_safe_redirect( wp_login_url( home_url( $wp->request ) ) );
</span><span class="cx" style="display: block; padding: 0 10px">                        exit;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -44,7 +43,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                if ( ! current_user_can( 'edit_translation_event_attendees', $event->id() ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        $this->die_with_error( esc_html__( 'You do not have permission to edit this event\'s attendees.', 'gp-translation-events' ), 403 );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $attendees = array();
</del><span class="cx" style="display: block; padding: 0 10px">                 if ( gp_get( 'filter' ) && 'hosts' === gp_get( 'filter' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        $is_active_filter = true;
</span><span class="cx" style="display: block; padding: 0 10px">                        $attendees        = $this->attendee_repository->get_hosts( $event->id() );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -52,6 +50,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $attendees = $this->attendee_repository->get_attendees( $event->id() );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->tmpl( 'events-attendees', get_defined_vars() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->tmpl(
+                       'events-attendees',
+                       array(
+                               'event'            => $event,
+                               'attendees'        => $attendees,
+                               'is_active_filter' => $is_active_filter,
+                       ),
+               );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesrouteseventcreatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/create.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/create.php     2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/create.php       2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,6 +2,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> namespace Wporg\TranslationEvents\Routes\Event;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use DateTimeImmutable;
+use DateTimeZone;
+use Wporg\TranslationEvents\Event\Event;
</ins><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Event\Event_End_Date;
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Event\Event_Start_Date;
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Routes\Route;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -21,20 +24,24 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $this->die_with_error( 'You do not have permission to create events.' );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $event_page_title        = 'Create Event';
-               $event_form_name         = 'create_event';
-               $css_show_url            = 'hide-event-url';
-               $event_id                = null;
-               $event_title             = '';
-               $event_description       = '';
-               $event_url               = '';
-               $create_trash_button     = true;
-               $visibility_trash_button = 'none';
-               $event_timezone          = null;
-               $event_start             = new Event_Start_Date( date_i18n( 'Y - m - d H:i' ) );
-               $event_end               = new Event_End_Date( date_i18n( 'Y - m - d H:i' ) );
-               $event_slug              = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $now = new DateTimeImmutable( 'now', new DateTimeZone( 'UTC' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->tmpl( 'events-form', get_defined_vars() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $event = new Event(
+                       get_current_user_id(),
+                       new Event_Start_Date( $now->format( 'Y-m-d H:i:s' ) ),
+                       new Event_End_Date( $now->modify( '+1 hour' )->format( 'Y-m-d H:i:s' ) ),
+                       new DateTimeZone( 'UTC' ),
+                       'draft',
+                       '',
+                       '',
+               );
+
+               $this->tmpl(
+                       'events-form',
+                       array(
+                               'is_create_form' => true,
+                               'event'          => $event,
+                       ),
+               );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesrouteseventdeletephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/delete.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/delete.php     2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/delete.php       2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,11 +2,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> namespace Wporg\TranslationEvents\Routes\Event;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-use Wporg\TranslationEvents\Attendee\Attendee;
-use Wporg\TranslationEvents\Attendee\Attendee_Repository;
</del><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Event\Event_Repository_Interface;
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Routes\Route;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-use Wporg\TranslationEvents\Stats\Stats_Importer;
</del><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Translation_Events;
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Urls;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesrouteseventdetailsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/details.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/details.php    2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/details.php      2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -9,7 +9,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Project\Project_Repository;
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Routes\Route;
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Stats\Stats_Calculator;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-use Wporg\TranslationEvents\Translation\Translation_Repository;
</del><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Translation_Events;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,17 +17,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> class Details_Route extends Route {
</span><span class="cx" style="display: block; padding: 0 10px">        private Event_Repository_Interface $event_repository;
</span><span class="cx" style="display: block; padding: 0 10px">        private Attendee_Repository $attendee_repository;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        private Translation_Repository $translation_repository;
</del><span class="cx" style="display: block; padding: 0 10px">         private Project_Repository $project_repository;
</span><span class="cx" style="display: block; padding: 0 10px">        private Stats_Calculator $stats_calculator;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        public function __construct() {
</span><span class="cx" style="display: block; padding: 0 10px">                parent::__construct();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->event_repository       = Translation_Events::get_event_repository();
-               $this->attendee_repository    = Translation_Events::get_attendee_repository();
-               $this->translation_repository = new Translation_Repository();
-               $this->project_repository     = new Project_Repository();
-               $this->stats_calculator       = new Stats_Calculator();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->event_repository    = Translation_Events::get_event_repository();
+               $this->attendee_repository = Translation_Events::get_attendee_repository();
+               $this->project_repository  = new Project_Repository();
+               $this->stats_calculator    = new Stats_Calculator();
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        public function handle( string $event_slug ): void {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -46,12 +43,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $this->die_with_error( esc_html__( 'You are not authorized to view this page.', 'gp-translation-events' ), 403 );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $event_id          = $event->id();
-               $event_title       = $event->title();
-               $event_description = $event->description();
-               $event_start       = $event->start();
-               $event_end         = $event->end();
-
</del><span class="cx" style="display: block; padding: 0 10px">                 $projects              = $this->project_repository->get_for_event( $event->id() );
</span><span class="cx" style="display: block; padding: 0 10px">                $attendees             = $this->attendee_repository->get_attendees( $event->id() );
</span><span class="cx" style="display: block; padding: 0 10px">                $current_user_attendee = $attendees[ $user->ID ] ?? null;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -79,21 +70,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $contributor_ids = array_map(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $new_contributor_ids = array_filter(
+                       $contributors,
</ins><span class="cx" style="display: block; padding: 0 10px">                         function ( Attendee $contributor ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                return $contributor->user_id();
-                       },
-                       $contributors
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         return $contributor->is_new_contributor();
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px">                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $new_contributor_ids = array();
-               $translations_counts = $this->translation_repository->count_translations_before( $contributor_ids, $event->start() );
-               foreach ( $translations_counts as $user_id => $count ) {
-                       if ( $count <= 10 ) {
-                               $new_contributor_ids[ $user_id ] = true;
-                       }
-               }
-
</del><span class="cx" style="display: block; padding: 0 10px">                 try {
</span><span class="cx" style="display: block; padding: 0 10px">                        $event_stats = $this->stats_calculator->for_event( $event->id() );
</span><span class="cx" style="display: block; padding: 0 10px">                } catch ( Exception $e ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -102,6 +85,20 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $this->die_with_error( esc_html__( 'Failed to calculate event stats', 'gp-translation-events' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->tmpl( 'event', get_defined_vars() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->tmpl(
+                       'event',
+                       array(
+                               'event'                      => $event,
+                               'user_is_attending'          => $user_is_attending,
+                               'user_is_contributor'        => $user_is_contributor,
+                               'hosts'                      => $hosts,
+                               'attendees_not_contributing' => $attendees_not_contributing,
+                               'contributors'               => $contributors,
+                               'new_contributor_ids'        => $new_contributor_ids,
+                               'event_stats'                => $event_stats,
+                               'projects'                   => $projects,
+                               'user'                       => $user,
+                       ),
+               );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesrouteseventeditphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/edit.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/edit.php       2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/edit.php 2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5,7 +5,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Event\Event_Repository_Interface;
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Routes\Route;
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Translation_Events;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-use Wporg\TranslationEvents\Urls;
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * Displays the event edit page.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -35,20 +34,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                include ABSPATH . 'wp-admin/includes/post.php';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $event_page_title        = 'Edit Event';
-               $event_form_name         = 'edit_event';
-               $css_show_url            = '';
-               $event_title             = $event->title();
-               $event_description       = $event->description();
-               $event_status            = $event->status();
-               $event_url               = Urls::event_details_absolute( $event_id );
-               $event_timezone          = $event->timezone();
-               $event_start             = $event->start();
-               $event_end               = $event->end();
-               $event_slug              = $event->slug();
-               $create_trash_button     = current_user_can( 'trash_translation_event', $event->id() );
-               $visibility_trash_button = 'inline-flex';
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->tmpl( 'events-form', get_defined_vars() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->tmpl(
+                       'events-form',
+                       array(
+                               'is_create_form' => false,
+                               'event'          => $event,
+                       ),
+               );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesrouteseventlisttrashedphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/list-trashed.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/list-trashed.php       2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/list-trashed.php 2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -40,6 +40,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $trashed_events_query = $this->event_repository->get_trashed_events( $current_page, 10 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->tmpl( 'events-list-trashed', get_defined_vars() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->tmpl(
+                       'events-list-trashed',
+                       array(
+                               'trashed_events_query' => $trashed_events_query,
+                       ),
+               );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesrouteseventlistphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/list.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/list.php       2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/list.php 2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -68,6 +68,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $past_events_query           = $this->event_repository->get_past_events( $_past_events_paged, 10 );
</span><span class="cx" style="display: block; padding: 0 10px">                $user_attending_events_query = $this->event_repository->get_current_and_upcoming_events_for_user( get_current_user_id(), $_user_attending_events_paged, 10 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->tmpl( 'events-list', get_defined_vars() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->tmpl(
+                       'events-list',
+                       array(
+                               'current_events_query'        => $current_events_query,
+                               'upcoming_events_query'       => $upcoming_events_query,
+                               'past_events_query'           => $past_events_query,
+                               'user_attending_events_query' => $user_attending_events_query,
+                       ),
+               );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesrouteseventtrashphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/trash.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/trash.php      2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/event/trash.php        2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,11 +2,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> namespace Wporg\TranslationEvents\Routes\Event;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-use Wporg\TranslationEvents\Attendee\Attendee;
-use Wporg\TranslationEvents\Attendee\Attendee_Repository;
</del><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Event\Event_Repository_Interface;
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Routes\Route;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-use Wporg\TranslationEvents\Stats\Stats_Importer;
</del><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Translation_Events;
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Urls;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -42,13 +39,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                if ( ! $event->is_trashed() ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        // Trash.
</span><span class="cx" style="display: block; padding: 0 10px">                        $this->event_repository->trash_event( $event );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        wp_safe_redirect( Urls::events_home() );
</ins><span class="cx" style="display: block; padding: 0 10px">                 } else {
</span><span class="cx" style="display: block; padding: 0 10px">                        // Restore.
</span><span class="cx" style="display: block; padding: 0 10px">                        $event->set_status( 'draft' );
</span><span class="cx" style="display: block; padding: 0 10px">                        $this->event_repository->update_event( $event );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        wp_safe_redirect( Urls::event_edit( $event->id() ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                wp_safe_redirect( Urls::event_edit( $event->id() ) );
</del><span class="cx" style="display: block; padding: 0 10px">                 exit;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesroutesroutephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/route.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/route.php    2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/route.php      2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3,10 +3,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> namespace Wporg\TranslationEvents\Routes;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> use GP_Route;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use Wporg\TranslationEvents\Templates;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> abstract class Route extends GP_Route {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        public function __construct() {
-               parent::__construct();
-               $this->template_path = __DIR__ . '/../../templates/';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function tmpl( $template, $args = array(), $honor_api = true ) {
+               $this->set_notices_and_errors();
+               $this->header( 'Content-Type: text/html; charset=utf-8' );
+
+               Templates::render( $template, $args );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesroutesuserattendeventphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/user/attend-event.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/user/attend-event.php        2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/user/attend-event.php  2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3,10 +3,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> namespace Wporg\TranslationEvents\Routes\User;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Attendee\Attendee;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use Wporg\TranslationEvents\Attendee\Attendee_Adder;
</ins><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Attendee\Attendee_Repository;
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Event\Event_Repository_Interface;
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Routes\Route;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-use Wporg\TranslationEvents\Stats\Stats_Importer;
</del><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Translation_Events;
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Urls;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -21,13 +21,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> class Attend_Event_Route extends Route {
</span><span class="cx" style="display: block; padding: 0 10px">        private Event_Repository_Interface $event_repository;
</span><span class="cx" style="display: block; padding: 0 10px">        private Attendee_Repository $attendee_repository;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        private Stats_Importer $stats_importer;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ private Attendee_Adder $attendee_adder;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        public function __construct() {
</span><span class="cx" style="display: block; padding: 0 10px">                parent::__construct();
</span><span class="cx" style="display: block; padding: 0 10px">                $this->event_repository    = Translation_Events::get_event_repository();
</span><span class="cx" style="display: block; padding: 0 10px">                $this->attendee_repository = Translation_Events::get_attendee_repository();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->stats_importer      = new Stats_Importer();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->attendee_adder      = Translation_Events::get_attendee_adder();
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        public function handle( int $event_id ): void {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -54,13 +54,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $this->attendee_repository->remove_attendee( $event->id(), $user_id );
</span><span class="cx" style="display: block; padding: 0 10px">                } else {
</span><span class="cx" style="display: block; padding: 0 10px">                        $attendee = new Attendee( $event->id(), $user_id );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $this->attendee_repository->insert_attendee( $attendee );
-
-                       // If the event is active right now,
-                       // import stats for translations the user created since the event started.
-                       if ( $event->is_active() ) {
-                               $this->stats_importer->import_for_user_and_event( $user_id, $event );
-                       }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $this->attendee_adder->add_to_event( $event, $attendee );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                wp_safe_redirect( Urls::event_details( $event->id() ) );
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesroutesusermyeventsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/user/my-events.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/user/my-events.php   2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/user/my-events.php     2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -25,11 +25,18 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">                include ABSPATH . 'wp-admin/includes/post.php';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $_events_i_created_paged  = 1;
-               $_events_i_hosted_paged   = 1;
-               $_events_i_attended_paged = 1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $_events_i_am_or_will_attend_paged = 1;
+               $_events_i_created_paged           = 1;
+               $_events_i_hosted_paged            = 1;
+               $_events_i_attended_paged          = 1;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // phpcs:disable WordPress.Security.NonceVerification.Recommended
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                if ( isset( $_GET['events_i_am_or_will_attend_paged'] ) ) {
+                       $value = sanitize_text_field( wp_unslash( $_GET['events_i_am_or_will_attend_paged'] ) );
+                       if ( is_numeric( $value ) ) {
+                               $_events_i_am_or_will_attend_paged = (int) $value;
+                       }
+               }
</ins><span class="cx" style="display: block; padding: 0 10px">                 if ( isset( $_GET['events_i_created_paged'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        $value = sanitize_text_field( wp_unslash( $_GET['events_i_created_paged'] ) );
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( is_numeric( $value ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -50,10 +57,19 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">                // phpcs:enable
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $events_i_created_query  = $this->event_repository->get_events_created_by_user( get_current_user_id(), $_events_i_created_paged, 10 );
-               $events_i_host_query     = $this->event_repository->get_events_hosted_by_user( get_current_user_id(), $_events_i_hosted_paged, 10 );
-               $events_i_attended_query = $this->event_repository->get_past_events_for_user( get_current_user_id(), $_events_i_attended_paged, 10 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $events_i_am_or_will_attend_query = $this->event_repository->get_current_and_upcoming_events_for_user( get_current_user_id(), $_events_i_am_or_will_attend_paged, 10 );
+               $events_i_created_query           = $this->event_repository->get_events_created_by_user( get_current_user_id(), $_events_i_created_paged, 10 );
+               $events_i_host_query              = $this->event_repository->get_events_hosted_by_user( get_current_user_id(), $_events_i_hosted_paged, 10 );
+               $events_i_attended_query          = $this->event_repository->get_past_events_for_user( get_current_user_id(), $_events_i_attended_paged, 10 );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->tmpl( 'events-my-events', get_defined_vars() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->tmpl(
+                       'events-my-events',
+                       array(
+                               'events_i_am_or_will_attend_query' => $events_i_am_or_will_attend_query,
+                               'events_i_created_query'           => $events_i_created_query,
+                               'events_i_host_query'              => $events_i_host_query,
+                               'events_i_attended_query'          => $events_i_attended_query,
+                       ),
+               );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesstatsstatscalculatorphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/stats/stats-calculator.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/stats/stats-calculator.php  2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/stats/stats-calculator.php    2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -97,15 +97,24 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $rows = $wpdb->get_results(
</span><span class="cx" style="display: block; padding: 0 10px">                        $wpdb->prepare(
</span><span class="cx" style="display: block; padding: 0 10px">                                "
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                select locale,
-                                       sum(action = 'create') as created,
-                                       count(*) as total,
-                                       sum(t.status = 'waiting') as waiting,
-                                       count(distinct ea.user_id) as users
-                               from {$gp_table_prefix}event_actions ea
-                               left join {$gp_table_prefix}translations t ON ea.original_id = t.original_id and ea.user_id = t.user_id
-                               where event_id = %d
-                               group by locale with rollup
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         SELECT
+                                       ea.locale,
+                                       SUM( ea.action = 'create' ) AS created,
+                                       count( ea.translate_event_actions_id ) AS total,
+                                       SUM( t.status = 'waiting' ) AS waiting,
+                                       COUNT( DISTINCT ea.user_id ) AS users
+                               FROM
+                                       {$gp_table_prefix}event_actions AS ea
+                               LEFT JOIN
+                                       {$gp_table_prefix}translation_sets AS ts ON ea.locale = ts.locale
+                               LEFT JOIN
+                                       {$gp_table_prefix}translations AS t ON ea.original_id = t.original_id
+                               WHERE
+                                       ea.event_id = %d
+                                       AND ts.id = t.translation_set_id
+                                       AND t.status IN ( 'current', 'waiting', 'fuzzy', 'changesrequested' )
+                               GROUP BY
+                                       ea.locale with rollup;
</ins><span class="cx" style="display: block; padding: 0 10px">                         ",
</span><span class="cx" style="display: block; padding: 0 10px">                                array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        $event_id,
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesstatsstatsimporterphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/stats/stats-importer.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/stats/stats-importer.php    2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/stats/stats-importer.php      2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,41 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-namespace Wporg\TranslationEvents\Stats;
-
-use Wporg\TranslationEvents\Event\Event;
-
-class Stats_Importer {
-       /**
-        * Imports the contributions a user made while a given event was active.
-        */
-       public function import_for_user_and_event( int $user_id, Event $event ): void {
-               global $wpdb, $gp_table_prefix;
-
-               // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
-               // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery
-               // phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching
-               $wpdb->query(
-                       $wpdb->prepare(
-                               "
-                               insert ignore into {$gp_table_prefix}event_actions
-                                   (event_id, user_id, original_id, locale, action, happened_at)
-                               select %d, t.user_id, t.original_id, ts.locale, %s, t.date_added
-                               from {$gp_table_prefix}translations t,
-                                    {$gp_table_prefix}translation_sets ts
-                               where t.user_id = %d
-                                 and t.translation_set_id = ts.id
-                                 and t.status in ( 'current', 'waiting', 'changesrequested', 'fuzzy' )
-                                 and date_added between %s and %s
-                               ",
-                               array(
-                                       'event_id'          => $event->id(),
-                                       'action'            => Stats_Listener::ACTION_CREATE,
-                                       'user_id'           => $user_id,
-                                       'date_added_after'  => $event->start()->utc()->format( 'Y-m-d H:i:s' ),
-                                       'date_added_before' => $event->end()->utc()->format( 'Y-m-d H:i:s' ),
-                               ),
-                       ),
-               );
-               // phpcs:enable
-       }
-}
</del></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludestemplatesphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/templates.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/templates.php                               (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/templates.php 2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,21 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+namespace Wporg\TranslationEvents;
+
+class Templates {
+       public static function render( string $template, array $data = array() ) {
+               gp_tmpl_load( $template, $data, __DIR__ . '/../templates/' );
+       }
+
+       public static function header( array $data ) {
+               self::partial( 'header', $data );
+       }
+
+       public static function footer( array $data = array() ) {
+               self::partial( 'footer', $data );
+       }
+
+       public static function partial( string $template, array $data ) {
+               self::render( "partials/$template", $data );
+       }
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/templates.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesupgradephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/upgrade.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/upgrade.php 2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/upgrade.php   2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,8 +2,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> namespace Wporg\TranslationEvents;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use Exception;
+use WP_Query;
+
</ins><span class="cx" style="display: block; padding: 0 10px"> class Upgrade {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        private const VERSION        = 2;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ private const VERSION        = 3;
</ins><span class="cx" style="display: block; padding: 0 10px">         private const VERSION_OPTION = 'wporg_gp_translations_events_version';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        public static function upgrade_if_needed(): void {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -23,6 +26,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">                require_once ABSPATH . 'wp-admin/includes/upgrade.php';
</span><span class="cx" style="display: block; padding: 0 10px">                dbDelta( self::get_database_schema_sql() );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                // Run version-specific upgrades.
+               $is_running_tests = 'yes' === getenv( 'WPORG_TRANSLATION_EVENTS_TESTS' );
+               if ( $previous_version < 3 && ! $is_running_tests ) {
+                       try {
+                               self::v3_set_is_new_contributor();
+                       } catch ( Exception $e ) {
+                               // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
+                               error_log( $e );
+                       }
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 update_option( self::VERSION_OPTION, self::VERSION );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -47,6 +61,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                `event_id` int(10) NOT NULL COMMENT 'Post_ID of the translation_event post in the wp_posts table',
</span><span class="cx" style="display: block; padding: 0 10px">                                `user_id` int(10) NOT NULL COMMENT 'ID of the user who is attending the event',
</span><span class="cx" style="display: block; padding: 0 10px">                                `is_host` tinyint(1) default 0 not null comment 'Whether the user is a host of the event',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                `is_new_contributor` tinyint(1) default 0 not null comment 'Whether the user is a new translation contributor',
</ins><span class="cx" style="display: block; padding: 0 10px">                         PRIMARY KEY (`translate_event_attendees_id`),
</span><span class="cx" style="display: block; padding: 0 10px">                        UNIQUE KEY `event_per_user` (`event_id`,`user_id`),
</span><span class="cx" style="display: block; padding: 0 10px">                        INDEX `user` (`user_id`)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -53,4 +68,66 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        ) COMMENT='Attendees of events';
</span><span class="cx" style="display: block; padding: 0 10px">                ";
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       /**
+        * Set is_new_contributor in attendees table for all events.
+        */
+       private static function v3_set_is_new_contributor(): void {
+               global $wpdb, $gp_table_prefix;
+
+               $query = new WP_Query(
+                       array(
+                               'post_type'   => Translation_Events::CPT,
+                               'post_status' => 'publish',
+                       )
+               );
+
+               $events              = $query->get_posts();
+               $event_repository    = Translation_Events::get_event_repository();
+               $attendee_repository = Translation_Events::get_attendee_repository();
+
+               foreach ( $events as $post ) {
+                       $event = $event_repository->get_event( $post->ID );
+                       if ( ! $event ) {
+                               continue;
+                       }
+
+                       $attendees = $attendee_repository->get_attendees( $event->id() );
+
+                       foreach ( $attendees as $attendee ) {
+                               // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
+                               // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery
+                               // phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching
+                               $translation_count = $wpdb->get_var(
+                                       $wpdb->prepare(
+                                               "
+                                                       select count(*) as cnt
+                                                       from {$gp_table_prefix}translations
+                                                       where user_id = %d
+                                                         and date_added < %s
+                                               ",
+                                               array(
+                                                       $attendee->user_id(),
+                                                       $event->start()->format( 'Y-m-d H:i:s' ),
+                                               ),
+                                       )
+                               );
+
+                               if ( $translation_count > 10 ) {
+                                       // Not a new contributor.
+                                       continue;
+                               }
+
+                               $wpdb->update(
+                                       "{$gp_table_prefix}event_attendees",
+                                       array( 'is_new_contributor' => 1 ),
+                                       array(
+                                               'event_id' => $attendee->event_id(),
+                                               'user_id'  => $attendee->user_id(),
+                                       )
+                               );
+                               // phpcs:enable
+                       }
+               }
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateseventtranslationsfooterphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/event-translations-footer.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/event-translations-footer.php      2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/event-translations-footer.php        2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,3 +1,8 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+namespace Wporg\TranslationEvents\Templates;
+
+?>
+
</ins><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="clear"></div>
</span><span class="cx" style="display: block; padding: 0 10px"> <script type="text/javascript">
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateseventtranslationsheaderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/event-translations-header.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/event-translations-header.php      2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/event-translations-header.php        2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,9 +1,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+namespace Wporg\TranslationEvents\Templates;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-namespace Wporg\TranslationEvents;
-
-use GP;
</del><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Event\Event;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use Wporg\TranslationEvents\Urls;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var Event  $event */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateseventphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/event.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/event.php  2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/event.php    2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,39 +2,79 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * Template for event page.
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+namespace Wporg\TranslationEvents\Templates;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-namespace Wporg\TranslationEvents;
-
</del><span class="cx" style="display: block; padding: 0 10px"> use GP_Locales;
</span><span class="cx" style="display: block; padding: 0 10px"> use WP_User;
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Attendee\Attendee;
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Event\Event;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-use Wporg\TranslationEvents\Event\Event_End_Date;
-use Wporg\TranslationEvents\Event\Event_Start_Date;
</del><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Stats\Event_Stats;
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Stats\Stats_Row;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use Wporg\TranslationEvents\Templates;
+use Wporg\TranslationEvents\Urls;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var bool $user_is_attending */
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var bool $user_is_contributor */
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/** @var Attendee[] $hosts */
</ins><span class="cx" style="display: block; padding: 0 10px"> /** @var Attendee[] $attendees_not_contributing */
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var Attendee[] $contributors */
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var array $new_contributor_ids */
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var Event $event */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/** @var int $event_id */
-/** @var string $event_title */
-/** @var string $event_description */
-/** @var Event_Start_Date $event_start */
-/** @var Event_End_Date $event_end */
</del><span class="cx" style="display: block; padding: 0 10px"> /** @var Event_Stats $event_stats */
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var array $projects */
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var WP_User $user */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/* translators: %s: Event title. */
-gp_title( sprintf( __( 'Translation Events - %s' ), esc_html( $event_title ) ) );
-gp_breadcrumb_translation_events( array( esc_html( $event_title ) ) );
-gp_tmpl_header();
-$event_page_title = $event_title;
-gp_tmpl_load( 'events-header', get_defined_vars(), __DIR__ );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+Templates::header(
+       array(
+               /* translators: %s: Event title. */
+               'html_title'  => sprintf( __( 'Translation Events - %s' ), esc_html( $event->title() ) ),
+               'page_title'  => function () use ( $event ) {
+                       echo esc_html( $event->title() );
+                       if ( 'draft' === $event->status() ) : ?>
+                               <span class="event-label-draft"><?php echo esc_html( $event->status() ); ?></span>
+                       <?php endif; ?>
+                       <?php
+               },
+               'breadcrumbs' => array( esc_html( $event->title() ) ),
+               'sub_head'    => function () use ( $event, $user, $hosts ) {
+                       ?>
+                       <span class="event-host">
+                               <?php
+                               $has_hosts = count( $hosts ) > 0;
+
+                               if ( ! $has_hosts ) {
+                                       $hosts = array( new Attendee( $event->id(), $event->author_id(), true ) );
+                               }
+                               $hosts_list = array_map(
+                                       function ( $host ) {
+                                               $url  = get_author_posts_url( $host->user_id() );
+                                               $name = get_the_author_meta( 'display_name', $host->user_id() );
+                                               return '<a href="' . esc_attr( $url ) . '">' . esc_html( $name ) . '</a>';
+                                       },
+                                       $hosts
+                               );
+
+                               if ( ! $has_hosts ) {
+                                       /* translators: %s: Display name of the user who created the event. */
+                                       $hosts_string = __( 'Created by: %s', 'gp-translation-events' );
+                               } else {
+                                       /* translators: %s is a comma-separated list of event hosts (=usernames) */
+                                       $hosts_string = _n( 'Host: %s', 'Hosts: %s', count( $hosts ), 'gp-translation-events' );
+                               }
+
+                               echo wp_kses(
+                                       sprintf( $hosts_string, implode( ', ', $hosts_list ) ),
+                                       array( 'a' => array( 'href' => array() ) )
+                               );
+                               ?>
+                       </span>
+                       <?php if ( current_user_can( 'edit_translation_event', $event->id() ) ) : ?>
+                               <a class="event-page-edit-link" href="<?php echo esc_url( Urls::event_edit( $event->id() ) ); ?>"><span class="dashicons dashicons-edit"></span><?php esc_html_e( 'Edit event', 'gp-translation-events' ); ?></a>
+                       <?php endif ?>
+                       <?php
+               },
+       ),
+);
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="event-page-wrapper">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -41,7 +81,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        <div class="event-details-left">
</span><span class="cx" style="display: block; padding: 0 10px">                <div class="event-page-content">
</span><span class="cx" style="display: block; padding: 0 10px">                        <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                echo wp_kses_post( wpautop( make_clickable( $event_description ) ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         echo wp_kses_post( wpautop( make_clickable( $event->description() ) ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                         ?>
</span><span class="cx" style="display: block; padding: 0 10px">                </div>
</span><span class="cx" style="display: block; padding: 0 10px">                <?php if ( ! empty( $contributors ) ) : ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -57,7 +97,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                <li class="event-contributor" title="<?php echo esc_html( implode( ', ', $contributor->contributed_locales() ) ); ?>">
</span><span class="cx" style="display: block; padding: 0 10px">                                                        <a href="<?php echo esc_url( get_author_posts_url( $contributor->user_id() ) ); ?>" class="avatar"><?php echo get_avatar( $contributor->user_id(), 48 ); ?></a>
</span><span class="cx" style="display: block; padding: 0 10px">                                                        <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>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                        <?php if ( isset( $new_contributor_ids[ $contributor->user_id() ] ) ) : ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                 <?php if ( $contributor->is_new_contributor() ) : ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                                                                 <span class="first-time-contributor-tada" title="<?php esc_html_e( 'New Translation Contributor', 'gp-translation-events' ); ?>"></span>
</span><span class="cx" style="display: block; padding: 0 10px">                                                        <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px">                                                </li>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -78,7 +118,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                <li class="event-attendee">
</span><span class="cx" style="display: block; padding: 0 10px">                                                        <a href="<?php echo esc_url( get_author_posts_url( $_attendee->user_id() ) ); ?>" class="avatar"><?php echo get_avatar( $_attendee->user_id(), 48 ); ?></a>
</span><span class="cx" style="display: block; padding: 0 10px">                                                        <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>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                        <?php if ( isset( $new_contributor_ids[ $_attendee->user_id() ] ) ) : ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                 <?php if ( $_attendee->is_new_contributor() ) : ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                                                                 <span class="first-time-contributor-tada" title="<?php esc_html_e( 'New Translation Contributor', 'gp-translation-events' ); ?>"></span>
</span><span class="cx" style="display: block; padding: 0 10px">                                                        <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px">                                                </li>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -167,7 +207,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                wp_sprintf(
</span><span class="cx" style="display: block; padding: 0 10px">                                                        // translators: %1$s: Event title, %2$d: Number of contributors, %3$s: is a parenthesis with potential text "x new contributors", %4$d: Number of languages, %5$l: List of languages, %6$d: Number of strings translated, %7$d: Number of strings reviewed.
</span><span class="cx" style="display: block; padding: 0 10px">                                                        __( 'At the <strong>%1$s</strong> event, we had %2$d people %3$s who contributed in %4$d languages (%5$l), translated %6$d strings and reviewed %7$d strings.', 'gp-translation-events' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                        esc_html( $event_title ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                 esc_html( $event->title() ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                                         esc_html( $event_stats->totals()->users ),
</span><span class="cx" style="display: block; padding: 0 10px">                                                        $new_contributors_text,
</span><span class="cx" style="display: block; padding: 0 10px">                                                        count( $event_stats->rows() ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -198,7 +238,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                        array_map(
</span><span class="cx" style="display: block; padding: 0 10px">                                                                function ( $contributor ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                                                        $append_tada = '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                                        if ( isset( $new_contributor_ids[ $contributor->user_id() ] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                                 if ( $contributor->is_new_contributor() ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                                                                         $append_tada = ' <span class="new-contributor" title="' . esc_html__( 'New Translation Contributor', 'gp-translation-events' ) . '">🎉</span>';
</span><span class="cx" style="display: block; padding: 0 10px">                                                                        }
</span><span class="cx" style="display: block; padding: 0 10px">                                                                        return '@' . ( new WP_User( $contributor->user_id() ) )->user_login . $append_tada;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -222,21 +262,21 @@
</span><span class="cx" style="display: block; padding: 0 10px">                <div class="event-details-date">
</span><span class="cx" style="display: block; padding: 0 10px">                        <p>
</span><span class="cx" style="display: block; padding: 0 10px">                                <span class="event-details-date-label">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        <?php echo esc_html( $event_start->is_in_the_past() ? __( 'Started', 'gp-translation-events' ) : __( 'Starts', 'gp-translation-events' ) ); ?>:
-                                       <?php $event_start->print_relative_time_html(); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 <?php echo esc_html( $event->start()->is_in_the_past() ? __( 'Started', 'gp-translation-events' ) : __( 'Starts', 'gp-translation-events' ) ); ?>:
+                                       <?php $event->start()->print_relative_time_html(); ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 </span>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <?php $event_start->print_time_html(); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         <?php $event->start()->print_time_html(); ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 <span class="event-details-date-label">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        <?php echo esc_html( $event_end->is_in_the_past() ? __( 'Ended', 'gp-translation-events' ) : __( 'Ends', 'gp-translation-events' ) ); ?>:
-                                       <?php $event_end->print_relative_time_html(); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 <?php echo esc_html( $event->end()->is_in_the_past() ? __( 'Ended', 'gp-translation-events' ) : __( 'Ends', 'gp-translation-events' ) ); ?>:
+                                       <?php $event->end()->print_relative_time_html(); ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                </span>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <?php $event_end->print_time_html(); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         <?php $event->end()->print_time_html(); ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                         </p>
</span><span class="cx" style="display: block; padding: 0 10px">                </div>
</span><span class="cx" style="display: block; padding: 0 10px">                <?php if ( is_user_logged_in() ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px">                <div class="event-details-join">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        <?php if ( $event_end->is_in_the_past() ) : ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 <?php if ( $event->end()->is_in_the_past() ) : ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 <?php if ( $user_is_attending ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px">                                        <button disabled="disabled" class="button is-primary attend-btn"><?php esc_html_e( 'You attended', 'gp-translation-events' ); ?></button>
</span><span class="cx" style="display: block; padding: 0 10px">                                <?php endif; ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -243,7 +283,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        <?php elseif ( $user_is_contributor ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px">                                <?php // Contributors can't un-attend so don't show anything. ?>
</span><span class="cx" style="display: block; padding: 0 10px">                        <?php else : ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <form class="event-details-attend" method="post" action="<?php echo esc_url( Urls::event_toggle_attendee( $event_id ) ); ?>">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         <form class="event-details-attend" method="post" action="<?php echo esc_url( Urls::event_toggle_attendee( $event->id() ) ); ?>">
</ins><span class="cx" style="display: block; padding: 0 10px">                                         <?php if ( $user_is_attending ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px">                                                <input type="submit" class="button is-secondary attending-btn" value="<?php esc_attr_e( "You're attending", 'gp-translation-events' ); ?>" />
</span><span class="cx" style="display: block; padding: 0 10px">                                        <?php else : ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -255,7 +295,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                <?php else : ?>
</span><span class="cx" style="display: block; padding: 0 10px">                <div class="event-details-join">
</span><span class="cx" style="display: block; padding: 0 10px">                        <p>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <?php if ( ! $event_end->is_in_the_past() ) : ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         <?php if ( ! $event->end()->is_in_the_past() ) : ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                                         <a href="<?php echo esc_url( wp_login_url() ); ?>" class="button is-primary attend-btn"><?php esc_html_e( 'Login to attend', 'gp-translation-events' ); ?></a>
</span><span class="cx" style="display: block; padding: 0 10px">                                <?php else : ?>
</span><span class="cx" style="display: block; padding: 0 10px">                                        <button disabled="disabled" class="button is-primary attend-btn"><?php esc_html_e( 'Event is over', 'gp-translation-events' ); ?></button>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -265,5 +305,5 @@
</span><span class="cx" style="display: block; padding: 0 10px">                <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px">        </div>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<div class="clear"></div>
-<?php gp_tmpl_footer(); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+<?php Templates::footer(); ?>
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateseventsattendeesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-attendees.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-attendees.php       2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-attendees.php 2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,21 +2,23 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * Attendees list page.
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+namespace Wporg\TranslationEvents\Templates;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-namespace Wporg\TranslationEvents;
-
</del><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Event\Event;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use Wporg\TranslationEvents\Templates;
+use Wporg\TranslationEvents\Urls;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**  @var Event $event */
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var bool $is_active_filter */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-gp_title( __( 'Translation Events', 'gp-translation-events' ) );
-gp_breadcrumb_translation_events();
-gp_tmpl_header();
-$event_page_title = __( 'Manage Attendees', 'gp-translation-events' );
-gp_tmpl_load( 'events-header', get_defined_vars(), __DIR__ );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+Templates::header(
+       array(
+               'html_title' => __( 'Translation Events', 'gp-translation-events' ),
+               'page_title' => __( 'Manage Attendees', 'gp-translation-events' ),
+       ),
+);
+?>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-?>
</del><span class="cx" style="display: block; padding: 0 10px"> <div class="event-page-wrapper">
</span><span class="cx" style="display: block; padding: 0 10px">        <div class="event-details-stats">
</span><span class="cx" style="display: block; padding: 0 10px">        <a href="<?php echo esc_url( Urls::event_details( $event->id() ) ); ?>" class="view-event-page">Go to event page</a>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -65,5 +67,5 @@
</span><span class="cx" style="display: block; padding: 0 10px">                <p><?php esc_html_e( 'No attendees found.', 'gp-translation-events' ); ?></p>
</span><span class="cx" style="display: block; padding: 0 10px">        </div>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-gp_tmpl_footer();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+<?php Templates::footer(); ?>
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateseventsformphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-form.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-form.php    2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-form.php      2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,50 +2,51 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * Template for event form.
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+namespace Wporg\TranslationEvents\Templates;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-namespace Wporg\TranslationEvents;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use Wporg\TranslationEvents\Event\Event;
+use Wporg\TranslationEvents\Event_Text_Snippet;
+use Wporg\TranslationEvents\Templates;
+use Wporg\TranslationEvents\Urls;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-use DateTimeZone;
-use Wporg\TranslationEvents\Event\Event_End_Date;
-use Wporg\TranslationEvents\Event\Event_Start_Date;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/** @var bool $is_create_form */
+/** @var Event $event */
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/** @var string $event_page_title */
-/** @var string $event_form_name */
-/** @var int    $event_id */
-/** @var string $event_title */
-/** @var string $event_description */
-/** @var Event_Start_Date $event_start */
-/** @var Event_End_Date $event_end */
-/** @var DateTimeZone|null $event_timezone */
-/** @var string $event_url */
-/** @var string $css_show_url */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+$page_title = $is_create_form ? 'Create Event' : 'Edit Event';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-gp_title( __( 'Translation Events' ) . ' - ' . esc_html( $event_page_title . ' - ' . $event_title ) );
-gp_breadcrumb_translation_events( array( esc_html( $event_page_title ) ) );
-gp_tmpl_header();
-gp_tmpl_load( 'events-header', get_defined_vars(), __DIR__ );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+Templates::header(
+       array(
+               'html_title'  => __( 'Translation Events' ) . ' - ' . esc_html( $page_title . ' - ' . $event->title() ),
+               'page_title'  => $page_title,
+               'breadcrumbs' => array( esc_html( $page_title ) ),
+       ),
+);
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> <div class="event-page-wrapper">
</span><span class="cx" style="display: block; padding: 0 10px"> <form class="translation-event-form" action="" method="post">
</span><span class="cx" style="display: block; padding: 0 10px">        <?php wp_nonce_field( '_event_nonce', '_event_nonce' ); ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <?php if ( ! $event_id ) : ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php if ( $is_create_form ) : ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                 <details id="quick-add"><summary><?php esc_html_e( 'Upcoming WordCamps', 'gp-translation-events' ); ?></summary><div class="loading"></div></details>
</span><span class="cx" style="display: block; padding: 0 10px">        <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px">        <input type="hidden" name="action" value="submit_event_ajax">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        <?php $event_form_name = $is_create_form ? 'create_event' : 'edit_event'; ?>
</ins><span class="cx" style="display: block; padding: 0 10px">         <input type="hidden" id="form-name" name="form_name" value="<?php echo esc_attr( $event_form_name ); ?>">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <input type="hidden" id="event-id" name="event_id" value="<?php echo esc_attr( $event_id ); ?>">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <input type="hidden" id="event-id" name="event_id" value="<?php echo esc_attr( $event->id() ); ?>">
</ins><span class="cx" style="display: block; padding: 0 10px">         <input type="hidden" id="event-form-action" name="event_form_action">
</span><span class="cx" style="display: block; padding: 0 10px">        <div>
</span><span class="cx" style="display: block; padding: 0 10px">                <label for="event-title"><?php esc_html_e( 'Event Title', 'gp-translation-events' ); ?></label>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <input type="text" id="event-title" name="event_title" value="<?php echo esc_html( $event_title ); ?>" required size="42">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <input type="text" id="event-title" name="event_title" value="<?php echo esc_html( $event->title() ); ?>" required size="42">
</ins><span class="cx" style="display: block; padding: 0 10px">         </div>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <div id="event-url" class="<?php echo esc_attr( $css_show_url ); ?>">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php $event_url_class = $is_create_form ? 'hide-event-url' : ''; ?>
+       <?php $event_url = $is_create_form ? '' : Urls::event_details_absolute( $event->id() ); ?>
+       <div id="event-url" class="<?php echo esc_attr( $event_url_class ); ?>">
</ins><span class="cx" style="display: block; padding: 0 10px">                 <label for="event-permalink"><?php esc_html_e( 'Event URL', 'gp-translation-events' ); ?></label>
</span><span class="cx" style="display: block; padding: 0 10px">                <a id="event-permalink" class="event-permalink" href="<?php echo esc_url( $event_url ); ?>" target="_blank"><?php echo esc_url( $event_url ); ?></a>
</span><span class="cx" style="display: block; padding: 0 10px">        </div>
</span><span class="cx" style="display: block; padding: 0 10px">        <div>
</span><span class="cx" style="display: block; padding: 0 10px">                <label for="event-description"><?php esc_html_e( 'Event Description', 'gp-translation-events' ); ?></label>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <textarea id="event-description" name="event_description" rows="4" cols="40" required><?php echo esc_html( $event_description ); ?></textarea>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <textarea id="event-description" name="event_description" rows="4" cols="40" required><?php echo esc_html( $event->description() ); ?></textarea>
</ins><span class="cx" style="display: block; padding: 0 10px">                 <?php
</span><span class="cx" style="display: block; padding: 0 10px">                echo wp_kses(
</span><span class="cx" style="display: block; padding: 0 10px">                        Event_Text_Snippet::get_snippet_links(),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -62,11 +63,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                ?>
</span><span class="cx" style="display: block; padding: 0 10px">                        <div>
</span><span class="cx" style="display: block; padding: 0 10px">                <label for="event-start"><?php esc_html_e( 'Start Date', 'gp-translation-events' ); ?></label>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <input type="datetime-local" id="event-start" name="event_start" value="<?php echo esc_attr( $event_start->format( 'Y-m-d H:i' ) ); ?>" required>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <input type="datetime-local" id="event-start" name="event_start" value="<?php echo esc_attr( $event->start()->format( 'Y-m-d H:i' ) ); ?>" required>
</ins><span class="cx" style="display: block; padding: 0 10px">         </div>
</span><span class="cx" style="display: block; padding: 0 10px">        <div>
</span><span class="cx" style="display: block; padding: 0 10px">                <label for="event-end"><?php esc_html_e( 'End Date', 'gp-translation-events' ); ?></label>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <input type="datetime-local" id="event-end" name="event_end" value="<?php echo esc_attr( $event_end->format( 'Y-m-d H:i' ) ); ?>" required>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <input type="datetime-local" id="event-end" name="event_end" value="<?php echo esc_attr( $event->end()->format( 'Y-m-d H:i' ) ); ?>" required>
</ins><span class="cx" style="display: block; padding: 0 10px">         </div>
</span><span class="cx" style="display: block; padding: 0 10px">        <div>
</span><span class="cx" style="display: block; padding: 0 10px">                <label for="event-timezone"><?php esc_html_e( 'Event Timezone', 'gp-translation-events' ); ?></label>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -73,7 +74,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                <select id="event-timezone" name="event_timezone" required>
</span><span class="cx" style="display: block; padding: 0 10px">                        <?php
</span><span class="cx" style="display: block; padding: 0 10px">                        echo wp_kses(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                wp_timezone_choice( $event_timezone ? $event_timezone->getName() : null, get_user_locale() ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         wp_timezone_choice( $is_create_form ? null : $event->timezone()->getName(), get_user_locale() ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                 array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        'optgroup' => array( 'label' => array() ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'option'   => array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -87,26 +88,25 @@
</span><span class="cx" style="display: block; padding: 0 10px">        </div>
</span><span class="cx" style="display: block; padding: 0 10px">        <div class="submit-btn-group">
</span><span class="cx" style="display: block; padding: 0 10px">                <label for="event-status"></label>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <?php if ( $event_id ) : ?>
-               <?php if ( isset( $event_status ) && 'draft' === $event_status ) : ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php if ( $event->id() ) : ?>
+               <?php if ( $event->is_draft() ) : ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                         <button class="button is-primary save-draft submit-event" type="submit" data-event-status="draft">Update Draft</button>
</span><span class="cx" style="display: block; padding: 0 10px">                <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px">        <button class="button is-primary submit-event" type="submit"  data-event-status="publish">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <?php echo ( isset( $event_status ) && 'publish' === $event_status ) ? esc_html( 'Update Event' ) : esc_html( 'Publish Event' ); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <?php echo ( $event->is_published() ) ? esc_html( 'Update Event' ) : esc_html( 'Publish Event' ); ?>
</ins><span class="cx" style="display: block; padding: 0 10px">         </button>
</span><span class="cx" style="display: block; padding: 0 10px">        <?php else : ?>
</span><span class="cx" style="display: block; padding: 0 10px">                <button class="button is-primary save-draft submit-event" type="submit" data-event-status="draft">Save Draft</button>
</span><span class="cx" style="display: block; padding: 0 10px">                <button class="button is-primary submit-event" type="submit"  data-event-status="publish">Publish Event</button>
</span><span class="cx" style="display: block; padding: 0 10px">        <?php endif; ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <?php if ( isset( $create_trash_button ) && $create_trash_button ) : ?>
-               <button id="trash-button" class="button is-destructive trash-event" type="submit" name="submit" value="Delete" style="display: <?php echo esc_attr( $visibility_trash_button ); ?>">Delete Event</button>
-       <?php endif; ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php $visibility_trash_button = current_user_can( 'trash_translation_event', $event->id() ) ? 'inline-flex' : 'none'; ?>
+       <button id="trash-button" class="button is-destructive trash-event" type="submit" name="submit" value="Delete" style="display: <?php echo esc_attr( $visibility_trash_button ); ?>">Delete Event</button>
</ins><span class="cx" style="display: block; padding: 0 10px">         </div>
</span><span class="cx" style="display: block; padding: 0 10px">        <div class="clear"></div>
</span><span class="cx" style="display: block; padding: 0 10px">        <div class="published-update-text">
</span><span class="cx" style="display: block; padding: 0 10px">                <?php
</span><span class="cx" style="display: block; padding: 0 10px">                $visibility_published_button = 'none';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( isset( $event_status ) && 'publish' === $event_status ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $event->is_published() ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $visibility_published_button = 'block';
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">                ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -129,10 +129,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">        </div>
</span><span class="cx" style="display: block; padding: 0 10px"> </form>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php if ( $event_id ) : ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php if ( $event->id() ) : ?>
</ins><span class="cx" style="display: block; padding: 0 10px">         <div class="event-edit-right">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <a class="manage-attendees-btn button is-primary" href="<?php echo esc_url( Urls::event_attendees( $event_id ) ); ?>"><?php esc_html_e( 'Manage Attendees', 'gp-translation-events' ); ?></a>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <a class="manage-attendees-btn button is-primary" href="<?php echo esc_url( Urls::event_attendees( $event->id() ) ); ?>"><?php esc_html_e( 'Manage Attendees', 'gp-translation-events' ); ?></a>
</ins><span class="cx" style="display: block; padding: 0 10px">         </div>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<div class="clear"></div>
-<?php gp_tmpl_footer(); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+<?php Templates::footer(); ?>
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateseventsheaderphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-header.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-header.php  2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-header.php    2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,70 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-namespace Wporg\TranslationEvents;
-
-use WP_User;
-use Wporg\TranslationEvents\Attendee\Attendee;
-use Wporg\TranslationEvents\Event\Event;
-
-/** @var WP_User $user */
-/** @var Attendee[] $hosts */
-/** @var Attendee $attendee */
-/** @var Event $event */
-/** @var string $event_page_title */
-?>
-
-<div class="event-list-top-bar">
-<h2 class="event-page-title">
-       <?php echo esc_html( $event_page_title ); ?>
-       <?php if ( isset( $event ) && 'draft' === $event->status() ) : ?>
-                               <span class="event-label-draft"><?php echo esc_html( $event->status() ); ?></span>
-                       <?php endif; ?>
-</h2>
-       <ul class="event-list-nav">
-               <?php if ( is_user_logged_in() ) : ?>
-                       <?php if ( current_user_can( 'manage_translation_events' ) ) : ?>
-                               <li><a href="<?php echo esc_url( Urls::events_trashed() ); ?>">Deleted Events</a></li>
-                       <?php endif; ?>
-                       <li><a href="<?php echo esc_url( Urls::my_events() ); ?>">My Events</a></li>
-                       <?php if ( current_user_can( 'create_translation_event' ) ) : ?>
-                               <li><a class="button is-primary" href="<?php echo esc_url( Urls::event_create() ); ?>">Create Event</a></li>
-                       <?php endif; ?>
-               <?php endif; ?>
-       </ul>
-       <?php if ( isset( $event ) && ! isset( $event_form_name ) && ! isset( $hide_sub_head ) ) : ?>
-       <p class="event-sub-head">
-                       <span class="event-host">
-                               <?php
-                               if ( isset( $hosts ) ) :
-                                       if ( count( $hosts ) > 0 ) :
-                                               if ( 1 === count( $hosts ) ) :
-                                                       esc_html_e( 'Host:', 'gp-translation-events' );
-                                               else :
-                                                       esc_html_e( 'Hosts:', 'gp-translation-events' );
-                                               endif;
-                                       else :
-                                               esc_html_e( 'Created by:', 'gp-translation-events' );
-                                               ?>
-                                               &nbsp;<a href="<?php echo esc_attr( get_author_posts_url( $event->author_id() ) ); ?>"><?php echo esc_html( get_the_author_meta( 'display_name', $event->author_id() ) ); ?></a>
-                                               <?php
-                                       endif;
-                                       ?>
-                                       <?php foreach ( $hosts as $host ) : ?>
-                                               &nbsp;<a href="<?php echo esc_attr( get_author_posts_url( $host->user_id() ) ); ?>"><?php echo esc_html( get_the_author_meta( 'display_name', $host->user_id() ) ); ?></a>
-                                               <?php if ( end( $hosts ) !== $host ) : ?>
-                                                       ,
-                                               <?php else : ?>
-                                                       .
-                                               <?php endif; ?>
-                                       <?php endforeach; ?>
-                               <?php endif; ?>
-                       </span>
-                       <?php if ( current_user_can( 'edit_translation_event', $event->id() ) ) : ?>
-                               <a class="event-page-edit-link" href="<?php echo esc_url( Urls::event_edit( $event->id() ) ); ?>"><span class="dashicons dashicons-edit"></span><?php esc_html_e( 'Edit event', 'gp-translation-events' ); ?></a>
-                       <?php elseif ( current_user_can( 'edit_translation_event_attendees', $event->id() ) ) : ?>
-                               <a class="event-page-attendees-link" href="<?php echo esc_url( Urls::event_attendees( $event->id() ) ); ?>"><?php esc_html_e( 'Manage attendees', 'gp-translation-events' ); ?></a>
-                       <?php endif ?>
-               </p>
-               <?php endif; ?>
-
-</div>
</del></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateseventslisttrashedphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-list-trashed.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-list-trashed.php    2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-list-trashed.php      2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,16 +1,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+namespace Wporg\TranslationEvents\Templates;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-namespace Wporg\TranslationEvents;
-
</del><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Event\Events_Query_Result;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use Wporg\TranslationEvents\Templates;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var Events_Query_Result $trashed_events_query */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-gp_title( __( 'Deleted Translation Events', 'gp-translation-events' ) );
-gp_breadcrumb_translation_events();
-gp_tmpl_header();
-$event_page_title = __( 'Deleted Translation Events', 'gp-translation-events' );
-gp_tmpl_load( 'events-header', get_defined_vars(), __DIR__ );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+Templates::header(
+       array(
+               'html_title' => __( 'Deleted Translation Events', 'gp-translation-events' ),
+               'page_title' => __( 'Deleted Translation Events', 'gp-translation-events' ),
+       ),
+);
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="event-page-wrapper">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,37 +19,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">                <?php if ( empty( $trashed_events_query->events ) ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px">                        <?php esc_html_e( 'No deleted events found.', 'gp-translation-events' ); ?>
</span><span class="cx" style="display: block; padding: 0 10px">                <?php else : ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        <ul class="event-list">
-                               <?php foreach ( $trashed_events_query->events as $event ) : ?>
-                                       <li class="event-list-item">
-                                               <a href="<?php echo esc_url( Urls::event_edit( $event->id() ) ); ?>"><?php echo esc_html( $event->title() ); ?></a>
-                                               <?php if ( current_user_can( 'trash_translation_event', $event->id() ) ) : ?>
-                                                       <a href="<?php echo esc_url( Urls::event_trash( $event->id() ) ); ?>" class="button is-small">Restore</a>
-                                               <?php endif; ?>
-                                               <?php if ( current_user_can( 'delete_translation_event', $event->id() ) ) : ?>
-                                                       <a href="<?php echo esc_url( Urls::event_delete( $event->id() ) ); ?>" class="button is-small is-destructive">Delete Permanently</a>
-                                               <?php endif; ?>
-                                               <?php if ( $event->is_past() ) : ?>
-                                                       <span class="event-list-date">ended <?php $event->end()->print_relative_time_html(); ?></time></span>
-                                               <?php else : ?>
-                                                       <span class="event-list-date">ends <?php $event->end()->print_relative_time_html(); ?></time></span>
-                                               <?php endif; ?>
-                                               <?php echo esc_html( get_the_excerpt( $event->id() ) ); ?>
-                                       </li>
-                               <?php endforeach; ?>
-                       </ul>
-
</del><span class="cx" style="display: block; padding: 0 10px">                         <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        echo wp_kses_post(
-                               paginate_links(
-                                       array(
-                                               'total'     => $trashed_events_query->page_count,
-                                               'current'   => $trashed_events_query->current_page,
-                                               'format'    => '?page=%#%',
-                                               'prev_text' => '&laquo; Previous',
-                                               'next_text' => 'Next &raquo;',
-                                       )
-                               ) ?? ''
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 Templates::partial(
+                               'event-list',
+                               array(
+                                       'query'                  => $trashed_events_query,
+                                       'pagination_query_param' => 'page',
+                                       'show_start'             => true,
+                                       'show_end'               => true,
+                                       'relative_time'          => false,
+                               ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         );
</span><span class="cx" style="display: block; padding: 0 10px">                        ?>
</span><span class="cx" style="display: block; padding: 0 10px">                <?php endif; ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -55,5 +35,4 @@
</span><span class="cx" style="display: block; padding: 0 10px">        </div>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<div class="clear"></div>
-<?php gp_tmpl_footer(); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php Templates::footer(); ?>
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateseventslistphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-list.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-list.php    2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-list.php      2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,13 +2,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * Events list page.
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+namespace Wporg\TranslationEvents\Templates;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-namespace Wporg\TranslationEvents;
-
-use DateTime;
-use WP_Query;
-use Wporg\TranslationEvents\Event\Event;
</del><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Event\Events_Query_Result;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use Wporg\TranslationEvents\Templates;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var Events_Query_Result $current_events_query */
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var Events_Query_Result $upcoming_events_query */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -15,106 +12,64 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var Events_Query_Result $past_events_query */
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var Events_Query_Result $user_attending_events_query */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-gp_title( __( 'Translation Events', 'gp-translation-events' ) );
-gp_breadcrumb_translation_events();
-gp_tmpl_header();
-$event_page_title = __( 'Translation Events', 'gp-translation-events' );
-gp_tmpl_load( 'events-header', get_defined_vars(), __DIR__ );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+Templates::header(
+       array(
+               'html_title' => __( 'Translation Events', 'gp-translation-events' ),
+               'page_title' => __( 'Translation Events', 'gp-translation-events' ),
+       ),
+);
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="event-page-wrapper">
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="event-left-col">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+if ( empty( $current_events_query->events ) && empty( $upcoming_events_query->events ) && empty( $past_events_query->post_count ) ) :
+       esc_html_e( 'No events found.', 'gp-translation-events' );
+endif;
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $current_events_query->events ) ) :
</span><span class="cx" style="display: block; padding: 0 10px">        ?>
</span><span class="cx" style="display: block; padding: 0 10px">        <h2><?php esc_html_e( 'Current events', 'gp-translation-events' ); ?></h2>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <ul class="event-list">
-               <?php foreach ( $current_events_query->events as $event ) : ?>
-                       <li class="event-list-item">
-                               <a href="<?php echo esc_url( Urls::event_details( $event->id() ) ); ?>"><?php echo esc_html( $event->title() ); ?></a>
-                               <span class="event-list-date">ends <?php $event->end()->print_relative_time_html(); ?></time></span>
-                               <?php echo esc_html( get_the_excerpt( $event->id() ) ); ?>
-                       </li>
-               <?php endforeach; ?>
-       </ul>
-
</del><span class="cx" style="display: block; padding: 0 10px">         <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        echo wp_kses_post(
-               paginate_links(
-                       array(
-                               'total'     => $current_events_query->page_count,
-                               'current'   => $current_events_query->current_page,
-                               'format'    => '?current_events_paged=%#%',
-                               'prev_text' => '&laquo; Previous',
-                               'next_text' => 'Next &raquo;',
-                       )
-               ) ?? ''
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ Templates::partial(
+               'event-list',
+               array(
+                       'query'                  => $current_events_query,
+                       'pagination_query_param' => 'current_events_paged',
+                       'show_end'               => true,
+               ),
</ins><span class="cx" style="display: block; padding: 0 10px">         );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-       wp_reset_postdata();
</del><span class="cx" style="display: block; padding: 0 10px"> endif;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $upcoming_events_query->events ) ) :
</span><span class="cx" style="display: block; padding: 0 10px">        ?>
</span><span class="cx" style="display: block; padding: 0 10px">        <h2><?php esc_html_e( 'Upcoming events', 'gp-translation-events' ); ?></h2>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <ul class="event-list">
-               <?php foreach ( $upcoming_events_query->events as $event ) : ?>
-                       <li class="event-list-item">
-                               <a href="<?php echo esc_url( Urls::event_details( $event->id() ) ); ?>"><?php echo esc_html( $event->title() ); ?></a>
-                               <span class="event-list-date">starts <?php $event->start()->print_relative_time_html(); ?></span>
-                               <?php echo esc_html( get_the_excerpt( $event->id() ) ); ?>
-                       </li>
-               <?php endforeach; ?>
-       </ul>
-
</del><span class="cx" style="display: block; padding: 0 10px">         <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        echo wp_kses_post(
-               paginate_links(
-                       array(
-                               'total'     => $upcoming_events_query->page_count,
-                               'current'   => $upcoming_events_query->current_page,
-                               'format'    => '?upcoming_events_paged=%#%',
-                               'prev_text' => '&laquo; Previous',
-                               'next_text' => 'Next &raquo;',
-                       )
-               ) ?? ''
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ Templates::partial(
+               'event-list',
+               array(
+                       'query'                  => $upcoming_events_query,
+                       'pagination_query_param' => 'upcoming_events_paged',
+                       'show_start'             => true,
+               ),
</ins><span class="cx" style="display: block; padding: 0 10px">         );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+endif;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        wp_reset_postdata();
-endif;
</del><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $past_events_query->events ) ) :
</span><span class="cx" style="display: block; padding: 0 10px">        ?>
</span><span class="cx" style="display: block; padding: 0 10px">        <h2><?php esc_html_e( 'Past events', 'gp-translation-events' ); ?></h2>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <ul class="event-list">
-               <?php foreach ( $past_events_query->events as $event ) : ?>
-                       <li class="event-list-item">
-                               <a href="<?php echo esc_url( Urls::event_details( $event->id() ) ); ?>"><?php echo esc_html( $event->title() ); ?></a>
-                               <span class="event-list-date">ended <?php $event->end()->print_relative_time_html( 'F j, Y H:i T' ); ?></span>
-                               <?php esc_html( get_the_excerpt( $event->id() ) ); ?>
-                       </li>
-               <?php endforeach; ?>
-       </ul>
-
</del><span class="cx" style="display: block; padding: 0 10px">         <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        echo wp_kses_post(
-               paginate_links(
-                       array(
-                               'total'     => $past_events_query->page_count,
-                               'current'   => $past_events_query->current_page,
-                               'format'    => '?past_events_paged=%#%',
-                               'prev_text' => '&laquo; Previous',
-                               'next_text' => 'Next &raquo;',
-                       )
-               ) ?? ''
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ Templates::partial(
+               'event-list',
+               array(
+                       'query'                  => $past_events_query,
+                       'pagination_query_param' => 'past_events_paged',
+                       'show_end'               => true,
+               ),
</ins><span class="cx" style="display: block; padding: 0 10px">         );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-       wp_reset_postdata();
</del><span class="cx" style="display: block; padding: 0 10px"> endif;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+?>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-if ( empty( $current_events_query->events ) && empty( $upcoming_events_query->events ) && empty( $past_events_query->post_count ) ) :
-       esc_html_e( 'No events found.', 'gp-translation-events' );
-endif;
-?>
</del><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php if ( is_user_logged_in() ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px">        <div class="event-right-col">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -122,36 +77,24 @@
</span><span class="cx" style="display: block; padding: 0 10px">                <?php if ( empty( $user_attending_events_query->events ) ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px">                        <p>You don't have any events to attend.</p>
</span><span class="cx" style="display: block; padding: 0 10px">                <?php else : ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        <ul class="event-attending-list">
-                               <?php foreach ( $user_attending_events_query->events as $event ) : ?>
-                                       <li class="event-list-item">
-                                               <a href="<?php echo esc_url( Urls::event_details( $event->id() ) ); ?>"><?php echo esc_html( $event->title() ); ?></a>
-                                               <?php if ( $event->start() === $event->end() ) : ?>
-                                                       <span class="event-list-date events-i-am-attending"><?php $event->start()->print_time_html( 'F j, Y H:i T' ); ?></span>
-                                               <?php else : ?>
-                                                       <span class="event-list-date events-i-am-attending"><?php $event->start()->print_time_html( 'F j, Y H:i T' ); ?> - <?php $event->end()->print_time_html( 'F j, Y H:i T' ); ?></span>
-                                               <?php endif; ?>
-                                       </li>
-                               <?php endforeach; ?>
-                       </ul>
</del><span class="cx" style="display: block; padding: 0 10px">                         <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                echo wp_kses_post(
-                                       paginate_links(
-                                               array(
-                                                       'total'     => $user_attending_events_query->page_count,
-                                                       'current'   => $user_attending_events_query->current_page,
-                                                       'format'    => '?user_attending_events_paged=%#%',
-                                                       'prev_text' => '&laquo; Previous',
-                                                       'next_text' => 'Next &raquo;',
-                                               )
-                                       ) ?? ''
-                               );
-
-                               wp_reset_postdata();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 Templates::partial(
+                               'event-list',
+                               array(
+                                       'query'                  => $user_attending_events_query,
+                                       'pagination_query_param' => 'user_attending_events_paged',
+                                       'show_start'             => true,
+                                       'show_end'               => true,
+                                       'show_excerpt'           => false,
+                                       'date_format'            => 'F j, Y H:i T',
+                                       'relative_time'          => false,
+                                       'classes'                => array( 'event-attending-list' ),
+                               ),
+                       );
</ins><span class="cx" style="display: block; padding: 0 10px">                 endif;
</span><span class="cx" style="display: block; padding: 0 10px">                ?>
</span><span class="cx" style="display: block; padding: 0 10px">        </div>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<div class="clear"></div>
-<?php gp_tmpl_footer(); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+<?php Templates::footer(); ?>
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateseventsmyeventsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-my-events.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-my-events.php       2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-my-events.php 2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,145 +2,109 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * Template for My Events.
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+namespace Wporg\TranslationEvents\Templates;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-namespace Wporg\TranslationEvents;
-
</del><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Event\Events_Query_Result;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-use Wporg\TranslationEvents\Stats\Stats_Calculator;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use Wporg\TranslationEvents\Templates;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var Events_Query_Result $events_i_created_query */
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var Events_Query_Result $events_i_host_query */
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var Events_Query_Result $events_i_attended_query */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-gp_title( esc_html__( 'Translation Events', 'gp-translation-events' ) . ' - ' . esc_html__( 'My Events', 'gp-translation-events' ) );
-gp_breadcrumb_translation_events( array( esc_html__( 'My Events', 'gp-translation-events' ) ) );
-gp_tmpl_header();
-$event_page_title = __( 'My Events', 'gp-translation-events' );
-gp_tmpl_load( 'events-header', get_defined_vars(), __DIR__ );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+Templates::header(
+       array(
+               'html_title'  => esc_html__( 'Translation Events', 'gp-translation-events' ) . ' - ' . esc_html__( 'My Events', 'gp-translation-events' ),
+               'page_title'  => __( 'My Events', 'gp-translation-events' ),
+               'breadcrumbs' => array( esc_html__( 'My Events', 'gp-translation-events' ) ),
+       ),
+);
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<div class="events-links-to-anchors">
+       <ul>
+               <?php if ( ! empty( $events_i_am_or_will_attend_query->events ) ) : ?>
+                       <li><a href="#events-i-am-or-will-attend"><?php esc_html_e( 'Events I am or will be attending', 'gp-translation-events' ); ?></a></li>
+               <?php endif; ?>
+               <?php if ( ! empty( $events_i_host_query->events ) ) : ?>
+                       <li><a href="#events-i-host"><?php esc_html_e( 'Events I host', 'gp-translation-events' ); ?></a></li>
+               <?php endif; ?>
+               <?php if ( ! empty( $events_i_created_query->events ) ) : ?>
+                       <li><a href="#events-i-created"><?php esc_html_e( 'Events I have created', 'gp-translation-events' ); ?></a></li>
+               <?php endif; ?>
+               <?php if ( ! empty( $events_i_attended_query->events ) ) : ?>
+                       <li><a href="#events-i-attended"><?php esc_html_e( 'Events I attended', 'gp-translation-events' ); ?></a></li>
+               <?php endif; ?>
+               </ul>
+</div>
+<div class="event-page-wrapper">
+       <?php
+       if ( empty( $events_i_am_or_will_attend_query->events ) && empty( $events_i_created_query->events ) && empty( $events_i_host_query->events ) && empty( $events_i_attended_query->post_count ) ) :
+               esc_html_e( 'No events found.', 'gp-translation-events' );
+       endif;
+       ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<div class="event-page-wrapper">
-       <?php if ( ! empty( $events_i_host_query->events ) ) : ?>
-               <h2><?php esc_html_e( 'Events I host', 'gp-translation-events' ); ?> </h2>
-               <ul>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php if ( ! empty( $events_i_am_or_will_attend_query->events ) ) : ?>
+               <h2 id="events-i-am-or-will-attend"><?php esc_html_e( 'Events I am or will be attending', 'gp-translation-events' ); ?> </h2>
</ins><span class="cx" style="display: block; padding: 0 10px">                 <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                foreach ( $events_i_host_query->events as $event ) :
-                       $stats_calculator = new Stats_Calculator();
-                       $has_stats        = $stats_calculator->event_has_stats( $event->id() );
-                       ?>
-                       <li class="event-list-item">
-                               <a class="event-link-<?php echo esc_attr( $event->status() ); ?>" href="<?php echo esc_url( Urls::event_details( $event->id() ) ); ?>"><?php echo esc_html( $event->title() ); ?></a>
-                               <?php if ( ! $event->end()->is_in_the_past() && ! $has_stats ) : ?>
-                                       <a href="<?php echo esc_url( Urls::event_edit( $event->id() ) ); ?>" class="button is-small action edit">Edit</a>
-                               <?php endif; ?>
-                               <?php if ( 'draft' === $event->status() ) : ?>
-                                       <span class="event-label-<?php echo esc_attr( $event->status() ); ?>"><?php echo esc_html( $event->status() ); ?></span>
-                               <?php endif; ?>
-                               <?php if ( $event->start()->format( 'Y-m-d' ) === $event->end()->format( 'Y-m-d' ) ) : ?>
-                                       <span class="event-list-date events-i-am-attending"><?php $event->start()->print_time_html(); ?></span>
-                               <?php else : ?>
-                                       <span class="event-list-date events-i-am-attending"><?php $event->start()->print_time_html(); ?> - <?php $event->end()->print_time_html(); ?></span>
-                               <?php endif; ?>
-                               <p><?php echo esc_html( get_the_excerpt( $event->id() ) ); ?></p>
-                       </li>
-               <?php endforeach; ?>
-               </ul>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         Templates::partial(
+                       'event-list',
+                       array(
+                               'query'                  => $events_i_am_or_will_attend_query,
+                               'pagination_query_param' => 'events_i_am_or_will_attend_paged',
+                               'show_start'             => true,
+                               'show_end'               => true,
+                               'relative_time'          => false,
+                       ),
+               );
+       endif;
+       ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        <?php if ( ! empty( $events_i_host_query->events ) ) : ?>
+               <h2 id="events-i-host"><?php esc_html_e( 'Events I host', 'gp-translation-events' ); ?> </h2>
</ins><span class="cx" style="display: block; padding: 0 10px">                 <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                echo wp_kses_post(
-                       paginate_links(
-                               array(
-                                       'total'     => $events_i_host_query->page_count,
-                                       'current'   => $events_i_host_query->current_page,
-                                       'format'    => '?events_i_hosted_paged=%#%',
-                                       'prev_text' => '&laquo; Previous',
-                                       'next_text' => 'Next &raquo;',
-                               )
-                       ) ?? ''
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         Templates::partial(
+                       'event-list',
+                       array(
+                               'query'                  => $events_i_host_query,
+                               'pagination_query_param' => 'events_i_hosted_paged',
+                               'show_start'             => true,
+                               'show_end'               => true,
+                               'relative_time'          => false,
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-               wp_reset_postdata();
</del><span class="cx" style="display: block; padding: 0 10px">         endif;
</span><span class="cx" style="display: block; padding: 0 10px">        ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        <?php if ( ! empty( $events_i_created_query->events ) ) : ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <h2><?php esc_html_e( 'Events I have created', 'gp-translation-events' ); ?> </h2>
-               <ul>
-                       <?php
-                       foreach ( $events_i_created_query->events as $event ) :
-                               $stats_calculator = new Stats_Calculator();
-                               $has_stats        = $stats_calculator->event_has_stats( $event->id() );
-                               ?>
-                               <li class="event-list-item">
-                                       <a class="event-link-<?php echo esc_attr( $event->status() ); ?>" href="<?php echo esc_url( Urls::event_details( $event->id() ) ); ?>"><?php echo esc_html( $event->title() ); ?></a>
-                                       <?php if ( ! $event->end()->is_in_the_past() && ! $has_stats ) : ?>
-                                               <a href="<?php echo esc_url( Urls::event_edit( $event->id() ) ); ?>" class="button is-small action edit">Edit</a>
-                                       <?php endif; ?>
-                                       <?php if ( 'draft' === $event->status() ) : ?>
-                                               <span class="event-label-<?php echo esc_attr( $event->status() ); ?>"><?php echo esc_html( $event->status() ); ?></span>
-                                       <?php endif; ?>
-                                       <?php if ( $event->start()->format( 'Y-m-d' ) === $event->end()->format( 'Y-m-d' ) ) : ?>
-                                               <span class="event-list-date events-i-am-attending"><?php $event->start()->print_time_html(); ?></span>
-                                       <?php else : ?>
-                                               <span class="event-list-date events-i-am-attending"><?php $event->start()->print_time_html(); ?> - <?php $event->end()->print_time_html(); ?></span>
-                                       <?php endif; ?>
-                                       <p><?php echo esc_html( get_the_excerpt( $event->id() ) ); ?></p>
-                               </li>
-                       <?php endforeach; ?>
-               </ul>
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <h2 id="events-i-created"><?php esc_html_e( 'Events I have created', 'gp-translation-events' ); ?> </h2>
</ins><span class="cx" style="display: block; padding: 0 10px">                 <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                echo wp_kses_post(
-                       paginate_links(
-                               array(
-                                       'total'     => $events_i_created_query->page_count,
-                                       'current'   => $events_i_created_query->current_page,
-                                       'format'    => '?events_i_created_paged=%#%',
-                                       'prev_text' => '&laquo; Previous',
-                                       'next_text' => 'Next &raquo;',
-                               )
-                       ) ?? ''
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         Templates::partial(
+                       'event-list',
+                       array(
+                               'query'                  => $events_i_created_query,
+                               'pagination_query_param' => 'events_i_created_paged',
+                               'show_start'             => true,
+                               'show_end'               => true,
+                               'relative_time'          => false,
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-               wp_reset_postdata();
</del><span class="cx" style="display: block; padding: 0 10px">         endif;
</span><span class="cx" style="display: block; padding: 0 10px">        ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <h2><?php esc_html_e( 'Events I attended', 'gp-translation-events' ); ?> </h2>
</del><span class="cx" style="display: block; padding: 0 10px">         <?php if ( ! empty( $events_i_attended_query->events ) ) : ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <ul>
-               <?php foreach ( $events_i_attended_query->events as $event ) : ?>
-                       <li class="event-list-item">
-                               <a class="event-link-<?php echo esc_attr( $event->status() ); ?>" href="<?php echo esc_url( Urls::event_details( $event->id() ) ); ?>"><?php echo esc_html( $event->title() ); ?></a>
-                               <?php if ( $event->start() === $event->end() ) : ?>
-                                       <span class="event-list-date events-i-am-attending"><?php $event->start()->print_time_html(); ?></span>
-                               <?php else : ?>
-                                       <span class="event-list-date events-i-am-attending"><?php $event->start()->print_time_html(); ?> - <?php $event->end()->print_time_html(); ?></span>
-                               <?php endif; ?>
-                               <p><?php echo esc_html( get_the_excerpt( $event->id() ) ); ?></p>
-                       </li>
-               <?php endforeach; ?>
-               </ul>
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <h2 id="events-i-attended"><?php esc_html_e( 'Events I attended', 'gp-translation-events' ); ?> </h2>
</ins><span class="cx" style="display: block; padding: 0 10px">                 <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                echo wp_kses_post(
-                       paginate_links(
-                               array(
-                                       'total'     => $events_i_attended_query->page_count,
-                                       'current'   => $events_i_attended_query->current_page,
-                                       'format'    => '?events_i_attended_paged=%#%',
-                                       'prev_text' => '&laquo; Previous',
-                                       'next_text' => 'Next &raquo;',
-                               )
-                       ) ?? ''
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         Templates::partial(
+                       'event-list',
+                       array(
+                               'query'                  => $events_i_attended_query,
+                               'pagination_query_param' => 'events_i_attended_paged',
+                               'show_start'             => true,
+                               'show_end'               => true,
+                               'relative_time'          => false,
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-               wp_reset_postdata();
-       else :
-               echo 'No events found.';
</del><span class="cx" style="display: block; padding: 0 10px">         endif;
</span><span class="cx" style="display: block; padding: 0 10px">        ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-       gp_tmpl_footer();
-?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+<?php Templates::footer(); ?>
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateshelperfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/helper-functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/helper-functions.php       2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/helper-functions.php 2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,4 +1,5 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+namespace Wporg\TranslationEvents\Templates;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Urls;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplatespartialseventlistphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/partials/event-list.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/partials/event-list.php                            (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/partials/event-list.php      2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,118 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+namespace Wporg\TranslationEvents\Templates\Partials;
+
+use Wporg\TranslationEvents\Event\Event_End_Date;
+use Wporg\TranslationEvents\Event\Event_Start_Date;
+use Wporg\TranslationEvents\Event\Events_Query_Result;
+use Wporg\TranslationEvents\Urls;
+
+/** @var Events_Query_Result $query */
+/** @var ?string $pagination_query_param */
+/** @var ?bool $show_start */
+/** @var ?bool $show_end */
+/** @var ?bool $show_excerpt */
+/** @var ?string $date_format */
+/** @var ?bool $relative_time */
+/** @var ?string[] $extra_classes */
+
+$show_start    = $show_start ?? false;
+$show_end      = $show_end ?? false;
+$show_excerpt  = $show_excerpt ?? true;
+$date_format   = $date_format ?? '';
+$relative_time = $relative_time ?? true;
+$extra_classes = isset( $extra_classes ) ? implode( $extra_classes, ' ' ) : '';
+
+/**
+ * @param Event_Start_Date|Event_End_Date $time
+ */
+$print_time = function ( $time ) use ( $date_format, $relative_time ): void {
+       if ( $relative_time ) {
+               $time->print_relative_time_html( $date_format );
+       } else {
+               $time->print_time_html( $date_format );
+       }
+};
+?>
+
+<ul class="event-list <?php echo esc_attr( $extra_classes ); ?>">
+       <?php foreach ( $query->events as $event ) : ?>
+               <li class="event-list-item">
+                       <?php // Title. ?>
+                       <?php // phpcs:ignore Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace ?>
+                       <a <?php if ( $event->is_draft() ) : ?>class="event-link-draft" <?php endif; ?>
+                               href="<?php echo esc_url( Urls::event_details( $event->id() ) ); ?>">
+                               <?php echo esc_html( $event->title() ); ?>
+                       </a>
+                       <?php if ( $event->is_draft() ) : ?>
+                               <span class="event-label-draft">Draft</span>
+                       <?php endif; ?>
+
+                       <?php // Buttons. ?>
+                       <?php if ( current_user_can( 'edit_translation_event', $event->id() ) ) : ?>
+                               <a href="<?php echo esc_url( Urls::event_edit( $event->id() ) ); ?>"
+                                       class="event-list-item-button"
+                                       title="<?php echo esc_attr__( 'Edit', 'gp-translation-events' ); ?>">
+                                       <span class="dashicons dashicons-edit"></span>
+                               </a>
+                       <?php endif; ?>
+                       <?php if ( current_user_can( 'trash_translation_event', $event->id() ) ) : ?>
+                               <?php if ( $event->is_trashed() ) : ?>
+                                       <a href="<?php echo esc_url( Urls::event_trash( $event->id() ) ); ?>"
+                                               class="button is-small"
+                                               title="<?php echo esc_attr__( 'Restore', 'gp-translation-events' ); ?>">
+                                               <?php echo esc_attr__( 'Restore', 'gp-translation-events' ); ?>
+                                       </a>
+                               <?php else : ?>
+                                       <a href="<?php echo esc_url( Urls::event_trash( $event->id() ) ); ?>"
+                                               class="event-list-item-button is-destructive"
+                                               title="<?php echo esc_attr__( 'Delete', 'gp-translation-events' ); ?>">
+                                               <span class="dashicons dashicons-trash"></span>
+                                       </a>
+                               <?php endif; ?>
+                       <?php endif; ?>
+                       <?php if ( current_user_can( 'delete_translation_event', $event->id() ) ) : ?>
+                               <a href="<?php echo esc_url( Urls::event_delete( $event->id() ) ); ?>"
+                                       class="button is-small is-destructive"
+                                       title="<?php echo esc_attr__( 'Delete permanently', 'gp-translation-events' ); ?>">
+                                       <?php echo esc_attr__( 'Delete permanently', 'gp-translation-events' ); ?>
+                               </a>
+                       <?php endif; ?>
+
+                       <?php // Dates. ?>
+                       <?php if ( $show_start ) : ?>
+                               <?php if ( $event->start()->is_in_the_past() ) : ?>
+                                       <span class="event-list-date">started <?php $print_time( $event->start() ); ?></span>
+                               <?php else : ?>
+                                       <span class="event-list-date">starts <?php $print_time( $event->start() ); ?></span>
+                               <?php endif; ?>
+                       <?php endif; ?>
+                       <?php if ( $show_end ) : ?>
+                               <?php if ( $event->end()->is_in_the_past() ) : ?>
+                                       <span class="event-list-date">ended <?php $print_time( $event->end() ); ?></span>
+                               <?php else : ?>
+                                       <span class="event-list-date">ends <?php $print_time( $event->end() ); ?></time></span>
+                               <?php endif; ?>
+                       <?php endif; ?>
+
+                       <?php // Excerpt. ?>
+                       <?php if ( $show_excerpt ) : ?>
+                               <?php echo esc_html( get_the_excerpt( $event->id() ) ); ?>
+                       <?php endif; ?>
+               </li>
+       <?php endforeach; ?>
+</ul>
+
+<?php
+if ( ! empty( $pagination_query_param ) ) {
+       echo wp_kses_post(
+               paginate_links(
+                       array(
+                               'total'     => $query->page_count,
+                               'current'   => $query->current_page,
+                               'format'    => "?$pagination_query_param=%#%",
+                               'prev_text' => '&laquo; Previous',
+                               'next_text' => 'Next &raquo;',
+                       )
+               ) ?? ''
+       );
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/partials/event-list.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplatespartialsfooterphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/partials/footer.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/partials/footer.php                                (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/partials/footer.php  2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,7 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+namespace Wporg\TranslationEvents\Templates\Partials;
+
+?>
+
+<div class="clear"></div>
+<?php gp_tmpl_footer(); ?>
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/partials/footer.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplatespartialsheaderphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/partials/header.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/partials/header.php                                (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/partials/header.php  2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,43 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+namespace Wporg\TranslationEvents\Templates\Partials;
+
+use Wporg\TranslationEvents\Urls;
+use function Wporg\TranslationEvents\Templates\gp_breadcrumb_translation_events;
+
+/** @var string $html_title */
+/** @var string|callable $page_title */
+/** @var ?callable $sub_head */
+/** @var ?string[] $breadcrumbs */
+
+gp_title( $html_title );
+gp_breadcrumb_translation_events( $breadcrumbs ?? array() );
+gp_tmpl_header();
+?>
+
+<div class="event-list-top-bar">
+       <h2 class="event-page-title">
+               <?php if ( is_callable( $page_title ) ) : ?>
+                       <?php $page_title(); ?>
+               <?php else : ?>
+                       <?php echo esc_html( $page_title ); ?>
+               <?php endif; ?>
+       </h2>
+
+       <ul class="event-list-nav">
+               <?php if ( is_user_logged_in() ) : ?>
+                       <?php if ( current_user_can( 'manage_translation_events' ) ) : ?>
+                               <li><a href="<?php echo esc_url( Urls::events_trashed() ); ?>">Deleted Events</a></li>
+                       <?php endif; ?>
+                       <li><a href="<?php echo esc_url( Urls::my_events() ); ?>">My Events</a></li>
+                       <?php if ( current_user_can( 'create_translation_event' ) ) : ?>
+                               <li><a class="button is-primary" href="<?php echo esc_url( Urls::event_create() ); ?>">Create Event</a></li>
+                       <?php endif; ?>
+               <?php endif; ?>
+       </ul>
+
+       <?php if ( isset( $sub_head ) && is_callable( $sub_head ) ) : ?>
+               <p class="event-sub-head">
+                       <?php $sub_head(); ?>
+               </p>
+       <?php endif; ?>
+</div>
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/partials/header.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplatestranslationsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/translations.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/translations.php   2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/translations.php     2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,5 +1,5 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-namespace Wporg\TranslationEvents;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+namespace Wporg\TranslationEvents\Templates;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> use GP;
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Event\Event;
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventswporggptranslationeventsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/wporg-gp-translation-events.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/wporg-gp-translation-events.php      2024-05-21 01:05:42 UTC (rev 13738)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/wporg-gp-translation-events.php        2024-05-21 11:43:05 UTC (rev 13739)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,14 +18,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> namespace Wporg\TranslationEvents;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-use DateTime;
-use DateTimeZone;
</del><span class="cx" style="display: block; padding: 0 10px"> use Exception;
</span><span class="cx" style="display: block; padding: 0 10px"> use GP;
</span><span class="cx" style="display: block; padding: 0 10px"> use GP_Locales;
</span><span class="cx" style="display: block; padding: 0 10px"> use WP_Post;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-use WP_Query;
</del><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Attendee\Attendee;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use Wporg\TranslationEvents\Attendee\Attendee_Adder;
</ins><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Attendee\Attendee_Repository;
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Event\Event_Capabilities;
</span><span class="cx" style="display: block; padding: 0 10px"> use Wporg\TranslationEvents\Event\Event_Form_Handler;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -65,6 +63,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                return $attendee_repository;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        public static function get_attendee_adder(): Attendee_Adder {
+               static $attendee_adder = null;
+               if ( null === $attendee_adder ) {
+                       $attendee_adder = new Attendee_Adder( self::get_attendee_repository() );
+               }
+               return $attendee_adder;
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         public function __construct() {
</span><span class="cx" style="display: block; padding: 0 10px">                add_action( 'wp_ajax_submit_event_ajax', array( $this, 'submit_event_ajax' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                add_action( 'wp_ajax_nopriv_submit_event_ajax', array( $this, 'submit_event_ajax' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -145,9 +151,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'has_archive'  => true,
</span><span class="cx" style="display: block; padding: 0 10px">                        'hierarchical' => true,
</span><span class="cx" style="display: block; padding: 0 10px">                        'menu_icon'    => 'dashicons-calendar',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'supports'     => array( 'title', 'editor', 'thumbnail', 'revisions' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'supports'     => array( 'title', 'editor', 'thumbnail', 'revisions', 'page-attributes' ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         'rewrite'      => array( 'slug' => 'events' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'show_ui'      => false,
</del><span class="cx" style="display: block; padding: 0 10px">                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                register_post_type( self::CPT, $args );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -157,6 +162,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function event_meta_boxes() {
</span><span class="cx" style="display: block; padding: 0 10px">                add_meta_box( 'event_dates', 'Event Dates', array( $this, 'event_dates_meta_box' ), self::CPT, 'normal', 'high' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                add_meta_box( 'hosts', 'Hosts', array( $this, 'hosts_meta_box' ), self::CPT, 'normal', 'high' );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -166,15 +172,56 @@
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function event_dates_meta_box( WP_Post $post ) {
</span><span class="cx" style="display: block; padding: 0 10px">                wp_nonce_field( 'event_dates_nonce', 'event_dates_nonce' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $event_start = get_post_meta( $post->ID, '_event_start', true );
-               $event_end   = get_post_meta( $post->ID, '_event_end', true );
-               echo '<label for="event_start">Start Date: </label>';
-               echo '<input type="date" id="event_start" name="event_start" value="' . esc_attr( $event_start ) . '" required>';
-               echo '<label for="event_end">End Date: </label>';
-               echo '<input type="date" id="event_end" name="event_end" value="' . esc_attr( $event_end ) . '" required>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $event = self::get_event_repository()->get_event( $post->ID );
+               ?>
+               <label for="event_start">Start Date (UTC): </label>
+               <input type="datetime-local" id="event_start" name="event_start" value="<?php echo esc_attr( $event->start() ); ?>" required><br>
+               <label for="event_end">End Date (UTC): </label>
+               <input type="datetime-local" id="event_end" name="event_end" value="<?php echo esc_attr( $event->end() ); ?>" required><br>
+               <label for="event-timezone">Timezone: </label>
+               <select id="event-timezone" name="event_timezone" required>
+                       <?php
+                       echo wp_kses(
+                               wp_timezone_choice( $event->timezone()->getName(), get_user_locale() ),
+                               array(
+                                       'optgroup' => array( 'label' => array() ),
+                                       'option'   => array(
+                                               'value'    => array(),
+                                               'selected' => array(),
+                                       ),
+                               )
+                       );
+                       ?>
+               </select>
+               <?php
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Output the event dates meta box.
+        *
+        * @param  WP_Post $post The current post object.
+        */
+       public function hosts_meta_box( WP_Post $post ) {
+               $hosts      = self::get_attendee_repository()->get_hosts( $post->ID );
+               $hosts_list = array_map(
+                       function ( Attendee $host ) {
+                               $user = get_user_by( 'ID', $host->user_id() );
+                               if ( ! $user ) {
+                                               return '<i>Unknown user id: ' . esc_html( $host->user_id() ) . '</i>';
+                               }
+                               return '<a href="' . esc_attr( get_author_posts_url( $host->user_id() ) ) . '">' . esc_html( $user->display_name ) . '</a>';
+                       },
+                       $hosts
+               );
+               echo wp_kses(
+                       implode( ', ', $hosts_list ),
+                       array(
+                               'a' => array( 'href' => array() ),
+                       )
+               );
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Save the event meta boxes.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @param  int $post_id The current post ID.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -191,7 +238,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                return;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $fields = array( 'event_start', 'event_end' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $fields = array( 'event_start', 'event_end', 'event_timezone' );
</ins><span class="cx" style="display: block; padding: 0 10px">                 foreach ( $fields as $field ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( isset( $_POST[ $field ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                update_post_meta( $post_id, '_' . $field, sanitize_text_field( wp_unslash( $_POST[ $field ] ) ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -210,7 +257,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        public function register_translation_event_js() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                wp_register_style( 'translation-events-css', plugins_url( 'assets/css/translation-events.css', __FILE__ ), array(), filemtime( __DIR__ . '/assets/css/translation-events.css' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         wp_register_style( 'translation-events-css', plugins_url( 'assets/css/translation-events.css', __FILE__ ), array( 'dashicons' ), filemtime( __DIR__ . '/assets/css/translation-events.css' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                 gp_enqueue_style( 'translation-events-css' );
</span><span class="cx" style="display: block; padding: 0 10px">                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 );
</span><span class="cx" style="display: block; padding: 0 10px">                gp_enqueue_script( 'translation-events-js' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -240,14 +287,18 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        return;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">                if ( 'publish' === $new_status && ( 'new' === $old_status || 'draft' === $old_status ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $event_id            = $post->ID;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $event = self::get_event_repository()->get_event( $post->ID );
+                       if ( ! $event ) {
+                               return;
+                       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         $user_id             = $post->post_author;
</span><span class="cx" style="display: block; padding: 0 10px">                        $attendee_repository = self::get_attendee_repository();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $attendee            = $attendee_repository->get_attendee( $event_id, $user_id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $attendee            = $attendee_repository->get_attendee( $event->id(), $user_id );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( null === $attendee ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $attendee = new Attendee( $event_id, $user_id, true );
-                               $attendee_repository->insert_attendee( $attendee );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $attendee = new Attendee( $event->id(), $user_id, true );
+                               self::get_attendee_adder()->add_to_event( $event, $attendee );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span></span></pre>
</div>
</div>

</body>
</html>