Completed
Push — develop ( c614b1...023ff7 )
by David
03:14
created
src/public/class-wordlift-public.php 2 patches
Indentation   +163 added lines, -163 removed lines patch added patch discarded remove patch
@@ -22,174 +22,174 @@
 block discarded – undo
22 22
  */
23 23
 class Wordlift_Public {
24 24
 
25
-	/**
26
-	 * The ID of this plugin.
27
-	 *
28
-	 * @since    1.0.0
29
-	 * @access   private
30
-	 * @var      string $plugin_name The ID of this plugin.
31
-	 */
32
-	private $plugin_name;
33
-
34
-	/**
35
-	 * The version of this plugin.
36
-	 *
37
-	 * @since    1.0.0
38
-	 * @access   private
39
-	 * @var      string $version The current version of this plugin.
40
-	 */
41
-	private $version;
42
-
43
-	/**
44
-	 * Initialize the class and set its properties.
45
-	 *
46
-	 * @since    1.0.0
47
-	 *
48
-	 * @param      string $plugin_name The name of the plugin.
49
-	 * @param      string $version The version of this plugin.
50
-	 */
51
-	public function __construct( $plugin_name, $version ) {
52
-
53
-		$this->plugin_name = $plugin_name;
54
-		$this->version     = $version;
55
-
56
-	}
57
-
58
-	/**
59
-	 * Register the stylesheets for the public-facing side of the site.
60
-	 *
61
-	 * @since 3.19.3 Register the `wordlift-ui` css.
62
-	 * @since 3.19.2 The call to this function is commented out in `class-wordlift.php` because `wordlift-public.css`
63
-	 *               is empty.
64
-	 * @since 1.0.0
65
-	 */
66
-	public function enqueue_styles() {
67
-
68
-		/**
69
-		 * An instance of this class should be passed to the run() function
70
-		 * defined in Wordlift_Loader as all of the hooks are defined
71
-		 * in that particular class.
72
-		 *
73
-		 * The Wordlift_Loader will then create the relationship
74
-		 * between the defined hooks and the functions defined in this
75
-		 * class.
76
-		 */
77
-
78
-		/**
79
-		 * Add the `wordlift-font-awesome` unless some 3rd party sets the flag to false.
80
-		 *
81
-		 * @since 3.19.3
82
-		 *
83
-		 * @param bool $include Whether to include or not font-awesome (default true).
84
-		 */
85
-		$deps = apply_filters( 'wl_include_font_awesome', true )
86
-			? array( 'wordlift-font-awesome' )
87
-			: array();
88
-		wp_register_style( 'wordlift-font-awesome', plugin_dir_url( dirname( __FILE__ ) ) . 'css/wordlift-font-awesome' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.css', array(), $this->version, 'all' );
89
-		wp_register_style( 'wordlift-ui', plugin_dir_url( dirname( __FILE__ ) ) . 'css/wordlift-ui' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.css', $deps, $this->version, 'all' );
90
-
91
-		// You need to re-enable the enqueue_styles in `class-wordlift.php` to make this effective.
92
-		//
93
-		// @see https://github.com/insideout10/wordlift-plugin/issues/821
94
-		//
95
-		// wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-public.css', array(), $this->version, 'all' );
96
-
97
-	}
98
-
99
-	/**
100
-	 * Register the stylesheets for the public-facing side of the site.
101
-	 *
102
-	 * @since    1.0.0
103
-	 */
104
-	public function enqueue_scripts() {
105
-
106
-		/**
107
-		 * This function is provided for demonstration purposes only.
108
-		 *
109
-		 * An instance of this class should be passed to the run() function
110
-		 * defined in Wordlift_Loader as all of the hooks are defined
111
-		 * in that particular class.
112
-		 *
113
-		 * The Wordlift_Loader will then create the relationship
114
-		 * between the defined hooks and the functions defined in this
115
-		 * class.
116
-		 */
117
-
118
-		$settings = self::get_settings();
119
-
120
-		// Note that we switched the js to be loaded in footer, since it is loading
121
-		// the json-ld representation.
122
-		wp_enqueue_script( $this->plugin_name, self::get_public_js_url(), array(), $this->version, true );
123
-		wp_localize_script( $this->plugin_name, 'wlSettings', $settings );
124
-
125
-		/*
25
+    /**
26
+     * The ID of this plugin.
27
+     *
28
+     * @since    1.0.0
29
+     * @access   private
30
+     * @var      string $plugin_name The ID of this plugin.
31
+     */
32
+    private $plugin_name;
33
+
34
+    /**
35
+     * The version of this plugin.
36
+     *
37
+     * @since    1.0.0
38
+     * @access   private
39
+     * @var      string $version The current version of this plugin.
40
+     */
41
+    private $version;
42
+
43
+    /**
44
+     * Initialize the class and set its properties.
45
+     *
46
+     * @since    1.0.0
47
+     *
48
+     * @param      string $plugin_name The name of the plugin.
49
+     * @param      string $version The version of this plugin.
50
+     */
51
+    public function __construct( $plugin_name, $version ) {
52
+
53
+        $this->plugin_name = $plugin_name;
54
+        $this->version     = $version;
55
+
56
+    }
57
+
58
+    /**
59
+     * Register the stylesheets for the public-facing side of the site.
60
+     *
61
+     * @since 3.19.3 Register the `wordlift-ui` css.
62
+     * @since 3.19.2 The call to this function is commented out in `class-wordlift.php` because `wordlift-public.css`
63
+     *               is empty.
64
+     * @since 1.0.0
65
+     */
66
+    public function enqueue_styles() {
67
+
68
+        /**
69
+         * An instance of this class should be passed to the run() function
70
+         * defined in Wordlift_Loader as all of the hooks are defined
71
+         * in that particular class.
72
+         *
73
+         * The Wordlift_Loader will then create the relationship
74
+         * between the defined hooks and the functions defined in this
75
+         * class.
76
+         */
77
+
78
+        /**
79
+         * Add the `wordlift-font-awesome` unless some 3rd party sets the flag to false.
80
+         *
81
+         * @since 3.19.3
82
+         *
83
+         * @param bool $include Whether to include or not font-awesome (default true).
84
+         */
85
+        $deps = apply_filters( 'wl_include_font_awesome', true )
86
+            ? array( 'wordlift-font-awesome' )
87
+            : array();
88
+        wp_register_style( 'wordlift-font-awesome', plugin_dir_url( dirname( __FILE__ ) ) . 'css/wordlift-font-awesome' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.css', array(), $this->version, 'all' );
89
+        wp_register_style( 'wordlift-ui', plugin_dir_url( dirname( __FILE__ ) ) . 'css/wordlift-ui' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.css', $deps, $this->version, 'all' );
90
+
91
+        // You need to re-enable the enqueue_styles in `class-wordlift.php` to make this effective.
92
+        //
93
+        // @see https://github.com/insideout10/wordlift-plugin/issues/821
94
+        //
95
+        // wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-public.css', array(), $this->version, 'all' );
96
+
97
+    }
98
+
99
+    /**
100
+     * Register the stylesheets for the public-facing side of the site.
101
+     *
102
+     * @since    1.0.0
103
+     */
104
+    public function enqueue_scripts() {
105
+
106
+        /**
107
+         * This function is provided for demonstration purposes only.
108
+         *
109
+         * An instance of this class should be passed to the run() function
110
+         * defined in Wordlift_Loader as all of the hooks are defined
111
+         * in that particular class.
112
+         *
113
+         * The Wordlift_Loader will then create the relationship
114
+         * between the defined hooks and the functions defined in this
115
+         * class.
116
+         */
117
+
118
+        $settings = self::get_settings();
119
+
120
+        // Note that we switched the js to be loaded in footer, since it is loading
121
+        // the json-ld representation.
122
+        wp_enqueue_script( $this->plugin_name, self::get_public_js_url(), array(), $this->version, true );
123
+        wp_localize_script( $this->plugin_name, 'wlSettings', $settings );
124
+
125
+        /*
126 126
 		 * Add WordLift's version.
127 127
 		 *
128 128
 		 * @since 3.19.4
129 129
 		 *
130 130
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/843.
131 131
 		 */
132
-		wp_localize_script( $this->plugin_name, 'wordlift', array(
133
-			'version' => $this->version,
134
-		) );
135
-
136
-	}
137
-
138
-	/**
139
-	 * Get the settings array.
140
-	 *
141
-	 * @since 3.19.1
142
-	 *
143
-	 * @return array An array with the settings.
144
-	 */
145
-	public static function get_settings() {
146
-
147
-		// Prepare a settings array for client-side functions.
148
-		$settings = array(
149
-			'ajaxUrl' => admin_url( 'admin-ajax.php' ),
150
-			'apiUrl'  => get_home_url( null, 'wl-api/' ),
151
-		);
152
-
153
-		// If we're in a single page, then print out the post id.
154
-		if ( is_singular() ) {
155
-			$settings['postId'] = get_the_ID();
156
-		}
157
-
158
-		// Add flag that we are on home/blog page.
159
-		if ( is_home() || is_front_page() ) {
160
-			$settings['isHome'] = true;
161
-		}
162
-
163
-		// By default only enable JSON-LD on supported entity pages (includes
164
-		// `page`, `post` and `entity` by default) and on the home page.
165
-		//
166
-		// @see https://github.com/insideout10/wordlift-plugin/issues/733
167
-		$jsonld_enabled = is_home() || is_front_page() || Wordlift_Entity_Type_Service::is_valid_entity_post_type( get_post_type() );
168
-
169
-		// Add the JSON-LD enabled flag, when set to false, the JSON-lD won't
170
-		// be loaded.
171
-		//
172
-		// @see https://github.com/insideout10/wordlift-plugin/issues/642.
173
-		$settings['jsonld_enabled'] = apply_filters( 'wl_jsonld_enabled', $jsonld_enabled );
174
-
175
-		return $settings;
176
-	}
177
-
178
-	/**
179
-	 * Get the public JavaScript URL.
180
-	 *
181
-	 * Using this function is encouraged, since the public JavaScript is also used by the {@link Wordlift_WpRocket_Adapter}
182
-	 * in order to avoid breaking optimizations.
183
-	 *
184
-	 * @since 3.19.4
185
-	 *
186
-	 * @see https://github.com/insideout10/wordlift-plugin/issues/842.
187
-	 *
188
-	 * @return string The URL to the public JavaScript.
189
-	 */
190
-	public static function get_public_js_url() {
191
-
192
-		return plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/bundle.js';
193
-	}
132
+        wp_localize_script( $this->plugin_name, 'wordlift', array(
133
+            'version' => $this->version,
134
+        ) );
135
+
136
+    }
137
+
138
+    /**
139
+     * Get the settings array.
140
+     *
141
+     * @since 3.19.1
142
+     *
143
+     * @return array An array with the settings.
144
+     */
145
+    public static function get_settings() {
146
+
147
+        // Prepare a settings array for client-side functions.
148
+        $settings = array(
149
+            'ajaxUrl' => admin_url( 'admin-ajax.php' ),
150
+            'apiUrl'  => get_home_url( null, 'wl-api/' ),
151
+        );
152
+
153
+        // If we're in a single page, then print out the post id.
154
+        if ( is_singular() ) {
155
+            $settings['postId'] = get_the_ID();
156
+        }
157
+
158
+        // Add flag that we are on home/blog page.
159
+        if ( is_home() || is_front_page() ) {
160
+            $settings['isHome'] = true;
161
+        }
162
+
163
+        // By default only enable JSON-LD on supported entity pages (includes
164
+        // `page`, `post` and `entity` by default) and on the home page.
165
+        //
166
+        // @see https://github.com/insideout10/wordlift-plugin/issues/733
167
+        $jsonld_enabled = is_home() || is_front_page() || Wordlift_Entity_Type_Service::is_valid_entity_post_type( get_post_type() );
168
+
169
+        // Add the JSON-LD enabled flag, when set to false, the JSON-lD won't
170
+        // be loaded.
171
+        //
172
+        // @see https://github.com/insideout10/wordlift-plugin/issues/642.
173
+        $settings['jsonld_enabled'] = apply_filters( 'wl_jsonld_enabled', $jsonld_enabled );
174
+
175
+        return $settings;
176
+    }
177
+
178
+    /**
179
+     * Get the public JavaScript URL.
180
+     *
181
+     * Using this function is encouraged, since the public JavaScript is also used by the {@link Wordlift_WpRocket_Adapter}
182
+     * in order to avoid breaking optimizations.
183
+     *
184
+     * @since 3.19.4
185
+     *
186
+     * @see https://github.com/insideout10/wordlift-plugin/issues/842.
187
+     *
188
+     * @return string The URL to the public JavaScript.
189
+     */
190
+    public static function get_public_js_url() {
191
+
192
+        return plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/bundle.js';
193
+    }
194 194
 
195 195
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @param      string $plugin_name The name of the plugin.
49 49
 	 * @param      string $version The version of this plugin.
50 50
 	 */
51
-	public function __construct( $plugin_name, $version ) {
51
+	public function __construct($plugin_name, $version) {
52 52
 
53 53
 		$this->plugin_name = $plugin_name;
54 54
 		$this->version     = $version;
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
 		 *
83 83
 		 * @param bool $include Whether to include or not font-awesome (default true).
84 84
 		 */
85
-		$deps = apply_filters( 'wl_include_font_awesome', true )
86
-			? array( 'wordlift-font-awesome' )
85
+		$deps = apply_filters('wl_include_font_awesome', true)
86
+			? array('wordlift-font-awesome')
87 87
 			: array();
88
-		wp_register_style( 'wordlift-font-awesome', plugin_dir_url( dirname( __FILE__ ) ) . 'css/wordlift-font-awesome' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.css', array(), $this->version, 'all' );
89
-		wp_register_style( 'wordlift-ui', plugin_dir_url( dirname( __FILE__ ) ) . 'css/wordlift-ui' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.css', $deps, $this->version, 'all' );
88
+		wp_register_style('wordlift-font-awesome', plugin_dir_url(dirname(__FILE__)).'css/wordlift-font-awesome'.( ! defined('SCRIPT_DEBUG') || ! SCRIPT_DEBUG ? '.min' : '').'.css', array(), $this->version, 'all');
89
+		wp_register_style('wordlift-ui', plugin_dir_url(dirname(__FILE__)).'css/wordlift-ui'.( ! defined('SCRIPT_DEBUG') || ! SCRIPT_DEBUG ? '.min' : '').'.css', $deps, $this->version, 'all');
90 90
 
91 91
 		// You need to re-enable the enqueue_styles in `class-wordlift.php` to make this effective.
92 92
 		//
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 
120 120
 		// Note that we switched the js to be loaded in footer, since it is loading
121 121
 		// the json-ld representation.
122
-		wp_enqueue_script( $this->plugin_name, self::get_public_js_url(), array(), $this->version, true );
123
-		wp_localize_script( $this->plugin_name, 'wlSettings', $settings );
122
+		wp_enqueue_script($this->plugin_name, self::get_public_js_url(), array(), $this->version, true);
123
+		wp_localize_script($this->plugin_name, 'wlSettings', $settings);
124 124
 
125 125
 		/*
126 126
 		 * Add WordLift's version.
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 		 *
130 130
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/843.
131 131
 		 */
132
-		wp_localize_script( $this->plugin_name, 'wordlift', array(
132
+		wp_localize_script($this->plugin_name, 'wordlift', array(
133 133
 			'version' => $this->version,
134
-		) );
134
+		));
135 135
 
136 136
 	}
137 137
 
@@ -146,17 +146,17 @@  discard block
 block discarded – undo
146 146
 
147 147
 		// Prepare a settings array for client-side functions.
148 148
 		$settings = array(
149
-			'ajaxUrl' => admin_url( 'admin-ajax.php' ),
150
-			'apiUrl'  => get_home_url( null, 'wl-api/' ),
149
+			'ajaxUrl' => admin_url('admin-ajax.php'),
150
+			'apiUrl'  => get_home_url(null, 'wl-api/'),
151 151
 		);
152 152
 
153 153
 		// If we're in a single page, then print out the post id.
154
-		if ( is_singular() ) {
154
+		if (is_singular()) {
155 155
 			$settings['postId'] = get_the_ID();
156 156
 		}
157 157
 
158 158
 		// Add flag that we are on home/blog page.
159
-		if ( is_home() || is_front_page() ) {
159
+		if (is_home() || is_front_page()) {
160 160
 			$settings['isHome'] = true;
161 161
 		}
162 162
 
@@ -164,13 +164,13 @@  discard block
 block discarded – undo
164 164
 		// `page`, `post` and `entity` by default) and on the home page.
165 165
 		//
166 166
 		// @see https://github.com/insideout10/wordlift-plugin/issues/733
167
-		$jsonld_enabled = is_home() || is_front_page() || Wordlift_Entity_Type_Service::is_valid_entity_post_type( get_post_type() );
167
+		$jsonld_enabled = is_home() || is_front_page() || Wordlift_Entity_Type_Service::is_valid_entity_post_type(get_post_type());
168 168
 
169 169
 		// Add the JSON-LD enabled flag, when set to false, the JSON-lD won't
170 170
 		// be loaded.
171 171
 		//
172 172
 		// @see https://github.com/insideout10/wordlift-plugin/issues/642.
173
-		$settings['jsonld_enabled'] = apply_filters( 'wl_jsonld_enabled', $jsonld_enabled );
173
+		$settings['jsonld_enabled'] = apply_filters('wl_jsonld_enabled', $jsonld_enabled);
174 174
 
175 175
 		return $settings;
176 176
 	}
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public static function get_public_js_url() {
191 191
 
192
-		return plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/bundle.js';
192
+		return plugin_dir_url(dirname(__FILE__)).'js/dist/bundle.js';
193 193
 	}
194 194
 
195 195
 }
Please login to merge, or discard this patch.
src/includes/class-wordlift-image-service.php 2 patches
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -19,85 +19,85 @@
 block discarded – undo
19 19
  */
20 20
 class Wordlift_Image_Service {
21 21
 
22
-	/**
23
-	 * The image ratios and sizes.
24
-	 *
25
-	 * @since 3.19.4
26
-	 * @access public
27
-	 * @var array $sizes The image ratios and sizes.
28
-	 */
29
-	public static $sizes = array(
30
-		'16x9' => array( 1200, 675 ),
31
-		'4x3'  => array( 1200, 900 ),
32
-		'1x1'  => array( 1200, 1200 ),
33
-	);
34
-
35
-	/**
36
-	 * Create a {@link Wordlift_Image_Service} instance.
37
-	 *
38
-	 * @since 3.19.4
39
-	 */
40
-	public function __construct() {
41
-
42
-		// Add hook to define the image sizes. Since we're a plugin, we cannot use the
43
-		// `after_theme_setup` hook.
44
-		add_action( 'init', array( $this, 'after_theme_setup' ) );
45
-
46
-	}
47
-
48
-	/**
49
-	 * Hook `after_theme_setup`: add our own image sizes.
50
-	 *
51
-	 * @since 3.19.4
52
-	 */
53
-	public function after_theme_setup() {
54
-
55
-		foreach ( self::$sizes as $ratio => $sizes ) {
56
-			add_image_size( "wl-$ratio", $sizes[0], $sizes[1], true );
57
-		}
58
-
59
-	}
60
-
61
-	/**
62
-	 * Get the sources for the specified attachment.
63
-	 *
64
-	 * @since 3.19.4
65
-	 *
66
-	 * @param int   $attachment_id The attachment id.
67
-	 *
68
-	 * @return array {
69
-	 * An array of image sources.
70
-	 *
71
-	 * @type string $url The attachment URL.
72
-	 * @type int    $width The attachment width.
73
-	 * @type int    $height The attachment height.
74
-	 * }
75
-	 */
76
-	public static function get_sources( $attachment_id ) {
77
-
78
-		// Get the source for the specified image sizes.
79
-		$sources = array_map( function ( $ratio ) use ( $attachment_id ) {
80
-
81
-			// Get the source of the specified ratio.
82
-			$source = wp_get_attachment_image_src( $attachment_id, "wl-$ratio" );
83
-
84
-			// Get the size for the specified ratio.
85
-			$size = Wordlift_Image_Service::$sizes[ $ratio ];
86
-
87
-			// Check that the source has an image, and the required size.
88
-			if ( empty( $source[0] ) || $size[0] !== $source[1] || $size[1] !== $source[2] ) {
89
-				return null;
90
-			}
91
-
92
-			// Return the source.
93
-			return $source;
94
-		}, array_keys( self::$sizes ) );
95
-
96
-		// Filter unavailable sources.
97
-		$sources_1200 = array_filter( $sources );
98
-
99
-		// Make the results unique.
100
-		return $sources_1200;
101
-	}
22
+    /**
23
+     * The image ratios and sizes.
24
+     *
25
+     * @since 3.19.4
26
+     * @access public
27
+     * @var array $sizes The image ratios and sizes.
28
+     */
29
+    public static $sizes = array(
30
+        '16x9' => array( 1200, 675 ),
31
+        '4x3'  => array( 1200, 900 ),
32
+        '1x1'  => array( 1200, 1200 ),
33
+    );
34
+
35
+    /**
36
+     * Create a {@link Wordlift_Image_Service} instance.
37
+     *
38
+     * @since 3.19.4
39
+     */
40
+    public function __construct() {
41
+
42
+        // Add hook to define the image sizes. Since we're a plugin, we cannot use the
43
+        // `after_theme_setup` hook.
44
+        add_action( 'init', array( $this, 'after_theme_setup' ) );
45
+
46
+    }
47
+
48
+    /**
49
+     * Hook `after_theme_setup`: add our own image sizes.
50
+     *
51
+     * @since 3.19.4
52
+     */
53
+    public function after_theme_setup() {
54
+
55
+        foreach ( self::$sizes as $ratio => $sizes ) {
56
+            add_image_size( "wl-$ratio", $sizes[0], $sizes[1], true );
57
+        }
58
+
59
+    }
60
+
61
+    /**
62
+     * Get the sources for the specified attachment.
63
+     *
64
+     * @since 3.19.4
65
+     *
66
+     * @param int   $attachment_id The attachment id.
67
+     *
68
+     * @return array {
69
+     * An array of image sources.
70
+     *
71
+     * @type string $url The attachment URL.
72
+     * @type int    $width The attachment width.
73
+     * @type int    $height The attachment height.
74
+     * }
75
+     */
76
+    public static function get_sources( $attachment_id ) {
77
+
78
+        // Get the source for the specified image sizes.
79
+        $sources = array_map( function ( $ratio ) use ( $attachment_id ) {
80
+
81
+            // Get the source of the specified ratio.
82
+            $source = wp_get_attachment_image_src( $attachment_id, "wl-$ratio" );
83
+
84
+            // Get the size for the specified ratio.
85
+            $size = Wordlift_Image_Service::$sizes[ $ratio ];
86
+
87
+            // Check that the source has an image, and the required size.
88
+            if ( empty( $source[0] ) || $size[0] !== $source[1] || $size[1] !== $source[2] ) {
89
+                return null;
90
+            }
91
+
92
+            // Return the source.
93
+            return $source;
94
+        }, array_keys( self::$sizes ) );
95
+
96
+        // Filter unavailable sources.
97
+        $sources_1200 = array_filter( $sources );
98
+
99
+        // Make the results unique.
100
+        return $sources_1200;
101
+    }
102 102
 
103 103
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
 	 * @var array $sizes The image ratios and sizes.
28 28
 	 */
29 29
 	public static $sizes = array(
30
-		'16x9' => array( 1200, 675 ),
31
-		'4x3'  => array( 1200, 900 ),
32
-		'1x1'  => array( 1200, 1200 ),
30
+		'16x9' => array(1200, 675),
31
+		'4x3'  => array(1200, 900),
32
+		'1x1'  => array(1200, 1200),
33 33
 	);
34 34
 
35 35
 	/**
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 		// Add hook to define the image sizes. Since we're a plugin, we cannot use the
43 43
 		// `after_theme_setup` hook.
44
-		add_action( 'init', array( $this, 'after_theme_setup' ) );
44
+		add_action('init', array($this, 'after_theme_setup'));
45 45
 
46 46
 	}
47 47
 
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function after_theme_setup() {
54 54
 
55
-		foreach ( self::$sizes as $ratio => $sizes ) {
56
-			add_image_size( "wl-$ratio", $sizes[0], $sizes[1], true );
55
+		foreach (self::$sizes as $ratio => $sizes) {
56
+			add_image_size("wl-$ratio", $sizes[0], $sizes[1], true);
57 57
 		}
58 58
 
59 59
 	}
@@ -73,28 +73,28 @@  discard block
 block discarded – undo
73 73
 	 * @type int    $height The attachment height.
74 74
 	 * }
75 75
 	 */
76
-	public static function get_sources( $attachment_id ) {
76
+	public static function get_sources($attachment_id) {
77 77
 
78 78
 		// Get the source for the specified image sizes.
79
-		$sources = array_map( function ( $ratio ) use ( $attachment_id ) {
79
+		$sources = array_map(function($ratio) use ($attachment_id) {
80 80
 
81 81
 			// Get the source of the specified ratio.
82
-			$source = wp_get_attachment_image_src( $attachment_id, "wl-$ratio" );
82
+			$source = wp_get_attachment_image_src($attachment_id, "wl-$ratio");
83 83
 
84 84
 			// Get the size for the specified ratio.
85
-			$size = Wordlift_Image_Service::$sizes[ $ratio ];
85
+			$size = Wordlift_Image_Service::$sizes[$ratio];
86 86
 
87 87
 			// Check that the source has an image, and the required size.
88
-			if ( empty( $source[0] ) || $size[0] !== $source[1] || $size[1] !== $source[2] ) {
88
+			if (empty($source[0]) || $size[0] !== $source[1] || $size[1] !== $source[2]) {
89 89
 				return null;
90 90
 			}
91 91
 
92 92
 			// Return the source.
93 93
 			return $source;
94
-		}, array_keys( self::$sizes ) );
94
+		}, array_keys(self::$sizes));
95 95
 
96 96
 		// Filter unavailable sources.
97
-		$sources_1200 = array_filter( $sources );
97
+		$sources_1200 = array_filter($sources);
98 98
 
99 99
 		// Make the results unique.
100 100
 		return $sources_1200;
Please login to merge, or discard this patch.
src/includes/class-wordlift-log-service.php 2 patches
Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -7,140 +7,140 @@
 block discarded – undo
7 7
  */
8 8
 class Wordlift_Log_Service {
9 9
 
10
-	const MESSAGE_TEMPLATE = '%-6s [%-40.40s] %s';
11
-
12
-	const ERROR = 4;
13
-	const WARN = 3;
14
-	const INFO = 2;
15
-	const DEBUG = 1;
16
-	const TRACE = 0;
17
-
18
-	/**
19
-	 * The class related to the logs.
20
-	 *
21
-	 * @since  1.0.0
22
-	 * @access private
23
-	 * @var string $class_name The class related to the logs.
24
-	 */
25
-	private $class_name;
26
-
27
-	/**
28
-	 * The log levels for printing in log lines.
29
-	 *
30
-	 * @var array $levels An array of log levels.
31
-	 */
32
-	private static $levels = array(
33
-		self::TRACE => 'TRACE',
34
-		self::DEBUG => 'DEBUG',
35
-		self::INFO  => 'INFO',
36
-		self::WARN  => 'WARN',
37
-		self::ERROR => 'ERROR',
38
-	);
10
+    const MESSAGE_TEMPLATE = '%-6s [%-40.40s] %s';
11
+
12
+    const ERROR = 4;
13
+    const WARN = 3;
14
+    const INFO = 2;
15
+    const DEBUG = 1;
16
+    const TRACE = 0;
17
+
18
+    /**
19
+     * The class related to the logs.
20
+     *
21
+     * @since  1.0.0
22
+     * @access private
23
+     * @var string $class_name The class related to the logs.
24
+     */
25
+    private $class_name;
26
+
27
+    /**
28
+     * The log levels for printing in log lines.
29
+     *
30
+     * @var array $levels An array of log levels.
31
+     */
32
+    private static $levels = array(
33
+        self::TRACE => 'TRACE',
34
+        self::DEBUG => 'DEBUG',
35
+        self::INFO  => 'INFO',
36
+        self::WARN  => 'WARN',
37
+        self::ERROR => 'ERROR',
38
+    );
39 39
 
40
-	/**
41
-	 * A singleton instance for legacy logging.
42
-	 *
43
-	 * @since  3.10.0
44
-	 * @access private
45
-	 * @var \Wordlift_Log_Service $instance A singleton instance for legacy logging.
46
-	 */
47
-	private static $instance = null;
40
+    /**
41
+     * A singleton instance for legacy logging.
42
+     *
43
+     * @since  3.10.0
44
+     * @access private
45
+     * @var \Wordlift_Log_Service $instance A singleton instance for legacy logging.
46
+     */
47
+    private static $instance = null;
48 48
 
49
-	/**
50
-	 * Create an instance of the Log service.
51
-	 * @since 1.0.0
52
-	 *
53
-	 * @param string $class_name The class related to the logs.
54
-	 */
55
-	public function __construct( $class_name ) {
49
+    /**
50
+     * Create an instance of the Log service.
51
+     * @since 1.0.0
52
+     *
53
+     * @param string $class_name The class related to the logs.
54
+     */
55
+    public function __construct( $class_name ) {
56 56
 
57
-		$this->class_name = $class_name;
57
+        $this->class_name = $class_name;
58 58
 
59
-	}
59
+    }
60 60
 
61
-	/**
62
-	 * Get the ROOT logger.
63
-	 *
64
-	 * @since 3.10.0
65
-	 *
66
-	 * @return \Wordlift_Log_Service A singleton instance for legacy logging.
67
-	 */
68
-	public static function get_instance() {
61
+    /**
62
+     * Get the ROOT logger.
63
+     *
64
+     * @since 3.10.0
65
+     *
66
+     * @return \Wordlift_Log_Service A singleton instance for legacy logging.
67
+     */
68
+    public static function get_instance() {
69 69
 
70
-		return self::$instance ?: self::$instance = new Wordlift_Log_Service( 'ROOT' );
71
-	}
70
+        return self::$instance ?: self::$instance = new Wordlift_Log_Service( 'ROOT' );
71
+    }
72 72
 
73 73
 
74
-	public static function get_logger( $class_name ) {
74
+    public static function get_logger( $class_name ) {
75 75
 
76
-		return new Wordlift_Log_Service( $class_name );
76
+        return new Wordlift_Log_Service( $class_name );
77 77
 
78
-	}
78
+    }
79 79
 
80
-	/**
81
-	 * Log a message.
82
-	 *
83
-	 * @since 1.0.0
84
-	 *
85
-	 * @param string $level   The log level.
86
-	 * @param string $message The message to log.
87
-	 */
88
-	public function log( $level, $message ) {
80
+    /**
81
+     * Log a message.
82
+     *
83
+     * @since 1.0.0
84
+     *
85
+     * @param string $level   The log level.
86
+     * @param string $message The message to log.
87
+     */
88
+    public function log( $level, $message ) {
89 89
 
90
-		// Bail out if `WL_DEBUG` isn't defined or it's false.
91
-		if ( ! defined( 'WL_DEBUG') || false === WL_DEBUG ) {
92
-			return;
93
-		}
90
+        // Bail out if `WL_DEBUG` isn't defined or it's false.
91
+        if ( ! defined( 'WL_DEBUG') || false === WL_DEBUG ) {
92
+            return;
93
+        }
94 94
 
95
-		// Bail out if WordLift log level isn't defined, and WP debug is disabled.
96
-		if ( ! defined( 'WL_LOG_LEVEL' ) && $level < self::ERROR
97
-			 && ( ! defined( 'WP_DEBUG' ) || false === WP_DEBUG ) ) {
98
-			return;
99
-		}
95
+        // Bail out if WordLift log level isn't defined, and WP debug is disabled.
96
+        if ( ! defined( 'WL_LOG_LEVEL' ) && $level < self::ERROR
97
+             && ( ! defined( 'WP_DEBUG' ) || false === WP_DEBUG ) ) {
98
+            return;
99
+        }
100 100
 
101
-		// Bail out if the log message is below the minimum log level.
102
-		if ( defined( 'WL_LOG_LEVEL' ) && $level < intval( WL_LOG_LEVEL ) ) {
103
-			return;
104
-		}
101
+        // Bail out if the log message is below the minimum log level.
102
+        if ( defined( 'WL_LOG_LEVEL' ) && $level < intval( WL_LOG_LEVEL ) ) {
103
+            return;
104
+        }
105 105
 
106
-		// Bail out if there's a filter and we don't match it.
107
-		if ( defined( 'WL_LOG_FILTER' ) && 1 !== preg_match( "/(^|,)$this->class_name($|,)/", WL_LOG_FILTER ) ) {
108
-			return;
109
-		}
106
+        // Bail out if there's a filter and we don't match it.
107
+        if ( defined( 'WL_LOG_FILTER' ) && 1 !== preg_match( "/(^|,)$this->class_name($|,)/", WL_LOG_FILTER ) ) {
108
+            return;
109
+        }
110 110
 
111
-		// Finally log the message.
112
-		error_log( sprintf( self::MESSAGE_TEMPLATE, self::$levels[ $level ], $this->class_name, is_array( $message ) ? implode( ', ', $message ) : $message ) );
111
+        // Finally log the message.
112
+        error_log( sprintf( self::MESSAGE_TEMPLATE, self::$levels[ $level ], $this->class_name, is_array( $message ) ? implode( ', ', $message ) : $message ) );
113 113
 
114
-	}
114
+    }
115 115
 
116
-	public function error( $message ) {
116
+    public function error( $message ) {
117 117
 
118
-		$this->log( self::ERROR, $message );
118
+        $this->log( self::ERROR, $message );
119 119
 
120
-	}
120
+    }
121 121
 
122
-	public function warn( $message ) {
122
+    public function warn( $message ) {
123 123
 
124
-		$this->log( self::WARN, $message );
124
+        $this->log( self::WARN, $message );
125 125
 
126
-	}
126
+    }
127 127
 
128
-	public function info( $message ) {
128
+    public function info( $message ) {
129 129
 
130
-		$this->log( self::INFO, $message );
130
+        $this->log( self::INFO, $message );
131 131
 
132
-	}
132
+    }
133 133
 
134
-	public function debug( $message ) {
134
+    public function debug( $message ) {
135 135
 
136
-		$this->log( self::DEBUG, $message );
136
+        $this->log( self::DEBUG, $message );
137 137
 
138
-	}
138
+    }
139 139
 
140
-	public function trace( $message ) {
140
+    public function trace( $message ) {
141 141
 
142
-		$this->log( self::TRACE, $message );
142
+        $this->log( self::TRACE, $message );
143 143
 
144
-	}
144
+    }
145 145
 
146 146
 }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @param string $class_name The class related to the logs.
54 54
 	 */
55
-	public function __construct( $class_name ) {
55
+	public function __construct($class_name) {
56 56
 
57 57
 		$this->class_name = $class_name;
58 58
 
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public static function get_instance() {
69 69
 
70
-		return self::$instance ?: self::$instance = new Wordlift_Log_Service( 'ROOT' );
70
+		return self::$instance ?: self::$instance = new Wordlift_Log_Service('ROOT');
71 71
 	}
72 72
 
73 73
 
74
-	public static function get_logger( $class_name ) {
74
+	public static function get_logger($class_name) {
75 75
 
76
-		return new Wordlift_Log_Service( $class_name );
76
+		return new Wordlift_Log_Service($class_name);
77 77
 
78 78
 	}
79 79
 
@@ -85,61 +85,61 @@  discard block
 block discarded – undo
85 85
 	 * @param string $level   The log level.
86 86
 	 * @param string $message The message to log.
87 87
 	 */
88
-	public function log( $level, $message ) {
88
+	public function log($level, $message) {
89 89
 
90 90
 		// Bail out if `WL_DEBUG` isn't defined or it's false.
91
-		if ( ! defined( 'WL_DEBUG') || false === WL_DEBUG ) {
91
+		if ( ! defined('WL_DEBUG') || false === WL_DEBUG) {
92 92
 			return;
93 93
 		}
94 94
 
95 95
 		// Bail out if WordLift log level isn't defined, and WP debug is disabled.
96
-		if ( ! defined( 'WL_LOG_LEVEL' ) && $level < self::ERROR
97
-			 && ( ! defined( 'WP_DEBUG' ) || false === WP_DEBUG ) ) {
96
+		if ( ! defined('WL_LOG_LEVEL') && $level < self::ERROR
97
+			 && ( ! defined('WP_DEBUG') || false === WP_DEBUG)) {
98 98
 			return;
99 99
 		}
100 100
 
101 101
 		// Bail out if the log message is below the minimum log level.
102
-		if ( defined( 'WL_LOG_LEVEL' ) && $level < intval( WL_LOG_LEVEL ) ) {
102
+		if (defined('WL_LOG_LEVEL') && $level < intval(WL_LOG_LEVEL)) {
103 103
 			return;
104 104
 		}
105 105
 
106 106
 		// Bail out if there's a filter and we don't match it.
107
-		if ( defined( 'WL_LOG_FILTER' ) && 1 !== preg_match( "/(^|,)$this->class_name($|,)/", WL_LOG_FILTER ) ) {
107
+		if (defined('WL_LOG_FILTER') && 1 !== preg_match("/(^|,)$this->class_name($|,)/", WL_LOG_FILTER)) {
108 108
 			return;
109 109
 		}
110 110
 
111 111
 		// Finally log the message.
112
-		error_log( sprintf( self::MESSAGE_TEMPLATE, self::$levels[ $level ], $this->class_name, is_array( $message ) ? implode( ', ', $message ) : $message ) );
112
+		error_log(sprintf(self::MESSAGE_TEMPLATE, self::$levels[$level], $this->class_name, is_array($message) ? implode(', ', $message) : $message));
113 113
 
114 114
 	}
115 115
 
116
-	public function error( $message ) {
116
+	public function error($message) {
117 117
 
118
-		$this->log( self::ERROR, $message );
118
+		$this->log(self::ERROR, $message);
119 119
 
120 120
 	}
121 121
 
122
-	public function warn( $message ) {
122
+	public function warn($message) {
123 123
 
124
-		$this->log( self::WARN, $message );
124
+		$this->log(self::WARN, $message);
125 125
 
126 126
 	}
127 127
 
128
-	public function info( $message ) {
128
+	public function info($message) {
129 129
 
130
-		$this->log( self::INFO, $message );
130
+		$this->log(self::INFO, $message);
131 131
 
132 132
 	}
133 133
 
134
-	public function debug( $message ) {
134
+	public function debug($message) {
135 135
 
136
-		$this->log( self::DEBUG, $message );
136
+		$this->log(self::DEBUG, $message);
137 137
 
138 138
 	}
139 139
 
140
-	public function trace( $message ) {
140
+	public function trace($message) {
141 141
 
142
-		$this->log( self::TRACE, $message );
142
+		$this->log(self::TRACE, $message);
143 143
 
144 144
 	}
145 145
 
Please login to merge, or discard this patch.
src/includes/class-wordlift-wprocket-adapter.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -20,30 +20,30 @@
 block discarded – undo
20 20
  */
21 21
 class Wordlift_WpRocket_Adapter {
22 22
 
23
-	/**
24
-	 * Create a {@link Wordlift_WpRocket_Adapter} instance.
25
-	 *
26
-	 * @since 3.19.4
27
-	 */
28
-	public function __construct() {
23
+    /**
24
+     * Create a {@link Wordlift_WpRocket_Adapter} instance.
25
+     *
26
+     * @since 3.19.4
27
+     */
28
+    public function __construct() {
29 29
 
30
-		add_filter( 'rocket_exclude_defer_js', array( $this, 'exclude_defer_js' ) );
30
+        add_filter( 'rocket_exclude_defer_js', array( $this, 'exclude_defer_js' ) );
31 31
 
32
-	}
32
+    }
33 33
 
34
-	/**
35
-	 * Hook to `rocket_exclude_defer_js` filter.
36
-	 *
37
-	 * @since 3.19.4
38
-	 *
39
-	 * @param array $excluded_files The preset excluded files.
40
-	 *
41
-	 * @return array The updated excluded files array.
42
-	 */
43
-	public function exclude_defer_js( $excluded_files = array() ) {
34
+    /**
35
+     * Hook to `rocket_exclude_defer_js` filter.
36
+     *
37
+     * @since 3.19.4
38
+     *
39
+     * @param array $excluded_files The preset excluded files.
40
+     *
41
+     * @return array The updated excluded files array.
42
+     */
43
+    public function exclude_defer_js( $excluded_files = array() ) {
44 44
 
45
-		// Exclude our own public JS.
46
-		return array_merge( $excluded_files, array( Wordlift_Public::get_public_js_url(), ) );
47
-	}
45
+        // Exclude our own public JS.
46
+        return array_merge( $excluded_files, array( Wordlift_Public::get_public_js_url(), ) );
47
+    }
48 48
 
49 49
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public function __construct() {
29 29
 
30
-		add_filter( 'rocket_exclude_defer_js', array( $this, 'exclude_defer_js' ) );
30
+		add_filter('rocket_exclude_defer_js', array($this, 'exclude_defer_js'));
31 31
 
32 32
 	}
33 33
 
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @return array The updated excluded files array.
42 42
 	 */
43
-	public function exclude_defer_js( $excluded_files = array() ) {
43
+	public function exclude_defer_js($excluded_files = array()) {
44 44
 
45 45
 		// Exclude our own public JS.
46
-		return array_merge( $excluded_files, array( Wordlift_Public::get_public_js_url(), ) );
46
+		return array_merge($excluded_files, array(Wordlift_Public::get_public_js_url(),));
47 47
 	}
48 48
 
49 49
 }
Please login to merge, or discard this patch.
src/includes/class-wordlift-http-api.php 2 patches
Indentation   +171 added lines, -171 removed lines patch added patch discarded remove patch
@@ -16,176 +16,176 @@
 block discarded – undo
16 16
  */
17 17
 class Wordlift_Http_Api {
18 18
 
19
-	/**
20
-	 * A {@link Wordlift_Log_Service} instance.
21
-	 *
22
-	 * @since 3.15.3
23
-	 *
24
-	 * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
25
-	 */
26
-	private $log;
27
-
28
-	/**
29
-	 * Create a {@link Wordlift_End_Point} instance.
30
-	 *
31
-	 * @since 3.15.3
32
-	 */
33
-	public function __construct() {
34
-
35
-		$this->log = Wordlift_Log_Service::get_logger( get_class() );
36
-
37
-		add_action( 'init', array( $this, 'add_rewrite_endpoint' ) );
38
-		add_action( 'template_redirect', array( $this, 'template_redirect' ) );
39
-
40
-		//region SAMPLE ACTIONS.
41
-		add_action( 'admin_post_wl_hello_world', array(
42
-			$this,
43
-			'hello_world',
44
-		) );
45
-		add_action( 'admin_post_nopriv_wl_hello_world', array(
46
-			$this,
47
-			'nopriv_hello_world',
48
-		) );
49
-		//endregion
50
-
51
-	}
52
-
53
-	/**
54
-	 * Add the `wl-api` rewrite end-point.
55
-	 *
56
-	 * @since 3.15.3
57
-	 */
58
-	public function add_rewrite_endpoint() {
59
-
60
-		add_rewrite_endpoint( 'wl-api', EP_ROOT );
61
-		$this->ensure_rewrite_rules_are_flushed();
62
-
63
-	}
64
-
65
-	/**
66
-	 * Handle `template_redirect` hooks.
67
-	 *
68
-	 * @since 3.15.3
69
-	 */
70
-	public function template_redirect() {
71
-
72
-		global $wp_query;
73
-
74
-		if ( ! isset( $wp_query->query_vars['wl-api'] ) ) {
75
-			$this->log->trace( 'Skipping, not a `wl-api` call.' );
76
-
77
-			return;
78
-		}
79
-
80
-		$this->do_action( $_REQUEST['action'] );
81
-
82
-		exit;
83
-
84
-	}
85
-
86
-	/**
87
-	 * Do the requested action.
88
-	 *
89
-	 * @since 3.15.3
90
-	 *
91
-	 * @param string $action The action to execute.
92
-	 */
93
-	private function do_action( $action ) {
94
-
95
-		if ( empty( $action ) ) {
96
-			return;
97
-		}
98
-
99
-		if ( ! wp_validate_auth_cookie( '', 'logged_in' ) ) {
100
-			/**
101
-			 * Fires on a non-authenticated admin post request for the given action.
102
-			 *
103
-			 * The dynamic portion of the hook name, `$action`, refers to the given
104
-			 * request action.
105
-			 *
106
-			 * @since 2.6.0
107
-			 */
108
-			do_action( "admin_post_nopriv_{$action}" );
109
-		} else {
110
-			/**
111
-			 * Fires on an authenticated admin post request for the given action.
112
-			 *
113
-			 * The dynamic portion of the hook name, `$action`, refers to the given
114
-			 * request action.
115
-			 *
116
-			 * @since 2.6.0
117
-			 */
118
-			do_action( "admin_post_{$action}" );
119
-		}
120
-
121
-	}
122
-
123
-	/**
124
-	 * Test function, anonymous.
125
-	 *
126
-	 * @since 3.15.3
127
-	 */
128
-	public function nopriv_hello_world() {
129
-
130
-		wp_die( 'Hello World! (from anonymous)' );
131
-
132
-	}
133
-
134
-	/**
135
-	 * Test function, authenticated.
136
-	 *
137
-	 * @since 3.15.3
138
-	 */
139
-	public function hello_world() {
140
-
141
-		wp_die( 'Hello World! (from authenticated)' );
142
-
143
-	}
144
-
145
-	/**
146
-	 * Ensure that the rewrite rules are flushed the first time.
147
-	 *
148
-	 * @since 3.16.0 changed the value from 1 to `yes` to avoid type juggling issues.
149
-	 * @since 3.15.3
150
-	 */
151
-	public static function ensure_rewrite_rules_are_flushed() {
152
-
153
-		// See https://github.com/insideout10/wordlift-plugin/issues/698.
154
-		if ( 'yes' !== get_option( 'wl_http_api' ) ) {
155
-			update_option( 'wl_http_api', 'yes' );
156
-			add_action( 'wp_loaded', function () {
157
-				flush_rewrite_rules();
158
-			} );
159
-		}
160
-
161
-	}
162
-
163
-	/**
164
-	 * Called by {@see activate_wordlift}, resets the `wl_http_api` option flag in order to force WordLift to
165
-	 * reinitialize the `wl-api` route.
166
-	 *
167
-	 * @see https://github.com/insideout10/wordlift-plugin/issues/820 related issue.
168
-	 *
169
-	 * @since 3.19.2
170
-	 */
171
-	public static function activate() {
172
-
173
-		// Force the plugin to reinitialize the rewrite rules.
174
-		update_option( 'wl_http_api', 'no' );
175
-
176
-	}
177
-
178
-	/**
179
-	 * Delete the option when the plugin is deactivated.
180
-	 *
181
-	 * @since 3.19.4
182
-	 *
183
-	 * @see https://github.com/insideout10/wordlift-plugin/issues/846
184
-	 */
185
-	public static function deactivate() {
186
-
187
-		delete_option( 'wl_http_api' );
188
-
189
-	}
19
+    /**
20
+     * A {@link Wordlift_Log_Service} instance.
21
+     *
22
+     * @since 3.15.3
23
+     *
24
+     * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
25
+     */
26
+    private $log;
27
+
28
+    /**
29
+     * Create a {@link Wordlift_End_Point} instance.
30
+     *
31
+     * @since 3.15.3
32
+     */
33
+    public function __construct() {
34
+
35
+        $this->log = Wordlift_Log_Service::get_logger( get_class() );
36
+
37
+        add_action( 'init', array( $this, 'add_rewrite_endpoint' ) );
38
+        add_action( 'template_redirect', array( $this, 'template_redirect' ) );
39
+
40
+        //region SAMPLE ACTIONS.
41
+        add_action( 'admin_post_wl_hello_world', array(
42
+            $this,
43
+            'hello_world',
44
+        ) );
45
+        add_action( 'admin_post_nopriv_wl_hello_world', array(
46
+            $this,
47
+            'nopriv_hello_world',
48
+        ) );
49
+        //endregion
50
+
51
+    }
52
+
53
+    /**
54
+     * Add the `wl-api` rewrite end-point.
55
+     *
56
+     * @since 3.15.3
57
+     */
58
+    public function add_rewrite_endpoint() {
59
+
60
+        add_rewrite_endpoint( 'wl-api', EP_ROOT );
61
+        $this->ensure_rewrite_rules_are_flushed();
62
+
63
+    }
64
+
65
+    /**
66
+     * Handle `template_redirect` hooks.
67
+     *
68
+     * @since 3.15.3
69
+     */
70
+    public function template_redirect() {
71
+
72
+        global $wp_query;
73
+
74
+        if ( ! isset( $wp_query->query_vars['wl-api'] ) ) {
75
+            $this->log->trace( 'Skipping, not a `wl-api` call.' );
76
+
77
+            return;
78
+        }
79
+
80
+        $this->do_action( $_REQUEST['action'] );
81
+
82
+        exit;
83
+
84
+    }
85
+
86
+    /**
87
+     * Do the requested action.
88
+     *
89
+     * @since 3.15.3
90
+     *
91
+     * @param string $action The action to execute.
92
+     */
93
+    private function do_action( $action ) {
94
+
95
+        if ( empty( $action ) ) {
96
+            return;
97
+        }
98
+
99
+        if ( ! wp_validate_auth_cookie( '', 'logged_in' ) ) {
100
+            /**
101
+             * Fires on a non-authenticated admin post request for the given action.
102
+             *
103
+             * The dynamic portion of the hook name, `$action`, refers to the given
104
+             * request action.
105
+             *
106
+             * @since 2.6.0
107
+             */
108
+            do_action( "admin_post_nopriv_{$action}" );
109
+        } else {
110
+            /**
111
+             * Fires on an authenticated admin post request for the given action.
112
+             *
113
+             * The dynamic portion of the hook name, `$action`, refers to the given
114
+             * request action.
115
+             *
116
+             * @since 2.6.0
117
+             */
118
+            do_action( "admin_post_{$action}" );
119
+        }
120
+
121
+    }
122
+
123
+    /**
124
+     * Test function, anonymous.
125
+     *
126
+     * @since 3.15.3
127
+     */
128
+    public function nopriv_hello_world() {
129
+
130
+        wp_die( 'Hello World! (from anonymous)' );
131
+
132
+    }
133
+
134
+    /**
135
+     * Test function, authenticated.
136
+     *
137
+     * @since 3.15.3
138
+     */
139
+    public function hello_world() {
140
+
141
+        wp_die( 'Hello World! (from authenticated)' );
142
+
143
+    }
144
+
145
+    /**
146
+     * Ensure that the rewrite rules are flushed the first time.
147
+     *
148
+     * @since 3.16.0 changed the value from 1 to `yes` to avoid type juggling issues.
149
+     * @since 3.15.3
150
+     */
151
+    public static function ensure_rewrite_rules_are_flushed() {
152
+
153
+        // See https://github.com/insideout10/wordlift-plugin/issues/698.
154
+        if ( 'yes' !== get_option( 'wl_http_api' ) ) {
155
+            update_option( 'wl_http_api', 'yes' );
156
+            add_action( 'wp_loaded', function () {
157
+                flush_rewrite_rules();
158
+            } );
159
+        }
160
+
161
+    }
162
+
163
+    /**
164
+     * Called by {@see activate_wordlift}, resets the `wl_http_api` option flag in order to force WordLift to
165
+     * reinitialize the `wl-api` route.
166
+     *
167
+     * @see https://github.com/insideout10/wordlift-plugin/issues/820 related issue.
168
+     *
169
+     * @since 3.19.2
170
+     */
171
+    public static function activate() {
172
+
173
+        // Force the plugin to reinitialize the rewrite rules.
174
+        update_option( 'wl_http_api', 'no' );
175
+
176
+    }
177
+
178
+    /**
179
+     * Delete the option when the plugin is deactivated.
180
+     *
181
+     * @since 3.19.4
182
+     *
183
+     * @see https://github.com/insideout10/wordlift-plugin/issues/846
184
+     */
185
+    public static function deactivate() {
186
+
187
+        delete_option( 'wl_http_api' );
188
+
189
+    }
190 190
 
191 191
 }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -32,20 +32,20 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function __construct() {
34 34
 
35
-		$this->log = Wordlift_Log_Service::get_logger( get_class() );
35
+		$this->log = Wordlift_Log_Service::get_logger(get_class());
36 36
 
37
-		add_action( 'init', array( $this, 'add_rewrite_endpoint' ) );
38
-		add_action( 'template_redirect', array( $this, 'template_redirect' ) );
37
+		add_action('init', array($this, 'add_rewrite_endpoint'));
38
+		add_action('template_redirect', array($this, 'template_redirect'));
39 39
 
40 40
 		//region SAMPLE ACTIONS.
41
-		add_action( 'admin_post_wl_hello_world', array(
41
+		add_action('admin_post_wl_hello_world', array(
42 42
 			$this,
43 43
 			'hello_world',
44
-		) );
45
-		add_action( 'admin_post_nopriv_wl_hello_world', array(
44
+		));
45
+		add_action('admin_post_nopriv_wl_hello_world', array(
46 46
 			$this,
47 47
 			'nopriv_hello_world',
48
-		) );
48
+		));
49 49
 		//endregion
50 50
 
51 51
 	}
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function add_rewrite_endpoint() {
59 59
 
60
-		add_rewrite_endpoint( 'wl-api', EP_ROOT );
60
+		add_rewrite_endpoint('wl-api', EP_ROOT);
61 61
 		$this->ensure_rewrite_rules_are_flushed();
62 62
 
63 63
 	}
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
 
72 72
 		global $wp_query;
73 73
 
74
-		if ( ! isset( $wp_query->query_vars['wl-api'] ) ) {
75
-			$this->log->trace( 'Skipping, not a `wl-api` call.' );
74
+		if ( ! isset($wp_query->query_vars['wl-api'])) {
75
+			$this->log->trace('Skipping, not a `wl-api` call.');
76 76
 
77 77
 			return;
78 78
 		}
79 79
 
80
-		$this->do_action( $_REQUEST['action'] );
80
+		$this->do_action($_REQUEST['action']);
81 81
 
82 82
 		exit;
83 83
 
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @param string $action The action to execute.
92 92
 	 */
93
-	private function do_action( $action ) {
93
+	private function do_action($action) {
94 94
 
95
-		if ( empty( $action ) ) {
95
+		if (empty($action)) {
96 96
 			return;
97 97
 		}
98 98
 
99
-		if ( ! wp_validate_auth_cookie( '', 'logged_in' ) ) {
99
+		if ( ! wp_validate_auth_cookie('', 'logged_in')) {
100 100
 			/**
101 101
 			 * Fires on a non-authenticated admin post request for the given action.
102 102
 			 *
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 			 *
106 106
 			 * @since 2.6.0
107 107
 			 */
108
-			do_action( "admin_post_nopriv_{$action}" );
108
+			do_action("admin_post_nopriv_{$action}");
109 109
 		} else {
110 110
 			/**
111 111
 			 * Fires on an authenticated admin post request for the given action.
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 			 *
116 116
 			 * @since 2.6.0
117 117
 			 */
118
-			do_action( "admin_post_{$action}" );
118
+			do_action("admin_post_{$action}");
119 119
 		}
120 120
 
121 121
 	}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	public function nopriv_hello_world() {
129 129
 
130
-		wp_die( 'Hello World! (from anonymous)' );
130
+		wp_die('Hello World! (from anonymous)');
131 131
 
132 132
 	}
133 133
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function hello_world() {
140 140
 
141
-		wp_die( 'Hello World! (from authenticated)' );
141
+		wp_die('Hello World! (from authenticated)');
142 142
 
143 143
 	}
144 144
 
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 	public static function ensure_rewrite_rules_are_flushed() {
152 152
 
153 153
 		// See https://github.com/insideout10/wordlift-plugin/issues/698.
154
-		if ( 'yes' !== get_option( 'wl_http_api' ) ) {
155
-			update_option( 'wl_http_api', 'yes' );
156
-			add_action( 'wp_loaded', function () {
154
+		if ('yes' !== get_option('wl_http_api')) {
155
+			update_option('wl_http_api', 'yes');
156
+			add_action('wp_loaded', function() {
157 157
 				flush_rewrite_rules();
158 158
 			} );
159 159
 		}
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	public static function activate() {
172 172
 
173 173
 		// Force the plugin to reinitialize the rewrite rules.
174
-		update_option( 'wl_http_api', 'no' );
174
+		update_option('wl_http_api', 'no');
175 175
 
176 176
 	}
177 177
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	public static function deactivate() {
186 186
 
187
-		delete_option( 'wl_http_api' );
187
+		delete_option('wl_http_api');
188 188
 
189 189
 	}
190 190
 
Please login to merge, or discard this patch.
src/modules/linked_data/wordlift_linked_data.php 2 patches
Indentation   +358 added lines, -358 removed lines patch added patch discarded remove patch
@@ -16,45 +16,45 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function wl_linked_data_save_post( $post_id ) {
18 18
 
19
-	$log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post' );
19
+    $log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post' );
20 20
 
21
-	$log->trace( "Saving post $post_id to Linked Data..." );
21
+    $log->trace( "Saving post $post_id to Linked Data..." );
22 22
 
23
-	// If it's not numeric exit from here.
24
-	if ( ! is_numeric( $post_id ) || is_numeric( wp_is_post_revision( $post_id ) ) ) {
25
-		$log->debug( "Skipping $post_id, because id is not numeric or is a post revision." );
23
+    // If it's not numeric exit from here.
24
+    if ( ! is_numeric( $post_id ) || is_numeric( wp_is_post_revision( $post_id ) ) ) {
25
+        $log->debug( "Skipping $post_id, because id is not numeric or is a post revision." );
26 26
 
27
-		return;
28
-	}
27
+        return;
28
+    }
29 29
 
30
-	// Get the post type and check whether it supports the editor.
31
-	//
32
-	// @see https://github.com/insideout10/wordlift-plugin/issues/659.
33
-	$post_type = get_post_type( $post_id );
34
-	/**
35
-	 * Use `wl_post_type_supports_editor` which calls a filter to allow 3rd parties to change the setting.
36
-	 *
37
-	 * @since 3.19.4
38
-	 *
39
-	 * @see https://github.com/insideout10/wordlift-plugin/issues/847.
40
-	 */
41
-	$is_editor_supported = wl_post_type_supports_editor( $post_type );
30
+    // Get the post type and check whether it supports the editor.
31
+    //
32
+    // @see https://github.com/insideout10/wordlift-plugin/issues/659.
33
+    $post_type = get_post_type( $post_id );
34
+    /**
35
+     * Use `wl_post_type_supports_editor` which calls a filter to allow 3rd parties to change the setting.
36
+     *
37
+     * @since 3.19.4
38
+     *
39
+     * @see https://github.com/insideout10/wordlift-plugin/issues/847.
40
+     */
41
+    $is_editor_supported = wl_post_type_supports_editor( $post_type );
42 42
 
43
-	// Bail out if it's not an entity.
44
-	if ( ! $is_editor_supported ) {
45
-		$log->debug( "Skipping $post_id, because $post_type doesn't support the editor (content)." );
43
+    // Bail out if it's not an entity.
44
+    if ( ! $is_editor_supported ) {
45
+        $log->debug( "Skipping $post_id, because $post_type doesn't support the editor (content)." );
46 46
 
47
-		return;
48
-	}
47
+        return;
48
+    }
49 49
 
50
-	// Unhook this function so it doesn't loop infinitely.
51
-	remove_action( 'save_post', 'wl_linked_data_save_post' );
50
+    // Unhook this function so it doesn't loop infinitely.
51
+    remove_action( 'save_post', 'wl_linked_data_save_post' );
52 52
 
53
-	// raise the *wl_linked_data_save_post* event.
54
-	do_action( 'wl_linked_data_save_post', $post_id );
53
+    // raise the *wl_linked_data_save_post* event.
54
+    do_action( 'wl_linked_data_save_post', $post_id );
55 55
 
56
-	// Re-hook this function.
57
-	add_action( 'save_post', 'wl_linked_data_save_post' );
56
+    // Re-hook this function.
57
+    add_action( 'save_post', 'wl_linked_data_save_post' );
58 58
 }
59 59
 
60 60
 add_action( 'save_post', 'wl_linked_data_save_post' );
@@ -68,156 +68,156 @@  discard block
 block discarded – undo
68 68
  */
69 69
 function wl_linked_data_save_post_and_related_entities( $post_id ) {
70 70
 
71
-	$log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post_and_related_entities' );
71
+    $log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post_and_related_entities' );
72 72
 
73
-	$log->trace( "Saving $post_id to Linked Data along with related entities..." );
73
+    $log->trace( "Saving $post_id to Linked Data along with related entities..." );
74 74
 
75
-	// Ignore auto-saves
76
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
77
-		$log->trace( 'Doing autosave, skipping...' );
75
+    // Ignore auto-saves
76
+    if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
77
+        $log->trace( 'Doing autosave, skipping...' );
78 78
 
79
-		return;
80
-	}
79
+        return;
80
+    }
81 81
 
82
-	// get the current post.
83
-	$post = get_post( $post_id );
82
+    // get the current post.
83
+    $post = get_post( $post_id );
84 84
 
85
-	remove_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' );
85
+    remove_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' );
86 86
 
87
-	// wl_write_log( "[ post id :: $post_id ][ autosave :: false ][ post type :: $post->post_type ]" );
87
+    // wl_write_log( "[ post id :: $post_id ][ autosave :: false ][ post type :: $post->post_type ]" );
88 88
 
89
-	// Get the entity service instance.
90
-	$entity_service = Wordlift_Entity_Service::get_instance();
89
+    // Get the entity service instance.
90
+    $entity_service = Wordlift_Entity_Service::get_instance();
91 91
 
92
-	// Store mapping between tmp new entities uris and real new entities uri
93
-	$entities_uri_mapping = array();
92
+    // Store mapping between tmp new entities uris and real new entities uri
93
+    $entities_uri_mapping = array();
94 94
 
95
-	// Save the entities coming with POST data.
96
-	if ( isset( $_POST['wl_entities'] ) && isset( $_POST['wl_boxes'] ) ) {
95
+    // Save the entities coming with POST data.
96
+    if ( isset( $_POST['wl_entities'] ) && isset( $_POST['wl_boxes'] ) ) {
97 97
 
98
-		wl_write_log( "[ post id :: $post_id ][ POST(wl_entities) :: " );
99
-		wl_write_log( json_encode( $_POST['wl_entities'] ) );
100
-		wl_write_log( "]" );
101
-		wl_write_log( "[ post id :: $post_id ][ POST(wl_boxes) :: " );
102
-		wl_write_log( json_encode( $_POST['wl_boxes'], true ) );
103
-		wl_write_log( "]" );
98
+        wl_write_log( "[ post id :: $post_id ][ POST(wl_entities) :: " );
99
+        wl_write_log( json_encode( $_POST['wl_entities'] ) );
100
+        wl_write_log( "]" );
101
+        wl_write_log( "[ post id :: $post_id ][ POST(wl_boxes) :: " );
102
+        wl_write_log( json_encode( $_POST['wl_boxes'], true ) );
103
+        wl_write_log( "]" );
104 104
 
105
-		$entities_via_post = $_POST['wl_entities'];
106
-		$boxes_via_post    = $_POST['wl_boxes'];
105
+        $entities_via_post = $_POST['wl_entities'];
106
+        $boxes_via_post    = $_POST['wl_boxes'];
107 107
 
108
-		foreach ( $entities_via_post as $entity_uri => $entity ) {
108
+        foreach ( $entities_via_post as $entity_uri => $entity ) {
109 109
 
110
-			// Only if the current entity is created from scratch let's avoid to
111
-			// create more than one entity with same label & entity type.
112
-			$entity_type = ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) ?
113
-				$entity['main_type'] : null;
110
+            // Only if the current entity is created from scratch let's avoid to
111
+            // create more than one entity with same label & entity type.
112
+            $entity_type = ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) ?
113
+                $entity['main_type'] : null;
114 114
 
115
-			// Look if current entity uri matches an internal existing entity, meaning:
116
-			// 1. when $entity_uri is an internal uri
117
-			// 2. when $entity_uri is an external uri used as sameAs of an internal entity
118
-			$ie = $entity_service->get_entity_post_by_uri( $entity_uri );
115
+            // Look if current entity uri matches an internal existing entity, meaning:
116
+            // 1. when $entity_uri is an internal uri
117
+            // 2. when $entity_uri is an external uri used as sameAs of an internal entity
118
+            $ie = $entity_service->get_entity_post_by_uri( $entity_uri );
119 119
 
120
-			// Detect the uri depending if is an existing or a new entity
121
-			$uri = ( null === $ie ) ?
122
-				Wordlift_Uri_Service::get_instance()->build_uri(
123
-					$entity['label'],
124
-					Wordlift_Entity_Service::TYPE_NAME,
125
-					$entity_type
126
-				) : wl_get_entity_uri( $ie->ID );
120
+            // Detect the uri depending if is an existing or a new entity
121
+            $uri = ( null === $ie ) ?
122
+                Wordlift_Uri_Service::get_instance()->build_uri(
123
+                    $entity['label'],
124
+                    Wordlift_Entity_Service::TYPE_NAME,
125
+                    $entity_type
126
+                ) : wl_get_entity_uri( $ie->ID );
127 127
 
128
-			wl_write_log( "Map $entity_uri on $uri" );
129
-			$entities_uri_mapping[ $entity_uri ] = $uri;
128
+            wl_write_log( "Map $entity_uri on $uri" );
129
+            $entities_uri_mapping[ $entity_uri ] = $uri;
130 130
 
131
-			// Local entities have a tmp uri with 'local-entity-' prefix
132
-			// These uris need to be rewritten here and replaced in the content
133
-			if ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) {
134
-				// Override the entity obj
135
-				$entity['uri'] = $uri;
136
-			}
131
+            // Local entities have a tmp uri with 'local-entity-' prefix
132
+            // These uris need to be rewritten here and replaced in the content
133
+            if ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) {
134
+                // Override the entity obj
135
+                $entity['uri'] = $uri;
136
+            }
137 137
 
138
-			// Update entity data with related post
139
-			$entity['related_post_id'] = $post_id;
138
+            // Update entity data with related post
139
+            $entity['related_post_id'] = $post_id;
140 140
 
141
-			// Save the entity if is a new entity
142
-			if ( null === $ie ) {
143
-				wl_save_entity( $entity );
144
-			}
141
+            // Save the entity if is a new entity
142
+            if ( null === $ie ) {
143
+                wl_save_entity( $entity );
144
+            }
145 145
 
146
-		}
146
+        }
147 147
 
148
-	}
148
+    }
149 149
 
150
-	// Replace tmp uris in content post if needed
151
-	$updated_post_content = $post->post_content;
150
+    // Replace tmp uris in content post if needed
151
+    $updated_post_content = $post->post_content;
152 152
 
153
-	// Update the post content if we found mappings of new entities.
154
-	if ( ! empty( $entities_uri_mapping ) ) {
155
-		// Save each entity and store the post id.
156
-		foreach ( $entities_uri_mapping as $tmp_uri => $uri ) {
157
-			$updated_post_content = str_replace( $tmp_uri, $uri, $updated_post_content );
158
-		}
153
+    // Update the post content if we found mappings of new entities.
154
+    if ( ! empty( $entities_uri_mapping ) ) {
155
+        // Save each entity and store the post id.
156
+        foreach ( $entities_uri_mapping as $tmp_uri => $uri ) {
157
+            $updated_post_content = str_replace( $tmp_uri, $uri, $updated_post_content );
158
+        }
159 159
 
160
-		// Update the post content.
161
-		wp_update_post( array(
162
-			'ID'           => $post->ID,
163
-			'post_content' => $updated_post_content,
164
-		) );
165
-	}
160
+        // Update the post content.
161
+        wp_update_post( array(
162
+            'ID'           => $post->ID,
163
+            'post_content' => $updated_post_content,
164
+        ) );
165
+    }
166 166
 
167
-	// Extract related/referenced entities from text.
168
-	$disambiguated_entities = wl_linked_data_content_get_embedded_entities( $updated_post_content );
167
+    // Extract related/referenced entities from text.
168
+    $disambiguated_entities = wl_linked_data_content_get_embedded_entities( $updated_post_content );
169 169
 
170
-	// Reset previously saved instances.
171
-	wl_core_delete_relation_instances( $post_id );
170
+    // Reset previously saved instances.
171
+    wl_core_delete_relation_instances( $post_id );
172 172
 
173
-	// Save relation instances
174
-	foreach ( array_unique( $disambiguated_entities ) as $referenced_entity_id ) {
173
+    // Save relation instances
174
+    foreach ( array_unique( $disambiguated_entities ) as $referenced_entity_id ) {
175 175
 
176
-		wl_core_add_relation_instance(
177
-			$post_id,
178
-			$entity_service->get_classification_scope_for( $referenced_entity_id ),
179
-			$referenced_entity_id
180
-		);
176
+        wl_core_add_relation_instance(
177
+            $post_id,
178
+            $entity_service->get_classification_scope_for( $referenced_entity_id ),
179
+            $referenced_entity_id
180
+        );
181 181
 
182
-	}
182
+    }
183 183
 
184
-	if ( isset( $_POST['wl_entities'] ) ) {
185
-		// Save post metadata if available
186
-		$metadata_via_post = ( isset( $_POST['wl_metadata'] ) ) ?
187
-			$_POST['wl_metadata'] : array();
188
-
189
-		$fields = array(
190
-			Wordlift_Schema_Service::FIELD_LOCATION_CREATED,
191
-			Wordlift_Schema_Service::FIELD_TOPIC,
192
-		);
193
-
194
-		// Unlink topic taxonomy terms
195
-		Wordlift_Topic_Taxonomy_Service::get_instance()->unlink_topic_for( $post->ID );
196
-
197
-		foreach ( $fields as $field ) {
198
-
199
-			// Delete current values
200
-			delete_post_meta( $post->ID, $field );
201
-			// Retrieve the entity uri
202
-			$uri = ( isset( $metadata_via_post[ $field ] ) ) ?
203
-				stripslashes( $metadata_via_post[ $field ] ) : '';
204
-
205
-			$entity = $entity_service->get_entity_post_by_uri( $uri );
206
-
207
-			if ( $entity ) {
208
-				add_post_meta( $post->ID, $field, $entity->ID, true );
209
-				// Set also the topic taxonomy
210
-				if ( $field === Wordlift_Schema_Service::FIELD_TOPIC ) {
211
-					Wordlift_Topic_Taxonomy_Service::get_instance()->set_topic_for( $post->ID, $entity );
212
-				}
213
-			}
214
-		}
215
-	}
216
-
217
-	// Push the post to Redlink.
218
-	Wordlift_Linked_Data_Service::get_instance()->push( $post->ID );
219
-
220
-	add_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' );
184
+    if ( isset( $_POST['wl_entities'] ) ) {
185
+        // Save post metadata if available
186
+        $metadata_via_post = ( isset( $_POST['wl_metadata'] ) ) ?
187
+            $_POST['wl_metadata'] : array();
188
+
189
+        $fields = array(
190
+            Wordlift_Schema_Service::FIELD_LOCATION_CREATED,
191
+            Wordlift_Schema_Service::FIELD_TOPIC,
192
+        );
193
+
194
+        // Unlink topic taxonomy terms
195
+        Wordlift_Topic_Taxonomy_Service::get_instance()->unlink_topic_for( $post->ID );
196
+
197
+        foreach ( $fields as $field ) {
198
+
199
+            // Delete current values
200
+            delete_post_meta( $post->ID, $field );
201
+            // Retrieve the entity uri
202
+            $uri = ( isset( $metadata_via_post[ $field ] ) ) ?
203
+                stripslashes( $metadata_via_post[ $field ] ) : '';
204
+
205
+            $entity = $entity_service->get_entity_post_by_uri( $uri );
206
+
207
+            if ( $entity ) {
208
+                add_post_meta( $post->ID, $field, $entity->ID, true );
209
+                // Set also the topic taxonomy
210
+                if ( $field === Wordlift_Schema_Service::FIELD_TOPIC ) {
211
+                    Wordlift_Topic_Taxonomy_Service::get_instance()->set_topic_for( $post->ID, $entity );
212
+                }
213
+            }
214
+        }
215
+    }
216
+
217
+    // Push the post to Redlink.
218
+    Wordlift_Linked_Data_Service::get_instance()->push( $post->ID );
219
+
220
+    add_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' );
221 221
 }
222 222
 
223 223
 add_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' );
@@ -240,203 +240,203 @@  discard block
 block discarded – undo
240 240
  */
241 241
 function wl_save_entity( $entity_data ) {
242 242
 
243
-	$log = Wordlift_Log_Service::get_logger( 'wl_save_entity' );
243
+    $log = Wordlift_Log_Service::get_logger( 'wl_save_entity' );
244 244
 
245
-	$uri = $entity_data['uri'];
246
-	/*
245
+    $uri = $entity_data['uri'];
246
+    /*
247 247
 	 * Data is coming from a $_POST, sanitize it.
248 248
 	 *
249 249
 	 * @since 3.19.4
250 250
 	 *
251 251
 	 * @see https://github.com/insideout10/wordlift-plugin/issues/841
252 252
 	 */
253
-	$label            = preg_replace( '/\xEF\xBB\xBF/', '', sanitize_text_field( $entity_data['label'] ) );
254
-	$type_uri         = $entity_data['main_type'];
255
-	$entity_types     = isset( $entity_data['type'] ) ? $entity_data['type'] : array();
256
-	$description      = $entity_data['description'];
257
-	$images           = isset( $entity_data['image'] ) ? (array) $entity_data['image'] : array();
258
-	$same_as          = isset( $entity_data['sameas'] ) ? (array) $entity_data['sameas'] : array();
259
-	$related_post_id  = isset( $entity_data['related_post_id'] ) ? $entity_data['related_post_id'] : null;
260
-	$other_properties = isset( $entity_data['properties'] ) ? $entity_data['properties'] : array();
261
-
262
-	// Get the synonyms.
263
-	$synonyms = isset( $entity_data['synonym'] ) ? $entity_data['synonym'] : array();
264
-
265
-	// Check whether an entity already exists with the provided URI.
266
-	if ( null !== $post = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( $uri ) ) {
267
-		$log->debug( "Post already exists for URI $uri." );
268
-
269
-		return $post;
270
-	}
271
-
272
-	// Prepare properties of the new entity.
273
-	$params = array(
274
-		'post_status'  => ( is_numeric( $related_post_id ) ? get_post_status( $related_post_id ) : 'draft' ),
275
-		'post_type'    => Wordlift_Entity_Service::TYPE_NAME,
276
-		'post_title'   => $label,
277
-		'post_content' => $description,
278
-		'post_excerpt' => '',
279
-		// Ensure we're using a valid slug. We're not overwriting an existing
280
-		// entity with a post_name already set, since this call is made only for
281
-		// new entities.
282
-		//
283
-		// See https://github.com/insideout10/wordlift-plugin/issues/282
284
-		'post_name'    => sanitize_title( $label ),
285
-	);
286
-
287
-	// If Yoast is installed and active, we temporary remove the save_postdata hook which causes Yoast to "pass over"
288
-	// the local SEO form values to the created entity (https://github.com/insideout10/wordlift-plugin/issues/156)
289
-	// Same thing applies to SEO Ultimate (https://github.com/insideout10/wordlift-plugin/issues/148)
290
-	// This does NOT affect saving an entity from the entity admin page since this function is called when an entity
291
-	// is created when saving a post.
292
-	global $wpseo_metabox, $seo_ultimate;
293
-	if ( isset( $wpseo_metabox ) ) {
294
-		remove_action( 'wp_insert_post', array(
295
-			$wpseo_metabox,
296
-			'save_postdata',
297
-		) );
298
-	}
299
-
300
-	if ( isset( $seo_ultimate ) ) {
301
-		remove_action( 'save_post', array(
302
-			$seo_ultimate,
303
-			'save_postmeta_box',
304
-		) );
305
-	}
306
-
307
-	// The fact that we're calling here wp_insert_post is causing issues with plugins (and ourselves too) that hook to
308
-	// save_post in order to save additional inputs from the edit page. In order to avoid issues, we pop all the hooks
309
-	// to the save_post and restore them after we saved the entity.
310
-	// see https://github.com/insideout10/wordlift-plugin/issues/203
311
-	// see https://github.com/insideout10/wordlift-plugin/issues/156
312
-	// see https://github.com/insideout10/wordlift-plugin/issues/148
313
-	global $wp_filter;
314
-	$save_post_filters = is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] : $wp_filter['save_post']->callbacks;
315
-	is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] = array() : $wp_filter['save_post']->remove_all_filters();
316
-
317
-
318
-	$log->trace( 'Going to insert new post...' );
319
-
320
-	// create or update the post.
321
-	$post_id = wp_insert_post( $params, true );
322
-
323
-	// Setting the alternative labels for this entity.
324
-	Wordlift_Entity_Service::get_instance()
325
-	                       ->set_alternative_labels( $post_id, $synonyms );
326
-
327
-	// Restore all the existing filters.
328
-	is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] = $save_post_filters : $wp_filter['save_post']->callbacks = $save_post_filters;
329
-
330
-	// If Yoast is installed and active, we restore the Yoast save_postdata hook (https://github.com/insideout10/wordlift-plugin/issues/156)
331
-	if ( isset( $wpseo_metabox ) ) {
332
-		add_action( 'wp_insert_post', array(
333
-			$wpseo_metabox,
334
-			'save_postdata',
335
-		) );
336
-	}
337
-
338
-	// If SEO Ultimate is installed, add back the hook we removed a few lines above.
339
-	if ( isset( $seo_ultimate ) ) {
340
-		add_action( 'save_post', array(
341
-			$seo_ultimate,
342
-			'save_postmeta_box',
343
-		), 10, 2 );
344
-	}
345
-
346
-	// TODO: handle errors.
347
-	if ( is_wp_error( $post_id ) ) {
348
-		$log->error( 'An error occurred: ' . $post_id->get_error_message() );
349
-
350
-		// inform an error occurred.
351
-		return null;
352
-	}
353
-
354
-	wl_set_entity_main_type( $post_id, $type_uri );
355
-
356
-	// Save the entity types.
357
-	wl_set_entity_rdf_types( $post_id, $entity_types );
358
-
359
-	// Get a dataset URI for the entity.
360
-	$wl_uri = wl_build_entity_uri( $post_id );
361
-
362
-	// Save the entity URI.
363
-	wl_set_entity_uri( $post_id, $wl_uri );
364
-
365
-	// Add the uri to the sameAs data if it's not a local URI.
366
-	if ( $wl_uri !== $uri ) {
367
-		array_push( $same_as, $uri );
368
-	}
369
-
370
-	$new_uri = wl_get_entity_uri( $post_id );
371
-
372
-	// Save the sameAs data for the entity.
373
-	wl_schema_set_value( $post_id, 'sameAs', $same_as );
374
-
375
-	// Save the other properties (latitude, langitude, startDate, endDate, etc.)
376
-	foreach ( $other_properties as $property_name => $property_value ) {
377
-		wl_schema_set_value( $post_id, $property_name, $property_value );
378
-	}
379
-
380
-	// Call hooks.
381
-	do_action( 'wl_save_entity', $post_id );
382
-
383
-	foreach ( $images as $image_remote_url ) {
384
-
385
-		// Check if image is already present in local DB
386
-		if ( strpos( $image_remote_url, site_url() ) !== false ) {
387
-			// Do nothing.
388
-			continue;
389
-		}
390
-
391
-		// Check if there is an existing attachment for this post ID and source URL.
392
-		$existing_image = wl_get_attachment_for_source_url( $post_id, $image_remote_url );
393
-
394
-		// Skip if an existing image is found.
395
-		if ( null !== $existing_image ) {
396
-			continue;
397
-		}
398
-
399
-		// Save the image and get the local path.
400
-		$image = Wordlift_Remote_Image_Service::save_from_url( $image_remote_url );
401
-
402
-		if ( false === $image ) {
403
-			continue;
404
-		}
253
+    $label            = preg_replace( '/\xEF\xBB\xBF/', '', sanitize_text_field( $entity_data['label'] ) );
254
+    $type_uri         = $entity_data['main_type'];
255
+    $entity_types     = isset( $entity_data['type'] ) ? $entity_data['type'] : array();
256
+    $description      = $entity_data['description'];
257
+    $images           = isset( $entity_data['image'] ) ? (array) $entity_data['image'] : array();
258
+    $same_as          = isset( $entity_data['sameas'] ) ? (array) $entity_data['sameas'] : array();
259
+    $related_post_id  = isset( $entity_data['related_post_id'] ) ? $entity_data['related_post_id'] : null;
260
+    $other_properties = isset( $entity_data['properties'] ) ? $entity_data['properties'] : array();
261
+
262
+    // Get the synonyms.
263
+    $synonyms = isset( $entity_data['synonym'] ) ? $entity_data['synonym'] : array();
264
+
265
+    // Check whether an entity already exists with the provided URI.
266
+    if ( null !== $post = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( $uri ) ) {
267
+        $log->debug( "Post already exists for URI $uri." );
268
+
269
+        return $post;
270
+    }
271
+
272
+    // Prepare properties of the new entity.
273
+    $params = array(
274
+        'post_status'  => ( is_numeric( $related_post_id ) ? get_post_status( $related_post_id ) : 'draft' ),
275
+        'post_type'    => Wordlift_Entity_Service::TYPE_NAME,
276
+        'post_title'   => $label,
277
+        'post_content' => $description,
278
+        'post_excerpt' => '',
279
+        // Ensure we're using a valid slug. We're not overwriting an existing
280
+        // entity with a post_name already set, since this call is made only for
281
+        // new entities.
282
+        //
283
+        // See https://github.com/insideout10/wordlift-plugin/issues/282
284
+        'post_name'    => sanitize_title( $label ),
285
+    );
286
+
287
+    // If Yoast is installed and active, we temporary remove the save_postdata hook which causes Yoast to "pass over"
288
+    // the local SEO form values to the created entity (https://github.com/insideout10/wordlift-plugin/issues/156)
289
+    // Same thing applies to SEO Ultimate (https://github.com/insideout10/wordlift-plugin/issues/148)
290
+    // This does NOT affect saving an entity from the entity admin page since this function is called when an entity
291
+    // is created when saving a post.
292
+    global $wpseo_metabox, $seo_ultimate;
293
+    if ( isset( $wpseo_metabox ) ) {
294
+        remove_action( 'wp_insert_post', array(
295
+            $wpseo_metabox,
296
+            'save_postdata',
297
+        ) );
298
+    }
299
+
300
+    if ( isset( $seo_ultimate ) ) {
301
+        remove_action( 'save_post', array(
302
+            $seo_ultimate,
303
+            'save_postmeta_box',
304
+        ) );
305
+    }
306
+
307
+    // The fact that we're calling here wp_insert_post is causing issues with plugins (and ourselves too) that hook to
308
+    // save_post in order to save additional inputs from the edit page. In order to avoid issues, we pop all the hooks
309
+    // to the save_post and restore them after we saved the entity.
310
+    // see https://github.com/insideout10/wordlift-plugin/issues/203
311
+    // see https://github.com/insideout10/wordlift-plugin/issues/156
312
+    // see https://github.com/insideout10/wordlift-plugin/issues/148
313
+    global $wp_filter;
314
+    $save_post_filters = is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] : $wp_filter['save_post']->callbacks;
315
+    is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] = array() : $wp_filter['save_post']->remove_all_filters();
316
+
317
+
318
+    $log->trace( 'Going to insert new post...' );
319
+
320
+    // create or update the post.
321
+    $post_id = wp_insert_post( $params, true );
322
+
323
+    // Setting the alternative labels for this entity.
324
+    Wordlift_Entity_Service::get_instance()
325
+                            ->set_alternative_labels( $post_id, $synonyms );
326
+
327
+    // Restore all the existing filters.
328
+    is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] = $save_post_filters : $wp_filter['save_post']->callbacks = $save_post_filters;
329
+
330
+    // If Yoast is installed and active, we restore the Yoast save_postdata hook (https://github.com/insideout10/wordlift-plugin/issues/156)
331
+    if ( isset( $wpseo_metabox ) ) {
332
+        add_action( 'wp_insert_post', array(
333
+            $wpseo_metabox,
334
+            'save_postdata',
335
+        ) );
336
+    }
337
+
338
+    // If SEO Ultimate is installed, add back the hook we removed a few lines above.
339
+    if ( isset( $seo_ultimate ) ) {
340
+        add_action( 'save_post', array(
341
+            $seo_ultimate,
342
+            'save_postmeta_box',
343
+        ), 10, 2 );
344
+    }
345
+
346
+    // TODO: handle errors.
347
+    if ( is_wp_error( $post_id ) ) {
348
+        $log->error( 'An error occurred: ' . $post_id->get_error_message() );
349
+
350
+        // inform an error occurred.
351
+        return null;
352
+    }
353
+
354
+    wl_set_entity_main_type( $post_id, $type_uri );
355
+
356
+    // Save the entity types.
357
+    wl_set_entity_rdf_types( $post_id, $entity_types );
358
+
359
+    // Get a dataset URI for the entity.
360
+    $wl_uri = wl_build_entity_uri( $post_id );
361
+
362
+    // Save the entity URI.
363
+    wl_set_entity_uri( $post_id, $wl_uri );
364
+
365
+    // Add the uri to the sameAs data if it's not a local URI.
366
+    if ( $wl_uri !== $uri ) {
367
+        array_push( $same_as, $uri );
368
+    }
369
+
370
+    $new_uri = wl_get_entity_uri( $post_id );
371
+
372
+    // Save the sameAs data for the entity.
373
+    wl_schema_set_value( $post_id, 'sameAs', $same_as );
374
+
375
+    // Save the other properties (latitude, langitude, startDate, endDate, etc.)
376
+    foreach ( $other_properties as $property_name => $property_value ) {
377
+        wl_schema_set_value( $post_id, $property_name, $property_value );
378
+    }
379
+
380
+    // Call hooks.
381
+    do_action( 'wl_save_entity', $post_id );
382
+
383
+    foreach ( $images as $image_remote_url ) {
384
+
385
+        // Check if image is already present in local DB
386
+        if ( strpos( $image_remote_url, site_url() ) !== false ) {
387
+            // Do nothing.
388
+            continue;
389
+        }
390
+
391
+        // Check if there is an existing attachment for this post ID and source URL.
392
+        $existing_image = wl_get_attachment_for_source_url( $post_id, $image_remote_url );
393
+
394
+        // Skip if an existing image is found.
395
+        if ( null !== $existing_image ) {
396
+            continue;
397
+        }
398
+
399
+        // Save the image and get the local path.
400
+        $image = Wordlift_Remote_Image_Service::save_from_url( $image_remote_url );
401
+
402
+        if ( false === $image ) {
403
+            continue;
404
+        }
405 405
 
406
-		// Get the local URL.
407
-		$filename     = $image['path'];
408
-		$url          = $image['url'];
409
-		$content_type = $image['content_type'];
406
+        // Get the local URL.
407
+        $filename     = $image['path'];
408
+        $url          = $image['url'];
409
+        $content_type = $image['content_type'];
410 410
 
411
-		$attachment = array(
412
-			'guid'           => $url,
413
-			// post_title, post_content (the value for this key should be the empty string), post_status and post_mime_type
414
-			'post_title'     => $label,
415
-			// Set the title to the post title.
416
-			'post_content'   => '',
417
-			'post_status'    => 'inherit',
418
-			'post_mime_type' => $content_type,
419
-		);
420
-
421
-		// Create the attachment in WordPress and generate the related metadata.
422
-		$attachment_id = wp_insert_attachment( $attachment, $filename, $post_id );
423
-
424
-		// Set the source URL for the image.
425
-		wl_set_source_url( $attachment_id, $image_remote_url );
411
+        $attachment = array(
412
+            'guid'           => $url,
413
+            // post_title, post_content (the value for this key should be the empty string), post_status and post_mime_type
414
+            'post_title'     => $label,
415
+            // Set the title to the post title.
416
+            'post_content'   => '',
417
+            'post_status'    => 'inherit',
418
+            'post_mime_type' => $content_type,
419
+        );
420
+
421
+        // Create the attachment in WordPress and generate the related metadata.
422
+        $attachment_id = wp_insert_attachment( $attachment, $filename, $post_id );
423
+
424
+        // Set the source URL for the image.
425
+        wl_set_source_url( $attachment_id, $image_remote_url );
426 426
 
427
-		$attachment_data = wp_generate_attachment_metadata( $attachment_id, $filename );
428
-		wp_update_attachment_metadata( $attachment_id, $attachment_data );
427
+        $attachment_data = wp_generate_attachment_metadata( $attachment_id, $filename );
428
+        wp_update_attachment_metadata( $attachment_id, $attachment_data );
429 429
 
430
-		// Set it as the featured image.
431
-		set_post_thumbnail( $post_id, $attachment_id );
432
-	}
430
+        // Set it as the featured image.
431
+        set_post_thumbnail( $post_id, $attachment_id );
432
+    }
433 433
 
434
-	// The entity is pushed to Redlink on save by the function hooked to save_post.
435
-	// save the entity in the triple store.
436
-	Wordlift_Linked_Data_Service::get_instance()->push( $post_id );
434
+    // The entity is pushed to Redlink on save by the function hooked to save_post.
435
+    // save the entity in the triple store.
436
+    Wordlift_Linked_Data_Service::get_instance()->push( $post_id );
437 437
 
438
-	// finally return the entity post.
439
-	return get_post( $post_id );
438
+    // finally return the entity post.
439
+    return get_post( $post_id );
440 440
 }
441 441
 
442 442
 /**
@@ -450,40 +450,40 @@  discard block
 block discarded – undo
450 450
  */
451 451
 function wl_linked_data_content_get_embedded_entities( $content ) {
452 452
 
453
-	// Remove quote escapes.
454
-	$content = str_replace( '\\"', '"', $content );
453
+    // Remove quote escapes.
454
+    $content = str_replace( '\\"', '"', $content );
455 455
 
456
-	// Match all itemid attributes.
457
-	$pattern = '/<\w+[^>]*\sitemid="([^"]+)"[^>]*>/im';
456
+    // Match all itemid attributes.
457
+    $pattern = '/<\w+[^>]*\sitemid="([^"]+)"[^>]*>/im';
458 458
 
459
-	//	wl_write_log( "Getting entities embedded into content [ pattern :: $pattern ]" );
459
+    //	wl_write_log( "Getting entities embedded into content [ pattern :: $pattern ]" );
460 460
 
461
-	// Remove the pattern while it is found (match nested annotations).
462
-	$matches = array();
461
+    // Remove the pattern while it is found (match nested annotations).
462
+    $matches = array();
463 463
 
464
-	// In case of errors, return an empty array.
465
-	if ( false === preg_match_all( $pattern, $content, $matches ) ) {
466
-		wl_write_log( "Found no entities embedded in content" );
464
+    // In case of errors, return an empty array.
465
+    if ( false === preg_match_all( $pattern, $content, $matches ) ) {
466
+        wl_write_log( "Found no entities embedded in content" );
467 467
 
468
-		return array();
469
-	}
468
+        return array();
469
+    }
470 470
 
471 471
 //    wl_write_log("wl_update_related_entities [ content :: $content ][ data :: " . var_export($data, true). " ][ matches :: " . var_export($matches, true) . " ]");
472 472
 
473
-	// Collect the entities.
474
-	$entities = array();
475
-	foreach ( $matches[1] as $uri ) {
476
-		$uri_d = html_entity_decode( $uri );
473
+    // Collect the entities.
474
+    $entities = array();
475
+    foreach ( $matches[1] as $uri ) {
476
+        $uri_d = html_entity_decode( $uri );
477 477
 
478
-		$entity = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( $uri_d );
478
+        $entity = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( $uri_d );
479 479
 
480
-		if ( null !== $entity ) {
481
-			array_push( $entities, $entity->ID );
482
-		}
483
-	}
480
+        if ( null !== $entity ) {
481
+            array_push( $entities, $entity->ID );
482
+        }
483
+    }
484 484
 
485
-	// $count = sizeof( $entities );
486
-	// wl_write_log( "Found $count entities embedded in content" );
485
+    // $count = sizeof( $entities );
486
+    // wl_write_log( "Found $count entities embedded in content" );
487 487
 
488
-	return $entities;
488
+    return $entities;
489 489
 }
Please login to merge, or discard this patch.
Spacing   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -14,15 +14,15 @@  discard block
 block discarded – undo
14 14
  *
15 15
  * @param int $post_id The post id.
16 16
  */
17
-function wl_linked_data_save_post( $post_id ) {
17
+function wl_linked_data_save_post($post_id) {
18 18
 
19
-	$log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post' );
19
+	$log = Wordlift_Log_Service::get_logger('wl_linked_data_save_post');
20 20
 
21
-	$log->trace( "Saving post $post_id to Linked Data..." );
21
+	$log->trace("Saving post $post_id to Linked Data...");
22 22
 
23 23
 	// If it's not numeric exit from here.
24
-	if ( ! is_numeric( $post_id ) || is_numeric( wp_is_post_revision( $post_id ) ) ) {
25
-		$log->debug( "Skipping $post_id, because id is not numeric or is a post revision." );
24
+	if ( ! is_numeric($post_id) || is_numeric(wp_is_post_revision($post_id))) {
25
+		$log->debug("Skipping $post_id, because id is not numeric or is a post revision.");
26 26
 
27 27
 		return;
28 28
 	}
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	// Get the post type and check whether it supports the editor.
31 31
 	//
32 32
 	// @see https://github.com/insideout10/wordlift-plugin/issues/659.
33
-	$post_type = get_post_type( $post_id );
33
+	$post_type = get_post_type($post_id);
34 34
 	/**
35 35
 	 * Use `wl_post_type_supports_editor` which calls a filter to allow 3rd parties to change the setting.
36 36
 	 *
@@ -38,26 +38,26 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @see https://github.com/insideout10/wordlift-plugin/issues/847.
40 40
 	 */
41
-	$is_editor_supported = wl_post_type_supports_editor( $post_type );
41
+	$is_editor_supported = wl_post_type_supports_editor($post_type);
42 42
 
43 43
 	// Bail out if it's not an entity.
44
-	if ( ! $is_editor_supported ) {
45
-		$log->debug( "Skipping $post_id, because $post_type doesn't support the editor (content)." );
44
+	if ( ! $is_editor_supported) {
45
+		$log->debug("Skipping $post_id, because $post_type doesn't support the editor (content).");
46 46
 
47 47
 		return;
48 48
 	}
49 49
 
50 50
 	// Unhook this function so it doesn't loop infinitely.
51
-	remove_action( 'save_post', 'wl_linked_data_save_post' );
51
+	remove_action('save_post', 'wl_linked_data_save_post');
52 52
 
53 53
 	// raise the *wl_linked_data_save_post* event.
54
-	do_action( 'wl_linked_data_save_post', $post_id );
54
+	do_action('wl_linked_data_save_post', $post_id);
55 55
 
56 56
 	// Re-hook this function.
57
-	add_action( 'save_post', 'wl_linked_data_save_post' );
57
+	add_action('save_post', 'wl_linked_data_save_post');
58 58
 }
59 59
 
60
-add_action( 'save_post', 'wl_linked_data_save_post' );
60
+add_action('save_post', 'wl_linked_data_save_post');
61 61
 
62 62
 /**
63 63
  * Save the post to the triple store. Also saves the entities locally and on the triple store.
@@ -66,23 +66,23 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @param int $post_id The post id being saved.
68 68
  */
69
-function wl_linked_data_save_post_and_related_entities( $post_id ) {
69
+function wl_linked_data_save_post_and_related_entities($post_id) {
70 70
 
71
-	$log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post_and_related_entities' );
71
+	$log = Wordlift_Log_Service::get_logger('wl_linked_data_save_post_and_related_entities');
72 72
 
73
-	$log->trace( "Saving $post_id to Linked Data along with related entities..." );
73
+	$log->trace("Saving $post_id to Linked Data along with related entities...");
74 74
 
75 75
 	// Ignore auto-saves
76
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
77
-		$log->trace( 'Doing autosave, skipping...' );
76
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
77
+		$log->trace('Doing autosave, skipping...');
78 78
 
79 79
 		return;
80 80
 	}
81 81
 
82 82
 	// get the current post.
83
-	$post = get_post( $post_id );
83
+	$post = get_post($post_id);
84 84
 
85
-	remove_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' );
85
+	remove_action('wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities');
86 86
 
87 87
 	// wl_write_log( "[ post id :: $post_id ][ autosave :: false ][ post type :: $post->post_type ]" );
88 88
 
@@ -93,44 +93,44 @@  discard block
 block discarded – undo
93 93
 	$entities_uri_mapping = array();
94 94
 
95 95
 	// Save the entities coming with POST data.
96
-	if ( isset( $_POST['wl_entities'] ) && isset( $_POST['wl_boxes'] ) ) {
96
+	if (isset($_POST['wl_entities']) && isset($_POST['wl_boxes'])) {
97 97
 
98
-		wl_write_log( "[ post id :: $post_id ][ POST(wl_entities) :: " );
99
-		wl_write_log( json_encode( $_POST['wl_entities'] ) );
100
-		wl_write_log( "]" );
101
-		wl_write_log( "[ post id :: $post_id ][ POST(wl_boxes) :: " );
102
-		wl_write_log( json_encode( $_POST['wl_boxes'], true ) );
103
-		wl_write_log( "]" );
98
+		wl_write_log("[ post id :: $post_id ][ POST(wl_entities) :: ");
99
+		wl_write_log(json_encode($_POST['wl_entities']));
100
+		wl_write_log("]");
101
+		wl_write_log("[ post id :: $post_id ][ POST(wl_boxes) :: ");
102
+		wl_write_log(json_encode($_POST['wl_boxes'], true));
103
+		wl_write_log("]");
104 104
 
105 105
 		$entities_via_post = $_POST['wl_entities'];
106 106
 		$boxes_via_post    = $_POST['wl_boxes'];
107 107
 
108
-		foreach ( $entities_via_post as $entity_uri => $entity ) {
108
+		foreach ($entities_via_post as $entity_uri => $entity) {
109 109
 
110 110
 			// Only if the current entity is created from scratch let's avoid to
111 111
 			// create more than one entity with same label & entity type.
112
-			$entity_type = ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) ?
112
+			$entity_type = (preg_match('/^local-entity-.+/', $entity_uri) > 0) ?
113 113
 				$entity['main_type'] : null;
114 114
 
115 115
 			// Look if current entity uri matches an internal existing entity, meaning:
116 116
 			// 1. when $entity_uri is an internal uri
117 117
 			// 2. when $entity_uri is an external uri used as sameAs of an internal entity
118
-			$ie = $entity_service->get_entity_post_by_uri( $entity_uri );
118
+			$ie = $entity_service->get_entity_post_by_uri($entity_uri);
119 119
 
120 120
 			// Detect the uri depending if is an existing or a new entity
121
-			$uri = ( null === $ie ) ?
121
+			$uri = (null === $ie) ?
122 122
 				Wordlift_Uri_Service::get_instance()->build_uri(
123 123
 					$entity['label'],
124 124
 					Wordlift_Entity_Service::TYPE_NAME,
125 125
 					$entity_type
126
-				) : wl_get_entity_uri( $ie->ID );
126
+				) : wl_get_entity_uri($ie->ID);
127 127
 
128
-			wl_write_log( "Map $entity_uri on $uri" );
129
-			$entities_uri_mapping[ $entity_uri ] = $uri;
128
+			wl_write_log("Map $entity_uri on $uri");
129
+			$entities_uri_mapping[$entity_uri] = $uri;
130 130
 
131 131
 			// Local entities have a tmp uri with 'local-entity-' prefix
132 132
 			// These uris need to be rewritten here and replaced in the content
133
-			if ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) {
133
+			if (preg_match('/^local-entity-.+/', $entity_uri) > 0) {
134 134
 				// Override the entity obj
135 135
 				$entity['uri'] = $uri;
136 136
 			}
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
 			$entity['related_post_id'] = $post_id;
140 140
 
141 141
 			// Save the entity if is a new entity
142
-			if ( null === $ie ) {
143
-				wl_save_entity( $entity );
142
+			if (null === $ie) {
143
+				wl_save_entity($entity);
144 144
 			}
145 145
 
146 146
 		}
@@ -151,39 +151,39 @@  discard block
 block discarded – undo
151 151
 	$updated_post_content = $post->post_content;
152 152
 
153 153
 	// Update the post content if we found mappings of new entities.
154
-	if ( ! empty( $entities_uri_mapping ) ) {
154
+	if ( ! empty($entities_uri_mapping)) {
155 155
 		// Save each entity and store the post id.
156
-		foreach ( $entities_uri_mapping as $tmp_uri => $uri ) {
157
-			$updated_post_content = str_replace( $tmp_uri, $uri, $updated_post_content );
156
+		foreach ($entities_uri_mapping as $tmp_uri => $uri) {
157
+			$updated_post_content = str_replace($tmp_uri, $uri, $updated_post_content);
158 158
 		}
159 159
 
160 160
 		// Update the post content.
161
-		wp_update_post( array(
161
+		wp_update_post(array(
162 162
 			'ID'           => $post->ID,
163 163
 			'post_content' => $updated_post_content,
164
-		) );
164
+		));
165 165
 	}
166 166
 
167 167
 	// Extract related/referenced entities from text.
168
-	$disambiguated_entities = wl_linked_data_content_get_embedded_entities( $updated_post_content );
168
+	$disambiguated_entities = wl_linked_data_content_get_embedded_entities($updated_post_content);
169 169
 
170 170
 	// Reset previously saved instances.
171
-	wl_core_delete_relation_instances( $post_id );
171
+	wl_core_delete_relation_instances($post_id);
172 172
 
173 173
 	// Save relation instances
174
-	foreach ( array_unique( $disambiguated_entities ) as $referenced_entity_id ) {
174
+	foreach (array_unique($disambiguated_entities) as $referenced_entity_id) {
175 175
 
176 176
 		wl_core_add_relation_instance(
177 177
 			$post_id,
178
-			$entity_service->get_classification_scope_for( $referenced_entity_id ),
178
+			$entity_service->get_classification_scope_for($referenced_entity_id),
179 179
 			$referenced_entity_id
180 180
 		);
181 181
 
182 182
 	}
183 183
 
184
-	if ( isset( $_POST['wl_entities'] ) ) {
184
+	if (isset($_POST['wl_entities'])) {
185 185
 		// Save post metadata if available
186
-		$metadata_via_post = ( isset( $_POST['wl_metadata'] ) ) ?
186
+		$metadata_via_post = (isset($_POST['wl_metadata'])) ?
187 187
 			$_POST['wl_metadata'] : array();
188 188
 
189 189
 		$fields = array(
@@ -192,35 +192,35 @@  discard block
 block discarded – undo
192 192
 		);
193 193
 
194 194
 		// Unlink topic taxonomy terms
195
-		Wordlift_Topic_Taxonomy_Service::get_instance()->unlink_topic_for( $post->ID );
195
+		Wordlift_Topic_Taxonomy_Service::get_instance()->unlink_topic_for($post->ID);
196 196
 
197
-		foreach ( $fields as $field ) {
197
+		foreach ($fields as $field) {
198 198
 
199 199
 			// Delete current values
200
-			delete_post_meta( $post->ID, $field );
200
+			delete_post_meta($post->ID, $field);
201 201
 			// Retrieve the entity uri
202
-			$uri = ( isset( $metadata_via_post[ $field ] ) ) ?
203
-				stripslashes( $metadata_via_post[ $field ] ) : '';
202
+			$uri = (isset($metadata_via_post[$field])) ?
203
+				stripslashes($metadata_via_post[$field]) : '';
204 204
 
205
-			$entity = $entity_service->get_entity_post_by_uri( $uri );
205
+			$entity = $entity_service->get_entity_post_by_uri($uri);
206 206
 
207
-			if ( $entity ) {
208
-				add_post_meta( $post->ID, $field, $entity->ID, true );
207
+			if ($entity) {
208
+				add_post_meta($post->ID, $field, $entity->ID, true);
209 209
 				// Set also the topic taxonomy
210
-				if ( $field === Wordlift_Schema_Service::FIELD_TOPIC ) {
211
-					Wordlift_Topic_Taxonomy_Service::get_instance()->set_topic_for( $post->ID, $entity );
210
+				if ($field === Wordlift_Schema_Service::FIELD_TOPIC) {
211
+					Wordlift_Topic_Taxonomy_Service::get_instance()->set_topic_for($post->ID, $entity);
212 212
 				}
213 213
 			}
214 214
 		}
215 215
 	}
216 216
 
217 217
 	// Push the post to Redlink.
218
-	Wordlift_Linked_Data_Service::get_instance()->push( $post->ID );
218
+	Wordlift_Linked_Data_Service::get_instance()->push($post->ID);
219 219
 
220
-	add_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' );
220
+	add_action('wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities');
221 221
 }
222 222
 
223
-add_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' );
223
+add_action('wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities');
224 224
 
225 225
 /**
226 226
  * Save the specified data as an entity in WordPress. This method only create new entities. When an existing entity is
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
  *
239 239
  * @return null|WP_Post A post instance or null in case of failure.
240 240
  */
241
-function wl_save_entity( $entity_data ) {
241
+function wl_save_entity($entity_data) {
242 242
 
243
-	$log = Wordlift_Log_Service::get_logger( 'wl_save_entity' );
243
+	$log = Wordlift_Log_Service::get_logger('wl_save_entity');
244 244
 
245 245
 	$uri = $entity_data['uri'];
246 246
 	/*
@@ -250,28 +250,28 @@  discard block
 block discarded – undo
250 250
 	 *
251 251
 	 * @see https://github.com/insideout10/wordlift-plugin/issues/841
252 252
 	 */
253
-	$label            = preg_replace( '/\xEF\xBB\xBF/', '', sanitize_text_field( $entity_data['label'] ) );
253
+	$label            = preg_replace('/\xEF\xBB\xBF/', '', sanitize_text_field($entity_data['label']));
254 254
 	$type_uri         = $entity_data['main_type'];
255
-	$entity_types     = isset( $entity_data['type'] ) ? $entity_data['type'] : array();
255
+	$entity_types     = isset($entity_data['type']) ? $entity_data['type'] : array();
256 256
 	$description      = $entity_data['description'];
257
-	$images           = isset( $entity_data['image'] ) ? (array) $entity_data['image'] : array();
258
-	$same_as          = isset( $entity_data['sameas'] ) ? (array) $entity_data['sameas'] : array();
259
-	$related_post_id  = isset( $entity_data['related_post_id'] ) ? $entity_data['related_post_id'] : null;
260
-	$other_properties = isset( $entity_data['properties'] ) ? $entity_data['properties'] : array();
257
+	$images           = isset($entity_data['image']) ? (array) $entity_data['image'] : array();
258
+	$same_as          = isset($entity_data['sameas']) ? (array) $entity_data['sameas'] : array();
259
+	$related_post_id  = isset($entity_data['related_post_id']) ? $entity_data['related_post_id'] : null;
260
+	$other_properties = isset($entity_data['properties']) ? $entity_data['properties'] : array();
261 261
 
262 262
 	// Get the synonyms.
263
-	$synonyms = isset( $entity_data['synonym'] ) ? $entity_data['synonym'] : array();
263
+	$synonyms = isset($entity_data['synonym']) ? $entity_data['synonym'] : array();
264 264
 
265 265
 	// Check whether an entity already exists with the provided URI.
266
-	if ( null !== $post = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( $uri ) ) {
267
-		$log->debug( "Post already exists for URI $uri." );
266
+	if (null !== $post = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri($uri)) {
267
+		$log->debug("Post already exists for URI $uri.");
268 268
 
269 269
 		return $post;
270 270
 	}
271 271
 
272 272
 	// Prepare properties of the new entity.
273 273
 	$params = array(
274
-		'post_status'  => ( is_numeric( $related_post_id ) ? get_post_status( $related_post_id ) : 'draft' ),
274
+		'post_status'  => (is_numeric($related_post_id) ? get_post_status($related_post_id) : 'draft'),
275 275
 		'post_type'    => Wordlift_Entity_Service::TYPE_NAME,
276 276
 		'post_title'   => $label,
277 277
 		'post_content' => $description,
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 		// new entities.
282 282
 		//
283 283
 		// See https://github.com/insideout10/wordlift-plugin/issues/282
284
-		'post_name'    => sanitize_title( $label ),
284
+		'post_name'    => sanitize_title($label),
285 285
 	);
286 286
 
287 287
 	// If Yoast is installed and active, we temporary remove the save_postdata hook which causes Yoast to "pass over"
@@ -290,18 +290,18 @@  discard block
 block discarded – undo
290 290
 	// This does NOT affect saving an entity from the entity admin page since this function is called when an entity
291 291
 	// is created when saving a post.
292 292
 	global $wpseo_metabox, $seo_ultimate;
293
-	if ( isset( $wpseo_metabox ) ) {
294
-		remove_action( 'wp_insert_post', array(
293
+	if (isset($wpseo_metabox)) {
294
+		remove_action('wp_insert_post', array(
295 295
 			$wpseo_metabox,
296 296
 			'save_postdata',
297
-		) );
297
+		));
298 298
 	}
299 299
 
300
-	if ( isset( $seo_ultimate ) ) {
301
-		remove_action( 'save_post', array(
300
+	if (isset($seo_ultimate)) {
301
+		remove_action('save_post', array(
302 302
 			$seo_ultimate,
303 303
 			'save_postmeta_box',
304
-		) );
304
+		));
305 305
 	}
306 306
 
307 307
 	// The fact that we're calling here wp_insert_post is causing issues with plugins (and ourselves too) that hook to
@@ -311,95 +311,95 @@  discard block
 block discarded – undo
311 311
 	// see https://github.com/insideout10/wordlift-plugin/issues/156
312 312
 	// see https://github.com/insideout10/wordlift-plugin/issues/148
313 313
 	global $wp_filter;
314
-	$save_post_filters = is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] : $wp_filter['save_post']->callbacks;
315
-	is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] = array() : $wp_filter['save_post']->remove_all_filters();
314
+	$save_post_filters = is_array($wp_filter['save_post']) ? $wp_filter['save_post'] : $wp_filter['save_post']->callbacks;
315
+	is_array($wp_filter['save_post']) ? $wp_filter['save_post'] = array() : $wp_filter['save_post']->remove_all_filters();
316 316
 
317 317
 
318
-	$log->trace( 'Going to insert new post...' );
318
+	$log->trace('Going to insert new post...');
319 319
 
320 320
 	// create or update the post.
321
-	$post_id = wp_insert_post( $params, true );
321
+	$post_id = wp_insert_post($params, true);
322 322
 
323 323
 	// Setting the alternative labels for this entity.
324 324
 	Wordlift_Entity_Service::get_instance()
325
-	                       ->set_alternative_labels( $post_id, $synonyms );
325
+	                       ->set_alternative_labels($post_id, $synonyms);
326 326
 
327 327
 	// Restore all the existing filters.
328
-	is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] = $save_post_filters : $wp_filter['save_post']->callbacks = $save_post_filters;
328
+	is_array($wp_filter['save_post']) ? $wp_filter['save_post'] = $save_post_filters : $wp_filter['save_post']->callbacks = $save_post_filters;
329 329
 
330 330
 	// If Yoast is installed and active, we restore the Yoast save_postdata hook (https://github.com/insideout10/wordlift-plugin/issues/156)
331
-	if ( isset( $wpseo_metabox ) ) {
332
-		add_action( 'wp_insert_post', array(
331
+	if (isset($wpseo_metabox)) {
332
+		add_action('wp_insert_post', array(
333 333
 			$wpseo_metabox,
334 334
 			'save_postdata',
335
-		) );
335
+		));
336 336
 	}
337 337
 
338 338
 	// If SEO Ultimate is installed, add back the hook we removed a few lines above.
339
-	if ( isset( $seo_ultimate ) ) {
340
-		add_action( 'save_post', array(
339
+	if (isset($seo_ultimate)) {
340
+		add_action('save_post', array(
341 341
 			$seo_ultimate,
342 342
 			'save_postmeta_box',
343
-		), 10, 2 );
343
+		), 10, 2);
344 344
 	}
345 345
 
346 346
 	// TODO: handle errors.
347
-	if ( is_wp_error( $post_id ) ) {
348
-		$log->error( 'An error occurred: ' . $post_id->get_error_message() );
347
+	if (is_wp_error($post_id)) {
348
+		$log->error('An error occurred: '.$post_id->get_error_message());
349 349
 
350 350
 		// inform an error occurred.
351 351
 		return null;
352 352
 	}
353 353
 
354
-	wl_set_entity_main_type( $post_id, $type_uri );
354
+	wl_set_entity_main_type($post_id, $type_uri);
355 355
 
356 356
 	// Save the entity types.
357
-	wl_set_entity_rdf_types( $post_id, $entity_types );
357
+	wl_set_entity_rdf_types($post_id, $entity_types);
358 358
 
359 359
 	// Get a dataset URI for the entity.
360
-	$wl_uri = wl_build_entity_uri( $post_id );
360
+	$wl_uri = wl_build_entity_uri($post_id);
361 361
 
362 362
 	// Save the entity URI.
363
-	wl_set_entity_uri( $post_id, $wl_uri );
363
+	wl_set_entity_uri($post_id, $wl_uri);
364 364
 
365 365
 	// Add the uri to the sameAs data if it's not a local URI.
366
-	if ( $wl_uri !== $uri ) {
367
-		array_push( $same_as, $uri );
366
+	if ($wl_uri !== $uri) {
367
+		array_push($same_as, $uri);
368 368
 	}
369 369
 
370
-	$new_uri = wl_get_entity_uri( $post_id );
370
+	$new_uri = wl_get_entity_uri($post_id);
371 371
 
372 372
 	// Save the sameAs data for the entity.
373
-	wl_schema_set_value( $post_id, 'sameAs', $same_as );
373
+	wl_schema_set_value($post_id, 'sameAs', $same_as);
374 374
 
375 375
 	// Save the other properties (latitude, langitude, startDate, endDate, etc.)
376
-	foreach ( $other_properties as $property_name => $property_value ) {
377
-		wl_schema_set_value( $post_id, $property_name, $property_value );
376
+	foreach ($other_properties as $property_name => $property_value) {
377
+		wl_schema_set_value($post_id, $property_name, $property_value);
378 378
 	}
379 379
 
380 380
 	// Call hooks.
381
-	do_action( 'wl_save_entity', $post_id );
381
+	do_action('wl_save_entity', $post_id);
382 382
 
383
-	foreach ( $images as $image_remote_url ) {
383
+	foreach ($images as $image_remote_url) {
384 384
 
385 385
 		// Check if image is already present in local DB
386
-		if ( strpos( $image_remote_url, site_url() ) !== false ) {
386
+		if (strpos($image_remote_url, site_url()) !== false) {
387 387
 			// Do nothing.
388 388
 			continue;
389 389
 		}
390 390
 
391 391
 		// Check if there is an existing attachment for this post ID and source URL.
392
-		$existing_image = wl_get_attachment_for_source_url( $post_id, $image_remote_url );
392
+		$existing_image = wl_get_attachment_for_source_url($post_id, $image_remote_url);
393 393
 
394 394
 		// Skip if an existing image is found.
395
-		if ( null !== $existing_image ) {
395
+		if (null !== $existing_image) {
396 396
 			continue;
397 397
 		}
398 398
 
399 399
 		// Save the image and get the local path.
400
-		$image = Wordlift_Remote_Image_Service::save_from_url( $image_remote_url );
400
+		$image = Wordlift_Remote_Image_Service::save_from_url($image_remote_url);
401 401
 
402
-		if ( false === $image ) {
402
+		if (false === $image) {
403 403
 			continue;
404 404
 		}
405 405
 
@@ -419,24 +419,24 @@  discard block
 block discarded – undo
419 419
 		);
420 420
 
421 421
 		// Create the attachment in WordPress and generate the related metadata.
422
-		$attachment_id = wp_insert_attachment( $attachment, $filename, $post_id );
422
+		$attachment_id = wp_insert_attachment($attachment, $filename, $post_id);
423 423
 
424 424
 		// Set the source URL for the image.
425
-		wl_set_source_url( $attachment_id, $image_remote_url );
425
+		wl_set_source_url($attachment_id, $image_remote_url);
426 426
 
427
-		$attachment_data = wp_generate_attachment_metadata( $attachment_id, $filename );
428
-		wp_update_attachment_metadata( $attachment_id, $attachment_data );
427
+		$attachment_data = wp_generate_attachment_metadata($attachment_id, $filename);
428
+		wp_update_attachment_metadata($attachment_id, $attachment_data);
429 429
 
430 430
 		// Set it as the featured image.
431
-		set_post_thumbnail( $post_id, $attachment_id );
431
+		set_post_thumbnail($post_id, $attachment_id);
432 432
 	}
433 433
 
434 434
 	// The entity is pushed to Redlink on save by the function hooked to save_post.
435 435
 	// save the entity in the triple store.
436
-	Wordlift_Linked_Data_Service::get_instance()->push( $post_id );
436
+	Wordlift_Linked_Data_Service::get_instance()->push($post_id);
437 437
 
438 438
 	// finally return the entity post.
439
-	return get_post( $post_id );
439
+	return get_post($post_id);
440 440
 }
441 441
 
442 442
 /**
@@ -448,10 +448,10 @@  discard block
 block discarded – undo
448 448
  *
449 449
  * @return array An array of entity posts.
450 450
  */
451
-function wl_linked_data_content_get_embedded_entities( $content ) {
451
+function wl_linked_data_content_get_embedded_entities($content) {
452 452
 
453 453
 	// Remove quote escapes.
454
-	$content = str_replace( '\\"', '"', $content );
454
+	$content = str_replace('\\"', '"', $content);
455 455
 
456 456
 	// Match all itemid attributes.
457 457
 	$pattern = '/<\w+[^>]*\sitemid="([^"]+)"[^>]*>/im';
@@ -462,8 +462,8 @@  discard block
 block discarded – undo
462 462
 	$matches = array();
463 463
 
464 464
 	// In case of errors, return an empty array.
465
-	if ( false === preg_match_all( $pattern, $content, $matches ) ) {
466
-		wl_write_log( "Found no entities embedded in content" );
465
+	if (false === preg_match_all($pattern, $content, $matches)) {
466
+		wl_write_log("Found no entities embedded in content");
467 467
 
468 468
 		return array();
469 469
 	}
@@ -472,13 +472,13 @@  discard block
 block discarded – undo
472 472
 
473 473
 	// Collect the entities.
474 474
 	$entities = array();
475
-	foreach ( $matches[1] as $uri ) {
476
-		$uri_d = html_entity_decode( $uri );
475
+	foreach ($matches[1] as $uri) {
476
+		$uri_d = html_entity_decode($uri);
477 477
 
478
-		$entity = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( $uri_d );
478
+		$entity = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri($uri_d);
479 479
 
480
-		if ( null !== $entity ) {
481
-			array_push( $entities, $entity->ID );
480
+		if (null !== $entity) {
481
+			array_push($entities, $entity->ID);
482 482
 		}
483 483
 	}
484 484
 
Please login to merge, or discard this patch.
src/admin/wordlift_admin_meta_box_entities.php 2 patches
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -10,15 +10,15 @@  discard block
 block discarded – undo
10 10
  */
11 11
 function wl_register_metaboxes() {
12 12
 
13
-	// Load metabox classes.
14
-	require_once( 'WL_Metabox/class-wl-metabox.php' );
13
+    // Load metabox classes.
14
+    require_once( 'WL_Metabox/class-wl-metabox.php' );
15 15
 
16
-	$wl_metabox = new WL_Metabox();     // Everything is done inside here with the correct timing.
16
+    $wl_metabox = new WL_Metabox();     // Everything is done inside here with the correct timing.
17 17
 }
18 18
 
19 19
 if ( is_admin() ) {
20
-	add_action( 'load-post.php', 'wl_register_metaboxes' );
21
-	add_action( 'load-post-new.php', 'wl_register_metaboxes' );
20
+    add_action( 'load-post.php', 'wl_register_metaboxes' );
21
+    add_action( 'load-post-new.php', 'wl_register_metaboxes' );
22 22
 }
23 23
 
24 24
 
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
  */
30 30
 function wl_admin_add_entities_meta_box( $post_type ) {
31 31
 
32
-	// Bail out if the post type doesn't support a TinyMCE editor.
33
-	if ( ! wl_post_type_supports_editor( $post_type ) ) {
34
-		return;
35
-	}
32
+    // Bail out if the post type doesn't support a TinyMCE editor.
33
+    if ( ! wl_post_type_supports_editor( $post_type ) ) {
34
+        return;
35
+    }
36 36
 
37
-	// Add main meta box for related entities and 4W.
38
-	add_meta_box(
39
-		'wordlift_entities_box', __( 'WordLift', 'wordlift' ), 'wl_entities_box_content', $post_type, 'side', 'high'
40
-	);
37
+    // Add main meta box for related entities and 4W.
38
+    add_meta_box(
39
+        'wordlift_entities_box', __( 'WordLift', 'wordlift' ), 'wl_entities_box_content', $post_type, 'side', 'high'
40
+    );
41 41
 }
42 42
 
43 43
 add_action( 'add_meta_boxes', 'wl_admin_add_entities_meta_box' );
@@ -53,18 +53,18 @@  discard block
 block discarded – undo
53 53
  */
54 54
 function wl_post_type_supports_editor( $post_type ) {
55 55
 
56
-	$default = post_type_supports( $post_type, 'editor' );
57
-
58
-	/**
59
-	 * Allow 3rd parties to force the classification to load.
60
-	 *
61
-	 * @since 3.19.4
62
-	 *
63
-	 * @see https://github.com/insideout10/wordlift-plugin/issues/847.
64
-	 *
65
-	 * @param bool $default The preset value as gathered by the `post_type_supports` call.
66
-	 */
67
-	return apply_filters( 'wl_post_type_supports_editor', $default, $post_type );
56
+    $default = post_type_supports( $post_type, 'editor' );
57
+
58
+    /**
59
+     * Allow 3rd parties to force the classification to load.
60
+     *
61
+     * @since 3.19.4
62
+     *
63
+     * @see https://github.com/insideout10/wordlift-plugin/issues/847.
64
+     *
65
+     * @param bool $default The preset value as gathered by the `post_type_supports` call.
66
+     */
67
+    return apply_filters( 'wl_post_type_supports_editor', $default, $post_type );
68 68
 }
69 69
 
70 70
 /**
@@ -74,94 +74,94 @@  discard block
 block discarded – undo
74 74
  */
75 75
 function wl_entities_box_content( $post ) {
76 76
 
77
-	// Angularjs edit-post widget wrapper.
78
-	echo '<div id="wordlift-edit-post-outer-wrapper"></div>';
79
-
80
-	// Angularjs edit-post widget classification boxes configuration.
81
-	$classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES );
82
-
83
-	// Array to store all related entities ids.
84
-	$all_referenced_entities_ids = array();
85
-
86
-	// Add selected entities to classification_boxes.
87
-	foreach ( $classification_boxes as $i => $box ) {
88
-		// Build the proper relation name.
89
-		$relation_name = $box['id'];
90
-
91
-		// Get the entity referenced from the post content.
92
-		$entity_uris = Wordlift_Content_Filter_Service::get_instance()->get_entity_uris( $post->post_content );
93
-
94
-		// Enhance current box selected entities.
95
-		$classification_boxes[ $i ]['selectedEntities'] = $entity_uris;
96
-
97
-		// Maps the URIs to entity posts.
98
-		$entity_service = Wordlift_Entity_Service::get_instance();
99
-
100
-		// Replace all entity URI's with post ID's if found or null if there is no related post.
101
-		$entity_ids = array_map( function ( $item ) use ( $entity_service ) {
102
-			// Return entity post by the entity URI or null.
103
-			$post = $entity_service->get_entity_post_by_uri( $item );
104
-
105
-			// Check that the post object is not null.
106
-			if ( ! empty( $post ) ) {
107
-				return $post->ID;
108
-			}
109
-		}, $entity_uris );
110
-		// Store the entity ids for all the 4W.
111
-		$all_referenced_entities_ids = array_merge( $all_referenced_entities_ids, $entity_ids );
112
-
113
-	}
114
-	// Json encoding for classification boxes structure.
115
-	$classification_boxes = wp_json_encode( $classification_boxes );
116
-
117
-	// Ensure there are no repetitions of the referenced entities.
118
-	$all_referenced_entities_ids = array_unique( $all_referenced_entities_ids );
119
-
120
-	// Remove all null, false and empty strings.
121
-	// NULL is being returned in some cases, when there is not related post, so we need to remove it.
122
-	$all_referenced_entities_ids = array_filter( $all_referenced_entities_ids );
123
-
124
-	// Build the entity storage object.
125
-	$referenced_entities_obj = array();
126
-	foreach ( $all_referenced_entities_ids as $referenced_entity ) {
127
-		$entity = wl_serialize_entity( $referenced_entity );
128
-		// Set a default confidence of `PHP_INT_MAX` for already annotated entities.
129
-		$referenced_entities_obj[ $entity['id'] ] = $entity
130
-													+ array( 'confidence' => PHP_INT_MAX );
131
-	}
132
-
133
-	$referenced_entities_obj = empty( $referenced_entities_obj ) ?
134
-		'{}' : wp_json_encode( $referenced_entities_obj );
135
-
136
-	$published_place_id  = get_post_meta(
137
-		$post->ID, Wordlift_Schema_Service::FIELD_LOCATION_CREATED, true
138
-	);
139
-	$published_place_obj = ( $published_place_id ) ?
140
-		wp_json_encode( wl_serialize_entity( $published_place_id ) ) :
141
-		'undefined';
142
-
143
-	$topic_id  = get_post_meta(
144
-		$post->ID, Wordlift_Schema_Service::FIELD_TOPIC, true
145
-	);
146
-	$topic_obj = ( $topic_id ) ?
147
-		wp_json_encode( wl_serialize_entity( $topic_id ) ) :
148
-		'undefined';
149
-
150
-	$configuration_service = Wordlift_Configuration_Service::get_instance();
151
-
152
-	$default_thumbnail_path = WL_DEFAULT_THUMBNAIL_PATH;
153
-	$default_path           = WL_DEFAULT_PATH;
154
-	$dataset_uri            = $configuration_service->get_dataset_uri();
155
-	$current_post_uri       = wl_get_entity_uri( $post->ID );
156
-
157
-	// Retrieve the current post author.
158
-	$post_author = get_userdata( $post->post_author )->display_name;
159
-	// Retrive the published date.
160
-	$published_date = get_the_time( 'Y-m-d', $post->ID );
161
-	// Current language.
162
-	$current_language = $configuration_service->get_language_code();
163
-
164
-	echo <<<EOF
77
+    // Angularjs edit-post widget wrapper.
78
+    echo '<div id="wordlift-edit-post-outer-wrapper"></div>';
79
+
80
+    // Angularjs edit-post widget classification boxes configuration.
81
+    $classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES );
82
+
83
+    // Array to store all related entities ids.
84
+    $all_referenced_entities_ids = array();
85
+
86
+    // Add selected entities to classification_boxes.
87
+    foreach ( $classification_boxes as $i => $box ) {
88
+        // Build the proper relation name.
89
+        $relation_name = $box['id'];
90
+
91
+        // Get the entity referenced from the post content.
92
+        $entity_uris = Wordlift_Content_Filter_Service::get_instance()->get_entity_uris( $post->post_content );
93
+
94
+        // Enhance current box selected entities.
95
+        $classification_boxes[ $i ]['selectedEntities'] = $entity_uris;
96
+
97
+        // Maps the URIs to entity posts.
98
+        $entity_service = Wordlift_Entity_Service::get_instance();
99
+
100
+        // Replace all entity URI's with post ID's if found or null if there is no related post.
101
+        $entity_ids = array_map( function ( $item ) use ( $entity_service ) {
102
+            // Return entity post by the entity URI or null.
103
+            $post = $entity_service->get_entity_post_by_uri( $item );
104
+
105
+            // Check that the post object is not null.
106
+            if ( ! empty( $post ) ) {
107
+                return $post->ID;
108
+            }
109
+        }, $entity_uris );
110
+        // Store the entity ids for all the 4W.
111
+        $all_referenced_entities_ids = array_merge( $all_referenced_entities_ids, $entity_ids );
112
+
113
+    }
114
+    // Json encoding for classification boxes structure.
115
+    $classification_boxes = wp_json_encode( $classification_boxes );
116
+
117
+    // Ensure there are no repetitions of the referenced entities.
118
+    $all_referenced_entities_ids = array_unique( $all_referenced_entities_ids );
119
+
120
+    // Remove all null, false and empty strings.
121
+    // NULL is being returned in some cases, when there is not related post, so we need to remove it.
122
+    $all_referenced_entities_ids = array_filter( $all_referenced_entities_ids );
123
+
124
+    // Build the entity storage object.
125
+    $referenced_entities_obj = array();
126
+    foreach ( $all_referenced_entities_ids as $referenced_entity ) {
127
+        $entity = wl_serialize_entity( $referenced_entity );
128
+        // Set a default confidence of `PHP_INT_MAX` for already annotated entities.
129
+        $referenced_entities_obj[ $entity['id'] ] = $entity
130
+                                                    + array( 'confidence' => PHP_INT_MAX );
131
+    }
132
+
133
+    $referenced_entities_obj = empty( $referenced_entities_obj ) ?
134
+        '{}' : wp_json_encode( $referenced_entities_obj );
135
+
136
+    $published_place_id  = get_post_meta(
137
+        $post->ID, Wordlift_Schema_Service::FIELD_LOCATION_CREATED, true
138
+    );
139
+    $published_place_obj = ( $published_place_id ) ?
140
+        wp_json_encode( wl_serialize_entity( $published_place_id ) ) :
141
+        'undefined';
142
+
143
+    $topic_id  = get_post_meta(
144
+        $post->ID, Wordlift_Schema_Service::FIELD_TOPIC, true
145
+    );
146
+    $topic_obj = ( $topic_id ) ?
147
+        wp_json_encode( wl_serialize_entity( $topic_id ) ) :
148
+        'undefined';
149
+
150
+    $configuration_service = Wordlift_Configuration_Service::get_instance();
151
+
152
+    $default_thumbnail_path = WL_DEFAULT_THUMBNAIL_PATH;
153
+    $default_path           = WL_DEFAULT_PATH;
154
+    $dataset_uri            = $configuration_service->get_dataset_uri();
155
+    $current_post_uri       = wl_get_entity_uri( $post->ID );
156
+
157
+    // Retrieve the current post author.
158
+    $post_author = get_userdata( $post->post_author )->display_name;
159
+    // Retrive the published date.
160
+    $published_date = get_the_time( 'Y-m-d', $post->ID );
161
+    // Current language.
162
+    $current_language = $configuration_service->get_language_code();
163
+
164
+    echo <<<EOF
165 165
 	<script type="text/javascript">
166 166
 		jQuery( function() {
167 167
 
Please login to merge, or discard this patch.
Spacing   +38 added lines, -40 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@  discard block
 block discarded – undo
11 11
 function wl_register_metaboxes() {
12 12
 
13 13
 	// Load metabox classes.
14
-	require_once( 'WL_Metabox/class-wl-metabox.php' );
14
+	require_once('WL_Metabox/class-wl-metabox.php');
15 15
 
16
-	$wl_metabox = new WL_Metabox();     // Everything is done inside here with the correct timing.
16
+	$wl_metabox = new WL_Metabox(); // Everything is done inside here with the correct timing.
17 17
 }
18 18
 
19
-if ( is_admin() ) {
20
-	add_action( 'load-post.php', 'wl_register_metaboxes' );
21
-	add_action( 'load-post-new.php', 'wl_register_metaboxes' );
19
+if (is_admin()) {
20
+	add_action('load-post.php', 'wl_register_metaboxes');
21
+	add_action('load-post-new.php', 'wl_register_metaboxes');
22 22
 }
23 23
 
24 24
 
@@ -27,20 +27,20 @@  discard block
 block discarded – undo
27 27
  *
28 28
  * @param string $post_type The type of the current open post.
29 29
  */
30
-function wl_admin_add_entities_meta_box( $post_type ) {
30
+function wl_admin_add_entities_meta_box($post_type) {
31 31
 
32 32
 	// Bail out if the post type doesn't support a TinyMCE editor.
33
-	if ( ! wl_post_type_supports_editor( $post_type ) ) {
33
+	if ( ! wl_post_type_supports_editor($post_type)) {
34 34
 		return;
35 35
 	}
36 36
 
37 37
 	// Add main meta box for related entities and 4W.
38 38
 	add_meta_box(
39
-		'wordlift_entities_box', __( 'WordLift', 'wordlift' ), 'wl_entities_box_content', $post_type, 'side', 'high'
39
+		'wordlift_entities_box', __('WordLift', 'wordlift'), 'wl_entities_box_content', $post_type, 'side', 'high'
40 40
 	);
41 41
 }
42 42
 
43
-add_action( 'add_meta_boxes', 'wl_admin_add_entities_meta_box' );
43
+add_action('add_meta_boxes', 'wl_admin_add_entities_meta_box');
44 44
 
45 45
 /**
46 46
  * Whether the post type supports the editor UI.
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
  *
52 52
  * @return bool True if the editor UI is supported otherwise false.
53 53
  */
54
-function wl_post_type_supports_editor( $post_type ) {
54
+function wl_post_type_supports_editor($post_type) {
55 55
 
56
-	$default = post_type_supports( $post_type, 'editor' );
56
+	$default = post_type_supports($post_type, 'editor');
57 57
 
58 58
 	/**
59 59
 	 * Allow 3rd parties to force the classification to load.
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @param bool $default The preset value as gathered by the `post_type_supports` call.
66 66
 	 */
67
-	return apply_filters( 'wl_post_type_supports_editor', $default, $post_type );
67
+	return apply_filters('wl_post_type_supports_editor', $default, $post_type);
68 68
 }
69 69
 
70 70
 /**
@@ -72,92 +72,90 @@  discard block
 block discarded – undo
72 72
  *
73 73
  * @param WP_Post $post The current post.
74 74
  */
75
-function wl_entities_box_content( $post ) {
75
+function wl_entities_box_content($post) {
76 76
 
77 77
 	// Angularjs edit-post widget wrapper.
78 78
 	echo '<div id="wordlift-edit-post-outer-wrapper"></div>';
79 79
 
80 80
 	// Angularjs edit-post widget classification boxes configuration.
81
-	$classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES );
81
+	$classification_boxes = unserialize(WL_CORE_POST_CLASSIFICATION_BOXES);
82 82
 
83 83
 	// Array to store all related entities ids.
84 84
 	$all_referenced_entities_ids = array();
85 85
 
86 86
 	// Add selected entities to classification_boxes.
87
-	foreach ( $classification_boxes as $i => $box ) {
87
+	foreach ($classification_boxes as $i => $box) {
88 88
 		// Build the proper relation name.
89 89
 		$relation_name = $box['id'];
90 90
 
91 91
 		// Get the entity referenced from the post content.
92
-		$entity_uris = Wordlift_Content_Filter_Service::get_instance()->get_entity_uris( $post->post_content );
92
+		$entity_uris = Wordlift_Content_Filter_Service::get_instance()->get_entity_uris($post->post_content);
93 93
 
94 94
 		// Enhance current box selected entities.
95
-		$classification_boxes[ $i ]['selectedEntities'] = $entity_uris;
95
+		$classification_boxes[$i]['selectedEntities'] = $entity_uris;
96 96
 
97 97
 		// Maps the URIs to entity posts.
98 98
 		$entity_service = Wordlift_Entity_Service::get_instance();
99 99
 
100 100
 		// Replace all entity URI's with post ID's if found or null if there is no related post.
101
-		$entity_ids = array_map( function ( $item ) use ( $entity_service ) {
101
+		$entity_ids = array_map(function($item) use ($entity_service) {
102 102
 			// Return entity post by the entity URI or null.
103
-			$post = $entity_service->get_entity_post_by_uri( $item );
103
+			$post = $entity_service->get_entity_post_by_uri($item);
104 104
 
105 105
 			// Check that the post object is not null.
106
-			if ( ! empty( $post ) ) {
106
+			if ( ! empty($post)) {
107 107
 				return $post->ID;
108 108
 			}
109
-		}, $entity_uris );
109
+		}, $entity_uris);
110 110
 		// Store the entity ids for all the 4W.
111
-		$all_referenced_entities_ids = array_merge( $all_referenced_entities_ids, $entity_ids );
111
+		$all_referenced_entities_ids = array_merge($all_referenced_entities_ids, $entity_ids);
112 112
 
113 113
 	}
114 114
 	// Json encoding for classification boxes structure.
115
-	$classification_boxes = wp_json_encode( $classification_boxes );
115
+	$classification_boxes = wp_json_encode($classification_boxes);
116 116
 
117 117
 	// Ensure there are no repetitions of the referenced entities.
118
-	$all_referenced_entities_ids = array_unique( $all_referenced_entities_ids );
118
+	$all_referenced_entities_ids = array_unique($all_referenced_entities_ids);
119 119
 
120 120
 	// Remove all null, false and empty strings.
121 121
 	// NULL is being returned in some cases, when there is not related post, so we need to remove it.
122
-	$all_referenced_entities_ids = array_filter( $all_referenced_entities_ids );
122
+	$all_referenced_entities_ids = array_filter($all_referenced_entities_ids);
123 123
 
124 124
 	// Build the entity storage object.
125 125
 	$referenced_entities_obj = array();
126
-	foreach ( $all_referenced_entities_ids as $referenced_entity ) {
127
-		$entity = wl_serialize_entity( $referenced_entity );
126
+	foreach ($all_referenced_entities_ids as $referenced_entity) {
127
+		$entity = wl_serialize_entity($referenced_entity);
128 128
 		// Set a default confidence of `PHP_INT_MAX` for already annotated entities.
129
-		$referenced_entities_obj[ $entity['id'] ] = $entity
130
-													+ array( 'confidence' => PHP_INT_MAX );
129
+		$referenced_entities_obj[$entity['id']] = $entity
130
+													+ array('confidence' => PHP_INT_MAX);
131 131
 	}
132 132
 
133
-	$referenced_entities_obj = empty( $referenced_entities_obj ) ?
134
-		'{}' : wp_json_encode( $referenced_entities_obj );
133
+	$referenced_entities_obj = empty($referenced_entities_obj) ?
134
+		'{}' : wp_json_encode($referenced_entities_obj);
135 135
 
136 136
 	$published_place_id  = get_post_meta(
137 137
 		$post->ID, Wordlift_Schema_Service::FIELD_LOCATION_CREATED, true
138 138
 	);
139
-	$published_place_obj = ( $published_place_id ) ?
140
-		wp_json_encode( wl_serialize_entity( $published_place_id ) ) :
141
-		'undefined';
139
+	$published_place_obj = ($published_place_id) ?
140
+		wp_json_encode(wl_serialize_entity($published_place_id)) : 'undefined';
142 141
 
143 142
 	$topic_id  = get_post_meta(
144 143
 		$post->ID, Wordlift_Schema_Service::FIELD_TOPIC, true
145 144
 	);
146
-	$topic_obj = ( $topic_id ) ?
147
-		wp_json_encode( wl_serialize_entity( $topic_id ) ) :
148
-		'undefined';
145
+	$topic_obj = ($topic_id) ?
146
+		wp_json_encode(wl_serialize_entity($topic_id)) : 'undefined';
149 147
 
150 148
 	$configuration_service = Wordlift_Configuration_Service::get_instance();
151 149
 
152 150
 	$default_thumbnail_path = WL_DEFAULT_THUMBNAIL_PATH;
153 151
 	$default_path           = WL_DEFAULT_PATH;
154 152
 	$dataset_uri            = $configuration_service->get_dataset_uri();
155
-	$current_post_uri       = wl_get_entity_uri( $post->ID );
153
+	$current_post_uri       = wl_get_entity_uri($post->ID);
156 154
 
157 155
 	// Retrieve the current post author.
158
-	$post_author = get_userdata( $post->post_author )->display_name;
156
+	$post_author = get_userdata($post->post_author)->display_name;
159 157
 	// Retrive the published date.
160
-	$published_date = get_the_time( 'Y-m-d', $post->ID );
158
+	$published_date = get_the_time('Y-m-d', $post->ID);
161 159
 	// Current language.
162 160
 	$current_language = $configuration_service->get_language_code();
163 161
 
Please login to merge, or discard this patch.
src/includes/class-wordlift-abstract-post-to-jsonld-converter.php 2 patches
Indentation   +266 added lines, -266 removed lines patch added patch discarded remove patch
@@ -18,285 +18,285 @@
 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
-		/*
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
+        /*
106 106
 		 * The `types` variable holds one or more entity types. The `type` variable isn't used anymore.
107 107
 		 *
108 108
 		 * @since 3.20.0 We support more than one entity type.
109 109
 		 *
110 110
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
111 111
 		 */
112
-		//		// Get the entity @type. We consider `post` BlogPostings.
113
-		//		$type = $this->entity_type_service->get( $post_id );
114
-		$types = $this->entity_type_service->get_names( $post_id );
115
-
116
-		// Prepare the response.
117
-		$jsonld = array(
118
-			'@context'    => self::CONTEXT,
119
-			'@id'         => $id,
120
-			'@type'       => self::make_one( $types ),
121
-			'description' => Wordlift_Post_Excerpt_Helper::get_text_excerpt( $post ),
122
-		);
123
-
124
-		// Set the `mainEntityOfPage` property if the post has some contents.
125
-		if ( ! empty( $post->post_content ) ) {
126
-			// We're setting the `mainEntityOfPage` to signal which one is the
127
-			// main entity for the specified URL. It might be however that the
128
-			// post/page is actually about another specific entity. How WL deals
129
-			// with that hasn't been defined yet (see https://github.com/insideout10/wordlift-plugin/issues/451).
130
-			//
131
-			// See http://schema.org/mainEntityOfPage
132
-			//
133
-			// No need to specify `'@type' => 'WebPage'.
134
-			//
135
-			// See https://github.com/insideout10/wordlift-plugin/issues/451.
136
-			$jsonld['mainEntityOfPage'] = get_the_permalink( $post->ID );
137
-		};
138
-
139
-		$this->set_images( $post, $jsonld );
140
-
141
-		// Get the entities referenced by this post and set it to the `references`
142
-		// array so that the caller can do further processing, such as printing out
143
-		// more of those references.
144
-		$references = $this->entity_service->get_related_entities( $post->ID );
145
-
146
-		return $jsonld;
147
-	}
148
-
149
-	/**
150
-	 * If the provided value starts with the schema.org context, we remove the schema.org
151
-	 * part since it is set with the '@context'.
152
-	 *
153
-	 * @since 3.10.0
154
-	 *
155
-	 * @param string $value The property value.
156
-	 *
157
-	 * @return string The property value without the context.
158
-	 */
159
-	public function relative_to_context( $value ) {
160
-
161
-		return 0 === strpos( $value, self::CONTEXT . '/' ) ? substr( $value, strlen( self::CONTEXT ) + 1 ) : $value;
162
-	}
163
-
164
-	/**
165
-	 * Set the images, by looking for embedded images, for images loaded via the
166
-	 * gallery and for the featured image.
167
-	 *
168
-	 * Uses the cache service to store the results of this function for a day.
169
-	 *
170
-	 * @since 3.10.0
171
-	 *
172
-	 * @param WP_Post $post The target {@link WP_Post}.
173
-	 * @param array   $jsonld The JSON-LD array.
174
-	 */
175
-	protected function set_images( $post, &$jsonld ) {
176
-
177
-		// Prepare the attachment ids array.
178
-		$ids = array();
179
-
180
-		// Set the thumbnail id as first attachment id, if any.
181
-		$thumbnail_id = get_post_thumbnail_id( $post->ID );
182
-		if ( '' !== $thumbnail_id ) {
183
-			$ids[] = $thumbnail_id;
184
-		}
185
-
186
-		// For the time being the following is being removed since the query
187
-		// initiated by `get_image_embeds` is consuming lots of CPU.
188
-		//
189
-		// See https://github.com/insideout10/wordlift-plugin/issues/689.
190
-		//
191
-		// Get the embeds, removing existing ids.
192
-		// $embeds = array_diff( $this->attachment_service->get_image_embeds( $post->post_content ), $ids );
193
-		$embeds = array();
194
-
195
-		// Get the gallery, removing existing ids.
196
-		$gallery = array_diff( $this->attachment_service->get_gallery( $post ), $ids, $embeds );
197
-
198
-		// Map the attachment ids to images' data structured for schema.org use.
199
-		$images_with_sizes = array_filter(
200
-			array_reduce( array_merge( $ids, $embeds, $gallery ),
201
-				function ( $carry, $item ) {
202
-					/*
112
+        //		// Get the entity @type. We consider `post` BlogPostings.
113
+        //		$type = $this->entity_type_service->get( $post_id );
114
+        $types = $this->entity_type_service->get_names( $post_id );
115
+
116
+        // Prepare the response.
117
+        $jsonld = array(
118
+            '@context'    => self::CONTEXT,
119
+            '@id'         => $id,
120
+            '@type'       => self::make_one( $types ),
121
+            'description' => Wordlift_Post_Excerpt_Helper::get_text_excerpt( $post ),
122
+        );
123
+
124
+        // Set the `mainEntityOfPage` property if the post has some contents.
125
+        if ( ! empty( $post->post_content ) ) {
126
+            // We're setting the `mainEntityOfPage` to signal which one is the
127
+            // main entity for the specified URL. It might be however that the
128
+            // post/page is actually about another specific entity. How WL deals
129
+            // with that hasn't been defined yet (see https://github.com/insideout10/wordlift-plugin/issues/451).
130
+            //
131
+            // See http://schema.org/mainEntityOfPage
132
+            //
133
+            // No need to specify `'@type' => 'WebPage'.
134
+            //
135
+            // See https://github.com/insideout10/wordlift-plugin/issues/451.
136
+            $jsonld['mainEntityOfPage'] = get_the_permalink( $post->ID );
137
+        };
138
+
139
+        $this->set_images( $post, $jsonld );
140
+
141
+        // Get the entities referenced by this post and set it to the `references`
142
+        // array so that the caller can do further processing, such as printing out
143
+        // more of those references.
144
+        $references = $this->entity_service->get_related_entities( $post->ID );
145
+
146
+        return $jsonld;
147
+    }
148
+
149
+    /**
150
+     * If the provided value starts with the schema.org context, we remove the schema.org
151
+     * part since it is set with the '@context'.
152
+     *
153
+     * @since 3.10.0
154
+     *
155
+     * @param string $value The property value.
156
+     *
157
+     * @return string The property value without the context.
158
+     */
159
+    public function relative_to_context( $value ) {
160
+
161
+        return 0 === strpos( $value, self::CONTEXT . '/' ) ? substr( $value, strlen( self::CONTEXT ) + 1 ) : $value;
162
+    }
163
+
164
+    /**
165
+     * Set the images, by looking for embedded images, for images loaded via the
166
+     * gallery and for the featured image.
167
+     *
168
+     * Uses the cache service to store the results of this function for a day.
169
+     *
170
+     * @since 3.10.0
171
+     *
172
+     * @param WP_Post $post The target {@link WP_Post}.
173
+     * @param array   $jsonld The JSON-LD array.
174
+     */
175
+    protected function set_images( $post, &$jsonld ) {
176
+
177
+        // Prepare the attachment ids array.
178
+        $ids = array();
179
+
180
+        // Set the thumbnail id as first attachment id, if any.
181
+        $thumbnail_id = get_post_thumbnail_id( $post->ID );
182
+        if ( '' !== $thumbnail_id ) {
183
+            $ids[] = $thumbnail_id;
184
+        }
185
+
186
+        // For the time being the following is being removed since the query
187
+        // initiated by `get_image_embeds` is consuming lots of CPU.
188
+        //
189
+        // See https://github.com/insideout10/wordlift-plugin/issues/689.
190
+        //
191
+        // Get the embeds, removing existing ids.
192
+        // $embeds = array_diff( $this->attachment_service->get_image_embeds( $post->post_content ), $ids );
193
+        $embeds = array();
194
+
195
+        // Get the gallery, removing existing ids.
196
+        $gallery = array_diff( $this->attachment_service->get_gallery( $post ), $ids, $embeds );
197
+
198
+        // Map the attachment ids to images' data structured for schema.org use.
199
+        $images_with_sizes = array_filter(
200
+            array_reduce( array_merge( $ids, $embeds, $gallery ),
201
+                function ( $carry, $item ) {
202
+                    /*
203 203
 					* @todo: we're not sure that we're getting attachment data here, we
204 204
 					* should filter `false`s.
205 205
 					*/
206 206
 
207
-					$sources = array_merge(
208
-						Wordlift_Image_Service::get_sources( $item ),
209
-						array( wp_get_attachment_image_src( $item, 'full' ) )
210
-					);
207
+                    $sources = array_merge(
208
+                        Wordlift_Image_Service::get_sources( $item ),
209
+                        array( wp_get_attachment_image_src( $item, 'full' ) )
210
+                    );
211 211
 
212
-					$sources_with_image = array_filter( $sources, function ( $source ) {
213
-						return ! empty( $source[0] );
214
-					} );
212
+                    $sources_with_image = array_filter( $sources, function ( $source ) {
213
+                        return ! empty( $source[0] );
214
+                    } );
215 215
 
216
-					// Get the attachment data.
217
-					// $attachment = wp_get_attachment_image_src( $item, 'full' );
216
+                    // Get the attachment data.
217
+                    // $attachment = wp_get_attachment_image_src( $item, 'full' );
218 218
 
219
-					// var_dump( array( "sources-$item" => Wordlift_Image_Service::get_sources( $item ) ) );
219
+                    // var_dump( array( "sources-$item" => Wordlift_Image_Service::get_sources( $item ) ) );
220 220
 
221
-					// Bail if image is not found.
222
-					// In some cases, you can delete the image from the database
223
-					// or from uploads dir, but the image id still exists as featured image
224
-					// or in [gallery] shortcode.
221
+                    // Bail if image is not found.
222
+                    // In some cases, you can delete the image from the database
223
+                    // or from uploads dir, but the image id still exists as featured image
224
+                    // or in [gallery] shortcode.
225 225
 //					if ( empty( $attachment[0] ) ) {
226
-					if ( empty( $sources_with_image ) ) {
227
-						return $carry;
228
-					}
229
-
230
-					// Merge the arrays.
231
-					return array_merge(
232
-						$carry,
233
-						$sources_with_image
234
-					);
235
-				}
236
-				// Initial array.
237
-				, array() )
238
-		);
239
-
240
-		// Refactor data as per schema.org specifications.
241
-		$images = array_map( function ( $attachment ) {
242
-			return Wordlift_Abstract_Post_To_Jsonld_Converter::set_image_size(
243
-				array(
244
-					'@type' => 'ImageObject',
245
-					'url'   => $attachment[0],
246
-				), $attachment
247
-			);
248
-		}, $images_with_sizes );
249
-
250
-		// Add images if present.
251
-		if ( 0 < count( $images ) ) {
252
-			$jsonld['image'] = $images;
253
-		}
254
-
255
-	}
256
-
257
-	/**
258
-	 * If the provided array of values contains only one value, then one single
259
-	 * value is returned, otherwise the original array is returned.
260
-	 *
261
-	 * @since 3.20.0 The function has been moved from {@link Wordlift_Entity_Post_To_Jsonld_Converter} to
262
-	 *  {@link Wordlift_Abstract_Post_To_Jsonld_Converter}.
263
-	 * @since  3.8.0
264
-	 * @access private
265
-	 *
266
-	 * @param array $value An array of values.
267
-	 *
268
-	 * @return mixed|array A single value or the original array.
269
-	 */
270
-	protected static function make_one( $value ) {
271
-
272
-		return 1 === count( $value ) ? $value[0] : $value;
273
-	}
274
-
275
-	/**
276
-	 * Process the provided array by adding the width / height if the values
277
-	 * are available and are greater than 0.
278
-	 *
279
-	 * @since 3.14.0
280
-	 *
281
-	 * @param array $image The `ImageObject` array.
282
-	 * @param array $attachment The attachment array.
283
-	 *
284
-	 * @return array The enriched `ImageObject` array.
285
-	 */
286
-	public static function set_image_size( $image, $attachment ) {
287
-
288
-		// If you specify a "width" or "height" value you should leave out
289
-		// 'px'. For example: "width":"4608px" should be "width":"4608".
290
-		//
291
-		// See https://github.com/insideout10/wordlift-plugin/issues/451.
292
-		if ( isset( $attachment[1] ) && is_numeric( $attachment[1] ) && 0 < $attachment[1] ) {
293
-			$image['width'] = $attachment[1];
294
-		}
295
-
296
-		if ( isset( $attachment[2] ) && is_numeric( $attachment[2] ) && 0 < $attachment[2] ) {
297
-			$image['height'] = $attachment[2];
298
-		}
299
-
300
-		return $image;
301
-	}
226
+                    if ( empty( $sources_with_image ) ) {
227
+                        return $carry;
228
+                    }
229
+
230
+                    // Merge the arrays.
231
+                    return array_merge(
232
+                        $carry,
233
+                        $sources_with_image
234
+                    );
235
+                }
236
+                // Initial array.
237
+                , array() )
238
+        );
239
+
240
+        // Refactor data as per schema.org specifications.
241
+        $images = array_map( function ( $attachment ) {
242
+            return Wordlift_Abstract_Post_To_Jsonld_Converter::set_image_size(
243
+                array(
244
+                    '@type' => 'ImageObject',
245
+                    'url'   => $attachment[0],
246
+                ), $attachment
247
+            );
248
+        }, $images_with_sizes );
249
+
250
+        // Add images if present.
251
+        if ( 0 < count( $images ) ) {
252
+            $jsonld['image'] = $images;
253
+        }
254
+
255
+    }
256
+
257
+    /**
258
+     * If the provided array of values contains only one value, then one single
259
+     * value is returned, otherwise the original array is returned.
260
+     *
261
+     * @since 3.20.0 The function has been moved from {@link Wordlift_Entity_Post_To_Jsonld_Converter} to
262
+     *  {@link Wordlift_Abstract_Post_To_Jsonld_Converter}.
263
+     * @since  3.8.0
264
+     * @access private
265
+     *
266
+     * @param array $value An array of values.
267
+     *
268
+     * @return mixed|array A single value or the original array.
269
+     */
270
+    protected static function make_one( $value ) {
271
+
272
+        return 1 === count( $value ) ? $value[0] : $value;
273
+    }
274
+
275
+    /**
276
+     * Process the provided array by adding the width / height if the values
277
+     * are available and are greater than 0.
278
+     *
279
+     * @since 3.14.0
280
+     *
281
+     * @param array $image The `ImageObject` array.
282
+     * @param array $attachment The attachment array.
283
+     *
284
+     * @return array The enriched `ImageObject` array.
285
+     */
286
+    public static function set_image_size( $image, $attachment ) {
287
+
288
+        // If you specify a "width" or "height" value you should leave out
289
+        // 'px'. For example: "width":"4608px" should be "width":"4608".
290
+        //
291
+        // See https://github.com/insideout10/wordlift-plugin/issues/451.
292
+        if ( isset( $attachment[1] ) && is_numeric( $attachment[1] ) && 0 < $attachment[1] ) {
293
+            $image['width'] = $attachment[1];
294
+        }
295
+
296
+        if ( isset( $attachment[2] ) && is_numeric( $attachment[2] ) && 0 < $attachment[2] ) {
297
+            $image['height'] = $attachment[2];
298
+        }
299
+
300
+        return $image;
301
+    }
302 302
 }
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 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,17 +90,17 @@  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
 		/*
106 106
 		 * The `types` variable holds one or more entity types. The `type` variable isn't used anymore.
@@ -111,18 +111,18 @@  discard block
 block discarded – undo
111 111
 		 */
112 112
 		//		// Get the entity @type. We consider `post` BlogPostings.
113 113
 		//		$type = $this->entity_type_service->get( $post_id );
114
-		$types = $this->entity_type_service->get_names( $post_id );
114
+		$types = $this->entity_type_service->get_names($post_id);
115 115
 
116 116
 		// Prepare the response.
117 117
 		$jsonld = array(
118 118
 			'@context'    => self::CONTEXT,
119 119
 			'@id'         => $id,
120
-			'@type'       => self::make_one( $types ),
121
-			'description' => Wordlift_Post_Excerpt_Helper::get_text_excerpt( $post ),
120
+			'@type'       => self::make_one($types),
121
+			'description' => Wordlift_Post_Excerpt_Helper::get_text_excerpt($post),
122 122
 		);
123 123
 
124 124
 		// Set the `mainEntityOfPage` property if the post has some contents.
125
-		if ( ! empty( $post->post_content ) ) {
125
+		if ( ! empty($post->post_content)) {
126 126
 			// We're setting the `mainEntityOfPage` to signal which one is the
127 127
 			// main entity for the specified URL. It might be however that the
128 128
 			// post/page is actually about another specific entity. How WL deals
@@ -133,15 +133,15 @@  discard block
 block discarded – undo
133 133
 			// No need to specify `'@type' => 'WebPage'.
134 134
 			//
135 135
 			// See https://github.com/insideout10/wordlift-plugin/issues/451.
136
-			$jsonld['mainEntityOfPage'] = get_the_permalink( $post->ID );
136
+			$jsonld['mainEntityOfPage'] = get_the_permalink($post->ID);
137 137
 		};
138 138
 
139
-		$this->set_images( $post, $jsonld );
139
+		$this->set_images($post, $jsonld);
140 140
 
141 141
 		// Get the entities referenced by this post and set it to the `references`
142 142
 		// array so that the caller can do further processing, such as printing out
143 143
 		// more of those references.
144
-		$references = $this->entity_service->get_related_entities( $post->ID );
144
+		$references = $this->entity_service->get_related_entities($post->ID);
145 145
 
146 146
 		return $jsonld;
147 147
 	}
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 	 *
157 157
 	 * @return string The property value without the context.
158 158
 	 */
159
-	public function relative_to_context( $value ) {
159
+	public function relative_to_context($value) {
160 160
 
161
-		return 0 === strpos( $value, self::CONTEXT . '/' ) ? substr( $value, strlen( self::CONTEXT ) + 1 ) : $value;
161
+		return 0 === strpos($value, self::CONTEXT.'/') ? substr($value, strlen(self::CONTEXT) + 1) : $value;
162 162
 	}
163 163
 
164 164
 	/**
@@ -172,14 +172,14 @@  discard block
 block discarded – undo
172 172
 	 * @param WP_Post $post The target {@link WP_Post}.
173 173
 	 * @param array   $jsonld The JSON-LD array.
174 174
 	 */
175
-	protected function set_images( $post, &$jsonld ) {
175
+	protected function set_images($post, &$jsonld) {
176 176
 
177 177
 		// Prepare the attachment ids array.
178 178
 		$ids = array();
179 179
 
180 180
 		// Set the thumbnail id as first attachment id, if any.
181
-		$thumbnail_id = get_post_thumbnail_id( $post->ID );
182
-		if ( '' !== $thumbnail_id ) {
181
+		$thumbnail_id = get_post_thumbnail_id($post->ID);
182
+		if ('' !== $thumbnail_id) {
183 183
 			$ids[] = $thumbnail_id;
184 184
 		}
185 185
 
@@ -193,24 +193,24 @@  discard block
 block discarded – undo
193 193
 		$embeds = array();
194 194
 
195 195
 		// Get the gallery, removing existing ids.
196
-		$gallery = array_diff( $this->attachment_service->get_gallery( $post ), $ids, $embeds );
196
+		$gallery = array_diff($this->attachment_service->get_gallery($post), $ids, $embeds);
197 197
 
198 198
 		// Map the attachment ids to images' data structured for schema.org use.
199 199
 		$images_with_sizes = array_filter(
200
-			array_reduce( array_merge( $ids, $embeds, $gallery ),
201
-				function ( $carry, $item ) {
200
+			array_reduce(array_merge($ids, $embeds, $gallery),
201
+				function($carry, $item) {
202 202
 					/*
203 203
 					* @todo: we're not sure that we're getting attachment data here, we
204 204
 					* should filter `false`s.
205 205
 					*/
206 206
 
207 207
 					$sources = array_merge(
208
-						Wordlift_Image_Service::get_sources( $item ),
209
-						array( wp_get_attachment_image_src( $item, 'full' ) )
208
+						Wordlift_Image_Service::get_sources($item),
209
+						array(wp_get_attachment_image_src($item, 'full'))
210 210
 					);
211 211
 
212
-					$sources_with_image = array_filter( $sources, function ( $source ) {
213
-						return ! empty( $source[0] );
212
+					$sources_with_image = array_filter($sources, function($source) {
213
+						return ! empty($source[0]);
214 214
 					} );
215 215
 
216 216
 					// Get the attachment data.
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 					// or from uploads dir, but the image id still exists as featured image
224 224
 					// or in [gallery] shortcode.
225 225
 //					if ( empty( $attachment[0] ) ) {
226
-					if ( empty( $sources_with_image ) ) {
226
+					if (empty($sources_with_image)) {
227 227
 						return $carry;
228 228
 					}
229 229
 
@@ -234,21 +234,21 @@  discard block
 block discarded – undo
234 234
 					);
235 235
 				}
236 236
 				// Initial array.
237
-				, array() )
237
+				, array())
238 238
 		);
239 239
 
240 240
 		// Refactor data as per schema.org specifications.
241
-		$images = array_map( function ( $attachment ) {
241
+		$images = array_map(function($attachment) {
242 242
 			return Wordlift_Abstract_Post_To_Jsonld_Converter::set_image_size(
243 243
 				array(
244 244
 					'@type' => 'ImageObject',
245 245
 					'url'   => $attachment[0],
246 246
 				), $attachment
247 247
 			);
248
-		}, $images_with_sizes );
248
+		}, $images_with_sizes);
249 249
 
250 250
 		// Add images if present.
251
-		if ( 0 < count( $images ) ) {
251
+		if (0 < count($images)) {
252 252
 			$jsonld['image'] = $images;
253 253
 		}
254 254
 
@@ -267,9 +267,9 @@  discard block
 block discarded – undo
267 267
 	 *
268 268
 	 * @return mixed|array A single value or the original array.
269 269
 	 */
270
-	protected static function make_one( $value ) {
270
+	protected static function make_one($value) {
271 271
 
272
-		return 1 === count( $value ) ? $value[0] : $value;
272
+		return 1 === count($value) ? $value[0] : $value;
273 273
 	}
274 274
 
275 275
 	/**
@@ -283,17 +283,17 @@  discard block
 block discarded – undo
283 283
 	 *
284 284
 	 * @return array The enriched `ImageObject` array.
285 285
 	 */
286
-	public static function set_image_size( $image, $attachment ) {
286
+	public static function set_image_size($image, $attachment) {
287 287
 
288 288
 		// If you specify a "width" or "height" value you should leave out
289 289
 		// 'px'. For example: "width":"4608px" should be "width":"4608".
290 290
 		//
291 291
 		// See https://github.com/insideout10/wordlift-plugin/issues/451.
292
-		if ( isset( $attachment[1] ) && is_numeric( $attachment[1] ) && 0 < $attachment[1] ) {
292
+		if (isset($attachment[1]) && is_numeric($attachment[1]) && 0 < $attachment[1]) {
293 293
 			$image['width'] = $attachment[1];
294 294
 		}
295 295
 
296
-		if ( isset( $attachment[2] ) && is_numeric( $attachment[2] ) && 0 < $attachment[2] ) {
296
+		if (isset($attachment[2]) && is_numeric($attachment[2]) && 0 < $attachment[2]) {
297 297
 			$image['height'] = $attachment[2];
298 298
 		}
299 299
 
Please login to merge, or discard this patch.
src/includes/class-wordlift.php 2 patches
Indentation   +1550 added lines, -1550 removed lines patch added patch discarded remove patch
@@ -28,1619 +28,1619 @@
 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 $entity_link_service The {@link Wordlift_Entity_Link_Service} instance.
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
-	 * The {@link Wordlift_Publisher_Service} instance.
686
-	 *
687
-	 * @since  3.19.0
688
-	 * @access protected
689
-	 * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
690
-	 */
691
-	protected $publisher_service;
692
-
693
-	/**
694
-	 * {@link Wordlift}'s singleton instance.
695
-	 *
696
-	 * @since  3.11.2
697
-	 * @access private
698
-	 * @var Wordlift $instance {@link Wordlift}'s singleton instance.
699
-	 */
700
-	private static $instance;
701
-	//</editor-fold>
702
-
703
-	/**
704
-	 * Define the core functionality of the plugin.
705
-	 *
706
-	 * Set the plugin name and the plugin version that can be used throughout the plugin.
707
-	 * Load the dependencies, define the locale, and set the hooks for the admin area and
708
-	 * the public-facing side of the site.
709
-	 *
710
-	 * @since    1.0.0
711
-	 */
712
-	public function __construct() {
713
-
714
-		$this->plugin_name = 'wordlift';
715
-		$this->version     = '3.20.0-dev3';
716
-		$this->load_dependencies();
717
-		$this->set_locale();
718
-		$this->define_admin_hooks();
719
-		$this->define_public_hooks();
720
-
721
-		// If we're in `WP_CLI` load the related files.
722
-		if ( class_exists( 'WP_CLI' ) ) {
723
-			$this->load_cli_dependencies();
724
-		}
725
-
726
-		self::$instance = $this;
727
-
728
-	}
729
-
730
-	/**
731
-	 * Get the singleton instance.
732
-	 *
733
-	 * @since 3.11.2
734
-	 *
735
-	 * @return Wordlift The {@link Wordlift} singleton instance.
736
-	 */
737
-	public static function get_instance() {
738
-
739
-		return self::$instance;
740
-	}
741
-
742
-	/**
743
-	 * Load the required dependencies for this plugin.
744
-	 *
745
-	 * Include the following files that make up the plugin:
746
-	 *
747
-	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
748
-	 * - Wordlift_i18n. Defines internationalization functionality.
749
-	 * - Wordlift_Admin. Defines all hooks for the admin area.
750
-	 * - Wordlift_Public. Defines all hooks for the public side of the site.
751
-	 *
752
-	 * Create an instance of the loader which will be used to register the hooks
753
-	 * with WordPress.
754
-	 *
755
-	 * @since    1.0.0
756
-	 * @access   private
757
-	 */
758
-	private function load_dependencies() {
759
-
760
-		/**
761
-		 * The class responsible for orchestrating the actions and filters of the
762
-		 * core plugin.
763
-		 */
764
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
765
-
766
-		// The class responsible for plugin uninstall.
767
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
768
-
769
-		/**
770
-		 * The class responsible for defining internationalization functionality
771
-		 * of the plugin.
772
-		 */
773
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
774
-
775
-		/**
776
-		 * WordLift's supported languages.
777
-		 */
778
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
779
-
780
-		/**
781
-		 * Provide support functions to sanitize data.
782
-		 */
783
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
784
-
785
-		/** Services. */
786
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
787
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
788
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
789
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
790
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
791
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
792
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
793
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
794
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
795
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php';
796
-
797
-		/**
798
-		 * The Query builder.
799
-		 */
800
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
801
-
802
-		/**
803
-		 * The Schema service.
804
-		 */
805
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
806
-
807
-		/**
808
-		 * The schema:url property service.
809
-		 */
810
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
811
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
812
-
813
-		/**
814
-		 * The UI service.
815
-		 */
816
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
817
-
818
-		/**
819
-		 * The Thumbnail service.
820
-		 */
821
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
822
-
823
-		/**
824
-		 * The Entity Types Taxonomy service.
825
-		 */
826
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
827
-
828
-		/**
829
-		 * The Entity service.
830
-		 */
831
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
832
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
833
-
834
-		// Add the entity rating service.
835
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
836
-
837
-		/**
838
-		 * The User service.
839
-		 */
840
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
841
-
842
-		/**
843
-		 * The Timeline service.
844
-		 */
845
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
846
-
847
-		/**
848
-		 * The Topic Taxonomy service.
849
-		 */
850
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
851
-
852
-		/**
853
-		 * The SPARQL service.
854
-		 */
855
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
856
-
857
-		/**
858
-		 * The WordLift import service.
859
-		 */
860
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
861
-
862
-		/**
863
-		 * The WordLift URI service.
864
-		 */
865
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
866
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
867
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
868
-
869
-		/**
870
-		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
871
-		 */
872
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php';
873
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php';
874
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php';
875
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php';
876
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
877
-
878
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
879
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
880
-
881
-		/**
882
-		 * Load the converters.
883
-		 */
884
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
885
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
886
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
887
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
888
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
889
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
890
-
891
-		/**
892
-		 * Load cache-related files.
893
-		 */
894
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
895
-
896
-		/**
897
-		 * Load the content filter.
898
-		 */
899
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
900
-
901
-		/*
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 $entity_link_service The {@link Wordlift_Entity_Link_Service} instance.
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
+     * The {@link Wordlift_Publisher_Service} instance.
686
+     *
687
+     * @since  3.19.0
688
+     * @access protected
689
+     * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
690
+     */
691
+    protected $publisher_service;
692
+
693
+    /**
694
+     * {@link Wordlift}'s singleton instance.
695
+     *
696
+     * @since  3.11.2
697
+     * @access private
698
+     * @var Wordlift $instance {@link Wordlift}'s singleton instance.
699
+     */
700
+    private static $instance;
701
+    //</editor-fold>
702
+
703
+    /**
704
+     * Define the core functionality of the plugin.
705
+     *
706
+     * Set the plugin name and the plugin version that can be used throughout the plugin.
707
+     * Load the dependencies, define the locale, and set the hooks for the admin area and
708
+     * the public-facing side of the site.
709
+     *
710
+     * @since    1.0.0
711
+     */
712
+    public function __construct() {
713
+
714
+        $this->plugin_name = 'wordlift';
715
+        $this->version     = '3.20.0-dev3';
716
+        $this->load_dependencies();
717
+        $this->set_locale();
718
+        $this->define_admin_hooks();
719
+        $this->define_public_hooks();
720
+
721
+        // If we're in `WP_CLI` load the related files.
722
+        if ( class_exists( 'WP_CLI' ) ) {
723
+            $this->load_cli_dependencies();
724
+        }
725
+
726
+        self::$instance = $this;
727
+
728
+    }
729
+
730
+    /**
731
+     * Get the singleton instance.
732
+     *
733
+     * @since 3.11.2
734
+     *
735
+     * @return Wordlift The {@link Wordlift} singleton instance.
736
+     */
737
+    public static function get_instance() {
738
+
739
+        return self::$instance;
740
+    }
741
+
742
+    /**
743
+     * Load the required dependencies for this plugin.
744
+     *
745
+     * Include the following files that make up the plugin:
746
+     *
747
+     * - Wordlift_Loader. Orchestrates the hooks of the plugin.
748
+     * - Wordlift_i18n. Defines internationalization functionality.
749
+     * - Wordlift_Admin. Defines all hooks for the admin area.
750
+     * - Wordlift_Public. Defines all hooks for the public side of the site.
751
+     *
752
+     * Create an instance of the loader which will be used to register the hooks
753
+     * with WordPress.
754
+     *
755
+     * @since    1.0.0
756
+     * @access   private
757
+     */
758
+    private function load_dependencies() {
759
+
760
+        /**
761
+         * The class responsible for orchestrating the actions and filters of the
762
+         * core plugin.
763
+         */
764
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
765
+
766
+        // The class responsible for plugin uninstall.
767
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
768
+
769
+        /**
770
+         * The class responsible for defining internationalization functionality
771
+         * of the plugin.
772
+         */
773
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
774
+
775
+        /**
776
+         * WordLift's supported languages.
777
+         */
778
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
779
+
780
+        /**
781
+         * Provide support functions to sanitize data.
782
+         */
783
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
784
+
785
+        /** Services. */
786
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
787
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
788
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
789
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
790
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
791
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
792
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
793
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
794
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
795
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php';
796
+
797
+        /**
798
+         * The Query builder.
799
+         */
800
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
801
+
802
+        /**
803
+         * The Schema service.
804
+         */
805
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
806
+
807
+        /**
808
+         * The schema:url property service.
809
+         */
810
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
811
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
812
+
813
+        /**
814
+         * The UI service.
815
+         */
816
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
817
+
818
+        /**
819
+         * The Thumbnail service.
820
+         */
821
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
822
+
823
+        /**
824
+         * The Entity Types Taxonomy service.
825
+         */
826
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
827
+
828
+        /**
829
+         * The Entity service.
830
+         */
831
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
832
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
833
+
834
+        // Add the entity rating service.
835
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
836
+
837
+        /**
838
+         * The User service.
839
+         */
840
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
841
+
842
+        /**
843
+         * The Timeline service.
844
+         */
845
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
846
+
847
+        /**
848
+         * The Topic Taxonomy service.
849
+         */
850
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
851
+
852
+        /**
853
+         * The SPARQL service.
854
+         */
855
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
856
+
857
+        /**
858
+         * The WordLift import service.
859
+         */
860
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
861
+
862
+        /**
863
+         * The WordLift URI service.
864
+         */
865
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
866
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
867
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
868
+
869
+        /**
870
+         * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
871
+         */
872
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php';
873
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php';
874
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php';
875
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php';
876
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
877
+
878
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
879
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
880
+
881
+        /**
882
+         * Load the converters.
883
+         */
884
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
885
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
886
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
887
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
888
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
889
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
890
+
891
+        /**
892
+         * Load cache-related files.
893
+         */
894
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
895
+
896
+        /**
897
+         * Load the content filter.
898
+         */
899
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
900
+
901
+        /*
902 902
 		 * Load the excerpt helper.
903 903
 		 */
904
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
905
-
906
-		/**
907
-		 * Load the JSON-LD service to publish entities using JSON-LD.s
908
-		 *
909
-		 * @since 3.8.0
910
-		 */
911
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
912
-
913
-		// The Publisher Service and the AJAX adapter.
914
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
915
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
916
-
917
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
918
-
919
-		/**
920
-		 * Load the WordLift key validation service.
921
-		 */
922
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
923
-
924
-		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
925
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
926
-
927
-		// Load the `Wordlift_Entity_Page_Service` class definition.
928
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
929
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php';
930
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php';
931
-
932
-		/** Linked Data. */
933
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
934
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
935
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
936
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
937
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
938
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
939
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
940
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
941
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
942
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
943
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
944
-
945
-		/** Linked Data Rendition. */
946
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
947
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
948
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
949
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
950
-
951
-		/** Services. */
952
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
953
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
954
-
955
-		/** Adapters. */
956
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
957
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
958
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
959
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
960
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php';
961
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php';
962
-
963
-		/** Async Tasks. */
964
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
965
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
966
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
967
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
968
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php';
969
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php';
970
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
971
-
972
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
973
-
974
-		/**
975
-		 * The class responsible for defining all actions that occur in the admin area.
976
-		 */
977
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
978
-
979
-		/**
980
-		 * The class to customize the entity list admin page.
981
-		 */
982
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
983
-
984
-		/**
985
-		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
986
-		 */
987
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
988
-
989
-		/**
990
-		 * The Notice service.
991
-		 */
992
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
993
-
994
-		/**
995
-		 * The PrimaShop adapter.
996
-		 */
997
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
998
-
999
-		/**
1000
-		 * The WordLift Dashboard service.
1001
-		 */
1002
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
1003
-
1004
-		/**
1005
-		 * The admin 'Install wizard' page.
1006
-		 */
1007
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
1008
-
1009
-		/**
1010
-		 * The WordLift entity type list admin page controller.
1011
-		 */
1012
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1013
-
1014
-		/**
1015
-		 * The WordLift entity type settings admin page controller.
1016
-		 */
1017
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
1018
-
1019
-		/**
1020
-		 * The admin 'Download Your Data' page.
1021
-		 */
1022
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
1023
-
1024
-		/**
1025
-		 * The admin 'WordLift Settings' page.
1026
-		 */
1027
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
1028
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
1029
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
1030
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
1031
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
1032
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
1033
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
1034
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
1035
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
1036
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
1037
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php';
1038
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
1039
-
1040
-		/** Admin Pages */
1041
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1042
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
1043
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
1044
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
1045
-
1046
-		/**
1047
-		 * The class responsible for defining all actions that occur in the public-facing
1048
-		 * side of the site.
1049
-		 */
1050
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1051
-
1052
-		/**
1053
-		 * The shortcode abstract class.
1054
-		 */
1055
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1056
-
1057
-		/**
1058
-		 * The Timeline shortcode.
1059
-		 */
1060
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1061
-
1062
-		/**
1063
-		 * The Navigator shortcode.
1064
-		 */
1065
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1066
-
1067
-		/**
1068
-		 * The chord shortcode.
1069
-		 */
1070
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1071
-
1072
-		/**
1073
-		 * The geomap shortcode.
1074
-		 */
1075
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1076
-
1077
-		/**
1078
-		 * The entity cloud shortcode.
1079
-		 */
1080
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1081
-
1082
-		/**
1083
-		 * The entity glossary shortcode.
1084
-		 */
1085
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1086
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1087
-
1088
-		/**
1089
-		 * The ShareThis service.
1090
-		 */
1091
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1092
-
1093
-		/**
1094
-		 * The SEO service.
1095
-		 */
1096
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1097
-
1098
-		/**
1099
-		 * The AMP service.
1100
-		 */
1101
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1102
-
1103
-		/** Widgets */
1104
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1105
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1106
-
1107
-		/*
904
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
905
+
906
+        /**
907
+         * Load the JSON-LD service to publish entities using JSON-LD.s
908
+         *
909
+         * @since 3.8.0
910
+         */
911
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
912
+
913
+        // The Publisher Service and the AJAX adapter.
914
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
915
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
916
+
917
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
918
+
919
+        /**
920
+         * Load the WordLift key validation service.
921
+         */
922
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
923
+
924
+        // Load the `Wordlift_Category_Taxonomy_Service` class definition.
925
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
926
+
927
+        // Load the `Wordlift_Entity_Page_Service` class definition.
928
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
929
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php';
930
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php';
931
+
932
+        /** Linked Data. */
933
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
934
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
935
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
936
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
937
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
938
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
939
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
940
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
941
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
942
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
943
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
944
+
945
+        /** Linked Data Rendition. */
946
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
947
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
948
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
949
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
950
+
951
+        /** Services. */
952
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
953
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
954
+
955
+        /** Adapters. */
956
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
957
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
958
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
959
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
960
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php';
961
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php';
962
+
963
+        /** Async Tasks. */
964
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
965
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
966
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
967
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
968
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php';
969
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php';
970
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
971
+
972
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
973
+
974
+        /**
975
+         * The class responsible for defining all actions that occur in the admin area.
976
+         */
977
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
978
+
979
+        /**
980
+         * The class to customize the entity list admin page.
981
+         */
982
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
983
+
984
+        /**
985
+         * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
986
+         */
987
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
988
+
989
+        /**
990
+         * The Notice service.
991
+         */
992
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
993
+
994
+        /**
995
+         * The PrimaShop adapter.
996
+         */
997
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
998
+
999
+        /**
1000
+         * The WordLift Dashboard service.
1001
+         */
1002
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
1003
+
1004
+        /**
1005
+         * The admin 'Install wizard' page.
1006
+         */
1007
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
1008
+
1009
+        /**
1010
+         * The WordLift entity type list admin page controller.
1011
+         */
1012
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1013
+
1014
+        /**
1015
+         * The WordLift entity type settings admin page controller.
1016
+         */
1017
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
1018
+
1019
+        /**
1020
+         * The admin 'Download Your Data' page.
1021
+         */
1022
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
1023
+
1024
+        /**
1025
+         * The admin 'WordLift Settings' page.
1026
+         */
1027
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
1028
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
1029
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
1030
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
1031
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
1032
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
1033
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
1034
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
1035
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
1036
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
1037
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php';
1038
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
1039
+
1040
+        /** Admin Pages */
1041
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1042
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
1043
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
1044
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
1045
+
1046
+        /**
1047
+         * The class responsible for defining all actions that occur in the public-facing
1048
+         * side of the site.
1049
+         */
1050
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1051
+
1052
+        /**
1053
+         * The shortcode abstract class.
1054
+         */
1055
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1056
+
1057
+        /**
1058
+         * The Timeline shortcode.
1059
+         */
1060
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1061
+
1062
+        /**
1063
+         * The Navigator shortcode.
1064
+         */
1065
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1066
+
1067
+        /**
1068
+         * The chord shortcode.
1069
+         */
1070
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1071
+
1072
+        /**
1073
+         * The geomap shortcode.
1074
+         */
1075
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1076
+
1077
+        /**
1078
+         * The entity cloud shortcode.
1079
+         */
1080
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1081
+
1082
+        /**
1083
+         * The entity glossary shortcode.
1084
+         */
1085
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1086
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1087
+
1088
+        /**
1089
+         * The ShareThis service.
1090
+         */
1091
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1092
+
1093
+        /**
1094
+         * The SEO service.
1095
+         */
1096
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1097
+
1098
+        /**
1099
+         * The AMP service.
1100
+         */
1101
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1102
+
1103
+        /** Widgets */
1104
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1105
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1106
+
1107
+        /*
1108 1108
 		 * Schema.org Services.
1109 1109
 		 *
1110 1110
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1111 1111
 		 */
1112
-		if ( WL_ALL_ENTITY_TYPES ) {
1113
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php';
1114
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php';
1115
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php';
1116
-			new Wordlift_Schemaorg_Sync_Service();
1117
-			$schemaorg_property_service = new Wordlift_Schemaorg_Property_Service();
1118
-			new Wordlift_Schemaorg_Class_Service();
1119
-		} else {
1120
-			$schemaorg_property_service = null;
1121
-		}
1112
+        if ( WL_ALL_ENTITY_TYPES ) {
1113
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php';
1114
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php';
1115
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php';
1116
+            new Wordlift_Schemaorg_Sync_Service();
1117
+            $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service();
1118
+            new Wordlift_Schemaorg_Class_Service();
1119
+        } else {
1120
+            $schemaorg_property_service = null;
1121
+        }
1122 1122
 
1123
-		$this->loader = new Wordlift_Loader();
1123
+        $this->loader = new Wordlift_Loader();
1124 1124
 
1125
-		// Instantiate a global logger.
1126
-		global $wl_logger;
1127
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1125
+        // Instantiate a global logger.
1126
+        global $wl_logger;
1127
+        $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1128 1128
 
1129
-		// Load the `wl-api` end-point.
1130
-		new Wordlift_Http_Api();
1129
+        // Load the `wl-api` end-point.
1130
+        new Wordlift_Http_Api();
1131 1131
 
1132
-		// Load the Install Service.
1133
-		$this->install_service = new Wordlift_Install_Service();
1132
+        // Load the Install Service.
1133
+        $this->install_service = new Wordlift_Install_Service();
1134 1134
 
1135
-		/** Services. */
1136
-		// Create the configuration service.
1137
-		$this->configuration_service = new Wordlift_Configuration_Service();
1135
+        /** Services. */
1136
+        // Create the configuration service.
1137
+        $this->configuration_service = new Wordlift_Configuration_Service();
1138 1138
 
1139
-		// Create an entity type service instance. It'll be later bound to the init action.
1140
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1139
+        // Create an entity type service instance. It'll be later bound to the init action.
1140
+        $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1141 1141
 
1142
-		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1143
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1142
+        // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1143
+        $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1144 1144
 
1145
-		// Create an instance of the UI service.
1146
-		$this->ui_service = new Wordlift_UI_Service();
1145
+        // Create an instance of the UI service.
1146
+        $this->ui_service = new Wordlift_UI_Service();
1147 1147
 
1148
-		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1149
-		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
1148
+        // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1149
+        $this->thumbnail_service = new Wordlift_Thumbnail_Service();
1150 1150
 
1151
-		$this->sparql_service        = new Wordlift_Sparql_Service();
1152
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1153
-		$this->notice_service        = new Wordlift_Notice_Service();
1154
-		$this->relation_service      = new Wordlift_Relation_Service();
1151
+        $this->sparql_service        = new Wordlift_Sparql_Service();
1152
+        $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1153
+        $this->notice_service        = new Wordlift_Notice_Service();
1154
+        $this->relation_service      = new Wordlift_Relation_Service();
1155 1155
 
1156
-		$entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1157
-		$this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' );
1158
-		$this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1159
-		$this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1160
-		$this->user_service       = new Wordlift_User_Service( $this->sparql_service, $this->entity_service );
1156
+        $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1157
+        $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' );
1158
+        $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1159
+        $this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1160
+        $this->user_service       = new Wordlift_User_Service( $this->sparql_service, $this->entity_service );
1161 1161
 
1162
-		// Instantiate the JSON-LD service.
1163
-		$property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1162
+        // Instantiate the JSON-LD service.
1163
+        $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1164 1164
 
1165
-		/** Linked Data. */
1166
-		$this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1167
-		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1165
+        /** Linked Data. */
1166
+        $this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1167
+        $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1168 1168
 
1169
-		$this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1169
+        $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1170 1170
 
1171
-		// Create a new instance of the Redirect service.
1172
-		$this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_service );
1173
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1174
-		$this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
1171
+        // Create a new instance of the Redirect service.
1172
+        $this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_service );
1173
+        $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1174
+        $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
1175 1175
 
1176
-		// Create a new instance of the Timeline service and Timeline shortcode.
1177
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1176
+        // Create a new instance of the Timeline service and Timeline shortcode.
1177
+        $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1178 1178
 
1179
-		$this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service );
1179
+        $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service );
1180 1180
 
1181
-		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1181
+        $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1182 1182
 
1183
-		$this->topic_taxonomy_service        = new Wordlift_Topic_Taxonomy_Service();
1184
-		$this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service();
1183
+        $this->topic_taxonomy_service        = new Wordlift_Topic_Taxonomy_Service();
1184
+        $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service();
1185 1185
 
1186
-		// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1187
-		$this->sharethis_service = new Wordlift_ShareThis_Service();
1186
+        // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1187
+        $this->sharethis_service = new Wordlift_ShareThis_Service();
1188 1188
 
1189
-		// Create an instance of the PrimaShop adapter.
1190
-		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1189
+        // Create an instance of the PrimaShop adapter.
1190
+        $this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1191 1191
 
1192
-		// Create an import service instance to hook later to WP's import function.
1193
-		$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() );
1192
+        // Create an import service instance to hook later to WP's import function.
1193
+        $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() );
1194 1194
 
1195
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1195
+        $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1196 1196
 
1197
-		// Create the entity rating service.
1198
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1197
+        // Create the entity rating service.
1198
+        $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1199 1199
 
1200
-		// Create entity list customization (wp-admin/edit.php).
1201
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1200
+        // Create entity list customization (wp-admin/edit.php).
1201
+        $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1202 1202
 
1203
-		// Create a new instance of the Redirect service.
1204
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1203
+        // Create a new instance of the Redirect service.
1204
+        $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1205 1205
 
1206
-		// Create an instance of the Publisher Service and the AJAX Adapter.
1207
-		$this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service );
1208
-		$this->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1209
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1206
+        // Create an instance of the Publisher Service and the AJAX Adapter.
1207
+        $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service );
1208
+        $this->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1209
+        $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1210 1210
 
1211
-		$attachment_service = new Wordlift_Attachment_Service();
1211
+        $attachment_service = new Wordlift_Attachment_Service();
1212 1212
 
1213
-		// Instantiate the JSON-LD service.
1214
-		$property_getter                         = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1215
-		$this->entity_post_to_jsonld_converter   = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service );
1216
-		$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 );
1217
-		$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 );
1218
-		$this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1219
-		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service );
1220
-		$this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1213
+        // Instantiate the JSON-LD service.
1214
+        $property_getter                         = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1215
+        $this->entity_post_to_jsonld_converter   = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service );
1216
+        $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 );
1217
+        $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 );
1218
+        $this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1219
+        $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service );
1220
+        $this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1221 1221
 
1222 1222
 
1223
-		$this->key_validation_service    = new Wordlift_Key_Validation_Service( $this->configuration_service );
1224
-		$this->content_filter_service    = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1225
-		$this->relation_rebuild_service  = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1226
-		$this->sample_data_service       = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1227
-		$this->sample_data_ajax_adapter  = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1228
-		$this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service );
1223
+        $this->key_validation_service    = new Wordlift_Key_Validation_Service( $this->configuration_service );
1224
+        $this->content_filter_service    = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1225
+        $this->relation_rebuild_service  = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1226
+        $this->sample_data_service       = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1227
+        $this->sample_data_ajax_adapter  = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1228
+        $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service );
1229 1229
 
1230
-		// Initialize the shortcodes.
1231
-		new Wordlift_Navigator_Shortcode();
1232
-		new Wordlift_Chord_Shortcode();
1233
-		new Wordlift_Geomap_Shortcode();
1234
-		new Wordlift_Timeline_Shortcode();
1235
-		new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1236
-		new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1230
+        // Initialize the shortcodes.
1231
+        new Wordlift_Navigator_Shortcode();
1232
+        new Wordlift_Chord_Shortcode();
1233
+        new Wordlift_Geomap_Shortcode();
1234
+        new Wordlift_Timeline_Shortcode();
1235
+        new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1236
+        new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1237 1237
 
1238
-		// Initialize the SEO service.
1239
-		new Wordlift_Seo_Service();
1238
+        // Initialize the SEO service.
1239
+        new Wordlift_Seo_Service();
1240 1240
 
1241
-		// Initialize the AMP service.
1242
-		new Wordlift_AMP_Service( $this->jsonld_service );
1241
+        // Initialize the AMP service.
1242
+        new Wordlift_AMP_Service( $this->jsonld_service );
1243 1243
 
1244
-		/** Services. */
1245
-		$this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1246
-		new Wordlift_Image_Service();
1244
+        /** Services. */
1245
+        $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1246
+        new Wordlift_Image_Service();
1247 1247
 
1248
-		/** Adapters. */
1249
-		$this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1250
-		$this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service );
1251
-		$this->tinymce_adapter          = new Wordlift_Tinymce_Adapter( $this );
1252
-		$this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service );
1253
-		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1248
+        /** Adapters. */
1249
+        $this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1250
+        $this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service );
1251
+        $this->tinymce_adapter          = new Wordlift_Tinymce_Adapter( $this );
1252
+        $this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service );
1253
+        $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1254 1254
 
1255
-		/*
1255
+        /*
1256 1256
 		 * Exclude our public js from WP-Rocket.
1257 1257
 		 *
1258 1258
 		 * @since 3.19.4
1259 1259
 		 *
1260 1260
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/842.
1261 1261
 		 */
1262
-		new Wordlift_WpRocket_Adapter();
1263
-
1264
-		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
1265
-		$this->rebuild_service = new Wordlift_Rebuild_Service(
1266
-			$this->sparql_service,
1267
-			$uri_service
1268
-		);
1269
-
1270
-		/** Async Tasks. */
1271
-		new Wordlift_Sparql_Query_Async_Task();
1272
-		new Wordlift_Batch_Analysis_Request_Async_Task();
1273
-		new Wordlift_Batch_Analysis_Complete_Async_Task();
1274
-		new Wordlift_Batch_Analysis_Complete_Async_Task();
1275
-		new Wordlift_Push_References_Async_Task();
1276
-
1277
-		/** WL Autocomplete. */
1278
-		$this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service );
1279
-		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service );
1280
-
1281
-		/** WordPress Admin UI. */
1282
-
1283
-		// UI elements.
1284
-		$this->input_element           = new Wordlift_Admin_Input_Element();
1285
-		$this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1286
-		$this->select2_element         = new Wordlift_Admin_Select2_Element();
1287
-		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1288
-		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1289
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element );
1290
-		$this->author_element          = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element );
1291
-
1292
-		$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 );
1293
-		$this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service );
1294
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1295
-
1296
-		// Pages.
1297
-		new Wordlift_Admin_Post_Edit_Page( $this );
1298
-		new Wordlift_Entity_Type_Admin_Service();
1299
-
1300
-		// create an instance of the entity type list admin page controller.
1301
-		$this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1302
-
1303
-		// create an instance of the entity type etting admin page controller.
1304
-		$this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1305
-
1306
-		/** Widgets */
1307
-		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1308
-
1309
-		/* WordPress Admin. */
1310
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1311
-		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1312
-
1313
-		// Create an instance of the install wizard.
1314
-		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1315
-
1316
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1317
-
1318
-		// User Profile.
1319
-		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1320
-
1321
-		$this->entity_page_service = new Wordlift_Entity_Page_Service();
1322
-
1323
-		// Load the debug service if WP is in debug mode.
1324
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1325
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1326
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1327
-		}
1328
-
1329
-		// Remote Image Service.
1330
-		new Wordlift_Remote_Image_Service();
1331
-	}
1332
-
1333
-	/**
1334
-	 * Define the locale for this plugin for internationalization.
1335
-	 *
1336
-	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1337
-	 * with WordPress.
1338
-	 *
1339
-	 * @since    1.0.0
1340
-	 * @access   private
1341
-	 */
1342
-	private function set_locale() {
1343
-
1344
-		$plugin_i18n = new Wordlift_i18n();
1345
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1346
-
1347
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1348
-
1349
-	}
1350
-
1351
-	/**
1352
-	 * Register all of the hooks related to the admin area functionality
1353
-	 * of the plugin.
1354
-	 *
1355
-	 * @since    1.0.0
1356
-	 * @access   private
1357
-	 */
1358
-	private function define_admin_hooks() {
1359
-
1360
-		$plugin_admin = new Wordlift_Admin(
1361
-			$this->get_plugin_name(),
1362
-			$this->get_version(),
1363
-			$this->configuration_service,
1364
-			$this->notice_service,
1365
-			$this->user_service
1366
-		);
1367
-
1368
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1369
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 );
1370
-
1371
-		// Hook the init action to taxonomy services.
1372
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1373
-		$this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 );
1374
-
1375
-		// Hook the deleted_post_meta action to the Thumbnail service.
1376
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1377
-
1378
-		// Hook the added_post_meta action to the Thumbnail service.
1379
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1380
-
1381
-		// Hook the updated_post_meta action to the Thumbnail service.
1382
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1383
-
1384
-		// Hook the AJAX wl_timeline action to the Timeline service.
1385
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1386
-
1387
-		// Register custom allowed redirect hosts.
1388
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1389
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1390
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1391
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1392
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1393
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1394
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1395
-
1396
-		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1397
-		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1398
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1399
-		$this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1400
-
1401
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1402
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1403
-
1404
-		// Entity listing customization (wp-admin/edit.php)
1405
-		// Add custom columns.
1406
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1407
-		// no explicit entity as it prevents handling of other post types.
1408
-		$this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1409
-		// Add 4W selection.
1410
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1411
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1412
-		$this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1413
-		$this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1414
-
1415
-		/*
1262
+        new Wordlift_WpRocket_Adapter();
1263
+
1264
+        // Create a Rebuild Service instance, which we'll later bound to an ajax call.
1265
+        $this->rebuild_service = new Wordlift_Rebuild_Service(
1266
+            $this->sparql_service,
1267
+            $uri_service
1268
+        );
1269
+
1270
+        /** Async Tasks. */
1271
+        new Wordlift_Sparql_Query_Async_Task();
1272
+        new Wordlift_Batch_Analysis_Request_Async_Task();
1273
+        new Wordlift_Batch_Analysis_Complete_Async_Task();
1274
+        new Wordlift_Batch_Analysis_Complete_Async_Task();
1275
+        new Wordlift_Push_References_Async_Task();
1276
+
1277
+        /** WL Autocomplete. */
1278
+        $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service );
1279
+        $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service );
1280
+
1281
+        /** WordPress Admin UI. */
1282
+
1283
+        // UI elements.
1284
+        $this->input_element           = new Wordlift_Admin_Input_Element();
1285
+        $this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1286
+        $this->select2_element         = new Wordlift_Admin_Select2_Element();
1287
+        $this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1288
+        $tabs_element                  = new Wordlift_Admin_Tabs_Element();
1289
+        $this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element );
1290
+        $this->author_element          = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element );
1291
+
1292
+        $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 );
1293
+        $this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service );
1294
+        $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1295
+
1296
+        // Pages.
1297
+        new Wordlift_Admin_Post_Edit_Page( $this );
1298
+        new Wordlift_Entity_Type_Admin_Service();
1299
+
1300
+        // create an instance of the entity type list admin page controller.
1301
+        $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1302
+
1303
+        // create an instance of the entity type etting admin page controller.
1304
+        $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1305
+
1306
+        /** Widgets */
1307
+        $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1308
+
1309
+        /* WordPress Admin. */
1310
+        $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1311
+        $this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1312
+
1313
+        // Create an instance of the install wizard.
1314
+        $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1315
+
1316
+        $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1317
+
1318
+        // User Profile.
1319
+        new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1320
+
1321
+        $this->entity_page_service = new Wordlift_Entity_Page_Service();
1322
+
1323
+        // Load the debug service if WP is in debug mode.
1324
+        if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1325
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1326
+            new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1327
+        }
1328
+
1329
+        // Remote Image Service.
1330
+        new Wordlift_Remote_Image_Service();
1331
+    }
1332
+
1333
+    /**
1334
+     * Define the locale for this plugin for internationalization.
1335
+     *
1336
+     * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1337
+     * with WordPress.
1338
+     *
1339
+     * @since    1.0.0
1340
+     * @access   private
1341
+     */
1342
+    private function set_locale() {
1343
+
1344
+        $plugin_i18n = new Wordlift_i18n();
1345
+        $plugin_i18n->set_domain( $this->get_plugin_name() );
1346
+
1347
+        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1348
+
1349
+    }
1350
+
1351
+    /**
1352
+     * Register all of the hooks related to the admin area functionality
1353
+     * of the plugin.
1354
+     *
1355
+     * @since    1.0.0
1356
+     * @access   private
1357
+     */
1358
+    private function define_admin_hooks() {
1359
+
1360
+        $plugin_admin = new Wordlift_Admin(
1361
+            $this->get_plugin_name(),
1362
+            $this->get_version(),
1363
+            $this->configuration_service,
1364
+            $this->notice_service,
1365
+            $this->user_service
1366
+        );
1367
+
1368
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1369
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 );
1370
+
1371
+        // Hook the init action to taxonomy services.
1372
+        $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1373
+        $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 );
1374
+
1375
+        // Hook the deleted_post_meta action to the Thumbnail service.
1376
+        $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1377
+
1378
+        // Hook the added_post_meta action to the Thumbnail service.
1379
+        $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1380
+
1381
+        // Hook the updated_post_meta action to the Thumbnail service.
1382
+        $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1383
+
1384
+        // Hook the AJAX wl_timeline action to the Timeline service.
1385
+        $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1386
+
1387
+        // Register custom allowed redirect hosts.
1388
+        $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1389
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1390
+        $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1391
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1392
+        $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1393
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1394
+        $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1395
+
1396
+        // Hook save_post to the entity service to update custom fields (such as alternate labels).
1397
+        // We have a priority of 9 because we want to be executed before data is sent to Redlink.
1398
+        $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1399
+        $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1400
+
1401
+        $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1402
+        $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1403
+
1404
+        // Entity listing customization (wp-admin/edit.php)
1405
+        // Add custom columns.
1406
+        $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1407
+        // no explicit entity as it prevents handling of other post types.
1408
+        $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1409
+        // Add 4W selection.
1410
+        $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1411
+        $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1412
+        $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1413
+        $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1414
+
1415
+        /*
1416 1416
 		 * If `All Entity Types` is disable, use the radio button Walker.
1417 1417
 		 *
1418 1418
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1419 1419
 		 */
1420
-		if ( ! WL_ALL_ENTITY_TYPES ) {
1421
-			$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1422
-		}
1423
-
1424
-		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1425
-		// entities.
1426
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1420
+        if ( ! WL_ALL_ENTITY_TYPES ) {
1421
+            $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1422
+        }
1423
+
1424
+        // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1425
+        // entities.
1426
+        $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1427 1427
 
1428
-		// Filter imported post meta.
1429
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1428
+        // Filter imported post meta.
1429
+        $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1430 1430
 
1431
-		// Notify the import service when an import starts and ends.
1432
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1433
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1431
+        // Notify the import service when an import starts and ends.
1432
+        $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1433
+        $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1434 1434
 
1435
-		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1436
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1437
-		$this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' );
1438
-
1439
-		// Hook the menu to the Download Your Data page.
1440
-		$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1441
-		$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1442
-		$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1443
-
1444
-		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1445
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1435
+        // Hook the AJAX wl_rebuild action to the Rebuild Service.
1436
+        $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1437
+        $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' );
1438
+
1439
+        // Hook the menu to the Download Your Data page.
1440
+        $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1441
+        $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1442
+        $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1443
+
1444
+        // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1445
+        $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1446 1446
 
1447
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1448
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1449
-		$this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' );
1450
-		$this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1451
-
1452
-		// Hook the AJAX wl_validate_key action to the Key Validation service.
1453
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1454
-
1455
-		// Hook the `admin_init` function to the Admin Setup.
1456
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1457
-
1458
-		// Hook the admin_init to the settings page.
1459
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1460
-
1461
-		$this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' );
1462
-
1463
-		// Hook the menu creation on the general wordlift menu creation.
1464
-		$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1465
-		if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) {
1466
-			// Add the functionality only if a flag is set in wp-config.php .
1467
-			$this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 );
1468
-		}
1469
-
1470
-		// Hook key update.
1471
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1472
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1473
-
1474
-		// Add additional action links to the WordLift plugin in the plugins page.
1475
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1476
-
1477
-		// Hook the AJAX `wl_publisher` action name.
1478
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1479
-
1480
-		// Hook row actions for the entity type list admin.
1481
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1482
-
1483
-		/** Ajax actions. */
1484
-		$this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1485
-
1486
-		// Hook capabilities manipulation to allow access to entity type admin
1487
-		// page  on WordPress versions before 4.7.
1488
-		global $wp_version;
1489
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1490
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1491
-		}
1492
-
1493
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1494
-
1495
-		/** Adapters. */
1496
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1497
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' );
1498
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' );
1499
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' );
1500
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' );
1501
-		$this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1502
-
1503
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1504
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1505
-
1506
-
1507
-		$this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 );
1508
-		$this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 );
1509
-
1510
-		// Handle the autocomplete request.
1511
-		add_action( 'wp_ajax_wl_autocomplete', array(
1512
-			$this->autocomplete_adapter,
1513
-			'wl_autocomplete',
1514
-		) );
1515
-		add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1516
-			$this->autocomplete_adapter,
1517
-			'wl_autocomplete',
1518
-		) );
1519
-
1520
-		// Hooks to restrict multisite super admin from manipulating entity types.
1521
-		if ( is_multisite() ) {
1522
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1523
-		}
1524
-
1525
-		$deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service );
1447
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1448
+        $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1449
+        $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' );
1450
+        $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1451
+
1452
+        // Hook the AJAX wl_validate_key action to the Key Validation service.
1453
+        $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1454
+
1455
+        // Hook the `admin_init` function to the Admin Setup.
1456
+        $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1457
+
1458
+        // Hook the admin_init to the settings page.
1459
+        $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1460
+
1461
+        $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' );
1462
+
1463
+        // Hook the menu creation on the general wordlift menu creation.
1464
+        $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1465
+        if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) {
1466
+            // Add the functionality only if a flag is set in wp-config.php .
1467
+            $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 );
1468
+        }
1469
+
1470
+        // Hook key update.
1471
+        $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1472
+        $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1473
+
1474
+        // Add additional action links to the WordLift plugin in the plugins page.
1475
+        $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1476
+
1477
+        // Hook the AJAX `wl_publisher` action name.
1478
+        $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1479
+
1480
+        // Hook row actions for the entity type list admin.
1481
+        $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1482
+
1483
+        /** Ajax actions. */
1484
+        $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1485
+
1486
+        // Hook capabilities manipulation to allow access to entity type admin
1487
+        // page  on WordPress versions before 4.7.
1488
+        global $wp_version;
1489
+        if ( version_compare( $wp_version, '4.7', '<' ) ) {
1490
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1491
+        }
1492
+
1493
+        $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1494
+
1495
+        /** Adapters. */
1496
+        $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1497
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' );
1498
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' );
1499
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' );
1500
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' );
1501
+        $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1502
+
1503
+        $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1504
+        $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1505
+
1506
+
1507
+        $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 );
1508
+        $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 );
1509
+
1510
+        // Handle the autocomplete request.
1511
+        add_action( 'wp_ajax_wl_autocomplete', array(
1512
+            $this->autocomplete_adapter,
1513
+            'wl_autocomplete',
1514
+        ) );
1515
+        add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1516
+            $this->autocomplete_adapter,
1517
+            'wl_autocomplete',
1518
+        ) );
1519
+
1520
+        // Hooks to restrict multisite super admin from manipulating entity types.
1521
+        if ( is_multisite() ) {
1522
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1523
+        }
1524
+
1525
+        $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service );
1526 1526
 
1527
-		add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1528
-		add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1529
-		add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) );
1530
-	}
1531
-
1532
-	/**
1533
-	 * Register all of the hooks related to the public-facing functionality
1534
-	 * of the plugin.
1535
-	 *
1536
-	 * @since    1.0.0
1537
-	 * @access   private
1538
-	 */
1539
-	private function define_public_hooks() {
1540
-
1541
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1527
+        add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1528
+        add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1529
+        add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) );
1530
+    }
1531
+
1532
+    /**
1533
+     * Register all of the hooks related to the public-facing functionality
1534
+     * of the plugin.
1535
+     *
1536
+     * @since    1.0.0
1537
+     * @access   private
1538
+     */
1539
+    private function define_public_hooks() {
1540
+
1541
+        $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1542 1542
 
1543
-		// Register the entity post type.
1544
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1545
-		$this->loader->add_action( 'init', $this->install_service, 'install' );
1543
+        // Register the entity post type.
1544
+        $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1545
+        $this->loader->add_action( 'init', $this->install_service, 'install' );
1546 1546
 
1547
-		// Bind the link generation and handling hooks to the entity link service.
1548
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1549
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1550
-		$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 );
1551
-		$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 );
1552
-
1553
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1554
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1555
-
1556
-		// Hook the content filter service to add entity links.
1557
-		if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1558
-			$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1559
-		}
1560
-
1561
-		// Hook the AJAX wl_timeline action to the Timeline service.
1562
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1563
-
1564
-		// Hook the ShareThis service.
1565
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1566
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1567
-
1568
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1569
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1570
-
1571
-		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1572
-		// in order to tweak WP's `WP_Query` to include entities in queries related
1573
-		// to categories.
1574
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1575
-
1576
-		/*
1547
+        // Bind the link generation and handling hooks to the entity link service.
1548
+        $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1549
+        $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1550
+        $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 );
1551
+        $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 );
1552
+
1553
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1554
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1555
+
1556
+        // Hook the content filter service to add entity links.
1557
+        if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1558
+            $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1559
+        }
1560
+
1561
+        // Hook the AJAX wl_timeline action to the Timeline service.
1562
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1563
+
1564
+        // Hook the ShareThis service.
1565
+        $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1566
+        $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1567
+
1568
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1569
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1570
+
1571
+        // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1572
+        // in order to tweak WP's `WP_Query` to include entities in queries related
1573
+        // to categories.
1574
+        $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1575
+
1576
+        /*
1577 1577
 		 * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service`
1578 1578
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1579 1579
 		 * order of start time.
1580 1580
 		 */
1581
-		$this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1582
-
1583
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1584
-
1585
-		// This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1586
-		$this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1587
-
1588
-	}
1589
-
1590
-	/**
1591
-	 * Run the loader to execute all of the hooks with WordPress.
1592
-	 *
1593
-	 * @since    1.0.0
1594
-	 */
1595
-	public function run() {
1596
-		$this->loader->run();
1597
-	}
1598
-
1599
-	/**
1600
-	 * The name of the plugin used to uniquely identify it within the context of
1601
-	 * WordPress and to define internationalization functionality.
1602
-	 *
1603
-	 * @since     1.0.0
1604
-	 * @return    string    The name of the plugin.
1605
-	 */
1606
-	public function get_plugin_name() {
1607
-		return $this->plugin_name;
1608
-	}
1609
-
1610
-	/**
1611
-	 * The reference to the class that orchestrates the hooks with the plugin.
1612
-	 *
1613
-	 * @since     1.0.0
1614
-	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1615
-	 */
1616
-	public function get_loader() {
1617
-		return $this->loader;
1618
-	}
1619
-
1620
-	/**
1621
-	 * Retrieve the version number of the plugin.
1622
-	 *
1623
-	 * @since     1.0.0
1624
-	 * @return    string    The version number of the plugin.
1625
-	 */
1626
-	public function get_version() {
1627
-		return $this->version;
1628
-	}
1629
-
1630
-	/**
1631
-	 * Load dependencies for WP-CLI.
1632
-	 *
1633
-	 * @since 3.18.0
1634
-	 * @throws Exception
1635
-	 */
1636
-	private function load_cli_dependencies() {
1637
-
1638
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php';
1639
-
1640
-		$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 );
1641
-
1642
-		WP_CLI::add_command( 'wl references push', $push_reference_data_command );
1643
-
1644
-	}
1581
+        $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1582
+
1583
+        $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1584
+
1585
+        // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1586
+        $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1587
+
1588
+    }
1589
+
1590
+    /**
1591
+     * Run the loader to execute all of the hooks with WordPress.
1592
+     *
1593
+     * @since    1.0.0
1594
+     */
1595
+    public function run() {
1596
+        $this->loader->run();
1597
+    }
1598
+
1599
+    /**
1600
+     * The name of the plugin used to uniquely identify it within the context of
1601
+     * WordPress and to define internationalization functionality.
1602
+     *
1603
+     * @since     1.0.0
1604
+     * @return    string    The name of the plugin.
1605
+     */
1606
+    public function get_plugin_name() {
1607
+        return $this->plugin_name;
1608
+    }
1609
+
1610
+    /**
1611
+     * The reference to the class that orchestrates the hooks with the plugin.
1612
+     *
1613
+     * @since     1.0.0
1614
+     * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1615
+     */
1616
+    public function get_loader() {
1617
+        return $this->loader;
1618
+    }
1619
+
1620
+    /**
1621
+     * Retrieve the version number of the plugin.
1622
+     *
1623
+     * @since     1.0.0
1624
+     * @return    string    The version number of the plugin.
1625
+     */
1626
+    public function get_version() {
1627
+        return $this->version;
1628
+    }
1629
+
1630
+    /**
1631
+     * Load dependencies for WP-CLI.
1632
+     *
1633
+     * @since 3.18.0
1634
+     * @throws Exception
1635
+     */
1636
+    private function load_cli_dependencies() {
1637
+
1638
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php';
1639
+
1640
+        $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 );
1641
+
1642
+        WP_CLI::add_command( 'wl references push', $push_reference_data_command );
1643
+
1644
+    }
1645 1645
 
1646 1646
 }
Please login to merge, or discard this patch.
Spacing   +296 added lines, -296 removed lines patch added patch discarded remove patch
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 		$this->define_public_hooks();
720 720
 
721 721
 		// If we're in `WP_CLI` load the related files.
722
-		if ( class_exists( 'WP_CLI' ) ) {
722
+		if (class_exists('WP_CLI')) {
723 723
 			$this->load_cli_dependencies();
724 724
 		}
725 725
 
@@ -761,358 +761,358 @@  discard block
 block discarded – undo
761 761
 		 * The class responsible for orchestrating the actions and filters of the
762 762
 		 * core plugin.
763 763
 		 */
764
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
764
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php';
765 765
 
766 766
 		// The class responsible for plugin uninstall.
767
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
767
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-deactivator-feedback.php';
768 768
 
769 769
 		/**
770 770
 		 * The class responsible for defining internationalization functionality
771 771
 		 * of the plugin.
772 772
 		 */
773
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
773
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php';
774 774
 
775 775
 		/**
776 776
 		 * WordLift's supported languages.
777 777
 		 */
778
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
778
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php';
779 779
 
780 780
 		/**
781 781
 		 * Provide support functions to sanitize data.
782 782
 		 */
783
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
783
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php';
784 784
 
785 785
 		/** Services. */
786
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
787
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
788
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
789
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
790
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
791
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
792
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
793
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
794
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
795
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php';
786
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php';
787
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-http-api.php';
788
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php';
789
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php';
790
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php';
791
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php';
792
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php';
793
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-linked-data-service.php';
794
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-service.php';
795
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-image-service.php';
796 796
 
797 797
 		/**
798 798
 		 * The Query builder.
799 799
 		 */
800
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
800
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php';
801 801
 
802 802
 		/**
803 803
 		 * The Schema service.
804 804
 		 */
805
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
805
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php';
806 806
 
807 807
 		/**
808 808
 		 * The schema:url property service.
809 809
 		 */
810
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
811
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
810
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php';
811
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php';
812 812
 
813 813
 		/**
814 814
 		 * The UI service.
815 815
 		 */
816
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
816
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php';
817 817
 
818 818
 		/**
819 819
 		 * The Thumbnail service.
820 820
 		 */
821
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
821
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php';
822 822
 
823 823
 		/**
824 824
 		 * The Entity Types Taxonomy service.
825 825
 		 */
826
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
826
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-taxonomy-service.php';
827 827
 
828 828
 		/**
829 829
 		 * The Entity service.
830 830
 		 */
831
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
832
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
831
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-uri-service.php';
832
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php';
833 833
 
834 834
 		// Add the entity rating service.
835
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
835
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php';
836 836
 
837 837
 		/**
838 838
 		 * The User service.
839 839
 		 */
840
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
840
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php';
841 841
 
842 842
 		/**
843 843
 		 * The Timeline service.
844 844
 		 */
845
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
845
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php';
846 846
 
847 847
 		/**
848 848
 		 * The Topic Taxonomy service.
849 849
 		 */
850
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
850
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php';
851 851
 
852 852
 		/**
853 853
 		 * The SPARQL service.
854 854
 		 */
855
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
855
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sparql-service.php';
856 856
 
857 857
 		/**
858 858
 		 * The WordLift import service.
859 859
 		 */
860
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
860
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-import-service.php';
861 861
 
862 862
 		/**
863 863
 		 * The WordLift URI service.
864 864
 		 */
865
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
866
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
867
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
865
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php';
866
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php';
867
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-service.php';
868 868
 
869 869
 		/**
870 870
 		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
871 871
 		 */
872
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php';
873
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php';
874
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php';
875
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php';
876
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
872
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-listable.php';
873
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-rebuild-service.php';
874
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-reference-rebuild-service.php';
875
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-service.php';
876
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
877 877
 
878
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
879
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
878
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php';
879
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php';
880 880
 
881 881
 		/**
882 882
 		 * Load the converters.
883 883
 		 */
884
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
885
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
886
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
887
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
888
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
889
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
884
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php';
885
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
886
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php';
887
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php';
888
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php';
889
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-website-converter.php';
890 890
 
891 891
 		/**
892 892
 		 * Load cache-related files.
893 893
 		 */
894
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
894
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/cache/require.php';
895 895
 
896 896
 		/**
897 897
 		 * Load the content filter.
898 898
 		 */
899
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
899
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php';
900 900
 
901 901
 		/*
902 902
 		 * Load the excerpt helper.
903 903
 		 */
904
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
904
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-excerpt-helper.php';
905 905
 
906 906
 		/**
907 907
 		 * Load the JSON-LD service to publish entities using JSON-LD.s
908 908
 		 *
909 909
 		 * @since 3.8.0
910 910
 		 */
911
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
911
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php';
912 912
 
913 913
 		// The Publisher Service and the AJAX adapter.
914
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
915
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
914
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php';
915
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php';
916 916
 
917
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
917
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-adapter.php';
918 918
 
919 919
 		/**
920 920
 		 * Load the WordLift key validation service.
921 921
 		 */
922
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
922
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php';
923 923
 
924 924
 		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
925
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
925
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php';
926 926
 
927 927
 		// Load the `Wordlift_Entity_Page_Service` class definition.
928
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
929
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php';
930
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php';
928
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-page-service.php';
929
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php';
930
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-service.php';
931 931
 
932 932
 		/** Linked Data. */
933
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
934
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
935
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
936
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
937
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
938
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
939
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
940
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
941
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
942
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
943
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
933
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage.php';
934
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
935
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-property-storage.php';
936
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
937
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
938
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-author-storage.php';
939
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
940
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-image-storage.php';
941
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-related-storage.php';
942
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-url-property-storage.php';
943
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage-factory.php';
944 944
 
945 945
 		/** Linked Data Rendition. */
946
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
947
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
948
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
949
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
946
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
947
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
948
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
949
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
950 950
 
951 951
 		/** Services. */
952
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
953
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
952
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-google-analytics-export-service.php';
953
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-service.php';
954 954
 
955 955
 		/** Adapters. */
956
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
957
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
958
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
959
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
960
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php';
961
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php';
956
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php';
957
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php';
958
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-ajax-adapter.php';
959
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-adapter.php';
960
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php';
961
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-wprocket-adapter.php';
962 962
 
963 963
 		/** Async Tasks. */
964
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
965
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
966
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
967
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
968
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php';
969
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php';
970
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
964
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-async-task.php';
965
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
966
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
967
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
968
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-push-references-async-task.php';
969
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-service.php';
970
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-adapter.php';
971 971
 
972
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
972
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-remote-image-service.php';
973 973
 
974 974
 		/**
975 975
 		 * The class responsible for defining all actions that occur in the admin area.
976 976
 		 */
977
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
977
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php';
978 978
 
979 979
 		/**
980 980
 		 * The class to customize the entity list admin page.
981 981
 		 */
982
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
982
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php';
983 983
 
984 984
 		/**
985 985
 		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
986 986
 		 */
987
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
987
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php';
988 988
 
989 989
 		/**
990 990
 		 * The Notice service.
991 991
 		 */
992
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
992
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php';
993 993
 
994 994
 		/**
995 995
 		 * The PrimaShop adapter.
996 996
 		 */
997
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
997
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php';
998 998
 
999 999
 		/**
1000 1000
 		 * The WordLift Dashboard service.
1001 1001
 		 */
1002
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
1002
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php';
1003 1003
 
1004 1004
 		/**
1005 1005
 		 * The admin 'Install wizard' page.
1006 1006
 		 */
1007
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
1007
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php';
1008 1008
 
1009 1009
 		/**
1010 1010
 		 * The WordLift entity type list admin page controller.
1011 1011
 		 */
1012
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1012
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1013 1013
 
1014 1014
 		/**
1015 1015
 		 * The WordLift entity type settings admin page controller.
1016 1016
 		 */
1017
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
1017
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php';
1018 1018
 
1019 1019
 		/**
1020 1020
 		 * The admin 'Download Your Data' page.
1021 1021
 		 */
1022
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
1022
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php';
1023 1023
 
1024 1024
 		/**
1025 1025
 		 * The admin 'WordLift Settings' page.
1026 1026
 		 */
1027
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
1028
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
1029
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
1030
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
1031
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
1032
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
1033
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
1034
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
1035
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
1036
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
1037
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php';
1038
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
1027
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/intf-wordlift-admin-element.php';
1028
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-input-element.php';
1029
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-input-radio-element.php';
1030
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-select2-element.php';
1031
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-language-select-element.php';
1032
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-tabs-element.php';
1033
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-author-element.php';
1034
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-publisher-element.php';
1035
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php';
1036
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php';
1037
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-batch-analysis-page.php';
1038
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php';
1039 1039
 
1040 1040
 		/** Admin Pages */
1041
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1042
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
1043
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
1044
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
1041
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php';
1042
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php';
1043
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-status-page.php';
1044
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-admin-service.php';
1045 1045
 
1046 1046
 		/**
1047 1047
 		 * The class responsible for defining all actions that occur in the public-facing
1048 1048
 		 * side of the site.
1049 1049
 		 */
1050
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1050
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php';
1051 1051
 
1052 1052
 		/**
1053 1053
 		 * The shortcode abstract class.
1054 1054
 		 */
1055
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1055
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php';
1056 1056
 
1057 1057
 		/**
1058 1058
 		 * The Timeline shortcode.
1059 1059
 		 */
1060
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1060
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php';
1061 1061
 
1062 1062
 		/**
1063 1063
 		 * The Navigator shortcode.
1064 1064
 		 */
1065
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1065
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php';
1066 1066
 
1067 1067
 		/**
1068 1068
 		 * The chord shortcode.
1069 1069
 		 */
1070
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1070
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php';
1071 1071
 
1072 1072
 		/**
1073 1073
 		 * The geomap shortcode.
1074 1074
 		 */
1075
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1075
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php';
1076 1076
 
1077 1077
 		/**
1078 1078
 		 * The entity cloud shortcode.
1079 1079
 		 */
1080
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1080
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php';
1081 1081
 
1082 1082
 		/**
1083 1083
 		 * The entity glossary shortcode.
1084 1084
 		 */
1085
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1086
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1085
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-alphabet-service.php';
1086
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-vocabulary-shortcode.php';
1087 1087
 
1088 1088
 		/**
1089 1089
 		 * The ShareThis service.
1090 1090
 		 */
1091
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1091
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php';
1092 1092
 
1093 1093
 		/**
1094 1094
 		 * The SEO service.
1095 1095
 		 */
1096
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1096
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php';
1097 1097
 
1098 1098
 		/**
1099 1099
 		 * The AMP service.
1100 1100
 		 */
1101
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1101
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php';
1102 1102
 
1103 1103
 		/** Widgets */
1104
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1105
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1104
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php';
1105
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php';
1106 1106
 
1107 1107
 		/*
1108 1108
 		 * Schema.org Services.
1109 1109
 		 *
1110 1110
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1111 1111
 		 */
1112
-		if ( WL_ALL_ENTITY_TYPES ) {
1113
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php';
1114
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php';
1115
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php';
1112
+		if (WL_ALL_ENTITY_TYPES) {
1113
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-sync-service.php';
1114
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-property-service.php';
1115
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-class-service.php';
1116 1116
 			new Wordlift_Schemaorg_Sync_Service();
1117 1117
 			$schemaorg_property_service = new Wordlift_Schemaorg_Property_Service();
1118 1118
 			new Wordlift_Schemaorg_Class_Service();
@@ -1124,7 +1124,7 @@  discard block
 block discarded – undo
1124 1124
 
1125 1125
 		// Instantiate a global logger.
1126 1126
 		global $wl_logger;
1127
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1127
+		$wl_logger = Wordlift_Log_Service::get_logger('WordLift');
1128 1128
 
1129 1129
 		// Load the `wl-api` end-point.
1130 1130
 		new Wordlift_Http_Api();
@@ -1137,10 +1137,10 @@  discard block
 block discarded – undo
1137 1137
 		$this->configuration_service = new Wordlift_Configuration_Service();
1138 1138
 
1139 1139
 		// Create an entity type service instance. It'll be later bound to the init action.
1140
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1140
+		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path());
1141 1141
 
1142 1142
 		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1143
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1143
+		$this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_post_type_service, $this->configuration_service->get_entity_base_path());
1144 1144
 
1145 1145
 		// Create an instance of the UI service.
1146 1146
 		$this->ui_service = new Wordlift_UI_Service();
@@ -1149,34 +1149,34 @@  discard block
 block discarded – undo
1149 1149
 		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
1150 1150
 
1151 1151
 		$this->sparql_service        = new Wordlift_Sparql_Service();
1152
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1152
+		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service($this->sparql_service);
1153 1153
 		$this->notice_service        = new Wordlift_Notice_Service();
1154 1154
 		$this->relation_service      = new Wordlift_Relation_Service();
1155 1155
 
1156
-		$entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1157
-		$this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' );
1158
-		$this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1159
-		$this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1160
-		$this->user_service       = new Wordlift_User_Service( $this->sparql_service, $this->entity_service );
1156
+		$entity_uri_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'entity_uri/');
1157
+		$this->file_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'converter/');
1158
+		$this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service($this->configuration_service, $entity_uri_cache_service);
1159
+		$this->entity_service     = new Wordlift_Entity_Service($this->ui_service, $this->relation_service, $this->entity_uri_service);
1160
+		$this->user_service       = new Wordlift_User_Service($this->sparql_service, $this->entity_service);
1161 1161
 
1162 1162
 		// Instantiate the JSON-LD service.
1163
-		$property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1163
+		$property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service);
1164 1164
 
1165 1165
 		/** Linked Data. */
1166
-		$this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1167
-		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1166
+		$this->storage_factory   = new Wordlift_Storage_Factory($this->entity_service, $this->user_service, $property_getter);
1167
+		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory($this->entity_service);
1168 1168
 
1169
-		$this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1169
+		$this->schema_service = new Wordlift_Schema_Service($this->storage_factory, $this->rendition_factory, $this->configuration_service);
1170 1170
 
1171 1171
 		// Create a new instance of the Redirect service.
1172
-		$this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_service );
1173
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1174
-		$this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
1172
+		$this->redirect_service    = new Wordlift_Redirect_Service($this->entity_service);
1173
+		$this->entity_type_service = new Wordlift_Entity_Type_Service($this->schema_service);
1174
+		$this->linked_data_service = new Wordlift_Linked_Data_Service($this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service);
1175 1175
 
