Skip to content

Commit

Permalink
Rename methods
Browse files Browse the repository at this point in the history
  • Loading branch information
carstingaxion committed Sep 16, 2024
1 parent fa3e35b commit 9a8be7e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
22 changes: 11 additions & 11 deletions includes/core/classes/class-calendars.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) ),
),
Expand Down Expand Up @@ -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' ),
);
Expand Down Expand Up @@ -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' );
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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' );
Expand Down Expand Up @@ -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.
Expand All @@ -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() );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion includes/templates/endpoints/ical-download.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion includes/templates/endpoints/ical-feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion test/unit/php/includes/core/classes/class-test-event.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit 9a8be7e

Please sign in to comment.