Completed
Push — develop ( 981d93...a2521a )
by David
01:31 queued 15s
created
src/modules/dashboard/load.php 2 patches
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -21,65 +21,65 @@  discard block
 block discarded – undo
21 21
  */
22 22
 function __wl_dashboard__load() {
23 23
 
24
-	// Dashboard is available only for Food Kg and Gardening Kg atm
25
-	// phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
26
-	if ( ! apply_filters( 'wl_feature__enable__food-kg', false ) && ! apply_filters( 'wl_feature__enable__gardening-kg', false ) ) {
27
-		return;
28
-	}
24
+    // Dashboard is available only for Food Kg and Gardening Kg atm
25
+    // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
26
+    if ( ! apply_filters( 'wl_feature__enable__food-kg', false ) && ! apply_filters( 'wl_feature__enable__gardening-kg', false ) ) {
27
+        return;
28
+    }
29 29
 
30
-	// Autoloader for plugin itself.
31
-	if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
32
-		require_once __DIR__ . '/vendor/autoload.php';
33
-	}
30
+    // Autoloader for plugin itself.
31
+    if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
32
+        require_once __DIR__ . '/vendor/autoload.php';
33
+    }
34 34
 
35
-	$container_builder = new ContainerBuilder();
36
-	$loader            = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) );
37
-	$loader->load( 'services.yml' );
38
-	$container_builder->compile();
35
+    $container_builder = new ContainerBuilder();
36
+    $loader            = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) );
37
+    $loader->load( 'services.yml' );
38
+    $container_builder->compile();
39 39
 
40
-	/**
41
-	 * @var $rest_controller Rest_Controller
42
-	 */
43
-	$rest_controller = $container_builder->get( 'Wordlift\Modules\Dashboard\Synchronization\Rest_Controller' );
44
-	$rest_controller->register_hooks();
40
+    /**
41
+     * @var $rest_controller Rest_Controller
42
+     */
43
+    $rest_controller = $container_builder->get( 'Wordlift\Modules\Dashboard\Synchronization\Rest_Controller' );
44
+    $rest_controller->register_hooks();
45 45
 
46
-	/**
47
-	 * @var $term_entity_match_rest_controller Term_Entity_Match_Rest_Controller
48
-	 */
49
-	$term_entity_match_rest_controller = $container_builder->get( Term_Entity_Match_Rest_Controller::class );
50
-	$term_entity_match_rest_controller->register_hooks();
46
+    /**
47
+     * @var $term_entity_match_rest_controller Term_Entity_Match_Rest_Controller
48
+     */
49
+    $term_entity_match_rest_controller = $container_builder->get( Term_Entity_Match_Rest_Controller::class );
50
+    $term_entity_match_rest_controller->register_hooks();
51 51
 
52
-	/**
53
-	 * @var $term_entity_match_rest_controller \Wordlift\Modules\Dashboard\Post_Entity_Match\Post_Entity_Match_Rest_Controller
54
-	 */
55
-	$post_entity_match_rest_controller = $container_builder->get( \Wordlift\Modules\Dashboard\Post_Entity_Match\Post_Entity_Match_Rest_Controller::class );
56
-	$post_entity_match_rest_controller->register_hooks();
52
+    /**
53
+     * @var $term_entity_match_rest_controller \Wordlift\Modules\Dashboard\Post_Entity_Match\Post_Entity_Match_Rest_Controller
54
+     */
55
+    $post_entity_match_rest_controller = $container_builder->get( \Wordlift\Modules\Dashboard\Post_Entity_Match\Post_Entity_Match_Rest_Controller::class );
56
+    $post_entity_match_rest_controller->register_hooks();
57 57
 
58
-	/**
59
-	 * @var $synchronization_service Synchronization_Service
60
-	 */
61
-	$synchronization_service = $container_builder->get( 'Wordlift\Modules\Dashboard\Synchronization\Synchronization_Service' );
62
-	$synchronization_service->register_hooks();
58
+    /**
59
+     * @var $synchronization_service Synchronization_Service
60
+     */
61
+    $synchronization_service = $container_builder->get( 'Wordlift\Modules\Dashboard\Synchronization\Synchronization_Service' );
62
+    $synchronization_service->register_hooks();
63 63
 
