Completed
Push — master ( 5af746...05f5a5 )
by Naveen
01:39 queued 49s
created
src/admin/class-wordlift-admin.php 2 patches
Indentation   +331 added lines, -331 removed lines patch added patch discarded remove patch
@@ -30,393 +30,393 @@
 block discarded – undo
30 30
  */
31 31
 class Wordlift_Admin {
32 32
 
33
-	/**
34
-	 * The singleton instance.
35
-	 *
36
-	 * @since 3.19.4
37
-	 * @access private
38
-	 * @var Wordlift_Admin $instance The singleton instance.
39
-	 */
40
-	private static $instance;
41
-	/**
42
-	 * The ID of this plugin.
43
-	 *
44
-	 * @since    1.0.0
45
-	 * @access   private
46
-	 * @var      string $plugin_name The ID of this plugin.
47
-	 */
48
-	private $plugin_name;
49
-	/**
50
-	 * The version of this plugin.
51
-	 *
52
-	 * @since    1.0.0
53
-	 * @access   private
54
-	 * @var      string $version The current version of this plugin.
55
-	 */
56
-	private $version;
57
-	/**
58
-	 * The {@link Wordlift_User_Service} instance.
59
-	 *
60
-	 * @since  3.14.0
61
-	 * @access private
62
-	 * @var Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance.
63
-	 */
64
-	private $user_service;
65
-	/**
66
-	 * The {@link Wordlift_Batch_Operation_Ajax_Adapter} instance.
67
-	 *
68
-	 * @since 3.20.0
69
-	 * @access private
70
-	 * @var Wordlift_Batch_Operation_Ajax_Adapter $sync_batch_operation_ajax_adapter The {@link Wordlift_Batch_Operation_Ajax_Adapter} instance.
71
-	 */
72
-	private $sync_batch_operation_ajax_adapter;
73
-
74
-	/**
75
-	 * Initialize the class and set its properties.
76
-	 *
77
-	 * @param string $plugin_name The name of this plugin.
78
-	 * @param string $version The version of this plugin.
79
-	 * @param Wordlift_Notice_Service $notice_service The notice service.
80
-	 * @param Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance.
81
-	 *
82
-	 * @since  1.0.0
83
-	 *
84
-	 */
85
-	public function __construct( $plugin_name, $version, $notice_service, $user_service ) {
86
-
87
-		$this->plugin_name = $plugin_name;
88
-		$this->version     = $version;
89
-
90
-		$this->user_service = $user_service;
91
-
92
-		$configuration_service = Wordlift_Configuration_Service::get_instance();
93
-		$dataset_uri           = $configuration_service->get_dataset_uri();
94
-		$key                   = $configuration_service->get_key();
95
-		$features_registry     = Features_Registry::get_instance();
96
-		if ( empty( $dataset_uri ) ) {
97
-			$settings_page = Wordlift_Admin_Settings_Page::get_instance();
98
-			if ( empty( $key ) ) {
99
-				$error = sprintf( esc_html__( "WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' );
100
-			} else {
101
-				$error = sprintf( esc_html__( "WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' );
102
-			}
103
-			$notice_service->add_error( $error );
104
-		}
105
-
106
-		// Load additional code if we're in the admin UI.
107
-		if ( is_admin() ) {
108
-
109
-			// Require the PHP files for the next code fragment.
110
-			self::require_files();
111
-
112
-			/*
33
+    /**
34
+     * The singleton instance.
35
+     *
36
+     * @since 3.19.4
37
+     * @access private
38
+     * @var Wordlift_Admin $instance The singleton instance.
39
+     */
40
+    private static $instance;
41
+    /**
42
+     * The ID of this plugin.
43
+     *
44
+     * @since    1.0.0
45
+     * @access   private
46
+     * @var      string $plugin_name The ID of this plugin.
47
+     */
48
+    private $plugin_name;
49
+    /**
50
+     * The version of this plugin.
51
+     *
52
+     * @since    1.0.0
53
+     * @access   private
54
+     * @var      string $version The current version of this plugin.
55
+     */
56
+    private $version;
57
+    /**
58
+     * The {@link Wordlift_User_Service} instance.
59
+     *
60
+     * @since  3.14.0
61
+     * @access private
62
+     * @var Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance.
63
+     */
64
+    private $user_service;
65
+    /**
66
+     * The {@link Wordlift_Batch_Operation_Ajax_Adapter} instance.
67
+     *
68
+     * @since 3.20.0
69
+     * @access private
70
+     * @var Wordlift_Batch_Operation_Ajax_Adapter $sync_batch_operation_ajax_adapter The {@link Wordlift_Batch_Operation_Ajax_Adapter} instance.
71
+     */
72
+    private $sync_batch_operation_ajax_adapter;
73
+
74
+    /**
75
+     * Initialize the class and set its properties.
76
+     *
77
+     * @param string $plugin_name The name of this plugin.
78
+     * @param string $version The version of this plugin.
79
+     * @param Wordlift_Notice_Service $notice_service The notice service.
80
+     * @param Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance.
81
+     *
82
+     * @since  1.0.0
83
+     *
84
+     */
85
+    public function __construct( $plugin_name, $version, $notice_service, $user_service ) {
86
+
87
+        $this->plugin_name = $plugin_name;
88
+        $this->version     = $version;
89
+
90
+        $this->user_service = $user_service;
91
+
92
+        $configuration_service = Wordlift_Configuration_Service::get_instance();
93
+        $dataset_uri           = $configuration_service->get_dataset_uri();
94
+        $key                   = $configuration_service->get_key();
95
+        $features_registry     = Features_Registry::get_instance();
96
+        if ( empty( $dataset_uri ) ) {
97
+            $settings_page = Wordlift_Admin_Settings_Page::get_instance();
98
+            if ( empty( $key ) ) {
99
+                $error = sprintf( esc_html__( "WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' );
100
+            } else {
101
+                $error = sprintf( esc_html__( "WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' );
102
+            }
103
+            $notice_service->add_error( $error );
104
+        }
105
+
106
+        // Load additional code if we're in the admin UI.
107
+        if ( is_admin() ) {
108
+
109
+            // Require the PHP files for the next code fragment.
110
+            self::require_files();
111
+
112
+            /*
113 113
 			 * @since 3.24.2 This function isn't called anymore because it was causing the Block Category to
114 114
 			 * multiply in Block Editor.
115 115
 			 *
116 116
 			 * @see https://github.com/insideout10/wordlift-plugin/issues/1004
117 117
 			 */
118
-			// Add Wordlift custom block category.
119
-			// self::add_block_category();
118
+            // Add Wordlift custom block category.
119
+            // self::add_block_category();
120 120
 
121
-			new Wordlift_Dashboard_Latest_News();
121
+            new Wordlift_Dashboard_Latest_News();
122 122
 
123
-			/*
123
+            /*
124 124
 			 * Add support for `All Entity Types`.
125 125
 			 *
126 126
 			 * @since 3.20.0
127 127
 			 *
128 128
 			 * @see https://github.com/insideout10/wordlift-plugin/issues/835
129 129
 			 */
130
-			if ( WL_ALL_ENTITY_TYPES ) {
131
-				require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-schemaorg-taxonomy-metabox.php';
132
-				require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-schemaorg-property-metabox.php';
130
+            if ( WL_ALL_ENTITY_TYPES ) {
131
+                require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-schemaorg-taxonomy-metabox.php';
132
+                require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-schemaorg-property-metabox.php';
133 133
 
134
-				// new Wordlift_Admin_Schemaorg_Property_Metabox( Wordlift_Schemaorg_Property_Service::get_instance() );
135
-				/*
134
+                // new Wordlift_Admin_Schemaorg_Property_Metabox( Wordlift_Schemaorg_Property_Service::get_instance() );
135
+                /*
136 136
 				 * The `Mappings` admin page.
137 137
 				 */
138
-				require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-mappings-page.php';
138
+                require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-mappings-page.php';
139 139
 
140 140
 
141
-				/*
141
+                /*
142 142
 				 * Allow sync'ing the schema.org taxonomy with the schema.org json file.
143 143
 				 *
144 144
 				 * @since 3.20.0
145 145
 				 */
146
-				require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-batch-operation.php';
146
+                require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-batch-operation.php';
147 147
 
148
-				$this->sync_batch_operation_ajax_adapter = new Wordlift_Batch_Operation_Ajax_Adapter( new Wordlift_Schemaorg_Sync_Batch_Operation(), 'wl_schemaorg_sync' );
148
+                $this->sync_batch_operation_ajax_adapter = new Wordlift_Batch_Operation_Ajax_Adapter( new Wordlift_Schemaorg_Sync_Batch_Operation(), 'wl_schemaorg_sync' );
149 149
 
150
-			}
150
+            }
151 151
 
152
-			$features_registry->register_feature_from_slug( 'all-entity-types', WL_ALL_ENTITY_TYPES, array(
153
-				$this,
154
-				'load_schema_org_types_page'
155
-			) );
152
+            $features_registry->register_feature_from_slug( 'all-entity-types', WL_ALL_ENTITY_TYPES, array(
153
+                $this,
154
+                'load_schema_org_types_page'
155
+            ) );
156 156
 
157
-			/*
157
+            /*
158 158
 			 * Add the {@link Wordlift_Admin_Term_Adapter}.
159 159
 			 *
160 160
 			 * @since 3.20.0
161 161
 			 */
162
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-term-adapter.php';
163
-			new Wordlift_Admin_Term_Adapter();
162
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-term-adapter.php';
163
+            new Wordlift_Admin_Term_Adapter();
164 164
 
165
-			/*
165
+            /*
166 166
 			 * The new dashboard.
167 167
 			 *
168 168
 			 * @since 3.20.0
169 169
 			 *
170 170
 			 * @see https://github.com/insideout10/wordlift-plugin/issues/879
171 171
 			 */
172
-			new Wordlift_Admin_Dashboard_V2(
173
-				Wordlift_Entity_Service::get_instance()
174
-			);
175
-			new Wordlift_Admin_Not_Enriched_Filter();
176
-
177
-		}
178
-
179
-		// @@todo only load this class if ACF is available.
180
-		// Add support for ACF mappings, so that the admin edit mappings page can pick up ACF support when ACF is available.
181
-		new Acf_Mappings();
182
-
183
-		// Add the Mappings' REST Controller.
184
-		new Mappings_REST_Controller();
185
-
186
-
187
-		$features_registry->register_feature_from_slug(
188
-			'mappings',
189
-			( defined( 'WL_ENABLE_MAPPINGS' ) && WL_ENABLE_MAPPINGS ),
190
-			array( $this, 'init_mappings' ) );
191
-
192
-
193
-		// Set the singleton instance.
194
-		self::$instance = $this;
195
-
196
-	}
197
-
198
-	/**
199
-	 * Require files needed for the Admin UI.
200
-	 *
201
-	 * @since 3.20.0
202
-	 */
203
-	private static function require_files() {
204
-
205
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard-latest-news.php';
206
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard-v2.php';
207
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-not-enriched-filter.php';
208
-
209
-	}
210
-
211
-	/**
212
-	 * Get the singleton instance.
213
-	 *
214
-	 * @return Wordlift_Admin The singleton instance.
215
-	 * @since 3.19.4
216
-	 *
217
-	 */
218
-	public static function get_instance() {
219
-
220
-		return self::$instance;
221
-	}
222
-
223
-	public static function is_gutenberg() {
224
-		if ( function_exists( 'is_gutenberg_page' ) &&
225
-		     is_gutenberg_page()
226
-		) {
227
-			// The Gutenberg plugin is on.
228
-			return true;
229
-		}
230
-		$current_screen = get_current_screen();
231
-		if ( method_exists( $current_screen, 'is_block_editor' ) &&
232
-		     $current_screen->is_block_editor()
233
-		) {
234
-			// Gutenberg page on 5+.
235
-			return true;
236
-		}
237
-
238
-		return false;
239
-	}
240
-
241
-	/**
242
-	 * Register the stylesheets for the admin area.
243
-	 *
244
-	 * @since    1.0.0
245
-	 */
246
-	public function enqueue_styles() {
247
-
248
-		/**
249
-		 * This function is provided for demonstration purposes only.
250
-		 *
251
-		 * An instance of this class should be passed to the run() function
252
-		 * defined in Wordlift_Loader as all of the hooks are defined
253
-		 * in that particular class.
254
-		 *
255
-		 * The Wordlift_Loader will then create the relationship
256
-		 * between the defined hooks and the functions defined in this
257
-		 * class.
258
-		 */
259
-
260
-		wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' );
261
-
262
-	}
263
-
264
-	/**
265
-	 * Register the JavaScript for the admin area.
266
-	 *
267
-	 * @since    1.0.0
268
-	 */
269
-	public function enqueue_scripts() {
270
-
271
-		/*
172
+            new Wordlift_Admin_Dashboard_V2(
173
+                Wordlift_Entity_Service::get_instance()
174
+            );
175
+            new Wordlift_Admin_Not_Enriched_Filter();
176
+
177
+        }
178
+
179
+        // @@todo only load this class if ACF is available.
180
+        // Add support for ACF mappings, so that the admin edit mappings page can pick up ACF support when ACF is available.
181
+        new Acf_Mappings();
182
+
183
+        // Add the Mappings' REST Controller.
184
+        new Mappings_REST_Controller();
185
+
186
+
187
+        $features_registry->register_feature_from_slug(
188
+            'mappings',
189
+            ( defined( 'WL_ENABLE_MAPPINGS' ) && WL_ENABLE_MAPPINGS ),
190
+            array( $this, 'init_mappings' ) );
191
+
192
+
193
+        // Set the singleton instance.
194
+        self::$instance = $this;
195
+
196
+    }
197
+
198
+    /**
199
+     * Require files needed for the Admin UI.
200
+     *
201
+     * @since 3.20.0
202
+     */
203
+    private static function require_files() {
204
+
205
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard-latest-news.php';
206
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard-v2.php';
207
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-not-enriched-filter.php';
208
+
209
+    }
210
+
211
+    /**
212
+     * Get the singleton instance.
213
+     *
214
+     * @return Wordlift_Admin The singleton instance.
215
+     * @since 3.19.4
216
+     *
217
+     */
218
+    public static function get_instance() {
219
+
220
+        return self::$instance;
221
+    }
222
+
223
+    public static function is_gutenberg() {
224
+        if ( function_exists( 'is_gutenberg_page' ) &&
225
+             is_gutenberg_page()
226
+        ) {
227
+            // The Gutenberg plugin is on.
228
+            return true;
229
+        }
230
+        $current_screen = get_current_screen();
231
+        if ( method_exists( $current_screen, 'is_block_editor' ) &&
232
+             $current_screen->is_block_editor()
233
+        ) {
234
+            // Gutenberg page on 5+.
235
+            return true;
236
+        }
237
+
238
+        return false;
239
+    }
240
+
241
+    /**
242
+     * Register the stylesheets for the admin area.
243
+     *
244
+     * @since    1.0.0
245
+     */
246
+    public function enqueue_styles() {
247
+
248
+        /**
249
+         * This function is provided for demonstration purposes only.
250
+         *
251
+         * An instance of this class should be passed to the run() function
252
+         * defined in Wordlift_Loader as all of the hooks are defined
253
+         * in that particular class.
254
+         *
255
+         * The Wordlift_Loader will then create the relationship
256
+         * between the defined hooks and the functions defined in this
257
+         * class.
258
+         */
259
+
260
+        wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' );
261
+
262
+    }
263
+
264
+    /**
265
+     * Register the JavaScript for the admin area.
266
+     *
267
+     * @since    1.0.0
268
+     */
269
+    public function enqueue_scripts() {
270
+
271
+        /*
272 272
 		 * Do not load our scripts on the Filter Urls plugin admin pages.
273 273
 		 *
274 274
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/901
275 275
 		 * @since 3.20.0
276 276
 		 */
277
-		$screen = get_current_screen();
278
-		if ( is_a( $screen, 'WP_Screen' ) && 'filter-urls_page_filter_urls_form' === $screen->id ) {
279
-			return;
280
-		}
277
+        $screen = get_current_screen();
278
+        if ( is_a( $screen, 'WP_Screen' ) && 'filter-urls_page_filter_urls_form' === $screen->id ) {
279
+            return;
280
+        }
281 281
 
282
-		// Enqueue the admin scripts.
283
-		wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/1/admin.js', array(
284
-			'jquery',
285
-			'underscore',
286
-			'backbone',
287
-		), $this->version, false );
282
+        // Enqueue the admin scripts.
283
+        wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/1/admin.js', array(
284
+            'jquery',
285
+            'underscore',
286
+            'backbone',
287
+        ), $this->version, false );
288 288
 
289 289
 
290
-		$params = $this->get_params();
290
+        $params = $this->get_params();
291 291
 
292
-		// Finally output the params as `wlSettings` for JavaScript code.
293
-		wp_localize_script( $this->plugin_name, 'wlSettings', apply_filters( 'wl_admin_settings', $params ) );
292
+        // Finally output the params as `wlSettings` for JavaScript code.
293
+        wp_localize_script( $this->plugin_name, 'wlSettings', apply_filters( 'wl_admin_settings', $params ) );
294 294
 
295
-	}
295
+    }
296 296
 
297
-	/**
298
-	 * Return the settings array by applying filters.
299
-	 * @return array
300
-	 */
301
-	public function get_params() {
302
-		$can_edit_wordlift_entities = current_user_can( 'edit_wordlift_entities' );
303
-		/*
297
+    /**
298
+     * Return the settings array by applying filters.
299
+     * @return array
300
+     */
301
+    public function get_params() {
302
+        $can_edit_wordlift_entities = current_user_can( 'edit_wordlift_entities' );
303
+        /*
304 304
 		 * People that can create entities will see the scope set in the wp-config.php file (by default `cloud`). People
305 305
 		 * that cannot edit create entities will always see the local entities.
306 306
 		 *
307 307
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/839
308 308
 		 */
309
-		$autocomplete_scope = $can_edit_wordlift_entities ? WL_AUTOCOMPLETE_SCOPE : "local";
310
-
311
-		// Set the basic params.
312
-		$params = array(
313
-			// @todo scripts in admin should use wp.post.
314
-			'ajax_url'              => admin_url( 'admin-ajax.php' ),
315
-			// @todo remove specific actions from settings.
316
-			'action'                => 'entity_by_title',
317
-			'datasetUri'            => Wordlift_Configuration_Service::get_instance()->get_dataset_uri(),
318
-			'language'              => Wordlift_Configuration_Service::get_instance()->get_language_code(),
319
-			'link_by_default'       => Wordlift_Configuration_Service::get_instance()->is_link_by_default(),
320
-			// Whether the current user is allowed to create new entities.
321
-			//
322
-			// @see https://github.com/insideout10/wordlift-plugin/issues/561
323
-			// @see https://github.com/insideout10/wordlift-plugin/issues/1267
324
-			'can_create_entities'   => apply_filters( 'wl_feature__enable__dataset', true ) ? ( $can_edit_wordlift_entities ? 'yes' : 'no' ) : 'no',
325
-			'l10n'                  => array(
326
-				'You already published an entity with the same name'                 => __( 'You already published an entity with the same name: ', 'wordlift' ),
327
-				'logo_selection_title'                                               => __( 'WordLift Choose Logo', 'wordlift' ),
328
-				'logo_selection_button'                                              => array( 'text' => __( 'Choose Logo', 'wordlift' ) ),
329
-				'Type at least 3 characters to search...'                            => _x( 'Type at least 3 characters to search...', 'Autocomplete Select', 'wordlift' ),
330
-				'No results found for your search.'                                  => _x( 'No results found: try changing or removing some words.', 'Autocomplete Select', 'wordlift' ),
331
-				'Please wait while we look for entities in the linked data cloud...' => _x( 'Please wait while we look for entities in the linked data cloud...', 'Autocomplete Select', 'wordlift' ),
332
-				'Add keywords to track'                                              => __( 'Add Keywords to track', 'wordlift' ),
333
-			),
334
-			'wl_autocomplete_nonce' => wp_create_nonce( 'wl_autocomplete' ),
335
-			'autocomplete_scope'    => $autocomplete_scope,
336
-			/**
337
-			 * Allow 3rd parties to define the default editor id. This turns useful if 3rd parties load
338
-			 * or change the TinyMCE id.
339
-			 *
340
-			 * The editor id is currently referenced by `src/coffee/editpost-widget/app.services.EditorAdapter.coffee`.
341
-			 *
342
-			 * @param string $editor The default editor id, by default `content`.
343
-			 *
344
-			 * @see https://github.com/insideout10/wordlift-plugin/issues/848
345
-			 *
346
-			 * @since 3.19.4
347
-			 *
348
-			 */
349
-			'default_editor_id'     => apply_filters( 'wl_default_editor_id', 'content' ),
350
-
351
-			'analysis'                     => array( '_wpnonce' => wp_create_nonce( 'wl_analyze' ) ),
352
-			/**
353
-			 * Faceted search default limit
354
-			 *
355
-			 * @since 3.26.1
356
-			 */
357
-			'faceted_search_default_limit' => apply_filters( 'wl_faceted_search_default_limit', 10 ),
358
-			/**
359
-			 * WL Root path, to access in JS
360
-			 *
361
-			 * @since 3.27.3
362
-			 */
363
-			'wl_root'                      => plugin_dir_url( __DIR__ ),
364
-			/**
365
-			 * Enable synonyms, to access in JS
366
-			 * Show classification sidebar, to access in JS
367
-			 *
368
-			 * @since 3.30.0
369
-			 */
370
-			'can_add_synonyms'             => apply_filters( 'wl_feature__enable__add-synonyms', true ),
371
-			'show_classification_sidebar'  => apply_filters( 'wl_feature__enable__classification-sidebar', true ),
372
-			// By default the videoobject should not show.
373
-			'show_videoobject'             => apply_filters( 'wl_feature__enable__videoobject', false )
374
-		);
375
-
376
-		// Set post-related values if there's a current post.
377
-		if ( null !== $post = $entity_being_edited = get_post() ) {
378
-
379
-			$params['post_id']           = $entity_being_edited->ID;
380
-			$entity_service              = Wordlift_Entity_Service::get_instance();
381
-			$params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && $entity_service->is_entity( $post->ID ) && is_numeric( get_the_ID() );
382
-			// We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it
383
-			// from the results, since we don't want the current entity to be discovered by the analysis.
384
-			//
385
-			// See https://github.com/insideout10/wordlift-plugin/issues/345
386
-			$params['itemId']                      = $entity_service->get_uri( $entity_being_edited->ID );
387
-			$params['wl_schemaorg_property_nonce'] = wp_create_nonce( 'wl_schemaorg_property' );
388
-
389
-			/*
309
+        $autocomplete_scope = $can_edit_wordlift_entities ? WL_AUTOCOMPLETE_SCOPE : "local";
310
+
311
+        // Set the basic params.
312
+        $params = array(
313
+            // @todo scripts in admin should use wp.post.
314
+            'ajax_url'              => admin_url( 'admin-ajax.php' ),
315
+            // @todo remove specific actions from settings.
316
+            'action'                => 'entity_by_title',
317
+            'datasetUri'            => Wordlift_Configuration_Service::get_instance()->get_dataset_uri(),
318
+            'language'              => Wordlift_Configuration_Service::get_instance()->get_language_code(),
319
+            'link_by_default'       => Wordlift_Configuration_Service::get_instance()->is_link_by_default(),
320
+            // Whether the current user is allowed to create new entities.
321
+            //
322
+            // @see https://github.com/insideout10/wordlift-plugin/issues/561
323
+            // @see https://github.com/insideout10/wordlift-plugin/issues/1267
324
+            'can_create_entities'   => apply_filters( 'wl_feature__enable__dataset', true ) ? ( $can_edit_wordlift_entities ? 'yes' : 'no' ) : 'no',
325
+            'l10n'                  => array(
326
+                'You already published an entity with the same name'                 => __( 'You already published an entity with the same name: ', 'wordlift' ),
327
+                'logo_selection_title'                                               => __( 'WordLift Choose Logo', 'wordlift' ),
328
+                'logo_selection_button'                                              => array( 'text' => __( 'Choose Logo', 'wordlift' ) ),
329
+                'Type at least 3 characters to search...'                            => _x( 'Type at least 3 characters to search...', 'Autocomplete Select', 'wordlift' ),
330
+                'No results found for your search.'                                  => _x( 'No results found: try changing or removing some words.', 'Autocomplete Select', 'wordlift' ),
331
+                'Please wait while we look for entities in the linked data cloud...' => _x( 'Please wait while we look for entities in the linked data cloud...', 'Autocomplete Select', 'wordlift' ),
332
+                'Add keywords to track'                                              => __( 'Add Keywords to track', 'wordlift' ),
333
+            ),
334
+            'wl_autocomplete_nonce' => wp_create_nonce( 'wl_autocomplete' ),
335
+            'autocomplete_scope'    => $autocomplete_scope,
336
+            /**
337
+             * Allow 3rd parties to define the default editor id. This turns useful if 3rd parties load
338
+             * or change the TinyMCE id.
339
+             *
340
+             * The editor id is currently referenced by `src/coffee/editpost-widget/app.services.EditorAdapter.coffee`.
341
+             *
342
+             * @param string $editor The default editor id, by default `content`.
343
+             *
344
+             * @see https://github.com/insideout10/wordlift-plugin/issues/848
345
+             *
346
+             * @since 3.19.4
347
+             *
348
+             */
349
+            'default_editor_id'     => apply_filters( 'wl_default_editor_id', 'content' ),
350
+
351
+            'analysis'                     => array( '_wpnonce' => wp_create_nonce( 'wl_analyze' ) ),
352
+            /**
353
+             * Faceted search default limit
354
+             *
355
+             * @since 3.26.1
356
+             */
357
+            'faceted_search_default_limit' => apply_filters( 'wl_faceted_search_default_limit', 10 ),
358
+            /**
359
+             * WL Root path, to access in JS
360
+             *
361
+             * @since 3.27.3
362
+             */
363
+            'wl_root'                      => plugin_dir_url( __DIR__ ),
364
+            /**
365
+             * Enable synonyms, to access in JS
366
+             * Show classification sidebar, to access in JS
367
+             *
368
+             * @since 3.30.0
369
+             */
370
+            'can_add_synonyms'             => apply_filters( 'wl_feature__enable__add-synonyms', true ),
371
+            'show_classification_sidebar'  => apply_filters( 'wl_feature__enable__classification-sidebar', true ),
372
+            // By default the videoobject should not show.
373
+            'show_videoobject'             => apply_filters( 'wl_feature__enable__videoobject', false )
374
+        );
375
+
376
+        // Set post-related values if there's a current post.
377
+        if ( null !== $post = $entity_being_edited = get_post() ) {
378
+
379
+            $params['post_id']           = $entity_being_edited->ID;
380
+            $entity_service              = Wordlift_Entity_Service::get_instance();
381
+            $params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && $entity_service->is_entity( $post->ID ) && is_numeric( get_the_ID() );
382
+            // We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it
383
+            // from the results, since we don't want the current entity to be discovered by the analysis.
384
+            //
385
+            // See https://github.com/insideout10/wordlift-plugin/issues/345
386
+            $params['itemId']                      = $entity_service->get_uri( $entity_being_edited->ID );
387
+            $params['wl_schemaorg_property_nonce'] = wp_create_nonce( 'wl_schemaorg_property' );
388
+
389
+            /*
390 390
 			 * Add the `properties` if `WL_ALL_ENTITY_TYPES` is enabled.
391 391
 			 *
392 392
 			 * @see https://github.com/insideout10/wordlift-plugin/issues/835
393 393
 			 */
394
-			if ( WL_ALL_ENTITY_TYPES ) {
395
-				$params['properties'] = Wordlift_Schemaorg_Property_Service::get_instance()->get_all( $post->ID );
396
-			}
397
-
398
-		}
399
-
400
-		return $params;
401
-	}
402
-
403
-	/**
404
-	 * Initialize the mappings.
405
-	 * @return void
406
-	 */
407
-	public function init_mappings() {
408
-		new Admin_Mappings_Page();
409
-		/**
410
-		 * @since 3.27.0
411
-		 * Hooks in to ui of edit mapping screen, add taxonomy as a option.
412
-		 */
413
-		$taxonomy_option = new Taxonomy_Option();
414
-		$taxonomy_option->add_taxonomy_option();
415
-		new Edit_Mappings_Page( new Mappings_Transform_Functions_Registry() );
416
-	}
417
-
418
-	public function load_schema_org_types_page() {
419
-		new Wordlift_Admin_Mappings_Page();
420
-	}
394
+            if ( WL_ALL_ENTITY_TYPES ) {
395
+                $params['properties'] = Wordlift_Schemaorg_Property_Service::get_instance()->get_all( $post->ID );
396
+            }
397
+
398
+        }
399
+
400
+        return $params;
401
+    }
402
+
403
+    /**
404
+     * Initialize the mappings.
405
+     * @return void
406
+     */
407
+    public function init_mappings() {
408
+        new Admin_Mappings_Page();
409
+        /**
410
+         * @since 3.27.0
411
+         * Hooks in to ui of edit mapping screen, add taxonomy as a option.
412
+         */
413
+        $taxonomy_option = new Taxonomy_Option();
414
+        $taxonomy_option->add_taxonomy_option();
415
+        new Edit_Mappings_Page( new Mappings_Transform_Functions_Registry() );
416
+    }
417
+
418
+    public function load_schema_org_types_page() {
419
+        new Wordlift_Admin_Mappings_Page();
420
+    }
421 421
 
422 422
 }
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 * @since  1.0.0
83 83
 	 *
84 84
 	 */
85
-	public function __construct( $plugin_name, $version, $notice_service, $user_service ) {
85
+	public function __construct($plugin_name, $version, $notice_service, $user_service) {
86 86
 
87 87
 		$this->plugin_name = $plugin_name;
88 88
 		$this->version     = $version;
@@ -93,18 +93,18 @@  discard block
 block discarded – undo
93 93
 		$dataset_uri           = $configuration_service->get_dataset_uri();
94 94
 		$key                   = $configuration_service->get_key();
95 95
 		$features_registry     = Features_Registry::get_instance();
96
-		if ( empty( $dataset_uri ) ) {
96
+		if (empty($dataset_uri)) {
97 97
 			$settings_page = Wordlift_Admin_Settings_Page::get_instance();
98
-			if ( empty( $key ) ) {
99
-				$error = sprintf( esc_html__( "WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' );
98
+			if (empty($key)) {
99
+				$error = sprintf(esc_html__("WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift'), '<a href="'.$settings_page->get_url().'">'.esc_html__('settings page', 'wordlift').'</a>');
100 100
 			} else {
101
-				$error = sprintf( esc_html__( "WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' );
101
+				$error = sprintf(esc_html__("WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift'), '<a href="'.$settings_page->get_url().'">'.esc_html__('settings page', 'wordlift').'</a>');
102 102
 			}
103
-			$notice_service->add_error( $error );
103
+			$notice_service->add_error($error);
104 104
 		}
105 105
 
106 106
 		// Load additional code if we're in the admin UI.
107
-		if ( is_admin() ) {
107
+		if (is_admin()) {
108 108
 
109 109
 			// Require the PHP files for the next code fragment.
110 110
 			self::require_files();
@@ -127,15 +127,15 @@  discard block
 block discarded – undo
127 127
 			 *
128 128
 			 * @see https://github.com/insideout10/wordlift-plugin/issues/835
129 129
 			 */
130
-			if ( WL_ALL_ENTITY_TYPES ) {
131
-				require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-schemaorg-taxonomy-metabox.php';
132
-				require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-schemaorg-property-metabox.php';
130
+			if (WL_ALL_ENTITY_TYPES) {
131
+				require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-schemaorg-taxonomy-metabox.php';
132
+				require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-schemaorg-property-metabox.php';
133 133
 
134 134
 				// new Wordlift_Admin_Schemaorg_Property_Metabox( Wordlift_Schemaorg_Property_Service::get_instance() );
135 135
 				/*
136 136
 				 * The `Mappings` admin page.
137 137
 				 */
138
-				require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-mappings-page.php';
138
+				require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-mappings-page.php';
139 139
 
140 140
 
141 141
 				/*
@@ -143,23 +143,23 @@  discard block
 block discarded – undo
143 143
 				 *
144 144
 				 * @since 3.20.0
145 145
 				 */
146
-				require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-batch-operation.php';
146
+				require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-sync-batch-operation.php';
147 147
 
148
-				$this->sync_batch_operation_ajax_adapter = new Wordlift_Batch_Operation_Ajax_Adapter( new Wordlift_Schemaorg_Sync_Batch_Operation(), 'wl_schemaorg_sync' );
148
+				$this->sync_batch_operation_ajax_adapter = new Wordlift_Batch_Operation_Ajax_Adapter(new Wordlift_Schemaorg_Sync_Batch_Operation(), 'wl_schemaorg_sync');
149 149
 
150 150
 			}
151 151
 
152
-			$features_registry->register_feature_from_slug( 'all-entity-types', WL_ALL_ENTITY_TYPES, array(
152
+			$features_registry->register_feature_from_slug('all-entity-types', WL_ALL_ENTITY_TYPES, array(
153 153
 				$this,
154 154
 				'load_schema_org_types_page'
155
-			) );
155
+			));
156 156
 
157 157
 			/*
158 158
 			 * Add the {@link Wordlift_Admin_Term_Adapter}.
159 159
 			 *
160 160
 			 * @since 3.20.0
161 161
 			 */
162
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-term-adapter.php';
162
+			require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-term-adapter.php';
163 163
 			new Wordlift_Admin_Term_Adapter();
164 164
 
165 165
 			/*
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 
187 187
 		$features_registry->register_feature_from_slug(
188 188
 			'mappings',
189
-			( defined( 'WL_ENABLE_MAPPINGS' ) && WL_ENABLE_MAPPINGS ),
190
-			array( $this, 'init_mappings' ) );
189
+			(defined('WL_ENABLE_MAPPINGS') && WL_ENABLE_MAPPINGS),
190
+			array($this, 'init_mappings') );
191 191
 
192 192
 
193 193
 		// Set the singleton instance.
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	private static function require_files() {
204 204
 
205
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard-latest-news.php';
206
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard-v2.php';
207
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-not-enriched-filter.php';
205
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard-latest-news.php';
206
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard-v2.php';
207
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-not-enriched-filter.php';
208 208
 
209 209
 	}
210 210
 
@@ -221,14 +221,14 @@  discard block
 block discarded – undo
221 221
 	}
222 222
 
223 223
 	public static function is_gutenberg() {
224
-		if ( function_exists( 'is_gutenberg_page' ) &&
224
+		if (function_exists('is_gutenberg_page') &&
225 225
 		     is_gutenberg_page()
226 226
 		) {
227 227
 			// The Gutenberg plugin is on.
228 228
 			return true;
229 229
 		}
230 230
 		$current_screen = get_current_screen();
231
-		if ( method_exists( $current_screen, 'is_block_editor' ) &&
231
+		if (method_exists($current_screen, 'is_block_editor') &&
232 232
 		     $current_screen->is_block_editor()
233 233
 		) {
234 234
 			// Gutenberg page on 5+.
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 		 * class.
258 258
 		 */
259 259
 
260
-		wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' );
260
+		wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/wordlift-admin.css', array(), $this->version, 'all');
261 261
 
262 262
 	}
263 263
 
@@ -275,22 +275,22 @@  discard block
 block discarded – undo
275 275
 		 * @since 3.20.0
276 276
 		 */
277 277
 		$screen = get_current_screen();
278
-		if ( is_a( $screen, 'WP_Screen' ) && 'filter-urls_page_filter_urls_form' === $screen->id ) {
278
+		if (is_a($screen, 'WP_Screen') && 'filter-urls_page_filter_urls_form' === $screen->id) {
279 279
 			return;
280 280
 		}
281 281
 
282 282
 		// Enqueue the admin scripts.
283
-		wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/1/admin.js', array(
283
+		wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/1/admin.js', array(
284 284
 			'jquery',
285 285
 			'underscore',
286 286
 			'backbone',
287
-		), $this->version, false );
287
+		), $this->version, false);
288 288
 
289 289
 
290 290
 		$params = $this->get_params();
291 291
 
292 292
 		// Finally output the params as `wlSettings` for JavaScript code.
293
-		wp_localize_script( $this->plugin_name, 'wlSettings', apply_filters( 'wl_admin_settings', $params ) );
293
+		wp_localize_script($this->plugin_name, 'wlSettings', apply_filters('wl_admin_settings', $params));
294 294
 
295 295
 	}
296 296
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 * @return array
300 300
 	 */
301 301
 	public function get_params() {
302
-		$can_edit_wordlift_entities = current_user_can( 'edit_wordlift_entities' );
302
+		$can_edit_wordlift_entities = current_user_can('edit_wordlift_entities');
303 303
 		/*
304 304
 		 * People that can create entities will see the scope set in the wp-config.php file (by default `cloud`). People
305 305
 		 * that cannot edit create entities will always see the local entities.
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 		// Set the basic params.
312 312
 		$params = array(
313 313
 			// @todo scripts in admin should use wp.post.
314
-			'ajax_url'              => admin_url( 'admin-ajax.php' ),
314
+			'ajax_url'              => admin_url('admin-ajax.php'),
315 315
 			// @todo remove specific actions from settings.
316 316
 			'action'                => 'entity_by_title',
317 317
 			'datasetUri'            => Wordlift_Configuration_Service::get_instance()->get_dataset_uri(),
@@ -321,17 +321,17 @@  discard block
 block discarded – undo
321 321
 			//
322 322
 			// @see https://github.com/insideout10/wordlift-plugin/issues/561
323 323
 			// @see https://github.com/insideout10/wordlift-plugin/issues/1267
324
-			'can_create_entities'   => apply_filters( 'wl_feature__enable__dataset', true ) ? ( $can_edit_wordlift_entities ? 'yes' : 'no' ) : 'no',
324
+			'can_create_entities'   => apply_filters('wl_feature__enable__dataset', true) ? ($can_edit_wordlift_entities ? 'yes' : 'no') : 'no',
325 325
 			'l10n'                  => array(
326
-				'You already published an entity with the same name'                 => __( 'You already published an entity with the same name: ', 'wordlift' ),
327
-				'logo_selection_title'                                               => __( 'WordLift Choose Logo', 'wordlift' ),
328
-				'logo_selection_button'                                              => array( 'text' => __( 'Choose Logo', 'wordlift' ) ),
329
-				'Type at least 3 characters to search...'                            => _x( 'Type at least 3 characters to search...', 'Autocomplete Select', 'wordlift' ),
330
-				'No results found for your search.'                                  => _x( 'No results found: try changing or removing some words.', 'Autocomplete Select', 'wordlift' ),
331
-				'Please wait while we look for entities in the linked data cloud...' => _x( 'Please wait while we look for entities in the linked data cloud...', 'Autocomplete Select', 'wordlift' ),
332
-				'Add keywords to track'                                              => __( 'Add Keywords to track', 'wordlift' ),
326
+				'You already published an entity with the same name'                 => __('You already published an entity with the same name: ', 'wordlift'),
327
+				'logo_selection_title'                                               => __('WordLift Choose Logo', 'wordlift'),
328
+				'logo_selection_button'                                              => array('text' => __('Choose Logo', 'wordlift')),
329
+				'Type at least 3 characters to search...'                            => _x('Type at least 3 characters to search...', 'Autocomplete Select', 'wordlift'),
330
+				'No results found for your search.'                                  => _x('No results found: try changing or removing some words.', 'Autocomplete Select', 'wordlift'),
331
+				'Please wait while we look for entities in the linked data cloud...' => _x('Please wait while we look for entities in the linked data cloud...', 'Autocomplete Select', 'wordlift'),
332
+				'Add keywords to track'                                              => __('Add Keywords to track', 'wordlift'),
333 333
 			),
334
-			'wl_autocomplete_nonce' => wp_create_nonce( 'wl_autocomplete' ),
334
+			'wl_autocomplete_nonce' => wp_create_nonce('wl_autocomplete'),
335 335
 			'autocomplete_scope'    => $autocomplete_scope,
336 336
 			/**
337 337
 			 * Allow 3rd parties to define the default editor id. This turns useful if 3rd parties load
@@ -346,53 +346,53 @@  discard block
 block discarded – undo
346 346
 			 * @since 3.19.4
347 347
 			 *
348 348
 			 */
349
-			'default_editor_id'     => apply_filters( 'wl_default_editor_id', 'content' ),
349
+			'default_editor_id'     => apply_filters('wl_default_editor_id', 'content'),
350 350
 
351
-			'analysis'                     => array( '_wpnonce' => wp_create_nonce( 'wl_analyze' ) ),
351
+			'analysis'                     => array('_wpnonce' => wp_create_nonce('wl_analyze')),
352 352
 			/**
353 353
 			 * Faceted search default limit
354 354
 			 *
355 355
 			 * @since 3.26.1
356 356
 			 */
357
-			'faceted_search_default_limit' => apply_filters( 'wl_faceted_search_default_limit', 10 ),
357
+			'faceted_search_default_limit' => apply_filters('wl_faceted_search_default_limit', 10),
358 358
 			/**
359 359
 			 * WL Root path, to access in JS
360 360
 			 *
361 361
 			 * @since 3.27.3
362 362
 			 */
363
-			'wl_root'                      => plugin_dir_url( __DIR__ ),
363
+			'wl_root'                      => plugin_dir_url(__DIR__),
364 364
 			/**
365 365
 			 * Enable synonyms, to access in JS
366 366
 			 * Show classification sidebar, to access in JS
367 367
 			 *
368 368
 			 * @since 3.30.0
369 369
 			 */
370
-			'can_add_synonyms'             => apply_filters( 'wl_feature__enable__add-synonyms', true ),
371
-			'show_classification_sidebar'  => apply_filters( 'wl_feature__enable__classification-sidebar', true ),
370
+			'can_add_synonyms'             => apply_filters('wl_feature__enable__add-synonyms', true),
371
+			'show_classification_sidebar'  => apply_filters('wl_feature__enable__classification-sidebar', true),
372 372
 			// By default the videoobject should not show.
373
-			'show_videoobject'             => apply_filters( 'wl_feature__enable__videoobject', false )
373
+			'show_videoobject'             => apply_filters('wl_feature__enable__videoobject', false)
374 374
 		);
375 375
 
376 376
 		// Set post-related values if there's a current post.
377
-		if ( null !== $post = $entity_being_edited = get_post() ) {
377
+		if (null !== $post = $entity_being_edited = get_post()) {
378 378
 
379 379
 			$params['post_id']           = $entity_being_edited->ID;
380 380
 			$entity_service              = Wordlift_Entity_Service::get_instance();
381
-			$params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && $entity_service->is_entity( $post->ID ) && is_numeric( get_the_ID() );
381
+			$params['entityBeingEdited'] = isset($entity_being_edited->post_type) && $entity_service->is_entity($post->ID) && is_numeric(get_the_ID());
382 382
 			// We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it
383 383
 			// from the results, since we don't want the current entity to be discovered by the analysis.
384 384
 			//
385 385
 			// See https://github.com/insideout10/wordlift-plugin/issues/345
386
-			$params['itemId']                      = $entity_service->get_uri( $entity_being_edited->ID );
387
-			$params['wl_schemaorg_property_nonce'] = wp_create_nonce( 'wl_schemaorg_property' );
386
+			$params['itemId']                      = $entity_service->get_uri($entity_being_edited->ID);
387
+			$params['wl_schemaorg_property_nonce'] = wp_create_nonce('wl_schemaorg_property');
388 388
 
389 389
 			/*
390 390
 			 * Add the `properties` if `WL_ALL_ENTITY_TYPES` is enabled.
391 391
 			 *
392 392
 			 * @see https://github.com/insideout10/wordlift-plugin/issues/835
393 393
 			 */
394
-			if ( WL_ALL_ENTITY_TYPES ) {
395
-				$params['properties'] = Wordlift_Schemaorg_Property_Service::get_instance()->get_all( $post->ID );
394
+			if (WL_ALL_ENTITY_TYPES) {
395
+				$params['properties'] = Wordlift_Schemaorg_Property_Service::get_instance()->get_all($post->ID);
396 396
 			}
397 397
 
398 398
 		}
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 		 */
413 413
 		$taxonomy_option = new Taxonomy_Option();
414 414
 		$taxonomy_option->add_taxonomy_option();
415
-		new Edit_Mappings_Page( new Mappings_Transform_Functions_Registry() );
415
+		new Edit_Mappings_Page(new Mappings_Transform_Functions_Registry());
416 416
 	}
417 417
 
418 418
 	public function load_schema_org_types_page() {
Please login to merge, or discard this patch.