1176 1176
 		// Create a new instance of the Timeline service and Timeline shortcode.
1177
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1177
+		$this->timeline_service = new Wordlift_Timeline_Service($this->entity_service, $this->entity_type_service);
1178 1178
 
1179
-		$this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service );
1179
+		$this->batch_analysis_service = new Wordlift_Batch_Analysis_Service($this, $this->configuration_service, $this->file_cache_service);
1180 1180
 
1181 1181
 		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1182 1182
 
@@ -1190,67 +1190,67 @@  discard block
 block discarded – undo
1190 1190
 		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1191 1191
 
1192 1192
 		// Create an import service instance to hook later to WP's import function.
1193
-		$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() );
1193
+		$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());
1194 1194
 
1195
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1195
+		$uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']);
1196 1196
 
1197 1197
 		// Create the entity rating service.
1198
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1198
+		$this->rating_service = new Wordlift_Rating_Service($this->entity_service, $this->entity_type_service, $this->notice_service);
1199 1199
 
1200 1200
 		// Create entity list customization (wp-admin/edit.php).
1201
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1201
+		$this->entity_list_service = new Wordlift_Entity_List_Service($this->rating_service);
1202 1202
 
1203 1203
 		// Create a new instance of the Redirect service.
1204
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1204
+		$this->dashboard_service = new Wordlift_Dashboard_Service($this->rating_service, $this->entity_service);
1205 1205
 
