/** * delete_cache_data * * @param int $post_id */ public function delete_cache_data( $post_id ) { $this->elements_manager->remove_files( $post_id ); delete_post_meta( $post_id, '_eael_custom_js' ); delete_post_meta( $post_id, '_eael_widget_elements' ); } /** * has_asset * * @param int $post_id * @param string $file * * @return bool */ public function has_asset( $post_id, $file = 'css' ) { if ( file_exists( $this->safe_path( EAEL_ASSET_PATH . '/' . 'eael' . ( $post_id ? '-' . $post_id : '' ) . '.' . $file ) ) ) { return true; } return false; } public function load_custom_js( $post_id ) { static $post_ids_array = []; if ( in_array( $post_id, $post_ids_array ) ) { return false; } $post_ids_array[] = $post_id; if ( ! $this->custom_js_enable ) { return false; } $custom_js = get_post_meta( $post_id, '_eael_custom_js', true ); if ( $custom_js ) { // add semicolon if someone misses adding this in custom js code . $this->custom_js .= $custom_js.';'; } } /** * is_edit * check is edit page * @return bool */ public function is_edit() { return ( Plugin::instance()->editor->is_edit_mode() || Plugin::instance()->preview->is_preview_mode() || is_preview() ); } /** * set_main_page * * @param $post_id */ protected function set_main_page( $post_id ) { $this->main_page = get_post_meta( $post_id, '_elementor_template_type', true ) == 'wp-page'; } }