Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions inc/compatibilities/jetengine.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

/**
* Class Optml_jetengine
*
* @reason Add support for JetEngine plugin custom endpoints.
*/
class Optml_jetengine extends Optml_compatibility {

/**
* Should we load the integration logic.
*
* @return bool Should we load.
*/
public function should_load() {
include_once ABSPATH . 'wp-admin/includes/plugin.php';

return is_plugin_active( 'jet-engine/jet-engine.php' );
}

/**
* Register integration details.
*
* @return void
*/
public function register() {
Optml_Url_Replacer::instance()->init();
add_filter(
'jet-engine/ajax/listing_load_more/response',
function ( $response ) {
if ( isset( $response['html'] ) && ! empty( $response['html'] ) ) {
$response['html'] = Optml_Main::instance()->manager->replace_content( $response['html'], true );
}

return $response;
},
10,
);
}

/**
* Should we early load the compatibility?
*
* @return bool Whether to load the compatibility or not.
*/
public function should_load_early() {
return true;
}
}
1 change: 1 addition & 0 deletions inc/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ final class Optml_Manager {
'otter_blocks',
'spectra',
'wpsp',
'jetengine',
'jetpack',
];
/**
Expand Down
Loading