64
-	$app_settings = $container_builder->get( App_Settings::class );
65
-	$app_settings->register_hooks();
64
+    $app_settings = $container_builder->get( App_Settings::class );
65
+    $app_settings->register_hooks();
66 66
 
67
-	/** Admin Menu */
68
-	add_action(
69
-		'admin_menu',
70
-		function () {
71
-			add_submenu_page( 'wl_admin_menu', __( 'Dashboard', 'wordlift' ), __( 'Dashboard', 'wordlift' ), 'manage_options', 'wl_admin_menu', '_wl_dashboard__main' );
72
-		},
73
-		9
74
-	);
67
+    /** Admin Menu */
68
+    add_action(
69
+        'admin_menu',
70
+        function () {
71
+            add_submenu_page( 'wl_admin_menu', __( 'Dashboard', 'wordlift' ), __( 'Dashboard', 'wordlift' ), 'manage_options', 'wl_admin_menu', '_wl_dashboard__main' );
72
+        },
73
+        9
74
+    );
75 75
 
76
-	add_action(
77
-		'_wl_dashboard__main',
78
-		function () {
79
-			wp_enqueue_script( WL_ANGULAR_APP_SCRIPT_HANDLE );
80
-			$iframe_src = WL_ANGULAR_APP_URL . '#/admin/dashboard';
81
-			// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
82
-			echo "
76
+    add_action(
77
+        '_wl_dashboard__main',
78
+        function () {
79
+            wp_enqueue_script( WL_ANGULAR_APP_SCRIPT_HANDLE );
80
+            $iframe_src = WL_ANGULAR_APP_URL . '#/admin/dashboard';
81
+            // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
82
+            echo "
83 83
 			<style>
84 84
 			    #wlx-plugin-app {
85 85
 			      margin-left: -20px;
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 			<iframe id='wlx-plugin-app' src='$iframe_src'></iframe>
91 91
             ";
92 92
 
93
-		}
94
-	);
93
+        }
94
+    );
95 95
 
96 96
 }
97 97
 
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -23,61 +23,61 @@
 block discarded – undo
23 23
 
24 24
 	// Dashboard is available only for Food Kg and Gardening Kg atm
25 25
 	// phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
26
-	if ( ! apply_filters( 'wl_feature__enable__food-kg', false ) && ! apply_filters( 'wl_feature__enable__gardening-kg', false ) ) {
26
+	if ( ! apply_filters('wl_feature__enable__food-kg', false) && ! apply_filters('wl_feature__enable__gardening-kg', false)) {
27 27
 		return;
28 28
 	}
29 29
 
30 30
 	// Autoloader for plugin itself.
31
-	if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
32
-		require_once __DIR__ . '/vendor/autoload.php';
31
+	if (file_exists(__DIR__.'/vendor/autoload.php')) {
32
+		require_once __DIR__.'/vendor/autoload.php';
33 33
 	}
34 34
 
35 35
 	$container_builder = new ContainerBuilder();
36
-	$loader            = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) );
37
-	$loader->load( 'services.yml' );
36
+	$loader            = new YamlFileLoader($container_builder, new FileLocator(__DIR__));
37
+	$loader->load('services.yml');
38 38
 	$container_builder->compile();
39 39
 
40 40
 	/**
41 41
 	 * @var $rest_controller Rest_Controller
42 42
 	 */
43
-	$rest_controller = $container_builder->get( 'Wordlift\Modules\Dashboard\Synchronization\Rest_Controller' );
43
+	$rest_controller = $container_builder->get('Wordlift\Modules\Dashboard\Synchronization\Rest_Controller');
44 44
 	$rest_controller->register_hooks();
45 45
 
46 46
 	/**
47 47
 	 * @var $term_entity_match_rest_controller Term_Entity_Match_Rest_Controller
48 48
 	 */
49
-	$term_entity_match_rest_controller = $container_builder->get( Term_Entity_Match_Rest_Controller::class );
49
+	$term_entity_match_rest_controller = $container_builder->get(Term_Entity_Match_Rest_Controller::class);
50 50
 	$term_entity_match_rest_controller->register_hooks();
