Completed
Push — master ( 660f9a...39f38d )
by David
05:34
created
src/modules/analyzer/wordlift_analyzer.php 2 patches
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -10,23 +10,23 @@  discard block
 block discarded – undo
10 10
  */
11 11
 function wl_ajax_analyze_action() {
12 12
 
13
-	try {
14
-		if ( $analysis = wl_analyze_content( file_get_contents( "php://input" ) ) ) {
15
-			header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
16
-			echo( $analysis );
17
-			wp_die();
18
-		}
19
-
20
-		status_header( 500 );
21
-		wp_send_json( __( 'An error occurred while request an analysis to the remote service. Please try again later.', 'wordlift' ) );
22
-
23
-	} catch ( Exception $e ) {
24
-		wp_send_json_error( array(
25
-			'code'    => $e->getCode(),
26
-			'message' => $e->getMessage(),
27
-			'trace'   => $e->getTraceAsString()
28
-		) );
29
-	}
13
+    try {
14
+        if ( $analysis = wl_analyze_content( file_get_contents( "php://input" ) ) ) {
15
+            header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
16
+            echo( $analysis );
17
+            wp_die();
18
+        }
19
+
20
+        status_header( 500 );
21
+        wp_send_json( __( 'An error occurred while request an analysis to the remote service. Please try again later.', 'wordlift' ) );
22
+
23
+    } catch ( Exception $e ) {
24
+        wp_send_json_error( array(
25
+            'code'    => $e->getCode(),
26
+            'message' => $e->getMessage(),
27
+            'trace'   => $e->getTraceAsString()
28
+        ) );
29
+    }
30 30
 
31 31
 }
32 32
 
@@ -48,51 +48,51 @@  discard block
 block discarded – undo
48 48
  */
49 49
 function wl_analyze_content( $content ) {
50 50
 
51
-	// Get the analyzer URL.
52
-	$url = wl_configuration_get_analyzer_url();
51
+    // Get the analyzer URL.
52
+    $url = wl_configuration_get_analyzer_url();
53 53
 
54
-	// Set the content type to the request content type or to text/plain by default.
55
-	$content_type = isset( $_SERVER['CONTENT_TYPE'] ) ? $_SERVER['CONTENT_TYPE'] : 'text/plain';
54
+    // Set the content type to the request content type or to text/plain by default.
55
+    $content_type = isset( $_SERVER['CONTENT_TYPE'] ) ? $_SERVER['CONTENT_TYPE'] : 'text/plain';
56 56
 
57
-	// Prepare the request.
58
-	$args = array_merge_recursive( unserialize( WL_REDLINK_API_HTTP_OPTIONS ), array(
59
-		'method'      => 'POST',
60
-		'headers'     => array(
61
-			'Accept'       => 'application/json',
62
-			'Content-type' => $content_type,
63
-		),
64
-		// we need to downgrade the HTTP version in this case since chunked encoding is dumping numbers in the response.
65
-		'httpversion' => '1.0',
66
-		'body'        => $content,
67
-	) );
57
+    // Prepare the request.
58
+    $args = array_merge_recursive( unserialize( WL_REDLINK_API_HTTP_OPTIONS ), array(
59
+        'method'      => 'POST',
60
+        'headers'     => array(
61
+            'Accept'       => 'application/json',
62
+            'Content-type' => $content_type,
63
+        ),
64
+        // we need to downgrade the HTTP version in this case since chunked encoding is dumping numbers in the response.
65
+        'httpversion' => '1.0',
66
+        'body'        => $content,
67
+    ) );
68 68
 
69
-	$response = wp_remote_post( $url, $args );
69
+    $response = wp_remote_post( $url, $args );
70 70
 
71
-	// If it's an error log it.
72
-	if ( is_wp_error( $response ) ) {
71
+    // If it's an error log it.
72
+    if ( is_wp_error( $response ) ) {
73 73
 
74
-		$message = "An error occurred while requesting an analysis to $url: {$response->get_error_message()}";
74
+        $message = "An error occurred while requesting an analysis to $url: {$response->get_error_message()}";
75 75
 
76
-		Wordlift_Log_Service::get_logger( 'wl_analyze_content' )->error( $message );
76
+        Wordlift_Log_Service::get_logger( 'wl_analyze_content' )->error( $message );
77 77
 
78
-		throw new Exception( $response->get_error_message(), is_numeric( $response->get_error_code() ) ? $response->get_error_code() : - 1 );
79
-	}
78
+        throw new Exception( $response->get_error_message(), is_numeric( $response->get_error_code() ) ? $response->get_error_code() : - 1 );
79
+    }
80 80
 
81
-	// Get the status code.
82
-	$status_code = (int) $response['response']['code'];
81
+    // Get the status code.
82
+    $status_code = (int) $response['response']['code'];
83 83
 
84
-	// If status code is OK, return the body.
85
-	if ( 200 === $status_code ) {
86
-		return $response['body'];
87
-	}
84
+    // If status code is OK, return the body.
85
+    if ( 200 === $status_code ) {
86
+        return $response['body'];
87
+    }
88 88
 
89
-	// Invalid request, e.g. invalid key.
90
-	if ( 400 === $status_code ) {
91
-		$error = json_decode( $response['body'] );
89
+    // Invalid request, e.g. invalid key.
90
+    if ( 400 === $status_code ) {
91
+        $error = json_decode( $response['body'] );
92 92
 
93
-		throw new Exception( $error->message, $error->code );
94
-	}
93
+        throw new Exception( $error->message, $error->code );
94
+    }
95 95
 
96
-	// Another generic error.
97
-	throw new Exception( "An error occurred.", $status_code );;
96
+    // Another generic error.
97
+    throw new Exception( "An error occurred.", $status_code );;
98 98
 }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -11,26 +11,26 @@  discard block
 block discarded – undo
