Completed
Pull Request — develop (#1633)
by Naveen
01:05
created
src/wordlift/link/class-default-link.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,19 +11,19 @@
 block discarded – undo
11 11
 
12 12
 abstract class Default_Link extends Singleton implements Link {
13 13
 
14
-	public function get_link_title( $id, $label_to_be_ignored ) {
14
+    public function get_link_title( $id, $label_to_be_ignored ) {
15 15
 
16
-		$entity_labels = $this->get_synonyms( $id );
16
+        $entity_labels = $this->get_synonyms( $id );
17 17
 
18
-		foreach ( $entity_labels as $entity_label ) {
19
-			// Return first synonym if it doesnt match the label.
20
-			if ( 0 !== strcasecmp( $entity_label, $label_to_be_ignored ) ) {
21
-				return $entity_label;
22
-			}
23
-		}
18
+        foreach ( $entity_labels as $entity_label ) {
19
+            // Return first synonym if it doesnt match the label.
20
+            if ( 0 !== strcasecmp( $entity_label, $label_to_be_ignored ) ) {
21
+                return $entity_label;
22
+            }
23
+        }
24 24
 
25
-		// If the label matches the synonym then dont add title attr.
26
-		return '';
27
-	}
25
+        // If the label matches the synonym then dont add title attr.
26
+        return '';
27
+    }
28 28
 
29 29
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@
 block discarded – undo
11 11
 
12 12
 abstract class Default_Link extends Singleton implements Link {
13 13
 
14
-	public function get_link_title( $id, $label_to_be_ignored ) {
14
+	public function get_link_title($id, $label_to_be_ignored) {
15 15
 
16
-		$entity_labels = $this->get_synonyms( $id );
16
+		$entity_labels = $this->get_synonyms($id);
17 17
 
18
-		foreach ( $entity_labels as $entity_label ) {
18
+		foreach ($entity_labels as $entity_label) {
19 19
 			// Return first synonym if it doesnt match the label.
20
-			if ( 0 !== strcasecmp( $entity_label, $label_to_be_ignored ) ) {
20
+			if (0 !== strcasecmp($entity_label, $label_to_be_ignored)) {
21 21
 				return $entity_label;
22 22
 			}
23 23
 		}
Please login to merge, or discard this patch.
src/wordlift/link/class-post-link.php 2 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -13,57 +13,57 @@
 block discarded – undo
13 13
 
14 14
 class Post_Link extends Default_Link {
15 15
 
16
-	/**
17
-	 * @var \Wordlift_Entity_Service
18
-	 */
19
-	private $entity_service;
16
+    /**
17
+     * @var \Wordlift_Entity_Service
18
+     */
19
+    private $entity_service;
20 20
 
21
-	public function __construct() {
22
-		parent::__construct();
23
-		$this->entity_service = Wordlift_Entity_Service::get_instance();
24
-	}
21
+    public function __construct() {
22
+        parent::__construct();
23
+        $this->entity_service = Wordlift_Entity_Service::get_instance();
24
+    }
25 25
 
26
-	public function get_same_as_uris( $id ) {
26
+    public function get_same_as_uris( $id ) {
27 27
 
28
-		return array_merge(
29
-			array( $this->entity_service->get_uri( $id ) ),
30
-			get_post_meta( $id, Wordlift_Schema_Service::FIELD_SAME_AS )
31
-		);
28
+        return array_merge(
29
+            array( $this->entity_service->get_uri( $id ) ),
30
+            get_post_meta( $id, Wordlift_Schema_Service::FIELD_SAME_AS )
31
+        );
32 32
 
33
-	}
33
+    }
34 34
 
35
-	public function get_id( $uri ) {
36
-		$content = Wordpress_Content_Service::get_instance()
37
-											->get_by_entity_id_or_same_as( $uri );
35
+    public function get_id( $uri ) {
36
+        $content = Wordpress_Content_Service::get_instance()
37
+                                            ->get_by_entity_id_or_same_as( $uri );
38 38
 
39
-		if ( ! isset( $content ) || ! is_a( $content->get_bag(), '\WP_Post' ) ) {
40
-			return false;
41
-		}
39
+        if ( ! isset( $content ) || ! is_a( $content->get_bag(), '\WP_Post' ) ) {
40
+            return false;
41
+        }
42 42
 
43
-		return $content->get_bag()->ID;
44
-	}
43
+        return $content->get_bag()->ID;
44
+    }
45 45
 
46
-	public function get_synonyms( $id ) {
47
-		// Get possible alternative entity_labels we can select from.
48
-		$entity_labels = $this->entity_service->get_alternative_labels( $id );
46
+    public function get_synonyms( $id ) {
47
+        // Get possible alternative entity_labels we can select from.
48
+        $entity_labels = $this->entity_service->get_alternative_labels( $id );
49 49
 
50
-		/*
50
+        /*
51 51
 		 * Since the original text might use an alternative entity_label than the
52 52
 		 * Entity title, add the title itself which is not returned by the api.
53 53
 		 */
54
-		$entity_labels[] = get_the_title( $id );
54
+        $entity_labels[] = get_the_title( $id );
55 55
 
56
-		// Add some randomness to the entity_label selection.
57
-		shuffle( $entity_labels );
56
+        // Add some randomness to the entity_label selection.
57
+        shuffle( $entity_labels );
58 58
 
59
-		return $entity_labels;
60
-	}
59
+        return $entity_labels;
60
+    }
61 61
 
62
-	public function get_permalink( $id ) {
63
-		return get_permalink( $id );
64
-	}
62
+    public function get_permalink( $id ) {
63
+        return get_permalink( $id );
64
+    }
65 65
 
66
-	public function get_edit_page_link( $id ) {
67
-		return get_edit_post_link( $id, 'none' );
68
-	}
66
+    public function get_edit_page_link( $id ) {
67
+        return get_edit_post_link( $id, 'none' );
68
+    }
69 69
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -23,47 +23,47 @@
 block discarded – undo
23 23
 		$this->entity_service = Wordlift_Entity_Service::get_instance();
24 24
 	}
25 25
 
26
-	public function get_same_as_uris( $id ) {
26
+	public function get_same_as_uris($id) {
27 27
 
28 28
 		return array_merge(
29
-			array( $this->entity_service->get_uri( $id ) ),
30
-			get_post_meta( $id, Wordlift_Schema_Service::FIELD_SAME_AS )
29
+			array($this->entity_service->get_uri($id)),
30
+			get_post_meta($id, Wordlift_Schema_Service::FIELD_SAME_AS)
31 31
 		);
32 32
 
33 33
 	}
34 34
 
35
-	public function get_id( $uri ) {
35
+	public function get_id($uri) {
36 36
 		$content = Wordpress_Content_Service::get_instance()
37
-											->get_by_entity_id_or_same_as( $uri );
37
+											->get_by_entity_id_or_same_as($uri);
38 38
 
39
-		if ( ! isset( $content ) || ! is_a( $content->get_bag(), '\WP_Post' ) ) {
39
+		if ( ! isset($content) || ! is_a($content->get_bag(), '\WP_Post')) {
40 40
 			return false;
41 41
 		}
42 42
 
43 43
 		return $content->get_bag()->ID;
44 44
 	}
45 45
 
46
-	public function get_synonyms( $id ) {
46
+	public function get_synonyms($id) {
47 47
 		// Get possible alternative entity_labels we can select from.
48
-		$entity_labels = $this->entity_service->get_alternative_labels( $id );
48
+		$entity_labels = $this->entity_service->get_alternative_labels($id);
49 49
 
50 50
 		/*
51 51
 		 * Since the original text might use an alternative entity_label than the
52 52
 		 * Entity title, add the title itself which is not returned by the api.
53 53
 		 */
54
-		$entity_labels[] = get_the_title( $id );
54
+		$entity_labels[] = get_the_title($id);
55 55
 
56 56
 		// Add some randomness to the entity_label selection.
57
-		shuffle( $entity_labels );
57
+		shuffle($entity_labels);
58 58
 
59 59
 		return $entity_labels;
60 60
 	}
61 61
 
62
-	public function get_permalink( $id ) {
63
-		return get_permalink( $id );
62
+	public function get_permalink($id) {
63
+		return get_permalink($id);
64 64
 	}
65 65
 
66
-	public function get_edit_page_link( $id ) {
67
-		return get_edit_post_link( $id, 'none' );
66
+	public function get_edit_page_link($id) {
67
+		return get_edit_post_link($id, 'none');
68 68
 	}
69 69
 }
Please login to merge, or discard this patch.
src/wordlift/link/class-object-link-provider.php 2 patches
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -11,110 +11,110 @@
 block discarded – undo
11 11
 use Wordlift\Object_Type_Enum;
12 12
 
13 13
 class Object_Link_Provider extends Singleton {
14
-	/**
15
-	 * @var array<Link>
16
-	 */
17
-	private $link_providers;
18
-
19
-	public function __construct() {
20
-		parent::__construct();
21
-		$this->link_providers = array(
22
-			Object_Type_Enum::POST => Post_Link::get_instance(),
23
-			Object_Type_Enum::TERM => Term_Link::get_instance(),
24
-		);
25
-	}
26
-
27
-	/**
28
-	 * @param $id int
29
-	 * @param $label_to_be_ignored string
30
-	 * @param $object_type int
31
-	 *
32
-	 * @return string
33
-	 */
34
-	public function get_link_title( $id, $label_to_be_ignored, $object_type ) {
35
-		$provider = $this->get_provider( $object_type );
36
-		if ( ! $provider ) {
37
-			return '';
38
-		}
39
-
40
-		return $provider->get_link_title( $id, $label_to_be_ignored );
41
-	}
42
-
43
-	/**
44
-	 * Return the object type by the entity uri.
45
-	 *
46
-	 * @return int which can be any of the {@link Object_Type_Enum} values.
47
-	 */
48
-	public function get_object_type( $uri ) {
49
-
50
-		$link_providers = $this->link_providers;
51
-		foreach ( $link_providers as $type => $provider ) {
52
-			/**
53
-			 * @var $provider Link
54
-			 */
55
-			$id = $provider->get_id( $uri );
56
-			if ( $id ) {
57
-				return $type;
58
-			}
59
-		}
60
-
61
-		return Object_Type_Enum::UNKNOWN;
62
-	}
63
-
64
-	public function get_same_as_uris( $id, $object_type ) {
65
-
66
-		$provider = $this->get_provider( $object_type );
67
-		if ( ! $provider ) {
68
-			return array();
69
-		}
70
-
71
-		return $provider->get_same_as_uris( $id );
72
-	}
73
-
74
-	/**
75
-	 * @param $object_type
76
-	 *
77
-	 * @return mixed|Link
78
-	 */
79
-	private function get_provider( $object_type ) {
80
-
81
-		if ( ! array_key_exists( $object_type, $this->link_providers ) ) {
82
-			return false;
83
-		}
84
-
85
-		return $this->link_providers[ $object_type ];
86
-	}
87
-
88
-	public function get_permalink( $id, $object_type ) {
89
-		$provider = $this->get_provider( $object_type );
90
-		if ( ! $provider ) {
91
-			return false;
92
-		}
93
-
94
-		return $provider->get_permalink( $id );
95
-	}
96
-
97
-	/**
98
-	 * Return the edit term page link.
99
-	 *
100
-	 * @param $object_id
101
-	 * @param $uri
102
-	 *
103
-	 * @return string | false
104
-	 * @since 3.32.0
105
-	 */
106
-	public function get_edit_page_link( $object_id, $uri ) {
107
-
108
-		$object_type = $this->get_object_type( $uri );
109
-
110
-		$provider = $this->get_provider( $object_type );
111
-
112
-		if ( ! $provider ) {
113
-			return false;
114
-		}
115
-
116
-		return $provider->get_edit_page_link( $object_id );
117
-
118
-	}
14
+    /**
15
+     * @var array<Link>
16
+     */
17
+    private $link_providers;
18
+
19
+    public function __construct() {
20
+        parent::__construct();
21
+        $this->link_providers = array(
22
+            Object_Type_Enum::POST => Post_Link::get_instance(),
23
+            Object_Type_Enum::TERM => Term_Link::get_instance(),
24
+        );
25
+    }
26
+
27
+    /**
28
+     * @param $id int
29
+     * @param $label_to_be_ignored string
30
+     * @param $object_type int
31
+     *
32
+     * @return string
33
+     */
34
+    public function get_link_title( $id, $label_to_be_ignored, $object_type ) {
35
+        $provider = $this->get_provider( $object_type );
36
+        if ( ! $provider ) {
37
+            return '';
38
+        }
39
+
40
+        return $provider->get_link_title( $id, $label_to_be_ignored );
41
+    }
42
+
43
+    /**
44
+     * Return the object type by the entity uri.
45
+     *
46
+     * @return int which can be any of the {@link Object_Type_Enum} values.
47
+     */
48
+    public function get_object_type( $uri ) {
49
+
50
+        $link_providers = $this->link_providers;
51
+        foreach ( $link_providers as $type => $provider ) {
52
+            /**
53
+             * @var $provider Link
54
+             */
55
+            $id = $provider->get_id( $uri );
56
+            if ( $id ) {
57
+                return $type;
58
+            }
59
+        }
60
+
61
+        return Object_Type_Enum::UNKNOWN;
62
+    }
63
+
64
+    public function get_same_as_uris( $id, $object_type ) {
65
+
66
+        $provider = $this->get_provider( $object_type );
67
+        if ( ! $provider ) {
68
+            return array();
69
+        }
70
+
71
+        return $provider->get_same_as_uris( $id );
72
+    }
73
+
74
+    /**
75
+     * @param $object_type
76
+     *
77
+     * @return mixed|Link
78
+     */
79
+    private function get_provider( $object_type ) {
80
+
81
+        if ( ! array_key_exists( $object_type, $this->link_providers ) ) {
82
+            return false;
83
+        }
84
+
85
+        return $this->link_providers[ $object_type ];
86
+    }
87
+
88
+    public function get_permalink( $id, $object_type ) {
89
+        $provider = $this->get_provider( $object_type );
90
+        if ( ! $provider ) {
91
+            return false;
92
+        }
93
+
94
+        return $provider->get_permalink( $id );
95
+    }
96
+
97
+    /**
98
+     * Return the edit term page link.
99
+     *
100
+     * @param $object_id
101
+     * @param $uri
102
+     *
103
+     * @return string | false
104
+     * @since 3.32.0
105
+     */
106
+    public function get_edit_page_link( $object_id, $uri ) {
107
+
108
+        $object_type = $this->get_object_type( $uri );
109
+
110
+        $provider = $this->get_provider( $object_type );
111
+
112
+        if ( ! $provider ) {
113
+            return false;
114
+        }
115
+
116
+        return $provider->get_edit_page_link( $object_id );
117
+
118
+    }
119 119
 
120 120
 }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @return string
33 33
 	 */
34
-	public function get_link_title( $id, $label_to_be_ignored, $object_type ) {
35
-		$provider = $this->get_provider( $object_type );
36
-		if ( ! $provider ) {
34
+	public function get_link_title($id, $label_to_be_ignored, $object_type) {
35
+		$provider = $this->get_provider($object_type);
36
+		if ( ! $provider) {
37 37
 			return '';
38 38
 		}
39 39
 
40
-		return $provider->get_link_title( $id, $label_to_be_ignored );
40
+		return $provider->get_link_title($id, $label_to_be_ignored);
41 41
 	}
42 42
 
43 43
 	/**
@@ -45,15 +45,15 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @return int which can be any of the {@link Object_Type_Enum} values.
47 47
 	 */
48
-	public function get_object_type( $uri ) {
48
+	public function get_object_type($uri) {
49 49
 
50 50
 		$link_providers = $this->link_providers;
51
-		foreach ( $link_providers as $type => $provider ) {
51
+		foreach ($link_providers as $type => $provider) {
52 52
 			/**
53 53
 			 * @var $provider Link
54 54
 			 */
55
-			$id = $provider->get_id( $uri );
56
-			if ( $id ) {
55
+			$id = $provider->get_id($uri);
56
+			if ($id) {
57 57
 				return $type;
58 58
 			}
59 59
 		}
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
 		return Object_Type_Enum::UNKNOWN;
62 62
 	}
63 63
 
64
-	public function get_same_as_uris( $id, $object_type ) {
64
+	public function get_same_as_uris($id, $object_type) {
65 65
 
66
-		$provider = $this->get_provider( $object_type );
67
-		if ( ! $provider ) {
66
+		$provider = $this->get_provider($object_type);
67
+		if ( ! $provider) {
68 68
 			return array();
69 69
 		}
70 70
 
71
-		return $provider->get_same_as_uris( $id );
71
+		return $provider->get_same_as_uris($id);
72 72
 	}
73 73
 
74 74
 	/**
@@ -76,22 +76,22 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @return mixed|Link
78 78
 	 */
79
-	private function get_provider( $object_type ) {
79
+	private function get_provider($object_type) {
80 80
 
81
-		if ( ! array_key_exists( $object_type, $this->link_providers ) ) {
81
+		if ( ! array_key_exists($object_type, $this->link_providers)) {
82 82
 			return false;
83 83
 		}
84 84
 
85
-		return $this->link_providers[ $object_type ];
85
+		return $this->link_providers[$object_type];
86 86
 	}
87 87
 
88
-	public function get_permalink( $id, $object_type ) {
89
-		$provider = $this->get_provider( $object_type );
90
-		if ( ! $provider ) {
88
+	public function get_permalink($id, $object_type) {
89
+		$provider = $this->get_provider($object_type);
90
+		if ( ! $provider) {
91 91
 			return false;
92 92
 		}
93 93
 
94
-		return $provider->get_permalink( $id );
94
+		return $provider->get_permalink($id);
95 95
 	}
96 96
 
97 97
 	/**
@@ -103,17 +103,17 @@  discard block
 block discarded – undo
103 103
 	 * @return string | false
104 104
 	 * @since 3.32.0
105 105
 	 */
106
-	public function get_edit_page_link( $object_id, $uri ) {
106
+	public function get_edit_page_link($object_id, $uri) {
107 107
 
108
-		$object_type = $this->get_object_type( $uri );
108
+		$object_type = $this->get_object_type($uri);
109 109
 
110
-		$provider = $this->get_provider( $object_type );
110
+		$provider = $this->get_provider($object_type);
111 111
 
112
-		if ( ! $provider ) {
112
+		if ( ! $provider) {
113 113
 			return false;
114 114
 		}
115 115
 
116
-		return $provider->get_edit_page_link( $object_id );
116
+		return $provider->get_edit_page_link($object_id);
117 117
 
118 118
 	}
119 119
 
Please login to merge, or discard this patch.
src/wordlift/no-editor-analysis/class-meta-box.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -10,38 +10,38 @@
 block discarded – undo
10 10
 
11 11
 class Meta_Box {
12 12
 
13
-	const META_BOX_ID = 'wl-no-editor-analysis-meta-box';
14
-
15
-	public function init() {
16
-		add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
17
-	}
18
-
19
-	public function add_meta_box( $post_type ) {
20
-
21
-		// We enable it for only the post types which doesn't support the editor and
22
-		// enabled on the filter.
23
-		if ( ! No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( get_the_ID() ) ) {
24
-			return;
25
-		}
26
-
27
-		add_meta_box(
28
-			self::META_BOX_ID,
29
-			__( 'WordLift', 'wordlift' ),
30
-			array( $this, 'render_meta_box' ),
31
-			$post_type,
32
-			'side',
33
-			'high'
34
-		);
35
-
36
-	}
37
-
38
-	public function render_meta_box() {
39
-		echo sprintf(
40
-			"<div id='%s'></div><div id='%s'></div>",
41
-			esc_attr( 'wl-no-editor-analysis-meta-box-content' ),
42
-			// Div to store the entities.
43
-			esc_attr( 'wl-no-editor-analysis-meta-box-storage' )
44
-		);
45
-	}
13
+    const META_BOX_ID = 'wl-no-editor-analysis-meta-box';
14
+
15
+    public function init() {
16
+        add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
17
+    }
18
+
19
+    public function add_meta_box( $post_type ) {
20
+
21
+        // We enable it for only the post types which doesn't support the editor and
22
+        // enabled on the filter.
23
+        if ( ! No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( get_the_ID() ) ) {
24
+            return;
25
+        }
26
+
27
+        add_meta_box(
28
+            self::META_BOX_ID,
29
+            __( 'WordLift', 'wordlift' ),
30
+            array( $this, 'render_meta_box' ),
31
+            $post_type,
32
+            'side',
33
+            'high'
34
+        );
35
+
36
+    }
37
+
38
+    public function render_meta_box() {
39
+        echo sprintf(
40
+            "<div id='%s'></div><div id='%s'></div>",
41
+            esc_attr( 'wl-no-editor-analysis-meta-box-content' ),
42
+            // Div to store the entities.
43
+            esc_attr( 'wl-no-editor-analysis-meta-box-storage' )
44
+        );
45
+    }
46 46
 
47 47
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,21 +13,21 @@  discard block
 block discarded – undo
13 13
 	const META_BOX_ID = 'wl-no-editor-analysis-meta-box';
14 14
 
15 15
 	public function init() {
16
-		add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
16
+		add_action('add_meta_boxes', array($this, 'add_meta_box'));
17 17
 	}
18 18
 
19
-	public function add_meta_box( $post_type ) {
19
+	public function add_meta_box($post_type) {
20 20
 
21 21
 		// We enable it for only the post types which doesn't support the editor and
22 22
 		// enabled on the filter.
23
-		if ( ! No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( get_the_ID() ) ) {
23
+		if ( ! No_Editor_Analysis_Feature::can_no_editor_analysis_be_used(get_the_ID())) {
24 24
 			return;
25 25
 		}
26 26
 
27 27
 		add_meta_box(
28 28
 			self::META_BOX_ID,
29
-			__( 'WordLift', 'wordlift' ),
30
-			array( $this, 'render_meta_box' ),
29
+			__('WordLift', 'wordlift'),
30
+			array($this, 'render_meta_box'),
31 31
 			$post_type,
32 32
 			'side',
33 33
 			'high'
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 	public function render_meta_box() {
39 39
 		echo sprintf(
40 40
 			"<div id='%s'></div><div id='%s'></div>",
41
-			esc_attr( 'wl-no-editor-analysis-meta-box-content' ),
41
+			esc_attr('wl-no-editor-analysis-meta-box-content'),
42 42
 			// Div to store the entities.
43
-			esc_attr( 'wl-no-editor-analysis-meta-box-storage' )
43
+			esc_attr('wl-no-editor-analysis-meta-box-storage')
44 44
 		);
45 45
 	}
46 46
 
Please login to merge, or discard this patch.
src/wordlift/no-editor-analysis/class-post-type.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -3,19 +3,19 @@
 block discarded – undo
3 3
 
4 4
 class Post_Type {
5 5
 
6
-	public static function is_no_editor_analysis_enabled_for_post_type( $post_type ) {
6
+    public static function is_no_editor_analysis_enabled_for_post_type( $post_type ) {
7 7
 
8
-		if ( ! $post_type ) {
9
-			return false;
10
-		}
8
+        if ( ! $post_type ) {
9
+            return false;
10
+        }
11 11
 
12
-		if ( ! post_type_exists( $post_type ) ) {
13
-			return false;
14
-		}
12
+        if ( ! post_type_exists( $post_type ) ) {
13
+            return false;
14
+        }
15 15
 
16
-		// Enable it on post types which doesn't have editor by default.
17
-		return ! post_type_supports( $post_type, 'editor' );
16
+        // Enable it on post types which doesn't have editor by default.
17
+        return ! post_type_supports( $post_type, 'editor' );
18 18
 
19
-	}
19
+    }
20 20
 
21 21
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,18 +3,18 @@
 block discarded – undo
3 3
 
4 4
 class Post_Type {
5 5
 
6
-	public static function is_no_editor_analysis_enabled_for_post_type( $post_type ) {
6
+	public static function is_no_editor_analysis_enabled_for_post_type($post_type) {
7 7
 
8
-		if ( ! $post_type ) {
8
+		if ( ! $post_type) {
9 9
 			return false;
10 10
 		}
11 11
 
12
-		if ( ! post_type_exists( $post_type ) ) {
12
+		if ( ! post_type_exists($post_type)) {
13 13
 			return false;
14 14
 		}
15 15
 
16 16
 		// Enable it on post types which doesn't have editor by default.
17
-		return ! post_type_supports( $post_type, 'editor' );
17
+		return ! post_type_supports($post_type, 'editor');
18 18
 
19 19
 	}
20 20
 
Please login to merge, or discard this patch.
src/wordlift/no-editor-analysis/class-edit-post-scripts.php 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -7,40 +7,40 @@
 block discarded – undo
7 7
 
8 8
 class Edit_Post_Scripts extends Edit_Post_Loader {
9 9
 
10
-	const HANDLE = 'wl-no-editor-analysis-deps';
11
-
12
-	public function run_on_edit_post_screen() {
13
-
14
-		// Dont load this script if the post doesnt support it.
15
-		if ( ! No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( get_the_ID() ) ) {
16
-			return;
17
-		}
18
-
19
-		Scripts_Helper::enqueue_based_on_wordpress_version(
20
-			self::HANDLE,
21
-			plugin_dir_url( dirname( __DIR__ ) ) . 'js/dist/no-editor-analysis',
22
-			array(
23
-				'react',
24
-				'react-dom',
25
-				'wp-api-fetch',
26
-				'wp-blocks',
27
-				'wp-components',
28
-				'wp-data',
29
-				'wp-element',
30
-				'wp-hooks',
31
-				'wp-polyfill',
32
-				'wp-rich-text',
33
-			),
34
-			true
35
-		);
36
-
37
-		wp_enqueue_style(
38
-			self::HANDLE,
39
-			plugin_dir_url( dirname( __DIR__ ) ) . 'js/dist/no-editor-analysis.full.css',
40
-			array(),
41
-			WORDLIFT_VERSION
42
-		);
43
-
44
-	}
10
+    const HANDLE = 'wl-no-editor-analysis-deps';
11
+
12
+    public function run_on_edit_post_screen() {
13
+
14
+        // Dont load this script if the post doesnt support it.
15
+        if ( ! No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( get_the_ID() ) ) {
16
+            return;
17
+        }
18
+
19
+        Scripts_Helper::enqueue_based_on_wordpress_version(
20
+            self::HANDLE,
21
+            plugin_dir_url( dirname( __DIR__ ) ) . 'js/dist/no-editor-analysis',
22
+            array(
23
+                'react',
24
+                'react-dom',
25
+                'wp-api-fetch',
26
+                'wp-blocks',
27
+                'wp-components',
28
+                'wp-data',
29
+                'wp-element',
30
+                'wp-hooks',
31
+                'wp-polyfill',
32
+                'wp-rich-text',
33
+            ),
34
+            true
35
+        );
36
+
37
+        wp_enqueue_style(
38
+            self::HANDLE,
39
+            plugin_dir_url( dirname( __DIR__ ) ) . 'js/dist/no-editor-analysis.full.css',
40
+            array(),
41
+            WORDLIFT_VERSION
42
+        );
43
+
44
+    }
45 45
 
46 46
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@  discard block
 block discarded – undo
12 12
 	public function run_on_edit_post_screen() {
13 13
 
14 14
 		// Dont load this script if the post doesnt support it.
15
-		if ( ! No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( get_the_ID() ) ) {
15
+		if ( ! No_Editor_Analysis_Feature::can_no_editor_analysis_be_used(get_the_ID())) {
16 16
 			return;
17 17
 		}
18 18
 
19 19
 		Scripts_Helper::enqueue_based_on_wordpress_version(
20 20
 			self::HANDLE,
21
-			plugin_dir_url( dirname( __DIR__ ) ) . 'js/dist/no-editor-analysis',
21
+			plugin_dir_url(dirname(__DIR__)).'js/dist/no-editor-analysis',
22 22
 			array(
23 23
 				'react',
24 24
 				'react-dom',
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 		wp_enqueue_style(
38 38
 			self::HANDLE,
39
-			plugin_dir_url( dirname( __DIR__ ) ) . 'js/dist/no-editor-analysis.full.css',
39
+			plugin_dir_url(dirname(__DIR__)).'js/dist/no-editor-analysis.full.css',
40 40
 			array(),
41 41
 			WORDLIFT_VERSION
42 42
 		);
Please login to merge, or discard this patch.
src/wordlift/no-editor-analysis/class-edit-screen-setting.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@
 block discarded – undo
10 10
  */
11 11
 class Edit_Screen_Setting {
12 12
 
13
-	public function add_setting() {
14
-		add_filter( 'wl_admin_settings', array( $this, 'wl_admin_settings' ) );
15
-	}
13
+    public function add_setting() {
14
+        add_filter( 'wl_admin_settings', array( $this, 'wl_admin_settings' ) );
15
+    }
16 16
 
17
-	public function wl_admin_settings( $settings ) {
18
-		$settings['analysis']['isNoEditorAnalysisActive'] = No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( get_the_ID() );
19
-		return $settings;
20
-	}
17
+    public function wl_admin_settings( $settings ) {
18
+        $settings['analysis']['isNoEditorAnalysisActive'] = No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( get_the_ID() );
19
+        return $settings;
20
+    }
21 21
 
22 22
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@
 block discarded – undo
11 11
 class Edit_Screen_Setting {
12 12
 
13 13
 	public function add_setting() {
14
-		add_filter( 'wl_admin_settings', array( $this, 'wl_admin_settings' ) );
14
+		add_filter('wl_admin_settings', array($this, 'wl_admin_settings'));
15 15
 	}
16 16
 
17
-	public function wl_admin_settings( $settings ) {
18
-		$settings['analysis']['isNoEditorAnalysisActive'] = No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( get_the_ID() );
17
+	public function wl_admin_settings($settings) {
18
+		$settings['analysis']['isNoEditorAnalysisActive'] = No_Editor_Analysis_Feature::can_no_editor_analysis_be_used(get_the_ID());
19 19
 		return $settings;
20 20
 	}
21 21
 
Please login to merge, or discard this patch.
src/wordlift/lod-import/index.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,6 +4,6 @@
 block discarded – undo
4 4
 
5 5
 // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
6 6
 if ( apply_filters( 'wl_feature__enable__lod-import', false ) ) {
7
-	$lod_import = new Lod_Import();
8
-	$lod_import->register_hooks();
7
+    $lod_import = new Lod_Import();
8
+    $lod_import->register_hooks();
9 9
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 use Wordlift\Lod_Import\Lod_Import;
4 4
 
5 5
 // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
6
-if ( apply_filters( 'wl_feature__enable__lod-import', false ) ) {
6
+if (apply_filters('wl_feature__enable__lod-import', false)) {
7 7
 	$lod_import = new Lod_Import();
8 8
 	$lod_import->register_hooks();
9 9
 }
Please login to merge, or discard this patch.
src/wordlift/lod-import/class-lod-import.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -10,30 +10,30 @@  discard block
 block discarded – undo
10 10
 
11 11
 class Lod_Import {
12 12
 
13
-	public function __construct() {
13
+    public function __construct() {
14 14
 
15
-	}
15
+    }
16 16
 
17
-	public function register_hooks() {
18
-		add_action( 'admin_menu', array( $this, 'admin_menu' ) );
19
-	}
17
+    public function register_hooks() {
18
+        add_action( 'admin_menu', array( $this, 'admin_menu' ) );
19
+    }
20 20
 
21
-	public function admin_menu() {
21
+    public function admin_menu() {
22 22
 
23
-		$callback = isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' === sanitize_text_field( wp_unslash( $_SERVER['REQUEST_METHOD'] ) ) ? 'handle' : 'render';
23
+        $callback = isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' === sanitize_text_field( wp_unslash( $_SERVER['REQUEST_METHOD'] ) ) ? 'handle' : 'render';
24 24
 
25
-		add_submenu_page(
26
-			'wl_admin_menu',
27
-			__( 'LOD Import', 'wordlift' ),
28
-			__( 'LOD Import', 'wordlift' ),
29
-			'manage_options',
30
-			'wl_lod_import',
31
-			array( $this, $callback )
32
-		);
33
-	}
25
+        add_submenu_page(
26
+            'wl_admin_menu',
27
+            __( 'LOD Import', 'wordlift' ),
28
+            __( 'LOD Import', 'wordlift' ),
29
+            'manage_options',
30
+            'wl_lod_import',
31
+            array( $this, $callback )
32
+        );
33
+    }
34 34
 
35
-	public function render() {
36
-		?>
35
+    public function render() {
36
+        ?>
37 37
 		<div class="wrap">
38 38
 			<h1><?php esc_html_e( 'LOD Import', 'wordlift' ); ?></h1>
39 39
 			<p><?php esc_html_e( 'Helpful stuff here', 'wordlift' ); ?></p>
@@ -48,38 +48,38 @@  discard block
 block discarded – undo
48 48
 		</div>
49 49
 		<?php
50 50
 
51
-	}
51
+    }
52 52
 
53
-	public function handle() {
54
-		$item_ids = filter_input( INPUT_POST, 'item-ids' );
55
-		if ( ! $item_ids ) {
56
-			?>
53
+    public function handle() {
54
+        $item_ids = filter_input( INPUT_POST, 'item-ids' );
55
+        if ( ! $item_ids ) {
56
+            ?>
57 57
 			<p class="notice notice-error">Please type stgh</p>
58 58
 			<?php
59
-			return;
60
-		}
59
+            return;
60
+        }
61 61
 
62
-		foreach ( preg_split( '(\r\n|\r|\n)', $item_ids ) as $item_id ) {
63
-			$this->import_single( $item_id );
64
-		}
65
-	}
62
+        foreach ( preg_split( '(\r\n|\r|\n)', $item_ids ) as $item_id ) {
63
+            $this->import_single( $item_id );
64
+        }
65
+    }
66 66
 
67
-	private function import_single( $item_id ) {
67
+    private function import_single( $item_id ) {
68 68
 
69
-		$content_service = Wordpress_Content_Service::get_instance();
69
+        $content_service = Wordpress_Content_Service::get_instance();
70 70
 
71
-		// Do not create/update an existing entity.
72
-		if ( $content_service->get_by_entity_id_or_same_as( $item_id ) ) {
73
-			return;
74
-		}
71
+        // Do not create/update an existing entity.
72
+        if ( $content_service->get_by_entity_id_or_same_as( $item_id ) ) {
73
+            return;
74
+        }
75 75
 
76
-		$remote_entity = Url_To_Remote_Entity_Converter::convert( $item_id );
77
-		$importer      = Remote_Entity_Importer_Factory::from_entity( $remote_entity );
78
-		$content_id    = $importer->import();
79
-		if ( $content_id instanceof Content_Id && $content_id->get_type() === Object_Type_Enum::POST ) {
80
-			edit_post_link( null, null, null, $content_id->get_id() );
81
-		}
76
+        $remote_entity = Url_To_Remote_Entity_Converter::convert( $item_id );
77
+        $importer      = Remote_Entity_Importer_Factory::from_entity( $remote_entity );
78
+        $content_id    = $importer->import();
79
+        if ( $content_id instanceof Content_Id && $content_id->get_type() === Object_Type_Enum::POST ) {
80
+            edit_post_link( null, null, null, $content_id->get_id() );
81
+        }
82 82
 
83
-	}
83
+    }
84 84
 
85 85
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -15,35 +15,35 @@  discard block
 block discarded – undo
15 15
 	}
16 16
 
17 17
 	public function register_hooks() {
18
-		add_action( 'admin_menu', array( $this, 'admin_menu' ) );
18
+		add_action('admin_menu', array($this, 'admin_menu'));
19 19
 	}
20 20
 
21 21
 	public function admin_menu() {
22 22
 
23
-		$callback = isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' === sanitize_text_field( wp_unslash( $_SERVER['REQUEST_METHOD'] ) ) ? 'handle' : 'render';
23
+		$callback = isset($_SERVER['REQUEST_METHOD']) && 'POST' === sanitize_text_field(wp_unslash($_SERVER['REQUEST_METHOD'])) ? 'handle' : 'render';
24 24
 
25 25
 		add_submenu_page(
26 26
 			'wl_admin_menu',
27
-			__( 'LOD Import', 'wordlift' ),
28
-			__( 'LOD Import', 'wordlift' ),
27
+			__('LOD Import', 'wordlift'),
28
+			__('LOD Import', 'wordlift'),
29 29
 			'manage_options',
30 30
 			'wl_lod_import',
31
-			array( $this, $callback )
31
+			array($this, $callback)
32 32
 		);
33 33
 	}
34 34
 
35 35
 	public function render() {
36 36
 		?>
37 37
 		<div class="wrap">
38
-			<h1><?php esc_html_e( 'LOD Import', 'wordlift' ); ?></h1>
39
-			<p><?php esc_html_e( 'Helpful stuff here', 'wordlift' ); ?></p>
38
+			<h1><?php esc_html_e('LOD Import', 'wordlift'); ?></h1>
39
+			<p><?php esc_html_e('Helpful stuff here', 'wordlift'); ?></p>
40 40
 			<form method="post" novalidate="novalidate">
41 41
 				<div class="form-field">
42
-					<label for="item-ids"><?php esc_html_e( 'Linked Data IDs', 'wordlift' ); ?></label>
42
+					<label for="item-ids"><?php esc_html_e('Linked Data IDs', 'wordlift'); ?></label>
43 43
 					<textarea name="item-ids" id="item-ids" rows="5" cols="40"></textarea>
44
-					<p><?php esc_html_e( 'The description is not prominent by default; however, some themes may show it.', 'wordlift' ); ?></p>
44
+					<p><?php esc_html_e('The description is not prominent by default; however, some themes may show it.', 'wordlift'); ?></p>
45 45
 				</div>
46
-				<?php submit_button( 'Import' ); ?>
46
+				<?php submit_button('Import'); ?>
47 47
 			</form>
48 48
 		</div>
49 49
 		<?php
@@ -51,33 +51,33 @@  discard block
 block discarded – undo
51 51
 	}
52 52
 
53 53
 	public function handle() {
54
-		$item_ids = filter_input( INPUT_POST, 'item-ids' );
55
-		if ( ! $item_ids ) {
54
+		$item_ids = filter_input(INPUT_POST, 'item-ids');
55
+		if ( ! $item_ids) {
56 56
 			?>
57 57
 			<p class="notice notice-error">Please type stgh</p>
58 58
 			<?php
59 59
 			return;
60 60
 		}
61 61
 
62
-		foreach ( preg_split( '(\r\n|\r|\n)', $item_ids ) as $item_id ) {
63
-			$this->import_single( $item_id );
62
+		foreach (preg_split('(\r\n|\r|\n)', $item_ids) as $item_id) {
63
+			$this->import_single($item_id);
64 64
 		}
65 65
 	}
66 66
 
67
-	private function import_single( $item_id ) {
67
+	private function import_single($item_id) {
68 68
 
69 69
 		$content_service = Wordpress_Content_Service::get_instance();
70 70
 
71 71
 		// Do not create/update an existing entity.
72
-		if ( $content_service->get_by_entity_id_or_same_as( $item_id ) ) {
72
+		if ($content_service->get_by_entity_id_or_same_as($item_id)) {
73 73
 			return;
74 74
 		}
75 75
 
76
-		$remote_entity = Url_To_Remote_Entity_Converter::convert( $item_id );
77
-		$importer      = Remote_Entity_Importer_Factory::from_entity( $remote_entity );
76
+		$remote_entity = Url_To_Remote_Entity_Converter::convert($item_id);
77
+		$importer      = Remote_Entity_Importer_Factory::from_entity($remote_entity);
78 78
 		$content_id    = $importer->import();
79
-		if ( $content_id instanceof Content_Id && $content_id->get_type() === Object_Type_Enum::POST ) {
80
-			edit_post_link( null, null, null, $content_id->get_id() );
79
+		if ($content_id instanceof Content_Id && $content_id->get_type() === Object_Type_Enum::POST) {
80
+			edit_post_link(null, null, null, $content_id->get_id());
81 81
 		}
82 82
 
83 83
 	}
Please login to merge, or discard this patch.