51 51
 
52 52
 	/**
53 53
 	 * @var $term_entity_match_rest_controller \Wordlift\Modules\Dashboard\Post_Entity_Match\Post_Entity_Match_Rest_Controller
54 54
 	 */
55
-	$post_entity_match_rest_controller = $container_builder->get( \Wordlift\Modules\Dashboard\Post_Entity_Match\Post_Entity_Match_Rest_Controller::class );
55
+	$post_entity_match_rest_controller = $container_builder->get(\Wordlift\Modules\Dashboard\Post_Entity_Match\Post_Entity_Match_Rest_Controller::class);
56 56
 	$post_entity_match_rest_controller->register_hooks();
57 57
 
58 58
 	/**
59 59
 	 * @var $synchronization_service Synchronization_Service
60 60
 	 */
61
-	$synchronization_service = $container_builder->get( 'Wordlift\Modules\Dashboard\Synchronization\Synchronization_Service' );
61
+	$synchronization_service = $container_builder->get('Wordlift\Modules\Dashboard\Synchronization\Synchronization_Service');
62 62
 	$synchronization_service->register_hooks();
63 63
 
64
-	$app_settings = $container_builder->get( App_Settings::class );
64
+	$app_settings = $container_builder->get(App_Settings::class);
65 65
 	$app_settings->register_hooks();
66 66
 
67 67
 	/** Admin Menu */