11 11
 function wl_ajax_analyze_action() {
12 12
 
13 13
 	try {
14
-		if ( $analysis = wl_analyze_content( file_get_contents( "php://input" ) ) ) {
15
-			header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
16
-			echo( $analysis );
14
+		if ($analysis = wl_analyze_content(file_get_contents("php://input"))) {
15
+			header('Content-Type: application/json; charset='.get_option('blog_charset'));
16
+			echo($analysis);
17 17
 			wp_die();
18 18
 		}
19 19
 
20
-		status_header( 500 );
21
-		wp_send_json( __( 'An error occurred while request an analysis to the remote service. Please try again later.', 'wordlift' ) );
20
+		status_header(500);
21
+		wp_send_json(__('An error occurred while request an analysis to the remote service. Please try again later.', 'wordlift'));
22 22
 
23
-	} catch ( Exception $e ) {
24
-		wp_send_json_error( array(
23
+	} catch (Exception $e) {
24
+		wp_send_json_error(array(
25 25
 			'code'    => $e->getCode(),
26 26
 			'message' => $e->getMessage(),
27 27
 			'trace'   => $e->getTraceAsString()
28
-		) );
28
+		));
29 29
 	}
30 30
 
31 31
 }
32 32
 
33
-add_action( 'wp_ajax_wordlift_analyze', 'wl_ajax_analyze_action' );
33
+add_action('wp_ajax_wordlift_analyze', 'wl_ajax_analyze_action');
34 34
 
35 35
 /**
36 36
  * Analyze the provided content. The analysis will make use of the method *wl_ajax_analyze_action*
@@ -46,16 +46,16 @@  discard block
 block discarded – undo
46 46
  *
47 47
  * @throws Exception
48 48
  */
49
-function wl_analyze_content( $content ) {
49
+function wl_analyze_content($content) {
50 50
 
51 51
 	// Get the analyzer URL.
52 52
 	$url = wl_configuration_get_analyzer_url();
53 53
 
54 54
 	// Set the content type to the request content type or to text/plain by default.
55
-	$content_type = isset( $_SERVER['CONTENT_TYPE'] ) ? $_SERVER['CONTENT_TYPE'] : 'text/plain';
55
+	$content_type = isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : 'text/plain';
56 56
 
57 57
 	// Prepare the request.
58
-	$args = array_merge_recursive( unserialize( WL_REDLINK_API_HTTP_OPTIONS ), array(
58
+	$args = array_merge_recursive(unserialize(WL_REDLINK_API_HTTP_OPTIONS), array(
59 59
 		'method'      => 'POST',
60 60
 		'headers'     => array(
61 61
 			'Accept'       => 'application/json',
@@ -64,35 +64,35 @@  discard block
 block discarded – undo
64 64
 		// we need to downgrade the HTTP version in this case since chunked encoding is dumping numbers in the response.
65 65
 		'httpversion' => '1.0',
66 66
 		'body'        => $content,
67
-	) );
67
+	));
68 68
 
69
-	$response = wp_remote_post( $url, $args );
69
+	$response = wp_remote_post($url, $args);
70 70
 
71 71
 	// If it's an error log it.
72
-	if ( is_wp_error( $response ) ) {
72
+	if (is_wp_error($response)) {
73 73
 
74 74
 		$message = "An error occurred while requesting an analysis to $url: {$response->get_error_message()}";
75 75
 
76
-		Wordlift_Log_Service::get_logger( 'wl_analyze_content' )->error( $message );
76
+		Wordlift_Log_Service::get_logger('wl_analyze_content')->error($message);
77 77
 
78
-		throw new Exception( $response->get_error_message(), is_numeric( $response->get_error_code() ) ? $response->get_error_code() : - 1 );
78
+		throw new Exception($response->get_error_message(), is_numeric($response->get_error_code()) ? $response->get_error_code() : - 1);
79 79
 	}
80 80
 
81 81
 	// Get the status code.
82 82
 	$status_code = (int) $response['response']['code'];
83 83
 
84 84
 	// If status code is OK, return the body.
85
-	if ( 200 === $status_code ) {
85
+	if (200 === $status_code) {
86 86
 		return $response['body'];
87 87
 	}
88 88
 
89 89
 	// Invalid request, e.g. invalid key.
90
-	if ( 400 === $status_code ) {
91
-		$error = json_decode( $response['body'] );
90
+	if (400 === $status_code) {
91
+		$error = json_decode($response['body']);
92 92
 
93
-		throw new Exception( $error->message, $error->code );
93
+		throw new Exception($error->message, $error->code);
94 94
 	}
95 95
 
96 96
 	// Another generic error.
97
-	throw new Exception( "An error occurred.", $status_code );;
97
+	throw new Exception("An error occurred.", $status_code); ;
98 98
 }
Please login to merge, or discard this patch.
src/wordlift_entity_type.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
  */
11 11
 function wl_set_entity_main_type( $post_id, $type_uri ) {
12 12
 
13
-	Wordlift_Entity_Type_Service::get_instance()
14
-	                            ->set( $post_id, $type_uri );
13
+    Wordlift_Entity_Type_Service::get_instance()
14
+                                ->set( $post_id, $type_uri );
15 15
 
16 16
 }
17 17
 
@@ -20,48 +20,48 @@  discard block
 block discarded – undo
20 20
  */
21 21
 function wl_print_entity_type_inline_js() {
22 22
 
23
-	$terms = get_terms( Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, array(
24
-		'hide_empty' => false,
25
-	) );
23
+    $terms = get_terms( Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, array(
24
+        'hide_empty' => false,
25
+    ) );
26 26
 
27
-	echo <<<EOF
27
+    echo <<<EOF
28 28
     <script type="text/javascript">
29 29
         (function() {
30 30
         var t = [];
31 31
 
32 32
 EOF;
33 33
 
34
-	// Cycle in each WordLift term and get its metadata. The metadata will be printed as a global object in JavaScript
35
-	// to be used by the JavaScript client library.
36
-	foreach ( $terms as $term ) {
34
+    // Cycle in each WordLift term and get its metadata. The metadata will be printed as a global object in JavaScript
35
+    // to be used by the JavaScript client library.
36
+    foreach ( $terms as $term ) {
37 37
 
38
-		$term_name = $term->name;
38
+        $term_name = $term->name;
39 39
 
40
-		// Load the type data.
41
-		$type = Wordlift_Schema_Service::get_instance()
42
-		                               ->get_schema( $term->slug );
40
+        // Load the type data.
41
+        $type = Wordlift_Schema_Service::get_instance()
42
+                                        ->get_schema( $term->slug );
43 43
 
44
-		// Skip types that are not defined.
45
-		if ( ! empty( $type['uri'] ) ) {
44
+        // Skip types that are not defined.
45
+        if ( ! empty( $type['uri'] ) ) {
46 46
 
47
-			// Prepare the JSON output then print it to the browser.
48
-			$json = json_encode( array(
49
-				'label'     => $term_name,
50
-				'uri'       => $type['uri'],
51
-				'css'       => $type['css_class'],
52
-				'sameAs'    => $type['same_as'],
53
-				'slug'      => $term->slug,
54
-				'templates' => ( isset( $type['templates'] ) ? $type['templates'] : array() ),
55
-			) );
47
+            // Prepare the JSON output then print it to the browser.
48
+            $json = json_encode( array(
49
+                'label'     => $term_name,
50
+                'uri'       => $type['uri'],
51
+                'css'       => $type['css_class'],
52
+                'sameAs'    => $type['same_as'],
53
+                'slug'      => $term->slug,
54
+                'templates' => ( isset( $type['templates'] ) ? $type['templates'] : array() ),
55
+            ) );
56 56
 
57
-			// Output the type data.
58
-			echo "t.push($json);\n";
57
+            // Output the type data.
58
+            echo "t.push($json);\n";
59 59
 
60
-		}
60
+        }
61 61
 
62
-	}
62
+    }
63 63
 
64
-	echo <<<EOF
64
+    echo <<<EOF
65 65
             if ('undefined' == typeof window.wordlift) {
66 66
                 window.wordlift = {}
67 67
             }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@  discard block
 block discarded – undo
8 8
  * @param int $post_id The numeric post ID.
9 9
  * @param string $type_uri A type URI.
10 10
  */
11
-function wl_set_entity_main_type( $post_id, $type_uri ) {
11
+function wl_set_entity_main_type($post_id, $type_uri) {
12 12
 
13 13
 	Wordlift_Entity_Type_Service::get_instance()
14
-	                            ->set( $post_id, $type_uri );
14
+	                            ->set($post_id, $type_uri);
15 15
 
16 16
 }
17 17
 
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
  */
21 21
 function wl_print_entity_type_inline_js() {
22 22
 
23
-	$terms = get_terms( Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, array(
23
+	$terms = get_terms(Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, array(
24 24
 		'hide_empty' => false,
25
-	) );
25
+	));
26 26
 
27 27
 	echo <<<EOF
28 28
     <script type="text/javascript">
@@ -33,26 +33,26 @@  discard block
 block discarded – undo
33 33
 
34 34
 	// Cycle in each WordLift term and get its metadata. The metadata will be printed as a global object in JavaScript
35 35
 	// to be used by the JavaScript client library.
36
-	foreach ( $terms as $term ) {
36
+	foreach ($terms as $term) {
37 37
 
38 38
 		$term_name = $term->name;
39 39
 
40 40
 		// Load the type data.
41 41
 		$type = Wordlift_Schema_Service::get_instance()
42
-		                               ->get_schema( $term->slug );
42
+		                               ->get_schema($term->slug);
43 43
 
44 44
 		// Skip types that are not defined.
45
-		if ( ! empty( $type['uri'] ) ) {
45
+		if ( ! empty($type['uri'])) {
46 46
 
47 47
 			// Prepare the JSON output then print it to the browser.
48
-			$json = json_encode( array(
48
+			$json = json_encode(array(
49 49
 				'label'     => $term_name,
50 50
 				'uri'       => $type['uri'],
51 51
 				'css'       => $type['css_class'],
52 52
 				'sameAs'    => $type['same_as'],
53 53
 				'slug'      => $term->slug,
54
-				'templates' => ( isset( $type['templates'] ) ? $type['templates'] : array() ),
55
-			) );
54
+				'templates' => (isset($type['templates']) ? $type['templates'] : array()),
55
+			));
56 56
 
57 57
 			// Output the type data.
58 58
 			echo "t.push($json);\n";
@@ -73,4 +73,4 @@  discard block
 block discarded – undo
73 73
 
74 74
 }
75 75
 
76
-add_action( 'admin_print_scripts', 'wl_print_entity_type_inline_js' );
76
+add_action('admin_print_scripts', 'wl_print_entity_type_inline_js');
Please login to merge, or discard this patch.
src/includes/class-wordlift-autocomplete-adapter.php 2 patches
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 if ( ! defined( 'ABSPATH' ) ) {
14
-	exit;
14
+    exit;
15 15
 }
16 16
 
17 17
 /**
@@ -21,82 +21,82 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class Wordlift_Autocomplete_Adapter {
23 23
 
24
-	/**
25
-	 * The {@link Wordlift_Autocomplete_Service} instance.
26
-	 *
27
-	 * @since  3.15.0
28
-	 * @access private
29
-	 * @var \Wordlift_Autocomplete_Service $configuration_service The {@link Wordlift_Autocomplete_Service} instance.
30
-	 */
31
-	private $autocomplete_service;
24
+    /**
25
+     * The {@link Wordlift_Autocomplete_Service} instance.
26
+     *
27
+     * @since  3.15.0
28
+     * @access private
29
+     * @var \Wordlift_Autocomplete_Service $configuration_service The {@link Wordlift_Autocomplete_Service} instance.
30
+     */
31
+    private $autocomplete_service;
32 32
 
33 33
 
34
-	/**
35
-	 * Wordlift_Autocomplete_Adapter constructor.
36
-	 *
37
-	 * @since 3.14.2
38
-	 *
39
-	 * @param \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance.
40
-	 */
41
-	public function __construct( $autocomplete_service ) {
42
-		$this->autocomplete_service = $autocomplete_service;
43
-	}
34
+    /**
35
+     * Wordlift_Autocomplete_Adapter constructor.
36
+     *
37
+     * @since 3.14.2
38
+     *
39
+     * @param \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance.
40
+     */
41
+    public function __construct( $autocomplete_service ) {
42
+        $this->autocomplete_service = $autocomplete_service;
43
+    }
44 44
 
45
-	/**
46
-	 * Handle the autocomplete ajax request.
47
-	 *
48
-	 * @since 3.15.0
49
-	 */
50
-	public function wl_autocomplete() {
51
-		if (
52
-			! isset( $_REQUEST['_wpnonce'] ) || // Input var okay.
53
-			! wp_verify_nonce( sanitize_key( $_REQUEST['_wpnonce'] ), 'wordlift_autocomplete' ) // Input var okay.
54
-		) {
55
-			wp_send_json_error( array(
56
-				'message' => __( 'Nonce field doesn\'t match.', 'wordlift' ),
57
-			) );
58
-		}
45
+    /**
46
+     * Handle the autocomplete ajax request.
47
+     *
48
+     * @since 3.15.0
49
+     */
50
+    public function wl_autocomplete() {
51
+        if (
52
+            ! isset( $_REQUEST['_wpnonce'] ) || // Input var okay.
53
+            ! wp_verify_nonce( sanitize_key( $_REQUEST['_wpnonce'] ), 'wordlift_autocomplete' ) // Input var okay.
54
+        ) {
55
+            wp_send_json_error( array(
56
+                'message' => __( 'Nonce field doesn\'t match.', 'wordlift' ),
57
+            ) );
58
+        }
59 59
 
60
-		// Return error if the query param is empty.
61
-		if ( ! empty( $_REQUEST['query'] ) ) { // Input var okay.
62
-			$query = sanitize_text_field( wp_unslash( $_REQUEST['query'] ) ); // Input var okay.
63
-		} else {
64
-			wp_send_json_error( array(
65
-				'message' => __( 'The query param is empty.', 'wordlift' ),
66
-			) );
67
-		}
60
+        // Return error if the query param is empty.
61
+        if ( ! empty( $_REQUEST['query'] ) ) { // Input var okay.
62
+            $query = sanitize_text_field( wp_unslash( $_REQUEST['query'] ) ); // Input var okay.
63
+        } else {
64
+            wp_send_json_error( array(
65
+                'message' => __( 'The query param is empty.', 'wordlift' ),
66
+            ) );
67
+        }
68 68
 
69
-		// Get the exclude parameter.
70
-		$exclude = ! empty( $_REQUEST['exclude'] )
71
-			? sanitize_text_field( wp_unslash( $_REQUEST['exclude'] ) ) : '';
69
+        // Get the exclude parameter.
70
+        $exclude = ! empty( $_REQUEST['exclude'] )
71
+            ? sanitize_text_field( wp_unslash( $_REQUEST['exclude'] ) ) : '';
72 72
 
73
-		$scope = ! empty( $_REQUEST['scope'] )
74
-			? sanitize_text_field( wp_unslash( $_REQUEST['scope'] ) ) : '';
73
+        $scope = ! empty( $_REQUEST['scope'] )
74
+            ? sanitize_text_field( wp_unslash( $_REQUEST['scope'] ) ) : '';
75 75
 
76
-		// Make request.
77
-		$response = $this->autocomplete_service->make_request( $query, $exclude, $scope );
76
+        // Make request.
77
+        $response = $this->autocomplete_service->make_request( $query, $exclude, $scope );
78 78
 
79
-		// Clear any buffer.
80
-		ob_clean();
79
+        // Clear any buffer.
80
+        ob_clean();
81 81
 
82
-		// If the response is valid, then send the suggestions.
83
-		if ( ! is_wp_error( $response ) && 200 === (int) $response['response']['code'] ) {
84
-			// Echo the response.
85
-			wp_send_json_success( json_decode( wp_remote_retrieve_body( $response ), true ) );
86
-		} else {
87
-			// Default error message.
88
-			$error_message = 'Something went wrong.';
82
+        // If the response is valid, then send the suggestions.
83
+        if ( ! is_wp_error( $response ) && 200 === (int) $response['response']['code'] ) {
84
+            // Echo the response.
85
+            wp_send_json_success( json_decode( wp_remote_retrieve_body( $response ), true ) );
86
+        } else {
87
+            // Default error message.
88
+            $error_message = 'Something went wrong.';
89 89
 
90
-			// Get the real error message if there is WP_Error.
91
-			if ( is_wp_error( $response ) ) {
92
-				$error_message = $response->get_error_message();
93
-			}
90
+            // Get the real error message if there is WP_Error.
91
+            if ( is_wp_error( $response ) ) {
92
+                $error_message = $response->get_error_message();
93
+            }
94 94
 
95
-			// There is an error, so send error message.
96
-			wp_send_json_error( array(
97
-				/* translators: Placeholders: %s - the error message that will be returned. */
98
-				'message' => sprintf( esc_html__( 'Error: %s', 'wordlift' ), $error_message ),
99
-			) );
100
-		}
101
-	}
95
+            // There is an error, so send error message.
96
+            wp_send_json_error( array(
97
+                /* translators: Placeholders: %s - the error message that will be returned. */
98
+                'message' => sprintf( esc_html__( 'Error: %s', 'wordlift' ), $error_message ),
99
+            ) );
100
+        }
101
+    }
102 102
 }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @since      3.15.0
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @param \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance.
40 40
 	 */
41
-	public function __construct( $autocomplete_service ) {
41
+	public function __construct($autocomplete_service) {
42 42
 		$this->autocomplete_service = $autocomplete_service;
43 43
 	}
44 44
 
@@ -49,54 +49,54 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function wl_autocomplete() {
51 51
 		if (
52
-			! isset( $_REQUEST['_wpnonce'] ) || // Input var okay.
53
-			! wp_verify_nonce( sanitize_key( $_REQUEST['_wpnonce'] ), 'wordlift_autocomplete' ) // Input var okay.
52
+			! isset($_REQUEST['_wpnonce']) || // Input var okay.
53
+			! wp_verify_nonce(sanitize_key($_REQUEST['_wpnonce']), 'wordlift_autocomplete') // Input var okay.
54 54
 		) {
55
-			wp_send_json_error( array(
56
-				'message' => __( 'Nonce field doesn\'t match.', 'wordlift' ),
57
-			) );
55
+			wp_send_json_error(array(
56
+				'message' => __('Nonce field doesn\'t match.', 'wordlift'),
57
+			));
58 58
 		}
59 59
 
60 60
 		// Return error if the query param is empty.
61
-		if ( ! empty( $_REQUEST['query'] ) ) { // Input var okay.
62
-			$query = sanitize_text_field( wp_unslash( $_REQUEST['query'] ) ); // Input var okay.
61
+		if ( ! empty($_REQUEST['query'])) { // Input var okay.
62
+			$query = sanitize_text_field(wp_unslash($_REQUEST['query'])); // Input var okay.
63 63
 		} else {
64
-			wp_send_json_error( array(
65
-				'message' => __( 'The query param is empty.', 'wordlift' ),
66
-			) );
64
+			wp_send_json_error(array(
65
+				'message' => __('The query param is empty.', 'wordlift'),
66
+			));
67 67
 		}
68 68
 
69 69
 		// Get the exclude parameter.
70
-		$exclude = ! empty( $_REQUEST['exclude'] )
71
-			? sanitize_text_field( wp_unslash( $_REQUEST['exclude'] ) ) : '';
70
+		$exclude = ! empty($_REQUEST['exclude'])
71
+			? sanitize_text_field(wp_unslash($_REQUEST['exclude'])) : '';
72 72
 
73
-		$scope = ! empty( $_REQUEST['scope'] )
74
-			? sanitize_text_field( wp_unslash( $_REQUEST['scope'] ) ) : '';
73
+		$scope = ! empty($_REQUEST['scope'])
74
+			? sanitize_text_field(wp_unslash($_REQUEST['scope'])) : '';
75 75
 
76 76
 		// Make request.
77
-		$response = $this->autocomplete_service->make_request( $query, $exclude, $scope );
77
+		$response = $this->autocomplete_service->make_request($query, $exclude, $scope);
78 78
 
79 79
 		// Clear any buffer.
80 80
 		ob_clean();
81 81
 
82 82
 		// If the response is valid, then send the suggestions.
83
-		if ( ! is_wp_error( $response ) && 200 === (int) $response['response']['code'] ) {
83
+		if ( ! is_wp_error($response) && 200 === (int) $response['response']['code']) {
84 84
 			// Echo the response.
85
-			wp_send_json_success( json_decode( wp_remote_retrieve_body( $response ), true ) );
85
+			wp_send_json_success(json_decode(wp_remote_retrieve_body($response), true));
86 86
 		} else {
87 87
 			// Default error message.
88 88
 			$error_message = 'Something went wrong.';
89 89
 
90 90
 			// Get the real error message if there is WP_Error.
91
-			if ( is_wp_error( $response ) ) {
91
+			if (is_wp_error($response)) {
92 92
 				$error_message = $response->get_error_message();
93 93
 			}
94 94
 
95 95
 			// There is an error, so send error message.
96
-			wp_send_json_error( array(
96
+			wp_send_json_error(array(
97 97
 				/* translators: Placeholders: %s - the error message that will be returned. */
98
-				'message' => sprintf( esc_html__( 'Error: %s', 'wordlift' ), $error_message ),
99
-			) );
98
+				'message' => sprintf(esc_html__('Error: %s', 'wordlift'), $error_message),
99
+			));
100 100
 		}
101 101
 	}
102 102
 }
Please login to merge, or discard this patch.
src/includes/class-wordlift-autocomplete-service.php 2 patches
Indentation   +80 added lines, -81 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 if ( ! defined( 'ABSPATH' ) ) {
14
-	exit;
14
+    exit;
15 15
 }
16 16
 
17 17
 /**
@@ -20,93 +20,92 @@  discard block
 block discarded – undo
20 20
  * @since 3.15.0
21 21
  */
22 22
 class Wordlift_Autocomplete_Service {
23
-	/**
24
-	 * The {@link Wordlift_Configuration_Service} instance.
25
-	 *
26
-	 * @since  3.15.0
27
-	 * @access private
28
-	 * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
29
-	 */
30
-	private $configuration_service;
23
+    /**
24
+     * The {@link Wordlift_Configuration_Service} instance.
25
+     *
26
+     * @since  3.15.0
27
+     * @access private
28
+     * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
29
+     */
30
+    private $configuration_service;
31 31
 
32
-	/**
33
-	 * A {@link Wordlift_Log_Service} instance.
34
-	 *
35
-	 * @since  3.15.0
36
-	 * @access private
37
-	 * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
38
-	 */
39
-	private $log;
32
+    /**
33
+     * A {@link Wordlift_Log_Service} instance.
34
+     *
35
+     * @since  3.15.0
36
+     * @access private
37
+     * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
38
+     */
39
+    private $log;
40 40
 
41
-	/**
42
-	 * The {@link Class_Wordlift_Autocomplete_Service} instance.
43
-	 *
44
-	 * @since 3.15.0
45
-	 *
46
-	 * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
47
-	 */
48
-	public function __construct( $configuration_service ) {
49
-		$this->configuration_service = $configuration_service;
50
-		$this->log                   = Wordlift_Log_Service::get_logger( 'Wordlift_Autocomplete_Service' );
51
-	}
41
+    /**
42
+     * The {@link Class_Wordlift_Autocomplete_Service} instance.
43
+     *
44
+     * @since 3.15.0
45
+     *
46
+     * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
47
+     */
48
+    public function __construct( $configuration_service ) {
49
+        $this->configuration_service = $configuration_service;
50
+        $this->log                   = Wordlift_Log_Service::get_logger( 'Wordlift_Autocomplete_Service' );
51
+    }
52 52
 
53
-	/**
54
-	 * Make request to external API and return the response.
55
-	 *
56
-	 * @since 3.15.0
57
-	 *
58
-	 * @param string $query The search string.
59
-	 * @param array|string $exclude The exclude parameter string.
60
-	 * @param string $scope The search scope: "local" will search only in the local dataset; "cloud" will search also
61
-	 *                      in Wikipedia. By default is "cloud".
62
-	 *
63
-	 * @return array $response The API response.
64
-	 */
65
-	public function make_request( $query, $exclude = '', $scope = 'cloud' ) {
66
-		$url = $this->build_request_url( $query, $exclude, $scope );
53
+    /**
54
+     * Make request to external API and return the response.
55
+     *
56
+     * @since 3.15.0
57
+     *
58
+     * @param string $query The search string.
59
+     * @param array|string $exclude The exclude parameter string.
60
+     * @param string $scope The search scope: "local" will search only in the local dataset; "cloud" will search also
61
+     *                      in Wikipedia. By default is "cloud".
62
+     *
63
+     * @return array $response The API response.
64
+     */
65
+    public function make_request( $query, $exclude = '', $scope = 'cloud' ) {
66
+        $url = $this->build_request_url( $query, $exclude, $scope );
67 67
 
68
-		// Make request.
69
-		$response = wp_remote_get( $url );
68
+        // Make request.
69
+        $response = wp_remote_get( $url );
70 70
 
71
-		// Return the response.
72
-		return $response;
73
-	}
71
+        // Return the response.
72
+        return $response;
73
+    }
74 74
 
75
-	/**
76
-	 * Build the autocomplete url.
77
-	 *
78
-	 * @since 3.15.0
79
-	 *
80
-	 * @param string $query The search string.
81
-	 * @param array|string $exclude The exclude parameter.
82
-	 * @param string $scope The search scope: "local" will search only in the local dataset; "cloud" will search also
83
-	 *                      in Wikipedia. By default is "cloud".
75
+    /**
76
+     * Build the autocomplete url.
77
+     *
78
+     * @since 3.15.0
79
+     *
80
+     * @param string $query The search string.
81
+     * @param array|string $exclude The exclude parameter.
82
+     * @param string $scope The search scope: "local" will search only in the local dataset; "cloud" will search also
83
+     *                      in Wikipedia. By default is "cloud".
84
+     * @return string Built url.
85
+     */
86
+    private function build_request_url( $query, $exclude, $scope ) {
87
+        $args = array(
88
+            'key'      => $this->configuration_service->get_key(),
89
+            'language' => $this->configuration_service->get_language_code(),
90
+            'query'    => $query,
91
+            'scope'    => $scope,
92
+            'limit'    => 100,
93
+        );
84 94
 
85
-	 * @return string Built url.
86
-	 */
87
-	private function build_request_url( $query, $exclude, $scope ) {
88
-		$args = array(
89
-			'key'      => $this->configuration_service->get_key(),
90
-			'language' => $this->configuration_service->get_language_code(),
91
-			'query'    => $query,
92
-			'scope'    => $scope,
93
-			'limit'    => 100,
94
-		);
95
+        // Add args to URL.
96
+        $request_url = add_query_arg(
97
+            urlencode_deep( $args ),
98
+            $this->configuration_service->get_autocomplete_url()
99
+        );
95 100
 
96
-		// Add args to URL.
97
-		$request_url = add_query_arg(
98
-			urlencode_deep( $args ),
99
-			$this->configuration_service->get_autocomplete_url()
100
-		);
101
+        // Add the exclude parameter.
102
+        if ( ! empty( $exclude ) ) {
103
+            foreach ( (array) $exclude as $item ) {
104
+                $request_url .= "&exclude=" . urlencode( $item );
105
+            }
106
+        }
101 107
 
102
-		// Add the exclude parameter.
103
-		if ( ! empty( $exclude ) ) {
104
-			foreach ( (array) $exclude as $item ) {
105
-				$request_url .= "&exclude=" . urlencode( $item );
106
-			}
107
-		}
108
-
109
-		// return the built url.
110
-		return $request_url;
111
-	}
108
+        // return the built url.
109
+        return $request_url;
110
+    }
112 111
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @since      3.15.0
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
47 47
 	 */
48
-	public function __construct( $configuration_service ) {
48
+	public function __construct($configuration_service) {
49 49
 		$this->configuration_service = $configuration_service;
50
-		$this->log                   = Wordlift_Log_Service::get_logger( 'Wordlift_Autocomplete_Service' );
50
+		$this->log                   = Wordlift_Log_Service::get_logger('Wordlift_Autocomplete_Service');
51 51
 	}
52 52
 
53 53
 	/**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return array $response The API response.
64 64
 	 */
65
-	public function make_request( $query, $exclude = '', $scope = 'cloud' ) {
66
-		$url = $this->build_request_url( $query, $exclude, $scope );
65
+	public function make_request($query, $exclude = '', $scope = 'cloud') {
66
+		$url = $this->build_request_url($query, $exclude, $scope);
67 67
 
68 68
 		// Make request.
69
-		$response = wp_remote_get( $url );
69
+		$response = wp_remote_get($url);
70 70
 
71 71
 		// Return the response.
72 72
 		return $response;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
 	 * @return string Built url.
86 86
 	 */
87
-	private function build_request_url( $query, $exclude, $scope ) {
87
+	private function build_request_url($query, $exclude, $scope) {
88 88
 		$args = array(
89 89
 			'key'      => $this->configuration_service->get_key(),
90 90
 			'language' => $this->configuration_service->get_language_code(),
@@ -95,14 +95,14 @@  discard block
 block discarded – undo
95 95
 
96 96
 		// Add args to URL.
97 97
 		$request_url = add_query_arg(
98
-			urlencode_deep( $args ),
98
+			urlencode_deep($args),
99 99
 			$this->configuration_service->get_autocomplete_url()
100 100
 		);
101 101
 
102 102
 		// Add the exclude parameter.
103
-		if ( ! empty( $exclude ) ) {
104
-			foreach ( (array) $exclude as $item ) {
105
-				$request_url .= "&exclude=" . urlencode( $item );
103
+		if ( ! empty($exclude)) {
104
+			foreach ((array) $exclude as $item) {
105
+				$request_url .= "&exclude=".urlencode($item);
106 106
 			}
107 107
 		}
108 108
 
Please login to merge, or discard this patch.
src/includes/class-wordlift.php 1 patch
Indentation   +1547 added lines, -1547 removed lines patch added patch discarded remove patch
@@ -28,1577 +28,1577 @@
 block discarded – undo
28 28
  */
29 29
 class Wordlift {
30 30
 
31
-	//<editor-fold desc="## FIELDS">
32
-
33
-	/**
34
-	 * The loader that's responsible for maintaining and registering all hooks that power
35
-	 * the plugin.
36
-	 *
37
-	 * @since    1.0.0
38
-	 * @access   protected
39
-	 * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
40
-	 */
41
-	protected $loader;
42
-
43
-	/**
44
-	 * The unique identifier of this plugin.
45
-	 *
46
-	 * @since    1.0.0
47
-	 * @access   protected
48
-	 * @var      string $plugin_name The string used to uniquely identify this plugin.
49
-	 */
50
-	protected $plugin_name;
51
-
52
-	/**
53
-	 * The current version of the plugin.
54
-	 *
55
-	 * @since    1.0.0
56
-	 * @access   protected
57
-	 * @var      string $version The current version of the plugin.
58
-	 */
59
-	protected $version;
60
-
61
-	/**
62
-	 * The {@link Wordlift_Tinymce_Adapter} instance.
63
-	 *
64
-	 * @since  3.12.0
65
-	 * @access protected
66
-	 * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
67
-	 */
68
-	protected $tinymce_adapter;
69
-
70
-	/**
71
-	 * The Thumbnail service.
72
-	 *
73
-	 * @since  3.1.5
74
-	 * @access private
75
-	 * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
76
-	 */
77
-	private $thumbnail_service;
78
-
79
-	/**
80
-	 * The UI service.
81
-	 *
82
-	 * @since  3.2.0
83
-	 * @access private
84
-	 * @var \Wordlift_UI_Service $ui_service The UI service.
85
-	 */
86
-	private $ui_service;
87
-
88
-	/**
89
-	 * The Schema service.
90
-	 *
91
-	 * @since  3.3.0
92
-	 * @access protected
93
-	 * @var \Wordlift_Schema_Service $schema_service The Schema service.
94
-	 */
95
-	protected $schema_service;
96
-
97
-	/**
98
-	 * The Entity service.
99
-	 *
100
-	 * @since  3.1.0
101
-	 * @access protected
102
-	 * @var \Wordlift_Entity_Service $entity_service The Entity service.
103
-	 */
104
-	protected $entity_service;
105
-
106
-	/**
107
-	 * The Topic Taxonomy service.
108
-	 *
109
-	 * @since  3.5.0
110
-	 * @access private
111
-	 * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
112
-	 */
113
-	private $topic_taxonomy_service;
114
-
115
-	/**
116
-	 * The Entity Types Taxonomy service.
117
-	 *
118
-	 * @since  3.18.0
119
-	 * @access private
120
-	 * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service.
121
-	 */
122
-	private $entity_types_taxonomy_service;
123
-
124
-	/**
125
-	 * The User service.
126
-	 *
127
-	 * @since  3.1.7
128
-	 * @access protected
129
-	 * @var \Wordlift_User_Service $user_service The User service.
130
-	 */
131
-	protected $user_service;
132
-
133
-	/**
134
-	 * The Timeline service.
135
-	 *
136
-	 * @since  3.1.0
137
-	 * @access private
138
-	 * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
139
-	 */
140
-	private $timeline_service;
141
-
142
-	/**
143
-	 * The Redirect service.
144
-	 *
145
-	 * @since  3.2.0
146
-	 * @access private
147
-	 * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
148
-	 */
149
-	private $redirect_service;
150
-
151
-	/**
152
-	 * The Notice service.
153
-	 *
154
-	 * @since  3.3.0
155
-	 * @access private
156
-	 * @var \Wordlift_Notice_Service $notice_service The Notice service.
157
-	 */
158
-	private $notice_service;
159
-
160
-	/**
161
-	 * The Entity list customization.
162
-	 *
163
-	 * @since  3.3.0
164
-	 * @access protected
165
-	 * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
166
-	 */
167
-	protected $entity_list_service;
168
-
169
-	/**
170
-	 * The Entity Types Taxonomy Walker.
171
-	 *
172
-	 * @since  3.1.0
173
-	 * @access private
174
-	 * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
175
-	 */
176
-	private $entity_types_taxonomy_walker;
177
-
178
-	/**
179
-	 * The ShareThis service.
180
-	 *
181
-	 * @since  3.2.0
182
-	 * @access private
183
-	 * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
184
-	 */
185
-	private $sharethis_service;
186
-
187
-	/**
188
-	 * The PrimaShop adapter.
189
-	 *
190
-	 * @since  3.2.3
191
-	 * @access private
192
-	 * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
193
-	 */
194
-	private $primashop_adapter;
195
-
196
-	/**
197
-	 * The WordLift Dashboard adapter.
198
-	 *
199
-	 * @since  3.4.0
200
-	 * @access private
201
-	 * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
202
-	 */
203
-	private $dashboard_service;
204
-
205
-	/**
206
-	 * The entity type service.
207
-	 *
208
-	 * @since  3.6.0
209
-	 * @access private
210
-	 * @var \Wordlift_Entity_Post_Type_Service
211
-	 */
212
-	private $entity_post_type_service;
213
-
214
-	/**
215
-	 * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
216
-	 *
217
-	 * @since  3.6.0
218
-	 * @access private
219
-	 * @var \Wordlift_Entity_Link_Service
220
-	 */
221
-	private $entity_link_service;
222
-
223
-	/**
224
-	 * A {@link Wordlift_Sparql_Service} instance.
225
-	 *
226
-	 * @since    3.6.0
227
-	 * @access   protected
228
-	 * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
229
-	 */
230
-	protected $sparql_service;
231
-
232
-	/**
233
-	 * A {@link Wordlift_Import_Service} instance.
234
-	 *
235
-	 * @since  3.6.0
236
-	 * @access private
237
-	 * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
238
-	 */
239
-	private $import_service;
240
-
241
-	/**
242
-	 * A {@link Wordlift_Rebuild_Service} instance.
243
-	 *
244
-	 * @since  3.6.0
245
-	 * @access private
246
-	 * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
247
-	 */
248
-	private $rebuild_service;
249
-
250
-	/**
251
-	 * A {@link Wordlift_Jsonld_Service} instance.
252
-	 *
253
-	 * @since  3.7.0
254
-	 * @access protected
255
-	 * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
256
-	 */
257
-	protected $jsonld_service;
258
-
259
-	/**
260
-	 * A {@link Wordlift_Website_Jsonld_Converter} instance.
261
-	 *
262
-	 * @since  3.14.0
263
-	 * @access protected
264
-	 * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
265
-	 */
266
-	protected $jsonld_website_converter;
267
-
268
-	/**
269
-	 * A {@link Wordlift_Property_Factory} instance.
270
-	 *
271
-	 * @since  3.7.0
272
-	 * @access private
273
-	 * @var \Wordlift_Property_Factory $property_factory
274
-	 */
275
-	private $property_factory;
276
-
277
-	/**
278
-	 * The 'Download Your Data' page.
279
-	 *
280
-	 * @since  3.6.0
281
-	 * @access private
282
-	 * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
283
-	 */
284
-	private $download_your_data_page;
285
-
286
-	/**
287
-	 * The 'WordLift Settings' page.
288
-	 *
289
-	 * @since  3.11.0
290
-	 * @access protected
291
-	 * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
292
-	 */
293
-	protected $settings_page;
294
-
295
-	/**
296
-	 * The 'WordLift Batch analysis' page.
297
-	 *
298
-	 * @since  3.14.0
299
-	 * @access protected
300
-	 * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page.
301
-	 */
302
-	protected $batch_analysis_page;
303
-
304
-	/**
305
-	 * The install wizard page.
306
-	 *
307
-	 * @since  3.9.0
308
-	 * @access private
309
-	 * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
310
-	 */
311
-	private $admin_setup;
312
-
313
-	/**
314
-	 * The Content Filter Service hooks up to the 'the_content' filter and provides
315
-	 * linking of entities to their pages.
316
-	 *
317
-	 * @since  3.8.0
318
-	 * @access private
319
-	 * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
320
-	 */
321
-	private $content_filter_service;
322
-
323
-	/**
324
-	 * A {@link Wordlift_Key_Validation_Service} instance.
325
-	 *
326
-	 * @since  3.9.0
327
-	 * @access private
328
-	 * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
329
-	 */
330
-	private $key_validation_service;
331
-
332
-	/**
333
-	 * A {@link Wordlift_Rating_Service} instance.
334
-	 *
335
-	 * @since  3.10.0
336
-	 * @access private
337
-	 * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
338
-	 */
339
-	private $rating_service;
340
-
341
-	/**
342
-	 * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
343
-	 *
344
-	 * @since  3.10.0
345
-	 * @access protected
346
-	 * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
347
-	 */
348
-	protected $post_to_jsonld_converter;
349
-
350
-	/**
351
-	 * A {@link Wordlift_Configuration_Service} instance.
352
-	 *
353
-	 * @since  3.10.0
354
-	 * @access protected
355
-	 * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
356
-	 */
357
-	protected $configuration_service;
358
-
359
-	/**
360
-	 * A {@link Wordlift_Install_Service} instance.
361
-	 *
362
-	 * @since  3.18.0
363
-	 * @access protected
364
-	 * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance.
365
-	 */
366
-	protected $install_service;
367
-
368
-	/**
369
-	 * A {@link Wordlift_Entity_Type_Service} instance.
370
-	 *
371
-	 * @since  3.10.0
372
-	 * @access protected
373
-	 * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
374
-	 */
375
-	protected $entity_type_service;
376
-
377
-	/**
378
-	 * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
379
-	 *
380
-	 * @since  3.10.0
381
-	 * @access protected
382
-	 * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
383
-	 */
384
-	protected $entity_post_to_jsonld_converter;
385
-
386
-	/**
387
-	 * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
388
-	 *
389
-	 * @since  3.10.0
390
-	 * @access protected
391
-	 * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
392
-	 */
393
-	protected $postid_to_jsonld_converter;
394
-
395
-	/**
396
-	 * The {@link Wordlift_Admin_Status_Page} class.
397
-	 *
398
-	 * @since  3.9.8
399
-	 * @access private
400
-	 * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
401
-	 */
402
-	private $status_page;
403
-
404
-	/**
405
-	 * The {@link Wordlift_Category_Taxonomy_Service} instance.
406
-	 *
407
-	 * @since  3.11.0
408
-	 * @access protected
409
-	 * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
410
-	 */
411
-	protected $category_taxonomy_service;
412
-
413
-	/**
414
-	 * The {@link Wordlift_Entity_Page_Service} instance.
415
-	 *
416
-	 * @since  3.11.0
417
-	 * @access protected
418
-	 * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
419
-	 */
420
-	protected $entity_page_service;
421
-
422
-	/**
423
-	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
424
-	 *
425
-	 * @since  3.11.0
426
-	 * @access protected
427
-	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
428
-	 */
429
-	protected $settings_page_action_link;
430
-
431
-	/**
432
-	 * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
433
-	 *
434
-	 * @since  3.11.0
435
-	 * @access protected
436
-	 * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
437
-	 */
438
-	protected $publisher_ajax_adapter;
439
-
440
-	/**
441
-	 * The {@link Wordlift_Admin_Input_Element} element renderer.
442
-	 *
443
-	 * @since  3.11.0
444
-	 * @access protected
445
-	 * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
446
-	 */
447
-	protected $input_element;
448
-
449
-	/**
450
-	 * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
451
-	 *
452
-	 * @since  3.13.0
453
-	 * @access protected
454
-	 * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
455
-	 */
456
-	protected $radio_input_element;
457
-
458
-	/**
459
-	 * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
460
-	 *
461
-	 * @since  3.11.0
462
-	 * @access protected
463
-	 * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
464
-	 */
465
-	protected $language_select_element;
466
-
467
-	/**
468
-	 * The {@link Wordlift_Admin_Publisher_Element} element renderer.
469
-	 *
470
-	 * @since  3.11.0
471
-	 * @access protected
472
-	 * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
473
-	 */
474
-	protected $publisher_element;
475
-
476
-	/**
477
-	 * The {@link Wordlift_Admin_Select2_Element} element renderer.
478
-	 *
479
-	 * @since  3.11.0
480
-	 * @access protected
481
-	 * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
482
-	 */
483
-	protected $select2_element;
484
-
485
-	/**
486
-	 * The controller for the entity type list admin page
487
-	 *
488
-	 * @since  3.11.0
489
-	 * @access private
490
-	 * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
491
-	 */
492
-	private $entity_type_admin_page;
493
-
494
-	/**
495
-	 * The controller for the entity type settings admin page
496
-	 *
497
-	 * @since  3.11.0
498
-	 * @access private
499
-	 * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
500
-	 */
501
-	private $entity_type_settings_admin_page;
502
-
503
-	/**
504
-	 * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
505
-	 *
506
-	 * @since  3.11.0
507
-	 * @access protected
508
-	 * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
509
-	 */
510
-	protected $related_entities_cloud_widget;
511
-
512
-	/**
513
-	 * The {@link Wordlift_Admin_Author_Element} instance.
514
-	 *
515
-	 * @since  3.14.0
516
-	 * @access protected
517
-	 * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
518
-	 */
519
-	protected $author_element;
520
-
521
-	/**
522
-	 * The {@link Wordlift_Batch_Analysis_Service} instance.
523
-	 *
524
-	 * @since  3.14.0
525
-	 * @access protected
526
-	 * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance.
527
-	 */
528
-	protected $batch_analysis_service;
529
-
530
-	/**
531
-	 * The {@link Wordlift_Sample_Data_Service} instance.
532
-	 *
533
-	 * @since  3.12.0
534
-	 * @access protected
535
-	 * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
536
-	 */
537
-	protected $sample_data_service;
538
-
539
-	/**
540
-	 * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
541
-	 *
542
-	 * @since  3.12.0
543
-	 * @access protected
544
-	 * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
545
-	 */
546
-	protected $sample_data_ajax_adapter;
547
-
548
-	/**
549
-	 * The {@link Wordlift_Batch_Analysis_Adapter} instance.
550
-	 *
551
-	 * @since  3.14.2
552
-	 * @access protected
553
-	 * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance.
554
-	 */
555
-	private $batch_analysis_adapter;
556
-
557
-	/**
558
-	 * The {@link Wordlift_Relation_Rebuild_Service} instance.
559
-	 *
560
-	 * @since  3.14.3
561
-	 * @access private
562
-	 * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
563
-	 */
564
-	private $relation_rebuild_service;
565
-
566
-	/**
567
-	 * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
568
-	 *
569
-	 * @since  3.14.3
570
-	 * @access private
571
-	 * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
572
-	 */
573
-	private $relation_rebuild_adapter;
574
-
575
-	/**
576
-	 * The {@link Wordlift_Reference_Rebuild_Service} instance.
577
-	 *
578
-	 * @since  3.18.0
579
-	 * @access private
580
-	 * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance.
581
-	 */
582
-	private $reference_rebuild_service;
583
-
584
-	/**
585
-	 * The {@link Wordlift_Google_Analytics_Export_Service} instance.
586
-	 *
587
-	 * @since  3.16.0
588
-	 * @access protected
589
-	 * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
590
-	 */
591
-	protected $google_analytics_export_service;
592
-
593
-	/**
594
-	 * {@link Wordlift}'s singleton instance.
595
-	 *
596
-	 * @since  3.15.0
597
-	 * @access protected
598
-	 * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
599
-	 */
600
-	protected $entity_type_adapter;
601
-
602
-	/**
603
-	 * The {@link Wordlift_Linked_Data_Service} instance.
604
-	 *
605
-	 * @since  3.15.0
606
-	 * @access protected
607
-	 * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance.
608
-	 */
609
-	protected $linked_data_service;
610
-
611
-	/**
612
-	 * The {@link Wordlift_Storage_Factory} instance.
613
-	 *
614
-	 * @since  3.15.0
615
-	 * @access protected
616
-	 * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
617
-	 */
618
-	protected $storage_factory;
619
-
620
-	/**
621
-	 * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
622
-	 *
623
-	 * @since  3.15.0
624
-	 * @access protected
625
-	 * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
626
-	 */
627
-	protected $rendition_factory;
628
-
629
-	/**
630
-	 * The {@link Wordlift_Autocomplete_Service} instance.
631
-	 *
632
-	 * @since  3.15.0
633
-	 * @access private
634
-	 * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance.
635
-	 */
636
-	private $autocomplete_service;
637
-
638
-	/**
639
-	 * The {@link Wordlift_Autocomplete_Adapter} instance.
640
-	 *
641
-	 * @since  3.15.0
642
-	 * @access private
643
-	 * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
644
-	 */
645
-	private $autocomplete_adapter;
646
-
647
-	/**
648
-	 * The {@link Wordlift_Relation_Service} instance.
649
-	 *
650
-	 * @since  3.15.0
651
-	 * @access protected
652
-	 * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
653
-	 */
654
-	protected $relation_service;
655
-
656
-	/**
657
-	 * The {@link Wordlift_Cached_Post_Converter} instance.
658
-	 *
659
-	 * @since  3.16.0
660
-	 * @access protected
661
-	 * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
662
-	 *
663
-	 */
664
-	protected $cached_postid_to_jsonld_converter;
665
-
666
-	/**
667
-	 * The {@link Wordlift_File_Cache_Service} instance.
668
-	 *
669
-	 * @since  3.16.0
670
-	 * @access protected
671
-	 * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance.
672
-	 */
673
-	protected $file_cache_service;
674
-
675
-	/**
676
-	 * The {@link Wordlift_Entity_Uri_Service} instance.
677
-	 *
678
-	 * @since  3.16.3
679
-	 * @access protected
680
-	 * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
681
-	 */
682
-	protected $entity_uri_service;
683
-
684
-	/**
685
-	 * {@link Wordlift}'s singleton instance.
686
-	 *
687
-	 * @since  3.11.2
688
-	 * @access private
689
-	 * @var Wordlift $instance {@link Wordlift}'s singleton instance.
690
-	 */
691
-	private static $instance;
692
-	//</editor-fold>
693
-
694
-	/**
695
-	 * Define the core functionality of the plugin.
696
-	 *
697
-	 * Set the plugin name and the plugin version that can be used throughout the plugin.
698
-	 * Load the dependencies, define the locale, and set the hooks for the admin area and
699
-	 * the public-facing side of the site.
700
-	 *
701
-	 * @since    1.0.0
702
-	 */
703
-	public function __construct() {
704
-
705
-		$this->plugin_name = 'wordlift';
706
-		$this->version     = '3.18.4';
707
-		$this->load_dependencies();
708
-		$this->set_locale();
709
-		$this->define_admin_hooks();
710
-		$this->define_public_hooks();
711
-
712
-		// If we're in `WP_CLI` load the related files.
713
-		if ( class_exists( 'WP_CLI' ) ) {
714
-			$this->load_cli_dependencies();
715
-		}
716
-
717
-		self::$instance = $this;
718
-
719
-	}
720
-
721
-	/**
722
-	 * Get the singleton instance.
723
-	 *
724
-	 * @since 3.11.2
725
-	 *
726
-	 * @return Wordlift The {@link Wordlift} singleton instance.
727
-	 */
728
-	public static function get_instance() {
729
-
730
-		return self::$instance;
731
-	}
732
-
733
-	/**
734
-	 * Load the required dependencies for this plugin.
735
-	 *
736
-	 * Include the following files that make up the plugin:
737
-	 *
738
-	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
739
-	 * - Wordlift_i18n. Defines internationalization functionality.
740
-	 * - Wordlift_Admin. Defines all hooks for the admin area.
741
-	 * - Wordlift_Public. Defines all hooks for the public side of the site.
742
-	 *
743
-	 * Create an instance of the loader which will be used to register the hooks
744
-	 * with WordPress.
745
-	 *
746
-	 * @since    1.0.0
747
-	 * @access   private
748
-	 */
749
-	private function load_dependencies() {
750
-
751
-		/**
752
-		 * The class responsible for orchestrating the actions and filters of the
753
-		 * core plugin.
754
-		 */
755
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
756
-
757
-		/**
758
-		 * The class responsible for defining internationalization functionality
759
-		 * of the plugin.
760
-		 */
761
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
762
-
763
-		/**
764
-		 * WordLift's supported languages.
765
-		 */
766
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
767
-
768
-		/**
769
-		 * Provide support functions to sanitize data.
770
-		 */
771
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
772
-
773
-		/** Installs. */
774
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install.php';
775
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
776
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-1-0-0.php';
777
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-10-0.php';
778
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-12-0.php';
779
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-14-0.php';
780
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-15-0.php';
781
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-0.php';
782
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-3.php';
783
-
784
-		/** Services. */
785
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
786
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
787
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
788
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
789
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
790
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
791
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
792
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
793
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
794
-
795
-		/**
796
-		 * The Query builder.
797
-		 */
798
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
799
-
800
-		/**
801
-		 * The Schema service.
802
-		 */
803
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
804
-
805
-		/**
806
-		 * The schema:url property service.
807
-		 */
808
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
809
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
810
-
811
-		/**
812
-		 * The UI service.
813
-		 */
814
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
815
-
816
-		/**
817
-		 * The Thumbnail service.
818
-		 */
819
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
820
-
821
-		/**
822
-		 * The Entity Types Taxonomy service.
823
-		 */
824
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
825
-
826
-		/**
827
-		 * The Entity service.
828
-		 */
829
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
830
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
831
-
832
-		// Add the entity rating service.
833
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
834
-
835
-		/**
836
-		 * The User service.
837
-		 */
838
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
839
-
840
-		/**
841
-		 * The Timeline service.
842
-		 */
843
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
844
-
845
-		/**
846
-		 * The Topic Taxonomy service.
847
-		 */
848
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
849
-
850
-		/**
851
-		 * The SPARQL service.
852
-		 */
853
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
854
-
855
-		/**
856
-		 * The WordLift import service.
857
-		 */
858
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
859
-
860
-		/**
861
-		 * The WordLift URI service.
862
-		 */
863
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
864
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
865
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
866
-
867
-		/**
868
-		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
869
-		 */
870
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php';
871
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php';
872
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php';
873
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php';
874
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
875
-
876
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
877
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
878
-
879
-		/**
880
-		 * Load the converters.
881
-		 */
882
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
883
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
884
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
885
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
886
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
887
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
888
-
889
-		/**
890
-		 * Load cache-related files.
891
-		 */
892
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
893
-
894
-		/**
895
-		 * Load the content filter.
896
-		 */
897
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
898
-
899
-		/*
31
+    //<editor-fold desc="## FIELDS">
32
+
33
+    /**
34
+     * The loader that's responsible for maintaining and registering all hooks that power
35
+     * the plugin.
36
+     *
37
+     * @since    1.0.0
38
+     * @access   protected
39
+     * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
40
+     */
41
+    protected $loader;
42
+
43
+    /**
44
+     * The unique identifier of this plugin.
45
+     *
46
+     * @since    1.0.0
47
+     * @access   protected
48
+     * @var      string $plugin_name The string used to uniquely identify this plugin.
49
+     */
50
+    protected $plugin_name;
51
+
52
+    /**
53
+     * The current version of the plugin.
54
+     *
55
+     * @since    1.0.0
56
+     * @access   protected
57
+     * @var      string $version The current version of the plugin.
58
+     */
59
+    protected $version;
60
+
61
+    /**
62
+     * The {@link Wordlift_Tinymce_Adapter} instance.
63
+     *
64
+     * @since  3.12.0
65
+     * @access protected
66
+     * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
67
+     */
68
+    protected $tinymce_adapter;
69
+
70
+    /**
71
+     * The Thumbnail service.
72
+     *
73
+     * @since  3.1.5
74
+     * @access private
75
+     * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
76
+     */
77
+    private $thumbnail_service;
78
+
79
+    /**
80
+     * The UI service.
81
+     *
82
+     * @since  3.2.0
83
+     * @access private
84
+     * @var \Wordlift_UI_Service $ui_service The UI service.
85
+     */
86
+    private $ui_service;
87
+
88
+    /**
89
+     * The Schema service.
90
+     *
91
+     * @since  3.3.0
92
+     * @access protected
93
+     * @var \Wordlift_Schema_Service $schema_service The Schema service.
94
+     */
95
+    protected $schema_service;
96
+
97
+    /**
98
+     * The Entity service.
99
+     *
100
+     * @since  3.1.0
101
+     * @access protected
102
+     * @var \Wordlift_Entity_Service $entity_service The Entity service.
103
+     */
104
+    protected $entity_service;
105
+
106
+    /**
107
+     * The Topic Taxonomy service.
108
+     *
109
+     * @since  3.5.0
110
+     * @access private
111
+     * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
112
+     */
113
+    private $topic_taxonomy_service;
114
+
115
+    /**
116
+     * The Entity Types Taxonomy service.
117
+     *
118
+     * @since  3.18.0
119
+     * @access private
120
+     * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service.
121
+     */
122
+    private $entity_types_taxonomy_service;
123
+
124
+    /**
125
+     * The User service.
126
+     *
127
+     * @since  3.1.7
128
+     * @access protected
129
+     * @var \Wordlift_User_Service $user_service The User service.
130
+     */
131
+    protected $user_service;
132
+
133
+    /**
134
+     * The Timeline service.
135
+     *
136
+     * @since  3.1.0
137
+     * @access private
138
+     * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
139
+     */
140
+    private $timeline_service;
141
+
142
+    /**
143
+     * The Redirect service.
144
+     *
145
+     * @since  3.2.0
146
+     * @access private
147
+     * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
148
+     */
149
+    private $redirect_service;
150
+
151
+    /**
152
+     * The Notice service.
153
+     *
154
+     * @since  3.3.0
155
+     * @access private
156
+     * @var \Wordlift_Notice_Service $notice_service The Notice service.
157
+     */
158
+    private $notice_service;
159
+
160
+    /**
161
+     * The Entity list customization.
162
+     *
163
+     * @since  3.3.0
164
+     * @access protected
165
+     * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
166
+     */
167
+    protected $entity_list_service;
168
+
169
+    /**
170
+     * The Entity Types Taxonomy Walker.
171
+     *
172
+     * @since  3.1.0
173
+     * @access private
174
+     * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
175
+     */
176
+    private $entity_types_taxonomy_walker;
177
+
178
+    /**
179
+     * The ShareThis service.
180
+     *
181
+     * @since  3.2.0
182
+     * @access private
183
+     * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
184
+     */
185
+    private $sharethis_service;
186
+
187
+    /**
188
+     * The PrimaShop adapter.
189
+     *
190
+     * @since  3.2.3
191
+     * @access private
192
+     * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
193
+     */
194
+    private $primashop_adapter;
195
+
196
+    /**
197
+     * The WordLift Dashboard adapter.
198
+     *
199
+     * @since  3.4.0
200
+     * @access private
201
+     * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
202
+     */
203
+    private $dashboard_service;
204
+
205
+    /**
206
+     * The entity type service.
207
+     *
208
+     * @since  3.6.0
209
+     * @access private
210
+     * @var \Wordlift_Entity_Post_Type_Service
211
+     */
212
+    private $entity_post_type_service;
213
+
214
+    /**
215
+     * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
216
+     *
217
+     * @since  3.6.0
218
+     * @access private
219
+     * @var \Wordlift_Entity_Link_Service
220
+     */
221
+    private $entity_link_service;
222
+
223
+    /**
224
+     * A {@link Wordlift_Sparql_Service} instance.
225
+     *
226
+     * @since    3.6.0
227
+     * @access   protected
228
+     * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
229
+     */
230
+    protected $sparql_service;
231
+
232
+    /**
233
+     * A {@link Wordlift_Import_Service} instance.
234
+     *
235
+     * @since  3.6.0
236
+     * @access private
237
+     * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
238
+     */
239
+    private $import_service;
240
+
241
+    /**
242
+     * A {@link Wordlift_Rebuild_Service} instance.
243
+     *
244
+     * @since  3.6.0
245
+     * @access private
246
+     * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
247
+     */
248
+    private $rebuild_service;
249
+
250
+    /**
251
+     * A {@link Wordlift_Jsonld_Service} instance.
252
+     *
253
+     * @since  3.7.0
254
+     * @access protected
255
+     * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
256
+     */
257
+    protected $jsonld_service;
258
+
259
+    /**
260
+     * A {@link Wordlift_Website_Jsonld_Converter} instance.
261
+     *
262
+     * @since  3.14.0
263
+     * @access protected
264
+     * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
265
+     */
266
+    protected $jsonld_website_converter;
267
+
268
+    /**
269
+     * A {@link Wordlift_Property_Factory} instance.
270
+     *
271
+     * @since  3.7.0
272
+     * @access private
273
+     * @var \Wordlift_Property_Factory $property_factory
274
+     */
275
+    private $property_factory;
276
+
277
+    /**
278
+     * The 'Download Your Data' page.
279
+     *
280
+     * @since  3.6.0
281
+     * @access private
282
+     * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
283
+     */
284
+    private $download_your_data_page;
285
+
286
+    /**
287
+     * The 'WordLift Settings' page.
288
+     *
289
+     * @since  3.11.0
290
+     * @access protected
291
+     * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
292
+     */
293
+    protected $settings_page;
294
+
295
+    /**
296
+     * The 'WordLift Batch analysis' page.
297
+     *
298
+     * @since  3.14.0
299
+     * @access protected
300
+     * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page.
301
+     */
302
+    protected $batch_analysis_page;
303
+
304
+    /**
305
+     * The install wizard page.
306
+     *
307
+     * @since  3.9.0
308
+     * @access private
309
+     * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
310
+     */
311
+    private $admin_setup;
312
+
313
+    /**
314
+     * The Content Filter Service hooks up to the 'the_content' filter and provides
315
+     * linking of entities to their pages.
316
+     *
317
+     * @since  3.8.0
318
+     * @access private
319
+     * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
320
+     */
321
+    private $content_filter_service;
322
+
323
+    /**
324
+     * A {@link Wordlift_Key_Validation_Service} instance.
325
+     *
326
+     * @since  3.9.0
327
+     * @access private
328
+     * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
329
+     */
330
+    private $key_validation_service;
331
+
332
+    /**
333
+     * A {@link Wordlift_Rating_Service} instance.
334
+     *
335
+     * @since  3.10.0
336
+     * @access private
337
+     * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
338
+     */
339
+    private $rating_service;
340
+
341
+    /**
342
+     * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
343
+     *
344
+     * @since  3.10.0
345
+     * @access protected
346
+     * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
347
+     */
348
+    protected $post_to_jsonld_converter;
349
+
350
+    /**
351
+     * A {@link Wordlift_Configuration_Service} instance.
352
+     *
353
+     * @since  3.10.0
354
+     * @access protected
355
+     * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
356
+     */
357
+    protected $configuration_service;
358
+
359
+    /**
360
+     * A {@link Wordlift_Install_Service} instance.
361
+     *
362
+     * @since  3.18.0
363
+     * @access protected
364
+     * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance.
365
+     */
366
+    protected $install_service;
367
+
368
+    /**
369
+     * A {@link Wordlift_Entity_Type_Service} instance.
370
+     *
371
+     * @since  3.10.0
372
+     * @access protected
373
+     * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
374
+     */
375
+    protected $entity_type_service;
376
+
377
+    /**
378
+     * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
379
+     *
380
+     * @since  3.10.0
381
+     * @access protected
382
+     * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
383
+     */
384
+    protected $entity_post_to_jsonld_converter;
385
+
386
+    /**
387
+     * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
388
+     *
389
+     * @since  3.10.0
390
+     * @access protected
391
+     * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
392
+     */
393
+    protected $postid_to_jsonld_converter;
394
+
395
+    /**
396
+     * The {@link Wordlift_Admin_Status_Page} class.
397
+     *
398
+     * @since  3.9.8
399
+     * @access private
400
+     * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
401
+     */
402
+    private $status_page;
403
+
404
+    /**
405
+     * The {@link Wordlift_Category_Taxonomy_Service} instance.
406
+     *
407
+     * @since  3.11.0
408
+     * @access protected
409
+     * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
410
+     */
411
+    protected $category_taxonomy_service;
412
+
413
+    /**
414
+     * The {@link Wordlift_Entity_Page_Service} instance.
415
+     *
416
+     * @since  3.11.0
417
+     * @access protected
418
+     * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
419
+     */
420
+    protected $entity_page_service;
421
+
422
+    /**
423
+     * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
424
+     *
425
+     * @since  3.11.0
426
+     * @access protected
427
+     * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
428
+     */
429
+    protected $settings_page_action_link;
430
+
431
+    /**
432
+     * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
433
+     *
434
+     * @since  3.11.0
435
+     * @access protected
436
+     * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
437
+     */
438
+    protected $publisher_ajax_adapter;
439
+
440
+    /**
441
+     * The {@link Wordlift_Admin_Input_Element} element renderer.
442
+     *
443
+     * @since  3.11.0
444
+     * @access protected
445
+     * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
446
+     */
447
+    protected $input_element;
448
+
449
+    /**
450
+     * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
451
+     *
452
+     * @since  3.13.0
453
+     * @access protected
454
+     * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
455
+     */
456
+    protected $radio_input_element;
457
+
458
+    /**
459
+     * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
460
+     *
461
+     * @since  3.11.0
462
+     * @access protected
463
+     * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
464
+     */
465
+    protected $language_select_element;
466
+
467
+    /**
468
+     * The {@link Wordlift_Admin_Publisher_Element} element renderer.
469
+     *
470
+     * @since  3.11.0
471
+     * @access protected
472
+     * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
473
+     */
474
+    protected $publisher_element;
475
+
476
+    /**
477
+     * The {@link Wordlift_Admin_Select2_Element} element renderer.
478
+     *
479
+     * @since  3.11.0
480
+     * @access protected
481
+     * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
482
+     */
483
+    protected $select2_element;
484
+
485
+    /**
486
+     * The controller for the entity type list admin page
487
+     *
488
+     * @since  3.11.0
489
+     * @access private
490
+     * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
491
+     */
492
+    private $entity_type_admin_page;
493
+
494
+    /**
495
+     * The controller for the entity type settings admin page
496
+     *
497
+     * @since  3.11.0
498
+     * @access private
499
+     * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
500
+     */
501
+    private $entity_type_settings_admin_page;
502
+
503
+    /**
504
+     * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
505
+     *
506
+     * @since  3.11.0
507
+     * @access protected
508
+     * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
509
+     */
510
+    protected $related_entities_cloud_widget;
511
+
512
+    /**
513
+     * The {@link Wordlift_Admin_Author_Element} instance.
514
+     *
515
+     * @since  3.14.0
516
+     * @access protected
517
+     * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
518
+     */
519
+    protected $author_element;
520
+
521
+    /**
522
+     * The {@link Wordlift_Batch_Analysis_Service} instance.
523
+     *
524
+     * @since  3.14.0
525
+     * @access protected
526
+     * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance.
527
+     */
528
+    protected $batch_analysis_service;
529
+
530
+    /**
531
+     * The {@link Wordlift_Sample_Data_Service} instance.
532
+     *
533
+     * @since  3.12.0
534
+     * @access protected
535
+     * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
536
+     */
537
+    protected $sample_data_service;
538
+
539
+    /**
540
+     * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
541
+     *
542
+     * @since  3.12.0
543
+     * @access protected
544
+     * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
545
+     */
546
+    protected $sample_data_ajax_adapter;
547
+
548
+    /**
549
+     * The {@link Wordlift_Batch_Analysis_Adapter} instance.
550
+     *
551
+     * @since  3.14.2
552
+     * @access protected
553
+     * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance.
554
+     */
555
+    private $batch_analysis_adapter;
556
+
557
+    /**
558
+     * The {@link Wordlift_Relation_Rebuild_Service} instance.
559
+     *
560
+     * @since  3.14.3
561
+     * @access private
562
+     * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
563
+     */
564
+    private $relation_rebuild_service;
565
+
566
+    /**
567
+     * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
568
+     *
569
+     * @since  3.14.3
570
+     * @access private
571
+     * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
572
+     */
573
+    private $relation_rebuild_adapter;
574
+
575
+    /**
576
+     * The {@link Wordlift_Reference_Rebuild_Service} instance.
577
+     *
578
+     * @since  3.18.0
579
+     * @access private
580
+     * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance.
581
+     */
582
+    private $reference_rebuild_service;
583
+
584
+    /**
585
+     * The {@link Wordlift_Google_Analytics_Export_Service} instance.
586
+     *
587
+     * @since  3.16.0
588
+     * @access protected
589
+     * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
590
+     */
591
+    protected $google_analytics_export_service;
592
+
593
+    /**
594
+     * {@link Wordlift}'s singleton instance.
595
+     *
596
+     * @since  3.15.0
597
+     * @access protected
598
+     * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
599
+     */
600
+    protected $entity_type_adapter;
601
+
602
+    /**
603
+     * The {@link Wordlift_Linked_Data_Service} instance.
604
+     *
605
+     * @since  3.15.0
606
+     * @access protected
607
+     * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance.
608
+     */
609
+    protected $linked_data_service;
610
+
611
+    /**
612
+     * The {@link Wordlift_Storage_Factory} instance.
613
+     *
614
+     * @since  3.15.0
615
+     * @access protected
616
+     * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
617
+     */
618
+    protected $storage_factory;
619
+
620
+    /**
621
+     * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
622
+     *
623
+     * @since  3.15.0
624
+     * @access protected
625
+     * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
626
+     */
627
+    protected $rendition_factory;
628
+
629
+    /**
630
+     * The {@link Wordlift_Autocomplete_Service} instance.
631
+     *
632
+     * @since  3.15.0
633
+     * @access private
634
+     * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance.
635
+     */
636
+    private $autocomplete_service;
637
+
638
+    /**
639
+     * The {@link Wordlift_Autocomplete_Adapter} instance.
640
+     *
641
+     * @since  3.15.0
642
+     * @access private
643
+     * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
644
+     */
645
+    private $autocomplete_adapter;
646
+
647
+    /**
648
+     * The {@link Wordlift_Relation_Service} instance.
649
+     *
650
+     * @since  3.15.0
651
+     * @access protected
652
+     * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
653
+     */
654
+    protected $relation_service;
655
+
656
+    /**
657
+     * The {@link Wordlift_Cached_Post_Converter} instance.
658
+     *
659
+     * @since  3.16.0
660
+     * @access protected
661
+     * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
662
+     *
663
+     */
664
+    protected $cached_postid_to_jsonld_converter;
665
+
666
+    /**
667
+     * The {@link Wordlift_File_Cache_Service} instance.
668
+     *
669
+     * @since  3.16.0
670
+     * @access protected
671
+     * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance.
672
+     */
673
+    protected $file_cache_service;
674
+
675
+    /**
676
+     * The {@link Wordlift_Entity_Uri_Service} instance.
677
+     *
678
+     * @since  3.16.3
679
+     * @access protected
680
+     * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
681
+     */
682
+    protected $entity_uri_service;
683
+
684
+    /**
685
+     * {@link Wordlift}'s singleton instance.
686
+     *
687
+     * @since  3.11.2
688
+     * @access private
689
+     * @var Wordlift $instance {@link Wordlift}'s singleton instance.
690
+     */
691
+    private static $instance;
692
+    //</editor-fold>
693
+
694
+    /**
695
+     * Define the core functionality of the plugin.
696
+     *
697
+     * Set the plugin name and the plugin version that can be used throughout the plugin.
698
+     * Load the dependencies, define the locale, and set the hooks for the admin area and
699
+     * the public-facing side of the site.
700
+     *
701
+     * @since    1.0.0
702
+     */
703
+    public function __construct() {
704
+
705
+        $this->plugin_name = 'wordlift';
706
+        $this->version     = '3.18.4';
707
+        $this->load_dependencies();
708
+        $this->set_locale();
709
+        $this->define_admin_hooks();
710
+        $this->define_public_hooks();
711
+
712
+        // If we're in `WP_CLI` load the related files.
713
+        if ( class_exists( 'WP_CLI' ) ) {
714
+            $this->load_cli_dependencies();
715
+        }
716
+
717
+        self::$instance = $this;
718
+
719
+    }
720
+
721
+    /**
722
+     * Get the singleton instance.
723
+     *
724
+     * @since 3.11.2
725
+     *
726
+     * @return Wordlift The {@link Wordlift} singleton instance.
727
+     */
728
+    public static function get_instance() {
729
+
730
+        return self::$instance;
731
+    }
732
+
733
+    /**
734
+     * Load the required dependencies for this plugin.
735
+     *
736
+     * Include the following files that make up the plugin:
737
+     *
738
+     * - Wordlift_Loader. Orchestrates the hooks of the plugin.
739
+     * - Wordlift_i18n. Defines internationalization functionality.
740
+     * - Wordlift_Admin. Defines all hooks for the admin area.
741
+     * - Wordlift_Public. Defines all hooks for the public side of the site.
742
+     *
743
+     * Create an instance of the loader which will be used to register the hooks
744
+     * with WordPress.
745
+     *
746
+     * @since    1.0.0
747
+     * @access   private
748
+     */
749
+    private function load_dependencies() {
750
+
751
+        /**
752
+         * The class responsible for orchestrating the actions and filters of the
753
+         * core plugin.
754
+         */
755
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
756
+
757
+        /**
758
+         * The class responsible for defining internationalization functionality
759
+         * of the plugin.
760
+         */
761
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
762
+
763
+        /**
764
+         * WordLift's supported languages.
765
+         */
766
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
767
+
768
+        /**
769
+         * Provide support functions to sanitize data.
770
+         */
771
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
772
+
773
+        /** Installs. */
774
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install.php';
775
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
776
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-1-0-0.php';
777
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-10-0.php';
778
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-12-0.php';
779
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-14-0.php';
780
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-15-0.php';
781
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-0.php';
782
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-3.php';
783
+
784
+        /** Services. */
785
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
786
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
787
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
788
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
789
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
790
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
791
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
792
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
793
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
794
+
795
+        /**
796
+         * The Query builder.
797
+         */
798
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
799
+
800
+        /**
801
+         * The Schema service.
802
+         */
803
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
804
+
805
+        /**
806
+         * The schema:url property service.
807
+         */
808
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
809
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
810
+
811
+        /**
812
+         * The UI service.
813
+         */
814
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
815
+
816
+        /**
817
+         * The Thumbnail service.
818
+         */
819
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
820
+
821
+        /**
822
+         * The Entity Types Taxonomy service.
823
+         */
824
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
825
+
826
+        /**
827
+         * The Entity service.
828
+         */
829
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
830
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
831
+
832
+        // Add the entity rating service.
833
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
834
+
835
+        /**
836
+         * The User service.
837
+         */
838
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
839
+
840
+        /**
841
+         * The Timeline service.
842
+         */
843
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
844
+
845
+        /**
846
+         * The Topic Taxonomy service.
847
+         */
848
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
849
+
850
+        /**
851
+         * The SPARQL service.
852
+         */
853
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
854
+
855
+        /**
856
+         * The WordLift import service.
857
+         */
858
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
859
+
860
+        /**
861
+         * The WordLift URI service.
862
+         */
863
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
864
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
865
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
866
+
867
+        /**
868
+         * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
869
+         */
870
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php';
871
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php';
872
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php';
873
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php';
874
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
875
+
876
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
877
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
878
+
879
+        /**
880
+         * Load the converters.
881
+         */
882
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
883
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
884
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
885
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
886
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
887
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
888
+
889
+        /**
890
+         * Load cache-related files.
891
+         */
892
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
893
+
894
+        /**
895
+         * Load the content filter.
896
+         */
897
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
898
+
899
+        /*
900 900
 		 * Load the excerpt helper.
901 901
 		 */
902
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
903
-
904
-		/**
905
-		 * Load the JSON-LD service to publish entities using JSON-LD.s
906
-		 *
907
-		 * @since 3.8.0
908
-		 */
909
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
910
-
911
-		// The Publisher Service and the AJAX adapter.
912
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
913
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
914
-
915
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
916
-
917
-		/**
918
-		 * Load the WordLift key validation service.
919
-		 */
920
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
921
-
922
-		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
923
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
924
-
925
-		// Load the `Wordlift_Entity_Page_Service` class definition.
926
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
927
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php';
928
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php';
929
-
930
-		/** Linked Data. */
931
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
932
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
933
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
934
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
935
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
936
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
937
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
938
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
939
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
940
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
941
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
942
-
943
-		/** Linked Data Rendition. */
944
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
945
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
946
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
947
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
948
-
949
-		/** Services. */
950
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
951
-
952
-		/** Adapters. */
953
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
954
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
955
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
956
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
957
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php';
958
-
959
-		/** Async Tasks. */
960
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
961
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
962
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
963
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
964
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php';
965
-
966
-		/** Async Tasks. */
967
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php';
968
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
969
-
970
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
971
-
972
-		/**
973
-		 * The class responsible for defining all actions that occur in the admin area.
974
-		 */
975
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
976
-
977
-		/**
978
-		 * The class to customize the entity list admin page.
979
-		 */
980
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
981
-
982
-		/**
983
-		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
984
-		 */
985
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
986
-
987
-		/**
988
-		 * The Notice service.
989
-		 */
990
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
991
-
992
-		/**
993
-		 * The PrimaShop adapter.
994
-		 */
995
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
996
-
997
-		/**
998
-		 * The WordLift Dashboard service.
999
-		 */
1000
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
1001
-
1002
-		/**
1003
-		 * The admin 'Install wizard' page.
1004
-		 */
1005
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
1006
-
1007
-		/**
1008
-		 * The WordLift entity type list admin page controller.
1009
-		 */
1010
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1011
-
1012
-		/**
1013
-		 * The WordLift entity type settings admin page controller.
1014
-		 */
1015
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
1016
-
1017
-		/**
1018
-		 * The admin 'Download Your Data' page.
1019
-		 */
1020
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
1021
-
1022
-		/**
1023
-		 * The admin 'WordLift Settings' page.
1024
-		 */
1025
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
1026
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
1027
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
1028
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
1029
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
1030
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
1031
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
1032
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
1033
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
1034
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
1035
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php';
1036
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
1037
-
1038
-		/** Admin Pages */
1039
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1040
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
1041
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
1042
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
1043
-
1044
-		/**
1045
-		 * The class responsible for defining all actions that occur in the public-facing
1046
-		 * side of the site.
1047
-		 */
1048
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1049
-
1050
-		/**
1051
-		 * The shortcode abstract class.
1052
-		 */
1053
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1054
-
1055
-		/**
1056
-		 * The Timeline shortcode.
1057
-		 */
1058
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1059
-
1060
-		/**
1061
-		 * The Navigator shortcode.
1062
-		 */
1063
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1064
-
1065
-		/**
1066
-		 * The chord shortcode.
1067
-		 */
1068
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1069
-
1070
-		/**
1071
-		 * The geomap shortcode.
1072
-		 */
1073
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1074
-
1075
-		/**
1076
-		 * The entity cloud shortcode.
1077
-		 */
1078
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1079
-
1080
-		/**
1081
-		 * The entity glossary shortcode.
1082
-		 */
1083
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1084
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1085
-
1086
-		/**
1087
-		 * The ShareThis service.
1088
-		 */
1089
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1090
-
1091
-		/**
1092
-		 * The SEO service.
1093
-		 */
1094
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1095
-
1096
-		/**
1097
-		 * The AMP service.
1098
-		 */
1099
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1100
-
1101
-		/** Widgets */
1102
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1103
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1104
-
1105
-		$this->loader = new Wordlift_Loader();
1106
-
1107
-		// Instantiate a global logger.
1108
-		global $wl_logger;
1109
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1110
-
1111
-		// Load the `wl-api` end-point.
1112
-		new Wordlift_Http_Api();
1113
-
1114
-		// Load the Install Service.
1115
-		$this->install_service = new Wordlift_Install_Service();
1116
-
1117
-		/** Services. */
1118
-		// Create the configuration service.
1119
-		$this->configuration_service = new Wordlift_Configuration_Service();
1120
-
1121
-		// Create an entity type service instance. It'll be later bound to the init action.
1122
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1123
-
1124
-		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1125
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1126
-
1127
-		// Create an instance of the UI service.
1128
-		$this->ui_service = new Wordlift_UI_Service();
1129
-
1130
-		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1131
-		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
1132
-
1133
-		$this->sparql_service        = new Wordlift_Sparql_Service();
1134
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1135
-		$this->notice_service        = new Wordlift_Notice_Service();
1136
-		$this->relation_service      = new Wordlift_Relation_Service();
1137
-
1138
-		$entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1139
-		$this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' );
1140
-		$this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1141
-		$this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1142
-		$this->user_service       = new Wordlift_User_Service( $this->sparql_service, $this->entity_service );
1143
-
1144
-		// Instantiate the JSON-LD service.
1145
-		$property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1146
-
1147
-		/** Linked Data. */
1148
-		$this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1149
-		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1150
-
1151
-		$this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1152
-
1153
-		// Create a new instance of the Redirect service.
1154
-		$this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_service );
1155
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1156
-		$this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
1157
-
1158
-		// Create a new instance of the Timeline service and Timeline shortcode.
1159
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1160
-
1161
-		$this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service );
902
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
903
+
904
+        /**
905
+         * Load the JSON-LD service to publish entities using JSON-LD.s
906
+         *
907
+         * @since 3.8.0
908
+         */
909
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
910
+
911
+        // The Publisher Service and the AJAX adapter.
912
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
913
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
914
+
915
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
916
+
917
+        /**
918
+         * Load the WordLift key validation service.
919
+         */
920
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
921
+
922
+        // Load the `Wordlift_Category_Taxonomy_Service` class definition.
923
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
924
+
925
+        // Load the `Wordlift_Entity_Page_Service` class definition.
926
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
927
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php';
928
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php';
929
+
930
+        /** Linked Data. */
931
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
932
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
933
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
934
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
935
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
936
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
937
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
938
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
939
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
940
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
941
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
942
+
943
+        /** Linked Data Rendition. */
944
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
945
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
946
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
947
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
948
+
949
+        /** Services. */
950
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
951
+
952
+        /** Adapters. */
953
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
954
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
955
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
956
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
957
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php';
958
+
959
+        /** Async Tasks. */
960
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
961
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
962
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
963
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
964
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php';
965
+
966
+        /** Async Tasks. */
967
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php';
968
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
969
+
970
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
971
+
972
+        /**
973
+         * The class responsible for defining all actions that occur in the admin area.
974
+         */
975
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
976
+
977
+        /**
978
+         * The class to customize the entity list admin page.
979
+         */
980
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
981
+
982
+        /**
983
+         * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
984
+         */
985
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
986
+
987
+        /**
988
+         * The Notice service.
989
+         */
990
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
991
+
992
+        /**
993
+         * The PrimaShop adapter.
994
+         */
995
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
996
+
997
+        /**
998
+         * The WordLift Dashboard service.
999
+         */
1000
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
1001
+
1002
+        /**
1003
+         * The admin 'Install wizard' page.
1004
+         */
1005
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
1006
+
1007
+        /**
1008
+         * The WordLift entity type list admin page controller.
1009
+         */
1010
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1011
+
1012
+        /**
1013
+         * The WordLift entity type settings admin page controller.
1014
+         */
1015
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
1016
+
1017
+        /**
1018
+         * The admin 'Download Your Data' page.
1019
+         */
1020
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
1021
+
1022
+        /**
1023
+         * The admin 'WordLift Settings' page.
1024
+         */
1025
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
1026
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
1027
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
1028
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
1029
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
1030
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
1031
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
1032
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
1033
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
1034
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
1035
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php';
1036
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
1037
+
1038
+        /** Admin Pages */
1039
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1040
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
1041
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
1042
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
1043
+
1044
+        /**
1045
+         * The class responsible for defining all actions that occur in the public-facing
1046
+         * side of the site.
1047
+         */
1048
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1049
+
1050
+        /**
1051
+         * The shortcode abstract class.
1052
+         */
1053
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1054
+
1055
+        /**
1056
+         * The Timeline shortcode.
1057
+         */
1058
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1059
+
1060
+        /**
1061
+         * The Navigator shortcode.
1062
+         */
1063
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1064
+
1065
+        /**
1066
+         * The chord shortcode.
1067
+         */
1068
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1069
+
1070
+        /**
1071
+         * The geomap shortcode.
1072
+         */
1073
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1074
+
1075
+        /**
1076
+         * The entity cloud shortcode.
1077
+         */
1078
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1079
+
1080
+        /**
1081
+         * The entity glossary shortcode.
1082
+         */
1083
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1084
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1085
+
1086
+        /**
1087
+         * The ShareThis service.
1088
+         */
1089
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1090
+
1091
+        /**
1092
+         * The SEO service.
1093
+         */
1094
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1095
+
1096
+        /**
1097
+         * The AMP service.
1098
+         */
1099
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1100
+
1101
+        /** Widgets */
1102
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1103
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1104
+
1105
+        $this->loader = new Wordlift_Loader();
1106
+
1107
+        // Instantiate a global logger.
1108
+        global $wl_logger;
1109
+        $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1110
+
1111
+        // Load the `wl-api` end-point.
1112
+        new Wordlift_Http_Api();
1113
+
1114
+        // Load the Install Service.
1115
+        $this->install_service = new Wordlift_Install_Service();
1116
+
1117
+        /** Services. */
1118
+        // Create the configuration service.
1119
+        $this->configuration_service = new Wordlift_Configuration_Service();
1120
+
1121
+        // Create an entity type service instance. It'll be later bound to the init action.
1122
+        $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1123
+
1124
+        // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1125
+        $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1126
+
1127
+        // Create an instance of the UI service.
1128
+        $this->ui_service = new Wordlift_UI_Service();
1129
+
1130
+        // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1131
+        $this->thumbnail_service = new Wordlift_Thumbnail_Service();
1132
+
1133
+        $this->sparql_service        = new Wordlift_Sparql_Service();
1134
+        $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1135
+        $this->notice_service        = new Wordlift_Notice_Service();
1136
+        $this->relation_service      = new Wordlift_Relation_Service();
1162 1137
 
1163
-		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1138
+        $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1139
+        $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' );
1140
+        $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1141
+        $this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1142
+        $this->user_service       = new Wordlift_User_Service( $this->sparql_service, $this->entity_service );
1164 1143
 
1165
-		$this->topic_taxonomy_service        = new Wordlift_Topic_Taxonomy_Service();
1166
-		$this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service();
1144
+        // Instantiate the JSON-LD service.
1145
+        $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1146
+
1147
+        /** Linked Data. */
1148
+        $this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1149
+        $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1150
+
1151
+        $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1152
+
1153
+        // Create a new instance of the Redirect service.
1154
+        $this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_service );
1155
+        $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1156
+        $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
1167 1157
 
1168
-		// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1169
-		$this->sharethis_service = new Wordlift_ShareThis_Service();
1158
+        // Create a new instance of the Timeline service and Timeline shortcode.
1159
+        $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1160
+
1161
+        $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service );
1162
+
1163
+        $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1170 1164
 
1171
-		// Create an instance of the PrimaShop adapter.
1172
-		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1165
+        $this->topic_taxonomy_service        = new Wordlift_Topic_Taxonomy_Service();
1166
+        $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service();
1167
+
1168
+        // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1169
+        $this->sharethis_service = new Wordlift_ShareThis_Service();
1170
+
1171
+        // Create an instance of the PrimaShop adapter.
1172
+        $this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1173 1173
 
1174
-		// Create an import service instance to hook later to WP's import function.
1175
-		$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() );
1174
+        // Create an import service instance to hook later to WP's import function.
1175
+        $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() );
1176 1176
 
1177
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1177
+        $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1178 1178
 
1179
-		// Create the entity rating service.
1180
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1179
+        // Create the entity rating service.
1180
+        $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1181 1181
 
1182
-		// Create entity list customization (wp-admin/edit.php).
1183
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1182
+        // Create entity list customization (wp-admin/edit.php).
1183
+        $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1184 1184
 
1185
-		// Create a new instance of the Redirect service.
1186
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1185
+        // Create a new instance of the Redirect service.
1186
+        $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1187 1187
 
1188
-		// Create an instance of the Publisher Service and the AJAX Adapter.
1189
-		$publisher_service      = new Wordlift_Publisher_Service();
1190
-		$this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service );
1191
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1188
+        // Create an instance of the Publisher Service and the AJAX Adapter.
1189
+        $publisher_service      = new Wordlift_Publisher_Service();
1190
+        $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service );
1191
+        $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1192 1192
 
1193
-		$attachment_service = new Wordlift_Attachment_Service();
1193
+        $attachment_service = new Wordlift_Attachment_Service();
1194 1194
 
1195
-		// Instantiate the JSON-LD service.
1196
-		$property_getter                         = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1197
-		$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 );
1198
-		$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 );
1199
-		$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 );
1200
-		$this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1201
-		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service );
1202
-		$this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1195
+        // Instantiate the JSON-LD service.
1196
+        $property_getter                         = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1197
+        $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 );
1198
+        $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 );
1199
+        $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 );
1200
+        $this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1201
+        $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service );
1202
+        $this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1203 1203
 
1204 1204
 
1205
-		$this->key_validation_service     = new Wordlift_Key_Validation_Service( $this->configuration_service );
1206
-		$this->content_filter_service     = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1207
-		$this->relation_rebuild_service   = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1208
-		$this->sample_data_service        = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1209
-		$this->sample_data_ajax_adapter   = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1210
-		$this->reference_rebuild_service  = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service );
1205
+        $this->key_validation_service     = new Wordlift_Key_Validation_Service( $this->configuration_service );
1206
+        $this->content_filter_service     = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1207
+        $this->relation_rebuild_service   = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1208
+        $this->sample_data_service        = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1209
+        $this->sample_data_ajax_adapter   = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1210
+        $this->reference_rebuild_service  = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service );
1211 1211
 
1212
-		// Initialize the shortcodes.
1213
-		new Wordlift_Navigator_Shortcode();
1214
-		new Wordlift_Chord_Shortcode();
1215
-		new Wordlift_Geomap_Shortcode();
1216
-		new Wordlift_Timeline_Shortcode();
1217
-		new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1218
-		new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1212
+        // Initialize the shortcodes.
1213
+        new Wordlift_Navigator_Shortcode();
1214
+        new Wordlift_Chord_Shortcode();
1215
+        new Wordlift_Geomap_Shortcode();
1216
+        new Wordlift_Timeline_Shortcode();
1217
+        new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1218
+        new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1219 1219
 
1220
-		// Initialize the SEO service.
1221
-		new Wordlift_Seo_Service();
1220
+        // Initialize the SEO service.
1221
+        new Wordlift_Seo_Service();
1222 1222
 
1223
-		// Initialize the AMP service.
1224
-		new Wordlift_AMP_Service();
1223
+        // Initialize the AMP service.
1224
+        new Wordlift_AMP_Service();
1225 1225
 
1226
-		/** Services. */
1227
-		$this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1226
+        /** Services. */
1227
+        $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1228 1228
 
1229
-		/** Adapters. */
1230
-		$this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1231
-		$this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter( $publisher_service );
1232
-		$this->tinymce_adapter          = new Wordlift_Tinymce_Adapter( $this );
1233
-		$this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service );
1234
-		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1235
-
1236
-		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
1237
-		$this->rebuild_service = new Wordlift_Rebuild_Service(
1238
-			$this->sparql_service,
1239
-			$uri_service,
1240
-			$this->reference_rebuild_service
1241
-		);
1242
-
1243
-		/** Async Tasks. */
1244
-		new Wordlift_Sparql_Query_Async_Task();
1245
-		new Wordlift_Batch_Analysis_Request_Async_Task();
1246
-		new Wordlift_Batch_Analysis_Complete_Async_Task();
1247
-		new Wordlift_Batch_Analysis_Complete_Async_Task();
1248
-		new Wordlift_Push_References_Async_Task();
1249
-
1250
-		/** WL Autocomplete. */
1251
-		$this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service );
1252
-		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service );
1253
-
1254
-		/** WordPress Admin UI. */
1255
-
1256
-		// UI elements.
1257
-		$this->input_element           = new Wordlift_Admin_Input_Element();
1258
-		$this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1259
-		$this->select2_element         = new Wordlift_Admin_Select2_Element();
1260
-		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1261
-		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1262
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element );
1263
-		$this->author_element          = new Wordlift_Admin_Author_Element( $publisher_service, $this->select2_element );
1264
-
1265
-		$this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element );
1266
-		$this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service );
1267
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1268
-
1269
-		// Pages.
1270
-		new Wordlift_Admin_Post_Edit_Page( $this );
1271
-		new Wordlift_Entity_Type_Admin_Service();
1272
-
1273
-		// create an instance of the entity type list admin page controller.
1274
-		$this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1275
-
1276
-		// create an instance of the entity type etting admin page controller.
1277
-		$this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1278
-
1279
-		/** Widgets */
1280
-		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1281
-
1282
-		/* WordPress Admin. */
1283
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1284
-		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1285
-
1286
-		// Create an instance of the install wizard.
1287
-		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1288
-
1289
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1290
-
1291
-		// User Profile.
1292
-		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1293
-
1294
-		$this->entity_page_service = new Wordlift_Entity_Page_Service();
1295
-
1296
-		// Load the debug service if WP is in debug mode.
1297
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1298
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1299
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1300
-		}
1301
-
1302
-		// Remote Image Service.
1303
-		new Wordlift_Remote_Image_Service();
1304
-	}
1305
-
1306
-	/**
1307
-	 * Define the locale for this plugin for internationalization.
1308
-	 *
1309
-	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1310
-	 * with WordPress.
1311
-	 *
1312
-	 * @since    1.0.0
1313
-	 * @access   private
1314
-	 */
1315
-	private function set_locale() {
1316
-
1317
-		$plugin_i18n = new Wordlift_i18n();
1318
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1319
-
1320
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1321
-
1322
-	}
1323
-
1324
-	/**
1325
-	 * Register all of the hooks related to the admin area functionality
1326
-	 * of the plugin.
1327
-	 *
1328
-	 * @since    1.0.0
1329
-	 * @access   private
1330
-	 */
1331
-	private function define_admin_hooks() {
1332
-
1333
-		$plugin_admin = new Wordlift_Admin(
1334
-			$this->get_plugin_name(),
1335
-			$this->get_version(),
1336
-			$this->configuration_service,
1337
-			$this->notice_service,
1338
-			$this->user_service
1339
-		);
1340
-
1341
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1342
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1343
-
1344
-		// Hook the init action to taxonomy services.
1345
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1346
-		$this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 );
1347
-
1348
-		// Hook the deleted_post_meta action to the Thumbnail service.
1349
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1350
-
1351
-		// Hook the added_post_meta action to the Thumbnail service.
1352
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1353
-
1354
-		// Hook the updated_post_meta action to the Thumbnail service.
1355
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1356
-
1357
-		// Hook the AJAX wl_timeline action to the Timeline service.
1358
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1359
-
1360
-		// Register custom allowed redirect hosts.
1361
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1362
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1363
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1364
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1365
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1366
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1367
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1368
-
1369
-		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1370
-		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1371
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1372
-		$this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1373
-
1374
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1375
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1376
-
1377
-		// Entity listing customization (wp-admin/edit.php)
1378
-		// Add custom columns.
1379
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1380
-		// no explicit entity as it prevents handling of other post types.
1381
-		$this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1382
-		// Add 4W selection.
1383
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1384
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1385
-		$this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1386
-		$this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1387
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1388
-
1389
-		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1390
-		// entities.
1391
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1392
-
1393
-		// Filter imported post meta.
1394
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1395
-
1396
-		// Notify the import service when an import starts and ends.
1397
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1398
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1399
-
1400
-		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1401
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1402
-		$this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' );
1403
-
1404
-		// Hook the menu to the Download Your Data page.
1405
-		$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1406
-		$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1407
-		$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1408
-
1409
-		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1410
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1411
-
1412
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1413
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1414
-		$this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' );
1415
-		$this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1416
-
1417
-		// Hook the AJAX wl_validate_key action to the Key Validation service.
1418
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1419
-
1420
-		// Hook the `admin_init` function to the Admin Setup.
1421
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1422
-
1423
-		// Hook the admin_init to the settings page.
1424
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1425
-
1426
-		// Hook the menu creation on the general wordlift menu creation.
1427
-		$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1428
-		if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) {
1429
-			// Add the functionality only if a flag is set in wp-config.php .
1430
-			$this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 );
1431
-		}
1432
-
1433
-		// Hook key update.
1434
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1435
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1436
-
1437
-		// Add additional action links to the WordLift plugin in the plugins page.
1438
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1439
-
1440
-		// Hook the AJAX `wl_publisher` action name.
1441
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1442
-
1443
-		// Hook row actions for the entity type list admin.
1444
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1445
-
1446
-		/** Ajax actions. */
1447
-		$this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1448
-
1449
-		// Hook capabilities manipulation to allow access to entity type admin
1450
-		// page  on WordPress versions before 4.7.
1451
-		global $wp_version;
1452
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1453
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1454
-		}
1455
-
1456
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1457
-
1458
-		/** Adapters. */
1459
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1460
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' );
1461
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' );
1462
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' );
1463
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' );
1464
-		$this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1465
-
1466
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1467
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1468
-
1469
-
1470
-		$this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 );
1471
-		$this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 );
1472
-
1473
-		// Handle the autocomplete request.
1474
-		add_action( 'wp_ajax_wl_autocomplete', array(
1475
-			$this->autocomplete_adapter,
1476
-			'wl_autocomplete',
1477
-		) );
1478
-		add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1479
-			$this->autocomplete_adapter,
1480
-			'wl_autocomplete',
1481
-		) );
1482
-
1483
-		// Hooks to restrict multisite super admin from manipulating entity types.
1484
-		if ( is_multisite() ) {
1485
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1486
-		}
1487
-
1488
-	}
1489
-
1490
-	/**
1491
-	 * Register all of the hooks related to the public-facing functionality
1492
-	 * of the plugin.
1493
-	 *
1494
-	 * @since    1.0.0
1495
-	 * @access   private
1496
-	 */
1497
-	private function define_public_hooks() {
1498
-
1499
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1500
-
1501
-		// Register the entity post type.
1502
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1503
-		$this->loader->add_action( 'init', $this->install_service, 'install' );
1504
-
1505
-		// Bind the link generation and handling hooks to the entity link service.
1506
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1507
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1508
-		$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 );
1509
-		$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 );
1510
-
1511
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1512
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1513
-
1514
-		// Hook the content filter service to add entity links.
1515
-		if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1516
-			$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1517
-		}
1518
-
1519
-		// Hook the AJAX wl_timeline action to the Timeline service.
1520
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1521
-
1522
-		// Hook the ShareThis service.
1523
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1524
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1525
-
1526
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1527
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1528
-
1529
-		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1530
-		// in order to tweak WP's `WP_Query` to include entities in queries related
1531
-		// to categories.
1532
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1533
-
1534
-		/*
1229
+        /** Adapters. */
1230
+        $this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1231
+        $this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter( $publisher_service );
1232
+        $this->tinymce_adapter          = new Wordlift_Tinymce_Adapter( $this );
1233
+        $this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service );
1234
+        $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1235
+
1236
+        // Create a Rebuild Service instance, which we'll later bound to an ajax call.
1237
+        $this->rebuild_service = new Wordlift_Rebuild_Service(
1238
+            $this->sparql_service,
1239
+            $uri_service,
1240
+            $this->reference_rebuild_service
1241
+        );
1242
+
1243
+        /** Async Tasks. */
1244
+        new Wordlift_Sparql_Query_Async_Task();
1245
+        new Wordlift_Batch_Analysis_Request_Async_Task();
1246
+        new Wordlift_Batch_Analysis_Complete_Async_Task();
1247
+        new Wordlift_Batch_Analysis_Complete_Async_Task();
1248
+        new Wordlift_Push_References_Async_Task();
1249
+
1250
+        /** WL Autocomplete. */
1251
+        $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service );
1252
+        $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service );
1253
+
1254
+        /** WordPress Admin UI. */
1255
+
1256
+        // UI elements.
1257
+        $this->input_element           = new Wordlift_Admin_Input_Element();
1258
+        $this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1259
+        $this->select2_element         = new Wordlift_Admin_Select2_Element();
1260
+        $this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1261
+        $tabs_element                  = new Wordlift_Admin_Tabs_Element();
1262
+        $this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element );
1263
+        $this->author_element          = new Wordlift_Admin_Author_Element( $publisher_service, $this->select2_element );
1264
+
1265
+        $this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element );
1266
+        $this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service );
1267
+        $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1268
+
1269
+        // Pages.
1270
+        new Wordlift_Admin_Post_Edit_Page( $this );
1271
+        new Wordlift_Entity_Type_Admin_Service();
1272
+
1273
+        // create an instance of the entity type list admin page controller.
1274
+        $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1275
+
1276
+        // create an instance of the entity type etting admin page controller.
1277
+        $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1278
+
1279
+        /** Widgets */
1280
+        $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1281
+
1282
+        /* WordPress Admin. */
1283
+        $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1284
+        $this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1285
+
1286
+        // Create an instance of the install wizard.
1287
+        $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1288
+
1289
+        $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1290
+
1291
+        // User Profile.
1292
+        new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1293
+
1294
+        $this->entity_page_service = new Wordlift_Entity_Page_Service();
1295
+
1296
+        // Load the debug service if WP is in debug mode.
1297
+        if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1298
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1299
+            new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1300
+        }
1301
+
1302
+        // Remote Image Service.
1303
+        new Wordlift_Remote_Image_Service();
1304
+    }
1305
+
1306
+    /**
1307
+     * Define the locale for this plugin for internationalization.
1308
+     *
1309
+     * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1310
+     * with WordPress.
1311
+     *
1312
+     * @since    1.0.0
1313
+     * @access   private
1314
+     */
1315
+    private function set_locale() {
1316
+
1317
+        $plugin_i18n = new Wordlift_i18n();
1318
+        $plugin_i18n->set_domain( $this->get_plugin_name() );
1319
+
1320
+        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1321
+
1322
+    }
1323
+
1324
+    /**
1325
+     * Register all of the hooks related to the admin area functionality
1326
+     * of the plugin.
1327
+     *
1328
+     * @since    1.0.0
1329
+     * @access   private
1330
+     */
1331
+    private function define_admin_hooks() {
1332
+
1333
+        $plugin_admin = new Wordlift_Admin(
1334
+            $this->get_plugin_name(),
1335
+            $this->get_version(),
1336
+            $this->configuration_service,
1337
+            $this->notice_service,
1338
+            $this->user_service
1339
+        );
1340
+
1341
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1342
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1343
+
1344
+        // Hook the init action to taxonomy services.
1345
+        $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1346
+        $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 );
1347
+
1348
+        // Hook the deleted_post_meta action to the Thumbnail service.
1349
+        $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1350
+
1351
+        // Hook the added_post_meta action to the Thumbnail service.
1352
+        $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1353
+
1354
+        // Hook the updated_post_meta action to the Thumbnail service.
1355
+        $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1356
+
1357
+        // Hook the AJAX wl_timeline action to the Timeline service.
1358
+        $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1359
+
1360
+        // Register custom allowed redirect hosts.
1361
+        $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1362
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1363
+        $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1364
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1365
+        $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1366
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1367
+        $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1368
+
1369
+        // Hook save_post to the entity service to update custom fields (such as alternate labels).
1370
+        // We have a priority of 9 because we want to be executed before data is sent to Redlink.
1371
+        $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1372
+        $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1373
+
1374
+        $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1375
+        $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1376
+
1377
+        // Entity listing customization (wp-admin/edit.php)
1378
+        // Add custom columns.
1379
+        $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1380
+        // no explicit entity as it prevents handling of other post types.
1381
+        $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1382
+        // Add 4W selection.
1383
+        $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1384
+        $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1385
+        $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1386
+        $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1387
+        $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1388
+
1389
+        // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1390
+        // entities.
1391
+        $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1392
+
1393
+        // Filter imported post meta.
1394
+        $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1395
+
1396
+        // Notify the import service when an import starts and ends.
1397
+        $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1398
+        $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1399
+
1400
+        // Hook the AJAX wl_rebuild action to the Rebuild Service.
1401
+        $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1402
+        $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' );
1403
+
1404
+        // Hook the menu to the Download Your Data page.
1405
+        $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1406
+        $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1407
+        $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1408
+
1409
+        // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1410
+        $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1411
+
1412
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1413
+        $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1414
+        $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' );
1415
+        $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1416
+
1417
+        // Hook the AJAX wl_validate_key action to the Key Validation service.
1418
+        $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1419
+
1420
+        // Hook the `admin_init` function to the Admin Setup.
1421
+        $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1422
+
1423
+        // Hook the admin_init to the settings page.
1424
+        $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1425
+
1426
+        // Hook the menu creation on the general wordlift menu creation.
1427
+        $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1428
+        if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) {
1429
+            // Add the functionality only if a flag is set in wp-config.php .
1430
+            $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 );
1431
+        }
1432
+
1433
+        // Hook key update.
1434
+        $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1435
+        $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1436
+
1437
+        // Add additional action links to the WordLift plugin in the plugins page.
1438
+        $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1439
+
1440
+        // Hook the AJAX `wl_publisher` action name.
1441
+        $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1442
+
1443
+        // Hook row actions for the entity type list admin.
1444
+        $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1445
+
1446
+        /** Ajax actions. */
1447
+        $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1448
+
1449
+        // Hook capabilities manipulation to allow access to entity type admin
1450
+        // page  on WordPress versions before 4.7.
1451
+        global $wp_version;
1452
+        if ( version_compare( $wp_version, '4.7', '<' ) ) {
1453
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1454
+        }
1455
+
1456
+        $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1457
+
1458
+        /** Adapters. */
1459
+        $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1460
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' );
1461
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' );
1462
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' );
1463
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' );
1464
+        $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1465
+
1466
+        $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1467
+        $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1468
+
1469
+
1470
+        $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 );
1471
+        $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 );
1472
+
1473
+        // Handle the autocomplete request.
1474
+        add_action( 'wp_ajax_wl_autocomplete', array(
1475
+            $this->autocomplete_adapter,
1476
+            'wl_autocomplete',
1477
+        ) );
1478
+        add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1479
+            $this->autocomplete_adapter,
1480
+            'wl_autocomplete',
1481
+        ) );
1482
+
1483
+        // Hooks to restrict multisite super admin from manipulating entity types.
1484
+        if ( is_multisite() ) {
1485
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1486
+        }
1487
+
1488
+    }
1489
+
1490
+    /**
1491
+     * Register all of the hooks related to the public-facing functionality
1492
+     * of the plugin.
1493
+     *
1494
+     * @since    1.0.0
1495
+     * @access   private
1496
+     */
1497
+    private function define_public_hooks() {
1498
+
1499
+        $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1500
+
1501
+        // Register the entity post type.
1502
+        $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1503
+        $this->loader->add_action( 'init', $this->install_service, 'install' );
1504
+
1505
+        // Bind the link generation and handling hooks to the entity link service.
1506
+        $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1507
+        $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1508
+        $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 );
1509
+        $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 );
1510
+
1511
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1512
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1513
+
1514
+        // Hook the content filter service to add entity links.
1515
+        if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1516
+            $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1517
+        }
1518
+
1519
+        // Hook the AJAX wl_timeline action to the Timeline service.
1520
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1521
+
1522
+        // Hook the ShareThis service.
1523
+        $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1524
+        $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1525
+
1526
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1527
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1528
+
1529
+        // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1530
+        // in order to tweak WP's `WP_Query` to include entities in queries related
1531
+        // to categories.
1532
+        $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1533
+
1534
+        /*
1535 1535
 		 * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service`
1536 1536
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1537 1537
 		 * order of start time.
1538 1538
 		 */
