Completed
Push — develop ( 8bae85...a85f9c )
by David
04:43 queued 01:50
created
src/admin/class-wordlift-admin-dashboard-v2.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,8 @@
 block discarded – undo
35 35
 	 * Wordlift_Admin_Dashboard_V2 constructor.
36 36
 	 *
37 37
 	 * @param \Wordlift_Admin_Search_Rankings_Service $search_rankings_service The {@link Wordlift_Admin_Search_Rankings_Service} instance.
38
-	 * @param                                         $dashboard_service
38
+	 * @param                                         Wordlift_Dashboard_Service $dashboard_service
39
+	 * @param Wordlift_Entity_Service $entity_service
39 40
 	 *
40 41
 	 * @since 3.20.0
41 42
 	 *
Please login to merge, or discard this patch.
Indentation   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -5,133 +5,133 @@  discard block
 block discarded – undo
5 5
 
6 6
 class Wordlift_Admin_Dashboard_V2 {
7 7
 
8
-	const TODAYS_TIP = 'wl_todays_tip_data';
9
-	const AVERAGE_POSITION = 'wl_search_rankings_average_position';
10
-
11
-	/**
12
-	 * The {@link Wordlift_Admin_Search_Rankings_Service} instance.
13
-	 *
14
-	 * @since 3.20.0
15
-	 * @access private
16
-	 * @var \Wordlift_Admin_Search_Rankings_Service $search_rankings_service The {@link Wordlift_Admin_Search_Rankings_Service} instance.
17
-	 */
18
-	private $search_rankings_service;
19
-
20
-	/**
21
-	 * The {@link Wordlift_Dashboard_Service} instance.
22
-	 *
23
-	 * @var \Wordlift_Dashboard_Service $dashboard_service The {@link Wordlift_Dashboard_Service} instance.
24
-	 * @access private
25
-	 * @since 3.20.0
26
-	 */
27
-	private $dashboard_service;
28
-
29
-	/**
30
-	 * @var \Wordlift_Entity_Service $entity_service
31
-	 */
32
-	private $entity_service;
33
-
34
-	/**
35
-	 * Wordlift_Admin_Dashboard_V2 constructor.
36
-	 *
37
-	 * @param \Wordlift_Admin_Search_Rankings_Service $search_rankings_service The {@link Wordlift_Admin_Search_Rankings_Service} instance.
38
-	 * @param                                         $dashboard_service
39
-	 *
40
-	 * @since 3.20.0
41
-	 *
42
-	 */
43
-	public function __construct( $search_rankings_service, $dashboard_service, $entity_service ) {
44
-
45
-		add_action( 'wp_dashboard_setup', array( $this, 'dashboard_setup' ) );
46
-
47
-		// Define where to access the tip.
48
-		defined( 'WL_TODAYS_TIP_JSON_URL' ) || define( 'WL_TODAYS_TIP_JSON_URL', 'https://wordlift.io/blog' );
49
-		defined( 'WL_TODAYS_TIP_JSON_URL_IT' ) || define( 'WL_TODAYS_TIP_JSON_URL_IT', '/it/wp-json/wp/v2/posts?context=embed&per_page=1&categories=27' );
50
-		defined( 'WL_TODAYS_TIP_JSON_URL_EN' ) || define( 'WL_TODAYS_TIP_JSON_URL_EN', '/en/wp-json/wp/v2/posts?context=embed&per_page=1&categories=38' );
51
-
52
-		$this->search_rankings_service = $search_rankings_service;
53
-		$this->dashboard_service       = $dashboard_service;
54
-		$this->entity_service          = $entity_service;
55
-
56
-	}
57
-
58
-	/**
59
-	 * Set up the dashboard metabox.
60
-	 *
61
-	 * @since 3.20.0
62
-	 */
63
-	public function dashboard_setup() {
64
-
65
-		wp_add_dashboard_widget(
66
-			'wl-dashboard-v2',
67
-			__( 'WordLift Dashboard', 'wordlift' ),
68
-			array( $this, 'dashboard_setup_callback' )
69
-		);
70
-
71
-	}
72
-
73
-	/**
74
-	 * The dashboard setup callback.
75
-	 *
76
-	 * @since 3.20.0
77
-	 */
78
-	public function dashboard_setup_callback() {
79
-
80
-		// Get the average position.
81
-		$average_position_string = $this->get_average_position();
82
-
83
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/wordlift-admin-dashboard-v2.php';
84
-
85
-	}
86
-
87
-	/**
88
-	 * Get the keyword average position.
89
-	 *
90
-	 * @return string The formatted average position string (or `n/a` if not available).
91
-	 * @since 3.20.0
92
-	 *
93
-	 */
94
-	private function get_average_position() {
95
-
96
-		// Get the cache value.
97
-		$average_position = get_transient( self::AVERAGE_POSITION );
98
-
99
-		// If there's no cached value, load it.
100
-		if ( false === $average_position ) {
101
-			// Get the average position from Search Ranking Service.
102
-			$average_position = @$this->search_rankings_service->get_average_position();
103
-
104
-			// If there was an error return 'n/a'.
105
-			if ( false === $average_position ) {
106
-				return esc_html( _x( 'n/a', 'Dashboard', 'wordlift' ) );
107
-			}
108
-		}
109
-
110
-		// Store the value for one day.
111
-		set_transient( self::AVERAGE_POSITION, $average_position, 86400 ); // One day.
112
-
113
-		// Format the average position with one decimal.
114
-		return number_format( $average_position, 1 );
115
-	}
116
-
117
-	/**
118
-	 * Get the top entities.
119
-	 *
120
-	 * @return array|object|null An array of top entities.
121
-	 * @since 3.20.0
122
-	 *
123
-	 */
124
-	private function get_top_entities() {
125
-
126
-		// Get the cached results.
127
-		$results = get_transient( '_wl_admin_dashboard_v2__top_entities' );
128
-		if ( false !== $results ) {
129
-			return $results;
130
-		}
131
-
132
-		global $wpdb;
133
-
134
-		$query = <<<EOF
8
+    const TODAYS_TIP = 'wl_todays_tip_data';
9
+    const AVERAGE_POSITION = 'wl_search_rankings_average_position';
10
+
11
+    /**
12
+     * The {@link Wordlift_Admin_Search_Rankings_Service} instance.
13
+     *
14
+     * @since 3.20.0
15
+     * @access private
16
+     * @var \Wordlift_Admin_Search_Rankings_Service $search_rankings_service The {@link Wordlift_Admin_Search_Rankings_Service} instance.
17
+     */
18
+    private $search_rankings_service;
19
+
20
+    /**
21
+     * The {@link Wordlift_Dashboard_Service} instance.
22
+     *
23
+     * @var \Wordlift_Dashboard_Service $dashboard_service The {@link Wordlift_Dashboard_Service} instance.
24
+     * @access private
25
+     * @since 3.20.0
26
+     */
27
+    private $dashboard_service;
28
+
29
+    /**
30
+     * @var \Wordlift_Entity_Service $entity_service
31
+     */
32
+    private $entity_service;
33
+
34
+    /**
35
+     * Wordlift_Admin_Dashboard_V2 constructor.
36
+     *
37
+     * @param \Wordlift_Admin_Search_Rankings_Service $search_rankings_service The {@link Wordlift_Admin_Search_Rankings_Service} instance.
38
+     * @param                                         $dashboard_service
39
+     *
40
+     * @since 3.20.0
41
+     *
42
+     */
43
+    public function __construct( $search_rankings_service, $dashboard_service, $entity_service ) {
44
+
45
+        add_action( 'wp_dashboard_setup', array( $this, 'dashboard_setup' ) );
46
+
47
+        // Define where to access the tip.
48
+        defined( 'WL_TODAYS_TIP_JSON_URL' ) || define( 'WL_TODAYS_TIP_JSON_URL', 'https://wordlift.io/blog' );
49
+        defined( 'WL_TODAYS_TIP_JSON_URL_IT' ) || define( 'WL_TODAYS_TIP_JSON_URL_IT', '/it/wp-json/wp/v2/posts?context=embed&per_page=1&categories=27' );
50
+        defined( 'WL_TODAYS_TIP_JSON_URL_EN' ) || define( 'WL_TODAYS_TIP_JSON_URL_EN', '/en/wp-json/wp/v2/posts?context=embed&per_page=1&categories=38' );
51
+
52
+        $this->search_rankings_service = $search_rankings_service;
53
+        $this->dashboard_service       = $dashboard_service;
54
+        $this->entity_service          = $entity_service;
55
+
56
+    }
57
+
58
+    /**
59
+     * Set up the dashboard metabox.
60
+     *
61
+     * @since 3.20.0
62
+     */
63
+    public function dashboard_setup() {
64
+
65
+        wp_add_dashboard_widget(
66
+            'wl-dashboard-v2',
67
+            __( 'WordLift Dashboard', 'wordlift' ),
68
+            array( $this, 'dashboard_setup_callback' )
69
+        );
70
+
71
+    }
72
+
73
+    /**
74
+     * The dashboard setup callback.
75
+     *
76
+     * @since 3.20.0
77
+     */
78
+    public function dashboard_setup_callback() {
79
+
80
+        // Get the average position.
81
+        $average_position_string = $this->get_average_position();
82
+
83
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/wordlift-admin-dashboard-v2.php';
84
+
85
+    }
86
+
87
+    /**
88
+     * Get the keyword average position.
89
+     *
90
+     * @return string The formatted average position string (or `n/a` if not available).
91
+     * @since 3.20.0
92
+     *
93
+     */
94
+    private function get_average_position() {
95
+
96
+        // Get the cache value.
97
+        $average_position = get_transient( self::AVERAGE_POSITION );
98
+
99
+        // If there's no cached value, load it.
100
+        if ( false === $average_position ) {
101
+            // Get the average position from Search Ranking Service.
102
+            $average_position = @$this->search_rankings_service->get_average_position();
103
+
104
+            // If there was an error return 'n/a'.
105
+            if ( false === $average_position ) {
106
+                return esc_html( _x( 'n/a', 'Dashboard', 'wordlift' ) );
107
+            }
108
+        }
109
+
110
+        // Store the value for one day.
111
+        set_transient( self::AVERAGE_POSITION, $average_position, 86400 ); // One day.
112
+
113
+        // Format the average position with one decimal.
114
+        return number_format( $average_position, 1 );
115
+    }
116
+
117
+    /**
118
+     * Get the top entities.
119
+     *
120
+     * @return array|object|null An array of top entities.
121
+     * @since 3.20.0
122
+     *
123
+     */
124
+    private function get_top_entities() {
125
+
126
+        // Get the cached results.
127
+        $results = get_transient( '_wl_admin_dashboard_v2__top_entities' );
128
+        if ( false !== $results ) {
129
+            return $results;
130
+        }
131
+
132
+        global $wpdb;
133
+
134
+        $query = <<<EOF
135 135
 select p.ID
136 136
      , p.post_title
137 137
      , coalesce(sum(case when obj_t.slug is null then 1 end), 0)     entities
@@ -161,26 +161,26 @@  discard block
 block discarded – undo
161 161
 limit 100;
162 162
 EOF;
163 163
 
164
-		$results = $wpdb->get_results( $query );
165
-		set_transient( '_wl_admin_dashboard_v2__top_entities', $results, 900 );
164
+        $results = $wpdb->get_results( $query );
165
+        set_transient( '_wl_admin_dashboard_v2__top_entities', $results, 900 );
166 166
 
167
-		return $results;
168
-	}
167
+        return $results;
168
+    }
169 169
 
170
-	/**
171
-	 * Get the today's tip block.
172
-	 *
173
-	 * @since 3.20.0
174
-	 */
175
-	public static function get_todays_tip_block() {
170
+    /**
171
+     * Get the today's tip block.
172
+     *
173
+     * @since 3.20.0
174
+     */
175
+    public static function get_todays_tip_block() {
176 176
 
177
-		$data = @self::get_todays_tip_data();
177
+        $data = @self::get_todays_tip_data();
178 178
 
179
-		// Unable to get data from the local cache, nor from the remote URL.
180
-		if ( false === $data ) {
181
-			return;
182
-		}
183
-		?>
179
+        // Unable to get data from the local cache, nor from the remote URL.
180
+        if ( false === $data ) {
181
+            return;
182
+        }
183
+        ?>
184 184
 
185 185
         <div id="wl-todays-tip" class="wl-dashboard__block wl-dashboard__block--todays-tip">
186 186
             <header>
@@ -195,53 +195,53 @@  discard block
 block discarded – undo
195 195
         </div>
196 196
 		<?php
197 197
 
198
-	}
199
-
200
-	/**
201
-	 * Get the today's tip data.
202
-	 *
203
-	 * @return array|false The today's tip data or false in case of error.
204
-	 * @since 3.20.0
205
-	 *
206
-	 */
207
-	private static function get_todays_tip_data() {
208
-
209
-		// Return the transient.
210
-		if ( false !== get_transient( self::TODAYS_TIP ) ) {
211
-			return get_transient( self::TODAYS_TIP );
212
-		}
213
-
214
-		// If the transient isn't available, query the remote web site.
215
-		$url = WL_TODAYS_TIP_JSON_URL
216
-		       . ( 'it' === get_bloginfo( 'language' ) ? WL_TODAYS_TIP_JSON_URL_IT : WL_TODAYS_TIP_JSON_URL_EN );
217
-
218
-		$response = wp_remote_get( $url );
219
-
220
-		if ( is_wp_error( $response )
221
-		     || ! isset( $response['response']['code'] )
222
-		     || 2 !== (int) $response['response']['code'] / 100 ) {
223
-			return false;
224
-		}
225
-
226
-		$json = json_decode( $response['body'], true );
227
-
228
-		if ( empty( $json )
229
-		     || ! isset( $json[0]['title']['rendered'] )
230
-		     || ! isset( $json[0]['excerpt']['rendered'] )
231
-		     || ! isset( $json[0]['link'] ) ) {
232
-			return false;
233
-		}
234
-
235
-		$value = array(
236
-			'title'   => $json[0]['title']['rendered'],
237
-			'excerpt' => '<!-- cached -->' . $json[0]['excerpt']['rendered'],
238
-			'link'    => $json[0]['link'],
239
-		);
240
-
241
-		// Store the results for one day.
242
-		set_transient( self::TODAYS_TIP, $value, 86400 );
243
-
244
-		return $value;
245
-	}
198
+    }
199
+
200
+    /**
201
+     * Get the today's tip data.
202
+     *
203
+     * @return array|false The today's tip data or false in case of error.
204
+     * @since 3.20.0
205
+     *
206
+     */
207
+    private static function get_todays_tip_data() {
208
+
209
+        // Return the transient.
210
+        if ( false !== get_transient( self::TODAYS_TIP ) ) {
211
+            return get_transient( self::TODAYS_TIP );
212
+        }
213
+
214
+        // If the transient isn't available, query the remote web site.
215
+        $url = WL_TODAYS_TIP_JSON_URL
216
+                . ( 'it' === get_bloginfo( 'language' ) ? WL_TODAYS_TIP_JSON_URL_IT : WL_TODAYS_TIP_JSON_URL_EN );
217
+
218
+        $response = wp_remote_get( $url );
219
+
220
+        if ( is_wp_error( $response )
221
+             || ! isset( $response['response']['code'] )
222
+             || 2 !== (int) $response['response']['code'] / 100 ) {
223
+            return false;
224
+        }
225
+
226
+        $json = json_decode( $response['body'], true );
227
+
228
+        if ( empty( $json )
229
+             || ! isset( $json[0]['title']['rendered'] )
230
+             || ! isset( $json[0]['excerpt']['rendered'] )
231
+             || ! isset( $json[0]['link'] ) ) {
232
+            return false;
233
+        }
234
+
235
+        $value = array(
236
+            'title'   => $json[0]['title']['rendered'],
237
+            'excerpt' => '<!-- cached -->' . $json[0]['excerpt']['rendered'],
238
+            'link'    => $json[0]['link'],
239
+        );
240
+
241
+        // Store the results for one day.
242
+        set_transient( self::TODAYS_TIP, $value, 86400 );
243
+
244
+        return $value;
245
+    }
246 246
 
247 247
 }
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
 	 * @since 3.20.0
41 41
 	 *
42 42
 	 */
43
-	public function __construct( $search_rankings_service, $dashboard_service, $entity_service ) {
43
+	public function __construct($search_rankings_service, $dashboard_service, $entity_service) {
44 44
 
45
-		add_action( 'wp_dashboard_setup', array( $this, 'dashboard_setup' ) );
45
+		add_action('wp_dashboard_setup', array($this, 'dashboard_setup'));
46 46
 
47 47
 		// Define where to access the tip.
48
-		defined( 'WL_TODAYS_TIP_JSON_URL' ) || define( 'WL_TODAYS_TIP_JSON_URL', 'https://wordlift.io/blog' );
49
-		defined( 'WL_TODAYS_TIP_JSON_URL_IT' ) || define( 'WL_TODAYS_TIP_JSON_URL_IT', '/it/wp-json/wp/v2/posts?context=embed&per_page=1&categories=27' );
50
-		defined( 'WL_TODAYS_TIP_JSON_URL_EN' ) || define( 'WL_TODAYS_TIP_JSON_URL_EN', '/en/wp-json/wp/v2/posts?context=embed&per_page=1&categories=38' );
48
+		defined('WL_TODAYS_TIP_JSON_URL') || define('WL_TODAYS_TIP_JSON_URL', 'https://wordlift.io/blog');
49
+		defined('WL_TODAYS_TIP_JSON_URL_IT') || define('WL_TODAYS_TIP_JSON_URL_IT', '/it/wp-json/wp/v2/posts?context=embed&per_page=1&categories=27');
50
+		defined('WL_TODAYS_TIP_JSON_URL_EN') || define('WL_TODAYS_TIP_JSON_URL_EN', '/en/wp-json/wp/v2/posts?context=embed&per_page=1&categories=38');
51 51
 
52 52
 		$this->search_rankings_service = $search_rankings_service;
53 53
 		$this->dashboard_service       = $dashboard_service;
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
 
65 65
 		wp_add_dashboard_widget(
66 66
 			'wl-dashboard-v2',
67
-			__( 'WordLift Dashboard', 'wordlift' ),
68
-			array( $this, 'dashboard_setup_callback' )
67
+			__('WordLift Dashboard', 'wordlift'),
68
+			array($this, 'dashboard_setup_callback')
69 69
 		);
70 70
 
71 71
 	}
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		// Get the average position.
81 81
 		$average_position_string = $this->get_average_position();
82 82
 
83
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/wordlift-admin-dashboard-v2.php';
83
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/partials/wordlift-admin-dashboard-v2.php';
84 84
 
85 85
 	}
86 86
 
@@ -94,24 +94,24 @@  discard block
 block discarded – undo