1206 1206
 		// Create an instance of the Publisher Service and the AJAX Adapter.
1207
-		$this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service );
1208
-		$this->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1209
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1207
+		$this->publisher_service = new Wordlift_Publisher_Service($this->configuration_service);
1208
+		$this->property_factory  = new Wordlift_Property_Factory($schema_url_property_service);
1209
+		$this->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service);
1210 1210
 
1211 1211
 		$attachment_service = new Wordlift_Attachment_Service();
1212 1212
 
1213 1213
 		// Instantiate the JSON-LD service.
1214
-		$property_getter                         = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1215
-		$this->entity_post_to_jsonld_converter   = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service );
1216
-		$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 );
1217
-		$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 );
1218
-		$this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1219
-		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service );
1220
-		$this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1221
-
1222
-
1223
-		$this->key_validation_service    = new Wordlift_Key_Validation_Service( $this->configuration_service );
1224
-		$this->content_filter_service    = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1225
-		$this->relation_rebuild_service  = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1226
-		$this->sample_data_service       = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1227
-		$this->sample_data_ajax_adapter  = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1228
-		$this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service );
1214
+		$property_getter                         = Wordlift_Property_Getter_Factory::create($this->entity_service);
1215
+		$this->entity_post_to_jsonld_converter   = new Wordlift_Entity_Post_To_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service);
1216
+		$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);
1217
+		$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);
1218
+		$this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service);
1219
+		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter($this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service);
1220
+		$this->jsonld_service                    = new Wordlift_Jsonld_Service($this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter);
1221
+
1222
+
1223
+		$this->key_validation_service    = new Wordlift_Key_Validation_Service($this->configuration_service);
1224
+		$this->content_filter_service    = new Wordlift_Content_Filter_Service($this->entity_service, $this->configuration_service, $this->entity_uri_service);
1225
+		$this->relation_rebuild_service  = new Wordlift_Relation_Rebuild_Service($this->content_filter_service, $this->entity_service);
1226
+		$this->sample_data_service       = new Wordlift_Sample_Data_Service($this->entity_type_service, $this->configuration_service, $this->user_service);
1227
+		$this->sample_data_ajax_adapter  = new Wordlift_Sample_Data_Ajax_Adapter($this->sample_data_service);
1228
+		$this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service($this->linked_data_service, $this->entity_service, $this->relation_service);
1229 1229
 
