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