<!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>[11850] sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events/meetup: Official WP Events: Sync with wordcamp.org forks.</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/11850">11850</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/11850","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>iandunn</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2022-05-17 23:25:58 +0000 (Tue, 17 May 2022)</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'>Official WP Events: Sync with wordcamp.org forks.
This includes some linting since that made it easier to compare them manually</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsofficialwordpresseventsmeetupclassapiclientphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events/meetup/class-api-client.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsofficialwordpresseventsmeetupclassmeetupclientphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events/meetup/class-meetup-client.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsofficialwordpresseventsmeetupclassmeetupoauth2clientphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events/meetup/class-meetup-oauth2-client.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsofficialwordpresseventsmeetupclassapiclientphp"></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/official-wordpress-events/meetup/class-api-client.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/official-wordpress-events/meetup/class-api-client.php 2022-05-16 04:42:38 UTC (rev 11849)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events/meetup/class-api-client.php 2022-05-17 23:25:58 UTC (rev 11850)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -35,7 +35,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="cx" style="display: block; padding: 0 10px"> * @var array A list of integer response codes that should break the "tenacious" remote request loop.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected $breaking_response_codes = [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected $breaking_response_codes = array();
</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|null The URL for the current request being attempted.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -59,13 +59,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * remote request loop.
</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">- public function __construct( array $settings = [] ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function __construct( array $settings = array() ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->error = new WP_Error();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $defaults = [
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $defaults = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'throttle_callback' => '',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'breaking_response_codes' => [ 400, 401, 404, 429 ],
- ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'breaking_response_codes' => array( 400, 401, 404, 429 ),
+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $settings = wp_parse_args( $settings, $defaults );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -85,7 +85,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array|WP_Error
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected function tenacious_remote_request( $url, array $args = [] ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected function tenacious_remote_request( $url, array $args = array() ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $attempt_count = 0;
</span><span class="cx" style="display: block; padding: 0 10px"> $max_attempts = 3;
</span><span class="cx" style="display: block; padding: 0 10px"> $breaking_codes = $this->breaking_response_codes;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -171,7 +171,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array|WP_Error
</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 tenacious_remote_get( $url, array $args = [] ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function tenacious_remote_get( $url, array $args = array() ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $args['method'] = 'GET';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->tenacious_remote_request( $url, $args );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -185,7 +185,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array|WP_Error
</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 tenacious_remote_post( $url, array $args = [] ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function tenacious_remote_post( $url, array $args = array() ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $args['method'] = 'POST';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->tenacious_remote_request( $url, $args );
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsofficialwordpresseventsmeetupclassmeetupclientphp"></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/official-wordpress-events/meetup/class-meetup-client.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/official-wordpress-events/meetup/class-meetup-client.php 2022-05-16 04:42:38 UTC (rev 11849)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events/meetup/class-meetup-client.php 2022-05-17 23:25:58 UTC (rev 11850)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -34,7 +34,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @var string The GraphQL field that must be present for pagination to work.
</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 $pageInfo = 'pageInfo { hasNextPage endCursor }';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public $pagination = 'pageInfo { hasNextPage endCursor }';
</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 Meetup_OAuth2_Client|null
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -55,7 +55,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @type bool $debug If true, the client will fetch fewer results, for faster debugging.
</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">- public function __construct( array $settings = [] ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function __construct( array $settings = array() ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> parent::__construct( array(
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="cx" style="display: block; padding: 0 10px"> * Response codes that should break the request loop.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -73,8 +73,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // TODO: NOTE: These headers are not returned from the GraphQL API, every request is 200 even if throttled.
</span><span class="cx" style="display: block; padding: 0 10px"> 401, // Unauthorized (invalid key).
</span><span class="cx" style="display: block; padding: 0 10px"> 429, // Too many requests (rate-limited).
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 404, // Unable to find group
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 404, // Unable to find group.
</ins><span class="cx" style="display: block; padding: 0 10px"> 503, // Timeout between API cache & GraphQL Server.
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> // NOTE: GraphQL does not expose the Quota Headers.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -91,10 +90,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->debug = $settings['debug'];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $this->debug ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self::cli_message( "Meetup Client debug is on. Results will be truncated." );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self::cli_message( 'Meetup Client debug is on. Results will be truncated.' );
</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">- $this->oauth_client = new Meetup_OAuth2_Client;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->oauth_client = new Meetup_OAuth2_Client();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $this->oauth_client->error->get_error_messages() ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->error = $this->merge_errors( $this->error, $this->oauth_client->error );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -138,10 +137,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Send a paginated request to the Meetup API and return the aggregated response.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * This automatically paginates requests and will repeat requests to ensure all results are retrieved.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * For pagination to work, $this->pageInfo must be present within the string, and a 'cursor' variable defined.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * For pagination to work, $this->pagination must be present within the string, and a 'cursor' variable defined.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $request_url The API endpoint URL to send the request to.
- * @param array $variables The Query variables used in the query.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $query The API endpoint URL to send the request to.
+ * @param array $variables The Query variables used in the query.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array|WP_Error The results of the request.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -151,7 +150,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $has_next_page = false;
</span><span class="cx" style="display: block; padding: 0 10px"> $is_paginated_request = ! empty( $variables ) &&
</span><span class="cx" style="display: block; padding: 0 10px"> array_key_exists( 'cursor', $variables ) &&
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- false !== stripos( $query, $this->pageInfo );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ false !== stripos( $query, $this->pagination );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> do {
</span><span class="cx" style="display: block; padding: 0 10px"> $request_args = $this->get_request_args( $query, $variables );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -194,10 +193,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // the targetted values are living.
</span><span class="cx" style="display: block; padding: 0 10px"> array_walk_recursive(
</span><span class="cx" style="display: block; padding: 0 10px"> $new_data,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function( $value, $key ) use( &$has_next_page, &$end_cursor ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function ( $value, $key ) use ( &$has_next_page, &$end_cursor ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> // NOTE: This will be truthful and present on the final page causing paged
</span><span class="cx" style="display: block; padding: 0 10px"> // requests to always make an additional request to a final empty page.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $key === 'hasNextPage' ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'hasNextPage' === $key ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $has_next_page = $value;
</span><span class="cx" style="display: block; padding: 0 10px"> } elseif ( 'endCursor' === $key ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $end_cursor = $value;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -224,7 +223,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } while ( $has_next_page );
</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 ( ! empty( $this->error->get_error_messages() ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $errors = implode( '. ', $this->error->get_error_messages() );
+ if ( ! empty( $errors ) ) {
+ trigger_error( "Request error(s): $errors", E_USER_WARNING );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> return $this->error;
</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">@@ -240,7 +242,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $merged = $array1;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $array2 as $key => &$value ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Merge numeric arrays
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Merge numeric arrays.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( is_array( $value ) && wp_is_numeric_array( $value ) && isset( $merged[ $key ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $merged[ $key ] = array_merge( $merged[ $key ], $value );
</span><span class="cx" style="display: block; padding: 0 10px"> } elseif ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -276,7 +278,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'Content-Type' => 'application/json',
</span><span class="cx" style="display: block; padding: 0 10px"> 'Authorization' => "Bearer $oauth_token",
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'body' => wp_json_encode( compact( 'query', 'variables' ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'body' => wp_json_encode( compact( 'query', 'variables' ) ),
</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">@@ -283,7 +285,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Check the rate limit status in an API response and delay further execution if necessary.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $headers
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param array $response
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return void
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -351,15 +353,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $datetime->getTimestamp();
</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">- $datetime_formats = [
- 'Y-m-d\TH:iP', // 2021-11-20T17:00+05:30
- 'Y-m-d\TH:i:sP', // 2021-11-20T17:00:00+05:30
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $datetime_formats = array(
+ 'Y-m-d\TH:iP', // '2021-11-20T17:00+05:30'.
+ 'Y-m-d\TH:i:sP', // '2021-11-20T17:00:00+05:30'.
</ins><span class="cx" style="display: block; padding: 0 10px"> // DateTime::createFromFormat() doesn't handle the final `]` character in the following timezone format.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'Y-m-d\TH:i\[e', // 2021-11-20T06:30[US/Eastern]
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'Y-m-d\TH:i\[e', // '2021-11-20T06:30[US/Eastern]'.
</ins><span class="cx" style="display: block; padding: 0 10px"> 'c', // ISO8601, just incase the above don't cover it.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'Y-m-d\TH:i:s', // timezoneless 2021-11-20T17:00:00
- 'Y-m-d\TH:i', // timezoneless 2021-11-20T17:00
- ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'Y-m-d\TH:i:s', // timezoneless '2021-11-20T17:00:00'.
+ 'Y-m-d\TH:i', // timezoneless '2021-11-20T17:00'.
+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // See above, just keep one timezone if the timezone format is `P\[e\]`. Simpler matching, assume the timezones are the same.
</span><span class="cx" style="display: block; padding: 0 10px"> $datetime = preg_replace( '/([-+][0-9:]+)[[].+[]]$/', '$1', $datetime );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -467,13 +469,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array|WP_Error
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_groups( array $args = array() ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $fields = $this->get_default_fields( 'group' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $filters = array();
+ $fields = $this->get_default_fields( 'group' );
</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( $args['fields'] ) && is_array( $args['fields'] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! empty( $args['fields'] ) && is_array( $args['fields'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $fields = array_merge( $fields, $args['fields'] );
</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">- $filters = [];
</del><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="cx" style="display: block; padding: 0 10px"> * See https://www.meetup.com/api/schema/#GroupAnalyticsFilter for valid filters.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -490,11 +492,11 @@
</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">- $variables = [
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $variables = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'urlname' => 'wordpress',
</span><span class="cx" style="display: block; padding: 0 10px"> 'perPage' => 200,
</span><span class="cx" style="display: block; padding: 0 10px"> 'cursor' => null,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query = '
</span><span class="cx" style="display: block; padding: 0 10px"> query ($urlname: String!, $perPage: Int!, $cursor: String ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -501,7 +503,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> proNetworkByUrlname( urlname: $urlname ) {
</span><span class="cx" style="display: block; padding: 0 10px"> groupsSearch( input: { first: $perPage, after: $cursor }, filter: { ' . implode( ', ', $filters ) . '} ) {
</span><span class="cx" style="display: block; padding: 0 10px"> count
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ' . $this->pageInfo . '
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ' . $this->pagination . '
</ins><span class="cx" style="display: block; padding: 0 10px"> edges {
</span><span class="cx" style="display: block; padding: 0 10px"> node {
</span><span class="cx" style="display: block; padding: 0 10px"> ' . implode( ' ', $fields ) . '
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -517,14 +519,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $result;
</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">- $results = array_column(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $groups = array_column(
</ins><span class="cx" style="display: block; padding: 0 10px"> $result['proNetworkByUrlname']['groupsSearch']['edges'],
</span><span class="cx" style="display: block; padding: 0 10px"> 'node'
</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">- $results = $this->apply_backcompat_fields( 'groups', $results );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $groups = $this->apply_backcompat_fields( 'groups', $groups );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $results;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $groups;
</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">@@ -577,20 +579,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $event_id The Event ID.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function get_event_details( $event_id ) {
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function get_event_details( $event_id ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $fields = $this->get_default_fields( 'event' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Accepts, slug / id / slugId as the query-by fields.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $query = '
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $query = '
</ins><span class="cx" style="display: block; padding: 0 10px"> query ( $eventId: ID ) {
</span><span class="cx" style="display: block; padding: 0 10px"> event( id: $eventId ) {
</span><span class="cx" style="display: block; padding: 0 10px"> ' . implode( ' ', $fields ) . '
</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">- $variables = [
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $variables = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'eventId' => $event_id,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $result = $this->send_paginated_request( $query, $variables );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -616,15 +617,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_events_status( $event_ids ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /* $events = [ id => $meetupID, id2 => $meetupID2 ] */
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $return = [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $return = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> $chunks = array_chunk( $event_ids, 250, true );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $chunks as $chunked_events ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $keys = [];
- $query = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $keys = array();
+ $query = '';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $chunked_events as $id => $event_id ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $key = 'e' . md5( $id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $key = 'e' . md5( $id );
</ins><span class="cx" style="display: block; padding: 0 10px"> $keys[ $key ] = $id;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query .= sprintf(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -658,19 +659,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array|WP_Error
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_group_details( $group_slug, $args = array() ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $fields = $this->get_default_fields( 'group' );;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $fields = $this->get_default_fields( 'group' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $events_fields = [
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $events_fields = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'dateTime',
</span><span class="cx" style="display: block; padding: 0 10px"> 'going',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ];
</del><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( $args['fields'] ) && is_array( $args['fields'] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! empty( $args['fields'] ) && is_array( $args['fields'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $fields = array_merge( $fields, $args['fields'] );
</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 ( !empty( $args['events_fields'] ) && is_array( $args['events_fields'] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! empty( $args['events_fields'] ) && is_array( $args['events_fields'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $events_fields = array_merge( $events_fields, $args['events_fields'] );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( !empty( $args['events_fields'] ) && true === $args['events_fields'] ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( ! empty( $args['events_fields'] ) && true === $args['events_fields'] ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $events_fields = array_merge( $events_fields, $this->get_default_fields( '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">@@ -677,12 +678,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // pastEvents cannot filter to the most recent past event, `last: 1`, `reverse:true, first: 1`, etc doesn't work.
</span><span class="cx" style="display: block; padding: 0 10px"> // Instead, we fetch the details for every past event instead.
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $query = '
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $query = '
</ins><span class="cx" style="display: block; padding: 0 10px"> query ( $urlname: String!, $perPage: Int!, $cursor: String ) {
</span><span class="cx" style="display: block; padding: 0 10px"> groupByUrlname( urlname: $urlname ) {
</span><span class="cx" style="display: block; padding: 0 10px"> ' . implode( ' ', $fields ) . '
</span><span class="cx" style="display: block; padding: 0 10px"> pastEvents ( input: { first: $perPage, after: $cursor } ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ' . $this->pageInfo . '
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ' . $this->pagination . '
</ins><span class="cx" style="display: block; padding: 0 10px"> edges {
</span><span class="cx" style="display: block; padding: 0 10px"> node {
</span><span class="cx" style="display: block; padding: 0 10px"> ' . implode( ' ', $events_fields ) . '
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -691,11 +692,11 @@
</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">- $variables = [
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $variables = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'urlname' => $group_slug,
</span><span class="cx" style="display: block; padding: 0 10px"> 'perPage' => 200,
</span><span class="cx" style="display: block; padding: 0 10px"> 'cursor' => null,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $result = $this->send_paginated_request( $query, $variables );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -703,12 +704,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $result;
</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">- // Format it similar to previous response payload??
- $result = $result['groupByUrlname'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Format it similar to previous response payload.
+ $group = $this->apply_backcompat_fields( 'group', $result['groupByUrlname'] );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $result = $this->apply_backcompat_fields( 'group', $result );
-
- return $result;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $group;
</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">@@ -729,8 +728,8 @@
</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">- // Filters
- $filters = [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Filters.
+ $filters = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $args['role'] ) && 'leads' === $args['role'] ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // See https://www.meetup.com/api/schema/#MembershipStatus for valid statuses.
</span><span class="cx" style="display: block; padding: 0 10px"> $filters[] = 'status: LEADER';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -743,11 +742,11 @@
</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"> // 'memberships' => 'GroupUserConnection' not documented.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $query = '
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $query = '
</ins><span class="cx" style="display: block; padding: 0 10px"> query ( $urlname: String!, $perPage: Int!, $cursor: String ) {
</span><span class="cx" style="display: block; padding: 0 10px"> groupByUrlname( urlname: $urlname ) {
</span><span class="cx" style="display: block; padding: 0 10px"> memberships ( input: { first: $perPage, after: $cursor }, filter: { ' . implode( ', ', $filters ) . ' } ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ' . $this->pageInfo . '
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ' . $this->pagination . '
</ins><span class="cx" style="display: block; padding: 0 10px"> edges {
</span><span class="cx" style="display: block; padding: 0 10px"> node {
</span><span class="cx" style="display: block; padding: 0 10px"> ' . implode( ' ', $fields ) . '
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -756,11 +755,11 @@
</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">- $variables = [
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $variables = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'urlname' => $group_slug,
</span><span class="cx" style="display: block; padding: 0 10px"> 'perPage' => 200,
</span><span class="cx" style="display: block; padding: 0 10px"> 'cursor' => null,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $results = $this->send_paginated_request( $query, $variables );
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_wp_error( $results ) || ! isset( $results['groupByUrlname'] ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -767,7 +766,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $results;
</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">- // Select memberships.edges[*].node
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Select memberships.edges[*].node.
</ins><span class="cx" style="display: block; padding: 0 10px"> $results = array_column(
</span><span class="cx" style="display: block; padding: 0 10px"> $results['groupByUrlname']['memberships']['edges'],
</span><span class="cx" style="display: block; padding: 0 10px"> 'node'
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -780,20 +779,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Query all events from the Network.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_network_events( array $args = array() ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $defaults = [
- 'filters' => [],
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $defaults = array(
+ 'filters' => array(),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'max_event_date' => time() + YEAR_IN_SECONDS,
</span><span class="cx" style="display: block; padding: 0 10px"> 'min_event_date' => false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'online_events' => null, // true: only online events, false: only IRL events
- 'status' => 'upcoming', // UPCOMING, PAST, CANCELLED
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'online_events' => null, // true: only online events, false: only IRL events.
+ 'status' => 'upcoming', // UPCOMING, PAST, CANCELLED.
</ins><span class="cx" style="display: block; padding: 0 10px"> 'sort' => '',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ];
- $args = wp_parse_args( $args, $defaults );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
+ $args = wp_parse_args( $args, $defaults );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $fields = $this->get_default_fields( '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">- // See https://www.meetup.com/api/schema/#ProNetworkEventsFilter
- $filters = [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // See https://www.meetup.com/api/schema/#ProNetworkEventsFilter.
+ $filters = array();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $args['min_event_date'] ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $filters['eventDateMin'] = 'eventDateMin: ' . $this->datetime_to_time( $args['min_event_date'] ) * 1000;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -806,22 +805,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $filters['isOnlineEvent'] = 'isOnlineEvent: ' . ( $args['online_events'] ? 'true' : '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">- // See https://www.meetup.com/api/schema/#ProNetworkEventStatus
- if ( $args['status'] && in_array( $args['status'], [ 'cancelled', 'upcoming', 'past' ] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // See https://www.meetup.com/api/schema/#ProNetworkEventStatus.
+ if ( $args['status'] && in_array( $args['status'], array( 'cancelled', 'upcoming', 'past' ) ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $filters['status'] = 'status: ' . strtoupper( $args['status'] );
</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"> if ( $args['filters'] ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- foreach( $args['filters'] as $key => $filter ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ foreach ( $args['filters'] as $key => $filter ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $filters[ $key ] = "{$key}: {$filter}";
</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">- $query = '
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $query = '
</ins><span class="cx" style="display: block; padding: 0 10px"> query ( $urlname: String!, $perPage: Int!, $cursor: String ) {
</span><span class="cx" style="display: block; padding: 0 10px"> proNetworkByUrlname( urlname: $urlname ) {
</span><span class="cx" style="display: block; padding: 0 10px"> eventsSearch ( input: { first: $perPage, after: $cursor }, filter: { ' . implode( ', ', $filters ) . ' } ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ' . $this->pageInfo . '
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ' . $this->pagination . '
</ins><span class="cx" style="display: block; padding: 0 10px"> edges {
</span><span class="cx" style="display: block; padding: 0 10px"> node {
</span><span class="cx" style="display: block; padding: 0 10px"> ' . implode( ' ', $fields ) . '
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -830,13 +829,12 @@
</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">- $variables = [
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $variables = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'urlname' => 'wordpress',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'perPage' => 1000, // More per-page to avoid hitting request limits
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'perPage' => 1000, // More per-page to avoid hitting request limits.
</ins><span class="cx" style="display: block; padding: 0 10px"> 'cursor' => null,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ];
</del><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">-
</del><span class="cx" style="display: block; padding: 0 10px"> $results = $this->send_paginated_request( $query, $variables );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_wp_error( $results ) || ! array_key_exists( 'eventsSearch', $results['proNetworkByUrlname'] ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -844,18 +842,18 @@
</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"> if ( empty( $results['proNetworkByUrlname']['eventsSearch'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return array();
</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">- // Select edges[*].node
- $results = array_column(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Select edges[*].node.
+ $events = array_column(
</ins><span class="cx" style="display: block; padding: 0 10px"> $results['proNetworkByUrlname']['eventsSearch']['edges'],
</span><span class="cx" style="display: block; padding: 0 10px"> 'node'
</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">- $results = $this->apply_backcompat_fields( 'events', $results );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $events = $this->apply_backcompat_fields( 'events', $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">- return $results;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $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">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -868,13 +866,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array|WP_Error
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_group_events( $group_slug, array $args = array() ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $defaults = [
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $defaults = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'status' => 'upcoming',
</span><span class="cx" style="display: block; padding: 0 10px"> 'no_earlier_than' => '',
</span><span class="cx" style="display: block; padding: 0 10px"> 'no_later_than' => '',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'fields' => [],
- ];
- $args = wp_parse_args( $args, $defaults );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'fields' => array(),
+ );
+ $args = wp_parse_args( $args, $defaults );
</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"> * The GraphQL API has 4 events fields, here's some comments:
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -891,7 +889,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * we can query using the individual fields to get the statii we want, and apply the other filters directly.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> if ( false !== strpos( $args['status'], ',' ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $events = [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $events = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( explode( ',', $args['status'] ) as $status ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $args['status'] = $status;
</span><span class="cx" style="display: block; padding: 0 10px"> $status_events = $this->get_group_events( $group_slug, $args );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -905,21 +903,22 @@
</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"> // Resort all items.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- usort( $events, function( $a, $b ) {
- if ( $a['time'] == $b['time'] ) {
- return 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ usort(
+ $events,
+ function( $a, $b ) {
+ if ( $a['time'] == $b['time'] ) {
+ return 0;
+ }
+
+ return ( $a['time'] < $b['time'] ) ? -1 : 1;
</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">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return ( $a['time'] < $b['time'] ) ? -1 : 1;
- } );
-
</del><span class="cx" style="display: block; padding: 0 10px"> return $events;
</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"> $fields = $this->get_default_fields( '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">- // TODO: Check the above list against Official_WordPress_Events::parse_meetup_events()
-
</del><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $args['fields'] ) && is_array( $args['fields'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $fields = array_merge(
</span><span class="cx" style="display: block; padding: 0 10px"> $fields,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -936,16 +935,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px"> default:
</span><span class="cx" style="display: block; padding: 0 10px"> // We got nothing.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return array();
</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"> // No filters defined, as we have to do it ourselves. See above.
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $query = '
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $query = '
</ins><span class="cx" style="display: block; padding: 0 10px"> query ( $urlname: String!, $perPage: Int!, $cursor: String ) {
</span><span class="cx" style="display: block; padding: 0 10px"> groupByUrlname( urlname: $urlname ) {
</span><span class="cx" style="display: block; padding: 0 10px"> ' . $event_field . ' ( input: { first: $perPage, after: $cursor } ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ' . $this->pageInfo . '
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ' . $this->pagination . '
</ins><span class="cx" style="display: block; padding: 0 10px"> edges {
</span><span class="cx" style="display: block; padding: 0 10px"> node {
</span><span class="cx" style="display: block; padding: 0 10px"> ' . implode( ' ', $fields ) . '
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -954,11 +953,11 @@
</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">- $variables = [
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $variables = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'urlname' => $group_slug,
</span><span class="cx" style="display: block; padding: 0 10px"> 'perPage' => 200,
</span><span class="cx" style="display: block; padding: 0 10px"> 'cursor' => null,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $results = $this->send_paginated_request( $query, $variables );
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_wp_error( $results ) || ! isset( $results['groupByUrlname'] ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -965,13 +964,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $results;
</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">- // Select {$event_field}.edges[*].node
- $results = array_column(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Select {$event_field}.edges[*].node.
+ $events = array_column(
</ins><span class="cx" style="display: block; padding: 0 10px"> $results['groupByUrlname'][ $event_field ]['edges'],
</span><span class="cx" style="display: block; padding: 0 10px"> 'node'
</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">- $results = $this->apply_backcompat_fields( 'events', $results );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $events = $this->apply_backcompat_fields( 'events', $events );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Apply filters.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $args['no_earlier_than'] || $args['no_later_than'] ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -978,17 +977,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $args['no_earlier_than'] = $this->datetime_to_time( $args['no_earlier_than'] ) ?: 0;
</span><span class="cx" style="display: block; padding: 0 10px"> $args['no_later_than'] = $this->datetime_to_time( $args['no_later_than'] ) ?: PHP_INT_MAX;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $results = array_filter(
- $results,
- function( $event ) use( $args ) {
- return
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $events = array_filter(
+ $events,
+ function ( $event ) use ( $args ) {
+ return (
</ins><span class="cx" style="display: block; padding: 0 10px"> $event['time'] >= $args['no_earlier_than'] &&
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $event['time'] < $args['no_later_than'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $event['time'] < $args['no_later_than']
+ );
</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="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $results;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $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"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1001,7 +1001,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_result_count( $route, array $args = array() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $result = false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $filters = [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $filters = array();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Number of groups in the Pro Network.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'pro/wordpress/groups' !== $route ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1008,7 +1008,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">- // https://www.meetup.com/api/schema/#GroupAnalyticsFilter
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // https://www.meetup.com/api/schema/#GroupAnalyticsFilter.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $args['pro_join_date_max'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $filters['proJoinDateMax'] = 'proJoinDateMax: ' . $this->datetime_to_time( $args['pro_join_date_max'] ) * 1000;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1024,7 +1024,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $query = '
</span><span class="cx" style="display: block; padding: 0 10px"> query {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- proNetworkByUrlname( urlname: "wordpress" ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ proNetworkByUrlname( urlname: "WordPress" ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> groupsSearch( filter: { ' . implode( ', ', $filters ) . ' } ) {
</span><span class="cx" style="display: block; padding: 0 10px"> count
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1048,7 +1048,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> protected function get_default_fields( $type ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'event' === $type ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // See https://www.meetup.com/api/schema/#Event for valid fields.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return [
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'id',
</span><span class="cx" style="display: block; padding: 0 10px"> 'title',
</span><span class="cx" style="display: block; padding: 0 10px"> 'description',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1066,24 +1066,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ' . implode( ' ', $this->get_default_fields( 'group' ) ) . '
</span><span class="cx" style="display: block; padding: 0 10px"> }',
</span><span class="cx" style="display: block; padding: 0 10px"> 'venue {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- id
- lat
- lng
- name
- city
- state
- country
- }'
- ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ' . implode( ' ', $this->get_default_fields( 'venue' ) ) . '
+ }',
+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> } elseif ( 'memberships' === $type ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // See https://www.meetup.com/api/schema/#User for valid fields.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return [
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'id',
</span><span class="cx" style="display: block; padding: 0 10px"> 'name',
</span><span class="cx" style="display: block; padding: 0 10px"> 'email',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> } elseif ( 'group' === $type ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return [
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'id',
</span><span class="cx" style="display: block; padding: 0 10px"> 'name',
</span><span class="cx" style="display: block; padding: 0 10px"> 'urlname',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1100,7 +1094,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'proJoinDate',
</span><span class="cx" style="display: block; padding: 0 10px"> 'latitude',
</span><span class="cx" style="display: block; padding: 0 10px"> 'longitude',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
+ } elseif ( 'venue' === $type ) {
+ return array(
+ 'id',
+ 'lat',
+ 'lng',
+ 'name',
+ 'city',
+ 'state',
+ 'country',
+ );
</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">@@ -1111,6 +1115,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $type The type of result object.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $result The result to back-compat.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return The $result with back-compat.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected function apply_backcompat_fields( $type, $result ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1124,7 +1129,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"> // Parse an ISO DateInterval into seconds.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $now = time();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $now = time();
</ins><span class="cx" style="display: block; padding: 0 10px"> $result['duration'] = ( DateTimeImmutable::createFromFormat( 'U', $now ) )->add( new DateInterval( $result['duration'] ) )->getTimestamp() - $now;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $result['utc_offset'] = 0;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1163,8 +1168,8 @@
</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"> $result['status'] = strtolower( $result['status'] );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( in_array( $result['status'], [ 'published', 'past', 'active', 'autosched' ] ) ) {
- $result['status'] = 'upcoming'; // Right, past is upcoming in this context
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( in_array( $result['status'], array( 'published', 'past', 'active', 'autosched' ) ) ) {
+ $result['status'] = 'upcoming'; // Right, past is upcoming in this context.
</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"> $result['yes_rsvp_count'] = $result['going'];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1191,10 +1196,10 @@
</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"> if ( ! empty( $result['pastEvents']['edges'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $result['last_event'] = [
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $result['last_event'] = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'time' => $this->datetime_to_time( end( $result['pastEvents']['edges'] )['node']['dateTime'] ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'yes_rsvp_count' => end( $result['pastEvents']['edges'] )['node']['going'],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> $result['past_event_count'] = count( $result['pastEvents']['edges'] );
</span><span class="cx" style="display: block; padding: 0 10px"> } elseif ( ! empty( $result['groupAnalytics']['lastEventDate'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // NOTE: last_event here vs above differs intentionally.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1217,12 +1222,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Generate a localised location name.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * For the US this is 'City, ST, USA'
- * For Canada this is 'City, ST, Canada'
- * For the rest of world, this is 'City, CountryName'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * For the US this is 'City, ST, USA'.
+ * For Canada this is 'City, ST, Canada'.
+ * For the rest of world, this is 'City, CountryName'.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected function localise_location( $args = array() ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Hard-code the Online event location
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Hard-code the Online event location.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $args['id'] ) && self::ONLINE_VENUE_ID == $args['id'] ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return 'online';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1242,7 +1247,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Set countries to USA, AU, or Australia in that order.
</span><span class="cx" style="display: block; padding: 0 10px"> $country = $this->localised_country_name( $country );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return implode( ', ', array_filter( [ $city, $state, $country ] ) ) ?: false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return implode( ', ', array_filter( array( $city, $state, $country ) ) ) ?: 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"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1256,11 +1261,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $country = strtoupper( $country );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Shortcut, CLDR isn't always what we expect here.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $shortcut = [
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $shortcut = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'US' => 'USA',
</span><span class="cx" style="display: block; padding: 0 10px"> 'HK' => 'Hong Kong',
</span><span class="cx" style="display: block; padding: 0 10px"> 'SG' => 'Singapore',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $shortcut[ $country ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return $shortcut[ $country ];
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsofficialwordpresseventsmeetupclassmeetupoauth2clientphp"></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/official-wordpress-events/meetup/class-meetup-oauth2-client.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/official-wordpress-events/meetup/class-meetup-oauth2-client.php 2022-05-16 04:42:38 UTC (rev 11849)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events/meetup/class-meetup-oauth2-client.php 2022-05-17 23:25:58 UTC (rev 11850)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -127,10 +127,10 @@
</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"> * Request one of various types of tokens from the Meetup OAuth API.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * Setting $type to 'access_token' is for step 2 of the oAuth flow. This takes a code that has been previously set
</span><span class="cx" style="display: block; padding: 0 10px"> * through a user-initiated oAuth authentication.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * Setting $type to 'refresh_token' will request a new access_token generated through the above access_token method.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @see https://www.meetup.com/api/authentication/#p02-server-flow-section
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -149,14 +149,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $request_headers = $this->get_headers();
</span><span class="cx" style="display: block; padding: 0 10px"> $request_body = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- switch( $type ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ switch ( $type ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> case 'access_token': // Request a new access token.
</span><span class="cx" style="display: block; padding: 0 10px"> $args = wp_parse_args( $args, array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'code' => '',
</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">- $request_url = self::URL_ACCESS_TOKEN;
- $request_body = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $request_url = self::URL_ACCESS_TOKEN;
+ $request_body = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'client_id' => self::CONSUMER_KEY,
</span><span class="cx" style="display: block; padding: 0 10px"> 'client_secret' => self::CONSUMER_SECRET,
</span><span class="cx" style="display: block; padding: 0 10px"> 'grant_type' => 'authorization_code',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -237,7 +237,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $_GET['code'] ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $message = sprintf(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "Meetup.com oAuth expired. Please access the following url while logged into the %s meetup.com account: \n\n%s\n\n" .
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "Meetup.com oAuth expired. Please access the following url while logged into the %s meetup.com account: \n\n%s\n\n" .
</ins><span class="cx" style="display: block; padding: 0 10px"> "For sites other than WordCamp Central, the ?code=... parameter will need to be stored on this site via wp-cli and this task run again: `wp --url=%s site option update '%s' '...'`",
</span><span class="cx" style="display: block; padding: 0 10px"> self::EMAIL,
</span><span class="cx" style="display: block; padding: 0 10px"> sprintf(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -264,7 +264,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $this->is_valid_token( $token, 'access_token' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> delete_site_option( self::SITE_OPTION_KEY_AUTHORIZATION, false );
</span><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"> } elseif ( $this->is_expired_token( $token ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $token = $this->request_token( 'refresh_token', $token );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>
</body>
</html>