From 9a8be7e95abdba2ffb54837321f15235c7f764b2 Mon Sep 17 00:00:00 2001 From: Carsten Bach Date: Mon, 16 Sep 2024 20:12:36 +0200 Subject: [PATCH] Rename methods --- includes/core/classes/class-calendars.php | 22 +++++++++---------- .../templates/endpoints/ical-download.php | 2 +- includes/templates/endpoints/ical-feed.php | 2 +- .../core/classes/class-test-event.php | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/includes/core/classes/class-calendars.php b/includes/core/classes/class-calendars.php index fb442c2b6..ff3b6e6c1 100644 --- a/includes/core/classes/class-calendars.php +++ b/includes/core/classes/class-calendars.php @@ -128,8 +128,8 @@ public function init_events(): void { ); new Posttype_Single_Endpoint( array( - new Endpoint_Template( self::ICAL_SLUG, array( $this, 'get_ical_download_template' ) ), - new Endpoint_Template( 'outlook', array( $this, 'get_ical_download_template' ) ), + new Endpoint_Template( self::ICAL_SLUG, array( $this, 'get_ical_file_template' ) ), + new Endpoint_Template( 'outlook', array( $this, 'get_ical_file_template' ) ), new Endpoint_Redirect( 'google-calendar', array( $this, 'get_google_calendar_link' ) ), new Endpoint_Redirect( 'yahoo-calendar', array( $this, 'get_yahoo_calendar_link' ) ), ), @@ -355,7 +355,7 @@ function ( $link ) { * - 'file_name': the file name of the template to be loaded from the theme. Will load defaults from the plugin if theme files do not exist. * - 'dir_path': (Optional) Absolute path to some template directory outside of the theme folder. */ - public function get_ical_download_template(): array { + public function get_ical_file_template(): array { return array( 'file_name' => Utility::prefix_key( 'ical-download.php' ), ); @@ -538,7 +538,7 @@ public function get_yahoo_calendar_link(): string { ); } - public static function get_ics_calendar_wrap( string $calendar_data ): string { + public static function get_ical_wrap( string $calendar_data ): string { // Prpeare 2-DIGIT lang code. $title = get_bloginfo( 'title' ); @@ -570,7 +570,7 @@ public static function get_ics_calendar_wrap( string $calendar_data ): string { * * @throws Exception If an error occurs while generating the ICS download link. */ - public static function get_ics_calendar_event(): string { + public static function get_ical_event(): string { $event = new Event( get_queried_object_id() ); $date_start = $event->get_formatted_datetime( 'Ymd', 'start', false ); @@ -605,7 +605,7 @@ public static function get_ics_calendar_event(): string { return implode( "\r\n", $args ); } - public static function get_ics_calendar_list(): string { + public static function get_ical_list(): string { $event_list_type = ''; // Keep empty, to get all events from upcoming & past. $number = ( is_feed( self::ICAL_SLUG ) ) ? -1 : get_option( 'posts_per_page' ); @@ -633,7 +633,7 @@ public static function get_ics_calendar_list(): string { $query = Event_Query::get_instance()->get_events_list( $event_list_type, $number, $topics, $venues ); while ( $query->have_posts() ) { $query->the_post(); - $output[] = self::get_ics_calendar_event(); + $output[] = self::get_ical_event(); } // Restore original Post Data. @@ -643,12 +643,12 @@ public static function get_ics_calendar_list(): string { } - public static function get_ics_calendar_download(): string { - return self::get_ics_calendar_wrap( self::get_ics_calendar_event() ); + public static function get_ical_file(): string { + return self::get_ical_wrap( self::get_ical_event() ); } - public static function get_ics_calendar_feed(): string { - return self::get_ics_calendar_wrap( self::get_ics_calendar_list() ); + public static function get_ical_feed(): string { + return self::get_ical_wrap( self::get_ical_list() ); } /** diff --git a/includes/templates/endpoints/ical-download.php b/includes/templates/endpoints/ical-download.php index 7650b5ddf..2e0661f8a 100644 --- a/includes/templates/endpoints/ical-download.php +++ b/includes/templates/endpoints/ical-download.php @@ -27,7 +27,7 @@ function gatherpress_output_ics_file() { Calendars::send_ics_headers( $filename ); // Output the generated iCalendar content. - echo wp_kses_post( Calendars::get_ics_calendar_download() ); + echo wp_kses_post( Calendars::get_ical_file() ); // Get the generated output and calculate file size. $ics_content = ob_get_contents(); diff --git a/includes/templates/endpoints/ical-feed.php b/includes/templates/endpoints/ical-feed.php index 5a023f171..5a0017f11 100644 --- a/includes/templates/endpoints/ical-feed.php +++ b/includes/templates/endpoints/ical-feed.php @@ -27,7 +27,7 @@ function gatherpress_output_ics_file() { Calendars::send_ics_headers( $filename ); // Output the generated iCalendar content. - echo wp_kses_post( Calendars::get_ics_calendar_feed() ); + echo wp_kses_post( Calendars::get_ical_feed() ); // Get the generated output and calculate file size. $ics_content = ob_get_contents(); diff --git a/test/unit/php/includes/core/classes/class-test-event.php b/test/unit/php/includes/core/classes/class-test-event.php index 0776232ca..94b9ef06b 100644 --- a/test/unit/php/includes/core/classes/class-test-event.php +++ b/test/unit/php/includes/core/classes/class-test-event.php @@ -371,7 +371,7 @@ public function test_get_venue_information(): void { * * @covers ::get_calendar_links * @covers ::get_google_calendar_link - * @covers ::get_ics_calendar_download + * @covers ::get_ical_file * @covers ::get_yahoo_calendar_link * @covers ::get_calendar_description *