1230 1230
 		// Initialize the shortcodes.
1231 1231
 		new Wordlift_Navigator_Shortcode();
1232 1232
 		new Wordlift_Chord_Shortcode();
1233 1233
 		new Wordlift_Geomap_Shortcode();
1234 1234
 		new Wordlift_Timeline_Shortcode();
1235
-		new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1236
-		new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1235
+		new Wordlift_Related_Entities_Cloud_Shortcode($this->relation_service);
1236
+		new Wordlift_Vocabulary_Shortcode($this->configuration_service);
1237 1237
 
1238 1238
 		// Initialize the SEO service.
1239 1239
 		new Wordlift_Seo_Service();
1240 1240
 
1241 1241
 		// Initialize the AMP service.
1242
-		new Wordlift_AMP_Service( $this->jsonld_service );
1242
+		new Wordlift_AMP_Service($this->jsonld_service);
1243 1243
 
1244 1244
 		/** Services. */
1245 1245
 		$this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1246 1246
 		new Wordlift_Image_Service();
1247 1247
 
1248 1248
 		/** Adapters. */
1249
-		$this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1250
-		$this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service );
1251
-		$this->tinymce_adapter          = new Wordlift_Tinymce_Adapter( $this );
1252
-		$this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service );
1253
-		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1249
+		$this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter($this->entity_type_service);
1250
+		$this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter($this->publisher_service);
1251
+		$this->tinymce_adapter          = new Wordlift_Tinymce_Adapter($this);
1252
+		$this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter($this->batch_analysis_service);
1253
+		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter($this->relation_rebuild_service);
1254 1254
 