94 94
 	private function get_average_position() {
95 95
 
96 96
 		// Get the cache value.
97
-		$average_position = get_transient( self::AVERAGE_POSITION );
97
+		$average_position = get_transient(self::AVERAGE_POSITION);
98 98
 
99 99
 		// If there's no cached value, load it.
100
-		if ( false === $average_position ) {
100
+		if (false === $average_position) {
101 101
 			// Get the average position from Search Ranking Service.
102 102
 			$average_position = @$this->search_rankings_service->get_average_position();
103 103
 
104 104
 			// If there was an error return 'n/a'.
105
-			if ( false === $average_position ) {
106
-				return esc_html( _x( 'n/a', 'Dashboard', 'wordlift' ) );
105
+			if (false === $average_position) {
106
+				return esc_html(_x('n/a', 'Dashboard', 'wordlift'));
107 107
 			}
108 108
 		}
109 109
 
110 110
 		// Store the value for one day.
111
-		set_transient( self::AVERAGE_POSITION, $average_position, 86400 ); // One day.
111
+		set_transient(self::AVERAGE_POSITION, $average_position, 86400); // One day.
112 112
 
113 113
 		// Format the average position with one decimal.
114
-		return number_format( $average_position, 1 );
114
+		return number_format($average_position, 1);
115 115
 	}
116 116
 
117 117
 	/**
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 	private function get_top_entities() {
125 125
 
126 126
 		// Get the cached results.
127
-		$results = get_transient( '_wl_admin_dashboard_v2__top_entities' );
128
-		if ( false !== $results ) {
127
+		$results = get_transient('_wl_admin_dashboard_v2__top_entities');
128
+		if (false !== $results) {
129 129
 			return $results;
130 130
 		}
131 131
 
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 limit 100;
162 162
 EOF;
163 163
 
164
-		$results = $wpdb->get_results( $query );
165
-		set_transient( '_wl_admin_dashboard_v2__top_entities', $results, 900 );
164
+		$results = $wpdb->get_results($query);
165
+		set_transient('_wl_admin_dashboard_v2__top_entities', $results, 900);
166 166
 
167 167
 		return $results;
168 168
 	}
@@ -177,20 +177,20 @@  discard block
 block discarded – undo
177 177
 		$data = @self::get_todays_tip_data();
178 178
 
179 179
 		// Unable to get data from the local cache, nor from the remote URL.
180
-		if ( false === $data ) {
180
+		if (false === $data) {
181 181
 			return;
182 182
 		}
183 183
 		?>
184 184
 
185 185
         <div id="wl-todays-tip" class="wl-dashboard__block wl-dashboard__block--todays-tip">
186 186
             <header>
187
-                <h3><?php echo __( "Today's Tip", 'wordlift' ); ?></h3>
187
+                <h3><?php echo __("Today's Tip", 'wordlift'); ?></h3>
188 188
             </header>
189 189
             <article>
190
-                <p><strong><?php echo esc_html( wp_strip_all_tags( $data['title'] ) ); ?></strong>
191
-					<?php echo esc_html( wp_strip_all_tags( $data['excerpt'] ) ); ?>
190
+                <p><strong><?php echo esc_html(wp_strip_all_tags($data['title'])); ?></strong>
191
+					<?php echo esc_html(wp_strip_all_tags($data['excerpt'])); ?>
192 192
                     <a target="_blank"
193
-                       href="<?php echo esc_attr( $data['link'] ); ?>"><?php echo esc_html( __( 'Read more', 'wordlift' ) ); ?></a>
193
+                       href="<?php echo esc_attr($data['link']); ?>"><?php echo esc_html(__('Read more', 'wordlift')); ?></a>
194 194
                 </p>
195 195
         </div>
196 196
 		<?php
@@ -207,39 +207,39 @@  discard block
 block discarded – undo
207 207
 	private static function get_todays_tip_data() {
208 208
 
209 209
 		// Return the transient.
210
-		if ( false !== get_transient( self::TODAYS_TIP ) ) {
211
-			return get_transient( self::TODAYS_TIP );
210
+		if (false !== get_transient(self::TODAYS_TIP)) {
211
+			return get_transient(self::TODAYS_TIP);
212 212
 		}
213 213
 
214 214
 		// If the transient isn't available, query the remote web site.
215 215
 		$url = WL_TODAYS_TIP_JSON_URL
216
-		       . ( 'it' === get_bloginfo( 'language' ) ? WL_TODAYS_TIP_JSON_URL_IT : WL_TODAYS_TIP_JSON_URL_EN );
216
+		       . ('it' === get_bloginfo('language') ? WL_TODAYS_TIP_JSON_URL_IT : WL_TODAYS_TIP_JSON_URL_EN);
217 217
 
218
-		$response = wp_remote_get( $url );
218
+		$response = wp_remote_get($url);
219 219
 
220
-		if ( is_wp_error( $response )
221
-		     || ! isset( $response['response']['code'] )
222
-		     || 2 !== (int) $response['response']['code'] / 100 ) {
220
+		if (is_wp_error($response)
221
+		     || ! isset($response['response']['code'])
222
+		     || 2 !== (int) $response['response']['code'] / 100) {
223 223
 			return false;
224 224
 		}
225 225
 
226
-		$json = json_decode( $response['body'], true );
226
+		$json = json_decode($response['body'], true);
227 227
 
228
-		if ( empty( $json )
229
-		     || ! isset( $json[0]['title']['rendered'] )
230
-		     || ! isset( $json[0]['excerpt']['rendered'] )
231
-		     || ! isset( $json[0]['link'] ) ) {
228
+		if (empty($json)
229
+		     || ! isset($json[0]['title']['rendered'])
230
+		     || ! isset($json[0]['excerpt']['rendered'])
231
+		     || ! isset($json[0]['link'])) {
232 232
 			return false;
233 233
 		}
234 234
 
235 235
 		$value = array(
236 236
 			'title'   => $json[0]['title']['rendered'],
237
-			'excerpt' => '<!-- cached -->' . $json[0]['excerpt']['rendered'],
237
+			'excerpt' => '<!-- cached -->'.$json[0]['excerpt']['rendered'],
238 238
 			'link'    => $json[0]['link'],
239 239
 		);
240 240
 
241 241
 		// Store the results for one day.
242
-		set_transient( self::TODAYS_TIP, $value, 86400 );
242
+		set_transient(self::TODAYS_TIP, $value, 86400);
243 243
 
244 244
 		return $value;
245 245
 	}
Please login to merge, or discard this patch.
src/install/class-wordlift-install-service.php 2 patches
Indentation   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -18,158 +18,158 @@
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Install_Service {
20 20
 
21
-	/**
22
-	 * A {@link Wordlift_Log_Service} instance.
23
-	 *
24
-	 * @since  3.18.0
25
-	 * @access private
26
-	 * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
27
-	 */
28
-	private $log;
29
-
30
-	/**
31
-	 * The singleton instance.
32
-	 *
33
-	 * @since  3.18.0
34
-	 * @access private
35
-	 * @var \Wordlift_Install_Service $instance A {@link Wordlift_Install_Service} instance.
36
-	 */
37
-	private static $instance;
38
-
39
-	/**
40
-	 * @var array
41
-	 */
42
-	private $installs;
43
-
44
-	/**
45
-	 * Wordlift_Install_Service constructor.
46
-	 *
47
-	 * @since 3.18.0
48
-	 */
49
-	public function __construct() {
50
-
51
-		/** Installs. */
52
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install.php';
53
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-1-0-0.php';
54
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-10-0.php';
55
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-12-0.php';
56
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-14-0.php';
57
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-15-0.php';
58
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-0.php';
59
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-3.php';
60
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-19-5.php';
61
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-20-0.php';
62
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-23-4.php';
63
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-24-2.php';
64
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-all-entity-types.php';
65
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-package-type.php';
66
-
67
-		// Get the install services.
68
-		$this->installs = array(
69
-			new Wordlift_Install_1_0_0(),
70
-			new Wordlift_Install_3_10_0(),
71
-			new Wordlift_Install_3_12_0(),
72
-			new Wordlift_Install_3_14_0(),
73
-			new Wordlift_Install_3_15_0(),
74
-			new Wordlift_Install_3_18_0(),
75
-			new Wordlift_Install_3_18_3(),
76
-			new Wordlift_Install_3_19_5(),
77
-			new Wordlift_Install_3_20_0(),
78
-			/*
21
+    /**
22
+     * A {@link Wordlift_Log_Service} instance.
23
+     *
24
+     * @since  3.18.0
25
+     * @access private
26
+     * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
27
+     */
28
+    private $log;
29
+
30
+    /**
31
+     * The singleton instance.
32
+     *
33
+     * @since  3.18.0
34
+     * @access private
35
+     * @var \Wordlift_Install_Service $instance A {@link Wordlift_Install_Service} instance.
36
+     */
37
+    private static $instance;
38
+
39
+    /**
40
+     * @var array
41
+     */
42
+    private $installs;
43
+
44
+    /**
45
+     * Wordlift_Install_Service constructor.
46
+     *
47
+     * @since 3.18.0
48
+     */
49
+    public function __construct() {
50
+
51
+        /** Installs. */
52
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install.php';
53
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-1-0-0.php';
54
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-10-0.php';
55
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-12-0.php';
56
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-14-0.php';
57
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-15-0.php';
58
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-0.php';
59
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-3.php';
60
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-19-5.php';
61
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-20-0.php';
62
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-23-4.php';
63
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-24-2.php';
64
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-all-entity-types.php';
65
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-package-type.php';
66
+
67
+        // Get the install services.
68
+        $this->installs = array(
69
+            new Wordlift_Install_1_0_0(),
70
+            new Wordlift_Install_3_10_0(),
71
+            new Wordlift_Install_3_12_0(),
72
+            new Wordlift_Install_3_14_0(),
73
+            new Wordlift_Install_3_15_0(),
74
+            new Wordlift_Install_3_18_0(),
75
+            new Wordlift_Install_3_18_3(),
76
+            new Wordlift_Install_3_19_5(),
77
+            new Wordlift_Install_3_20_0(),
78
+            /*
79 79
 			 * This should be enabled with #852.
80 80
 			 */
81
-			// new Wordlift_Install_All_Entity_Types(),
82
-			new Wordlift_Install_Package_Type(),
83
-			new Wordlift_Install_3_23_4(),
84
-			new Wordlift_Install_3_24_2(),
85
-		);
81
+            // new Wordlift_Install_All_Entity_Types(),
82
+            new Wordlift_Install_Package_Type(),
83
+            new Wordlift_Install_3_23_4(),
84
+            new Wordlift_Install_3_24_2(),
85
+        );
86 86
 
87
-		self::$instance = $this;
87
+        self::$instance = $this;
88 88
 
89
-		$this->log = Wordlift_Log_Service::get_logger( get_class() );
89
+        $this->log = Wordlift_Log_Service::get_logger( get_class() );
90 90
 
91
-		add_action( 'init', array( $this, 'install' ) );
91
+        add_action( 'init', array( $this, 'install' ) );
92 92
 
93
-	}
93
+    }
94 94
 
95
-	/**
96
-	 * Get the singleton instance.
97
-	 *
98
-	 * @since 3.18.0
99
-	 */
100
-	public static function get_instance() {
95
+    /**
96
+     * Get the singleton instance.
97
+     *
98
+     * @since 3.18.0
99
+     */
100
+    public static function get_instance() {
101 101
 
102
-		return self::$instance;
103
-	}
102
+        return self::$instance;
103
+    }
104 104
 
105
-	/**
106
-	 * Loop thought all versions and install the updates.
107
-	 *
108
-	 * @return void
109
-	 * @since 3.18.0
110
-	 *
111
-	 * @since 3.20.0 use a transient to avoid concurrent installation calls.
112
-	 */
113
-	public function install() {
105
+    /**
106
+     * Loop thought all versions and install the updates.
107
+     *
108
+     * @return void
109
+     * @since 3.18.0
110
+     *
111
+     * @since 3.20.0 use a transient to avoid concurrent installation calls.
112
+     */
113
+    public function install() {
114 114
 
115
-		$version = null;
115
+        $version = null;
116 116
 
117
-		if ( $this->install_required() && false === get_transient( '_wl_installing' ) ) {
118
-			set_transient( '_wl_installing', true, 5 * MINUTE_IN_SECONDS );
117
+        if ( $this->install_required() && false === get_transient( '_wl_installing' ) ) {
118
+            set_transient( '_wl_installing', true, 5 * MINUTE_IN_SECONDS );
119 119
 
120
-			/** @var Wordlift_Install $install */
121
-			foreach ( $this->installs as $install ) {
122
-				// Get the install version.
123
-				$version = $install->get_version();
120
+            /** @var Wordlift_Install $install */
121
+            foreach ( $this->installs as $install ) {
122
+                // Get the install version.
123
+                $version = $install->get_version();
124 124
 
125
-				if ( version_compare( $version, $this->get_current_version(), '>' )
126
-				     || $install->must_install() ) {
125
+                if ( version_compare( $version, $this->get_current_version(), '>' )
126
+                     || $install->must_install() ) {
127 127
 
128
-					$class_name = get_class( $install );
128
+                    $class_name = get_class( $install );
129 129
 
130
-					$this->log->info( "Current version is {$this->get_current_version()}, installing $class_name..." );
130
+                    $this->log->info( "Current version is {$this->get_current_version()}, installing $class_name..." );
131 131
 
132
-					// Install version.
133
-					$install->install();
132
+                    // Install version.
133
+                    $install->install();
134 134
 
135
-					$this->log->info( "$class_name installed." );
135
+                    $this->log->info( "$class_name installed." );
136 136
 
137
-					// Bump the version.
138
-					update_option( 'wl_db_version', $version );
139
-				}
137
+                    // Bump the version.
138
+                    update_option( 'wl_db_version', $version );
139
+                }
140 140
 
141
-			}
141
+            }
142 142
 
143
-			@delete_transient( '_wl_installing' );
143
+            @delete_transient( '_wl_installing' );
144 144
 
145
-		}
145
+        }
146 146
 
147
-	}
147
+    }
148 148
 
149
-	private function install_required() {
149
+    private function install_required() {
150 150
 
151
-		/** @var Wordlift_Install $install */
152
-		foreach ( $this->installs as $install ) {
153
-			// Get the install version.
154
-			$version = $install->get_version();
151
+        /** @var Wordlift_Install $install */
152
+        foreach ( $this->installs as $install ) {
153
+            // Get the install version.
154
+            $version = $install->get_version();
155 155
 
156
-			if ( version_compare( $version, $this->get_current_version(), '>' )
157
-			     || $install->must_install() ) {
158
-				return true;
159
-			}
156
+            if ( version_compare( $version, $this->get_current_version(), '>' )
157
+                 || $install->must_install() ) {
158
+                return true;
159
+            }
160 160
 
161
-		}
161
+        }
162 162
 
163
-		return false;
164
-	}
163
+        return false;
164
+    }
165 165
 
166
-	/**
167
-	 * Retrieve the current db version.
168
-	 *
169
-	 * @return type
170
-	 */
171
-	private function get_current_version() {
172
-		return get_option( 'wl_db_version', '0.0.0' );
173
-	}
166
+    /**
167
+     * Retrieve the current db version.
168
+     *
169
+     * @return type
170
+     */
171
+    private function get_current_version() {
172
+        return get_option( 'wl_db_version', '0.0.0' );
173
+    }
174 174
 
175 175
 }
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -49,20 +49,20 @@  discard block
 block discarded – undo
49 49
 	public function __construct() {
50 50
 
51 51
 		/** Installs. */
52
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install.php';
53
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-1-0-0.php';
54
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-10-0.php';
55
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-12-0.php';
56
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-14-0.php';
57
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-15-0.php';
58
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-0.php';
59
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-3.php';
60
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-19-5.php';
61
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-20-0.php';
62
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-23-4.php';
63
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-24-2.php';
64
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-all-entity-types.php';
65
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-package-type.php';
52
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install.php';
53
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-1-0-0.php';
54
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-10-0.php';
55
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-12-0.php';
56
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-14-0.php';
57
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-15-0.php';
58
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-18-0.php';
59
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-18-3.php';
60
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-19-5.php';
61
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-20-0.php';
62
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-23-4.php';
63
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-24-2.php';
64
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-all-entity-types.php';
65
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-package-type.php';
66 66
 
67 67
 		// Get the install services.
68 68
 		$this->installs = array(
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 
87 87
 		self::$instance = $this;
88 88
 
89
-		$this->log = Wordlift_Log_Service::get_logger( get_class() );
89
+		$this->log = Wordlift_Log_Service::get_logger(get_class());
90 90
 
91
-		add_action( 'init', array( $this, 'install' ) );
91
+		add_action('init', array($this, 'install'));
92 92
 
93 93
 	}
94 94
 
@@ -114,33 +114,33 @@  discard block
 block discarded – undo
114 114
 
115 115
 		$version = null;
116 116
 
117
-		if ( $this->install_required() && false === get_transient( '_wl_installing' ) ) {
118
-			set_transient( '_wl_installing', true, 5 * MINUTE_IN_SECONDS );
117
+		if ($this->install_required() && false === get_transient('_wl_installing')) {
118
+			set_transient('_wl_installing', true, 5 * MINUTE_IN_SECONDS);
119 119
 
120 120
 			/** @var Wordlift_Install $install */
121
-			foreach ( $this->installs as $install ) {
121
+			foreach ($this->installs as $install) {
122 122
 				// Get the install version.
123 123
 				$version = $install->get_version();
124 124
 
125
-				if ( version_compare( $version, $this->get_current_version(), '>' )
126
-				     || $install->must_install() ) {
125
+				if (version_compare($version, $this->get_current_version(), '>')
126
+				     || $install->must_install()) {
127 127
 
128
-					$class_name = get_class( $install );
128
+					$class_name = get_class($install);
129 129
 
130
-					$this->log->info( "Current version is {$this->get_current_version()}, installing $class_name..." );
130
+					$this->log->info("Current version is {$this->get_current_version()}, installing $class_name...");
131 131
 
132 132
 					// Install version.
133 133
 					$install->install();
134 134
 
135
-					$this->log->info( "$class_name installed." );
135
+					$this->log->info("$class_name installed.");
136 136
 
137 137
 					// Bump the version.
138
-					update_option( 'wl_db_version', $version );
138
+					update_option('wl_db_version', $version);
139 139
 				}
140 140
 
141 141
 			}
142 142
 
143
-			@delete_transient( '_wl_installing' );
143
+			@delete_transient('_wl_installing');
144 144
 
145 145
 		}
146 146
 
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
 	private function install_required() {
150 150
 
151 151
 		/** @var Wordlift_Install $install */
152
-		foreach ( $this->installs as $install ) {
152
+		foreach ($this->installs as $install) {
153 153
 			// Get the install version.
154 154
 			$version = $install->get_version();
155 155
 
156
-			if ( version_compare( $version, $this->get_current_version(), '>' )
157
-			     || $install->must_install() ) {
156
+			if (version_compare($version, $this->get_current_version(), '>')
157
+			     || $install->must_install()) {
158 158
 				return true;
159 159
 			}
160 160
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 * @return type
170 170
 	 */
171 171
 	private function get_current_version() {
172
-		return get_option( 'wl_db_version', '0.0.0' );
172
+		return get_option('wl_db_version', '0.0.0');
173 173
 	}
174 174
 
175 175
 }
Please login to merge, or discard this patch.
src/wordlift/autocomplete/class-local-autocomplete-service.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -15,55 +15,55 @@
 block discarded – undo
15 15
 
16 16
 class Local_Autocomplete_Service extends Abstract_Autocomplete_Service {
17 17
 
18
-	/**
19
-	 * @inheritDoc
20
-	 */
21
-	public function query( $query, $scope, $excludes ) {
22
-		global $wpdb;
18
+    /**
19
+     * @inheritDoc
20
+     */
21
+    public function query( $query, $scope, $excludes ) {
22
+        global $wpdb;
23 23
 
24
-		$posts = $wpdb->get_results( $wpdb->prepare(
25
-			"SELECT * FROM {$wpdb->posts} p"
26
-			. " INNER JOIN {$wpdb->term_relationships} tr"
27
-			. "  ON tr.object_id = p.ID"
28
-			. " INNER JOIN {$wpdb->term_taxonomy} tt"
29
-			. "  ON tt.taxonomy = %s AND tt.term_taxonomy_id = tr.term_taxonomy_id"
30
-			. " INNER JOIN {$wpdb->terms} t"
31
-			. "  ON t.term_id = tt.term_id AND t.name != %s"
32
-			. " LEFT OUTER JOIN {$wpdb->postmeta} pm"
33
-			. "  ON pm.meta_key = %s AND pm.post_id = p.ID"
34
-			. " WHERE p.post_type IN ( '" . implode( "', '", array_map( 'esc_sql', Wordlift_Entity_Service::valid_entity_post_types() ) ) . "' )"
35
-			. "  AND ( p.post_title LIKE %s OR pm.meta_value LIKE %s )"
36
-			. " LIMIT %d",
37
-			Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
38
-			'article',
39
-			Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY,
40
-			// `prepare` doesn't support argument number, hence we must repeat the query.
41
-			'%' . $wpdb->esc_like( $query ) . '%',
42
-			'%' . $wpdb->esc_like( $query ) . '%',
43
-			50
44
-		) );
24
+        $posts = $wpdb->get_results( $wpdb->prepare(
25
+            "SELECT * FROM {$wpdb->posts} p"
26
+            . " INNER JOIN {$wpdb->term_relationships} tr"
27
+            . "  ON tr.object_id = p.ID"
28
+            . " INNER JOIN {$wpdb->term_taxonomy} tt"
29
+            . "  ON tt.taxonomy = %s AND tt.term_taxonomy_id = tr.term_taxonomy_id"
30
+            . " INNER JOIN {$wpdb->terms} t"
31
+            . "  ON t.term_id = tt.term_id AND t.name != %s"
32
+            . " LEFT OUTER JOIN {$wpdb->postmeta} pm"
33
+            . "  ON pm.meta_key = %s AND pm.post_id = p.ID"
34
+            . " WHERE p.post_type IN ( '" . implode( "', '", array_map( 'esc_sql', Wordlift_Entity_Service::valid_entity_post_types() ) ) . "' )"
35
+            . "  AND ( p.post_title LIKE %s OR pm.meta_value LIKE %s )"
36
+            . " LIMIT %d",
37
+            Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
38
+            'article',
39
+            Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY,
40
+            // `prepare` doesn't support argument number, hence we must repeat the query.
41
+            '%' . $wpdb->esc_like( $query ) . '%',
42
+            '%' . $wpdb->esc_like( $query ) . '%',
43
+            50
44
+        ) );
45 45
 
46
-		$results = array_map( function ( $item ) {
46
+        $results = array_map( function ( $item ) {
47 47
 
48
-			$entity_service = Wordlift_Entity_Service::get_instance();
49
-			$uri            = $entity_service->get_uri( $item->ID );
48
+            $entity_service = Wordlift_Entity_Service::get_instance();
49
+            $uri            = $entity_service->get_uri( $item->ID );
50 50
 
51
-			return array(
52
-				'id'           => $uri,
53
-				'label'        => array( $item->post_title ),
54
-				'labels'       => $entity_service->get_alternative_labels( $item->ID ),
55
-				'descriptions' => array( Wordlift_Post_Excerpt_Helper::get_text_excerpt( $item ) ),
56
-				'scope'        => 'local',
57
-				'sameAss'      => get_post_meta( $item->ID, \Wordlift_Schema_Service::FIELD_SAME_AS ),
58
-				// The following properties are less relevant because we're linking entities that exist already in the
59
-				// vocabulary. That's why we don't make an effort to load the real data.
60
-				'types'        => array( 'http://schema.org/Thing' ),
61
-				'urls'         => array(),
62
-				'images'       => array(),
63
-			);
64
-		}, $posts );
51
+            return array(
52
+                'id'           => $uri,
53
+                'label'        => array( $item->post_title ),
54
+                'labels'       => $entity_service->get_alternative_labels( $item->ID ),
55
+                'descriptions' => array( Wordlift_Post_Excerpt_Helper::get_text_excerpt( $item ) ),
56
+                'scope'        => 'local',
57
+                'sameAss'      => get_post_meta( $item->ID, \Wordlift_Schema_Service::FIELD_SAME_AS ),
58
+                // The following properties are less relevant because we're linking entities that exist already in the
59
+                // vocabulary. That's why we don't make an effort to load the real data.
60
+                'types'        => array( 'http://schema.org/Thing' ),
61
+                'urls'         => array(),
62
+                'images'       => array(),
63
+            );
64
+        }, $posts );
65 65
 
66
-		return $this->filter( $results, $excludes );
67
-	}
66
+        return $this->filter( $results, $excludes );
67
+    }
68 68
 
69 69
 }
70 70
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 	/**
19 19
 	 * @inheritDoc
20 20
 	 */
21
-	public function query( $query, $scope, $excludes ) {
21
+	public function query($query, $scope, $excludes) {
22 22
 		global $wpdb;
23 23
 
24
-		$posts = $wpdb->get_results( $wpdb->prepare(
24
+		$posts = $wpdb->get_results($wpdb->prepare(
25 25
 			"SELECT * FROM {$wpdb->posts} p"
26 26
 			. " INNER JOIN {$wpdb->term_relationships} tr"
27 27
 			. "  ON tr.object_id = p.ID"
@@ -31,39 +31,39 @@  discard block
 block discarded – undo
31 31
 			. "  ON t.term_id = tt.term_id AND t.name != %s"
32 32
 			. " LEFT OUTER JOIN {$wpdb->postmeta} pm"
33 33
 			. "  ON pm.meta_key = %s AND pm.post_id = p.ID"
34
-			. " WHERE p.post_type IN ( '" . implode( "', '", array_map( 'esc_sql', Wordlift_Entity_Service::valid_entity_post_types() ) ) . "' )"
34
+			. " WHERE p.post_type IN ( '".implode("', '", array_map('esc_sql', Wordlift_Entity_Service::valid_entity_post_types()))."' )"
35 35
 			. "  AND ( p.post_title LIKE %s OR pm.meta_value LIKE %s )"
36 36
 			. " LIMIT %d",
37 37
 			Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
38 38
 			'article',
39 39
 			Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY,
40 40
 			// `prepare` doesn't support argument number, hence we must repeat the query.
41
-			'%' . $wpdb->esc_like( $query ) . '%',
42
-			'%' . $wpdb->esc_like( $query ) . '%',
41
+			'%'.$wpdb->esc_like($query).'%',
42
+			'%'.$wpdb->esc_like($query).'%',
43 43
 			50
44
-		) );
44
+		));
45 45
 
46
-		$results = array_map( function ( $item ) {
46
+		$results = array_map(function($item) {
47 47
 
48 48
 			$entity_service = Wordlift_Entity_Service::get_instance();
49
-			$uri            = $entity_service->get_uri( $item->ID );
49
+			$uri            = $entity_service->get_uri($item->ID);
50 50
 
51 51
 			return array(
52 52
 				'id'           => $uri,
53
-				'label'        => array( $item->post_title ),
54
-				'labels'       => $entity_service->get_alternative_labels( $item->ID ),
55
-				'descriptions' => array( Wordlift_Post_Excerpt_Helper::get_text_excerpt( $item ) ),
53
+				'label'        => array($item->post_title),
54
+				'labels'       => $entity_service->get_alternative_labels($item->ID),
55
+				'descriptions' => array(Wordlift_Post_Excerpt_Helper::get_text_excerpt($item)),
56 56
 				'scope'        => 'local',
57
-				'sameAss'      => get_post_meta( $item->ID, \Wordlift_Schema_Service::FIELD_SAME_AS ),
57
+				'sameAss'      => get_post_meta($item->ID, \Wordlift_Schema_Service::FIELD_SAME_AS),
58 58
 				// The following properties are less relevant because we're linking entities that exist already in the
59 59
 				// vocabulary. That's why we don't make an effort to load the real data.
60
-				'types'        => array( 'http://schema.org/Thing' ),
60
+				'types'        => array('http://schema.org/Thing'),
61 61
 				'urls'         => array(),
62 62
 				'images'       => array(),
63 63
 			);
64
-		}, $posts );
64
+		}, $posts);
65 65
 
66
-		return $this->filter( $results, $excludes );
66
+		return $this->filter($results, $excludes);
67 67
 	}
68 68
 
69 69
 }
70 70
\ No newline at end of file
Please login to merge, or discard this patch.
src/includes/class-wordlift.php 1 patch
Indentation   +1654 added lines, -1654 removed lines patch added patch discarded remove patch
@@ -33,1492 +33,1492 @@  discard block
 block discarded – undo
33 33
  */
34 34
 class Wordlift {
35 35
 
36
-	//<editor-fold desc="## FIELDS">
37
-
38
-	/**
39
-	 * The loader that's responsible for maintaining and registering all hooks that power
40
-	 * the plugin.
41
-	 *
42
-	 * @since    1.0.0
43
-	 * @access   protected
44
-	 * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
45
-	 */
46
-	protected $loader;
47
-
48
-	/**
49
-	 * The unique identifier of this plugin.
50
-	 *
51
-	 * @since    1.0.0
52
-	 * @access   protected
53
-	 * @var      string $plugin_name The string used to uniquely identify this plugin.
54
-	 */
55
-	protected $plugin_name;
56
-
57
-	/**
58
-	 * The current version of the plugin.
59
-	 *
60
-	 * @since    1.0.0
61
-	 * @access   protected
62
-	 * @var      string $version The current version of the plugin.
63
-	 */
64
-	protected $version;
65
-
66
-	/**
67
-	 * The {@link Wordlift_Tinymce_Adapter} instance.
68
-	 *
69
-	 * @since  3.12.0
70
-	 * @access protected
71
-	 * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
72
-	 */
73
-	protected $tinymce_adapter;
74
-
75
-	/**
76
-	 * The Thumbnail service.
77
-	 *
78
-	 * @since  3.1.5
79
-	 * @access private
80
-	 * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
81
-	 */
82
-	private $thumbnail_service;
83
-
84
-	/**
85
-	 * The UI service.
86
-	 *
87
-	 * @since  3.2.0
88
-	 * @access private
89
-	 * @var \Wordlift_UI_Service $ui_service The UI service.
90
-	 */
91
-	private $ui_service;
92
-
93
-	/**
94
-	 * The Schema service.
95
-	 *
96
-	 * @since  3.3.0
97
-	 * @access protected
98
-	 * @var \Wordlift_Schema_Service $schema_service The Schema service.
99
-	 */
100
-	protected $schema_service;
101
-
102
-	/**
103
-	 * The Entity service.
104
-	 *
105
-	 * @since  3.1.0
106
-	 * @access protected
107
-	 * @var \Wordlift_Entity_Service $entity_service The Entity service.
108
-	 */
109
-	protected $entity_service;
110
-
111
-	/**
112
-	 * The Topic Taxonomy service.
113
-	 *
114
-	 * @since  3.5.0
115
-	 * @access private
116
-	 * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
117
-	 */
118
-	private $topic_taxonomy_service;
119
-
120
-	/**
121
-	 * The Entity Types Taxonomy service.
122
-	 *
123
-	 * @since  3.18.0
124
-	 * @access private
125
-	 * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service.
126
-	 */
127
-	private $entity_types_taxonomy_service;
128
-
129
-	/**
130
-	 * The User service.
131
-	 *
132
-	 * @since  3.1.7
133
-	 * @access protected
134
-	 * @var \Wordlift_User_Service $user_service The User service.
135
-	 */
136
-	protected $user_service;
137
-
138
-	/**
139
-	 * The Timeline service.
140
-	 *
141
-	 * @since  3.1.0
142
-	 * @access private
143
-	 * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
144
-	 */
145
-	private $timeline_service;
146
-
147
-	/**
148
-	 * The Redirect service.
149
-	 *
150
-	 * @since  3.2.0
151
-	 * @access private
152
-	 * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
153
-	 */
154
-	private $redirect_service;
155
-
156
-	/**
157
-	 * The Notice service.
158
-	 *
159
-	 * @since  3.3.0
160
-	 * @access private
161
-	 * @var \Wordlift_Notice_Service $notice_service The Notice service.
162
-	 */
163
-	private $notice_service;
164
-
165
-	/**
166
-	 * The Entity list customization.
167
-	 *
168
-	 * @since  3.3.0
169
-	 * @access protected
170
-	 * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
171
-	 */
172
-	protected $entity_list_service;
173
-
174
-	/**
175
-	 * The Entity Types Taxonomy Walker.
176
-	 *
177
-	 * @since  3.1.0
178
-	 * @access private
179
-	 * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
180
-	 */
181
-	private $entity_types_taxonomy_walker;
182
-
183
-	/**
184
-	 * The ShareThis service.
185
-	 *
186
-	 * @since  3.2.0
187
-	 * @access private
188
-	 * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
189
-	 */
190
-	private $sharethis_service;
191
-
192
-	/**
193
-	 * The PrimaShop adapter.
194
-	 *
195
-	 * @since  3.2.3
196
-	 * @access private
197
-	 * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
198
-	 */
199
-	private $primashop_adapter;
200
-
201
-	/**
202
-	 * The WordLift Dashboard adapter.
203
-	 *
204
-	 * @since  3.4.0
205
-	 * @access private
206
-	 * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
207
-	 */
208
-	private $dashboard_service;
209
-
210
-	/**
211
-	 * The entity type service.
212
-	 *
213
-	 * @since  3.6.0
214
-	 * @access private
215
-	 * @var \Wordlift_Entity_Post_Type_Service
216
-	 */
217
-	private $entity_post_type_service;
218
-
219
-	/**
220
-	 * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
221
-	 *
222
-	 * @since  3.6.0
223
-	 * @access private
224
-	 * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance.
225
-	 */
226
-	private $entity_link_service;
227
-
228
-	/**
229
-	 * A {@link Wordlift_Sparql_Service} instance.
230
-	 *
231
-	 * @since    3.6.0
232
-	 * @access   protected
233
-	 * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
234
-	 */
235
-	protected $sparql_service;
236
-
237
-	/**
238
-	 * A {@link Wordlift_Import_Service} instance.
239
-	 *
240
-	 * @since  3.6.0
241
-	 * @access private
242
-	 * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
243
-	 */
244
-	private $import_service;
245
-
246
-	/**
247
-	 * A {@link Wordlift_Rebuild_Service} instance.
248
-	 *
249
-	 * @since  3.6.0
250
-	 * @access private
251
-	 * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
252
-	 */
253
-	private $rebuild_service;
254
-
255
-	/**
256
-	 * A {@link Wordlift_Jsonld_Service} instance.
257
-	 *
258
-	 * @since  3.7.0
259
-	 * @access protected
260
-	 * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
261
-	 */
262
-	protected $jsonld_service;
263
-
264
-	/**
265
-	 * A {@link Wordlift_Website_Jsonld_Converter} instance.
266
-	 *
267
-	 * @since  3.14.0
268
-	 * @access protected
269
-	 * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
270
-	 */
271
-	protected $jsonld_website_converter;
272
-
273
-	/**
274
-	 * A {@link Wordlift_Property_Factory} instance.
275
-	 *
276
-	 * @since  3.7.0
277
-	 * @access private
278
-	 * @var \Wordlift_Property_Factory $property_factory
279
-	 */
280
-	private $property_factory;
281
-
282
-	/**
283
-	 * The 'Download Your Data' page.
284
-	 *
285
-	 * @since  3.6.0
286
-	 * @access private
287
-	 * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
288
-	 */
289
-	private $download_your_data_page;
290
-
291
-	/**
292
-	 * The 'WordLift Settings' page.
293
-	 *
294
-	 * @since  3.11.0
295
-	 * @access protected
296
-	 * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
297
-	 */
298
-	protected $settings_page;
299
-
300
-	/**
301
-	 * The 'WordLift Batch analysis' page.
302
-	 *
303
-	 * @since  3.14.0
304
-	 * @access protected
305
-	 * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page.
306
-	 */
307
-	protected $batch_analysis_page;
308
-
309
-	/**
310
-	 * The install wizard page.
311
-	 *
312
-	 * @since  3.9.0
313
-	 * @access private
314
-	 * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
315
-	 */
316
-	private $admin_setup;
317
-
318
-	/**
319
-	 * The Content Filter Service hooks up to the 'the_content' filter and provides
320
-	 * linking of entities to their pages.
321
-	 *
322
-	 * @since  3.8.0
323
-	 * @access private
324
-	 * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
325
-	 */
326
-	private $content_filter_service;
327
-
328
-	/**
329
-	 * A {@link Wordlift_Key_Validation_Service} instance.
330
-	 *
331
-	 * @since  3.9.0
332
-	 * @access private
333
-	 * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
334
-	 */
335
-	private $key_validation_service;
336
-
337
-	/**
338
-	 * A {@link Wordlift_Rating_Service} instance.
339
-	 *
340
-	 * @since  3.10.0
341
-	 * @access private
342
-	 * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
343
-	 */
344
-	private $rating_service;
345
-
346
-	/**
347
-	 * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
348
-	 *
349
-	 * @since  3.10.0
350
-	 * @access protected
351
-	 * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
352
-	 */
353
-	protected $post_to_jsonld_converter;
354
-
355
-	/**
356
-	 * A {@link Wordlift_Configuration_Service} instance.
357
-	 *
358
-	 * @since  3.10.0
359
-	 * @access protected
360
-	 * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
361
-	 */
362
-	protected $configuration_service;
363
-
364
-	/**
365
-	 * A {@link Wordlift_Install_Service} instance.
366
-	 *
367
-	 * @since  3.18.0
368
-	 * @access protected
369
-	 * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance.
370
-	 */
371
-	protected $install_service;
372
-
373
-	/**
374
-	 * A {@link Wordlift_Entity_Type_Service} instance.
375
-	 *
376
-	 * @since  3.10.0
377
-	 * @access protected
378
-	 * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
379
-	 */
380
-	protected $entity_type_service;
381
-
382
-	/**
383
-	 * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
384
-	 *
385
-	 * @since  3.10.0
386
-	 * @access protected
387
-	 * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
388
-	 */
389
-	protected $entity_post_to_jsonld_converter;
390
-
391
-	/**
392
-	 * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
393
-	 *
394
-	 * @since  3.10.0
395
-	 * @access protected
396
-	 * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
397
-	 */
398
-	protected $postid_to_jsonld_converter;
399
-
400
-	/**
401
-	 * The {@link Wordlift_Admin_Status_Page} class.
402
-	 *
403
-	 * @since  3.9.8
404
-	 * @access private
405
-	 * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
406
-	 */
407
-	private $status_page;
408
-
409
-	/**
410
-	 * The {@link Wordlift_Category_Taxonomy_Service} instance.
411
-	 *
412
-	 * @since  3.11.0
413
-	 * @access protected
414
-	 * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
415
-	 */
416
-	protected $category_taxonomy_service;
417
-
418
-	/**
419
-	 * The {@link Wordlift_Entity_Page_Service} instance.
420
-	 *
421
-	 * @since  3.11.0
422
-	 * @access protected
423
-	 * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
424
-	 */
425
-	protected $entity_page_service;
426
-
427
-	/**
428
-	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
429
-	 *
430
-	 * @since  3.11.0
431
-	 * @access protected
432
-	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
433
-	 */
434
-	protected $settings_page_action_link;
435
-
436
-	/**
437
-	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
438
-	 *
439
-	 * @since  3.11.0
440
-	 * @access protected
441
-	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
442
-	 */
443
-	protected $analytics_settings_page_action_link;
444
-
445
-	/**
446
-	 * The {@link Wordlift_Analytics_Connect} class.
447
-	 *
448
-	 * @since  3.11.0
449
-	 * @access protected
450
-	 * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class.
451
-	 */
452
-	protected $analytics_connect;
453
-
454
-	/**
455
-	 * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
456
-	 *
457
-	 * @since  3.11.0
458
-	 * @access protected
459
-	 * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
460
-	 */
461
-	protected $publisher_ajax_adapter;
462
-
463
-	/**
464
-	 * The {@link Wordlift_Admin_Input_Element} element renderer.
465
-	 *
466
-	 * @since  3.11.0
467
-	 * @access protected
468
-	 * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
469
-	 */
470
-	protected $input_element;
471
-
472
-	/**
473
-	 * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
474
-	 *
475
-	 * @since  3.13.0
476
-	 * @access protected
477
-	 * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
478
-	 */
479
-	protected $radio_input_element;
480
-
481
-	/**
482
-	 * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
483
-	 *
484
-	 * @since  3.11.0
485
-	 * @access protected
486
-	 * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
487
-	 */
488
-	protected $language_select_element;
489
-
490
-	/**
491
-	 * The {@link Wordlift_Admin_Country_Select_Element} element renderer.
492
-	 *
493
-	 * @since  3.18.0
494
-	 * @access protected
495
-	 * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer.
496
-	 */
497
-	protected $country_select_element;
498
-
499
-	/**
500
-	 * The {@link Wordlift_Admin_Publisher_Element} element renderer.
501
-	 *
502
-	 * @since  3.11.0
503
-	 * @access protected
504
-	 * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
505
-	 */
506
-	protected $publisher_element;
507
-
508
-	/**
509
-	 * The {@link Wordlift_Admin_Select2_Element} element renderer.
510
-	 *
511
-	 * @since  3.11.0
512
-	 * @access protected
513
-	 * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
514
-	 */
515
-	protected $select2_element;
516
-
517
-	/**
518
-	 * The controller for the entity type list admin page
519
-	 *
520
-	 * @since  3.11.0
521
-	 * @access private
522
-	 * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
523
-	 */
524
-	private $entity_type_admin_page;
525
-
526
-	/**
527
-	 * The controller for the entity type settings admin page
528
-	 *
529
-	 * @since  3.11.0
530
-	 * @access private
531
-	 * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
532
-	 */
533
-	private $entity_type_settings_admin_page;
534
-
535
-	/**
536
-	 * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
537
-	 *
538
-	 * @since  3.11.0
539
-	 * @access protected
540
-	 * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
541
-	 */
542
-	protected $related_entities_cloud_widget;
543
-
544
-	/**
545
-	 * The {@link Wordlift_Admin_Author_Element} instance.
546
-	 *
547
-	 * @since  3.14.0
548
-	 * @access protected
549
-	 * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
550
-	 */
551
-	protected $author_element;
552
-
553
-	/**
554
-	 * The {@link Wordlift_Batch_Analysis_Service} instance.
555
-	 *
556
-	 * @since  3.14.0
557
-	 * @access protected
558
-	 * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance.
559
-	 */
560
-	protected $batch_analysis_service;
561
-
562
-	/**
563
-	 * The {@link Wordlift_Sample_Data_Service} instance.
564
-	 *
565
-	 * @since  3.12.0
566
-	 * @access protected
567
-	 * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
568
-	 */
569
-	protected $sample_data_service;
570
-
571
-	/**
572
-	 * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
573
-	 *
574
-	 * @since  3.12.0
575
-	 * @access protected
576
-	 * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
577
-	 */
578
-	protected $sample_data_ajax_adapter;
579
-
580
-	/**
581
-	 * The {@link Wordlift_Batch_Analysis_Adapter} instance.
582
-	 *
583
-	 * @since  3.14.2
584
-	 * @access protected
585
-	 * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance.
586
-	 */
587
-	private $batch_analysis_adapter;
588
-
589
-	/**
590
-	 * The {@link Wordlift_Relation_Rebuild_Service} instance.
591
-	 *
592
-	 * @since  3.14.3
593
-	 * @access private
594
-	 * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
595
-	 */
596
-	private $relation_rebuild_service;
597
-
598
-	/**
599
-	 * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
600
-	 *
601
-	 * @since  3.14.3
602
-	 * @access private
603
-	 * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
604
-	 */
605
-	private $relation_rebuild_adapter;
606
-
607
-	/**
608
-	 * The {@link Wordlift_Reference_Rebuild_Service} instance.
609
-	 *
610
-	 * @since  3.18.0
611
-	 * @access private
612
-	 * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance.
613
-	 */
614
-	private $reference_rebuild_service;
615
-
616
-	/**
617
-	 * The {@link Wordlift_Google_Analytics_Export_Service} instance.
618
-	 *
619
-	 * @since  3.16.0
620
-	 * @access protected
621
-	 * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
622
-	 */
623
-	protected $google_analytics_export_service;
624
-
625
-	/**
626
-	 * {@link Wordlift}'s singleton instance.
627
-	 *
628
-	 * @since  3.15.0
629
-	 * @access protected
630
-	 * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
631
-	 */
632
-	protected $entity_type_adapter;
633
-
634
-	/**
635
-	 * The {@link Wordlift_Linked_Data_Service} instance.
636
-	 *
637
-	 * @since  3.15.0
638
-	 * @access protected
639
-	 * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance.
640
-	 */
641
-	protected $linked_data_service;
642
-
643
-	/**
644
-	 * The {@link Wordlift_Storage_Factory} instance.
645
-	 *
646
-	 * @since  3.15.0
647
-	 * @access protected
648
-	 * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
649
-	 */
650
-	protected $storage_factory;
651
-
652
-	/**
653
-	 * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
654
-	 *
655
-	 * @since  3.15.0
656
-	 * @access protected
657
-	 * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
658
-	 */
659
-	protected $rendition_factory;
660
-
661
-	/**
662
-	 * The {@link Wordlift_Autocomplete_Adapter} instance.
663
-	 *
664
-	 * @since  3.15.0
665
-	 * @access private
666
-	 * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
667
-	 */
668
-	private $autocomplete_adapter;
669
-
670
-	/**
671
-	 * The {@link Wordlift_Relation_Service} instance.
672
-	 *
673
-	 * @since  3.15.0
674
-	 * @access protected
675
-	 * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
676
-	 */
677
-	protected $relation_service;
678
-
679
-	/**
680
-	 * The {@link Wordlift_Cached_Post_Converter} instance.
681
-	 *
682
-	 * @since  3.16.0
683
-	 * @access protected
684
-	 * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
685
-	 *
686
-	 */
687
-	protected $cached_postid_to_jsonld_converter;
688
-
689
-	/**
690
-	 * The {@link Wordlift_File_Cache_Service} instance.
691
-	 *
692
-	 * @since  3.16.0
693
-	 * @access protected
694
-	 * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance.
695
-	 */
696
-	protected $file_cache_service;
697
-
698
-	/**
699
-	 * The {@link Wordlift_Entity_Uri_Service} instance.
700
-	 *
701
-	 * @since  3.16.3
702
-	 * @access protected
703
-	 * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
704
-	 */
705
-	protected $entity_uri_service;
706
-
707
-	/**
708
-	 * The {@link Wordlift_Publisher_Service} instance.
709
-	 *
710
-	 * @since  3.19.0
711
-	 * @access protected
712
-	 * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
713
-	 */
714
-	protected $publisher_service;
715
-
716
-	/**
717
-	 * {@link Wordlift}'s singleton instance.
718
-	 *
719
-	 * @since  3.11.2
720
-	 * @access private
721
-	 * @var Wordlift $instance {@link Wordlift}'s singleton instance.
722
-	 */
723
-	private static $instance;
724
-
725
-	//</editor-fold>
726
-
727
-	/**
728
-	 * Define the core functionality of the plugin.
729
-	 *
730
-	 * Set the plugin name and the plugin version that can be used throughout the plugin.
731
-	 * Load the dependencies, define the locale, and set the hooks for the admin area and
732
-	 * the public-facing side of the site.
733
-	 *
734
-	 * @since    1.0.0
735
-	 */
736
-	public function __construct() {
737
-
738
-		self::$instance = $this;
739
-
740
-		$this->plugin_name = 'wordlift';
741
-		$this->version     = '3.24.4';
742
-		$this->load_dependencies();
743
-		$this->set_locale();
744
-		$this->define_admin_hooks();
745
-		$this->define_public_hooks();
746
-
747
-		// If we're in `WP_CLI` load the related files.
748
-		if ( class_exists( 'WP_CLI' ) ) {
749
-			$this->load_cli_dependencies();
750
-		}
751
-
752
-	}
753
-
754
-	/**
755
-	 * Get the singleton instance.
756
-	 *
757
-	 * @return Wordlift The {@link Wordlift} singleton instance.
758
-	 * @since 3.11.2
759
-	 *
760
-	 */
761
-	public static function get_instance() {
762
-
763
-		return self::$instance;
764
-	}
765
-
766
-	/**
767
-	 * Load the required dependencies for this plugin.
768
-	 *
769
-	 * Include the following files that make up the plugin:
770
-	 *
771
-	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
772
-	 * - Wordlift_i18n. Defines internationalization functionality.
773
-	 * - Wordlift_Admin. Defines all hooks for the admin area.
774
-	 * - Wordlift_Public. Defines all hooks for the public side of the site.
775
-	 *
776
-	 * Create an instance of the loader which will be used to register the hooks
777
-	 * with WordPress.
778
-	 *
779
-	 * @since    1.0.0
780
-	 * @access   private
781
-	 */
782
-	private function load_dependencies() {
783
-
784
-		/**
785
-		 * The class responsible for orchestrating the actions and filters of the
786
-		 * core plugin.
787
-		 */
788
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
789
-
790
-		// The class responsible for plugin uninstall.
791
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
792
-
793
-		/**
794
-		 * The class responsible for defining internationalization functionality
795
-		 * of the plugin.
796
-		 */
797
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
798
-
799
-		/**
800
-		 * WordLift's supported languages.
801
-		 */
802
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
803
-
804
-		/**
805
-		 * WordLift's supported countries.
806
-		 */
807
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php';
808
-
809
-		/**
810
-		 * Provide support functions to sanitize data.
811
-		 */
812
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
813
-
814
-		/** Services. */
815
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
816
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
817
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
818
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
819
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
820
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
821
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
822
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
823
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
824
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php';
825
-
826
-		/**
827
-		 * The Query builder.
828
-		 */
829
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
830
-
831
-		/**
832
-		 * The Schema service.
833
-		 */
834
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
835
-
836
-		/**
837
-		 * The schema:url property service.
838
-		 */
839
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
840
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
841
-
842
-		/**
843
-		 * The UI service.
844
-		 */
845
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
846
-
847
-		/**
848
-		 * The Thumbnail service.
849
-		 */
850
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
851
-
852
-		/**
853
-		 * The Entity Types Taxonomy service.
854
-		 */
855
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
856
-
857
-		/**
858
-		 * The Entity service.
859
-		 */
860
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
861
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
862
-
863
-		// Add the entity rating service.
864
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
865
-
866
-		/**
867
-		 * The User service.
868
-		 */
869
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
870
-
871
-		/**
872
-		 * The Timeline service.
873
-		 */
874
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
875
-
876
-		/**
877
-		 * The Topic Taxonomy service.
878
-		 */
879
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
880
-
881
-		/**
882
-		 * The SPARQL service.
883
-		 */
884
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
885
-
886
-		/**
887
-		 * The WordLift import service.
888
-		 */
889
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
890
-
891
-		/**
892
-		 * The WordLift URI service.
893
-		 */
894
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
895
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
896
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
897
-
898
-		/**
899
-		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
900
-		 */
901
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php';
902
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php';
903
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php';
904
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php';
905
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
906
-
907
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
908
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
909
-
910
-		/**
911
-		 * Load the converters.
912
-		 */
913
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
914
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
915
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
916
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
917
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
918
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
919
-
920
-		/**
921
-		 * Load cache-related files.
922
-		 */
923
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
924
-
925
-		/**
926
-		 * Load the content filter.
927
-		 */
928
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
929
-
930
-		/*
36
+    //<editor-fold desc="## FIELDS">
37
+
38
+    /**
39
+     * The loader that's responsible for maintaining and registering all hooks that power
40
+     * the plugin.
41
+     *
42
+     * @since    1.0.0
43
+     * @access   protected
44
+     * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
45
+     */
46
+    protected $loader;
47
+
48
+    /**
49
+     * The unique identifier of this plugin.
50
+     *
51
+     * @since    1.0.0
52
+     * @access   protected
53
+     * @var      string $plugin_name The string used to uniquely identify this plugin.
54
+     */
55
+    protected $plugin_name;
56
+
57
+    /**
58
+     * The current version of the plugin.
59
+     *
60
+     * @since    1.0.0
61
+     * @access   protected
62
+     * @var      string $version The current version of the plugin.
63
+     */
64
+    protected $version;
65
+
66
+    /**
67
+     * The {@link Wordlift_Tinymce_Adapter} instance.
68
+     *
69
+     * @since  3.12.0
70
+     * @access protected
71
+     * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
72
+     */
73
+    protected $tinymce_adapter;
74
+
75
+    /**
76
+     * The Thumbnail service.
77
+     *
78
+     * @since  3.1.5
79
+     * @access private
80
+     * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
81
+     */
82
+    private $thumbnail_service;
83
+
84
+    /**
85
+     * The UI service.
86
+     *
87
+     * @since  3.2.0
88
+     * @access private
89
+     * @var \Wordlift_UI_Service $ui_service The UI service.
90
+     */
91
+    private $ui_service;
92
+
93
+    /**
94
+     * The Schema service.
95
+     *
96
+     * @since  3.3.0
97
+     * @access protected
98
+     * @var \Wordlift_Schema_Service $schema_service The Schema service.
99
+     */
100
+    protected $schema_service;
101
+
102
+    /**
103
+     * The Entity service.
104
+     *
105
+     * @since  3.1.0
106
+     * @access protected
107
+     * @var \Wordlift_Entity_Service $entity_service The Entity service.
108
+     */
109
+    protected $entity_service;
110
+
111
+    /**
112
+     * The Topic Taxonomy service.
113
+     *
114
+     * @since  3.5.0
115
+     * @access private
116
+     * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
117
+     */
118
+    private $topic_taxonomy_service;
119
+
120
+    /**
121
+     * The Entity Types Taxonomy service.
122
+     *
123
+     * @since  3.18.0
124
+     * @access private
125
+     * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service.
126
+     */
127
+    private $entity_types_taxonomy_service;
128
+
129
+    /**
130
+     * The User service.
131
+     *
132
+     * @since  3.1.7
133
+     * @access protected
134
+     * @var \Wordlift_User_Service $user_service The User service.
135
+     */
136
+    protected $user_service;
137
+
138
+    /**
139
+     * The Timeline service.
140
+     *
141
+     * @since  3.1.0
142
+     * @access private
143
+     * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
144
+     */
145
+    private $timeline_service;
146
+
147
+    /**
148
+     * The Redirect service.
149
+     *
150
+     * @since  3.2.0
151
+     * @access private
152
+     * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
153
+     */
154
+    private $redirect_service;
155
+
156
+    /**
157
+     * The Notice service.
158
+     *
159
+     * @since  3.3.0
160
+     * @access private
161
+     * @var \Wordlift_Notice_Service $notice_service The Notice service.
162
+     */
163
+    private $notice_service;
164
+
165
+    /**
166
+     * The Entity list customization.
167
+     *
168
+     * @since  3.3.0
169
+     * @access protected
170
+     * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
171
+     */
172
+    protected $entity_list_service;
173
+
174
+    /**
175
+     * The Entity Types Taxonomy Walker.
176
+     *
177
+     * @since  3.1.0
178
+     * @access private
179
+     * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
180
+     */
181
+    private $entity_types_taxonomy_walker;
182
+
183
+    /**
184
+     * The ShareThis service.
185
+     *
186
+     * @since  3.2.0
187
+     * @access private
188
+     * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
189
+     */
190
+    private $sharethis_service;
191
+
192
+    /**
193
+     * The PrimaShop adapter.
194
+     *
195
+     * @since  3.2.3
196
+     * @access private
197
+     * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
198
+     */
199
+    private $primashop_adapter;
200
+
201
+    /**
202
+     * The WordLift Dashboard adapter.
203
+     *
204
+     * @since  3.4.0
205
+     * @access private
206
+     * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
207
+     */
208
+    private $dashboard_service;
209
+
210
+    /**
211
+     * The entity type service.
212
+     *
213
+     * @since  3.6.0
214
+     * @access private
215
+     * @var \Wordlift_Entity_Post_Type_Service
216
+     */
217
+    private $entity_post_type_service;
218
+
219
+    /**
220
+     * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
221
+     *
222
+     * @since  3.6.0
223
+     * @access private
224
+     * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance.
225
+     */
226
+    private $entity_link_service;
227
+
228
+    /**
229
+     * A {@link Wordlift_Sparql_Service} instance.
230
+     *
231
+     * @since    3.6.0
232
+     * @access   protected
233
+     * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
234
+     */
235
+    protected $sparql_service;
236
+
237
+    /**
238
+     * A {@link Wordlift_Import_Service} instance.
239
+     *
240
+     * @since  3.6.0
241
+     * @access private
242
+     * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
243
+     */
244
+    private $import_service;
245
+
246
+    /**
247
+     * A {@link Wordlift_Rebuild_Service} instance.
248
+     *
249
+     * @since  3.6.0
250
+     * @access private
251
+     * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
252
+     */
253
+    private $rebuild_service;
254
+
255
+    /**
256
+     * A {@link Wordlift_Jsonld_Service} instance.
257
+     *
258
+     * @since  3.7.0
259
+     * @access protected
260
+     * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
261
+     */
262
+    protected $jsonld_service;
263
+
264
+    /**
265
+     * A {@link Wordlift_Website_Jsonld_Converter} instance.
266
+     *
267
+     * @since  3.14.0
268
+     * @access protected
269
+     * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
270
+     */
271
+    protected $jsonld_website_converter;
272
+
273
+    /**
274
+     * A {@link Wordlift_Property_Factory} instance.
275
+     *
276
+     * @since  3.7.0
277
+     * @access private
278
+     * @var \Wordlift_Property_Factory $property_factory
279
+     */
280
+    private $property_factory;
281
+
282
+    /**
283
+     * The 'Download Your Data' page.
284
+     *
285
+     * @since  3.6.0
286
+     * @access private
287
+     * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
288
+     */
289
+    private $download_your_data_page;
290
+
291
+    /**
292
+     * The 'WordLift Settings' page.
293
+     *
294
+     * @since  3.11.0
295
+     * @access protected
296
+     * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
297
+     */
298
+    protected $settings_page;
299
+
300
+    /**
301
+     * The 'WordLift Batch analysis' page.
302
+     *
303
+     * @since  3.14.0
304
+     * @access protected
305
+     * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page.
306
+     */
307
+    protected $batch_analysis_page;
308
+
309
+    /**
310
+     * The install wizard page.
311
+     *
312
+     * @since  3.9.0
313
+     * @access private
314
+     * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
315
+     */
316
+    private $admin_setup;
317
+
318
+    /**
319
+     * The Content Filter Service hooks up to the 'the_content' filter and provides
320
+     * linking of entities to their pages.
321
+     *
322
+     * @since  3.8.0
323
+     * @access private
324
+     * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
325
+     */
326
+    private $content_filter_service;
327
+
328
+    /**
329
+     * A {@link Wordlift_Key_Validation_Service} instance.
330
+     *
331
+     * @since  3.9.0
332
+     * @access private
333
+     * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
334
+     */
335
+    private $key_validation_service;
336
+
337
+    /**
338
+     * A {@link Wordlift_Rating_Service} instance.
339
+     *
340
+     * @since  3.10.0
341
+     * @access private
342
+     * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
343
+     */
344
+    private $rating_service;
345
+
346
+    /**
347
+     * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
348
+     *
349
+     * @since  3.10.0
350
+     * @access protected
351
+     * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
352
+     */
353
+    protected $post_to_jsonld_converter;
354
+
355
+    /**
356
+     * A {@link Wordlift_Configuration_Service} instance.
357
+     *
358
+     * @since  3.10.0
359
+     * @access protected
360
+     * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
361
+     */
362
+    protected $configuration_service;
363
+
364
+    /**
365
+     * A {@link Wordlift_Install_Service} instance.
366
+     *
367
+     * @since  3.18.0
368
+     * @access protected
369
+     * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance.
370
+     */
371
+    protected $install_service;
372
+
373
+    /**
374
+     * A {@link Wordlift_Entity_Type_Service} instance.
375
+     *
376
+     * @since  3.10.0
377
+     * @access protected
378
+     * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
379
+     */
380
+    protected $entity_type_service;
381
+
382
+    /**
383
+     * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
384
+     *
385
+     * @since  3.10.0
386
+     * @access protected
387
+     * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
388
+     */
389
+    protected $entity_post_to_jsonld_converter;
390
+
391
+    /**
392
+     * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
393
+     *
394
+     * @since  3.10.0
395
+     * @access protected
396
+     * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
397
+     */
398
+    protected $postid_to_jsonld_converter;
399
+
400
+    /**
401
+     * The {@link Wordlift_Admin_Status_Page} class.
402
+     *
403
+     * @since  3.9.8
404
+     * @access private
405
+     * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
406
+     */
407
+    private $status_page;
408
+
409
+    /**
410
+     * The {@link Wordlift_Category_Taxonomy_Service} instance.
411
+     *
412
+     * @since  3.11.0
413
+     * @access protected
414
+     * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
415
+     */
416
+    protected $category_taxonomy_service;
417
+
418
+    /**
419
+     * The {@link Wordlift_Entity_Page_Service} instance.
420
+     *
421
+     * @since  3.11.0
422
+     * @access protected
423
+     * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
424
+     */
425
+    protected $entity_page_service;
426
+
427
+    /**
428
+     * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
429
+     *
430
+     * @since  3.11.0
431
+     * @access protected
432
+     * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
433
+     */
434
+    protected $settings_page_action_link;
435
+
436
+    /**
437
+     * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
438
+     *
439
+     * @since  3.11.0
440
+     * @access protected
441
+     * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
442
+     */
443
+    protected $analytics_settings_page_action_link;
444
+
445
+    /**
446
+     * The {@link Wordlift_Analytics_Connect} class.
447
+     *
448
+     * @since  3.11.0
449
+     * @access protected
450
+     * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class.
451
+     */
452
+    protected $analytics_connect;
453
+
454
+    /**
455
+     * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
456
+     *
457
+     * @since  3.11.0
458
+     * @access protected
459
+     * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
460
+     */
461
+    protected $publisher_ajax_adapter;
462
+
463
+    /**
464
+     * The {@link Wordlift_Admin_Input_Element} element renderer.
465
+     *
466
+     * @since  3.11.0
467
+     * @access protected
468
+     * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
469
+     */
470
+    protected $input_element;
471
+
472
+    /**
473
+     * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
474
+     *
475
+     * @since  3.13.0
476
+     * @access protected
477
+     * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
478
+     */
479
+    protected $radio_input_element;
480
+
481
+    /**
482
+     * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
483
+     *
484
+     * @since  3.11.0
485
+     * @access protected
486
+     * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
487
+     */
488
+    protected $language_select_element;
489
+
490
+    /**
491
+     * The {@link Wordlift_Admin_Country_Select_Element} element renderer.
492
+     *
493
+     * @since  3.18.0
494
+     * @access protected
495
+     * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer.
496
+     */
497
+    protected $country_select_element;
498
+
499
+    /**
500
+     * The {@link Wordlift_Admin_Publisher_Element} element renderer.
501
+     *
502
+     * @since  3.11.0
503
+     * @access protected
504
+     * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
505
+     */
506
+    protected $publisher_element;
507
+
508
+    /**
509
+     * The {@link Wordlift_Admin_Select2_Element} element renderer.
510
+     *
511
+     * @since  3.11.0
512
+     * @access protected
513
+     * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
514
+     */
515
+    protected $select2_element;
516
+
517
+    /**
518
+     * The controller for the entity type list admin page
519
+     *
520
+     * @since  3.11.0
521
+     * @access private
522
+     * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
523
+     */
524
+    private $entity_type_admin_page;
525
+
526
+    /**
527
+     * The controller for the entity type settings admin page
528
+     *
529
+     * @since  3.11.0
530
+     * @access private
531
+     * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
532
+     */
533
+    private $entity_type_settings_admin_page;
534
+
535
+    /**
536
+     * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
537
+     *
538
+     * @since  3.11.0
539
+     * @access protected
540
+     * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
541
+     */
542
+    protected $related_entities_cloud_widget;
543
+
544
+    /**
545
+     * The {@link Wordlift_Admin_Author_Element} instance.
546
+     *
547
+     * @since  3.14.0
548
+     * @access protected
549
+     * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
550
+     */
551
+    protected $author_element;
552
+
553
+    /**
554
+     * The {@link Wordlift_Batch_Analysis_Service} instance.
555
+     *
556
+     * @since  3.14.0
557
+     * @access protected
558
+     * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance.
559
+     */
560
+    protected $batch_analysis_service;
561
+
562
+    /**
563
+     * The {@link Wordlift_Sample_Data_Service} instance.
564
+     *
565
+     * @since  3.12.0
566
+     * @access protected
567
+     * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
568
+     */
569
+    protected $sample_data_service;
570
+
571
+    /**
572
+     * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
573
+     *
574
+     * @since  3.12.0
575
+     * @access protected
576
+     * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
577
+     */
578
+    protected $sample_data_ajax_adapter;
579
+
580
+    /**
581
+     * The {@link Wordlift_Batch_Analysis_Adapter} instance.
582
+     *
583
+     * @since  3.14.2
584
+     * @access protected
585
+     * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance.
586
+     */
587
+    private $batch_analysis_adapter;
588
+
589
+    /**
590
+     * The {@link Wordlift_Relation_Rebuild_Service} instance.
591
+     *
592
+     * @since  3.14.3
593
+     * @access private
594
+     * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
595
+     */
596
+    private $relation_rebuild_service;
597
+
598
+    /**
599
+     * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
600
+     *
601
+     * @since  3.14.3
602
+     * @access private
603
+     * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
604
+     */
605
+    private $relation_rebuild_adapter;
606
+
607
+    /**
608
+     * The {@link Wordlift_Reference_Rebuild_Service} instance.
609
+     *
610
+     * @since  3.18.0
611
+     * @access private
612
+     * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance.
613
+     */
614
+    private $reference_rebuild_service;
615
+
616
+    /**
617
+     * The {@link Wordlift_Google_Analytics_Export_Service} instance.
618
+     *
619
+     * @since  3.16.0
620
+     * @access protected
621
+     * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
622
+     */
623
+    protected $google_analytics_export_service;
624
+
625
+    /**
626
+     * {@link Wordlift}'s singleton instance.
627
+     *
628
+     * @since  3.15.0
629
+     * @access protected
630
+     * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
631
+     */
632
+    protected $entity_type_adapter;
633
+
634
+    /**
635
+     * The {@link Wordlift_Linked_Data_Service} instance.
636
+     *
637
+     * @since  3.15.0
638
+     * @access protected
639
+     * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance.
640
+     */
641
+    protected $linked_data_service;
642
+
643
+    /**
644
+     * The {@link Wordlift_Storage_Factory} instance.
645
+     *
646
+     * @since  3.15.0
647
+     * @access protected
648
+     * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
649
+     */
650
+    protected $storage_factory;
651
+
652
+    /**
653
+     * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
654
+     *
655
+     * @since  3.15.0
656
+     * @access protected
657
+     * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
658
+     */
659
+    protected $rendition_factory;
660
+
661
+    /**
662
+     * The {@link Wordlift_Autocomplete_Adapter} instance.
663
+     *
664
+     * @since  3.15.0
665
+     * @access private
666
+     * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
667
+     */
668
+    private $autocomplete_adapter;
669
+
670
+    /**
671
+     * The {@link Wordlift_Relation_Service} instance.
672
+     *
673
+     * @since  3.15.0
674
+     * @access protected
675
+     * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
676
+     */
677
+    protected $relation_service;
678
+
679
+    /**
680
+     * The {@link Wordlift_Cached_Post_Converter} instance.
681
+     *
682
+     * @since  3.16.0
683
+     * @access protected
684
+     * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
685
+     *
686
+     */
687
+    protected $cached_postid_to_jsonld_converter;
688
+
689
+    /**
690
+     * The {@link Wordlift_File_Cache_Service} instance.
691
+     *
692
+     * @since  3.16.0
693
+     * @access protected
694
+     * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance.
695
+     */
696
+    protected $file_cache_service;
697
+
698
+    /**
699
+     * The {@link Wordlift_Entity_Uri_Service} instance.
700
+     *
701
+     * @since  3.16.3
702
+     * @access protected
703
+     * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
704
+     */
705
+    protected $entity_uri_service;
706
+
707
+    /**
708
+     * The {@link Wordlift_Publisher_Service} instance.
709
+     *
710
+     * @since  3.19.0
711
+     * @access protected
712
+     * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
713
+     */
714
+    protected $publisher_service;
715
+
716
+    /**
717
+     * {@link Wordlift}'s singleton instance.
718
+     *
719
+     * @since  3.11.2
720
+     * @access private
721
+     * @var Wordlift $instance {@link Wordlift}'s singleton instance.
722
+     */
723
+    private static $instance;
724
+
725
+    //</editor-fold>
726
+
727
+    /**
728
+     * Define the core functionality of the plugin.
729
+     *
730
+     * Set the plugin name and the plugin version that can be used throughout the plugin.
731
+     * Load the dependencies, define the locale, and set the hooks for the admin area and
732
+     * the public-facing side of the site.
733
+     *
734
+     * @since    1.0.0
735
+     */
736
+    public function __construct() {
737
+
738
+        self::$instance = $this;
739
+
740
+        $this->plugin_name = 'wordlift';
741
+        $this->version     = '3.24.4';
742
+        $this->load_dependencies();
743
+        $this->set_locale();
744
+        $this->define_admin_hooks();
745
+        $this->define_public_hooks();
746
+
747
+        // If we're in `WP_CLI` load the related files.
748
+        if ( class_exists( 'WP_CLI' ) ) {
749
+            $this->load_cli_dependencies();
750
+        }
751
+
752
+    }
753
+
754
+    /**
755
+     * Get the singleton instance.
756
+     *
757
+     * @return Wordlift The {@link Wordlift} singleton instance.
758
+     * @since 3.11.2
759
+     *
760
+     */
761
+    public static function get_instance() {
762
+
763
+        return self::$instance;
764
+    }
765
+
766
+    /**
767
+     * Load the required dependencies for this plugin.
768
+     *
769
+     * Include the following files that make up the plugin:
770
+     *
771
+     * - Wordlift_Loader. Orchestrates the hooks of the plugin.
772
+     * - Wordlift_i18n. Defines internationalization functionality.
773
+     * - Wordlift_Admin. Defines all hooks for the admin area.
774
+     * - Wordlift_Public. Defines all hooks for the public side of the site.
775
+     *
776
+     * Create an instance of the loader which will be used to register the hooks
777
+     * with WordPress.
778
+     *
779
+     * @since    1.0.0
780
+     * @access   private
781
+     */
782
+    private function load_dependencies() {
783
+
784
+        /**
785
+         * The class responsible for orchestrating the actions and filters of the
786
+         * core plugin.
787
+         */
788
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
789
+
790
+        // The class responsible for plugin uninstall.
791
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
792
+
793
+        /**
794
+         * The class responsible for defining internationalization functionality
795
+         * of the plugin.
796
+         */
797
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
798
+
799
+        /**
800
+         * WordLift's supported languages.
801
+         */
802
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
803
+
804
+        /**
805
+         * WordLift's supported countries.
806
+         */
807
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php';
808
+
809
+        /**
810
+         * Provide support functions to sanitize data.
811
+         */
812
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
813
+
814
+        /** Services. */
815
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
816
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
817
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
818
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
819
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
820
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
821
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
822
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
823
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
824
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php';
825
+
826
+        /**
827
+         * The Query builder.
828
+         */
829
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
830
+
831
+        /**
832
+         * The Schema service.
833
+         */
834
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
835
+
836
+        /**
837
+         * The schema:url property service.
838
+         */
839
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
840
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
841
+
842
+        /**
843
+         * The UI service.
844
+         */
845
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
846
+
847
+        /**
848
+         * The Thumbnail service.
849
+         */
850
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
851
+
852
+        /**
853
+         * The Entity Types Taxonomy service.
854
+         */
855
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
856
+
857
+        /**
858
+         * The Entity service.
859
+         */
860
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
861
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
862
+
863
+        // Add the entity rating service.
864
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
865
+
866
+        /**
867
+         * The User service.
868
+         */
869
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
870
+
871
+        /**
872
+         * The Timeline service.
873
+         */
874
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
875
+
876
+        /**
877
+         * The Topic Taxonomy service.
878
+         */
879
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
880
+
881
+        /**
882
+         * The SPARQL service.
883
+         */
884
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
885
+
886
+        /**
887
+         * The WordLift import service.
888
+         */
889
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
890
+
891
+        /**
892
+         * The WordLift URI service.
893
+         */
894
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
895
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
896
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
897
+
898
+        /**
899
+         * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
900
+         */
901
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php';
902
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php';
903
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php';
904
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php';
905
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
906
+
907
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
908
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
909
+
910
+        /**
911
+         * Load the converters.
912
+         */
913
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
914
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
915
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
916
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
917
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
918
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
919
+
920
+        /**
921
+         * Load cache-related files.
922
+         */
923
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
924
+
925
+        /**
926
+         * Load the content filter.
927
+         */
928
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
929
+
930
+        /*
931 931
 		 * Load the excerpt helper.
932 932
 		 */
933
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
934
-
935
-		/**
936
-		 * Load the JSON-LD service to publish entities using JSON-LD.s
937
-		 *
938
-		 * @since 3.8.0
939
-		 */
940
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
941
-
942
-		// The Publisher Service and the AJAX adapter.
943
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
944
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
945
-
946
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
947
-
948
-		/**
949
-		 * Load the WordLift key validation service.
950
-		 */
951
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
952
-
953
-		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
954
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
955
-
956
-		// Load the `Wordlift_Entity_Page_Service` class definition.
957
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
958
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php';
959
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php';
960
-
961
-		/** Linked Data. */
962
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
963
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
964
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
965
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
966
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
967
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
968
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
969
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
970
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
971
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
972
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
973
-
974
-		/** Linked Data Rendition. */
975
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
976
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
977
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
978
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
979
-
980
-		/** Services. */
981
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
982
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php';
983
-
984
-		/** Adapters. */
985
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
986
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
987
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
988
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
989
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php';
990
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php';
991
-
992
-		/** Async Tasks. */
993
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
994
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
995
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
996
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
997
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php';
998
-
999
-		/** Autocomplete. */
1000
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
1001
-
1002
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
1003
-
1004
-		/** Analytics */
1005
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php';
1006
-
1007
-		/**
1008
-		 * The class responsible for defining all actions that occur in the admin area.
1009
-		 */
1010
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
1011
-
1012
-		/**
1013
-		 * The class to customize the entity list admin page.
1014
-		 */
1015
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
1016
-
1017
-		/**
1018
-		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
1019
-		 */
1020
-		global $wp_version;
1021
-		if ( version_compare( $wp_version, '5.3', '<' ) ) {
1022
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
1023
-		} else {
1024
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php';
1025
-		}
1026
-
1027
-		/**
1028
-		 * The Notice service.
1029
-		 */
1030
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
1031
-
1032
-		/**
1033
-		 * The PrimaShop adapter.
1034
-		 */
1035
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
1036
-
1037
-		/**
1038
-		 * The WordLift Dashboard service.
1039
-		 */
1040
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
1041
-
1042
-		/**
1043
-		 * The admin 'Install wizard' page.
1044
-		 */
1045
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
1046
-
1047
-		/**
1048
-		 * The WordLift entity type list admin page controller.
1049
-		 */
1050
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1051
-
1052
-		/**
1053
-		 * The WordLift entity type settings admin page controller.
1054
-		 */
1055
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
1056
-
1057
-		/**
1058
-		 * The admin 'Download Your Data' page.
1059
-		 */
1060
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
1061
-
1062
-		/**
1063
-		 * The admin 'WordLift Settings' page.
1064
-		 */
1065
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php';
1066
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php';
1067
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php';
1068
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php';
1069
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php';
1070
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php';
1071
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php';
1072
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php';
1073
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php';
1074
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php';
1075
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
1076
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
1077
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php';
1078
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php';
1079
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
1080
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php';
1081
-
1082
-		/** Admin Pages */
1083
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
1084
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
1085
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php';
1086
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
1087
-
1088
-		/**
1089
-		 * The class responsible for defining all actions that occur in the public-facing
1090
-		 * side of the site.
1091
-		 */
1092
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1093
-
1094
-		/**
1095
-		 * The shortcode abstract class.
1096
-		 */
1097
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1098
-
1099
-		/**
1100
-		 * The Timeline shortcode.
1101
-		 */
1102
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1103
-
1104
-		/**
1105
-		 * The Navigator shortcode.
1106
-		 */
1107
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1108
-
1109
-		/**
1110
-		 * The chord shortcode.
1111
-		 */
1112
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1113
-
1114
-		/**
1115
-		 * The geomap shortcode.
1116
-		 */
1117
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1118
-
1119
-		/**
1120
-		 * The entity cloud shortcode.
1121
-		 */
1122
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1123
-
1124
-		/**
1125
-		 * The entity glossary shortcode.
1126
-		 */
1127
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1128
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1129
-
1130
-		/**
1131
-		 * Faceted Search shortcode.
1132
-		 */
1133
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php';
1134
-
1135
-		/**
1136
-		 * The ShareThis service.
1137
-		 */
1138
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1139
-
1140
-		/**
1141
-		 * The SEO service.
1142
-		 */
1143
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1144
-
1145
-		/**
1146
-		 * The AMP service.
1147
-		 */
1148
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1149
-
1150
-		/** Widgets */
1151
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1152
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1153
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php';
1154
-
1155
-		/*
933
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
934
+
935
+        /**
936
+         * Load the JSON-LD service to publish entities using JSON-LD.s
937
+         *
938
+         * @since 3.8.0
939
+         */
940
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
941
+
942
+        // The Publisher Service and the AJAX adapter.
943
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
944
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
945
+
946
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
947
+
948
+        /**
949
+         * Load the WordLift key validation service.
950
+         */
951
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
952
+
953
+        // Load the `Wordlift_Category_Taxonomy_Service` class definition.
954
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
955
+
956
+        // Load the `Wordlift_Entity_Page_Service` class definition.
957
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
958
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php';
959
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php';
960
+
961
+        /** Linked Data. */
962
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
963
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
964
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
965
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
966
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
967
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
968
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
969
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
970
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
971
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
972
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
973
+
974
+        /** Linked Data Rendition. */
975
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
976
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
977
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
978
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
979
+
980
+        /** Services. */
981
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
982
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php';
983
+
984
+        /** Adapters. */
985
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
986
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
987
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
988
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
989
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php';
990
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php';
991
+
992
+        /** Async Tasks. */
993
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
994
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
995
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
996
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
997
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php';
998
+
999
+        /** Autocomplete. */
1000
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
1001
+
1002
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
1003
+
1004
+        /** Analytics */
1005
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php';
1006
+
1007
+        /**
1008
+         * The class responsible for defining all actions that occur in the admin area.
1009
+         */
1010
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
1011
+
1012
+        /**
1013
+         * The class to customize the entity list admin page.
1014
+         */
1015
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
1016
+
1017
+        /**
1018
+         * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
1019
+         */
1020
+        global $wp_version;
1021
+        if ( version_compare( $wp_version, '5.3', '<' ) ) {
1022
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
1023
+        } else {
1024
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php';
1025
+        }
1026
+
1027
+        /**
1028
+         * The Notice service.
1029
+         */
1030
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
1031
+
1032
+        /**
1033
+         * The PrimaShop adapter.
1034
+         */
1035
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
1036
+
1037
+        /**
1038
+         * The WordLift Dashboard service.
1039
+         */
1040
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
1041
+
1042
+        /**
1043
+         * The admin 'Install wizard' page.
1044
+         */
1045
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
1046
+
1047
+        /**
1048
+         * The WordLift entity type list admin page controller.
1049
+         */
1050
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1051
+
1052
+        /**
1053
+         * The WordLift entity type settings admin page controller.
1054
+         */
1055
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
1056
+
1057
+        /**
1058
+         * The admin 'Download Your Data' page.
1059
+         */
1060
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
1061
+
1062
+        /**
1063
+         * The admin 'WordLift Settings' page.
1064
+         */
1065
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php';
1066
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php';
1067
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php';
1068
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php';
1069
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php';
1070
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php';
1071
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php';
1072
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php';
1073
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php';
1074
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php';
1075
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
1076
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
1077
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php';
1078
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php';
1079
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
1080
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php';
1081
+
1082
+        /** Admin Pages */
1083
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
1084
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
1085
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php';
1086
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
1087
+
1088
+        /**
1089
+         * The class responsible for defining all actions that occur in the public-facing
1090
+         * side of the site.
1091
+         */
1092
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1093
+
1094
+        /**
1095
+         * The shortcode abstract class.
1096
+         */
1097
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1098
+
1099
+        /**
1100
+         * The Timeline shortcode.
1101
+         */
1102
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1103
+
1104
+        /**
1105
+         * The Navigator shortcode.
1106
+         */
1107
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1108
+
1109
+        /**
1110
+         * The chord shortcode.
1111
+         */
1112
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1113
+
1114
+        /**
1115
+         * The geomap shortcode.
1116
+         */
1117
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1118
+
1119
+        /**
1120
+         * The entity cloud shortcode.
1121
+         */
1122
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1123
+
1124
+        /**
1125
+         * The entity glossary shortcode.
1126
+         */
1127
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1128
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1129
+
1130
+        /**
1131
+         * Faceted Search shortcode.
1132
+         */
1133
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php';
1134
+
1135
+        /**
1136
+         * The ShareThis service.
1137
+         */
1138
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1139
+
1140
+        /**
1141
+         * The SEO service.
1142
+         */
1143
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1144
+
1145
+        /**
1146
+         * The AMP service.
1147
+         */
1148
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1149
+
1150
+        /** Widgets */
1151
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1152
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1153
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php';
1154
+
1155
+        /*
1156 1156
 		 * Schema.org Services.
1157 1157
 		 *
1158 1158
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1159 1159
 		 */
1160
-		if ( WL_ALL_ENTITY_TYPES ) {
1161
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php';
1162
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php';
1163
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php';
1164
-			new Wordlift_Schemaorg_Sync_Service();
1165
-			$schemaorg_property_service = new Wordlift_Schemaorg_Property_Service();
1166
-			new Wordlift_Schemaorg_Class_Service();
1167
-		} else {
1168
-			$schemaorg_property_service = null;
1169
-		}
1160
+        if ( WL_ALL_ENTITY_TYPES ) {
1161
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php';
1162
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php';
1163
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php';
1164
+            new Wordlift_Schemaorg_Sync_Service();
1165
+            $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service();
1166
+            new Wordlift_Schemaorg_Class_Service();
1167
+        } else {
1168
+            $schemaorg_property_service = null;
1169
+        }
1170 1170
 
1171
-		$this->loader = new Wordlift_Loader();
1171
+        $this->loader = new Wordlift_Loader();
1172 1172
 
1173
-		// Instantiate a global logger.
1174
-		global $wl_logger;
1175
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1173
+        // Instantiate a global logger.
1174
+        global $wl_logger;
1175
+        $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1176 1176
 
1177
-		// Load the `wl-api` end-point.
1178
-		new Wordlift_Http_Api();
1177
+        // Load the `wl-api` end-point.
1178
+        new Wordlift_Http_Api();
1179 1179
 
1180
-		// Load the Install Service.
1181
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
1182
-		$this->install_service = new Wordlift_Install_Service();
1180
+        // Load the Install Service.
1181
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
1182
+        $this->install_service = new Wordlift_Install_Service();
1183 1183
 
1184
-		/** Services. */
1185
-		// Create the configuration service.
1186
-		$this->configuration_service = new Wordlift_Configuration_Service();
1187
-		$api_service                 = new Wordlift_Api_Service( $this->configuration_service );
1184
+        /** Services. */
1185
+        // Create the configuration service.
1186
+        $this->configuration_service = new Wordlift_Configuration_Service();
1187
+        $api_service                 = new Wordlift_Api_Service( $this->configuration_service );
1188 1188
 
1189
-		// Create an entity type service instance. It'll be later bound to the init action.
1190
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1189
+        // Create an entity type service instance. It'll be later bound to the init action.
1190
+        $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1191 1191
 
1192
-		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1193
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1192
+        // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1193
+        $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1194 1194
 
1195
-		// Create an instance of the UI service.
1196
-		$this->ui_service = new Wordlift_UI_Service();
1195
+        // Create an instance of the UI service.
1196
+        $this->ui_service = new Wordlift_UI_Service();
1197 1197
 
1198
-		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1199
-		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
1198
+        // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1199
+        $this->thumbnail_service = new Wordlift_Thumbnail_Service();
1200 1200
 
1201
-		$this->sparql_service        = new Wordlift_Sparql_Service();
1202
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1203
-		$this->notice_service        = new Wordlift_Notice_Service();
1204
-		$this->relation_service      = new Wordlift_Relation_Service();
1201
+        $this->sparql_service        = new Wordlift_Sparql_Service();
1202
+        $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1203
+        $this->notice_service        = new Wordlift_Notice_Service();
1204
+        $this->relation_service      = new Wordlift_Relation_Service();
1205 1205
 
1206
-		$entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1207
-		$this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' );
1208
-		$this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1209
-		$this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1210
-		$this->user_service       = new Wordlift_User_Service( $this->sparql_service, $this->entity_service );
1206
+        $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1207
+        $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' );
1208
+        $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1209
+        $this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1210
+        $this->user_service       = new Wordlift_User_Service( $this->sparql_service, $this->entity_service );
1211 1211
 
1212
-		// Instantiate the JSON-LD service.
1213
-		$property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1212
+        // Instantiate the JSON-LD service.
1213
+        $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1214 1214
 
1215
-		/** Linked Data. */
1216
-		$this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1217
-		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1215
+        /** Linked Data. */
1216
+        $this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1217
+        $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1218 1218
 
1219
-		$this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1219
+        $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1220 1220
 
1221
-		// Create a new instance of the Redirect service.
1222
-		$this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_uri_service );
1223
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1224
-		$this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
1221
+        // Create a new instance of the Redirect service.
1222
+        $this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_uri_service );
1223
+        $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1224
+        $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
1225 1225
 
1226
-		// Create a new instance of the Timeline service and Timeline shortcode.
1227
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1226
+        // Create a new instance of the Timeline service and Timeline shortcode.
1227
+        $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1228 1228
 
1229
-		$this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service );
1229
+        $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service );
1230 1230
 
1231
-		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1231
+        $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1232 1232
 
1233
-		$this->topic_taxonomy_service        = new Wordlift_Topic_Taxonomy_Service();
1234
-		$this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service();
1233
+        $this->topic_taxonomy_service        = new Wordlift_Topic_Taxonomy_Service();
1234
+        $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service();
1235 1235
 
1236
-		// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1237
-		$this->sharethis_service = new Wordlift_ShareThis_Service();
1236
+        // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1237
+        $this->sharethis_service = new Wordlift_ShareThis_Service();
1238 1238
 
1239
-		// Create an instance of the PrimaShop adapter.
1240
-		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1239
+        // Create an instance of the PrimaShop adapter.
1240
+        $this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1241 1241
 
1242
-		// Create an import service instance to hook later to WP's import function.
1243
-		$this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() );
1242
+        // Create an import service instance to hook later to WP's import function.
1243
+        $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() );
1244 1244
 
1245
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1245
+        $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1246 1246
 
1247
-		// Create the entity rating service.
1248
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1247
+        // Create the entity rating service.
1248
+        $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1249 1249
 
1250
-		// Create entity list customization (wp-admin/edit.php).
1251
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1250
+        // Create entity list customization (wp-admin/edit.php).
1251
+        $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1252 1252
 
1253
-		// Create a new instance of the Redirect service.
1254
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1253
+        // Create a new instance of the Redirect service.
1254
+        $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1255 1255
 
1256
-		// Create an instance of the Publisher Service and the AJAX Adapter.
1257
-		$this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service );
1258
-		$this->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1259
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1256
+        // Create an instance of the Publisher Service and the AJAX Adapter.
1257
+        $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service );
1258
+        $this->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1259
+        $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1260 1260
 
1261
-		$attachment_service = new Wordlift_Attachment_Service();
1261
+        $attachment_service = new Wordlift_Attachment_Service();
1262 1262
 
1263
-		// Instantiate the JSON-LD service.
1264
-		$property_getter                         = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1265
-		$this->entity_post_to_jsonld_converter   = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service );
1266
-		$this->post_to_jsonld_converter          = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1267
-		$this->postid_to_jsonld_converter        = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter );
1268
-		$this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1269
-		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service );
1270
-		$this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1271
-		new Jsonld_Endpoint( $this->jsonld_service, $this->entity_uri_service );
1263
+        // Instantiate the JSON-LD service.
1264
+        $property_getter                         = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1265
+        $this->entity_post_to_jsonld_converter   = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service );
1266
+        $this->post_to_jsonld_converter          = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1267
+        $this->postid_to_jsonld_converter        = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter );
1268
+        $this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1269
+        $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service );
1270
+        $this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1271
+        new Jsonld_Endpoint( $this->jsonld_service, $this->entity_uri_service );
1272 1272
 