1539
-		$this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1540
-
1541
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1542
-
1543
-		// This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1544
-		$this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1545
-
1546
-	}
1547
-
1548
-	/**
1549
-	 * Run the loader to execute all of the hooks with WordPress.
1550
-	 *
1551
-	 * @since    1.0.0
1552
-	 */
1553
-	public function run() {
1554
-		$this->loader->run();
1555
-	}
1556
-
1557
-	/**
1558
-	 * The name of the plugin used to uniquely identify it within the context of
1559
-	 * WordPress and to define internationalization functionality.
1560
-	 *
1561
-	 * @since     1.0.0
1562
-	 * @return    string    The name of the plugin.
1563
-	 */
1564
-	public function get_plugin_name() {
1565
-		return $this->plugin_name;
1566
-	}
1567
-
1568
-	/**
1569
-	 * The reference to the class that orchestrates the hooks with the plugin.
1570
-	 *
1571
-	 * @since     1.0.0
1572
-	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1573
-	 */
1574
-	public function get_loader() {
1575
-		return $this->loader;
1576
-	}
1577
-
1578
-	/**
1579
-	 * Retrieve the version number of the plugin.
1580
-	 *
1581
-	 * @since     1.0.0
1582
-	 * @return    string    The version number of the plugin.
1583
-	 */
1584
-	public function get_version() {
1585
-		return $this->version;
1586
-	}
1587
-
1588
-	/**
1589
-	 * Load dependencies for WP-CLI.
1590
-	 *
1591
-	 * @since 3.18.0
1592
-	 * @throws Exception
1593
-	 */
1594
-	private function load_cli_dependencies() {
1595
-
1596
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php';
1597
-
1598
-		$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 );
1599
-
1600
-		WP_CLI::add_command( 'wl references push', $push_reference_data_command );
1601
-
1602
-	}
1539
+        $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1540
+
1541
+        $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1542
+
1543
+        // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1544
+        $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1545
+
1546
+    }
1547
+
1548
+    /**
1549
+     * Run the loader to execute all of the hooks with WordPress.
1550
+     *
1551
+     * @since    1.0.0
1552
+     */
1553
+    public function run() {
1554
+        $this->loader->run();
1555
+    }
1556
+
1557
+    /**
1558
+     * The name of the plugin used to uniquely identify it within the context of
1559
+     * WordPress and to define internationalization functionality.
1560
+     *
1561
+     * @since     1.0.0
1562
+     * @return    string    The name of the plugin.
1563
+     */
1564
+    public function get_plugin_name() {
1565
+        return $this->plugin_name;
1566
+    }
1567
+
1568
+    /**
1569
+     * The reference to the class that orchestrates the hooks with the plugin.
1570
+     *
1571
+     * @since     1.0.0
1572
+     * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1573
+     */
1574
+    public function get_loader() {
1575
+        return $this->loader;
1576
+    }
1577
+
1578
+    /**
1579
+     * Retrieve the version number of the plugin.
1580
+     *
1581
+     * @since     1.0.0
1582
+     * @return    string    The version number of the plugin.
1583
+     */
1584
+    public function get_version() {
1585
+        return $this->version;
1586
+    }
1587
+
1588
+    /**
1589
+     * Load dependencies for WP-CLI.
1590
+     *
1591
+     * @since 3.18.0
1592
+     * @throws Exception
1593
+     */
1594
+    private function load_cli_dependencies() {
1595
+
1596
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php';
1597
+
1598
+        $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 );
1599
+
1600
+        WP_CLI::add_command( 'wl references push', $push_reference_data_command );
1601
+
1602
+    }
1603 1603
 