1255 1255
 		/*
1256 1256
 		 * Exclude our public js from WP-Rocket.
@@ -1275,8 +1275,8 @@  discard block
 block discarded – undo
1275 1275
 		new Wordlift_Push_References_Async_Task();
1276 1276
 
1277 1277
 		/** WL Autocomplete. */
1278
-		$this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service );
1279
-		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service );
1278
+		$this->autocomplete_service = new Wordlift_Autocomplete_Service($this->configuration_service);
1279
+		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter($this->autocomplete_service);
1280 1280
 
1281 1281
 		/** WordPress Admin UI. */
1282 1282
 
@@ -1286,15 +1286,15 @@  discard block
 block discarded – undo
1286 1286
 		$this->select2_element         = new Wordlift_Admin_Select2_Element();
1287 1287
 		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1288 1288
 		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1289
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element );
1290
-		$this->author_element          = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element );
1289
+		$this->publisher_element       = new Wordlift_Admin_Publisher_Element($this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element);
1290
+		$this->author_element          = new Wordlift_Admin_Author_Element($this->publisher_service, $this->select2_element);
1291 1291
 
1292
-		$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 );
1293
-		$this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service );
1294
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1292
+		$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);
1293
+		$this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page($this->batch_analysis_service);
1294
+		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($this->settings_page);
1295 1295
 
