wp/wp-admin/includes/class-wp-community-events.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
   451 	 * higher position, so that it doesn't get trimmed off.
   451 	 * higher position, so that it doesn't get trimmed off.
   452 	 *
   452 	 *
   453 	 * @since 4.8.0
   453 	 * @since 4.8.0
   454 	 * @since 4.9.7 Stick a WordCamp to the final list.
   454 	 * @since 4.9.7 Stick a WordCamp to the final list.
   455 	 * @since 5.5.2 Accepts and returns only the events, rather than an entire HTTP response.
   455 	 * @since 5.5.2 Accepts and returns only the events, rather than an entire HTTP response.
       
   456 	 * @since 6.0.0 Decode HTML entities from the event title.
   456 	 *
   457 	 *
   457 	 * @param array $events The events that will be prepared.
   458 	 * @param array $events The events that will be prepared.
   458 	 * @return array The response body with events trimmed.
   459 	 * @return array The response body with events trimmed.
   459 	 */
   460 	 */
   460 	protected function trim_events( array $events ) {
   461 	protected function trim_events( array $events ) {
   466 			 * it can be converted to the _user's_ local time.
   467 			 * it can be converted to the _user's_ local time.
   467 			 */
   468 			 */
   468 			$end_time = (int) $event['end_unix_timestamp'];
   469 			$end_time = (int) $event['end_unix_timestamp'];
   469 
   470 
   470 			if ( time() < $end_time ) {
   471 			if ( time() < $end_time ) {
       
   472 				// Decode HTML entities from the event title.
       
   473 				$event['title'] = html_entity_decode( $event['title'], ENT_QUOTES, 'UTF-8' );
       
   474 
   471 				array_push( $future_events, $event );
   475 				array_push( $future_events, $event );
   472 			}
   476 			}
   473 		}
   477 		}
   474 
   478 
   475 		$future_wordcamps = array_filter(
   479 		$future_wordcamps = array_filter(
   476 			$future_events,
   480 			$future_events,
   477 			function( $wordcamp ) {
   481 			static function( $wordcamp ) {
   478 				return 'wordcamp' === $wordcamp['type'];
   482 				return 'wordcamp' === $wordcamp['type'];
   479 			}
   483 			}
   480 		);
   484 		);
   481 
   485 
   482 		$future_wordcamps    = array_values( $future_wordcamps ); // Remove gaps in indices.
   486 		$future_wordcamps    = array_values( $future_wordcamps ); // Remove gaps in indices.