1604 1604
 }
Please login to merge, or discard this patch.
src/includes/class-wordlift-abstract-post-to-jsonld-converter.php 2 patches
Indentation   +229 added lines, -229 removed lines patch added patch discarded remove patch
@@ -18,237 +18,237 @@
 block discarded – undo
18 18
  */
19 19
 abstract class Wordlift_Abstract_Post_To_Jsonld_Converter implements Wordlift_Post_Converter {
20 20
 
21
-	/**
22
-	 * The JSON-LD context.
23
-	 *
24
-	 * @since 3.10.0
25
-	 */
26
-	const CONTEXT = 'http://schema.org';
27
-
28
-	/**
29
-	 * A {@link Wordlift_Entity_Type_Service} instance.
30
-	 *
31
-	 * @since  3.10.0
32
-	 * @access protected
33
-	 * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
34
-	 */
35
-	protected $entity_type_service;
36
-
37
-	/**
38
-	 * A {@link Wordlift_Entity_Service} instance.
39
-	 *
40
-	 * @since  3.10.0
41
-	 * @access protected
42
-	 * @var \Wordlift_Entity_Service $entity_type_service A {@link Wordlift_Entity_Service} instance.
43
-	 */
44
-	protected $entity_service;
45
-
46
-	/**
47
-	 * A {@link Wordlift_User_Service} instance.
48
-	 *
49
-	 * @since  3.10.0
50
-	 * @access private
51
-	 * @var \Wordlift_User_Service $user_service A {@link Wordlift_User_Service} instance.
52
-	 */
53
-	protected $user_service;
54
-
55
-	/**
56
-	 * A {@link Wordlift_Attachment_Service} instance.
57
-	 *
58
-	 * @since  3.10.0
59
-	 * @access private
60
-	 * @var \Wordlift_Attachment_Service $attachment_service A {@link Wordlift_Attachment_Service} instance.
61
-	 */
62
-	protected $attachment_service;
63
-
64
-	/**
65
-	 * Wordlift_Post_To_Jsonld_Converter constructor.
66
-	 *
67
-	 * @since 3.10.0
68
-	 *
69
-	 * @param \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
70
-	 * @param \Wordlift_Entity_Service      $entity_service      A {@link Wordlift_Entity_Service} instance.
71
-	 * @param \Wordlift_User_Service        $user_service        A {@link Wordlift_User_Service} instance.
72
-	 * @param \Wordlift_Attachment_Service  $attachment_service  A {@link Wordlift_Attachment_Service} instance.
73
-	 */
74
-	public function __construct( $entity_type_service, $entity_service, $user_service, $attachment_service ) {
75
-
76
-		$this->entity_type_service = $entity_type_service;
77
-		$this->entity_service      = $entity_service;
78
-		$this->user_service        = $user_service;
79
-		$this->attachment_service  = $attachment_service;
80
-	}
81
-
82
-	/**
83
-	 * Convert the provided {@link WP_Post} to a JSON-LD array. Any entity reference
84
-	 * found while processing the post is set in the $references array.
85
-	 *
86
-	 * @since 3.10.0
87
-	 *
88
-	 * @param int   $post_id    The post id.
89
-	 * @param array $references An array of entity references.
90
-	 *
91
-	 * @return array A JSON-LD array.
92
-	 */
93
-	public function convert( $post_id, &$references = array() ) {
94
-
95
-		// Get the post instance.
96
-		$post = get_post( $post_id );
97
-		if ( null === $post ) {
98
-			// Post not found.
99
-			return null;
100
-		}
101
-
102
-		// Get the post URI @id.
103
-		$id = $this->entity_service->get_uri( $post->ID );
104
-
105
-		// Get the entity @type. We consider `post` BlogPostings.
106
-		$type = $this->entity_type_service->get( $post_id );
107
-
108
-		// Prepare the response.
109
-		$jsonld = array(
110
-			'@context'    => self::CONTEXT,
111
-			'@id'         => $id,
112
-			'@type'       => $this->relative_to_context( $type['uri'] ),
113
-			'description' => Wordlift_Post_Excerpt_Helper::get_text_excerpt( $post ),
114
-		);
115
-
116
-		// Set the `mainEntityOfPage` property if the post has some contents.
117
-		if ( ! empty( $post->post_content ) ) {
118
-			// We're setting the `mainEntityOfPage` to signal which one is the
119
-			// main entity for the specified URL. It might be however that the
120
-			// post/page is actually about another specific entity. How WL deals
121
-			// with that hasn't been defined yet (see https://github.com/insideout10/wordlift-plugin/issues/451).
122
-			//
123
-			// See http://schema.org/mainEntityOfPage
124
-			//
125
-			// No need to specify `'@type' => 'WebPage'.
126
-			//
127
-			// See https://github.com/insideout10/wordlift-plugin/issues/451.
128
-			$jsonld['mainEntityOfPage'] = get_the_permalink( $post->ID );
129
-		};
130
-
131
-		$this->set_images( $post, $jsonld );
132
-
133
-		// Get the entities referenced by this post and set it to the `references`
134
-		// array so that the caller can do further processing, such as printing out
135
-		// more of those references.
136
-		$references = $this->entity_service->get_related_entities( $post->ID );
137
-
138
-		return $jsonld;
139
-	}
140
-
141
-	/**
142
-	 * If the provided value starts with the schema.org context, we remove the schema.org
143
-	 * part since it is set with the '@context'.
144
-	 *
145
-	 * @since 3.10.0
146
-	 *
147
-	 * @param string $value The property value.
148
-	 *
149
-	 * @return string The property value without the context.
150
-	 */
151
-	public function relative_to_context( $value ) {
152
-
153
-		return 0 === strpos( $value, self::CONTEXT . '/' ) ? substr( $value, strlen( self::CONTEXT ) + 1 ) : $value;
154
-	}
155
-
156
-	/**
157
-	 * Set the images, by looking for embedded images, for images loaded via the
158
-	 * gallery and for the featured image.
159
-	 *
160
-	 * Uses the cache service to store the results of this function for a day.
161
-	 *
162
-	 * @since 3.10.0
163
-	 *
164
-	 * @param WP_Post $post   The target {@link WP_Post}.
165
-	 * @param array   $jsonld The JSON-LD array.
166
-	 */
167
-	protected function set_images( $post, &$jsonld ) {
168
-
169
-		// Prepare the attachment ids array.
170
-		$ids = array();
171
-
172
-		// Set the thumbnail id as first attachment id, if any.
173
-		$thumbnail_id = get_post_thumbnail_id( $post->ID );
174
-		if ( '' !== $thumbnail_id ) {
175
-			$ids[] = $thumbnail_id;
176
-		}
177
-
178
-		// For the time being the following is being removed since the query
179
-		// initiated by `get_image_embeds` is consuming lots of CPU.
180
-		//
181
-		// See https://github.com/insideout10/wordlift-plugin/issues/689.
182
-		//
183
-		// Get the embeds, removing existing ids.
184
-		// $embeds = array_diff( $this->attachment_service->get_image_embeds( $post->post_content ), $ids );
185
-		$embeds = array();
186
-
187
-		// Get the gallery, removing existing ids.
188
-		$gallery = array_diff( $this->attachment_service->get_gallery( $post ), $ids, $embeds );
189
-
190
-		// Map the attachment ids to images' data structured for schema.org use.
191
-		$images = array_filter(
192
-			array_map(
193
-				function ( $item ) {
194
-					/*
21
+    /**
22
+     * The JSON-LD context.
23
+     *
24
+     * @since 3.10.0
25
+     */
26
+    const CONTEXT = 'http://schema.org';
27
+
28
+    /**
29
+     * A {@link Wordlift_Entity_Type_Service} instance.
30
+     *
31
+     * @since  3.10.0
32
+     * @access protected
33
+     * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
34
+     */
35
+    protected $entity_type_service;
36
+
37
+    /**
38
+     * A {@link Wordlift_Entity_Service} instance.
39
+     *
40
+     * @since  3.10.0
41
+     * @access protected
42
+     * @var \Wordlift_Entity_Service $entity_type_service A {@link Wordlift_Entity_Service} instance.
43
+     */
44
+    protected $entity_service;
45
+
46
+    /**
47
+     * A {@link Wordlift_User_Service} instance.
48
+     *
49
+     * @since  3.10.0
50
+     * @access private
51
+     * @var \Wordlift_User_Service $user_service A {@link Wordlift_User_Service} instance.
52
+     */
53
+    protected $user_service;
54
+
55
+    /**
56
+     * A {@link Wordlift_Attachment_Service} instance.
57
+     *
58
+     * @since  3.10.0
59
+     * @access private
60
+     * @var \Wordlift_Attachment_Service $attachment_service A {@link Wordlift_Attachment_Service} instance.
61
+     */
62
+    protected $attachment_service;
63
+
64
+    /**
65
+     * Wordlift_Post_To_Jsonld_Converter constructor.
66
+     *
67
+     * @since 3.10.0
68
+     *
69
+     * @param \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
70
+     * @param \Wordlift_Entity_Service      $entity_service      A {@link Wordlift_Entity_Service} instance.
71
+     * @param \Wordlift_User_Service        $user_service        A {@link Wordlift_User_Service} instance.
72
+     * @param \Wordlift_Attachment_Service  $attachment_service  A {@link Wordlift_Attachment_Service} instance.
73
+     */
74
+    public function __construct( $entity_type_service, $entity_service, $user_service, $attachment_service ) {
75
+
76
+        $this->entity_type_service = $entity_type_service;
77
+        $this->entity_service      = $entity_service;
78
+        $this->user_service        = $user_service;
79
+        $this->attachment_service  = $attachment_service;
80
+    }
81
+
82
+    /**
83
+     * Convert the provided {@link WP_Post} to a JSON-LD array. Any entity reference
84
+     * found while processing the post is set in the $references array.
85
+     *
86
+     * @since 3.10.0
87
+     *
88
+     * @param int   $post_id    The post id.
89
+     * @param array $references An array of entity references.
90
+     *
91
+     * @return array A JSON-LD array.
92
+     */
93
+    public function convert( $post_id, &$references = array() ) {
94
+
95
+        // Get the post instance.
96
+        $post = get_post( $post_id );
97
+        if ( null === $post ) {
98
+            // Post not found.
99
+            return null;
100
+        }
101
+
102
+        // Get the post URI @id.
103
+        $id = $this->entity_service->get_uri( $post->ID );
104
+
105
+        // Get the entity @type. We consider `post` BlogPostings.
106
+        $type = $this->entity_type_service->get( $post_id );
107
+
108
+        // Prepare the response.
109
+        $jsonld = array(
110
+            '@context'    => self::CONTEXT,
111
+            '@id'         => $id,
112
+            '@type'       => $this->relative_to_context( $type['uri'] ),
113
+            'description' => Wordlift_Post_Excerpt_Helper::get_text_excerpt( $post ),
114
+        );
115
+
116
+        // Set the `mainEntityOfPage` property if the post has some contents.
117
+        if ( ! empty( $post->post_content ) ) {
118
+            // We're setting the `mainEntityOfPage` to signal which one is the
119
+            // main entity for the specified URL. It might be however that the
120
+            // post/page is actually about another specific entity. How WL deals
121
+            // with that hasn't been defined yet (see https://github.com/insideout10/wordlift-plugin/issues/451).
122
+            //
123
+            // See http://schema.org/mainEntityOfPage
124
+            //
125
+            // No need to specify `'@type' => 'WebPage'.
126
+            //
127
+            // See https://github.com/insideout10/wordlift-plugin/issues/451.
128
+            $jsonld['mainEntityOfPage'] = get_the_permalink( $post->ID );
129
+        };
130
+
131
+        $this->set_images( $post, $jsonld );
132
+
133
+        // Get the entities referenced by this post and set it to the `references`
134
+        // array so that the caller can do further processing, such as printing out
135
+        // more of those references.
136
+        $references = $this->entity_service->get_related_entities( $post->ID );
137
+
138
+        return $jsonld;
139
+    }
140
+
141
+    /**
142
+     * If the provided value starts with the schema.org context, we remove the schema.org
143
+     * part since it is set with the '@context'.
144
+     *
145
+     * @since 3.10.0
146
+     *
147
+     * @param string $value The property value.
148
+     *
149
+     * @return string The property value without the context.
150
+     */
151
+    public function relative_to_context( $value ) {
152
+
153
+        return 0 === strpos( $value, self::CONTEXT . '/' ) ? substr( $value, strlen( self::CONTEXT ) + 1 ) : $value;
154
+    }
155
+
156
+    /**
157
+     * Set the images, by looking for embedded images, for images loaded via the
158
+     * gallery and for the featured image.
159
+     *
160
+     * Uses the cache service to store the results of this function for a day.
161
+     *
162
+     * @since 3.10.0
163
+     *
164
+     * @param WP_Post $post   The target {@link WP_Post}.
165
+     * @param array   $jsonld The JSON-LD array.
166
+     */
167
+    protected function set_images( $post, &$jsonld ) {
168
+
169
+        // Prepare the attachment ids array.
170
+        $ids = array();
171
+
172
+        // Set the thumbnail id as first attachment id, if any.
173
+        $thumbnail_id = get_post_thumbnail_id( $post->ID );
174
+        if ( '' !== $thumbnail_id ) {
175
+            $ids[] = $thumbnail_id;
176
+        }
177
+
178
+        // For the time being the following is being removed since the query
179
+        // initiated by `get_image_embeds` is consuming lots of CPU.
180
+        //
181
+        // See https://github.com/insideout10/wordlift-plugin/issues/689.
182
+        //
183
+        // Get the embeds, removing existing ids.
184
+        // $embeds = array_diff( $this->attachment_service->get_image_embeds( $post->post_content ), $ids );
185
+        $embeds = array();
186
+
187
+        // Get the gallery, removing existing ids.
188
+        $gallery = array_diff( $this->attachment_service->get_gallery( $post ), $ids, $embeds );
189
+
190
+        // Map the attachment ids to images' data structured for schema.org use.
191
+        $images = array_filter(
192
+            array_map(
193
+                function ( $item ) {
194
+                    /*
195 195
 					* @todo: we're not sure that we're getting attachment data here, we
196 196
 					* should filter `false`s.
197 197
 					*/
198 198
 
199
-					// Get the attachment data.
200
-					$attachment = wp_get_attachment_image_src( $item, 'full' );
201
-
202
-					// Bail if image is not found.
203
-					// In some cases, you can delete the image from the database
204
-					// or from uploads dir, but the image id still exists as featured image
205
-					// or in [gallery] shortcode.
206
-					if ( empty( $attachment[0] ) ) {
207
-						return null;
208
-					}
209
-
210
-					// Refactor data as per schema.org specifications.
211
-					return Wordlift_Abstract_Post_To_Jsonld_Converter::set_image_size(
212
-						array(
213
-							'@type' => 'ImageObject',
214
-							'url'   => $attachment[0],
215
-						), $attachment
216
-					);
217
-				}, array_merge( $ids, $embeds, $gallery )
218
-			)
219
-		);
220
-
221
-		if ( 0 < count( $images ) ) {
222
-			$jsonld['image'] = $images;
223
-		}
224
-
225
-	}
226
-
227
-	/**
228
-	 * Process the provided array by adding the width / height if the values
229
-	 * are available and are greater than 0.
230
-	 *
231
-	 * @since 3.14.0
232
-	 *
233
-	 * @param array $image      The `ImageObject` array.
234
-	 * @param array $attachment The attachment array.
235
-	 *
236
-	 * @return array The enriched `ImageObject` array.
237
-	 */
238
-	public static function set_image_size( $image, $attachment ) {
239
-
240
-		// If you specify a "width" or "height" value you should leave out
241
-		// 'px'. For example: "width":"4608px" should be "width":"4608".
242
-		//
243
-		// See https://github.com/insideout10/wordlift-plugin/issues/451.
244
-		if ( isset( $attachment[1] ) && is_numeric( $attachment[1] ) && 0 < $attachment[1] ) {
245
-			$image['width'] = $attachment[1];
246
-		}
247
-
248
-		if ( isset( $attachment[2] ) && is_numeric( $attachment[2] ) && 0 < $attachment[2] ) {
249
-			$image['height'] = $attachment[2];
250
-		}
251
-
252
-		return $image;
253
-	}
199
+                    // Get the attachment data.
200
+                    $attachment = wp_get_attachment_image_src( $item, 'full' );
201
+
202
+                    // Bail if image is not found.
203
+                    // In some cases, you can delete the image from the database
204
+                    // or from uploads dir, but the image id still exists as featured image
205
+                    // or in [gallery] shortcode.
206
+                    if ( empty( $attachment[0] ) ) {
207
+                        return null;
208
+                    }
209
+
210
+                    // Refactor data as per schema.org specifications.
211
+                    return Wordlift_Abstract_Post_To_Jsonld_Converter::set_image_size(
212
+                        array(
213
+                            '@type' => 'ImageObject',
214
+                            'url'   => $attachment[0],
215
+                        ), $attachment
216
+                    );
217
+                }, array_merge( $ids, $embeds, $gallery )
218
+            )
219
+        );
220
+
221
+        if ( 0 < count( $images ) ) {
222
+            $jsonld['image'] = $images;
223
+        }
224
+
225
+    }
226
+
227
+    /**
228
+     * Process the provided array by adding the width / height if the values
229
+     * are available and are greater than 0.
230
+     *
231
+     * @since 3.14.0
232
+     *
233
+     * @param array $image      The `ImageObject` array.
234
+     * @param array $attachment The attachment array.
235
+     *
236
+     * @return array The enriched `ImageObject` array.
237
+     */
238
+    public static function set_image_size( $image, $attachment ) {
239
+
240
+        // If you specify a "width" or "height" value you should leave out
241
+        // 'px'. For example: "width":"4608px" should be "width":"4608".
242
+        //
243
+        // See https://github.com/insideout10/wordlift-plugin/issues/451.
244
+        if ( isset( $attachment[1] ) && is_numeric( $attachment[1] ) && 0 < $attachment[1] ) {
245
+            $image['width'] = $attachment[1];
246
+        }
247
+
248
+        if ( isset( $attachment[2] ) && is_numeric( $attachment[2] ) && 0 < $attachment[2] ) {
249
+            $image['height'] = $attachment[2];
250
+        }
251
+
252
+        return $image;
253
+    }
254 254
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * @param \Wordlift_User_Service        $user_service        A {@link Wordlift_User_Service} instance.
72 72
 	 * @param \Wordlift_Attachment_Service  $attachment_service  A {@link Wordlift_Attachment_Service} instance.
73 73
 	 */
74
-	public function __construct( $entity_type_service, $entity_service, $user_service, $attachment_service ) {
74
+	public function __construct($entity_type_service, $entity_service, $user_service, $attachment_service) {
75 75
 
76 76
 		$this->entity_type_service = $entity_type_service;
77 77
 		$this->entity_service      = $entity_service;
@@ -90,31 +90,31 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @return array A JSON-LD array.
92 92
 	 */
93
-	public function convert( $post_id, &$references = array() ) {
93
+	public function convert($post_id, &$references = array()) {
94 94
 
95 95
 		// Get the post instance.
96
-		$post = get_post( $post_id );
97
-		if ( null === $post ) {
96
+		$post = get_post($post_id);
97
+		if (null === $post) {
98 98
 			// Post not found.
99 99
 			return null;
100 100
 		}
101 101
 
102 102
 		// Get the post URI @id.
103
-		$id = $this->entity_service->get_uri( $post->ID );
103
+		$id = $this->entity_service->get_uri($post->ID);
104 104
 
105 105
 		// Get the entity @type. We consider `post` BlogPostings.
106
-		$type = $this->entity_type_service->get( $post_id );
106
+		$type = $this->entity_type_service->get($post_id);
107 107
 
108 108
 		// Prepare the response.
109 109
 		$jsonld = array(
110 110
 			'@context'    => self::CONTEXT,
111 111
 			'@id'         => $id,
112
-			'@type'       => $this->relative_to_context( $type['uri'] ),
113
-			'description' => Wordlift_Post_Excerpt_Helper::get_text_excerpt( $post ),
112
+			'@type'       => $this->relative_to_context($type['uri']),
113
+			'description' => Wordlift_Post_Excerpt_Helper::get_text_excerpt($post),
114 114
 		);
115 115
 
116 116
 		// Set the `mainEntityOfPage` property if the post has some contents.
117
-		if ( ! empty( $post->post_content ) ) {
117
+		if ( ! empty($post->post_content)) {
118 118
 			// We're setting the `mainEntityOfPage` to signal which one is the
119 119
 			// main entity for the specified URL. It might be however that the
120 120
 			// post/page is actually about another specific entity. How WL deals
@@ -125,15 +125,15 @@  discard block
 block discarded – undo
125 125
 			// No need to specify `'@type' => 'WebPage'.
126 126
 			//
127 127
 			// See https://github.com/insideout10/wordlift-plugin/issues/451.
128
-			$jsonld['mainEntityOfPage'] = get_the_permalink( $post->ID );
128
+			$jsonld['mainEntityOfPage'] = get_the_permalink($post->ID);
129 129
 		};
130 130
 
131
-		$this->set_images( $post, $jsonld );
131
+		$this->set_images($post, $jsonld);
132 132
 
133 133
 		// Get the entities referenced by this post and set it to the `references`
134 134
 		// array so that the caller can do further processing, such as printing out
135 135
 		// more of those references.
136
-		$references = $this->entity_service->get_related_entities( $post->ID );
136
+		$references = $this->entity_service->get_related_entities($post->ID);
137 137
 
138 138
 		return $jsonld;
139 139
 	}
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 	 *
149 149
 	 * @return string The property value without the context.
150 150
 	 */
151
-	public function relative_to_context( $value ) {
151
+	public function relative_to_context($value) {
152 152
 
153
-		return 0 === strpos( $value, self::CONTEXT . '/' ) ? substr( $value, strlen( self::CONTEXT ) + 1 ) : $value;
153
+		return 0 === strpos($value, self::CONTEXT.'/') ? substr($value, strlen(self::CONTEXT) + 1) : $value;
154 154
 	}
155 155
 
156 156
 	/**
@@ -164,14 +164,14 @@  discard block
 block discarded – undo
164 164
 	 * @param WP_Post $post   The target {@link WP_Post}.
165 165
 	 * @param array   $jsonld The JSON-LD array.
166 166
 	 */
167
-	protected function set_images( $post, &$jsonld ) {
167
+	protected function set_images($post, &$jsonld) {
168 168
 
169 169
 		// Prepare the attachment ids array.
170 170
 		$ids = array();
171 171
 
172 172
 		// Set the thumbnail id as first attachment id, if any.
173
-		$thumbnail_id = get_post_thumbnail_id( $post->ID );
174
-		if ( '' !== $thumbnail_id ) {
173
+		$thumbnail_id = get_post_thumbnail_id($post->ID);
174
+		if ('' !== $thumbnail_id) {
175 175
 			$ids[] = $thumbnail_id;
176 176
 		}
177 177
 
@@ -185,25 +185,25 @@  discard block
 block discarded – undo
185 185
 		$embeds = array();
186 186
 
187 187
 		// Get the gallery, removing existing ids.
188
-		$gallery = array_diff( $this->attachment_service->get_gallery( $post ), $ids, $embeds );
188
+		$gallery = array_diff($this->attachment_service->get_gallery($post), $ids, $embeds);
189 189
 
190 190
 		// Map the attachment ids to images' data structured for schema.org use.
191 191
 		$images = array_filter(
192 192
 			array_map(
193
-				function ( $item ) {
193
+				function($item) {
194 194
 					/*
195 195
 					* @todo: we're not sure that we're getting attachment data here, we
196 196
 					* should filter `false`s.
197 197
 					*/
198 198
 
199 199
 					// Get the attachment data.
200
-					$attachment = wp_get_attachment_image_src( $item, 'full' );
200
+					$attachment = wp_get_attachment_image_src($item, 'full');
201 201
 
202 202
 					// Bail if image is not found.
203 203
 					// In some cases, you can delete the image from the database
204 204
 					// or from uploads dir, but the image id still exists as featured image
205 205
 					// or in [gallery] shortcode.
206
-					if ( empty( $attachment[0] ) ) {
206
+					if (empty($attachment[0])) {
207 207
 						return null;
208 208
 					}
209 209
 
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
 							'url'   => $attachment[0],
215 215
 						), $attachment
216 216
 					);
217
-				}, array_merge( $ids, $embeds, $gallery )
217
+				}, array_merge($ids, $embeds, $gallery)
218 218
 			)
219 219
 		);
220 220
 
221
-		if ( 0 < count( $images ) ) {
221
+		if (0 < count($images)) {
222 222
 			$jsonld['image'] = $images;
223 223
 		}
224 224
 
@@ -235,17 +235,17 @@  discard block
 block discarded – undo
235 235
 	 *
236 236
 	 * @return array The enriched `ImageObject` array.
237 237
 	 */
238
-	public static function set_image_size( $image, $attachment ) {
238
+	public static function set_image_size($image, $attachment) {
239 239
 
240 240
 		// If you specify a "width" or "height" value you should leave out
241 241
 		// 'px'. For example: "width":"4608px" should be "width":"4608".
242 242
 		//
243 243
 		// See https://github.com/insideout10/wordlift-plugin/issues/451.
244
-		if ( isset( $attachment[1] ) && is_numeric( $attachment[1] ) && 0 < $attachment[1] ) {
244
+		if (isset($attachment[1]) && is_numeric($attachment[1]) && 0 < $attachment[1]) {
245 245
 			$image['width'] = $attachment[1];
246 246
 		}
247 247
 
248
-		if ( isset( $attachment[2] ) && is_numeric( $attachment[2] ) && 0 < $attachment[2] ) {
248
+		if (isset($attachment[2]) && is_numeric($attachment[2]) && 0 < $attachment[2]) {
249 249
 			$image['height'] = $attachment[2];
250 250
 		}
251 251
 
Please login to merge, or discard this patch.