1296 1296
 		// Pages.
1297
-		new Wordlift_Admin_Post_Edit_Page( $this );
1297
+		new Wordlift_Admin_Post_Edit_Page($this);
1298 1298
 		new Wordlift_Entity_Type_Admin_Service();
1299 1299
 
1300 1300
 		// create an instance of the entity type list admin page controller.
@@ -1307,23 +1307,23 @@  discard block
 block discarded – undo
1307 1307
 		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1308 1308
 
1309 1309
 		/* WordPress Admin. */
1310
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1311
-		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1310
+		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service);
1311
+		$this->status_page             = new Wordlift_Admin_Status_Page($this->entity_service, $this->sparql_service);
1312 1312
 
1313 1313
 		// Create an instance of the install wizard.
1314
-		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1314
+		$this->admin_setup = new Wordlift_Admin_Setup($this->configuration_service, $this->key_validation_service, $this->entity_service);
1315 1315
 
1316
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1316
+		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($this->entity_post_type_service);
1317 1317
 
1318 1318
 		// User Profile.
1319
-		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1319
+		new Wordlift_Admin_User_Profile_Page($this->author_element, $this->user_service);
1320 1320
 
1321 1321
 		$this->entity_page_service = new Wordlift_Entity_Page_Service();
1322 1322
 