1273
-		$this->key_validation_service    = new Wordlift_Key_Validation_Service( $this->configuration_service );
1274
-		$this->content_filter_service    = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1275
-		$this->relation_rebuild_service  = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1276
-		$this->sample_data_service       = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1277
-		$this->sample_data_ajax_adapter  = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1278
-		$this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service );
1273
+        $this->key_validation_service    = new Wordlift_Key_Validation_Service( $this->configuration_service );
1274
+        $this->content_filter_service    = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1275
+        $this->relation_rebuild_service  = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1276
+        $this->sample_data_service       = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1277
+        $this->sample_data_ajax_adapter  = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1278
+        $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service );
1279 1279
 
1280
-		// Initialize the short-codes.
1281
-		new Wordlift_Navigator_Shortcode();
1282
-		new Wordlift_Chord_Shortcode();
1283
-		new Wordlift_Geomap_Shortcode();
1284
-		new Wordlift_Timeline_Shortcode();
1285
-		new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1286
-		new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1287
-		new Wordlift_Faceted_Search_Shortcode();
1280
+        // Initialize the short-codes.
1281
+        new Wordlift_Navigator_Shortcode();
1282
+        new Wordlift_Chord_Shortcode();
1283
+        new Wordlift_Geomap_Shortcode();
1284
+        new Wordlift_Timeline_Shortcode();
1285
+        new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1286
+        new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1287
+        new Wordlift_Faceted_Search_Shortcode();
1288 1288
 
