* * @copyright (c) 2018, Incsub (http://incsub.com) */ namespace Smush\Core\Integrations; use Smush\WP_Smush; if ( ! defined( 'WPINC' ) ) { die; } /** * Class Composer for WPBakery Page Builder integration. * * @since 3.2.1 */ class Composer extends Abstract_Integration { /** * Composer constructor. * * @since 3.2.1 */ public function __construct() { $this->module = 'js_builder'; $this->class = 'free'; $this->check_for_js_builder(); parent::__construct(); // Hook at the end of setting row to output a error div. add_action( 'smush_setting_column_right_inside', array( $this, 'additional_notice' ) ); // Add beta tag. add_action( 'smush_setting_column_tag', array( $this, 'add_beta_tag' ) ); if ( $this->settings->get( 'js_builder' ) ) { add_filter( 'image_make_intermediate_size', array( $this, 'process_image_resize' ) ); } } /************************************** * * OVERWRITE PARENT CLASS FUNCTIONALITY */ /** * Filters the setting variable to add NextGen setting title and description * * @since 3.2.1 * * @param array $settings Settings. * * @return mixed */ public function register( $settings ) { $settings[ $this->module ] = array( 'label' => esc_html__( 'Enable WPBakery Page Builder integration', 'wp-smushit' ), 'short_label' => esc_html__( 'WPBakery Page Builder', 'wp-smushit' ), 'desc' => esc_html__( 'Allow smushing images resized in WPBakery Page Builder editor.', 'wp-smushit' ), ); return $settings; } /** * Show additional notice if the required plugins are not installed. * * @since 3.2.1 * * @param string $name Setting name. */ public function additional_notice( $name ) { if ( 'js_builder' === $name && ! $this->enabled ) { ?>