Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add support for The Events Calendar #599

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/classes/class-compatibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public function __construct() {
*/
new BuddyBoss();

/**
* Support for The Events Calendar
*/
new TheEventsCalendar();

/**
* Support for BuddyPress
*/
Expand Down
48 changes: 48 additions & 0 deletions lib/classes/compatibility/the-events-calendar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* Plugin Name: TheEventsCalendar
* Plugin URI: https://wordpress.org/plugins/the-events-calendar/
*
* Compatibility Description: Ensures compatibility with The Events Calendar.
* Noteably: The Events Calendar does not store media, but it uses a fake file called 'silence'
*
*/

namespace wpCloud\StatelessMedia {

if( !class_exists( 'wpCloud\StatelessMedia\TheEventsCalendar' ) ) {

class TheEventsCalendar extends ICompatibility {
protected $id = 'theeventscalendar';
protected $title = 'TheEventsCalendar';
protected $constant = 'WP_STATELESS_COMPATIBILITY_THEEVENTSCALENDAR';
protected $description = 'Ensures compatibility with TheEventsCalendar.';
protected $plugin_file = [ 'the-events-calendar/the-events-calendar.php' ];
protected $sm_mode_not_supported = [ ];

/**
* @param $sm
*/
public function module_init( $sm ) {
add_action( 'stateless_skip_cache_busting', array( $this, 'skip_cache_busting' ), 10, 2 );
}

/**
* skip cache busting for template file name.
* @param $return
* @param $filename
* @return mixed
*/
public function skip_cache_busting( $return, $filename ) {
$backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 8 );
if( strpos( $backtrace[ 7 ][ 'file' ], '/the-events-calendar/' ) !== false ) {
return $filename;
}
return $return;
}

}

}

}