1289
-		// Initialize the SEO service.
1290
-		new Wordlift_Seo_Service();
1289
+        // Initialize the SEO service.
1290
+        new Wordlift_Seo_Service();
1291 1291
 
1292
-		// Initialize the AMP service.
1293
-		new Wordlift_AMP_Service( $this->jsonld_service );
1292
+        // Initialize the AMP service.
1293
+        new Wordlift_AMP_Service( $this->jsonld_service );
1294 1294
 
1295
-		/** Services. */
1296
-		$this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1297
-		new Wordlift_Image_Service();
1295
+        /** Services. */
1296
+        $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1297
+        new Wordlift_Image_Service();
1298 1298
 
1299
-		/** Adapters. */
1300
-		$this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1301
-		$this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service );
1302
-		$this->tinymce_adapter          = new Wordlift_Tinymce_Adapter( $this );
1303
-		$this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service );
1304
-		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1299
+        /** Adapters. */
1300
+        $this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1301
+        $this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service );
1302
+        $this->tinymce_adapter          = new Wordlift_Tinymce_Adapter( $this );
1303
+        $this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service );
1304
+        $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1305 1305
 
1306
-		/*
1306
+        /*
1307 1307
 		 * Exclude our public js from WP-Rocket.
1308 1308
 		 *
1309 1309
 		 * @since 3.19.4
1310 1310
 		 *
1311 1311
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/842.
1312 1312
 		 */