1323 1323
 		// Load the debug service if WP is in debug mode.
1324
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1325
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1326
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1324
+		if (defined('WP_DEBUG') && WP_DEBUG) {
1325
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php';
1326
+			new Wordlift_Debug_Service($this->entity_service, $uri_service);
1327 1327
 		}
1328 1328
 
1329 1329
 		// Remote Image Service.
@@ -1342,9 +1342,9 @@  discard block
 block discarded – undo
1342 1342
 	private function set_locale() {
1343 1343
 
1344 1344
 		$plugin_i18n = new Wordlift_i18n();
1345
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1345
+		$plugin_i18n->set_domain($this->get_plugin_name());
1346 1346
 
1347
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1347
+		$this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain');
1348 1348
 
1349 1349
 	}
1350 1350
 
@@ -1365,168 +1365,168 @@  discard block
 block discarded – undo
1365 1365
 			$this->user_service
1366 1366
 		);
1367 1367
 
1368
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1369
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 );
1368
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles');
1369
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11);
1370 1370
 
1371 1371
 		// Hook the init action to taxonomy services.
1372
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1373
-		$this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 );
1372
+		$this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0);
1373
+		$this->loader->add_action('init', $this->entity_types_taxonomy_service, 'init', 0);
1374 1374
 
1375 1375
 		// Hook the deleted_post_meta action to the Thumbnail service.
