Completed
Pull Request — develop (#1598)
by
unknown
01:07
created
src/wordlift/no-editor-analysis/class-no-editor-analysis-feature.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -11,56 +11,56 @@
 block discarded – undo
11 11
 
12 12
 class No_Editor_Analysis_Feature {
13 13
 
14
-	public static function can_no_editor_analysis_be_used( $post_id ) {
15
-		// If post id is falsy then dont do other checks, this necessary because get_post_type will return false
16
-		// when the post_id is 0  and inverting it would turn on this feature.
17
-		if ( ! $post_id ) {
18
-			return false;
19
-		}
14
+    public static function can_no_editor_analysis_be_used( $post_id ) {
15
+        // If post id is falsy then dont do other checks, this necessary because get_post_type will return false
16
+        // when the post_id is 0  and inverting it would turn on this feature.
17
+        if ( ! $post_id ) {
18
+            return false;
19
+        }
20 20
 
21
-		// phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
22
-		return apply_filters( 'wl_feature__enable__no-editor-analysis', false )
23
-			&& (
24
-				// If the post doesnt have `editor` attribute
25
-				Post_Type::is_no_editor_analysis_enabled_for_post_type( get_post_type( $post_id ) )
26
-				// check if Divi is enabled, then we can use no editor analysis.
27
-				|| self::is_divi_page_builder_enabled( $post_id )
28
-				// Check if elementor is enabled, then we can use no editor analysis.
29
-				|| self::is_elementor_enabled( $post_id )
30
-				// Check if WP Bakery is enabled, then we can use no editor analysis.
31
-				|| self::is_wp_bakery_enabled( $post_id )
32
-				// Custom builders can hook in to this filter to enable no editor analysis.
33
-				/**
34
-				* @param $post_id
35
-				*
36
-				* @return bool | False by default.
37
-				* @since 3.33.0
38
-				* Filter name : wl_no_editor_analysis_should_be_enabled_for_post_id
39
-				*/
40
-				|| apply_filters( 'wl_no_editor_analysis_should_be_enabled_for_post_id', false, $post_id )
41
-			);
42
-	}
21
+        // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
22
+        return apply_filters( 'wl_feature__enable__no-editor-analysis', false )
23
+            && (
24
+                // If the post doesnt have `editor` attribute
25
+                Post_Type::is_no_editor_analysis_enabled_for_post_type( get_post_type( $post_id ) )
26
+                // check if Divi is enabled, then we can use no editor analysis.
27
+                || self::is_divi_page_builder_enabled( $post_id )
28
+                // Check if elementor is enabled, then we can use no editor analysis.
29
+                || self::is_elementor_enabled( $post_id )
30
+                // Check if WP Bakery is enabled, then we can use no editor analysis.
31
+                || self::is_wp_bakery_enabled( $post_id )
32
+                // Custom builders can hook in to this filter to enable no editor analysis.
33
+                /**
34
+                 * @param $post_id
35
+                 *
36
+                 * @return bool | False by default.
37
+                 * @since 3.33.0
38
+                 * Filter name : wl_no_editor_analysis_should_be_enabled_for_post_id
39
+                 */
40
+                || apply_filters( 'wl_no_editor_analysis_should_be_enabled_for_post_id', false, $post_id )
41
+            );
42
+    }
43 43
 
44
-	private static function is_divi_page_builder_enabled( $post_id ) {
45
-		return function_exists( 'et_pb_is_pagebuilder_used' ) && et_pb_is_pagebuilder_used( $post_id );
46
-	}
44
+    private static function is_divi_page_builder_enabled( $post_id ) {
45
+        return function_exists( 'et_pb_is_pagebuilder_used' ) && et_pb_is_pagebuilder_used( $post_id );
46
+    }
47 47
 
48
-	private static function is_elementor_enabled( $post_id ) {
49
-		return defined( 'ELEMENTOR_VERSION' ) && get_post_meta( $post_id, '_elementor_edit_mode', true ) === 'builder';
50
-	}
48
+    private static function is_elementor_enabled( $post_id ) {
49
+        return defined( 'ELEMENTOR_VERSION' ) && get_post_meta( $post_id, '_elementor_edit_mode', true ) === 'builder';
50
+    }
51 51
 
52
-	private static function is_wp_bakery_enabled( $post_id ) {
53
-		$post_type = get_post_type( $post_id );
52
+    private static function is_wp_bakery_enabled( $post_id ) {
53
+        $post_type = get_post_type( $post_id );
54 54
 
55
-		if ( ! function_exists( 'vc_editor_post_types' ) ) {
56
-			return false;
57
-		}
55
+        if ( ! function_exists( 'vc_editor_post_types' ) ) {
56
+            return false;
57
+        }
58 58
 
59
-		try {
60
-			return in_array( $post_type, vc_editor_post_types(), true );
61
-		} catch ( \Exception $e ) {
62
-			return false;
63
-		}
64
-	}
59
+        try {
60
+            return in_array( $post_type, vc_editor_post_types(), true );
61
+        } catch ( \Exception $e ) {
62
+            return false;
63
+        }
64
+    }
65 65
 
66 66
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -11,24 +11,24 @@  discard block
 block discarded – undo
11 11
 
12 12
 class No_Editor_Analysis_Feature {
13 13
 
14
-	public static function can_no_editor_analysis_be_used( $post_id ) {
14
+	public static function can_no_editor_analysis_be_used($post_id) {
15 15
 		// If post id is falsy then dont do other checks, this necessary because get_post_type will return false
16 16
 		// when the post_id is 0  and inverting it would turn on this feature.
17
-		if ( ! $post_id ) {
17
+		if ( ! $post_id) {
18 18
 			return false;
19 19
 		}
20 20
 
21 21
 		// phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
22
-		return apply_filters( 'wl_feature__enable__no-editor-analysis', false )
22
+		return apply_filters('wl_feature__enable__no-editor-analysis', false)
23 23
 			&& (
24 24
 				// If the post doesnt have `editor` attribute
25
-				Post_Type::is_no_editor_analysis_enabled_for_post_type( get_post_type( $post_id ) )
25
+				Post_Type::is_no_editor_analysis_enabled_for_post_type(get_post_type($post_id))
26 26
 				// check if Divi is enabled, then we can use no editor analysis.
27
-				|| self::is_divi_page_builder_enabled( $post_id )
27
+				|| self::is_divi_page_builder_enabled($post_id)
28 28
 				// Check if elementor is enabled, then we can use no editor analysis.
29
-				|| self::is_elementor_enabled( $post_id )
29
+				|| self::is_elementor_enabled($post_id)
30 30
 				// Check if WP Bakery is enabled, then we can use no editor analysis.
31
-				|| self::is_wp_bakery_enabled( $post_id )
31
+				|| self::is_wp_bakery_enabled($post_id)
32 32
 				// Custom builders can hook in to this filter to enable no editor analysis.
33 33
 				/**
34 34
 				* @param $post_id
@@ -37,28 +37,28 @@  discard block
 block discarded – undo
37 37
 				* @since 3.33.0
38 38
 				* Filter name : wl_no_editor_analysis_should_be_enabled_for_post_id
39 39
 				*/
40
-				|| apply_filters( 'wl_no_editor_analysis_should_be_enabled_for_post_id', false, $post_id )
40
+				|| apply_filters('wl_no_editor_analysis_should_be_enabled_for_post_id', false, $post_id)
41 41
 			);
42 42
 	}
43 43
 
44
-	private static function is_divi_page_builder_enabled( $post_id ) {
45
-		return function_exists( 'et_pb_is_pagebuilder_used' ) && et_pb_is_pagebuilder_used( $post_id );
44
+	private static function is_divi_page_builder_enabled($post_id) {
45
+		return function_exists('et_pb_is_pagebuilder_used') && et_pb_is_pagebuilder_used($post_id);
46 46
 	}
47 47
 
48
-	private static function is_elementor_enabled( $post_id ) {
49
-		return defined( 'ELEMENTOR_VERSION' ) && get_post_meta( $post_id, '_elementor_edit_mode', true ) === 'builder';
48
+	private static function is_elementor_enabled($post_id) {
49
+		return defined('ELEMENTOR_VERSION') && get_post_meta($post_id, '_elementor_edit_mode', true) === 'builder';
50 50
 	}
51 51
 
52
-	private static function is_wp_bakery_enabled( $post_id ) {
53
-		$post_type = get_post_type( $post_id );
52
+	private static function is_wp_bakery_enabled($post_id) {
53
+		$post_type = get_post_type($post_id);
54 54
 
55
-		if ( ! function_exists( 'vc_editor_post_types' ) ) {
55
+		if ( ! function_exists('vc_editor_post_types')) {
56 56
 			return false;
57 57
 		}
58 58
 
59 59
 		try {
60
-			return in_array( $post_type, vc_editor_post_types(), true );
61
-		} catch ( \Exception $e ) {
60
+			return in_array($post_type, vc_editor_post_types(), true);
61
+		} catch (\Exception $e) {
62 62
 			return false;
63 63
 		}
64 64
 	}
Please login to merge, or discard this patch.