1313
-		new Wordlift_WpRocket_Adapter();
1314
-
1315
-		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
1316
-		$this->rebuild_service = new Wordlift_Rebuild_Service(
1317
-			$this->sparql_service,
1318
-			$uri_service
1319
-		);
1320
-
1321
-		/** Async Tasks. */
1322
-		new Wordlift_Sparql_Query_Async_Task();
1323
-		new Wordlift_Batch_Analysis_Request_Async_Task();
1324
-		new Wordlift_Batch_Analysis_Complete_Async_Task();
1325
-		new Wordlift_Push_References_Async_Task();
1326
-
1327
-		/** WL Autocomplete. */
1328
-		$autocomplete_service       = new All_Autocomplete_Service( array(
1329
-			new Local_Autocomplete_Service(),
1330
-			new Linked_Data_Autocomplete_Service( $this->configuration_service ),
1331
-		) );
1332
-		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service );
1333
-
1334
-		/** WordPress Admin UI. */
1335
-
1336
-		// UI elements.
1337
-		$this->input_element           = new Wordlift_Admin_Input_Element();
1338
-		$this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1339
-		$this->select2_element         = new Wordlift_Admin_Select2_Element();
1340
-		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1341
-		$this->country_select_element  = new Wordlift_Admin_Country_Select_Element();
1342
-		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1343
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element );
1344
-		$this->author_element          = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element );
1345
-
1346
-		$this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element );
1347
-		$this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service );
1348
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1349
-
1350
-		$this->analytics_settings_page             = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element );
1351
-		$this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page );
1352
-		$this->analytics_connect                   = new Wordlift_Analytics_Connect();
1353
-
1354
-		// Pages.
1355
-		/*
1313
+        new Wordlift_WpRocket_Adapter();
1314
+
1315
+        // Create a Rebuild Service instance, which we'll later bound to an ajax call.
1316
+        $this->rebuild_service = new Wordlift_Rebuild_Service(
1317
+            $this->sparql_service,
1318
+            $uri_service
1319
+        );
1320
+
1321
+        /** Async Tasks. */
1322
+        new Wordlift_Sparql_Query_Async_Task();
1323
+        new Wordlift_Batch_Analysis_Request_Async_Task();
1324
+        new Wordlift_Batch_Analysis_Complete_Async_Task();
1325
+        new Wordlift_Push_References_Async_Task();
1326
+
1327
+        /** WL Autocomplete. */
1328
+        $autocomplete_service       = new All_Autocomplete_Service( array(
1329
+            new Local_Autocomplete_Service(),
1330
+            new Linked_Data_Autocomplete_Service( $this->configuration_service ),
1331
+        ) );
1332
+        $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service );
1333
+
1334
+        /** WordPress Admin UI. */
1335
+
1336
+        // UI elements.
1337
+        $this->input_element           = new Wordlift_Admin_Input_Element();
1338
+        $this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1339
+        $this->select2_element         = new Wordlift_Admin_Select2_Element();
1340
+        $this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1341
+        $this->country_select_element  = new Wordlift_Admin_Country_Select_Element();
1342
+        $tabs_element                  = new Wordlift_Admin_Tabs_Element();
1343
+        $this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element );
1344
+        $this->author_element          = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element );
1345
+
1346
+        $this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element );
1347
+        $this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service );
1348
+        $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1349
+
1350
+        $this->analytics_settings_page             = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element );
1351
+        $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page );
1352
+        $this->analytics_connect                   = new Wordlift_Analytics_Connect();
1353
+
1354
+        // Pages.
1355
+        /*
1356 1356
 		 * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box.
1357 1357
 		 *
1358 1358
 		 * @since 3.20.3
1359 1359
 		 *
1360 1360
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/914
1361 1361
 		 */
1362
-		if ( apply_filters( 'wl_can_see_classification_box', true ) ) {
1363
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1364
-			new Wordlift_Admin_Post_Edit_Page( $this );
1365
-		}
1366
-		new Wordlift_Entity_Type_Admin_Service();
1362
+        if ( apply_filters( 'wl_can_see_classification_box', true ) ) {
1363
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1364
+            new Wordlift_Admin_Post_Edit_Page( $this );
1365
+        }
1366
+        new Wordlift_Entity_Type_Admin_Service();
1367 1367
 
1368
-		// create an instance of the entity type list admin page controller.
1369
-		$this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1368
+        // create an instance of the entity type list admin page controller.
1369
+        $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1370 1370
 
1371
-		// create an instance of the entity type setting admin page controller.
1372
-		$this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1371
+        // create an instance of the entity type setting admin page controller.
1372
+        $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1373 1373
 
1374
-		/** Widgets */
1375
-		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1374
+        /** Widgets */
1375
+        $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1376 1376
 
1377
-		/* WordPress Admin. */
1378
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1379
-		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1377
+        /* WordPress Admin. */
1378
+        $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1379
+        $this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1380 1380
 
1381
-		// Create an instance of the install wizard.
1382
-		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element );
1381
+        // Create an instance of the install wizard.
1382
+        $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element );
1383 1383
 
1384
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1384
+        $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1385 1385
 
1386
-		// User Profile.
1387
-		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1386
+        // User Profile.
1387
+        new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1388 1388
 
1389
-		$this->entity_page_service = new Wordlift_Entity_Page_Service();
1389
+        $this->entity_page_service = new Wordlift_Entity_Page_Service();
1390 1390
 
1391
-		// Load the debug service if WP is in debug mode.
1392
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1393
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1394
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1395
-		}
1391
+        // Load the debug service if WP is in debug mode.
1392
+        if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1393
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1394
+            new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1395
+        }
1396 1396
 
1397
-		// Remote Image Service.
1398
-		new Wordlift_Remote_Image_Service();
1397
+        // Remote Image Service.
1398
+        new Wordlift_Remote_Image_Service();
1399 1399
 
1400
-		/*
1400
+        /*
1401 1401
 		 * Provides mappings between post types and entity types.
1402 1402
 		 *
1403 1403
 		 * @since 3.20.0
1404 1404
 		 *
1405 1405
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/852.
1406 1406
 		 */
1407
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php';
1408
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php';
1409
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php';
1407
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php';
1408
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php';
1409
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php';
1410 1410
 
1411
-		// Create an instance of the Mapping Service and assign it to the Ajax Adapter.
1412
-		new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) );
1411
+        // Create an instance of the Mapping Service and assign it to the Ajax Adapter.
1412
+        new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) );
1413 1413
 
1414
-		/*
1414
+        /*
1415 1415
 		 * Batch Operations. They're similar to Batch Actions but do not require working on post types.
1416 1416
 		 *
1417 1417
 		 * Eventually Batch Actions will become Batch Operations.
1418 1418
 		 *
1419 1419
 		 * @since 3.20.0
1420 1420
 		 */
1421
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php';
1422
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php';
1421
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php';
1422
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php';
1423 1423
 
1424
-		/*
1424
+        /*
1425 1425
 		 * Add the Search Keywords taxonomy to manage the Search Keywords on WLS.
1426 1426
 		 *
1427 1427
 		 * @link https://github.com/insideout10/wordlift-plugin/issues/761
1428 1428
 		 *
1429 1429
 		 * @since 3.20.0
1430 1430
 		 */
1431
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php';
1432
-		new Wordlift_Search_Keyword_Taxonomy( $api_service );
1431
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php';
1432
+        new Wordlift_Search_Keyword_Taxonomy( $api_service );
1433 1433
 
1434
-		/*
1434
+        /*
1435 1435
 		 * Load dependencies for the front-end.
1436 1436
 		 *
1437 1437
 		 * @since 3.20.0
1438 1438
 		 */
1439
-		if ( ! is_admin() ) {
1440
-			/*
1439
+        if ( ! is_admin() ) {
1440
+            /*
1441 1441
 			 * Load the `Wordlift_Term_JsonLd_Adapter`.
1442 1442
 			 *
1443 1443
 			 * @see https://github.com/insideout10/wordlift-plugin/issues/892
1444 1444
 			 *
1445 1445
 			 * @since 3.20.0
1446 1446
 			 */
1447
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php';
1448
-			new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service );
1449
-		}
1447
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php';
1448
+            new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service );
1449
+        }
1450 1450
 
1451
-		/*
1451
+        /*
1452 1452
 		 * Initialize the Context Cards Service
1453 1453
 		 *
1454 1454
 		 * @link https://github.com/insideout10/wordlift-plugin/issues/934
1455 1455
 		 *
1456 1456
 		 * @since 3.22.0
1457 1457
 		 */
1458
-		$this->context_cards_service = new Wordlift_Context_Cards_Service();
1459
-
1460
-	}
1461
-
1462
-	/**
1463
-	 * Define the locale for this plugin for internationalization.
1464
-	 *
1465
-	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1466
-	 * with WordPress.
1467
-	 *
1468
-	 * @since    1.0.0
1469
-	 * @access   private
1470
-	 */
1471
-	private function set_locale() {
1472
-
1473
-		$plugin_i18n = new Wordlift_i18n();
1474
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1475
-
1476
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1477
-
1478
-	}
1479
-
1480
-	/**
1481
-	 * Register all of the hooks related to the admin area functionality
1482
-	 * of the plugin.
1483
-	 *
1484
-	 * @since    1.0.0
1485
-	 * @access   private
1486
-	 */
1487
-	private function define_admin_hooks() {
1488
-
1489
-		$plugin_admin = new Wordlift_Admin(
1490
-			$this->get_plugin_name(),
1491
-			$this->get_version(),
1492
-			$this->configuration_service,
1493
-			$this->notice_service,
1494
-			$this->user_service
1495
-		);
1496
-
1497
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1498
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 );
1499
-
1500
-		// Hook the init action to taxonomy services.
1501
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1502
-		$this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 );
1503
-
1504
-		// Hook the deleted_post_meta action to the Thumbnail service.
1505
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1506
-
1507
-		// Hook the added_post_meta action to the Thumbnail service.
1508
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1509
-
1510
-		// Hook the updated_post_meta action to the Thumbnail service.
1511
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1512
-
1513
-		// Hook the AJAX wl_timeline action to the Timeline service.
1514
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1515
-
1516
-		// Register custom allowed redirect hosts.
1517
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1518
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1519
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1520
-
1521
-		/*
1458
+        $this->context_cards_service = new Wordlift_Context_Cards_Service();
1459
+
1460
+    }
1461
+
1462
+    /**
1463
+     * Define the locale for this plugin for internationalization.
1464
+     *
1465
+     * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1466
+     * with WordPress.
1467
+     *
1468
+     * @since    1.0.0
1469
+     * @access   private
1470
+     */
1471
+    private function set_locale() {
1472
+
1473
+        $plugin_i18n = new Wordlift_i18n();
1474
+        $plugin_i18n->set_domain( $this->get_plugin_name() );
1475
+
1476
+        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1477
+
1478
+    }
1479
+
1480
+    /**
1481
+     * Register all of the hooks related to the admin area functionality
1482
+     * of the plugin.
1483
+     *
1484
+     * @since    1.0.0
1485
+     * @access   private
1486
+     */
1487
+    private function define_admin_hooks() {
1488
+
1489
+        $plugin_admin = new Wordlift_Admin(
1490
+            $this->get_plugin_name(),
1491
+            $this->get_version(),
1492
+            $this->configuration_service,
1493
+            $this->notice_service,
1494
+            $this->user_service
1495
+        );
1496
+
1497
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1498
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 );
1499
+
1500
+        // Hook the init action to taxonomy services.
1501
+        $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1502
+        $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 );
1503
+
1504
+        // Hook the deleted_post_meta action to the Thumbnail service.
1505
+        $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1506
+
1507
+        // Hook the added_post_meta action to the Thumbnail service.
1508
+        $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1509
+
1510
+        // Hook the updated_post_meta action to the Thumbnail service.
1511
+        $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1512
+
1513
+        // Hook the AJAX wl_timeline action to the Timeline service.
1514
+        $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1515
+
1516
+        // Register custom allowed redirect hosts.
1517
+        $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1518
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1519
+        $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1520
+
1521
+        /*
1522 1522
 		 * The old dashboard is replaced with dashboard v2.
1523 1523
 		 *
1524 1524
 		 * The old dashboard service is still loaded because its functions are used.
@@ -1527,314 +1527,314 @@  discard block
 block discarded – undo
1527 1527
 		 *
1528 1528
 		 * @since 3.20.0
1529 1529
 		 */