1376
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1376
+		$this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4);
1377 1377
 
1378 1378
 		// Hook the added_post_meta action to the Thumbnail service.
1379
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1379
+		$this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4);
1380 1380
 
1381 1381
 		// Hook the updated_post_meta action to the Thumbnail service.
1382
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1382
+		$this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4);
1383 1383
 
1384 1384
 		// Hook the AJAX wl_timeline action to the Timeline service.
1385
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1385
+		$this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline');
1386 1386
 
1387 1387
 		// Register custom allowed redirect hosts.
1388
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1388
+		$this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts');
1389 1389
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1390
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1390
+		$this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect');
1391 1391
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1392
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1392
+		$this->loader->add_action('wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats');
1393 1393
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1394
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1394
+		$this->loader->add_action('wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets');
1395 1395
 
1396 1396
 		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1397 1397
 		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1398
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1399
-		$this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1398
+		$this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3);
1399
+		$this->loader->add_action('save_post', $this->rating_service, 'set_rating_for', 20, 1);
1400 1400
 
1401
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1402
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1401
+		$this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1);
1402
+		$this->loader->add_action('in_admin_header', $this->rating_service, 'in_admin_header');
1403 1403
 
1404 1404
 		// Entity listing customization (wp-admin/edit.php)
1405 1405
 		// Add custom columns.
1406
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1406
+		$this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns');
1407 1407
 		// no explicit entity as it prevents handling of other post types.
1408
-		$this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1408
+		$this->loader->add_filter('manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2);
1409 1409
 		// Add 4W selection.
1410
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1411
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1412
-		$this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1413
-		$this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1410
+		$this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope');
1411
+		$this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope');
1412
+		$this->loader->add_action('pre_get_posts', $this->entity_list_service, 'pre_get_posts');
1413
+		$this->loader->add_action('load-edit.php', $this->entity_list_service, 'load_edit');
1414 1414
 
1415 1415
 		/*
1416 1416
 		 * If `All Entity Types` is disable, use the radio button Walker.
1417 1417
 		 *
1418 1418
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1419 1419
 		 */
1420
-		if ( ! WL_ALL_ENTITY_TYPES ) {
1421
-			$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1420
+		if ( ! WL_ALL_ENTITY_TYPES) {
1421
+			$this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args');
1422 1422
 		}
1423 1423
 
1424 1424
 		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1425 1425
 		// entities.
1426
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1426
+		$this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2);
1427 1427
 
1428 1428
 		// Filter imported post meta.
1429
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1429
+		$this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3);
1430 1430
 
1431 1431
 		// Notify the import service when an import starts and ends.
1432
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1433
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1432
+		$this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0);
1433
+		$this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0);
1434 1434
 
1435 1435
 		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1436
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1437
-		$this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' );
1436
+		$this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild');
1437
+		$this->loader->add_action('wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild');
1438 1438
 
1439 1439
 		// Hook the menu to the Download Your Data page.
1440
-		$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1441
-		$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1442
-		$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1440
+		$this->loader->add_action('admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0);
1441
+		$this->loader->add_action('admin_menu', $this->status_page, 'admin_menu', 100, 0);
1442
+		$this->loader->add_action('admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0);
1443 1443
 
1444 1444
 		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1445
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1445
+		$this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10);
1446 1446
 
1447 1447
 		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1448
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1449
-		$this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' );
1450
-		$this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1448
+		$this->loader->add_action('wp_ajax_wl_jsonld', $this->jsonld_service, 'get');
1449
+		$this->loader->add_action('admin_post_wl_jsonld', $this->jsonld_service, 'get');
1450
+		$this->loader->add_action('admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get');
1451 1451
 
1452 1452
 		// Hook the AJAX wl_validate_key action to the Key Validation service.
1453
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1453
+		$this->loader->add_action('wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key');
1454 1454
 
1455 1455
 		// Hook the `admin_init` function to the Admin Setup.
1456
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1456
+		$this->loader->add_action('admin_init', $this->admin_setup, 'admin_init');
1457 1457
 
1458 1458
 		// Hook the admin_init to the settings page.
1459
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1459
+		$this->loader->add_action('admin_init', $this->settings_page, 'admin_init');
1460 1460
 
1461
-		$this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' );
1461
+		$this->loader->add_filter('admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction');
1462 1462
 
1463 1463
 		// Hook the menu creation on the general wordlift menu creation.
1464
-		$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1465
-		if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) {
1464
+		$this->loader->add_action('wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2);
1465
+		if (defined('WORDLIFT_BATCH') && WORDLIFT_BATCH) {
1466 1466
 			// Add the functionality only if a flag is set in wp-config.php .
1467
-			$this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 );
1467
+			$this->loader->add_action('wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2);
1468 1468
 		}
1469 1469
 
1470 1470
 		// Hook key update.
1471
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1472
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1471
+		$this->loader->add_action('pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2);
1472
+		$this->loader->add_action('update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2);
1473 1473
 
1474 1474
 		// Add additional action links to the WordLift plugin in the plugins page.
1475
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1475
+		$this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1);
1476 1476
 
1477 1477
 		// Hook the AJAX `wl_publisher` action name.
1478
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1478
+		$this->loader->add_action('wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher');
1479 1479
 
1480 1480
 		// Hook row actions for the entity type list admin.
1481
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1481
+		$this->loader->add_filter('wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2);
1482 1482
 
1483 1483
 		/** Ajax actions. */
1484
-		$this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1484
+		$this->loader->add_action('wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export');
1485 1485
 
1486 1486
 		// Hook capabilities manipulation to allow access to entity type admin
1487 1487
 		// page  on WordPress versions before 4.7.
1488 1488
 		global $wp_version;
1489
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1490
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1489
+		if (version_compare($wp_version, '4.7', '<')) {
1490
+			$this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4);
1491 1491
 		}
1492 1492
 
1493
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1493
+		$this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1);
1494 1494
 
1495 1495
 		/** Adapters. */
1496
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1497
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' );
1498
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' );
1499
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' );
1500
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' );
1501
-		$this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1496
+		$this->loader->add_filter('mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1);
1497
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit');
1498
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts');
1499
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel');
1500
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning');
1501
+		$this->loader->add_action('wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all');
1502 1502
 
1503
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1504
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1503
+		$this->loader->add_action('wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create');
1504
+		$this->loader->add_action('wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete');
1505 1505
 
1506 1506
 
1507
-		$this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 );
1508
-		$this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 );
1507
+		$this->loader->add_action('update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5);
1508
+		$this->loader->add_action('delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5);
1509 1509
 
1510 1510
 		// Handle the autocomplete request.
1511
-		add_action( 'wp_ajax_wl_autocomplete', array(
1511
+		add_action('wp_ajax_wl_autocomplete', array(
1512 1512
 			$this->autocomplete_adapter,
1513 1513
 			'wl_autocomplete',
1514
-		) );
1515
-		add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1514
+		));
1515
+		add_action('wp_ajax_nopriv_wl_autocomplete', array(
1516 1516
 			$this->autocomplete_adapter,
1517 1517
 			'wl_autocomplete',
1518
-		) );
1518
+		));
1519 1519
 
1520 1520
 		// Hooks to restrict multisite super admin from manipulating entity types.
1521
-		if ( is_multisite() ) {
1522
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1521
+		if (is_multisite()) {
1522
+			$this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4);
1523 1523
 		}
1524 1524
 
1525
-		$deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service );
1525
+		$deactivator_feedback = new Wordlift_Deactivator_Feedback($this->configuration_service);
1526 1526
 
1527
-		add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1528
-		add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1529
-		add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) );
1527
+		add_action('admin_footer', array($deactivator_feedback, 'render_feedback_popup'));
1528
+		add_action('admin_enqueue_scripts', array($deactivator_feedback, 'enqueue_popup_scripts'));
1529
+		add_action('wp_ajax_wl_deactivation_feedback', array($deactivator_feedback, 'wl_deactivation_feedback'));
1530 1530
 	}
1531 1531
 
1532 1532
 	/**
@@ -1538,52 +1538,52 @@  discard block
 block discarded – undo
1538 1538
 	 */
1539 1539
 	private function define_public_hooks() {
1540 1540
 
1541
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1541
+		$plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version());
1542 1542
 
1543 1543
 		// Register the entity post type.
1544
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1545
-		$this->loader->add_action( 'init', $this->install_service, 'install' );
1544
+		$this->loader->add_action('init', $this->entity_post_type_service, 'register');
1545
+		$this->loader->add_action('init', $this->install_service, 'install');
1546 1546
 
1547 1547
 		// Bind the link generation and handling hooks to the entity link service.
1548
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1549
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1550
-		$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 );
1551
-		$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 );
1548
+		$this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4);
1549
+		$this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1);
1550
+		$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);
1551
+		$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);
1552 1552
 
1553
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1554
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1553
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles');
1554
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts');
1555 1555
 
1556 1556
 		// Hook the content filter service to add entity links.
1557
-		if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1558
-			$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1557
+		if ( ! defined('WL_DISABLE_CONTENT_FILTER') || ! WL_DISABLE_CONTENT_FILTER) {
1558
+			$this->loader->add_filter('the_content', $this->content_filter_service, 'the_content');
1559 1559
 		}
1560 1560
 
1561 1561
 		// Hook the AJAX wl_timeline action to the Timeline service.
1562
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1562
+		$this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline');
1563 1563
 
1564 1564
 		// Hook the ShareThis service.
1565
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1566
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1565
+		$this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99);
1566
+		$this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99);
1567 1567
 
1568 1568
 		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1569
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1569
+		$this->loader->add_action('wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get');
1570 1570
 
1571 1571
 		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1572 1572
 		// in order to tweak WP's `WP_Query` to include entities in queries related
1573 1573
 		// to categories.
1574
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1574
+		$this->loader->add_action('pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1);
1575 1575
 
1576 1576
 		/*
1577 1577
 		 * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service`
1578 1578
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1579 1579
 		 * order of start time.
1580 1580
 		 */
1581
-		$this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1581
+		$this->loader->add_action('pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1);
1582 1582
 
1583
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1583
+		$this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1);
1584 1584
 
1585 1585
 		// This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1586
-		$this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1586
+		$this->loader->add_action('save_post', $this->entity_type_adapter, 'save_post', 9, 3);
1587 1587
 
1588 1588
 	}
1589 1589
 
@@ -1635,11 +1635,11 @@  discard block
 block discarded – undo
1635 1635
 	 */
1636 1636
 	private function load_cli_dependencies() {
1637 1637
 
1638
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php';
1638
+		require_once plugin_dir_path(dirname(__FILE__)).'cli/class-wordlift-push-reference-data-command.php';
1639 1639
 
1640
-		$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 );
1640
+		$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);
1641 1641
 
1642
-		WP_CLI::add_command( 'wl references push', $push_reference_data_command );
1642
+		WP_CLI::add_command('wl references push', $push_reference_data_command);
1643 1643
 
1644 1644
 	}
1645 1645
 
Please login to merge, or discard this patch.