| Server IP : 65.108.144.40 / Your IP : 216.73.217.165 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 User : dev ( 1000) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/pia/wp-content/plugins/nitropack/classes/Integration/Plugin/ |
Upload File : |
<?php
namespace NitroPack\Integration\Plugin;
class Elementor {
const STAGE = "late";
public static function isActive() {
$activePlugins = apply_filters('active_plugins', get_option('active_plugins'));
if (defined('ELEMENTOR_PRO_VERSION') || in_array( 'elementor-pro/elementor-pro.php', $activePlugins )) {
return true;
}
return false;
}
public function init($stage) {
if ( ! self::isActive() ) {
return;
}
add_action( 'save_post', array($this, 'purge_cache_on_custom_code_snippet_update'), 10, 3 );
}
public function purge_cache_on_custom_code_snippet_update( $post_id, $post, $update ) {
if ( 'elementor_snippet' !== $post->post_type || defined('DOING_AUTOSAVE') && DOING_AUTOSAVE || 'auto-draft' === $post->post_status ) {
return;
}
if( strpos( wp_get_raw_referer(), 'post-new' ) > 0 ) {
if ( empty( $_POST['code'] ) ) {
return;
}
/* If new snippet is added */
nitropack_sdk_invalidate(NULL, NULL, 'Elementor Custom Code Snippet Added');
} else {
/* If old snippet is Updated */
nitropack_sdk_invalidate(NULL, NULL, 'Elementor Custom Code Snippet Updated');
}
}
}