1530
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1531
-		// $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1532
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1533
-		// $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1534
-
1535
-		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1536
-		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1537
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1538
-		$this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1539
-
1540
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1541
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1542
-
1543
-		// Entity listing customization (wp-admin/edit.php)
1544
-		// Add custom columns.
1545
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1546
-		// no explicit entity as it prevents handling of other post types.
1547
-		$this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1548
-		// Add 4W selection.
1549
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1550
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1551
-		$this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1552
-		$this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1553
-
1554
-		/*
1530
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1531
+        // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1532
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1533
+        // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1534
+
1535
+        // Hook save_post to the entity service to update custom fields (such as alternate labels).
1536
+        // We have a priority of 9 because we want to be executed before data is sent to Redlink.
1537
+        $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1538
+        $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1539
+
1540
+        $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1541
+        $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1542
+
1543
+        // Entity listing customization (wp-admin/edit.php)
1544
+        // Add custom columns.
1545
+        $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1546
+        // no explicit entity as it prevents handling of other post types.
1547
+        $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1548
+        // Add 4W selection.
1549
+        $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1550
+        $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1551
+        $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1552
+        $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1553
+
1554
+        /*
1555 1555
 		 * If `All Entity Types` is disable, use the radio button Walker.
1556 1556
 		 *
1557 1557
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1558 1558
 		 */
1559
-		if ( ! WL_ALL_ENTITY_TYPES ) {
1560
-			$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1561
-		}
1559
+        if ( ! WL_ALL_ENTITY_TYPES ) {
1560
+            $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1561
+        }
1562 1562
 
1563
-		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1564
-		// entities.
1565
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1563
+        // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1564
+        // entities.
1565
+        $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1566 1566
 
1567
-		// Filter imported post meta.
1568
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1567
+        // Filter imported post meta.
1568
+        $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1569 1569
 
1570
-		// Notify the import service when an import starts and ends.
1571
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1572
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1570
+        // Notify the import service when an import starts and ends.
1571
+        $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1572
+        $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1573 1573
 
1574
-		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1575
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1576
-		$this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' );
1574
+        // Hook the AJAX wl_rebuild action to the Rebuild Service.
1575
+        $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1576
+        $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' );
1577 1577
 
1578
-		// Hook the menu to the Download Your Data page.
1579
-		$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1580
-		$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1581
-		$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1578
+        // Hook the menu to the Download Your Data page.
1579
+        $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1580
+        $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1581
+        $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1582 1582
 
1583
-		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1584
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1583
+        // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1584
+        $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1585 1585
 
1586
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1587
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1588
-		$this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' );
1589
-		$this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1586
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1587
+        $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1588
+        $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' );
1589
+        $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1590 1590
 
1591
-		// Hook the AJAX wl_validate_key action to the Key Validation service.
1592
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1591
+        // Hook the AJAX wl_validate_key action to the Key Validation service.
1592
+        $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1593 1593
 
1594
-		// Hook the AJAX wl_update_country_options action to the countries.
1595
-		$this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' );
1594
+        // Hook the AJAX wl_update_country_options action to the countries.
1595
+        $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' );
1596 1596
 
1597
-		// Hook the `admin_init` function to the Admin Setup.
1598
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1597
+        // Hook the `admin_init` function to the Admin Setup.
1598
+        $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1599 1599
 
1600
-		// Hook the admin_init to the settings page.
1601
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1602
-		$this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' );
1600
+        // Hook the admin_init to the settings page.
1601
+        $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1602
+        $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' );
1603 1603
 
1604
-		$this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' );
1604
+        $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' );
1605 1605
 
1606
-		// Hook the menu creation on the general wordlift menu creation.
1607
-		$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1608
-		if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) {
1609
-			// Add the functionality only if a flag is set in wp-config.php .
1610
-			$this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 );
1611
-		}
1606
+        // Hook the menu creation on the general wordlift menu creation.
1607
+        $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1608
+        if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) {
1609
+            // Add the functionality only if a flag is set in wp-config.php .
1610
+            $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 );
1611
+        }
1612 1612
 
1613
-		/*
1613
+        /*
1614 1614
 		 * Display the `Wordlift_Admin_Search_Rankings_Page` page.
1615 1615
 		 *
1616 1616
 		 * @link https://github.com/insideout10/wordlift-plugin/issues/761
1617 1617
 		 *
1618 1618
 		 * @since 3.20.0
1619 1619
 		 */
1620
-		if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) {
1621
-			$admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page();
1622
-			$this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' );
1623
-		}
1620
+        if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) {
1621
+            $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page();
1622
+            $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' );
1623
+        }
1624 1624
 
1625
-		// Hook key update.
1626
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1627
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1625
+        // Hook key update.
1626
+        $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1627
+        $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1628 1628
 
1629
-		// Add additional action links to the WordLift plugin in the plugins page.
1630
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1629
+        // Add additional action links to the WordLift plugin in the plugins page.
1630
+        $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1631 1631
 
1632
-		/*
1632
+        /*
1633 1633
 		 * Remove the Analytics Settings link from the plugin page.
1634 1634
 		 *
1635 1635
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/932
1636 1636
 		 * @since 3.21.1
1637 1637
 		 */
1638
-		// $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 );
1639
-
1640
-		// Hook the AJAX `wl_publisher` action name.
1641
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1642
-
1643
-		// Hook row actions for the entity type list admin.
1644
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1645
-
1646
-		/** Ajax actions. */
1647
-		$this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1648
-
1649
-		// Hook capabilities manipulation to allow access to entity type admin
1650
-		// page  on WordPress versions before 4.7.
1651
-		global $wp_version;
1652
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1653
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1654
-		}
1655
-
1656
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1657
-
1658
-		/** Adapters. */
1659
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1660
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' );
1661
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' );
1662
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' );
1663
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' );
1664
-		$this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1665
-
1666
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1667
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1668
-
1669
-
1670
-		$this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 );
1671
-		$this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 );
1672
-
1673
-		// Handle the autocomplete request.
1674
-		add_action( 'wp_ajax_wl_autocomplete', array(
1675
-			$this->autocomplete_adapter,
1676
-			'wl_autocomplete',
1677
-		) );
1678
-		add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1679
-			$this->autocomplete_adapter,
1680
-			'wl_autocomplete',
1681
-		) );
1682
-
1683
-		// Hooks to restrict multisite super admin from manipulating entity types.
1684
-		if ( is_multisite() ) {
1685
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1686
-		}
1687
-
1688
-		$deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service );
1689
-
1690
-		add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1691
-		add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1692
-		add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) );
1693
-
1694
-		/**
1695
-		 * Always allow the `wordlift/classification` block.
1696
-		 *
1697
-		 * @since 3.23.0
1698
-		 */
1699
-		add_filter( 'allowed_block_types', function ( $value ) {
1700
-
1701
-			if ( true === $value ) {
1702
-				return $value;
1703
-			}
1704
-
1705
-			return array_merge( (array) $value, array( 'wordlift/classification' ) );
1706
-		}, PHP_INT_MAX );
1707
-
1708
-	}
1709
-
1710
-	/**
1711
-	 * Register all of the hooks related to the public-facing functionality
1712
-	 * of the plugin.
1713
-	 *
1714
-	 * @since    1.0.0
1715
-	 * @access   private
1716
-	 */
1717
-	private function define_public_hooks() {
1718
-
1719
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1720
-
1721
-		// Register the entity post type.
1722
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1723
-
1724
-		// Bind the link generation and handling hooks to the entity link service.
1725
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1726
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1727
-		$this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 );
1728
-		$this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 );
1729
-
1730
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1731
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1732
-		$this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' );
1733
-
1734
-		// Hook the content filter service to add entity links.
1735
-		if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1736
-			$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1737
-		}
1738
-
1739
-		// Hook the AJAX wl_timeline action to the Timeline service.
1740
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1741
-
1742
-		// Hook the ShareThis service.
1743
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1744
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1745
-
1746
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1747
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1748
-
1749
-		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1750
-		// in order to tweak WP's `WP_Query` to include entities in queries related
1751
-		// to categories.
1752
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1638
+        // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 );
1639
+
1640
+        // Hook the AJAX `wl_publisher` action name.
1641
+        $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1642
+
1643
+        // Hook row actions for the entity type list admin.
1644
+        $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1645
+
1646
+        /** Ajax actions. */
1647
+        $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1753 1648
 
1754
-		/*
1649
+        // Hook capabilities manipulation to allow access to entity type admin
1650
+        // page  on WordPress versions before 4.7.
1651
+        global $wp_version;
1652
+        if ( version_compare( $wp_version, '4.7', '<' ) ) {
1653
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1654
+        }
1655
+
1656
+        $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1657
+
1658
+        /** Adapters. */
1659
+        $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1660
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' );
1661
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' );
1662
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' );
1663
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' );
1664
+        $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1665
+
1666
+        $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1667
+        $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1668
+
1669
+
1670
+        $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 );
1671
+        $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 );
1672
+
1673
+        // Handle the autocomplete request.
1674
+        add_action( 'wp_ajax_wl_autocomplete', array(
1675
+            $this->autocomplete_adapter,
1676
+            'wl_autocomplete',
1677
+        ) );
1678
+        add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1679
+            $this->autocomplete_adapter,
1680
+            'wl_autocomplete',
1681
+        ) );
1682
+
1683
+        // Hooks to restrict multisite super admin from manipulating entity types.
1684
+        if ( is_multisite() ) {
1685
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1686
+        }
1687
+
1688
+        $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service );
1689
+
1690
+        add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1691
+        add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1692
+        add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) );
1693
+
1694
+        /**
1695
+         * Always allow the `wordlift/classification` block.
1696
+         *
1697
+         * @since 3.23.0
1698
+         */
1699
+        add_filter( 'allowed_block_types', function ( $value ) {
1700
+
1701
+            if ( true === $value ) {
1702
+                return $value;
1703
+            }
1704
+
1705
+            return array_merge( (array) $value, array( 'wordlift/classification' ) );
1706
+        }, PHP_INT_MAX );
1707
+
1708
+    }
1709
+
1710
+    /**
1711
+     * Register all of the hooks related to the public-facing functionality
1712
+     * of the plugin.
1713
+     *
1714
+     * @since    1.0.0
1715
+     * @access   private
1716
+     */
1717
+    private function define_public_hooks() {
1718
+
1719
+        $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1720
+
1721
+        // Register the entity post type.
1722
+        $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1723
+
1724
+        // Bind the link generation and handling hooks to the entity link service.
1725
+        $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1726
+        $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1727
+        $this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 );
1728
+        $this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 );
1729
+
1730
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1731
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1732
+        $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' );
1733
+
1734
+        // Hook the content filter service to add entity links.
1735
+        if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1736
+            $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1737
+        }
1738
+
1739
+        // Hook the AJAX wl_timeline action to the Timeline service.
1740
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1741
+
1742
+        // Hook the ShareThis service.
1743
+        $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1744
+        $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1745
+
1746
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1747
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1748
+
1749
+        // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1750
+        // in order to tweak WP's `WP_Query` to include entities in queries related
1751
+        // to categories.
1752
+        $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1753
+
1754
+        /*
1755 1755
 		 * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service`
1756 1756
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1757 1757
 		 * order of start time.
1758 1758
 		 */
1759
-		$this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1760
-
1761
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1762
-
1763
-		// This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1764
-		$this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1765
-
1766
-		// Analytics Script Frontend.
1767
-		if ( $this->configuration_service->is_analytics_enable() ) {
1768
-			$this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 );
1769
-		}
1770
-
1771
-	}
1772
-
1773
-	/**
1774
-	 * Run the loader to execute all of the hooks with WordPress.
1775
-	 *
1776
-	 * @since    1.0.0
1777
-	 */
1778
-	public function run() {
1779
-		$this->loader->run();
1780
-	}
1781
-
1782
-	/**
1783
-	 * The name of the plugin used to uniquely identify it within the context of
1784
-	 * WordPress and to define internationalization functionality.
1785
-	 *
1786
-	 * @return    string    The name of the plugin.
1787
-	 * @since     1.0.0
1788
-	 */
1789
-	public function get_plugin_name() {
1790
-		return $this->plugin_name;
1791
-	}
1792
-
1793
-	/**
1794
-	 * The reference to the class that orchestrates the hooks with the plugin.
1795
-	 *
1796
-	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1797
-	 * @since     1.0.0
1798
-	 */
1799
-	public function get_loader() {
1800
-		return $this->loader;
1801
-	}
1802
-
1803
-	/**
1804
-	 * Retrieve the version number of the plugin.
1805
-	 *
1806
-	 * @return    string    The version number of the plugin.
1807
-	 * @since     1.0.0
1808
-	 */
1809
-	public function get_version() {
1810
-		return $this->version;
1811
-	}
1812
-
1813
-	/**
1814
-	 * Load dependencies for WP-CLI.
1815
-	 *
1816
-	 * @throws Exception
1817
-	 * @since 3.18.0
1818
-	 */
1819
-	private function load_cli_dependencies() {
1820
-
1821
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php';
1822
-
1823
-		$push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service );
1824
-
1825
-		WP_CLI::add_command( 'wl references push', $push_reference_data_command );
1826
-
1827
-	}
1828
-
1829
-	/**
1830
-	 * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions.
1831
-	 *
1832
-	 * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance.
1833
-	 * @since 3.20.0
1834
-	 */
1835
-	public function get_dashboard_service() {
1836
-
1837
-		return $this->dashboard_service;
1838
-	}
1759
+        $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1760
+
1761
+        $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1762
+
1763
+        // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1764
+        $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1765
+
1766
+        // Analytics Script Frontend.
1767
+        if ( $this->configuration_service->is_analytics_enable() ) {
1768
+            $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 );
1769
+        }
1770
+
1771
+    }
1772
+
1773
+    /**
1774
+     * Run the loader to execute all of the hooks with WordPress.
1775
+     *
1776
+     * @since    1.0.0
1777
+     */
1778
+    public function run() {
1779
+        $this->loader->run();
1780
+    }
1781
+
1782
+    /**
1783
+     * The name of the plugin used to uniquely identify it within the context of
1784
+     * WordPress and to define internationalization functionality.
1785
+     *
1786
+     * @return    string    The name of the plugin.
1787
+     * @since     1.0.0
1788
+     */
1789
+    public function get_plugin_name() {
1790
+        return $this->plugin_name;
1791
+    }
1792
+
1793
+    /**
1794
+     * The reference to the class that orchestrates the hooks with the plugin.
1795
+     *
1796
+     * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1797
+     * @since     1.0.0
1798
+     */
1799
+    public function get_loader() {
1800
+        return $this->loader;
1801
+    }
1802
+
1803
+    /**
1804
+     * Retrieve the version number of the plugin.
1805
+     *
1806
+     * @return    string    The version number of the plugin.
1807
+     * @since     1.0.0
1808
+     */
1809
+    public function get_version() {
1810
+        return $this->version;
1811
+    }
1812
+
1813
+    /**
1814
+     * Load dependencies for WP-CLI.
1815
+     *
1816
+     * @throws Exception
1817
+     * @since 3.18.0
1818
+     */
1819
+    private function load_cli_dependencies() {
1820
+
1821
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php';
1822
+
1823
+        $push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service );
1824
+
1825
+        WP_CLI::add_command( 'wl references push', $push_reference_data_command );
1826
+
1827
+    }
1828
+
1829
+    /**
1830
+     * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions.
1831
+     *
1832
+     * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance.
1833
+     * @since 3.20.0
1834
+     */
1835
+    public function get_dashboard_service() {
1836
+
1837
+        return $this->dashboard_service;
1838
+    }
1839 1839
 
1840 1840
 }
Please login to merge, or discard this patch.
src/includes/class-wordlift-entity-service.php 2 patches
Indentation   +573 added lines, -573 removed lines patch added patch discarded remove patch
@@ -16,497 +16,497 @@  discard block
 block discarded – undo
16 16
  */
