| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Class Optml_jetengine |
| 5 |
* |
| 6 |
* @reason Add support for JetEngine plugin custom endpoints. |
| 7 |
*/ |
| 8 |
class Optml_jetengine extends Optml_compatibility { |
| 9 |
|
| 10 |
/** |
| 11 |
* Should we load the integration logic. |
| 12 |
* |
| 13 |
* @return bool Should we load. |
| 14 |
*/ |
| 15 |
public function should_load() { |
| 16 |
include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 17 |
|
| 18 |
return is_plugin_active( 'jet-engine/jet-engine.php' ); |
| 19 |
} |
| 20 |
|
| 21 |
/** |
| 22 |
* Register integration details. |
| 23 |
* |
| 24 |
* @return void |
| 25 |
*/ |
| 26 |
public function register() { |
| 27 |
Optml_Url_Replacer::instance()->init(); |
| 28 |
add_filter( |
| 29 |
'jet-engine/ajax/listing_load_more/response', |
| 30 |
function ( $response ) { |
| 31 |
if ( isset( $response['html'] ) && ! empty( $response['html'] ) ) { |
| 32 |
$response['html'] = Optml_Main::instance()->manager->replace_content( $response['html'], true ); |
| 33 |
} |
| 34 |
|
| 35 |
return $response; |
| 36 |
}, |
| 37 |
10, |
| 38 |
); |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Should we early load the compatibility? |
| 43 |
* |
| 44 |
* @return bool Whether to load the compatibility or not. |
| 45 |
*/ |
| 46 |
public function should_load_early() { |
| 47 |
return true; |
| 48 |
} |
| 49 |
} |
| 50 |
|