68 68
 	add_action(
69 69
 		'admin_menu',
70
-		function () {
71
-			add_submenu_page( 'wl_admin_menu', __( 'Dashboard', 'wordlift' ), __( 'Dashboard', 'wordlift' ), 'manage_options', 'wl_admin_menu', '_wl_dashboard__main' );
70
+		function() {
71
+			add_submenu_page('wl_admin_menu', __('Dashboard', 'wordlift'), __('Dashboard', 'wordlift'), 'manage_options', 'wl_admin_menu', '_wl_dashboard__main');
72 72
 		},
73 73
 		9
74 74
 	);
75 75
 
76 76
 	add_action(
77 77
 		'_wl_dashboard__main',
78
-		function () {
79
-			wp_enqueue_script( WL_ANGULAR_APP_SCRIPT_HANDLE );
80
-			$iframe_src = WL_ANGULAR_APP_URL . '#/admin/dashboard';
78
+		function() {
79
+			wp_enqueue_script(WL_ANGULAR_APP_SCRIPT_HANDLE);
80
+			$iframe_src = WL_ANGULAR_APP_URL.'#/admin/dashboard';
81 81
 			// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
82 82
 			echo "
83 83
 			<style>
Please login to merge, or discard this patch.
src/modules/app/load.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,21 +14,21 @@
 block discarded – undo
14 14
 use Wordlift\Modules\Common\Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
15 15
 
16 16
 if ( ! defined( 'WL_ANGULAR_APP_URL' ) ) {
17
-	define( 'WL_ANGULAR_APP_URL', esc_url( plugin_dir_url( __DIR__ ) . 'app/app/iframe.html' ) . '?v=' . WORDLIFT_VERSION );
17
+    define( 'WL_ANGULAR_APP_URL', esc_url( plugin_dir_url( __DIR__ ) . 'app/app/iframe.html' ) . '?v=' . WORDLIFT_VERSION );
18 18
 }
19 19
 
20 20
 if ( ! defined( 'WL_ANGULAR_APP_SCRIPT_HANDLE' ) ) {
21
-	define( 'WL_ANGULAR_APP_SCRIPT_HANDLE', 'wl-angular-app' );
21
+    define( 'WL_ANGULAR_APP_SCRIPT_HANDLE', 'wl-angular-app' );
22 22
 }
23 23
 
24 24
 // Load the rest of the module only on admin calls.
25 25
 if ( ! is_admin() ) {
26
-	return;
26
+    return;
27 27
 }
28 28
 
29 29
 // Autoloader for plugin itself.
30 30
 if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
31
-	require_once __DIR__ . '/vendor/autoload.php';
31
+    require_once __DIR__ . '/vendor/autoload.php';
32 32
 }
33 33
 
34 34
 $container_builder = new ContainerBuilder();
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -13,32 +13,32 @@
 block discarded – undo
13 13
 use Wordlift\Modules\Common\Symfony\Component\DependencyInjection\ContainerBuilder;
14 14
 use Wordlift\Modules\Common\Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
15 15
 
16
-if ( ! defined( 'WL_ANGULAR_APP_URL' ) ) {
17
-	define( 'WL_ANGULAR_APP_URL', esc_url( plugin_dir_url( __DIR__ ) . 'app/app/iframe.html' ) . '?v=' . WORDLIFT_VERSION );
16
+if ( ! defined('WL_ANGULAR_APP_URL')) {
17
+	define('WL_ANGULAR_APP_URL', esc_url(plugin_dir_url(__DIR__).'app/app/iframe.html').'?v='.WORDLIFT_VERSION);
18 18
 }
19 19
 
20
-if ( ! defined( 'WL_ANGULAR_APP_SCRIPT_HANDLE' ) ) {
21
-	define( 'WL_ANGULAR_APP_SCRIPT_HANDLE', 'wl-angular-app' );
20
+if ( ! defined('WL_ANGULAR_APP_SCRIPT_HANDLE')) {
21
+	define('WL_ANGULAR_APP_SCRIPT_HANDLE', 'wl-angular-app');
22 22
 }
23 23
 
24 24
 // Load the rest of the module only on admin calls.
25
-if ( ! is_admin() ) {
25
+if ( ! is_admin()) {
26 26
 	return;
27 27
 }
28 28
 
29 29
 // Autoloader for plugin itself.
30
-if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
31
-	require_once __DIR__ . '/vendor/autoload.php';
30
+if (file_exists(__DIR__.'/vendor/autoload.php')) {
31
+	require_once __DIR__.'/vendor/autoload.php';
32 32
 }
33 33
 
34 34
 $container_builder = new ContainerBuilder();
35
-$loader            = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) );
36
-$loader->load( 'services.yml' );
35
+$loader            = new YamlFileLoader($container_builder, new FileLocator(__DIR__));
36
+$loader->load('services.yml');
37 37
 $container_builder->compile();
38 38
 
39 39
 /**
40 40
  * @var $app Plugin_App
41 41
  */
42
-$app = $container_builder->get( Plugin_App::class );
42
+$app = $container_builder->get(Plugin_App::class);
43 43
 
44 44
 $app->register_handle();
Please login to merge, or discard this patch.
src/wordlift/vocabulary-terms/jsonld/class-post-jsonld.php 2 patches
Indentation   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -17,117 +17,117 @@
 block discarded – undo
17 17
 
18 18
 class Post_Jsonld {
19 19
 
20
-	public function init() {
21
-		add_filter( 'wl_post_jsonld_array', array( $this, 'wl_post_jsonld_array' ), 10, 2 );
22
-	}
23
-
24
-	public function wl_post_jsonld_array( $data, $post_id ) {
25
-
26
-		$relations = $data['relations'];
27
-
28
-		if ( ! is_a( $relations, 'Wordlift\Relation\Relations' ) ) {
29
-			return $data;
30
-		}
31
-
32
-		$term_relations = $this->get_term_relations( $post_id );
33
-
34
-		if ( ! $term_relations ) {
35
-			return $data;
36
-		}
37
-
38
-		$references       = $data['references'];
39
-		$jsonld           = $data['jsonld'];
40
-		$references_infos = $data['references_infos'];
41
-
42
-		$relations->add( ...$term_relations );
43
-		$term_mentions = $this->get_term_mentions( $term_relations );
44
-
45
-		if ( count( $term_mentions ) > 0 ) {
46
-			$existing_mentions  = array_key_exists( 'mentions', $jsonld ) ? $jsonld['mentions'] : array();
47
-			$jsonld['mentions'] = array_merge( $existing_mentions, $term_mentions );
48
-		}
49
-
50
-		return array(
51
-			'jsonld'           => $jsonld,
52
-			'references'       => $references,
53
-			'references_infos' => $references_infos,
54
-			'relations'        => $relations,
55
-		);
56
-	}
57
-
58
-	/**
59
-	 * @param $post_id
60
-	 * @param $relations Relations
61
-	 *
62
-	 * @return array<Relation> Returns a list of term relations.
63
-	 */
64
-	private function get_term_relations( $post_id ) {
65
-
66
-		/** @var WP_Taxonomy[] $taxonomies_for_post */
67
-		$taxonomies_for_post = get_object_taxonomies( get_post_type( $post_id ), 'objects' );
68
-
69
-		// now we need to collect all terms attached to this post.
70
-		$terms = array();
71
-
72
-		foreach ( $taxonomies_for_post as $taxonomy ) {
73
-			// Please note that `$taxonomy->publicly_queryable is only WP 4.7+
74
-			if ( 'wl_entity_type' === $taxonomy->name || ! $taxonomy->public ) {
75
-				continue;
76
-			}
77
-
78
-			$taxonomy_terms = get_the_terms( $post_id, $taxonomy->name );
79
-			if ( is_array( $taxonomy_terms ) ) {
80
-				$terms = array_merge( $terms, $taxonomy_terms );
81
-			}
82
-		}
83
-
84
-		// Convert everything to the Term Reference.
85
-		return array_filter(
86
-			array_map(
87
-				function ( $term ) use ( $post_id ) {
88
-
89
-					if ( 1 === $term->term_id ) {
90
-						return false;
91
-					}
92
-
93
-					/**
94
-					 * @var WP_Term $term
95
-					 */
96
-					if ( Wordpress_Term_Content_Service::get_instance()
97
-													  ->get_entity_id( Wordpress_Content_Id::create_term( $term->term_id ) )
98
-					) {
99
-						return new Relation(
100
-							Wordpress_Content_Id::create_post( $post_id ),
101
-							Wordpress_Content_Id::create_term( $term->term_id ),
102
-							WL_WHAT_RELATION
103
-						);
104
-					}
105
-
106
-					return false;
107
-				},
108
-				$terms
109
-			)
110
-		);
111
-
112
-	}
113
-
114
-	/**
115
-	 * @param $term_relations array<Relation>
116
-	 *
117
-	 * @return array
118
-	 */
119
-	private function get_term_mentions( $term_relations ) {
120
-
121
-		return array_map(
122
-			function ( $term_relation ) {
123
-				return array(
124
-					'@id' => Wordpress_Term_Content_Service::get_instance()
125
-															  ->get_entity_id( $term_relation->get_object() ),
126
-				);
127
-			},
128
-			$term_relations
129
-		);
130
-
131
-	}
20
+    public function init() {
21
+        add_filter( 'wl_post_jsonld_array', array( $this, 'wl_post_jsonld_array' ), 10, 2 );
22
+    }
23
+
24
+    public function wl_post_jsonld_array( $data, $post_id ) {
25
+
26
+        $relations = $data['relations'];
27
+
28
+        if ( ! is_a( $relations, 'Wordlift\Relation\Relations' ) ) {
29
+            return $data;
30
+        }
31
+
32
+        $term_relations = $this->get_term_relations( $post_id );
33
+
34
+        if ( ! $term_relations ) {
35
+            return $data;
36
+        }
37
+
38
+        $references       = $data['references'];
39
+        $jsonld           = $data['jsonld'];
40
+        $references_infos = $data['references_infos'];
41
+
42
+        $relations->add( ...$term_relations );
43
+        $term_mentions = $this->get_term_mentions( $term_relations );
44
+
45
+        if ( count( $term_mentions ) > 0 ) {
46
+            $existing_mentions  = array_key_exists( 'mentions', $jsonld ) ? $jsonld['mentions'] : array();
47
+            $jsonld['mentions'] = array_merge( $existing_mentions, $term_mentions );
48
+        }
49
+
50
+        return array(
51
+            'jsonld'           => $jsonld,
52
+            'references'       => $references,
53
+            'references_infos' => $references_infos,
54
+            'relations'        => $relations,
55
+        );
56
+    }
57
+
58
+    /**
59
+     * @param $post_id
60
+     * @param $relations Relations
61
+     *
62
+     * @return array<Relation> Returns a list of term relations.
63
+     */
64
+    private function get_term_relations( $post_id ) {
65
+
66
+        /** @var WP_Taxonomy[] $taxonomies_for_post */
67
+        $taxonomies_for_post = get_object_taxonomies( get_post_type( $post_id ), 'objects' );
68
+
69
+        // now we need to collect all terms attached to this post.
70
+        $terms = array();
71
+
72
+        foreach ( $taxonomies_for_post as $taxonomy ) {
73
+            // Please note that `$taxonomy->publicly_queryable is only WP 4.7+
74
+            if ( 'wl_entity_type' === $taxonomy->name || ! $taxonomy->public ) {
75
+                continue;
76
+            }
77
+
78
+            $taxonomy_terms = get_the_terms( $post_id, $taxonomy->name );
79
+            if ( is_array( $taxonomy_terms ) ) {
80
+                $terms = array_merge( $terms, $taxonomy_terms );
81
+            }
82
+        }
83
+
84
+        // Convert everything to the Term Reference.
85
+        return array_filter(
86
+            array_map(
87
+                function ( $term ) use ( $post_id ) {
88
+
89
+                    if ( 1 === $term->term_id ) {
90
+                        return false;
91
+                    }
92
+
93
+                    /**
94
+                     * @var WP_Term $term
95
+                     */
96
+                    if ( Wordpress_Term_Content_Service::get_instance()
97
+                                                        ->get_entity_id( Wordpress_Content_Id::create_term( $term->term_id ) )
98
+                    ) {
99
+                        return new Relation(
100
+                            Wordpress_Content_Id::create_post( $post_id ),
101
+                            Wordpress_Content_Id::create_term( $term->term_id ),
102
+                            WL_WHAT_RELATION
103
+                        );
104
+                    }
105
+
106
+                    return false;
107
+                },
108
+                $terms
109
+            )
110
+        );
111
+
112
+    }
113
+
114
+    /**
115
+     * @param $term_relations array<Relation>
116
+     *
117
+     * @return array
118
+     */
119
+    private function get_term_mentions( $term_relations ) {
120
+
121
+        return array_map(
122
+            function ( $term_relation ) {
123
+                return array(
124
+                    '@id' => Wordpress_Term_Content_Service::get_instance()
125
+                                                                ->get_entity_id( $term_relation->get_object() ),
126
+                );
127
+            },
128
+            $term_relations
129
+        );
130
+
131
+    }
132 132
 
133 133
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -18,20 +18,20 @@  discard block
 block discarded – undo
18 18
 class Post_Jsonld {
19 19
 
20 20
 	public function init() {
21
-		add_filter( 'wl_post_jsonld_array', array( $this, 'wl_post_jsonld_array' ), 10, 2 );
21
+		add_filter('wl_post_jsonld_array', array($this, 'wl_post_jsonld_array'), 10, 2);
22 22
 	}
23 23
 
24
-	public function wl_post_jsonld_array( $data, $post_id ) {
24
+	public function wl_post_jsonld_array($data, $post_id) {
25 25
 
26 26
 		$relations = $data['relations'];
27 27
 
28
-		if ( ! is_a( $relations, 'Wordlift\Relation\Relations' ) ) {
28
+		if ( ! is_a($relations, 'Wordlift\Relation\Relations')) {
29 29
 			return $data;
30 30
 		}
31 31
 
32
-		$term_relations = $this->get_term_relations( $post_id );
32
+		$term_relations = $this->get_term_relations($post_id);
33 33
 
34
-		if ( ! $term_relations ) {
34
+		if ( ! $term_relations) {
35 35
 			return $data;
36 36
 		}
37 37
 
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 		$jsonld           = $data['jsonld'];
40 40
 		$references_infos = $data['references_infos'];
41 41
 
42
-		$relations->add( ...$term_relations );
43
-		$term_mentions = $this->get_term_mentions( $term_relations );
42
+		$relations->add(...$term_relations);
43
+		$term_mentions = $this->get_term_mentions($term_relations);
44 44
 
45
-		if ( count( $term_mentions ) > 0 ) {
46
-			$existing_mentions  = array_key_exists( 'mentions', $jsonld ) ? $jsonld['mentions'] : array();
47
-			$jsonld['mentions'] = array_merge( $existing_mentions, $term_mentions );
45
+		if (count($term_mentions) > 0) {
46
+			$existing_mentions  = array_key_exists('mentions', $jsonld) ? $jsonld['mentions'] : array();
47
+			$jsonld['mentions'] = array_merge($existing_mentions, $term_mentions);
48 48
 		}
49 49
 
50 50
 		return array(
@@ -61,44 +61,44 @@  discard block
 block discarded – undo
61 61
 	 *
62 62
 	 * @return array<Relation> Returns a list of term relations.
63 63
 	 */
64
-	private function get_term_relations( $post_id ) {
64
+	private function get_term_relations($post_id) {
65 65
 
66 66
 		/** @var WP_Taxonomy[] $taxonomies_for_post */
67
-		$taxonomies_for_post = get_object_taxonomies( get_post_type( $post_id ), 'objects' );
67
+		$taxonomies_for_post = get_object_taxonomies(get_post_type($post_id), 'objects');
68 68
 
69 69
 		// now we need to collect all terms attached to this post.
70 70
 		$terms = array();
71 71
 
72
-		foreach ( $taxonomies_for_post as $taxonomy ) {
72
+		foreach ($taxonomies_for_post as $taxonomy) {
73 73
 			// Please note that `$taxonomy->publicly_queryable is only WP 4.7+
74
-			if ( 'wl_entity_type' === $taxonomy->name || ! $taxonomy->public ) {
74
+			if ('wl_entity_type' === $taxonomy->name || ! $taxonomy->public) {
75 75
 				continue;
76 76
 			}
77 77
 
78
-			$taxonomy_terms = get_the_terms( $post_id, $taxonomy->name );
79
-			if ( is_array( $taxonomy_terms ) ) {
80
-				$terms = array_merge( $terms, $taxonomy_terms );
78
+			$taxonomy_terms = get_the_terms($post_id, $taxonomy->name);
79
+			if (is_array($taxonomy_terms)) {
80
+				$terms = array_merge($terms, $taxonomy_terms);
81 81
 			}
82 82
 		}
83 83
 
84 84
 		// Convert everything to the Term Reference.
85 85
 		return array_filter(
86 86
 			array_map(
87
-				function ( $term ) use ( $post_id ) {
87
+				function($term) use ($post_id) {
88 88
 
89
-					if ( 1 === $term->term_id ) {
89
+					if (1 === $term->term_id) {
90 90
 						return false;
91 91
 					}
92 92
 
93 93
 					/**
94 94
 					 * @var WP_Term $term
95 95
 					 */
96
-					if ( Wordpress_Term_Content_Service::get_instance()
97
-													  ->get_entity_id( Wordpress_Content_Id::create_term( $term->term_id ) )
96
+					if (Wordpress_Term_Content_Service::get_instance()
97
+													  ->get_entity_id(Wordpress_Content_Id::create_term($term->term_id))
98 98
 					) {
99 99
 						return new Relation(
100
-							Wordpress_Content_Id::create_post( $post_id ),
101
-							Wordpress_Content_Id::create_term( $term->term_id ),
100
+							Wordpress_Content_Id::create_post($post_id),
101
+							Wordpress_Content_Id::create_term($term->term_id),
102 102
 							WL_WHAT_RELATION
103 103
 						);
104 104
 					}
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @return array
118 118
 	 */
119
-	private function get_term_mentions( $term_relations ) {
119
+	private function get_term_mentions($term_relations) {
120 120
 
121 121
 		return array_map(
122
-			function ( $term_relation ) {
122
+			function($term_relation) {
123 123
 				return array(
124 124
 					'@id' => Wordpress_Term_Content_Service::get_instance()
125
-															  ->get_entity_id( $term_relation->get_object() ),
125
+															  ->get_entity_id($term_relation->get_object()),
126 126
 				);
127 127
 			},
128 128
 			$term_relations
Please login to merge, or discard this patch.