17 17
 class Wordlift_Entity_Service {
18 18
 
19
-	/**
20
-	 * The Log service.
21
-	 *
22
-	 * @since  3.2.0
23
-	 * @access private
24
-	 * @var \Wordlift_Log_Service $log The Log service.
25
-	 */
26
-	private $log;
27
-
28
-	/**
29
-	 * The UI service.
30
-	 *
31
-	 * @since  3.2.0
32
-	 * @access private
33
-	 * @var \Wordlift_UI_Service $ui_service The UI service.
34
-	 */
35
-	private $ui_service;
36
-
37
-	/**
38
-	 * The {@link Wordlift_Relation_Service} instance.
39
-	 *
40
-	 * @since  3.15.0
41
-	 * @access private
42
-	 * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
43
-	 */
44
-	private $relation_service;
45
-
46
-	/**
47
-	 * The {@link Wordlift_Entity_Uri_Service} instance.
48
-	 *
49
-	 * @since  3.16.3
50
-	 * @access private
51
-	 * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
52
-	 */
53
-	private $entity_uri_service;
54
-
55
-	/**
56
-	 * The entity post type name.
57
-	 *
58
-	 * @since 3.1.0
59
-	 */
60
-	const TYPE_NAME = 'entity';
61
-
62
-	/**
63
-	 * The alternative label meta key.
64
-	 *
65
-	 * @since 3.2.0
66
-	 */
67
-	const ALTERNATIVE_LABEL_META_KEY = '_wl_alt_label';
68
-
69
-	/**
70
-	 * The alternative label input template.
71
-	 *
72
-	 * @since 3.2.0
73
-	 */
74
-	// TODO: this should be moved to a class that deals with HTML code.
75
-	const ALTERNATIVE_LABEL_INPUT_TEMPLATE = '<div class="wl-alternative-label">
19
+    /**
20
+     * The Log service.
21
+     *
22
+     * @since  3.2.0
23
+     * @access private
24
+     * @var \Wordlift_Log_Service $log The Log service.
25
+     */
26
+    private $log;
27
+
28
+    /**
29
+     * The UI service.
30
+     *
31
+     * @since  3.2.0
32
+     * @access private
33
+     * @var \Wordlift_UI_Service $ui_service The UI service.
34
+     */
35
+    private $ui_service;
36
+
37
+    /**
38
+     * The {@link Wordlift_Relation_Service} instance.
39
+     *
40
+     * @since  3.15.0
41
+     * @access private
42
+     * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
43
+     */
44
+    private $relation_service;
45
+
46
+    /**
47
+     * The {@link Wordlift_Entity_Uri_Service} instance.
48
+     *
49
+     * @since  3.16.3
50
+     * @access private
51
+     * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
52
+     */
53
+    private $entity_uri_service;
54
+
55
+    /**
56
+     * The entity post type name.
57
+     *
58
+     * @since 3.1.0
59
+     */
60
+    const TYPE_NAME = 'entity';
61
+
62
+    /**
63
+     * The alternative label meta key.
64
+     *
65
+     * @since 3.2.0
66
+     */
67
+    const ALTERNATIVE_LABEL_META_KEY = '_wl_alt_label';
68
+
69
+    /**
70
+     * The alternative label input template.
71
+     *
72
+     * @since 3.2.0
73
+     */
74
+    // TODO: this should be moved to a class that deals with HTML code.
75
+    const ALTERNATIVE_LABEL_INPUT_TEMPLATE = '<div class="wl-alternative-label">
76 76
                 <label class="screen-reader-text" id="wl-alternative-label-prompt-text" for="wl-alternative-label">Enter alternative label here</label>
77 77
                 <input name="wl_alternative_label[]" size="30" value="%s" id="wl-alternative-label" type="text">
78 78
                 <button class="button wl-delete-button">%s</button>
79 79
                 </div>';
80 80
 
81
-	/**
82
-	 * A singleton instance of the Entity service.
83
-	 *
84
-	 * @since  3.2.0
85
-	 * @access private
86
-	 * @var \Wordlift_Entity_Service $instance A singleton instance of the Entity service.
87
-	 */
88
-	private static $instance;
89
-
90
-	/**
91
-	 * Create a Wordlift_Entity_Service instance.
92
-	 *
93
-	 * @param \Wordlift_UI_Service $ui_service The UI service.
94
-	 * @param \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
95
-	 * @param \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
96
-	 *
97
-	 * @since 3.2.0
98
-	 *
99
-	 */
100
-	public function __construct( $ui_service, $relation_service, $entity_uri_service ) {
101
-
102
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' );
103
-
104
-		$this->ui_service         = $ui_service;
105
-		$this->relation_service   = $relation_service;
106
-		$this->entity_uri_service = $entity_uri_service;
107
-
108
-		// Set the singleton instance.
109
-		self::$instance = $this;
110
-	}
111
-
112
-	/**
113
-	 * Get the singleton instance of the Entity service.
114
-	 *
115
-	 * @return \Wordlift_Entity_Service The singleton instance of the Entity service.
116
-	 * @since 3.2.0
117
-	 */
118
-	public static function get_instance() {
119
-
120
-		return self::$instance;
121
-	}
122
-
123
-	/**
124
-	 * Determines whether a post is an entity or not. Entity is in this context
125
-	 * something which is not an article.
126
-	 *
127
-	 * @param int $post_id A post id.
128
-	 *
129
-	 * @return bool Return true if the post is an entity otherwise false.
130
-	 * @since 3.1.0
131
-	 *
132
-	 */
133
-	public function is_entity( $post_id ) {
134
-
135
-		$terms = wp_get_object_terms( $post_id, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
136
-
137
-		if ( is_wp_error( $terms ) ) {
138
-			$this->log->error( "Cannot get the terms for post $post_id: " . $terms->get_error_message() );
139
-
140
-			return false;
141
-		}
142
-
143
-		if ( empty( $terms ) ) {
144
-			return false;
145
-		}
146
-
147
-		/*
81
+    /**
82
+     * A singleton instance of the Entity service.
83
+     *
84
+     * @since  3.2.0
85
+     * @access private
86
+     * @var \Wordlift_Entity_Service $instance A singleton instance of the Entity service.
87
+     */
88
+    private static $instance;
89
+
90
+    /**
91
+     * Create a Wordlift_Entity_Service instance.
92
+     *
93
+     * @param \Wordlift_UI_Service $ui_service The UI service.
94
+     * @param \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
95
+     * @param \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
96
+     *
97
+     * @since 3.2.0
98
+     *
99
+     */
100
+    public function __construct( $ui_service, $relation_service, $entity_uri_service ) {
101
+
102
+        $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' );
103
+
104
+        $this->ui_service         = $ui_service;
105
+        $this->relation_service   = $relation_service;
106
+        $this->entity_uri_service = $entity_uri_service;
107
+
108
+        // Set the singleton instance.
109
+        self::$instance = $this;
110
+    }
111
+
112
+    /**
113
+     * Get the singleton instance of the Entity service.
114
+     *
115
+     * @return \Wordlift_Entity_Service The singleton instance of the Entity service.
116
+     * @since 3.2.0
117
+     */
118
+    public static function get_instance() {
119
+
120
+        return self::$instance;
121
+    }
122
+
123
+    /**
124
+     * Determines whether a post is an entity or not. Entity is in this context
125
+     * something which is not an article.
126
+     *
127
+     * @param int $post_id A post id.
128
+     *
129
+     * @return bool Return true if the post is an entity otherwise false.
130
+     * @since 3.1.0
131
+     *
132
+     */
133
+    public function is_entity( $post_id ) {
134
+
135
+        $terms = wp_get_object_terms( $post_id, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
136
+
137
+        if ( is_wp_error( $terms ) ) {
138
+            $this->log->error( "Cannot get the terms for post $post_id: " . $terms->get_error_message() );
139
+
140
+            return false;
141
+        }
142
+
143
+        if ( empty( $terms ) ) {
144
+            return false;
145
+        }
146
+
147
+        /*
148 148
 		 * We don't consider an `article` to be an entity.
149 149
 		 *
150 150
 		 * @since 3.20.0 At least one associated mustn't be an `article`.
151 151
 		 *
152 152
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
153 153
 		 */
154
-		foreach ( $terms as $term ) {
155
-			if ( 'article' !== $term->slug ) {
156
-				return true;
157
-			}
158
-		}
159
-
160
-		return false;
161
-	}
162
-
163
-	/**
164
-	 * Get the proper classification scope for a given entity post
165
-	 *
166
-	 * @param integer $post_id An entity post id.
167
-	 *
168
-	 * @param string $default The default classification scope, `what` if not
169
-	 *                         provided.
170
-	 *
171
-	 * @return string Returns a classification scope (e.g. 'what').
172
-	 * @since 3.5.0
173
-	 *
174
-	 */
175
-	public function get_classification_scope_for( $post_id, $default = WL_WHAT_RELATION ) {
176
-
177
-		if ( false === $this->is_entity( $post_id ) ) {
178
-			return $default;
179
-		}
180
-
181
-		// Retrieve the entity type
182
-		$entity_type_arr = Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
183
-		$entity_type     = str_replace( 'wl-', '', $entity_type_arr['css_class'] );
184
-		// Retrieve classification boxes configuration
185
-		$classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES );
186
-		foreach ( $classification_boxes as $cb ) {
187
-			if ( in_array( $entity_type, $cb['registeredTypes'] ) ) {
188
-				return $cb['id'];
189
-			}
190
-		}
191
-
192
-		return $default;
193
-	}
194
-
195
-	/**
196
-	 * Check whether a {@link WP_Post} is used.
197
-	 *
198
-	 * @param int $post_id The {@link WP_Post}'s id.
199
-	 *
200
-	 * @return bool|null Null if it's not an entity, otherwise true if it's used.
201
-	 */
202
-	public function is_used( $post_id ) {
203
-
204
-		if ( false === $this->is_entity( $post_id ) ) {
205
-			return null;
206
-		}
207
-		// Retrieve the post
208
-		$entity = get_post( $post_id );
209
-
210
-		global $wpdb;
211
-		// Retrieve Wordlift relation instances table name
212
-		$table_name = wl_core_get_relation_instances_table_name();
213
-
214
-		// Check is it's referenced / related to another post / entity
215
-		$stmt = $wpdb->prepare(
216
-			"SELECT COUNT(*) FROM $table_name WHERE  object_id = %d",
217
-			$entity->ID
218
-		);
219
-
220
-		// Perform the query
221
-		$relation_instances = (int) $wpdb->get_var( $stmt );
222
-		// If there is at least one relation instance for the current entity, then it's used
223
-		if ( 0 < $relation_instances ) {
224
-			return true;
225
-		}
226
-
227
-		// Check if the entity uri is used as meta_value
228
-		$stmt = $wpdb->prepare(
229
-			"SELECT COUNT(*) FROM $wpdb->postmeta WHERE post_id != %d AND meta_value = %s",
230
-			$entity->ID,
231
-			wl_get_entity_uri( $entity->ID )
232
-		);
233
-		// Perform the query
234
-		$meta_instances = (int) $wpdb->get_var( $stmt );
235
-
236
-		// If there is at least one meta that refers the current entity uri, then current entity is used
237
-		if ( 0 < $meta_instances ) {
238
-			return true;
239
-		}
240
-
241
-		// If we are here, it means the current entity is not used at the moment
242
-		return false;
243
-	}
244
-
245
-	/**
246
-	 * Find entity posts by the entity URI. Entity as searched by their entity URI or same as.
247
-	 *
248
-	 * @param string $uri The entity URI.
249
-	 *
250
-	 * @return WP_Post|null A WP_Post instance or null if not found.
251
-	 * @deprecated in favor of Wordlift_Entity_Uri_Service->get_entity( $uri );
252
-	 *
253
-	 * @since      3.16.3 deprecated in favor of Wordlift_Entity_Uri_Service->get_entity( $uri );
254
-	 * @since      3.2.0
255
-	 *
256
-	 */
257
-	public function get_entity_post_by_uri( $uri ) {
258
-
259
-		return $this->entity_uri_service->get_entity( $uri );
260
-	}
261
-
262
-	/**
263
-	 * Fires once a post has been saved. This function uses the $_REQUEST, therefore
264
-	 * we check that the post we're saving is the current post.
265
-	 *
266
-	 * @see   https://github.com/insideout10/wordlift-plugin/issues/363
267
-	 *
268
-	 * @since 3.2.0
269
-	 *
270
-	 * @param int $post_id Post ID.
271
-	 * @param WP_Post $post Post object.
272
-	 * @param bool $update Whether this is an existing post being updated or not.
273
-	 */
274
-	public function save_post( $post_id, $post, $update ) {
275
-
276
-		// Avoid doing anything if post is autosave or a revision.
277
-		if ( wp_is_post_autosave( $post ) || wp_is_post_revision( $post ) ) {
278
-			return;
279
-		}
280
-
281
-		// We're setting the alternative label that have been provided via the UI
282
-		// (in fact we're using $_REQUEST), while save_post may be also called
283
-		// programmatically by some other function: we need to check therefore if
284
-		// the $post_id in the save_post call matches the post id set in the request.
285
-		//
286
-		// If this is not the current post being saved or if it's not an entity, return.
287
-		if ( ! isset( $_REQUEST['post_ID'] ) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity( $post_id ) ) {
288
-			return;
289
-		}
290
-
291
-		// Get the alt labels from the request (or empty array).
292
-		$alt_labels = isset( $_REQUEST['wl_alternative_label'] ) ? $_REQUEST['wl_alternative_label'] : array();
293
-
294
-		// Set the alternative labels.
295
-		$this->set_alternative_labels( $post_id, $alt_labels );
296
-
297
-	}
298
-
299
-	/**
300
-	 * Set the alternative labels.
301
-	 *
302
-	 * @param int $post_id The post id.
303
-	 * @param array $alt_labels An array of labels.
304
-	 *
305
-	 * @since 3.2.0
306
-	 *
307
-	 */
308
-	public function set_alternative_labels( $post_id, $alt_labels ) {
309
-
310
-		// Force $alt_labels to be an array
311
-		if ( ! is_array( $alt_labels ) ) {
312
-			$alt_labels = array( $alt_labels );
313
-		}
314
-
315
-		$this->log->debug( "Setting alternative labels [ post id :: $post_id ][ alt labels :: " . implode( ',', $alt_labels ) . " ]" );
316
-
317
-		// Delete all the existing alternate labels.
318
-		delete_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
319
-
320
-		// Set the alternative labels.
321
-		foreach ( $alt_labels as $alt_label ) {
322
-			if ( ! empty( $alt_label ) ) {
323
-				add_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label );
324
-			}
325
-		}
326
-
327
-	}
328
-
329
-	/**
330
-	 * Retrieve the alternate labels.
331
-	 *
332
-	 * @param int $post_id Post id.
333
-	 *
334
-	 * @return mixed An array  of alternative labels.
335
-	 * @since 3.2.0
336
-	 *
337
-	 */
338
-	public function get_alternative_labels( $post_id ) {
339
-
340
-		return get_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
341
-	}
342
-
343
-	/**
344
-	 * Retrieve the labels for an entity, i.e. the title + the synonyms.
345
-	 *
346
-	 * @param int $post_id The entity {@link WP_Post} id.
347
-	 *
348
-	 * @return array An array with the entity title and labels.
349
-	 * @since 3.12.0
350
-	 *
351
-	 */
352
-	public function get_labels( $post_id ) {
353
-
354
-		return array_merge( (array) get_the_title( $post_id ), $this->get_alternative_labels( $post_id ) );
355
-	}
356
-
357
-	/**
358
-	 * Fires before the permalink field in the edit form (this event is available in WP from 4.1.0).
359
-	 *
360
-	 * @param WP_Post $post Post object.
361
-	 *
362
-	 * @since 3.2.0
363
-	 *
364
-	 */
365
-	public function edit_form_before_permalink( $post ) {
366
-
367
-		// If it's not an entity, return.
368
-		if ( ! $this->is_entity( $post->ID ) ) {
369
-			return;
370
-		}
371
-
372
-		// Print the input template.
373
-		$this->ui_service->print_template( 'wl-tmpl-alternative-label-input', $this->get_alternative_label_input() );
374
-
375
-		// Print all the currently set alternative labels.
376
-		foreach ( $this->get_alternative_labels( $post->ID ) as $alt_label ) {
377
-
378
-			echo $this->get_alternative_label_input( $alt_label );
379
-
380
-		};
381
-
382
-		// Print the button.
383
-		$this->ui_service->print_button( 'wl-add-alternative-labels-button', __( 'Add more titles', 'wordlift' ) );
384
-
385
-	}
386
-
387
-	/**
388
-	 * Get the URI for the entity with the specified post id.
389
-	 *
390
-	 * @param int $post_id The entity post id.
391
-	 *
392
-	 * @return null|string The entity URI or NULL if not found or the dataset URI is not configured.
393
-	 * @since 3.6.0
394
-	 *
395
-	 */
396
-	public function get_uri( $post_id ) {
397
-
398
-		// If a null is given, nothing to do
399
-		if ( null == $post_id ) {
400
-			return null;
401
-		}
402
-
403
-		$dataset_uri = wl_configuration_get_redlink_dataset_uri();
404
-
405
-		// If the dataset uri is not properly configured, null is returned
406
-		if ( empty( $dataset_uri ) ) {
407
-			return null;
408
-		}
409
-
410
-		$uri = get_post_meta( $post_id, WL_ENTITY_URL_META_NAME, true );
411
-
412
-		/*
154
+        foreach ( $terms as $term ) {
155
+            if ( 'article' !== $term->slug ) {
156
+                return true;
157
+            }
158
+        }
159
+
160
+        return false;
161
+    }
162
+
163
+    /**
164
+     * Get the proper classification scope for a given entity post
165
+     *
166
+     * @param integer $post_id An entity post id.
167
+     *
168
+     * @param string $default The default classification scope, `what` if not
169
+     *                         provided.
170
+     *
171
+     * @return string Returns a classification scope (e.g. 'what').
172
+     * @since 3.5.0
173
+     *
174
+     */
175
+    public function get_classification_scope_for( $post_id, $default = WL_WHAT_RELATION ) {
176
+
177
+        if ( false === $this->is_entity( $post_id ) ) {
178
+            return $default;
179
+        }
180
+
181
+        // Retrieve the entity type
182
+        $entity_type_arr = Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
183
+        $entity_type     = str_replace( 'wl-', '', $entity_type_arr['css_class'] );
184
+        // Retrieve classification boxes configuration
185
+        $classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES );
186
+        foreach ( $classification_boxes as $cb ) {
187
+            if ( in_array( $entity_type, $cb['registeredTypes'] ) ) {
188
+                return $cb['id'];
189
+            }
190
+        }
191
+
192
+        return $default;
193
+    }
194
+
195
+    /**
196
+     * Check whether a {@link WP_Post} is used.
197
+     *
198
+     * @param int $post_id The {@link WP_Post}'s id.
199
+     *
200
+     * @return bool|null Null if it's not an entity, otherwise true if it's used.
201
+     */
202
+    public function is_used( $post_id ) {
203
+
204
+        if ( false === $this->is_entity( $post_id ) ) {
205
+            return null;
206
+        }
207
+        // Retrieve the post
208
+        $entity = get_post( $post_id );
209
+
210
+        global $wpdb;
211
+        // Retrieve Wordlift relation instances table name
212
+        $table_name = wl_core_get_relation_instances_table_name();
213
+
214
+        // Check is it's referenced / related to another post / entity
215
+        $stmt = $wpdb->prepare(
216
+            "SELECT COUNT(*) FROM $table_name WHERE  object_id = %d",
217
+            $entity->ID
218
+        );
219
+
220
+        // Perform the query
221
+        $relation_instances = (int) $wpdb->get_var( $stmt );
222
+        // If there is at least one relation instance for the current entity, then it's used
223
+        if ( 0 < $relation_instances ) {
224
+            return true;
225
+        }
226
+
227
+        // Check if the entity uri is used as meta_value
228
+        $stmt = $wpdb->prepare(
229
+            "SELECT COUNT(*) FROM $wpdb->postmeta WHERE post_id != %d AND meta_value = %s",
230
+            $entity->ID,
231
+            wl_get_entity_uri( $entity->ID )
232
+        );
233
+        // Perform the query
234
+        $meta_instances = (int) $wpdb->get_var( $stmt );
235
+
236
+        // If there is at least one meta that refers the current entity uri, then current entity is used
237
+        if ( 0 < $meta_instances ) {
238
+            return true;
239
+        }
240
+
241
+        // If we are here, it means the current entity is not used at the moment
242
+        return false;
243
+    }
244
+
245
+    /**
246
+     * Find entity posts by the entity URI. Entity as searched by their entity URI or same as.
247
+     *
248
+     * @param string $uri The entity URI.
249
+     *
250
+     * @return WP_Post|null A WP_Post instance or null if not found.
251
+     * @deprecated in favor of Wordlift_Entity_Uri_Service->get_entity( $uri );
252
+     *
253
+     * @since      3.16.3 deprecated in favor of Wordlift_Entity_Uri_Service->get_entity( $uri );
254
+     * @since      3.2.0
255
+     *
256
+     */
257
+    public function get_entity_post_by_uri( $uri ) {
258
+
259
+        return $this->entity_uri_service->get_entity( $uri );
260
+    }
261
+
262
+    /**
263
+     * Fires once a post has been saved. This function uses the $_REQUEST, therefore
264
+     * we check that the post we're saving is the current post.
265
+     *
266
+     * @see   https://github.com/insideout10/wordlift-plugin/issues/363
267
+     *
268
+     * @since 3.2.0
269
+     *
270
+     * @param int $post_id Post ID.
271
+     * @param WP_Post $post Post object.
272
+     * @param bool $update Whether this is an existing post being updated or not.
273
+     */
274
+    public function save_post( $post_id, $post, $update ) {
275
+
276
+        // Avoid doing anything if post is autosave or a revision.
277
+        if ( wp_is_post_autosave( $post ) || wp_is_post_revision( $post ) ) {
278
+            return;
279
+        }
280
+
281
+        // We're setting the alternative label that have been provided via the UI
282
+        // (in fact we're using $_REQUEST), while save_post may be also called
283
+        // programmatically by some other function: we need to check therefore if
284
+        // the $post_id in the save_post call matches the post id set in the request.
285
+        //
286
+        // If this is not the current post being saved or if it's not an entity, return.
287
+        if ( ! isset( $_REQUEST['post_ID'] ) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity( $post_id ) ) {
288
+            return;
289
+        }
290
+
291
+        // Get the alt labels from the request (or empty array).
292
+        $alt_labels = isset( $_REQUEST['wl_alternative_label'] ) ? $_REQUEST['wl_alternative_label'] : array();
293
+
294
+        // Set the alternative labels.
295
+        $this->set_alternative_labels( $post_id, $alt_labels );
296
+
297
+    }
298
+
299
+    /**
300
+     * Set the alternative labels.
301
+     *
302
+     * @param int $post_id The post id.
303
+     * @param array $alt_labels An array of labels.
304
+     *
305
+     * @since 3.2.0
306
+     *
307
+     */
308
+    public function set_alternative_labels( $post_id, $alt_labels ) {
309
+
310
+        // Force $alt_labels to be an array
311
+        if ( ! is_array( $alt_labels ) ) {
312
+            $alt_labels = array( $alt_labels );
313
+        }
314
+
315
+        $this->log->debug( "Setting alternative labels [ post id :: $post_id ][ alt labels :: " . implode( ',', $alt_labels ) . " ]" );
316
+
317
+        // Delete all the existing alternate labels.
318
+        delete_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
319
+
320
+        // Set the alternative labels.
321
+        foreach ( $alt_labels as $alt_label ) {
322
+            if ( ! empty( $alt_label ) ) {
323
+                add_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label );
324
+            }
325
+        }
326
+
327
+    }
328
+
329
+    /**
330
+     * Retrieve the alternate labels.
331
+     *
332
+     * @param int $post_id Post id.
333
+     *
334
+     * @return mixed An array  of alternative labels.
335
+     * @since 3.2.0
336
+     *
337
+     */
338
+    public function get_alternative_labels( $post_id ) {
339
+
340
+        return get_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
341
+    }
342
+
343
+    /**
344
+     * Retrieve the labels for an entity, i.e. the title + the synonyms.
345
+     *
346
+     * @param int $post_id The entity {@link WP_Post} id.
347
+     *
348
+     * @return array An array with the entity title and labels.
349
+     * @since 3.12.0
350
+     *
351
+     */
352
+    public function get_labels( $post_id ) {
353
+
354
+        return array_merge( (array) get_the_title( $post_id ), $this->get_alternative_labels( $post_id ) );
355
+    }
356
+
357
+    /**
358
+     * Fires before the permalink field in the edit form (this event is available in WP from 4.1.0).
359
+     *
360
+     * @param WP_Post $post Post object.
361
+     *
362
+     * @since 3.2.0
363
+     *
364
+     */
365
+    public function edit_form_before_permalink( $post ) {
366
+
367
+        // If it's not an entity, return.
368
+        if ( ! $this->is_entity( $post->ID ) ) {
369
+            return;
370
+        }
371
+
372
+        // Print the input template.
373
+        $this->ui_service->print_template( 'wl-tmpl-alternative-label-input', $this->get_alternative_label_input() );
374
+
375
+        // Print all the currently set alternative labels.
376
+        foreach ( $this->get_alternative_labels( $post->ID ) as $alt_label ) {
377
+
378
+            echo $this->get_alternative_label_input( $alt_label );
379
+
380
+        };
381
+
382
+        // Print the button.
383
+        $this->ui_service->print_button( 'wl-add-alternative-labels-button', __( 'Add more titles', 'wordlift' ) );
384
+
385
+    }
386
+
387
+    /**
388
+     * Get the URI for the entity with the specified post id.
389
+     *
390
+     * @param int $post_id The entity post id.
391
+     *
392
+     * @return null|string The entity URI or NULL if not found or the dataset URI is not configured.
393
+     * @since 3.6.0
394
+     *
395
+     */
396
+    public function get_uri( $post_id ) {
397
+
398
+        // If a null is given, nothing to do
399
+        if ( null == $post_id ) {
400
+            return null;
401
+        }
402
+
403
+        $dataset_uri = wl_configuration_get_redlink_dataset_uri();
404
+
405
+        // If the dataset uri is not properly configured, null is returned
406
+        if ( empty( $dataset_uri ) ) {
407
+            return null;
408
+        }
409
+
410
+        $uri = get_post_meta( $post_id, WL_ENTITY_URL_META_NAME, true );
411
+
412
+        /*
413 413
 		 * Consider the URI invalid if it doesn't start with the dataset URI.
414 414
 		 *
415 415
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/996
416 416
 		 */
417
-		if ( 0 !== strpos( $uri, $dataset_uri ) ) {
418
-			$uri = null;
419
-		}
420
-
421
-		// Set the URI if it isn't set yet.
422
-		$post_status = get_post_status( $post_id );
423
-		if ( empty( $uri ) && 'auto-draft' !== $post_status && 'revision' !== $post_status ) {
424
-			$uri = wl_build_entity_uri( $post_id );
425
-			wl_set_entity_uri( $post_id, $uri );
426
-		}
427
-
428
-		return $uri;
429
-	}
430
-
431
-
432
-	/**
433
-	 * Get the alternative label input HTML code.
434
-	 *
435
-	 * @param string $value The input value.
436
-	 *
437
-	 * @return string The input HTML code.
438
-	 * @since 3.2.0
439
-	 *
440
-	 */
441
-	private function get_alternative_label_input( $value = '' ) {
442
-
443
-		return sprintf( self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr( $value ), __( 'Delete', 'wordlift' ) );
444
-	}
445
-
446
-	/**
447
-	 * Get the number of entity posts published in this blog.
448
-	 *
449
-	 * @return int The number of published entity posts.
450
-	 * @since 3.6.0
451
-	 *
452
-	 */
453
-	public function count() {
454
-		global $wpdb;
455
-
456
-		// Try to get the count from the transient.
457
-		$count = get_transient( '_wl_entity_service__count' );
458
-		if ( false !== $count ) {
459
-			return $count;
460
-		}
461
-
462
-		// Query the count.
463
-		$count = $wpdb->get_var( $wpdb->prepare(
464
-			"SELECT COUNT( DISTINCT( tr.object_id ) )"
465
-			. " FROM {$wpdb->term_relationships} tr"
466
-			. " INNER JOIN {$wpdb->term_taxonomy} tt"
467
-			. "  ON tt.taxonomy = %s AND tt.term_taxonomy_id = tr.term_taxonomy_id"
468
-			. " INNER JOIN {$wpdb->terms} t"
469
-			. "  ON t.term_id = tt.term_id AND t.name != %s",
470
-			Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
471
-			'article'
472
-		) );
473
-
474
-		// Store the count in cache.
475
-		set_transient( '_wl_entity_service__count', $count, 900 );
476
-
477
-		return $count;
478
-	}
479
-
480
-	/**
481
-	 * Add the entity filtering criterias to the arguments for a `get_posts`
482
-	 * call.
483
-	 *
484
-	 * @param array $args The arguments for a `get_posts` call.
485
-	 *
486
-	 * @return array The arguments for a `get_posts` call.
487
-	 * @since 3.15.0
488
-	 *
489
-	 */
490
-	public static function add_criterias( $args ) {
491
-
492
-		// Build an optimal tax-query.
493
-		$tax_query = array(
494
-			'relation' => 'AND',
495
-			array(
496
-				'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
497
-				'operator' => 'EXISTS',
498
-			),
499
-			array(
500
-				'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
501
-				'field'    => 'slug',
502
-				'terms'    => 'article',
503
-				'operator' => 'NOT IN',
504
-			),
505
-		);
506
-
507
-		return $args + array(
508
-				'post_type' => Wordlift_Entity_Service::valid_entity_post_types(),
509
-				/*
417
+        if ( 0 !== strpos( $uri, $dataset_uri ) ) {
418
+            $uri = null;
419
+        }
420
+
421
+        // Set the URI if it isn't set yet.
422
+        $post_status = get_post_status( $post_id );
423
+        if ( empty( $uri ) && 'auto-draft' !== $post_status && 'revision' !== $post_status ) {
424
+            $uri = wl_build_entity_uri( $post_id );
425
+            wl_set_entity_uri( $post_id, $uri );
426
+        }
427
+
428
+        return $uri;
429
+    }
430
+
431
+
432
+    /**
433
+     * Get the alternative label input HTML code.
434
+     *
435
+     * @param string $value The input value.
436
+     *
437
+     * @return string The input HTML code.
438
+     * @since 3.2.0
439
+     *
440
+     */
441
+    private function get_alternative_label_input( $value = '' ) {
442
+
443
+        return sprintf( self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr( $value ), __( 'Delete', 'wordlift' ) );
444
+    }
445
+
446
+    /**
447
+     * Get the number of entity posts published in this blog.
448
+     *
449
+     * @return int The number of published entity posts.
450
+     * @since 3.6.0
451
+     *
452
+     */
453
+    public function count() {
454
+        global $wpdb;
455
+
456
+        // Try to get the count from the transient.
457
+        $count = get_transient( '_wl_entity_service__count' );
458
+        if ( false !== $count ) {
459
+            return $count;
460
+        }
461
+
462
+        // Query the count.
463
+        $count = $wpdb->get_var( $wpdb->prepare(
464
+            "SELECT COUNT( DISTINCT( tr.object_id ) )"
465
+            . " FROM {$wpdb->term_relationships} tr"
466
+            . " INNER JOIN {$wpdb->term_taxonomy} tt"
467
+            . "  ON tt.taxonomy = %s AND tt.term_taxonomy_id = tr.term_taxonomy_id"
468
+            . " INNER JOIN {$wpdb->terms} t"
469
+            . "  ON t.term_id = tt.term_id AND t.name != %s",
470
+            Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
471
+            'article'
472
+        ) );
473
+
474
+        // Store the count in cache.
475
+        set_transient( '_wl_entity_service__count', $count, 900 );
476
+
477
+        return $count;
478
+    }
479
+
480
+    /**
481
+     * Add the entity filtering criterias to the arguments for a `get_posts`
482
+     * call.
483
+     *
484
+     * @param array $args The arguments for a `get_posts` call.
485
+     *
486
+     * @return array The arguments for a `get_posts` call.
487
+     * @since 3.15.0
488
+     *
489
+     */
490
+    public static function add_criterias( $args ) {
491
+
492
+        // Build an optimal tax-query.
493
+        $tax_query = array(
494
+            'relation' => 'AND',
495
+            array(
496
+                'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
497
+                'operator' => 'EXISTS',
498
+            ),
499
+            array(
500
+                'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
501
+                'field'    => 'slug',
502
+                'terms'    => 'article',
503
+                'operator' => 'NOT IN',
504
+            ),
505
+        );
506
+
507
+        return $args + array(
508
+                'post_type' => Wordlift_Entity_Service::valid_entity_post_types(),
509
+                /*
510 510
 				 * Ensure compatibility with Polylang.
511 511
 				 *
512 512
 				 * @see https://github.com/insideout10/wordlift-plugin/issues/855.
@@ -514,102 +514,102 @@  discard block
 block discarded – undo
514 514
 				 *
515 515
 				 * @since 3.19.5
516 516
 				 */
517
-				'lang'      => '',
518
-				'tax_query' => $tax_query,
519
-			);
520
-	}
521
-
522
-	/**
523
-	 * Create a new entity.
524
-	 *
525
-	 * @param string $name The entity name.
526
-	 * @param string $type_uri The entity's type URI.
527
-	 * @param null $logo The entity logo id (or NULL if none).
528
-	 * @param string $status The post status, by default 'publish'.
529
-	 *
530
-	 * @return int|WP_Error The entity post id or a {@link WP_Error} in case the `wp_insert_post` call fails.
531
-	 * @since 3.9.0
532
-	 *
533
-	 */
534
-	public function create( $name, $type_uri, $logo = null, $status = 'publish' ) {
535
-
536
-		// Create an entity for the publisher.
537
-		$post_id = @wp_insert_post( array(
538
-			'post_type'    => self::TYPE_NAME,
539
-			'post_title'   => $name,
540
-			'post_status'  => $status,
541
-			'post_content' => '',
542
-		) );
543
-
544
-		// Return the error if any.
545
-		if ( is_wp_error( $post_id ) ) {
546
-			return $post_id;
547
-		}
548
-
549
-		// Set the entity logo.
550
-		if ( $logo && is_numeric( $logo ) ) {
551
-			set_post_thumbnail( $post_id, $logo );
552
-		}
553
-
554
-		// Set the entity type.
555
-		Wordlift_Entity_Type_Service::get_instance()->set( $post_id, $type_uri );
556
-
557
-		return $post_id;
558
-	}
559
-
560
-	/**
561
-	 * Get the entities related to the one with the specified id. By default only
562
-	 * published entities will be returned.
563
-	 *
564
-	 * @param int $id The post id.
565
-	 * @param string $post_status The target post status (default = publish).
566
-	 *
567
-	 * @return array An array of post ids.
568
-	 * @since 3.10.0
569
-	 *
570
-	 */
571
-	public function get_related_entities( $id, $post_status = 'publish' ) {
572
-
573
-		return $this->relation_service->get_objects( $id, 'ids', null, $post_status );
574
-	}
575
-
576
-	/**
577
-	 * Get the list of entities.
578
-	 *
579
-	 * @param array $params Custom parameters for WordPress' own {@link get_posts} function.
580
-	 *
581
-	 * @return array An array of entity posts.
582
-	 * @since 3.12.2
583
-	 *
584
-	 */
585
-	public function get( $params = array() ) {
586
-
587
-		// Set the defaults.
588
-		$defaults = array( 'post_type' => 'entity' );
589
-
590
-		// Merge the defaults with the provided parameters.
591
-		$args = wp_parse_args( $params, $defaults );
592
-
593
-		// Call the `get_posts` function.
594
-		return get_posts( $args );
595
-	}
596
-
597
-	/**
598
-	 * The list of post type names which can be used for entities
599
-	 *
600
-	 * Criteria is that the post type is public. The list of valid post types
601
-	 * can be overridden with a filter.
602
-	 *
603
-	 * @return array Array containing the names of the valid post types.
604
-	 * @since 3.15.0
605
-	 *
606
-	 */
607
-	static function valid_entity_post_types() {
608
-
609
-		// Ignore builtins in the call to avoid getting attachments.
610
-		$post_types = array( 'post', 'page', self::TYPE_NAME );
611
-
612
-		return apply_filters( 'wl_valid_entity_post_types', $post_types );
613
-	}
517
+                'lang'      => '',
518
+                'tax_query' => $tax_query,
519
+            );
520
+    }
521
+
522
+    /**
523
+     * Create a new entity.
524
+     *
525
+     * @param string $name The entity name.
526
+     * @param string $type_uri The entity's type URI.
527
+     * @param null $logo The entity logo id (or NULL if none).
528
+     * @param string $status The post status, by default 'publish'.
529
+     *
530
+     * @return int|WP_Error The entity post id or a {@link WP_Error} in case the `wp_insert_post` call fails.
531
+     * @since 3.9.0
532
+     *
533
+     */
534
+    public function create( $name, $type_uri, $logo = null, $status = 'publish' ) {
535
+
536
+        // Create an entity for the publisher.
537
+        $post_id = @wp_insert_post( array(
538
+            'post_type'    => self::TYPE_NAME,
539
+            'post_title'   => $name,
540
+            'post_status'  => $status,
541
+            'post_content' => '',
542
+        ) );
543
+
544
+        // Return the error if any.
545
+        if ( is_wp_error( $post_id ) ) {
546
+            return $post_id;
547
+        }
548
+
549
+        // Set the entity logo.
550
+        if ( $logo && is_numeric( $logo ) ) {
551
+            set_post_thumbnail( $post_id, $logo );
552
+        }
553
+
554
+        // Set the entity type.
555
+        Wordlift_Entity_Type_Service::get_instance()->set( $post_id, $type_uri );
556
+
557
+        return $post_id;
558
+    }
559
+
560
+    /**
561
+     * Get the entities related to the one with the specified id. By default only
562
+     * published entities will be returned.
563
+     *
564
+     * @param int $id The post id.
565
+     * @param string $post_status The target post status (default = publish).
566
+     *
567
+     * @return array An array of post ids.
568
+     * @since 3.10.0
569
+     *
570
+     */
571
+    public function get_related_entities( $id, $post_status = 'publish' ) {
572
+
573
+        return $this->relation_service->get_objects( $id, 'ids', null, $post_status );
574
+    }
575
+
576
+    /**
577
+     * Get the list of entities.
578
+     *
579
+     * @param array $params Custom parameters for WordPress' own {@link get_posts} function.
580
+     *
581
+     * @return array An array of entity posts.
582
+     * @since 3.12.2
583
+     *
584
+     */
585
+    public function get( $params = array() ) {
586
+
587
+        // Set the defaults.
588
+        $defaults = array( 'post_type' => 'entity' );
589
+
590
+        // Merge the defaults with the provided parameters.
591
+        $args = wp_parse_args( $params, $defaults );
592
+
593
+        // Call the `get_posts` function.
594
+        return get_posts( $args );
595
+    }
596
+
597
+    /**
598
+     * The list of post type names which can be used for entities
599
+     *
600
+     * Criteria is that the post type is public. The list of valid post types
601
+     * can be overridden with a filter.
602
+     *
603
+     * @return array Array containing the names of the valid post types.
604
+     * @since 3.15.0
605
+     *
606
+     */
607
+    static function valid_entity_post_types() {
608
+
609
+        // Ignore builtins in the call to avoid getting attachments.
610
+        $post_types = array( 'post', 'page', self::TYPE_NAME );
611
+
612
+        return apply_filters( 'wl_valid_entity_post_types', $post_types );
613
+    }
614 614
 
615 615
 }
