@@ -10,43 +10,43 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class Avada_Builder_Support { |
| 12 | 12 | |
| 13 | - public function __construct() { |
|
| 14 | - add_filter( 'wl_post_excerpt_post_content', array( $this, 'post_excerpt_post_content' ), 10, 3 ); |
|
| 15 | - add_filter( 'wl_no_editor_analysis_should_be_enabled_for_post_id', array( $this, 'is_avada_builder_active' ), 10, 2 ); |
|
| 16 | - } |
|
| 17 | - |
|
| 18 | - /** |
|
| 19 | - * Filter the post content before sending it to WordLift API. |
|
| 20 | - * |
|
| 21 | - * @param $post_body string The post content sent from WordPress editor. ( with strip shortcodes ) |
|
| 22 | - * @param $post_id int The post id. |
|
| 23 | - * @param $post_content string The post content. |
|
| 24 | - * |
|
| 25 | - * @return string The post content after removing Avada Builder's shortcodes. |
|
| 26 | - */ |
|
| 27 | - public function post_excerpt_post_content( $post_body, $post_id, $post_content ) { |
|
| 28 | - |
|
| 29 | - if ( $this->is_avada_builder_active( false, $post_id ) ) { // Check if its Avada Builder's Content. |
|
| 30 | - return wp_strip_all_tags( do_shortcode( $post_content ), true ); |
|
| 31 | - } |
|
| 32 | - return $post_body; |
|
| 33 | - |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * Check if Avada Builder is active for the post. |
|
| 38 | - * |
|
| 39 | - * @param $is_enabled bool ( For No Analysis ) @see wl_no_editor_analysis_should_be_enabled_for_post_id filter. |
|
| 40 | - * @param $post_id int The post id. |
|
| 41 | - * |
|
| 42 | - * @return bool True if Avada Builder is active for the post. |
|
| 43 | - */ |
|
| 44 | - public function is_avada_builder_active( $is_enabled, $post_id ) { |
|
| 45 | - |
|
| 46 | - if ( ! $post_id || ! class_exists( '\FusionBuilder' ) ) { |
|
| 47 | - return $is_enabled; |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - return 'active' === get_post_meta( $post_id, 'fusion_builder_status', true ); |
|
| 51 | - } |
|
| 13 | + public function __construct() { |
|
| 14 | + add_filter( 'wl_post_excerpt_post_content', array( $this, 'post_excerpt_post_content' ), 10, 3 ); |
|
| 15 | + add_filter( 'wl_no_editor_analysis_should_be_enabled_for_post_id', array( $this, 'is_avada_builder_active' ), 10, 2 ); |
|
| 16 | + } |
|
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * Filter the post content before sending it to WordLift API. |
|
| 20 | + * |
|
| 21 | + * @param $post_body string The post content sent from WordPress editor. ( with strip shortcodes ) |
|
| 22 | + * @param $post_id int The post id. |
|
| 23 | + * @param $post_content string The post content. |
|
| 24 | + * |
|
| 25 | + * @return string The post content after removing Avada Builder's shortcodes. |
|
| 26 | + */ |
|
| 27 | + public function post_excerpt_post_content( $post_body, $post_id, $post_content ) { |
|
| 28 | + |
|
| 29 | + if ( $this->is_avada_builder_active( false, $post_id ) ) { // Check if its Avada Builder's Content. |
|
| 30 | + return wp_strip_all_tags( do_shortcode( $post_content ), true ); |
|
| 31 | + } |
|
| 32 | + return $post_body; |
|
| 33 | + |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * Check if Avada Builder is active for the post. |
|
| 38 | + * |
|
| 39 | + * @param $is_enabled bool ( For No Analysis ) @see wl_no_editor_analysis_should_be_enabled_for_post_id filter. |
|
| 40 | + * @param $post_id int The post id. |
|
| 41 | + * |
|
| 42 | + * @return bool True if Avada Builder is active for the post. |
|
| 43 | + */ |
|
| 44 | + public function is_avada_builder_active( $is_enabled, $post_id ) { |
|
| 45 | + |
|
| 46 | + if ( ! $post_id || ! class_exists( '\FusionBuilder' ) ) { |
|
| 47 | + return $is_enabled; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + return 'active' === get_post_meta( $post_id, 'fusion_builder_status', true ); |
|
| 51 | + } |
|
| 52 | 52 | } |
@@ -11,8 +11,8 @@ discard block |
||
| 11 | 11 | class Avada_Builder_Support { |
| 12 | 12 | |
| 13 | 13 | public function __construct() { |
| 14 | - add_filter( 'wl_post_excerpt_post_content', array( $this, 'post_excerpt_post_content' ), 10, 3 ); |
|
| 15 | - add_filter( 'wl_no_editor_analysis_should_be_enabled_for_post_id', array( $this, 'is_avada_builder_active' ), 10, 2 ); |
|
| 14 | + add_filter('wl_post_excerpt_post_content', array($this, 'post_excerpt_post_content'), 10, 3); |
|
| 15 | + add_filter('wl_no_editor_analysis_should_be_enabled_for_post_id', array($this, 'is_avada_builder_active'), 10, 2); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | /** |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | * |
| 25 | 25 | * @return string The post content after removing Avada Builder's shortcodes. |
| 26 | 26 | */ |
| 27 | - public function post_excerpt_post_content( $post_body, $post_id, $post_content ) { |
|
| 27 | + public function post_excerpt_post_content($post_body, $post_id, $post_content) { |
|
| 28 | 28 | |
| 29 | - if ( $this->is_avada_builder_active( false, $post_id ) ) { // Check if its Avada Builder's Content. |
|
| 30 | - return wp_strip_all_tags( do_shortcode( $post_content ), true ); |
|
| 29 | + if ($this->is_avada_builder_active(false, $post_id)) { // Check if its Avada Builder's Content. |
|
| 30 | + return wp_strip_all_tags(do_shortcode($post_content), true); |
|
| 31 | 31 | } |
| 32 | 32 | return $post_body; |
| 33 | 33 | |
@@ -41,12 +41,12 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @return bool True if Avada Builder is active for the post. |
| 43 | 43 | */ |
| 44 | - public function is_avada_builder_active( $is_enabled, $post_id ) { |
|
| 44 | + public function is_avada_builder_active($is_enabled, $post_id) { |
|
| 45 | 45 | |
| 46 | - if ( ! $post_id || ! class_exists( '\FusionBuilder' ) ) { |
|
| 46 | + if ( ! $post_id || ! class_exists('\FusionBuilder')) { |
|
| 47 | 47 | return $is_enabled; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - return 'active' === get_post_meta( $post_id, 'fusion_builder_status', true ); |
|
| 50 | + return 'active' === get_post_meta($post_id, 'fusion_builder_status', true); |
|
| 51 | 51 | } |
| 52 | 52 | } |