Please login to merge, or discard this patch.
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 	 * @since 3.2.0
98 98
 	 *
99 99
 	 */
100
-	public function __construct( $ui_service, $relation_service, $entity_uri_service ) {
100
+	public function __construct($ui_service, $relation_service, $entity_uri_service) {
101 101
 
102
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' );
102
+		$this->log = Wordlift_Log_Service::get_logger('Wordlift_Entity_Service');
103 103
 
104 104
 		$this->ui_service         = $ui_service;
105 105
 		$this->relation_service   = $relation_service;
@@ -130,17 +130,17 @@  discard block
 block discarded – undo
130 130
 	 * @since 3.1.0
131 131
 	 *
132 132
 	 */
133
-	public function is_entity( $post_id ) {
133
+	public function is_entity($post_id) {
134 134
 
135
-		$terms = wp_get_object_terms( $post_id, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
135
+		$terms = wp_get_object_terms($post_id, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME);
136 136
 
137
-		if ( is_wp_error( $terms ) ) {
138
-			$this->log->error( "Cannot get the terms for post $post_id: " . $terms->get_error_message() );
137
+		if (is_wp_error($terms)) {
138
+			$this->log->error("Cannot get the terms for post $post_id: ".$terms->get_error_message());
139 139
 
140 140
 			return false;
141 141
 		}
142 142
 
143
-		if ( empty( $terms ) ) {
143
+		if (empty($terms)) {
144 144
 			return false;
145 145
 		}
146 146
 
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 		 *
152 152
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
153 153
 		 */
154
-		foreach ( $terms as $term ) {
155
-			if ( 'article' !== $term->slug ) {
154
+		foreach ($terms as $term) {
155
+			if ('article' !== $term->slug) {
156 156
 				return true;
157 157
 			}
158 158
 		}
@@ -172,19 +172,19 @@  discard block
 block discarded – undo
172 172
 	 * @since 3.5.0
173 173
 	 *
174 174
 	 */
175
-	public function get_classification_scope_for( $post_id, $default = WL_WHAT_RELATION ) {
175
+	public function get_classification_scope_for($post_id, $default = WL_WHAT_RELATION) {
176 176
 
177
-		if ( false === $this->is_entity( $post_id ) ) {
177
+		if (false === $this->is_entity($post_id)) {
178 178
 			return $default;
179 179
 		}
180 180
 
181 181
 		// Retrieve the entity type
182
-		$entity_type_arr = Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
183
-		$entity_type     = str_replace( 'wl-', '', $entity_type_arr['css_class'] );
182
+		$entity_type_arr = Wordlift_Entity_Type_Service::get_instance()->get($post_id);
183
+		$entity_type     = str_replace('wl-', '', $entity_type_arr['css_class']);
184 184
 		// Retrieve classification boxes configuration
185
-		$classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES );
186
-		foreach ( $classification_boxes as $cb ) {
187
-			if ( in_array( $entity_type, $cb['registeredTypes'] ) ) {
185
+		$classification_boxes = unserialize(WL_CORE_POST_CLASSIFICATION_BOXES);
186
+		foreach ($classification_boxes as $cb) {
187
+			if (in_array($entity_type, $cb['registeredTypes'])) {
188 188
 				return $cb['id'];
189 189
 			}
190 190
 		}
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return bool|null Null if it's not an entity, otherwise true if it's used.
201 201
 	 */
202
-	public function is_used( $post_id ) {
202
+	public function is_used($post_id) {
203 203
 
204
-		if ( false === $this->is_entity( $post_id ) ) {
204
+		if (false === $this->is_entity($post_id)) {
205 205
 			return null;
206 206
 		}
207 207
 		// Retrieve the post
208
-		$entity = get_post( $post_id );
208
+		$entity = get_post($post_id);
209 209
 
210 210
 		global $wpdb;
211 211
 		// Retrieve Wordlift relation instances table name
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
 		);
219 219
 
220 220
 		// Perform the query
221
-		$relation_instances = (int) $wpdb->get_var( $stmt );
221
+		$relation_instances = (int) $wpdb->get_var($stmt);
222 222
 		// If there is at least one relation instance for the current entity, then it's used
223
-		if ( 0 < $relation_instances ) {
223
+		if (0 < $relation_instances) {
224 224
 			return true;
225 225
 		}
226 226
 
@@ -228,13 +228,13 @@  discard block
 block discarded – undo
228 228
 		$stmt = $wpdb->prepare(
229 229
 			"SELECT COUNT(*) FROM $wpdb->postmeta WHERE post_id != %d AND meta_value = %s",
230 230
 			$entity->ID,
231
-			wl_get_entity_uri( $entity->ID )
231
+			wl_get_entity_uri($entity->ID)
232 232
 		);
233 233
 		// Perform the query
234
-		$meta_instances = (int) $wpdb->get_var( $stmt );
234
+		$meta_instances = (int) $wpdb->get_var($stmt);
235 235
 
236 236
 		// If there is at least one meta that refers the current entity uri, then current entity is used
237
-		if ( 0 < $meta_instances ) {
237
+		if (0 < $meta_instances) {
238 238
 			return true;
239 239
 		}
240 240
 
@@ -254,9 +254,9 @@  discard block
 block discarded – undo
254 254
 	 * @since      3.2.0
255 255
 	 *
256 256
 	 */
257
-	public function get_entity_post_by_uri( $uri ) {
257
+	public function get_entity_post_by_uri($uri) {
258 258
 
259
-		return $this->entity_uri_service->get_entity( $uri );
259
+		return $this->entity_uri_service->get_entity($uri);
260 260
 	}
261 261
 
262 262
 	/**
@@ -271,10 +271,10 @@  discard block
 block discarded – undo
271 271
 	 * @param WP_Post $post Post object.
272 272
 	 * @param bool $update Whether this is an existing post being updated or not.
273 273
 	 */
274
-	public function save_post( $post_id, $post, $update ) {
274
+	public function save_post($post_id, $post, $update) {
275 275
 
276 276
 		// Avoid doing anything if post is autosave or a revision.
277
-		if ( wp_is_post_autosave( $post ) || wp_is_post_revision( $post ) ) {
277
+		if (wp_is_post_autosave($post) || wp_is_post_revision($post)) {
278 278
 			return;
279 279
 		}
280 280
 
@@ -284,15 +284,15 @@  discard block
 block discarded – undo
284 284
 		// the $post_id in the save_post call matches the post id set in the request.
285 285
 		//
286 286
 		// If this is not the current post being saved or if it's not an entity, return.
287
-		if ( ! isset( $_REQUEST['post_ID'] ) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity( $post_id ) ) {
287
+		if ( ! isset($_REQUEST['post_ID']) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity($post_id)) {
288 288
 			return;
289 289
 		}
290 290
 
291 291
 		// Get the alt labels from the request (or empty array).
292
-		$alt_labels = isset( $_REQUEST['wl_alternative_label'] ) ? $_REQUEST['wl_alternative_label'] : array();
292
+		$alt_labels = isset($_REQUEST['wl_alternative_label']) ? $_REQUEST['wl_alternative_label'] : array();
293 293
 
294 294
 		// Set the alternative labels.
295
-		$this->set_alternative_labels( $post_id, $alt_labels );
295
+		$this->set_alternative_labels($post_id, $alt_labels);
296 296
 
297 297
 	}
298 298
 
@@ -305,22 +305,22 @@  discard block
 block discarded – undo
305 305
 	 * @since 3.2.0
306 306
 	 *
307 307
 	 */
308
-	public function set_alternative_labels( $post_id, $alt_labels ) {
308
+	public function set_alternative_labels($post_id, $alt_labels) {
309 309
 
310 310
 		// Force $alt_labels to be an array
311
-		if ( ! is_array( $alt_labels ) ) {
312
-			$alt_labels = array( $alt_labels );
311
+		if ( ! is_array($alt_labels)) {
312
+			$alt_labels = array($alt_labels);
313 313
 		}
314 314
 
315
-		$this->log->debug( "Setting alternative labels [ post id :: $post_id ][ alt labels :: " . implode( ',', $alt_labels ) . " ]" );
315
+		$this->log->debug("Setting alternative labels [ post id :: $post_id ][ alt labels :: ".implode(',', $alt_labels)." ]");
316 316
 
317 317
 		// Delete all the existing alternate labels.
318
-		delete_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
318
+		delete_post_meta($post_id, self::ALTERNATIVE_LABEL_META_KEY);
319 319
 
320 320
 		// Set the alternative labels.
321
-		foreach ( $alt_labels as $alt_label ) {
322
-			if ( ! empty( $alt_label ) ) {
323
-				add_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label );
321
+		foreach ($alt_labels as $alt_label) {
322
+			if ( ! empty($alt_label)) {
323
+				add_post_meta($post_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label);
324 324
 			}
325 325
 		}
326 326
 
@@ -335,9 +335,9 @@  discard block
 block discarded – undo
335 335
 	 * @since 3.2.0
336 336
 	 *
337 337
 	 */
338
-	public function get_alternative_labels( $post_id ) {
338
+	public function get_alternative_labels($post_id) {
339 339
 
340
-		return get_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
340
+		return get_post_meta($post_id, self::ALTERNATIVE_LABEL_META_KEY);
341 341
 	}
342 342
 
343 343
 	/**
@@ -349,9 +349,9 @@  discard block
 block discarded – undo
349 349
 	 * @since 3.12.0
350 350
 	 *
351 351
 	 */
352
-	public function get_labels( $post_id ) {
352
+	public function get_labels($post_id) {
353 353
 
354
-		return array_merge( (array) get_the_title( $post_id ), $this->get_alternative_labels( $post_id ) );
354
+		return array_merge((array) get_the_title($post_id), $this->get_alternative_labels($post_id));
355 355
 	}
356 356
 
357 357
 	/**
@@ -362,25 +362,25 @@  discard block
 block discarded – undo
362 362
 	 * @since 3.2.0
363 363
 	 *
364 364
 	 */
365
-	public function edit_form_before_permalink( $post ) {
365
+	public function edit_form_before_permalink($post) {
366 366
 
367 367
 		// If it's not an entity, return.
368
-		if ( ! $this->is_entity( $post->ID ) ) {
368
+		if ( ! $this->is_entity($post->ID)) {
369 369
 			return;
370 370
 		}
371 371
 
372 372
 		// Print the input template.
373
-		$this->ui_service->print_template( 'wl-tmpl-alternative-label-input', $this->get_alternative_label_input() );
373
+		$this->ui_service->print_template('wl-tmpl-alternative-label-input', $this->get_alternative_label_input());
374 374
 
375 375
 		// Print all the currently set alternative labels.
376
-		foreach ( $this->get_alternative_labels( $post->ID ) as $alt_label ) {
376
+		foreach ($this->get_alternative_labels($post->ID) as $alt_label) {
377 377
 
378
-			echo $this->get_alternative_label_input( $alt_label );
378
+			echo $this->get_alternative_label_input($alt_label);
379 379
 
380 380
 		};
381 381
 
382 382
 		// Print the button.
383
-		$this->ui_service->print_button( 'wl-add-alternative-labels-button', __( 'Add more titles', 'wordlift' ) );
383
+		$this->ui_service->print_button('wl-add-alternative-labels-button', __('Add more titles', 'wordlift'));
384 384
 
385 385
 	}
386 386
 
@@ -393,36 +393,36 @@  discard block
 block discarded – undo
393 393
 	 * @since 3.6.0
394 394
 	 *
395 395
 	 */
396
-	public function get_uri( $post_id ) {
396
+	public function get_uri($post_id) {
397 397
 
398 398
 		// If a null is given, nothing to do
399
-		if ( null == $post_id ) {
399
+		if (null == $post_id) {
400 400
 			return null;
401 401
 		}
402 402
 
403 403
 		$dataset_uri = wl_configuration_get_redlink_dataset_uri();
404 404
 
405 405
 		// If the dataset uri is not properly configured, null is returned
406
-		if ( empty( $dataset_uri ) ) {
406
+		if (empty($dataset_uri)) {
407 407
 			return null;
408 408
 		}
409 409
 
410
-		$uri = get_post_meta( $post_id, WL_ENTITY_URL_META_NAME, true );
410
+		$uri = get_post_meta($post_id, WL_ENTITY_URL_META_NAME, true);
411 411
 
412 412
 		/*
413 413
 		 * Consider the URI invalid if it doesn't start with the dataset URI.
414 414
 		 *
415 415
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/996
416 416
 		 */
417
-		if ( 0 !== strpos( $uri, $dataset_uri ) ) {
417
+		if (0 !== strpos($uri, $dataset_uri)) {
418 418
 			$uri = null;
419 419
 		}
420 420
 
421 421
 		// Set the URI if it isn't set yet.
422
-		$post_status = get_post_status( $post_id );
423
-		if ( empty( $uri ) && 'auto-draft' !== $post_status && 'revision' !== $post_status ) {
424
-			$uri = wl_build_entity_uri( $post_id );
425
-			wl_set_entity_uri( $post_id, $uri );
422
+		$post_status = get_post_status($post_id);
423
+		if (empty($uri) && 'auto-draft' !== $post_status && 'revision' !== $post_status) {
424
+			$uri = wl_build_entity_uri($post_id);
425
+			wl_set_entity_uri($post_id, $uri);
426 426
 		}
427 427
 
428 428
 		return $uri;
@@ -438,9 +438,9 @@  discard block
 block discarded – undo
438 438
 	 * @since 3.2.0
439 439
 	 *
440 440
 	 */
441
-	private function get_alternative_label_input( $value = '' ) {
441
+	private function get_alternative_label_input($value = '') {
442 442
 
443
-		return sprintf( self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr( $value ), __( 'Delete', 'wordlift' ) );
443
+		return sprintf(self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr($value), __('Delete', 'wordlift'));
444 444
 	}
445 445
 
446 446
 	/**
@@ -454,13 +454,13 @@  discard block
 block discarded – undo
454 454
 		global $wpdb;
455 455
 
456 456
 		// Try to get the count from the transient.
457
-		$count = get_transient( '_wl_entity_service__count' );
458
-		if ( false !== $count ) {
457
+		$count = get_transient('_wl_entity_service__count');
458
+		if (false !== $count) {
459 459
 			return $count;
460 460
 		}
461 461
 
462 462
 		// Query the count.
463
-		$count = $wpdb->get_var( $wpdb->prepare(
463
+		$count = $wpdb->get_var($wpdb->prepare(
464 464
 			"SELECT COUNT( DISTINCT( tr.object_id ) )"
465 465
 			. " FROM {$wpdb->term_relationships} tr"
466 466
 			. " INNER JOIN {$wpdb->term_taxonomy} tt"
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
 			. "  ON t.term_id = tt.term_id AND t.name != %s",
470 470
 			Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
471 471
 			'article'
472
-		) );
472
+		));
473 473
 
474 474
 		// Store the count in cache.
475
-		set_transient( '_wl_entity_service__count', $count, 900 );
475
+		set_transient('_wl_entity_service__count', $count, 900);
476 476
 
477 477
 		return $count;
478 478
 	}
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 	 * @since 3.15.0
488 488
 	 *
489 489
 	 */
490
-	public static function add_criterias( $args ) {
490
+	public static function add_criterias($args) {
491 491
 
492 492
 		// Build an optimal tax-query.
493 493
 		$tax_query = array(
@@ -531,28 +531,28 @@  discard block
 block discarded – undo
531 531
 	 * @since 3.9.0
532 532
 	 *
533 533
 	 */
534
-	public function create( $name, $type_uri, $logo = null, $status = 'publish' ) {
534
+	public function create($name, $type_uri, $logo = null, $status = 'publish') {
535 535
 
536 536
 		// Create an entity for the publisher.
537
-		$post_id = @wp_insert_post( array(
537
+		$post_id = @wp_insert_post(array(
538 538
 			'post_type'    => self::TYPE_NAME,
539 539
 			'post_title'   => $name,
540 540
 			'post_status'  => $status,
541 541
 			'post_content' => '',
542
-		) );
542
+		));
543 543
 
544 544
 		// Return the error if any.
545
-		if ( is_wp_error( $post_id ) ) {
545
+		if (is_wp_error($post_id)) {
546 546
 			return $post_id;
547 547
 		}
548 548
 
549 549
 		// Set the entity logo.
550
-		if ( $logo && is_numeric( $logo ) ) {
551
-			set_post_thumbnail( $post_id, $logo );
550
+		if ($logo && is_numeric($logo)) {
551
+			set_post_thumbnail($post_id, $logo);
552 552
 		}
553 553
 
554 554
 		// Set the entity type.
555
-		Wordlift_Entity_Type_Service::get_instance()->set( $post_id, $type_uri );
555
+		Wordlift_Entity_Type_Service::get_instance()->set($post_id, $type_uri);
556 556
 
557 557
 		return $post_id;
558 558
 	}
@@ -568,9 +568,9 @@  discard block
 block discarded – undo
568 568
 	 * @since 3.10.0
569 569
 	 *
570 570
 	 */
571
-	public function get_related_entities( $id, $post_status = 'publish' ) {
571
+	public function get_related_entities($id, $post_status = 'publish') {
572 572
 
573
-		return $this->relation_service->get_objects( $id, 'ids', null, $post_status );
573
+		return $this->relation_service->get_objects($id, 'ids', null, $post_status);
574 574
 	}
575 575
 
576 576
 	/**
@@ -582,16 +582,16 @@  discard block
 block discarded – undo
582 582
 	 * @since 3.12.2
583 583
 	 *
584 584
 	 */
585
-	public function get( $params = array() ) {
585
+	public function get($params = array()) {
586 586
 
587 587
 		// Set the defaults.
588
-		$defaults = array( 'post_type' => 'entity' );
588
+		$defaults = array('post_type' => 'entity');
589 589
 
590 590
 		// Merge the defaults with the provided parameters.
591
-		$args = wp_parse_args( $params, $defaults );
591
+		$args = wp_parse_args($params, $defaults);
592 592
 
593 593
 		// Call the `get_posts` function.
594
-		return get_posts( $args );
594
+		return get_posts($args);
595 595
 	}
596 596
 
597 597
 	/**
@@ -607,9 +607,9 @@  discard block
 block discarded – undo
607 607
 	static function valid_entity_post_types() {
608 608
 
609 609
 		// Ignore builtins in the call to avoid getting attachments.
610
-		$post_types = array( 'post', 'page', self::TYPE_NAME );
610
+		$post_types = array('post', 'page', self::TYPE_NAME);
611 611
 
612
-		return apply_filters( 'wl_valid_entity_post_types', $post_types );
612
+		return apply_filters('wl_valid_entity_post_types', $post_types);
613 613
 	}
614 614
 
615 615
 }
Please login to merge, or discard this patch.