Completed
Push — develop ( 1753bd...a73cd0 )
by David
02:54
created
src/admin/class-wordlift-admin.php 2 patches
Indentation   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -22,129 +22,129 @@
 block discarded – undo
22 22
  */
23 23
 class Wordlift_Admin {
24 24
 
25
-	/**
26
-	 * The ID of this plugin.
27
-	 *
28
-	 * @since    1.0.0
29
-	 * @access   private
30
-	 * @var      string $plugin_name The ID of this plugin.
31
-	 */
32
-	private $plugin_name;
33
-
34
-	/**
35
-	 * The version of this plugin.
36
-	 *
37
-	 * @since    1.0.0
38
-	 * @access   private
39
-	 * @var      string $version The current version of this plugin.
40
-	 */
41
-	private $version;
42
-
43
-	/**
44
-	 * Initialize the class and set its properties.
45
-	 *
46
-	 * @since    1.0.0
47
-	 *
48
-	 * @param   string                           $plugin_name           The name of this plugin.
49
-	 * @param   string                           $version               The version of this plugin.
50
-	 * @param    \Wordlift_Configuration_Service $configuration_service The configuration service.
51
-	 * @param    \Wordlift_Notice_Service        $notice_service        The notice service.
52
-	 */
53
-	public function __construct( $plugin_name, $version, $configuration_service, $notice_service ) {
54
-
55
-		$this->plugin_name = $plugin_name;
56
-		$this->version     = $version;
57
-		if ( empty( $configuration_service->get_dataset_uri() ) ) {
58
-			if ( empty( $configuration_service->get_key() ) ) {
59
-				$error = __( 'WordLift\'s key is unset: WordLift requires a key.', 'wordlift' );
60
-			} else {
61
-				$error = __( 'WordLift\'s dataset URI is unset: please retry WordLift\'s configuration.', 'wordlift' );
62
-			}
63
-			$notice_service->add_error( $error );
64
-		}
65
-
66
-	}
67
-
68
-	/**
69
-	 * Register the stylesheets for the admin area.
70
-	 *
71
-	 * @since    1.0.0
72
-	 */
73
-	public function enqueue_styles() {
74
-
75
-		/**
76
-		 * This function is provided for demonstration purposes only.
77
-		 *
78
-		 * An instance of this class should be passed to the run() function
79
-		 * defined in Wordlift_Loader as all of the hooks are defined
80
-		 * in that particular class.
81
-		 *
82
-		 * The Wordlift_Loader will then create the relationship
83
-		 * between the defined hooks and the functions defined in this
84
-		 * class.
85
-		 */
86
-
87
-		wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' );
88
-
89
-	}
90
-
91
-	/**
92
-	 * Register the JavaScript for the admin area.
93
-	 *
94
-	 * @since    1.0.0
95
-	 */
96
-	public function enqueue_scripts() {
97
-
98
-		/**
99
-		 * This function is provided for demonstration purposes only.
100
-		 *
101
-		 * An instance of this class should be passed to the run() function
102
-		 * defined in Wordlift_Loader as all of the hooks are defined
103
-		 * in that particular class.
104
-		 *
105
-		 * The Wordlift_Loader will then create the relationship
106
-		 * between the defined hooks and the functions defined in this
107
-		 * class.
108
-		 */
109
-
110
-		// Enqueue the admin scripts.
111
-		wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-admin.bundle.js', array(
112
-			'jquery',
113
-			'underscore',
114
-			'backbone',
115
-		), $this->version, false );
116
-
117
-		// Set the basic params.
118
-		$params = array(
119
-			// @todo scripts in admin should use wp.post.
120
-			'ajax_url'   => admin_url( 'admin-ajax.php' ),
121
-			// @todo remove specific actions from settings.
122
-			'action'     => 'entity_by_title',
123
-			'datasetUri' => Wordlift_Configuration_Service::get_instance()->get_dataset_uri(),
124
-			'language'   => Wordlift_Configuration_Service::get_instance()->get_language_code(),
125
-			'l10n'       => array(
126
-				'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ),
127
-				'logo_selection_title'                               => __( 'WordLift Choose Logo', 'wordlift' ),
128
-				'logo_selection_button'                              => array( 'text' => __( 'Choose Logo', 'wordlift' ) ),
129
-			),
130
-		);
131
-
132
-		// Set post-related values if there's a current post.
133
-		if ( null !== $post = $entity_being_edited = get_post() ) {
134
-
135
-			$params['post_id']           = $entity_being_edited->ID;
136
-			$params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && Wordlift_Entity_Service::TYPE_NAME == $entity_being_edited->post_type && is_numeric( get_the_ID() );
137
-			// We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it
138
-			// from the results, since we don't want the current entity to be discovered by the analysis.
139
-			//
140
-			// See https://github.com/insideout10/wordlift-plugin/issues/345
141
-			$params['itemId'] = Wordlift_Entity_Service::get_instance()->get_uri( $entity_being_edited->ID );
142
-
143
-		}
144
-
145
-		// Finally output the params as `wlSettings` for JavaScript code.
146
-		wp_localize_script( $this->plugin_name, 'wlSettings', $params );
147
-
148
-	}
25
+    /**
26
+     * The ID of this plugin.
27
+     *
28
+     * @since    1.0.0
29
+     * @access   private
30
+     * @var      string $plugin_name The ID of this plugin.
31
+     */
32
+    private $plugin_name;
33
+
34
+    /**
35
+     * The version of this plugin.
36
+     *
37
+     * @since    1.0.0
38
+     * @access   private
39
+     * @var      string $version The current version of this plugin.
40
+     */
41
+    private $version;
42
+
43
+    /**
44
+     * Initialize the class and set its properties.
45
+     *
46
+     * @since    1.0.0
47
+     *
48
+     * @param   string                           $plugin_name           The name of this plugin.
49
+     * @param   string                           $version               The version of this plugin.
50
+     * @param    \Wordlift_Configuration_Service $configuration_service The configuration service.
51
+     * @param    \Wordlift_Notice_Service        $notice_service        The notice service.
52
+     */
53
+    public function __construct( $plugin_name, $version, $configuration_service, $notice_service ) {
54
+
55
+        $this->plugin_name = $plugin_name;
56
+        $this->version     = $version;
57
+        if ( empty( $configuration_service->get_dataset_uri() ) ) {
58
+            if ( empty( $configuration_service->get_key() ) ) {
59
+                $error = __( 'WordLift\'s key is unset: WordLift requires a key.', 'wordlift' );
60
+            } else {
61
+                $error = __( 'WordLift\'s dataset URI is unset: please retry WordLift\'s configuration.', 'wordlift' );
62
+            }
63
+            $notice_service->add_error( $error );
64
+        }
65
+
66
+    }
67
+
68
+    /**
69
+     * Register the stylesheets for the admin area.
70
+     *
71
+     * @since    1.0.0
72
+     */
73
+    public function enqueue_styles() {
74
+
75
+        /**
76
+         * This function is provided for demonstration purposes only.
77
+         *
78
+         * An instance of this class should be passed to the run() function
79
+         * defined in Wordlift_Loader as all of the hooks are defined
80
+         * in that particular class.
81
+         *
82
+         * The Wordlift_Loader will then create the relationship
83
+         * between the defined hooks and the functions defined in this
84
+         * class.
85
+         */
86
+
87
+        wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' );
88
+
89
+    }
90
+
91
+    /**
92
+     * Register the JavaScript for the admin area.
93
+     *
94
+     * @since    1.0.0
95
+     */
96
+    public function enqueue_scripts() {
97
+
98
+        /**
99
+         * This function is provided for demonstration purposes only.
100
+         *
101
+         * An instance of this class should be passed to the run() function
102
+         * defined in Wordlift_Loader as all of the hooks are defined
103
+         * in that particular class.
104
+         *
105
+         * The Wordlift_Loader will then create the relationship
106
+         * between the defined hooks and the functions defined in this
107
+         * class.
108
+         */
109
+
110
+        // Enqueue the admin scripts.
111
+        wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-admin.bundle.js', array(
112
+            'jquery',
113
+            'underscore',
114
+            'backbone',
115
+        ), $this->version, false );
116
+
117
+        // Set the basic params.
118
+        $params = array(
119
+            // @todo scripts in admin should use wp.post.
120
+            'ajax_url'   => admin_url( 'admin-ajax.php' ),
121
+            // @todo remove specific actions from settings.
122
+            'action'     => 'entity_by_title',
123
+            'datasetUri' => Wordlift_Configuration_Service::get_instance()->get_dataset_uri(),
124
+            'language'   => Wordlift_Configuration_Service::get_instance()->get_language_code(),
125
+            'l10n'       => array(
126
+                'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ),
127
+                'logo_selection_title'                               => __( 'WordLift Choose Logo', 'wordlift' ),
128
+                'logo_selection_button'                              => array( 'text' => __( 'Choose Logo', 'wordlift' ) ),
129
+            ),
130
+        );
131
+
132
+        // Set post-related values if there's a current post.
133
+        if ( null !== $post = $entity_being_edited = get_post() ) {
134
+
135
+            $params['post_id']           = $entity_being_edited->ID;
136
+            $params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && Wordlift_Entity_Service::TYPE_NAME == $entity_being_edited->post_type && is_numeric( get_the_ID() );
137
+            // We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it
138
+            // from the results, since we don't want the current entity to be discovered by the analysis.
139
+            //
140
+            // See https://github.com/insideout10/wordlift-plugin/issues/345
141
+            $params['itemId'] = Wordlift_Entity_Service::get_instance()->get_uri( $entity_being_edited->ID );
142
+
143
+        }
144
+
145
+        // Finally output the params as `wlSettings` for JavaScript code.
146
+        wp_localize_script( $this->plugin_name, 'wlSettings', $params );
147
+
148
+    }
149 149
 
150 150
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -50,17 +50,17 @@  discard block
 block discarded – undo
50 50
 	 * @param    \Wordlift_Configuration_Service $configuration_service The configuration service.
51 51
 	 * @param    \Wordlift_Notice_Service        $notice_service        The notice service.
52 52
 	 */
53
-	public function __construct( $plugin_name, $version, $configuration_service, $notice_service ) {
53
+	public function __construct($plugin_name, $version, $configuration_service, $notice_service) {
54 54
 
55 55
 		$this->plugin_name = $plugin_name;
56 56
 		$this->version     = $version;
57
-		if ( empty( $configuration_service->get_dataset_uri() ) ) {
58
-			if ( empty( $configuration_service->get_key() ) ) {
59
-				$error = __( 'WordLift\'s key is unset: WordLift requires a key.', 'wordlift' );
57
+		if (empty($configuration_service->get_dataset_uri())) {
58
+			if (empty($configuration_service->get_key())) {
59
+				$error = __('WordLift\'s key is unset: WordLift requires a key.', 'wordlift');
60 60
 			} else {
61
-				$error = __( 'WordLift\'s dataset URI is unset: please retry WordLift\'s configuration.', 'wordlift' );
61
+				$error = __('WordLift\'s dataset URI is unset: please retry WordLift\'s configuration.', 'wordlift');
62 62
 			}
63
-			$notice_service->add_error( $error );
63
+			$notice_service->add_error($error);
64 64
 		}
65 65
 
66 66
 	}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		 * class.
85 85
 		 */
86 86
 
87
-		wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' );
87
+		wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/wordlift-admin.css', array(), $this->version, 'all');
88 88
 
89 89
 	}
90 90
 
@@ -108,42 +108,42 @@  discard block
 block discarded – undo
108 108
 		 */
109 109
 
110 110
 		// Enqueue the admin scripts.
111
-		wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-admin.bundle.js', array(
111
+		wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/wordlift-admin.bundle.js', array(
112 112
 			'jquery',
113 113
 			'underscore',
114 114
 			'backbone',
115
-		), $this->version, false );
115
+		), $this->version, false);
116 116
 
117 117
 		// Set the basic params.
118 118
 		$params = array(
119 119
 			// @todo scripts in admin should use wp.post.
120
-			'ajax_url'   => admin_url( 'admin-ajax.php' ),
120
+			'ajax_url'   => admin_url('admin-ajax.php'),
121 121
 			// @todo remove specific actions from settings.
122 122
 			'action'     => 'entity_by_title',
123 123
 			'datasetUri' => Wordlift_Configuration_Service::get_instance()->get_dataset_uri(),
124 124
 			'language'   => Wordlift_Configuration_Service::get_instance()->get_language_code(),
125 125
 			'l10n'       => array(
126
-				'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ),
127
-				'logo_selection_title'                               => __( 'WordLift Choose Logo', 'wordlift' ),
128
-				'logo_selection_button'                              => array( 'text' => __( 'Choose Logo', 'wordlift' ) ),
126
+				'You already published an entity with the same name' => __('You already published an entity with the same name: ', 'wordlift'),
127
+				'logo_selection_title'                               => __('WordLift Choose Logo', 'wordlift'),
128
+				'logo_selection_button'                              => array('text' => __('Choose Logo', 'wordlift')),
129 129
 			),
130 130
 		);
131 131
 
132 132
 		// Set post-related values if there's a current post.
133
-		if ( null !== $post = $entity_being_edited = get_post() ) {
133
+		if (null !== $post = $entity_being_edited = get_post()) {
134 134
 
135 135
 			$params['post_id']           = $entity_being_edited->ID;
136
-			$params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && Wordlift_Entity_Service::TYPE_NAME == $entity_being_edited->post_type && is_numeric( get_the_ID() );
136
+			$params['entityBeingEdited'] = isset($entity_being_edited->post_type) && Wordlift_Entity_Service::TYPE_NAME == $entity_being_edited->post_type && is_numeric(get_the_ID());
137 137
 			// We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it
138 138
 			// from the results, since we don't want the current entity to be discovered by the analysis.
139 139
 			//
140 140
 			// See https://github.com/insideout10/wordlift-plugin/issues/345
141
-			$params['itemId'] = Wordlift_Entity_Service::get_instance()->get_uri( $entity_being_edited->ID );
141
+			$params['itemId'] = Wordlift_Entity_Service::get_instance()->get_uri($entity_being_edited->ID);
142 142
 
143 143
 		}
144 144
 
145 145
 		// Finally output the params as `wlSettings` for JavaScript code.
146
-		wp_localize_script( $this->plugin_name, 'wlSettings', $params );
146
+		wp_localize_script($this->plugin_name, 'wlSettings', $params);
147 147
 
148 148
 	}
149 149
 
Please login to merge, or discard this patch.
src/admin/partials/wordlift-admin-setup.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -16,34 +16,34 @@  discard block
 block discarded – undo
16 16
 
17 17
 	<?php
18 18
 
19
-	// Enqueue wp.media functions.
20
-	wp_enqueue_media();
21
-
22
-	// Enqueue styles and scripts.
23
-	wp_enqueue_style( 'wl-font-awesome', plugin_dir_url( dirname( dirname( __FILE__ ) ) ) . 'css/font-awesome.min.css' );
24
-	wp_enqueue_style( 'wordlift-admin-setup', plugin_dir_url( dirname( __FILE__ ) ) . 'css/wordlift-admin-setup.css', array(
25
-		'wp-admin',
26
-		'wl-font-awesome',
27
-	) );
28
-	wp_enqueue_script( 'wordlift-admin-setup', plugin_dir_url( dirname( __FILE__ ) ) . 'js/wordlift-admin-setup.js', array( 'jquery' ) );
29
-
30
-	// Set configuration settings.
31
-	wp_localize_script( 'wordlift-admin-setup', '_wlAdminSetup', array(
32
-		'ajaxUrl' => parse_url( self_admin_url( 'admin-ajax.php' ), PHP_URL_PATH ),
33
-		'action'  => 'wl_validate_key',
34
-		'media'   => array(
35
-			'title' => __( 'WordLift Choose Logo', 'wordlift' ),
36
-			'button' => array( 'text' => __( 'Choose Logo', 'wordlift' ) ),
37
-		),
38
-	) );
39
-
40
-	// Finally print styles and scripts.
41
-	wp_print_styles();
42
-	wp_print_scripts();
43
-	//	do_action( 'admin_print_styles' );
44
-	//	do_action( 'admin_print_scripts' );
45
-
46
-	?>
19
+    // Enqueue wp.media functions.
20
+    wp_enqueue_media();
21
+
22
+    // Enqueue styles and scripts.
23
+    wp_enqueue_style( 'wl-font-awesome', plugin_dir_url( dirname( dirname( __FILE__ ) ) ) . 'css/font-awesome.min.css' );
24
+    wp_enqueue_style( 'wordlift-admin-setup', plugin_dir_url( dirname( __FILE__ ) ) . 'css/wordlift-admin-setup.css', array(
25
+        'wp-admin',
26
+        'wl-font-awesome',
27
+    ) );
28
+    wp_enqueue_script( 'wordlift-admin-setup', plugin_dir_url( dirname( __FILE__ ) ) . 'js/wordlift-admin-setup.js', array( 'jquery' ) );
29
+
30
+    // Set configuration settings.
31
+    wp_localize_script( 'wordlift-admin-setup', '_wlAdminSetup', array(
32
+        'ajaxUrl' => parse_url( self_admin_url( 'admin-ajax.php' ), PHP_URL_PATH ),
33
+        'action'  => 'wl_validate_key',
34
+        'media'   => array(
35
+            'title' => __( 'WordLift Choose Logo', 'wordlift' ),
36
+            'button' => array( 'text' => __( 'Choose Logo', 'wordlift' ) ),
37
+        ),
38
+    ) );
39
+
40
+    // Finally print styles and scripts.
41
+    wp_print_styles();
42
+    wp_print_scripts();
43
+    //	do_action( 'admin_print_styles' );
44
+    //	do_action( 'admin_print_scripts' );
45
+
46
+    ?>
47 47
 
48 48
 	<!-- Pane 1 content -->
49 49
 	<script type="text/html" id="page-0">
@@ -133,20 +133,20 @@  discard block
 block discarded – undo
133 133
 		<select id="language" name="language" placeholder="<?php esc_attr_e( 'Choose your language', 'wordlift' ); ?>">
134 134
 			<?php
135 135
 
136
-			// Get WordLift's supported languages.
137
-			$languages = Wordlift_Languages::get_languages();
136
+            // Get WordLift's supported languages.
137
+            $languages = Wordlift_Languages::get_languages();
138 138
 
139
-			// Get WP's locale.
140
-			$locale = get_locale();
139
+            // Get WP's locale.
140
+            $locale = get_locale();
141 141
 
142
-			// Get the language locale part.
143
-			$parts = explode( '_', $locale );
142
+            // Get the language locale part.
143
+            $parts = explode( '_', $locale );
144 144
 
145
-			// If we support WP's configured language, then use that, otherwise use English by default.
146
-			$language = isset( $languages[ $parts[0] ] ) ? $parts[0] : 'en';
145
+            // If we support WP's configured language, then use that, otherwise use English by default.
146
+            $language = isset( $languages[ $parts[0] ] ) ? $parts[0] : 'en';
147 147
 
148
-			// Print all the supported language, preselecting the one configured in WP (or English if not supported).
149
-			foreach ( $languages as $code => $label ) { ?>
148
+            // Print all the supported language, preselecting the one configured in WP (or English if not supported).
149
+            foreach ( $languages as $code => $label ) { ?>
150 150
 				<option
151 151
 					value="<?php echo esc_attr( $code ) ?>" <?php echo selected( $code, $language, false ) ?>><?php echo esc_html( $label ) ?></option>
152 152
 			<?php } ?>
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 	<!-- Defining responsive ambient. -->
13 13
 	<meta name="viewport" content="width=device-width, initial-scale=1">
14 14
 
15
-	<title><?php esc_html_e( 'WordLift Setup', 'wordlift' ); ?></title>
15
+	<title><?php esc_html_e('WordLift Setup', 'wordlift'); ?></title>
16 16
 
17 17
 	<?php
18 18
 
@@ -20,22 +20,22 @@  discard block
 block discarded – undo
20 20
 	wp_enqueue_media();
21 21
 
22 22
 	// Enqueue styles and scripts.
23
-	wp_enqueue_style( 'wl-font-awesome', plugin_dir_url( dirname( dirname( __FILE__ ) ) ) . 'css/font-awesome.min.css' );
24
-	wp_enqueue_style( 'wordlift-admin-setup', plugin_dir_url( dirname( __FILE__ ) ) . 'css/wordlift-admin-setup.css', array(
23
+	wp_enqueue_style('wl-font-awesome', plugin_dir_url(dirname(dirname(__FILE__))).'css/font-awesome.min.css');
24
+	wp_enqueue_style('wordlift-admin-setup', plugin_dir_url(dirname(__FILE__)).'css/wordlift-admin-setup.css', array(
25 25
 		'wp-admin',
26 26
 		'wl-font-awesome',
27
-	) );
28
-	wp_enqueue_script( 'wordlift-admin-setup', plugin_dir_url( dirname( __FILE__ ) ) . 'js/wordlift-admin-setup.js', array( 'jquery' ) );
27
+	));
28
+	wp_enqueue_script('wordlift-admin-setup', plugin_dir_url(dirname(__FILE__)).'js/wordlift-admin-setup.js', array('jquery'));
29 29
 
30 30
 	// Set configuration settings.
31
-	wp_localize_script( 'wordlift-admin-setup', '_wlAdminSetup', array(
32
-		'ajaxUrl' => parse_url( self_admin_url( 'admin-ajax.php' ), PHP_URL_PATH ),
31
+	wp_localize_script('wordlift-admin-setup', '_wlAdminSetup', array(
32
+		'ajaxUrl' => parse_url(self_admin_url('admin-ajax.php'), PHP_URL_PATH),
33 33
 		'action'  => 'wl_validate_key',
34 34
 		'media'   => array(
35
-			'title' => __( 'WordLift Choose Logo', 'wordlift' ),
36
-			'button' => array( 'text' => __( 'Choose Logo', 'wordlift' ) ),
35
+			'title' => __('WordLift Choose Logo', 'wordlift'),
36
+			'button' => array('text' => __('Choose Logo', 'wordlift')),
37 37
 		),
38
-	) );
38
+	));
39 39
 
40 40
 	// Finally print styles and scripts.
41 41
 	wp_print_styles();
@@ -47,90 +47,90 @@  discard block
 block discarded – undo
47 47
 
48 48
 	<!-- Pane 1 content -->
49 49
 	<script type="text/html" id="page-0">
50
-		<h2 class="page-title"><?php esc_html_e( 'Welcome', 'wordlift' ); ?></h2>
50
+		<h2 class="page-title"><?php esc_html_e('Welcome', 'wordlift'); ?></h2>
51 51
 		<p class="page-txt">
52
-			<?php esc_html_e( 'Thank you for downloading WordLift. Now you can boost your website with a double-digit growth. WordLift helps you with:', 'wordlift' ); ?>
52
+			<?php esc_html_e('Thank you for downloading WordLift. Now you can boost your website with a double-digit growth. WordLift helps you with:', 'wordlift'); ?>
53 53
 		</p>
54 54
 		<ul class="page-list">
55 55
 			<li>
56 56
 				<span class="fa fa-university"></span>
57
-				<?php esc_html_e( 'Trustworthiness', 'wordlift' ); ?>
57
+				<?php esc_html_e('Trustworthiness', 'wordlift'); ?>
58 58
 			</li>
59 59
 
60 60
 			<li>
61 61
 				<span class="fa fa-map-marker"></span>
62
-				<?php esc_html_e( 'Enrichment', 'wordlift' ); ?>
62
+				<?php esc_html_e('Enrichment', 'wordlift'); ?>
63 63
 			</li>
64 64
 
65 65
 			<li>
66 66
 				<span class="fa fa-heart"></span>
67
-				<?php esc_html_e( 'Engagement', 'wordlift' ); ?>
67
+				<?php esc_html_e('Engagement', 'wordlift'); ?>
68 68
 			</li>
69 69
 
70 70
 			<li>
71 71
 				<span class="fa fa-hand-o-right"></span>
72
-				<?php esc_html_e( 'Smart Navigation', 'wordlift' ); ?>
72
+				<?php esc_html_e('Smart Navigation', 'wordlift'); ?>
73 73
 			</li>
74 74
 
75 75
 			<li>
76 76
 				<span class="fa fa-google"></span>
77
-				<?php esc_html_e( 'SEO Optimization', 'wordlift' ); ?>
77
+				<?php esc_html_e('SEO Optimization', 'wordlift'); ?>
78 78
 			</li>
79 79
 
80 80
 			<li>
81 81
 				<span class="fa fa-group"></span>
82
-				<?php esc_html_e( 'Content Marketing', 'wordlift' ); ?>
82
+				<?php esc_html_e('Content Marketing', 'wordlift'); ?>
83 83
 			</li>
84 84
 		</ul>
85 85
 		<div class="btn-wrapper">
86 86
 			<a href="https://wordlift.io/blogger/?utm_campaign=wl_activation_learn_more" target="_tab"
87
-			   class="button"><?php esc_html_e( 'Learn More', 'wordlift' ); ?></a>
87
+			   class="button"><?php esc_html_e('Learn More', 'wordlift'); ?></a>
88 88
 			<input type="button" data-wl-next="wl-next" class="wl-default-action"
89
-			       value="<?php esc_attr_e( 'Next', 'wordlift' ); ?>">
89
+			       value="<?php esc_attr_e('Next', 'wordlift'); ?>">
90 90
 		</div>
91 91
 	</script>
92 92
 
93 93
 	<!-- Pane 2 content -->
94 94
 	<script type="text/html" id="page-1">
95
-		<h2 class="page-title"><?php esc_html_e( 'License Key', 'wordlift' ); ?></h2>
95
+		<h2 class="page-title"><?php esc_html_e('License Key', 'wordlift'); ?></h2>
96 96
 		<p class="page-txt">
97
-			<?php esc_html_e( 'If you already puchased a plan, check your email, get the activation key from your inbox and insert it in the field below. Otherwise ....', 'wordlift' ); ?>
97
+			<?php esc_html_e('If you already puchased a plan, check your email, get the activation key from your inbox and insert it in the field below. Otherwise ....', 'wordlift'); ?>
98 98
 		</p>
99 99
 		<input type="text" data-wl-key="wl-key" class="invalid untouched" id="key" name="key" value=""
100 100
 		       autocomplete="off" placeholder="Activation Key">
101 101
 		<div class="btn-wrapper">
102 102
 			<a
103 103
 				href="https://wordlift.io/?utm_campaign=wl_activation_grab_the_key#plan-and-price" target="_tab"
104
-				class="button"><?php esc_html_e( 'Grab a Key!', 'wordlift' ); ?></a><input
104
+				class="button"><?php esc_html_e('Grab a Key!', 'wordlift'); ?></a><input
105 105
 				type="button" data-wl-next="wl-next" class="wl-default-action"
106
-				value="<?php esc_attr_e( 'Next', 'wordlift' ); ?>">
106
+				value="<?php esc_attr_e('Next', 'wordlift'); ?>">
107 107
 		</div>
108 108
 	</script>
109 109
 
110 110
 	<!-- Pane 3 content -->
111 111
 	<script type="text/html" id="page-2">
112
-		<h2 class="page-title"><?php esc_html_e( 'Vocabulary', 'wordlift' ); ?></h2>
112
+		<h2 class="page-title"><?php esc_html_e('Vocabulary', 'wordlift'); ?></h2>
113 113
 		<p class="page-txt">
114
-			<?php esc_html_e( 'All new pages created with WordLift, will be stored inside your internal vocabulary. You can customize the url pattern of these pages in the field below. Check our FAQs if you need more info.', 'wordlift' ); ?>
114
+			<?php esc_html_e('All new pages created with WordLift, will be stored inside your internal vocabulary. You can customize the url pattern of these pages in the field below. Check our FAQs if you need more info.', 'wordlift'); ?>
115 115
 		</p>
116 116
 		<input type="text" id="vocabulary" name="vocabulary" autocomplete="off" value="vocabulary"
117 117
 		       class="valid untouched" data-wl-vocabulary="wl-vocabulary">
118 118
 		<p class="page-det">
119
-			<?php esc_html_e( 'Leave it empty to place your entities in the root folder of your website', 'wordlift' ); ?>
119
+			<?php esc_html_e('Leave it empty to place your entities in the root folder of your website', 'wordlift'); ?>
120 120
 		</p>
121 121
 		<div class="btn-wrapper">
122 122
 			<input type="button" data-wl-next="wl-next" class="wl-default-action"
123
-			       value="<?php esc_attr_e( 'Next', 'wordlift' ); ?>">
123
+			       value="<?php esc_attr_e('Next', 'wordlift'); ?>">
124 124
 		</div>
125 125
 	</script>
126 126
 
127 127
 	<!-- Pane 4 content -->
128 128
 	<script type="text/html" id="page-3">
129
-		<h2 class="page-title"><?php esc_html_e( 'Language', 'wordlift' ); ?></h2>
129
+		<h2 class="page-title"><?php esc_html_e('Language', 'wordlift'); ?></h2>
130 130
 		<p class="page-txt">
131
-			<?php esc_html_e( 'Each WordLift key can be used only in one language. Pick yours.', 'wordlift' ); ?>
131
+			<?php esc_html_e('Each WordLift key can be used only in one language. Pick yours.', 'wordlift'); ?>
132 132
 		</p>
133
-		<select id="language" name="language" placeholder="<?php esc_attr_e( 'Choose your language', 'wordlift' ); ?>">
133
+		<select id="language" name="language" placeholder="<?php esc_attr_e('Choose your language', 'wordlift'); ?>">
134 134
 			<?php
135 135
 
136 136
 			// Get WordLift's supported languages.
@@ -140,45 +140,45 @@  discard block
 block discarded – undo
140 140
 			$locale = get_locale();
141 141
 
142 142
 			// Get the language locale part.
143
-			$parts = explode( '_', $locale );
143
+			$parts = explode('_', $locale);
144 144
 
145 145
 			// If we support WP's configured language, then use that, otherwise use English by default.
146
-			$language = isset( $languages[ $parts[0] ] ) ? $parts[0] : 'en';
146
+			$language = isset($languages[$parts[0]]) ? $parts[0] : 'en';
147 147
 
148 148
 			// Print all the supported language, preselecting the one configured in WP (or English if not supported).
149
-			foreach ( $languages as $code => $label ) { ?>
149
+			foreach ($languages as $code => $label) { ?>
150 150
 				<option
151
-					value="<?php echo esc_attr( $code ) ?>" <?php echo selected( $code, $language, false ) ?>><?php echo esc_html( $label ) ?></option>
151
+					value="<?php echo esc_attr($code) ?>" <?php echo selected($code, $language, false) ?>><?php echo esc_html($label) ?></option>
152 152
 			<?php } ?>
153 153
 		</select>
154 154
 
155 155
 		<div class="btn-wrapper">
156 156
 			<input type="button" data-wl-next="wl-next" class="wl-default-action"
157
-			       value="<?php esc_attr_e( 'Next', 'wordlift' ); ?>">
157
+			       value="<?php esc_attr_e('Next', 'wordlift'); ?>">
158 158
 		</div>
159 159
 	</script>
160 160
 
161 161
 	<!-- Pane 5 content -->
162 162
 	<script type="text/html" id="page-4">
163
-		<h2 class="page-title"><?php esc_html_e( 'Publisher', 'wordlift' ); ?></h2>
163
+		<h2 class="page-title"><?php esc_html_e('Publisher', 'wordlift'); ?></h2>
164 164
 		<p class="page-txt">
165
-			<?php esc_html_e( 'Are you going to publish as an individual or as a company?', 'wordlift' ); ?>
165
+			<?php esc_html_e('Are you going to publish as an individual or as a company?', 'wordlift'); ?>
166 166
 		</p>
167 167
 		<div class="radio-wrapper">
168 168
 			<label for="personal">
169 169
 				<input id="personal" type="radio" name="user_type" value="person" checked>
170 170
 				<span class="radio"><span class="check"></span></span>
171
-				<span class="label"><?php esc_html_e( 'Personal', 'wordlift' ); ?></span>
171
+				<span class="label"><?php esc_html_e('Personal', 'wordlift'); ?></span>
172 172
 			</label>
173 173
 			<label for="company">
174 174
 				<input id="company" type="radio" name="user_type" value="organization">
175 175
 				<span class="radio"><span class="check"></span></span>
176
-				<span class="label"><?php esc_html_e( 'Company', 'wordlift' ); ?></span>
176
+				<span class="label"><?php esc_html_e('Company', 'wordlift'); ?></span>
177 177
 			</label>
178 178
 		</div>
179 179
 		<input type="text" id="name" name="name" data-wl-name="wl-name" value="" autocomplete="off"
180 180
 		       class="untouched invalid"
181
-		       placeholder="<?php esc_attr_e( "What's your name?", 'wordlift' ); ?>">
181
+		       placeholder="<?php esc_attr_e("What's your name?", 'wordlift'); ?>">
182 182
 
183 183
 		<div data-wl-logo="wl-logo">
184 184
 			<input type="hidden" name="logo"/>
@@ -186,12 +186,12 @@  discard block
 block discarded – undo
186 186
 				<a data-wl-remove-logo="wl-remove-logo" href="javascript:void(0);" class="fa fa-times"></a>
187 187
 			</div>
188 188
 			<a data-wl-add-logo="wl-add-logo" class="add-logo" href="javascript:void(0);">
189
-				<?php esc_html_e( 'Add your logo', 'wordlift' ); ?>
189
+				<?php esc_html_e('Add your logo', 'wordlift'); ?>
190 190
 			</a>
191 191
 		</div>
192 192
 		<div class="btn-wrapper">
193 193
 			<input type="submit" id="btn-finish" class="wl-default-action"
194
-			       value="<?php esc_attr_e( 'Finish', 'wordlift' ); ?>">
194
+			       value="<?php esc_attr_e('Finish', 'wordlift'); ?>">
195 195
 		</div>
196 196
 	</script>
197 197
 
@@ -200,23 +200,23 @@  discard block
 block discarded – undo
200 200
 
201 201
 <div class="wl-container">
202 202
 
203
-	<a href="<?php echo esc_url( admin_url() ); ?> " class="fa fa-times wl-close"></a>
203
+	<a href="<?php echo esc_url(admin_url()); ?> " class="fa fa-times wl-close"></a>
204 204
 
205 205
 	<header>
206 206
 		<h1><strong>Word</strong>Lift</h1>
207
-		<img src="<?php echo plugin_dir_url( dirname( dirname( __FILE__ ) ) ) . 'images/shapes.png'; ?>"/>
207
+		<img src="<?php echo plugin_dir_url(dirname(dirname(__FILE__))).'images/shapes.png'; ?>"/>
208 208
 	</header>
209 209
 
210 210
 
211 211
 	<form method="post">
212
-		<?php wp_nonce_field( 'wl-save-configuration' ); ?>
212
+		<?php wp_nonce_field('wl-save-configuration'); ?>
213 213
 		<input type="hidden" name="action" value="wl-save-configuration"/>
214 214
 		<div class="viewport"></div>
215 215
 	</form>
216 216
 
217 217
 </div>
218 218
 
219
-<?php do_action( 'admin_footer' ); ?>
219
+<?php do_action('admin_footer'); ?>
220 220
 
221 221
 </body>
222 222
 </html>
Please login to merge, or discard this patch.
src/admin/wordlift_admin_edit_post.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -16,23 +16,23 @@
 block discarded – undo
16 16
  */
17 17
 function wl_admin_permalink_html( $html, $post_id, $new_title, $new_slug ) {
18 18
 
19
-	// If the post is published, add the button to view Redlink's linked data.
20
-	if ( 'publish' == get_post_status( $post_id ) ) {
21
-		if ( $uri = wl_get_entity_uri( $post_id ) ) {
22
-			$uri_esc       = esc_attr( wl_get_entity_uri( $post_id ) );
23
-			$lod_view_href = 'http://lodview.it/lodview/?IRI=' . $uri_esc;
24
-			$html .= "<span id='view-post-btn'><a href='$lod_view_href' class='button button-small wl-button' target='_blank'>" .
25
-			         esc_html__( 'View Linked Data', 'wordlift' ) .
26
-			         "</a></span>\n";
27
-		}
28
-		$html .= "<span id='view-post-btn'><a href='" . WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL .
29
-		         urlencode( get_permalink( $post_id ) ) .
30
-		         "' class='button button-small wl-button' target='_blank'>" .
31
-		         esc_html__( 'Test Google Rich Snippets', 'wordlift' ) .
32
-		         "</a></span>\n";
33
-	}
19
+    // If the post is published, add the button to view Redlink's linked data.
20
+    if ( 'publish' == get_post_status( $post_id ) ) {
21
+        if ( $uri = wl_get_entity_uri( $post_id ) ) {
22
+            $uri_esc       = esc_attr( wl_get_entity_uri( $post_id ) );
23
+            $lod_view_href = 'http://lodview.it/lodview/?IRI=' . $uri_esc;
24
+            $html .= "<span id='view-post-btn'><a href='$lod_view_href' class='button button-small wl-button' target='_blank'>" .
25
+                        esc_html__( 'View Linked Data', 'wordlift' ) .
26
+                        "</a></span>\n";
27
+        }
28
+        $html .= "<span id='view-post-btn'><a href='" . WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL .
29
+                    urlencode( get_permalink( $post_id ) ) .
30
+                    "' class='button button-small wl-button' target='_blank'>" .
31
+                    esc_html__( 'Test Google Rich Snippets', 'wordlift' ) .
32
+                    "</a></span>\n";
33
+    }
34 34
 
35
-	return $html;
35
+    return $html;
36 36
 }
37 37
 
38 38
 add_filter( 'get_sample_permalink_html', 'wl_admin_permalink_html', 10, 4 );
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,25 +14,25 @@
 block discarded – undo
14 14
  *
15 15
  * @return The enhanced html.
16 16
  */
17
-function wl_admin_permalink_html( $html, $post_id, $new_title, $new_slug ) {
17
+function wl_admin_permalink_html($html, $post_id, $new_title, $new_slug) {
18 18
 
19 19
 	// If the post is published, add the button to view Redlink's linked data.
20
-	if ( 'publish' == get_post_status( $post_id ) ) {
21
-		if ( $uri = wl_get_entity_uri( $post_id ) ) {
22
-			$uri_esc       = esc_attr( wl_get_entity_uri( $post_id ) );
23
-			$lod_view_href = 'http://lodview.it/lodview/?IRI=' . $uri_esc;
24
-			$html .= "<span id='view-post-btn'><a href='$lod_view_href' class='button button-small wl-button' target='_blank'>" .
25
-			         esc_html__( 'View Linked Data', 'wordlift' ) .
20
+	if ('publish' == get_post_status($post_id)) {
21
+		if ($uri = wl_get_entity_uri($post_id)) {
22
+			$uri_esc       = esc_attr(wl_get_entity_uri($post_id));
23
+			$lod_view_href = 'http://lodview.it/lodview/?IRI='.$uri_esc;
24
+			$html .= "<span id='view-post-btn'><a href='$lod_view_href' class='button button-small wl-button' target='_blank'>".
25
+			         esc_html__('View Linked Data', 'wordlift').
26 26
 			         "</a></span>\n";
27 27
 		}
28
-		$html .= "<span id='view-post-btn'><a href='" . WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL .
29
-		         urlencode( get_permalink( $post_id ) ) .
30
-		         "' class='button button-small wl-button' target='_blank'>" .
31
-		         esc_html__( 'Test Google Rich Snippets', 'wordlift' ) .
28
+		$html .= "<span id='view-post-btn'><a href='".WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL.
29
+		         urlencode(get_permalink($post_id)).
30
+		         "' class='button button-small wl-button' target='_blank'>".
31
+		         esc_html__('Test Google Rich Snippets', 'wordlift').
32 32
 		         "</a></span>\n";
33 33
 	}
34 34
 
35 35
 	return $html;
36 36
 }
37 37
 
38
-add_filter( 'get_sample_permalink_html', 'wl_admin_permalink_html', 10, 4 );
38
+add_filter('get_sample_permalink_html', 'wl_admin_permalink_html', 10, 4);
Please login to merge, or discard this patch.
src/admin/WL_Metabox/WL_Metabox_Field.php 2 patches
Indentation   +245 added lines, -245 removed lines patch added patch discarded remove patch
@@ -7,258 +7,258 @@
 block discarded – undo
7 7
  */
8 8
 class WL_Metabox_Field {
9 9
 
10
-	public $meta_name;
11
-	public $raw_custom_field;
12
-	public $predicate;
13
-	public $label;
14
-	public $expected_wl_type;
15
-	public $expected_uri_type;
16
-	public $cardinality;
17
-	public $data;
18
-
19
-	/**
20
-	 * @param array $args
21
-	 */
22
-	public function __construct( $args ) {
23
-
24
-		if ( empty( $args ) ) {
25
-			return;
26
-		}
27
-
28
-		// Save a copy of the custom field's params.
29
-		$this->raw_custom_field = reset( $args );
30
-
31
-		// Extract meta name (post_meta key for the DB).
32
-		$this->meta_name = key( $args );
33
-
34
-		// Extract linked data predicate.
35
-		if ( isset( $this->raw_custom_field['predicate'] ) ) {
36
-			$this->predicate = $this->raw_custom_field['predicate'];
37
-		} else {
38
-			return;
39
-		}
40
-
41
-		// Extract human readable label.
42
-		$exploded_predicate = explode( '/', $this->predicate );
43
-
44
-		// Use the label defined for the property if set, otherwise the last part of the schema.org/xyz predicate.
45
-		$this->label = isset( $this->raw_custom_field['metabox']['label'] ) ? $this->raw_custom_field['metabox']['label'] : end( $exploded_predicate );
46
-
47
-		// Extract field constraints (numerosity, expected type).
48
-		// Default constaints: accept one string..
49
-		if ( isset( $this->raw_custom_field['type'] ) ) {
50
-			$this->expected_wl_type = $this->raw_custom_field['type'];
51
-		} else {
52
-			$this->expected_wl_type = Wordlift_Schema_Service::DATA_TYPE_STRING;
53
-		}
54
-
55
-		$this->cardinality = 1;
56
-		if ( isset( $this->raw_custom_field['constraints'] ) ) {
57
-
58
-			$constraints = $this->raw_custom_field['constraints'];
59
-
60
-			// Extract cardinality.
61
-			if ( isset( $constraints['cardinality'] ) ) {
62
-				$this->cardinality = $constraints['cardinality'];
63
-			}
64
-
65
-			// Which type of entity can we accept (e.g. Place, Event, ecc.)? .
66
-			if ( $this->expected_wl_type === Wordlift_Schema_Service::DATA_TYPE_URI && isset( $constraints['uri_type'] ) ) {
67
-				$this->expected_uri_type = is_array( $constraints['uri_type'] ) ? $constraints['uri_type'] : array( $constraints['uri_type'] );
68
-			}
69
-
70
-		}
71
-	}
72
-
73
-	/**
74
-	 * Return nonce HTML.
75
-	 * Overwrite this method in a child class to obtain custom behaviour.
76
-	 */
77
-	public function html_nonce() {
78
-
79
-		return wp_nonce_field( 'wordlift_' . $this->meta_name . '_entity_box', 'wordlift_' . $this->meta_name . '_entity_box_nonce', TRUE, FALSE );
80
-	}
81
-
82
-	/**
83
-	 * Verify nonce.
84
-	 * Overwrite this method in a child class to obtain custom behaviour.
85
-	 *
86
-	 * @return boolean Nonce verification
87
-	 */
88
-	public function verify_nonce() {
89
-
90
-		$nonce_name   = 'wordlift_' . $this->meta_name . '_entity_box_nonce';
91
-		$nonce_verify = 'wordlift_' . $this->meta_name . '_entity_box';
92
-
93
-		if ( ! isset( $_POST[ $nonce_name ] ) ) {
94
-			return FALSE;
95
-		}
96
-
97
-		// Verify that the nonce is valid.
98
-		return wp_verify_nonce( $_POST[ $nonce_name ], $nonce_verify );
99
-	}
100
-
101
-	/**
102
-	 * Load data from DB and store the resulting array in $this->data.
103
-	 * Overwrite this method in a child class to obtain custom behaviour.
104
-	 */
105
-	public function get_data() {
106
-
107
-		$data = get_post_meta( get_the_ID(), $this->meta_name );
108
-
109
-		// Values are always contained in an array (makes it easier to manage cardinality).
110
-		if ( ! is_array( $data ) ) {
111
-			$data = array( $data );
112
-		}
113
-
114
-		$this->data = $data;
115
-	}
116
-
117
-	/**
118
-	 * Sanitizes data before saving to DB. Default sanitization trashes empty values.
119
-	 * Stores the sanitized values into $this->data so they can be later processed.
120
-	 * Overwrite this method in a child class to obtain custom behaviour.
121
-	 *
122
-	 * @param array $values Array of values to be sanitized and then stored into $this->data
123
-	 *
124
-	 */
125
-	public function sanitize_data( $values ) {
126
-
127
-		$sanitized_data = array();
128
-
129
-		if ( ! is_array( $values ) ) {
130
-			$values = array( $values );
131
-		}
132
-
133
-		foreach ( $values as $value ) {
134
-			$sanitized_value = $this->sanitize_data_filter( $value );
135
-			if ( ! is_null( $sanitized_value ) ) {
136
-				$sanitized_data[] = $sanitized_value;
137
-			}
138
-		}
139
-
140
-		$this->data = $sanitized_data;
141
-	}
142
-
143
-	/**
144
-	 * Sanitize a single value. Called from $this->sanitize_data. Default sanitization excludes empty values.
145
-	 * Overwrite this method in a child class to obtain custom behaviour.
146
-	 *
147
-	 * @return mixed Returns sanitized value, or null.
148
-	 */
149
-	public function sanitize_data_filter( $value ) {
150
-
151
-		// TODO: all fields should provide their own sanitize which shouldn't be part of a UI class.
152
-		// If the field provides its own validation, use it.
153
-		if ( isset( $this->raw_custom_field['sanitize'] ) ) {
154
-			return call_user_func( $this->raw_custom_field['sanitize'], $value );
155
-		}
156
-
157
-		if ( ! is_null( $value ) && $value !== '' ) {         // do not use 'empty()' -> https://www.virendrachandak.com/techtalk/php-isset-vs-empty-vs-is_null/ .
158
-			return $value;
159
-		}
160
-
161
-		return NULL;
162
-	}
163
-
164
-	/**
165
-	 * Save data to DB.
166
-	 * Overwrite this method in a child class to obtain custom behaviour.
167
-	 */
168
-	public function save_data( $values ) {
169
-
170
-		// Will sanitize data and store them in $field->data.
171
-		$this->sanitize_data( $values );
172
-
173
-		$entity_id = get_the_ID();
174
-
175
-		// Take away old values.
176
-		delete_post_meta( $entity_id, $this->meta_name );
177
-
178
-		// insert new values, respecting cardinality.
179
-		$single = ( $this->cardinality == 1 );
180
-		foreach ( $this->data as $value ) {
181
-			add_post_meta( $entity_id, $this->meta_name, $value, $single );
182
-		}
183
-	}
184
-
185
-	/**
186
-	 * Returns the HTML tag that will contain the Field. By default the we return a <div> with data- attributes on cardinality and expected types.
187
-	 * It is useful to provide data- attributes for the JS scripts.
188
-	 * Overwrite this method in a child class to obtain custom behaviour.
189
-	 */
190
-	public function html_wrapper_open() {
191
-
192
-		return "<div class='wl-field' data-cardinality='$this->cardinality'>";
193
-	}
194
-
195
-	/**
196
-	 * Returns Field HTML (nonce included).
197
-	 * Overwrite this method (or methods called from this method) in a child class to obtain custom behaviour.
198
-	 */
199
-	public function html() {
200
-
201
-		// Open main <div> for the Field.
202
-		$html = $this->html_wrapper_open();
203
-
204
-		// Label.
205
-		$html .= "<h3>$this->label</h3>";
206
-
207
-		// print nonce.
208
-		$html .= $this->html_nonce();
209
-
210
-		// print data loaded from DB.
211
-		$count = 0;
212
-		if ( $this->data ) {
213
-			foreach ( $this->data as $value ) {
214
-				if ( $count < $this->cardinality ) {
215
-					$html .= $this->html_input( $value );
216
-				}
217
-				$count ++;
218
-			}
219
-		}
220
-
221
-		// Print the empty <input> to add new values.
222
-		if ( $count === 0 ) { // } || $count < $this->cardinality ) { DO NOT print empty inputs unless requested by the editor since fields might support empty strings.
223
-			$html .= $this->html_input( '' );    // Will print an empty <input>
224
-			$count ++;
225
-		}
226
-
227
-		// If cardiality allows it, print button to add new values.
228
-		if ( $count < $this->cardinality ) {
229
-			$html .= '<button class="button wl-add-input wl-button" type="button">Add</button>';
230
-		}
231
-
232
-		// Close the HTML wrapper.
233
-		$html .= $this->html_wrapper_close();
234
-
235
-		return $html;
236
-	}
237
-
238
-	/**
239
-	 * Return a single <input> tag for the Field.
240
-	 *
241
-	 * @param mixed $value Input value
242
-	 *
243
-	 * @return string
244
-	 */
245
-	public function html_input( $value ) {
246
-		$html = <<<EOF
10
+    public $meta_name;
11
+    public $raw_custom_field;
12
+    public $predicate;
13
+    public $label;
14
+    public $expected_wl_type;
15
+    public $expected_uri_type;
16
+    public $cardinality;
17
+    public $data;
18
+
19
+    /**
20
+     * @param array $args
21
+     */
22
+    public function __construct( $args ) {
23
+
24
+        if ( empty( $args ) ) {
25
+            return;
26
+        }
27
+
28
+        // Save a copy of the custom field's params.
29
+        $this->raw_custom_field = reset( $args );
30
+
31
+        // Extract meta name (post_meta key for the DB).
32
+        $this->meta_name = key( $args );
33
+
34
+        // Extract linked data predicate.
35
+        if ( isset( $this->raw_custom_field['predicate'] ) ) {
36
+            $this->predicate = $this->raw_custom_field['predicate'];
37
+        } else {
38
+            return;
39
+        }
40
+
41
+        // Extract human readable label.
42
+        $exploded_predicate = explode( '/', $this->predicate );
43
+
44
+        // Use the label defined for the property if set, otherwise the last part of the schema.org/xyz predicate.
45
+        $this->label = isset( $this->raw_custom_field['metabox']['label'] ) ? $this->raw_custom_field['metabox']['label'] : end( $exploded_predicate );
46
+
47
+        // Extract field constraints (numerosity, expected type).
48
+        // Default constaints: accept one string..
49
+        if ( isset( $this->raw_custom_field['type'] ) ) {
50
+            $this->expected_wl_type = $this->raw_custom_field['type'];
51
+        } else {
52
+            $this->expected_wl_type = Wordlift_Schema_Service::DATA_TYPE_STRING;
53
+        }
54
+
55
+        $this->cardinality = 1;
56
+        if ( isset( $this->raw_custom_field['constraints'] ) ) {
57
+
58
+            $constraints = $this->raw_custom_field['constraints'];
59
+
60
+            // Extract cardinality.
61
+            if ( isset( $constraints['cardinality'] ) ) {
62
+                $this->cardinality = $constraints['cardinality'];
63
+            }
64
+
65
+            // Which type of entity can we accept (e.g. Place, Event, ecc.)? .
66
+            if ( $this->expected_wl_type === Wordlift_Schema_Service::DATA_TYPE_URI && isset( $constraints['uri_type'] ) ) {
67
+                $this->expected_uri_type = is_array( $constraints['uri_type'] ) ? $constraints['uri_type'] : array( $constraints['uri_type'] );
68
+            }
69
+
70
+        }
71
+    }
72
+
73
+    /**
74
+     * Return nonce HTML.
75
+     * Overwrite this method in a child class to obtain custom behaviour.
76
+     */
77
+    public function html_nonce() {
78
+
79
+        return wp_nonce_field( 'wordlift_' . $this->meta_name . '_entity_box', 'wordlift_' . $this->meta_name . '_entity_box_nonce', TRUE, FALSE );
80
+    }
81
+
82
+    /**
83
+     * Verify nonce.
84
+     * Overwrite this method in a child class to obtain custom behaviour.
85
+     *
86
+     * @return boolean Nonce verification
87
+     */
88
+    public function verify_nonce() {
89
+
90
+        $nonce_name   = 'wordlift_' . $this->meta_name . '_entity_box_nonce';
91
+        $nonce_verify = 'wordlift_' . $this->meta_name . '_entity_box';
92
+
93
+        if ( ! isset( $_POST[ $nonce_name ] ) ) {
94
+            return FALSE;
95
+        }
96
+
97
+        // Verify that the nonce is valid.
98
+        return wp_verify_nonce( $_POST[ $nonce_name ], $nonce_verify );
99
+    }
100
+
101
+    /**
102
+     * Load data from DB and store the resulting array in $this->data.
103
+     * Overwrite this method in a child class to obtain custom behaviour.
104
+     */
105
+    public function get_data() {
106
+
107
+        $data = get_post_meta( get_the_ID(), $this->meta_name );
108
+
109
+        // Values are always contained in an array (makes it easier to manage cardinality).
110
+        if ( ! is_array( $data ) ) {
111
+            $data = array( $data );
112
+        }
113
+
114
+        $this->data = $data;
115
+    }
116
+
117
+    /**
118
+     * Sanitizes data before saving to DB. Default sanitization trashes empty values.
119
+     * Stores the sanitized values into $this->data so they can be later processed.
120
+     * Overwrite this method in a child class to obtain custom behaviour.
121
+     *
122
+     * @param array $values Array of values to be sanitized and then stored into $this->data
123
+     *
124
+     */
125
+    public function sanitize_data( $values ) {
126
+
127
+        $sanitized_data = array();
128
+
129
+        if ( ! is_array( $values ) ) {
130
+            $values = array( $values );
131
+        }
132
+
133
+        foreach ( $values as $value ) {
134
+            $sanitized_value = $this->sanitize_data_filter( $value );
135
+            if ( ! is_null( $sanitized_value ) ) {
136
+                $sanitized_data[] = $sanitized_value;
137
+            }
138
+        }
139
+
140
+        $this->data = $sanitized_data;
141
+    }
142
+
143
+    /**
144
+     * Sanitize a single value. Called from $this->sanitize_data. Default sanitization excludes empty values.
145
+     * Overwrite this method in a child class to obtain custom behaviour.
146
+     *
147
+     * @return mixed Returns sanitized value, or null.
148
+     */
149
+    public function sanitize_data_filter( $value ) {
150
+
151
+        // TODO: all fields should provide their own sanitize which shouldn't be part of a UI class.
152
+        // If the field provides its own validation, use it.
153
+        if ( isset( $this->raw_custom_field['sanitize'] ) ) {
154
+            return call_user_func( $this->raw_custom_field['sanitize'], $value );
155
+        }
156
+
157
+        if ( ! is_null( $value ) && $value !== '' ) {         // do not use 'empty()' -> https://www.virendrachandak.com/techtalk/php-isset-vs-empty-vs-is_null/ .
158
+            return $value;
159
+        }
160
+
161
+        return NULL;
162
+    }
163
+
164
+    /**
165
+     * Save data to DB.
166
+     * Overwrite this method in a child class to obtain custom behaviour.
167
+     */
168
+    public function save_data( $values ) {
169
+
170
+        // Will sanitize data and store them in $field->data.
171
+        $this->sanitize_data( $values );
172
+
173
+        $entity_id = get_the_ID();
174
+
175
+        // Take away old values.
176
+        delete_post_meta( $entity_id, $this->meta_name );
177
+
178
+        // insert new values, respecting cardinality.
179
+        $single = ( $this->cardinality == 1 );
180
+        foreach ( $this->data as $value ) {
181
+            add_post_meta( $entity_id, $this->meta_name, $value, $single );
182
+        }
183
+    }
184
+
185
+    /**
186
+     * Returns the HTML tag that will contain the Field. By default the we return a <div> with data- attributes on cardinality and expected types.
187
+     * It is useful to provide data- attributes for the JS scripts.
188
+     * Overwrite this method in a child class to obtain custom behaviour.
189
+     */
190
+    public function html_wrapper_open() {
191
+
192
+        return "<div class='wl-field' data-cardinality='$this->cardinality'>";
193
+    }
194
+
195
+    /**
196
+     * Returns Field HTML (nonce included).
197
+     * Overwrite this method (or methods called from this method) in a child class to obtain custom behaviour.
198
+     */
199
+    public function html() {
200
+
201
+        // Open main <div> for the Field.
202
+        $html = $this->html_wrapper_open();
203
+
204
+        // Label.
205
+        $html .= "<h3>$this->label</h3>";
206
+
207
+        // print nonce.
208
+        $html .= $this->html_nonce();
209
+
210
+        // print data loaded from DB.
211
+        $count = 0;
212
+        if ( $this->data ) {
213
+            foreach ( $this->data as $value ) {
214
+                if ( $count < $this->cardinality ) {
215
+                    $html .= $this->html_input( $value );
216
+                }
217
+                $count ++;
218
+            }
219
+        }
220
+
221
+        // Print the empty <input> to add new values.
222
+        if ( $count === 0 ) { // } || $count < $this->cardinality ) { DO NOT print empty inputs unless requested by the editor since fields might support empty strings.
223
+            $html .= $this->html_input( '' );    // Will print an empty <input>
224
+            $count ++;
225
+        }
226
+
227
+        // If cardiality allows it, print button to add new values.
228
+        if ( $count < $this->cardinality ) {
229
+            $html .= '<button class="button wl-add-input wl-button" type="button">Add</button>';
230
+        }
231
+
232
+        // Close the HTML wrapper.
233
+        $html .= $this->html_wrapper_close();
234
+
235
+        return $html;
236
+    }
237
+
238
+    /**
239
+     * Return a single <input> tag for the Field.
240
+     *
241
+     * @param mixed $value Input value
242
+     *
243
+     * @return string
244
+     */
245
+    public function html_input( $value ) {
246
+        $html = <<<EOF
247 247
 			<div class="wl-input-wrapper">
248 248
 				<input type="text" id="$this->meta_name" name="wl_metaboxes[$this->meta_name][]" value="$value" style="width:88%" />
249 249
 				<button class="button wl-remove-input wl-button" type="button" style="width:10 % ">Remove</button>
250 250
 			</div>
251 251
 EOF;
252 252
 
253
-		return $html;
254
-	}
253
+        return $html;
254
+    }
255 255
 
256
-	/**
257
-	 * Returns closing for the wrapper HTML tag.
258
-	 */
259
-	public function html_wrapper_close() {
256
+    /**
257
+     * Returns closing for the wrapper HTML tag.
258
+     */
259
+    public function html_wrapper_close() {
260 260
 
261
-		return '</div><hr>';
262
-	}
261
+        return '</div><hr>';
262
+    }
263 263
 
264 264
 }
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -19,52 +19,52 @@  discard block
 block discarded – undo
19 19
 	/**
20 20
 	 * @param array $args
21 21
 	 */
22
-	public function __construct( $args ) {
22
+	public function __construct($args) {
23 23
 
24
-		if ( empty( $args ) ) {
24
+		if (empty($args)) {
25 25
 			return;
26 26
 		}
27 27
 
28 28
 		// Save a copy of the custom field's params.
29
-		$this->raw_custom_field = reset( $args );
29
+		$this->raw_custom_field = reset($args);
30 30
 
31 31
 		// Extract meta name (post_meta key for the DB).
32
-		$this->meta_name = key( $args );
32
+		$this->meta_name = key($args);
33 33
 
34 34
 		// Extract linked data predicate.
35
-		if ( isset( $this->raw_custom_field['predicate'] ) ) {
35
+		if (isset($this->raw_custom_field['predicate'])) {
36 36
 			$this->predicate = $this->raw_custom_field['predicate'];
37 37
 		} else {
38 38
 			return;
39 39
 		}
40 40
 
41 41
 		// Extract human readable label.
42
-		$exploded_predicate = explode( '/', $this->predicate );
42
+		$exploded_predicate = explode('/', $this->predicate);
43 43
 
44 44
 		// Use the label defined for the property if set, otherwise the last part of the schema.org/xyz predicate.
45
-		$this->label = isset( $this->raw_custom_field['metabox']['label'] ) ? $this->raw_custom_field['metabox']['label'] : end( $exploded_predicate );
45
+		$this->label = isset($this->raw_custom_field['metabox']['label']) ? $this->raw_custom_field['metabox']['label'] : end($exploded_predicate);
46 46
 
47 47
 		// Extract field constraints (numerosity, expected type).
48 48
 		// Default constaints: accept one string..
49
-		if ( isset( $this->raw_custom_field['type'] ) ) {
49
+		if (isset($this->raw_custom_field['type'])) {
50 50
 			$this->expected_wl_type = $this->raw_custom_field['type'];
51 51
 		} else {
52 52
 			$this->expected_wl_type = Wordlift_Schema_Service::DATA_TYPE_STRING;
53 53
 		}
54 54
 
55 55
 		$this->cardinality = 1;
56
-		if ( isset( $this->raw_custom_field['constraints'] ) ) {
56
+		if (isset($this->raw_custom_field['constraints'])) {
57 57
 
58 58
 			$constraints = $this->raw_custom_field['constraints'];
59 59
 
60 60
 			// Extract cardinality.
61
-			if ( isset( $constraints['cardinality'] ) ) {
61
+			if (isset($constraints['cardinality'])) {
62 62
 				$this->cardinality = $constraints['cardinality'];
63 63
 			}
64 64
 
65 65
 			// Which type of entity can we accept (e.g. Place, Event, ecc.)? .
66
-			if ( $this->expected_wl_type === Wordlift_Schema_Service::DATA_TYPE_URI && isset( $constraints['uri_type'] ) ) {
67
-				$this->expected_uri_type = is_array( $constraints['uri_type'] ) ? $constraints['uri_type'] : array( $constraints['uri_type'] );
66
+			if ($this->expected_wl_type === Wordlift_Schema_Service::DATA_TYPE_URI && isset($constraints['uri_type'])) {
67
+				$this->expected_uri_type = is_array($constraints['uri_type']) ? $constraints['uri_type'] : array($constraints['uri_type']);
68 68
 			}
69 69
 
70 70
 		}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function html_nonce() {
78 78
 
79
-		return wp_nonce_field( 'wordlift_' . $this->meta_name . '_entity_box', 'wordlift_' . $this->meta_name . '_entity_box_nonce', TRUE, FALSE );
79
+		return wp_nonce_field('wordlift_'.$this->meta_name.'_entity_box', 'wordlift_'.$this->meta_name.'_entity_box_nonce', TRUE, FALSE);
80 80
 	}
81 81
 
82 82
 	/**
@@ -87,15 +87,15 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function verify_nonce() {
89 89
 
90
-		$nonce_name   = 'wordlift_' . $this->meta_name . '_entity_box_nonce';
91
-		$nonce_verify = 'wordlift_' . $this->meta_name . '_entity_box';
90
+		$nonce_name   = 'wordlift_'.$this->meta_name.'_entity_box_nonce';
91
+		$nonce_verify = 'wordlift_'.$this->meta_name.'_entity_box';
92 92
 
93
-		if ( ! isset( $_POST[ $nonce_name ] ) ) {
93
+		if ( ! isset($_POST[$nonce_name])) {
94 94
 			return FALSE;
95 95
 		}
96 96
 
97 97
 		// Verify that the nonce is valid.
98
-		return wp_verify_nonce( $_POST[ $nonce_name ], $nonce_verify );
98
+		return wp_verify_nonce($_POST[$nonce_name], $nonce_verify);
99 99
 	}
100 100
 
101 101
 	/**
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	public function get_data() {
106 106
 
107
-		$data = get_post_meta( get_the_ID(), $this->meta_name );
107
+		$data = get_post_meta(get_the_ID(), $this->meta_name);
108 108
 
109 109
 		// Values are always contained in an array (makes it easier to manage cardinality).
110
-		if ( ! is_array( $data ) ) {
111
-			$data = array( $data );
110
+		if ( ! is_array($data)) {
111
+			$data = array($data);
112 112
 		}
113 113
 
114 114
 		$this->data = $data;
@@ -122,17 +122,17 @@  discard block
 block discarded – undo
122 122
 	 * @param array $values Array of values to be sanitized and then stored into $this->data
123 123
 	 *
124 124
 	 */
125
-	public function sanitize_data( $values ) {
125
+	public function sanitize_data($values) {
126 126
 
127 127
 		$sanitized_data = array();
128 128
 
129
-		if ( ! is_array( $values ) ) {
130
-			$values = array( $values );
129
+		if ( ! is_array($values)) {
130
+			$values = array($values);
131 131
 		}
132 132
 
133
-		foreach ( $values as $value ) {
134
-			$sanitized_value = $this->sanitize_data_filter( $value );
135
-			if ( ! is_null( $sanitized_value ) ) {
133
+		foreach ($values as $value) {
134
+			$sanitized_value = $this->sanitize_data_filter($value);
135
+			if ( ! is_null($sanitized_value)) {
136 136
 				$sanitized_data[] = $sanitized_value;
137 137
 			}
138 138
 		}
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @return mixed Returns sanitized value, or null.
148 148
 	 */
149
-	public function sanitize_data_filter( $value ) {
149
+	public function sanitize_data_filter($value) {
150 150
 
151 151
 		// TODO: all fields should provide their own sanitize which shouldn't be part of a UI class.
152 152
 		// If the field provides its own validation, use it.
153
-		if ( isset( $this->raw_custom_field['sanitize'] ) ) {
154
-			return call_user_func( $this->raw_custom_field['sanitize'], $value );
153
+		if (isset($this->raw_custom_field['sanitize'])) {
154
+			return call_user_func($this->raw_custom_field['sanitize'], $value);
155 155
 		}
156 156
 
157
-		if ( ! is_null( $value ) && $value !== '' ) {         // do not use 'empty()' -> https://www.virendrachandak.com/techtalk/php-isset-vs-empty-vs-is_null/ .
157
+		if ( ! is_null($value) && $value !== '') {         // do not use 'empty()' -> https://www.virendrachandak.com/techtalk/php-isset-vs-empty-vs-is_null/ .
158 158
 			return $value;
159 159
 		}
160 160
 
@@ -165,20 +165,20 @@  discard block
 block discarded – undo
165 165
 	 * Save data to DB.
166 166
 	 * Overwrite this method in a child class to obtain custom behaviour.
167 167
 	 */
168
-	public function save_data( $values ) {
168
+	public function save_data($values) {
169 169
 
170 170
 		// Will sanitize data and store them in $field->data.
171
-		$this->sanitize_data( $values );
171
+		$this->sanitize_data($values);
172 172
 
173 173
 		$entity_id = get_the_ID();
174 174
 
175 175
 		// Take away old values.
176
-		delete_post_meta( $entity_id, $this->meta_name );
176
+		delete_post_meta($entity_id, $this->meta_name);
177 177
 
178 178
 		// insert new values, respecting cardinality.
179
-		$single = ( $this->cardinality == 1 );
180
-		foreach ( $this->data as $value ) {
181
-			add_post_meta( $entity_id, $this->meta_name, $value, $single );
179
+		$single = ($this->cardinality == 1);
180
+		foreach ($this->data as $value) {
181
+			add_post_meta($entity_id, $this->meta_name, $value, $single);
182 182
 		}
183 183
 	}
184 184
 
@@ -209,23 +209,23 @@  discard block
 block discarded – undo
209 209
 
210 210
 		// print data loaded from DB.
211 211
 		$count = 0;
212
-		if ( $this->data ) {
213
-			foreach ( $this->data as $value ) {
214
-				if ( $count < $this->cardinality ) {
215
-					$html .= $this->html_input( $value );
212
+		if ($this->data) {
213
+			foreach ($this->data as $value) {
214
+				if ($count < $this->cardinality) {
215
+					$html .= $this->html_input($value);
216 216
 				}
217
-				$count ++;
217
+				$count++;
218 218
 			}
219 219
 		}
220 220
 
221 221
 		// Print the empty <input> to add new values.
222
-		if ( $count === 0 ) { // } || $count < $this->cardinality ) { DO NOT print empty inputs unless requested by the editor since fields might support empty strings.
223
-			$html .= $this->html_input( '' );    // Will print an empty <input>
224
-			$count ++;
222
+		if ($count === 0) { // } || $count < $this->cardinality ) { DO NOT print empty inputs unless requested by the editor since fields might support empty strings.
223
+			$html .= $this->html_input(''); // Will print an empty <input>
224
+			$count++;
225 225
 		}
226 226
 
227 227
 		// If cardiality allows it, print button to add new values.
228
-		if ( $count < $this->cardinality ) {
228
+		if ($count < $this->cardinality) {
229 229
 			$html .= '<button class="button wl-add-input wl-button" type="button">Add</button>';
230 230
 		}
231 231
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	 *
243 243
 	 * @return string
244 244
 	 */
245
-	public function html_input( $value ) {
245
+	public function html_input($value) {
246 246
 		$html = <<<EOF
247 247
 			<div class="wl-input-wrapper">
248 248
 				<input type="text" id="$this->meta_name" name="wl_metaboxes[$this->meta_name][]" value="$value" style="width:88%" />
Please login to merge, or discard this patch.
src/admin/class-wordlift-admin-entity-list.php 2 patches
Indentation   +199 added lines, -199 removed lines patch added patch discarded remove patch
@@ -13,204 +13,204 @@
 block discarded – undo
13 13
  */
14 14
 class Wordlift_Entity_List_Service {
15 15
 
16
-	/**
17
-	 * Size of the entity thumbnail in pixels
18
-	 *
19
-	 * @since  3.3.0
20
-	 */
21
-	const THUMB_SIZE = 50;
22
-
23
-	/**
24
-	 * A {@link Wordlift_Rating_Service} instance.
25
-	 *
26
-	 * @since  3.10.0
27
-	 * @access private
28
-	 * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
29
-	 */
30
-	private $rating_service;
31
-
32
-	/**
33
-	 * Create a Wordlift_Entity_List_Service.
34
-	 *
35
-	 * @since 3.3.0
36
-	 *
37
-	 * @param \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
38
-	 */
39
-	public function __construct( $rating_service ) {
40
-
41
-		$this->rating_service = $rating_service;
42
-
43
-	}
44
-
45
-	/**
46
-	 * Register custom columns for entity listing in backend.
47
-	 *
48
-	 * @see   https://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column
49
-	 *
50
-	 * @since 3.3.0
51
-	 *
52
-	 * @param array $columns the default columns.
53
-	 *
54
-	 * @return array Enhanced columns array.
55
-	 */
56
-	public function register_custom_columns( $columns ) {
57
-
58
-		// Take away first column and keep a reference,
59
-		// so we can later insert the thumbnail between the first and the rest of columns.
60
-		$columns_cb = $columns['cb'];
61
-		unset( $columns['cb'] );
62
-
63
-		// Thumbnails column is inserted in second place, while the related posts on the end.
64
-		$columns = array_merge(
65
-			array( 'cb' => $columns_cb ),                      // re-add first column
66
-			array( 'wl_column_thumbnail' => __( 'Image', 'wordlift' ) ),        // thumb
67
-			$columns,                                                               // default columns (without the first)
68
-			array( 'wl_column_related_posts' => __( 'Related Posts', 'wordlift' ) ), // related posts
69
-			array( 'wl_column_rating' => __( 'Rating', 'wordlift' ) ) // related posts
70
-		);
71
-
72
-		return $columns;
73
-	}
74
-
75
-	/**
76
-	 * Render custom columns.
77
-	 *
78
-	 * @see   https://codex.wordpress.org/Plugin_API/Action_Reference/manage_$post_type_posts_custom_column
79
-	 *
80
-	 * @since 3.3.0
81
-	 *
82
-	 * @param string $column    the current column.
83
-	 * @param int    $entity_id An entity post id.
84
-	 */
85
-	public function render_custom_columns( $column, $entity_id ) {
86
-
87
-		switch ( $column ) {
88
-
89
-			case 'wl_column_related_posts':
90
-				echo count( wl_core_get_related_post_ids( $entity_id ) );
91
-				break;
92
-
93
-			case 'wl_column_thumbnail':
94
-
95
-				$edit_link = get_edit_post_link( $entity_id );
96
-				$thumb     = get_the_post_thumbnail( $entity_id, array(
97
-					self::THUMB_SIZE,
98
-					self::THUMB_SIZE,
99
-				) );
100
-
101
-				if ( ! $thumb ) {
102
-					$thumb = "<img src='" . WL_DEFAULT_THUMBNAIL_PATH . "' width='" . self::THUMB_SIZE . "' />";
103
-				}
104
-				echo "<a href='" . esc_url( $edit_link ) . "'>$thumb</a>";
105
-				break;
106
-
107
-			case 'wl_column_rating':
108
-
109
-				$rating = $this->rating_service->get_rating_for( $entity_id );
110
-				echo '<i class="wl-traffic-light wl-tl-' . $rating['traffic_light_score'] . '">' . $rating['percentage_score'] . '%</i>';
111
-				break;
112
-		}
113
-
114
-	}
115
-
116
-	/**
117
-	 * Add wl-classification-scope select box before the 'Filter' button.
118
-	 *
119
-	 * @since 3.3.0
120
-	 */
121
-	public function restrict_manage_posts_classification_scope() {
122
-
123
-		// Return safely if get_current_screen() is not defined (yet)
124
-		if ( false === function_exists( 'get_current_screen' ) ) {
125
-			return;
126
-		}
127
-
128
-		$screen = get_current_screen();
129
-		// If there is any valid screen nothing to do
130
-		if ( null === $screen ) {
131
-			return;
132
-		}
133
-
134
-		if ( Wordlift_Entity_Service::TYPE_NAME !== $screen->post_type ) {
135
-			return;
136
-		}
137
-
138
-		// Was a W already selected?
139
-		$selected = isset( $_GET['wl-classification-scope'] ) ?
140
-			$_GET['wl-classification-scope'] : '';
141
-
142
-		// Print select box with the 4W
143
-		$all_w = array(
144
-			"All 'W'" => __( "All 'W'", 'wordlift' ),
145
-			WL_WHAT_RELATION => __( 'What', 'wordlift' ),
146
-			WL_WHO_RELATION => __( 'Who', 'wordlift' ),
147
-			WL_WHERE_RELATION => __( 'Where', 'wordlift' ),
148
-			WL_WHEN_RELATION => __( 'When', 'wordlift' ),
149
-		);
150
-		echo '<select name="wl-classification-scope" id="wl-dropdown-classification-scope">';
151
-		foreach ( $all_w as $v => $w ) {
152
-			$default = ( $selected === $v ) ? 'selected' : '';
153
-			echo sprintf( '<option value="%s" %s >%s</option>', esc_attr( $v ), $default, esc_html( $w ) );
154
-		}
155
-		echo '</select>';
156
-	}
157
-
158
-	/**
159
-	 * Server side response operations for the classification filter set in *restrict_manage_posts_classification_scope_filter*
160
-	 *
161
-	 * @since 3.3.0
162
-	 *
163
-	 * @param array $clauses WP main query clauses.
164
-	 *
165
-	 * @return array Modified clauses.
166
-	 */
167
-	public function posts_clauses_classification_scope( $clauses ) {
168
-
169
-		// Run only on admin page.
170
-		if ( ! is_admin() ) {
171
-			return $clauses;
172
-		}
173
-
174
-		// Return safely if get_current_screen() is not defined (yet).
175
-		if ( false === function_exists( 'get_current_screen' ) ) {
176
-			return $clauses;
177
-		}
178
-
179
-		// Only apply on entity list page, only if this is the main query and if the wl-classification-scope query param is set.
180
-		$screen = get_current_screen();
181
-
182
-		// If there is any valid screen nothing to do.
183
-		if ( null === $screen ) {
184
-			return $clauses;
185
-		}
186
-
187
-		if ( ! ( $screen->post_type === Wordlift_Entity_Service::TYPE_NAME && is_main_query() && isset( $_GET['wl-classification-scope'] ) ) ) {
188
-			return $clauses;
189
-		}
190
-
191
-		// Check a valid W was requested.
192
-		$requested_w = $_GET['wl-classification-scope'];
193
-
194
-		$all_w = array(
195
-			WL_WHAT_RELATION,
196
-			WL_WHO_RELATION,
197
-			WL_WHERE_RELATION,
198
-			WL_WHEN_RELATION,
199
-		);
200
-
201
-		if ( ! in_array( $requested_w, $all_w ) ) {
202
-			return $clauses;
203
-		}
204
-
205
-		global $wpdb;
206
-		$wl_relation_table = wl_core_get_relation_instances_table_name();
207
-
208
-		// Change WP main query clauses.
209
-		$clauses['join'] .= "INNER JOIN {$wl_relation_table} ON {$wpdb->posts}.ID = {$wl_relation_table}.object_id";
210
-		$clauses['where'] .= $wpdb->prepare( "AND {$wl_relation_table}.predicate = %s", $requested_w );
211
-		$clauses['distinct'] .= "DISTINCT";
212
-
213
-		return $clauses;
214
-	}
16
+    /**
17
+     * Size of the entity thumbnail in pixels
18
+     *
19
+     * @since  3.3.0
20
+     */
21
+    const THUMB_SIZE = 50;
22
+
23
+    /**
24
+     * A {@link Wordlift_Rating_Service} instance.
25
+     *
26
+     * @since  3.10.0
27
+     * @access private
28
+     * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
29
+     */
30
+    private $rating_service;
31
+
32
+    /**
33
+     * Create a Wordlift_Entity_List_Service.
34
+     *
35
+     * @since 3.3.0
36
+     *
37
+     * @param \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
38
+     */
39
+    public function __construct( $rating_service ) {
40
+
41
+        $this->rating_service = $rating_service;
42
+
43
+    }
44
+
45
+    /**
46
+     * Register custom columns for entity listing in backend.
47
+     *
48
+     * @see   https://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column
49
+     *
50
+     * @since 3.3.0
51
+     *
52
+     * @param array $columns the default columns.
53
+     *
54
+     * @return array Enhanced columns array.
55
+     */
56
+    public function register_custom_columns( $columns ) {
57
+
58
+        // Take away first column and keep a reference,
59
+        // so we can later insert the thumbnail between the first and the rest of columns.
60
+        $columns_cb = $columns['cb'];
61
+        unset( $columns['cb'] );
62
+
63
+        // Thumbnails column is inserted in second place, while the related posts on the end.
64
+        $columns = array_merge(
65
+            array( 'cb' => $columns_cb ),                      // re-add first column
66
+            array( 'wl_column_thumbnail' => __( 'Image', 'wordlift' ) ),        // thumb
67
+            $columns,                                                               // default columns (without the first)
68
+            array( 'wl_column_related_posts' => __( 'Related Posts', 'wordlift' ) ), // related posts
69
+            array( 'wl_column_rating' => __( 'Rating', 'wordlift' ) ) // related posts
70
+        );
71
+
72
+        return $columns;
73
+    }
74
+
75
+    /**
76
+     * Render custom columns.
77
+     *
78
+     * @see   https://codex.wordpress.org/Plugin_API/Action_Reference/manage_$post_type_posts_custom_column
79
+     *
80
+     * @since 3.3.0
81
+     *
82
+     * @param string $column    the current column.
83
+     * @param int    $entity_id An entity post id.
84
+     */
85
+    public function render_custom_columns( $column, $entity_id ) {
86
+
87
+        switch ( $column ) {
88
+
89
+            case 'wl_column_related_posts':
90
+                echo count( wl_core_get_related_post_ids( $entity_id ) );
91
+                break;
92
+
93
+            case 'wl_column_thumbnail':
94
+
95
+                $edit_link = get_edit_post_link( $entity_id );
96
+                $thumb     = get_the_post_thumbnail( $entity_id, array(
97
+                    self::THUMB_SIZE,
98
+                    self::THUMB_SIZE,
99
+                ) );
100
+
101
+                if ( ! $thumb ) {
102
+                    $thumb = "<img src='" . WL_DEFAULT_THUMBNAIL_PATH . "' width='" . self::THUMB_SIZE . "' />";
103
+                }
104
+                echo "<a href='" . esc_url( $edit_link ) . "'>$thumb</a>";
105
+                break;
106
+
107
+            case 'wl_column_rating':
108
+
109
+                $rating = $this->rating_service->get_rating_for( $entity_id );
110
+                echo '<i class="wl-traffic-light wl-tl-' . $rating['traffic_light_score'] . '">' . $rating['percentage_score'] . '%</i>';
111
+                break;
112
+        }
113
+
114
+    }
115
+
116
+    /**
117
+     * Add wl-classification-scope select box before the 'Filter' button.
118
+     *
119
+     * @since 3.3.0
120
+     */
121
+    public function restrict_manage_posts_classification_scope() {
122
+
123
+        // Return safely if get_current_screen() is not defined (yet)
124
+        if ( false === function_exists( 'get_current_screen' ) ) {
125
+            return;
126
+        }
127
+
128
+        $screen = get_current_screen();
129
+        // If there is any valid screen nothing to do
130
+        if ( null === $screen ) {
131
+            return;
132
+        }
133
+
134
+        if ( Wordlift_Entity_Service::TYPE_NAME !== $screen->post_type ) {
135
+            return;
136
+        }
137
+
138
+        // Was a W already selected?
139
+        $selected = isset( $_GET['wl-classification-scope'] ) ?
140
+            $_GET['wl-classification-scope'] : '';
141
+
142
+        // Print select box with the 4W
143
+        $all_w = array(
144
+            "All 'W'" => __( "All 'W'", 'wordlift' ),
145
+            WL_WHAT_RELATION => __( 'What', 'wordlift' ),
146
+            WL_WHO_RELATION => __( 'Who', 'wordlift' ),
147
+            WL_WHERE_RELATION => __( 'Where', 'wordlift' ),
148
+            WL_WHEN_RELATION => __( 'When', 'wordlift' ),
149
+        );
150
+        echo '<select name="wl-classification-scope" id="wl-dropdown-classification-scope">';
151
+        foreach ( $all_w as $v => $w ) {
152
+            $default = ( $selected === $v ) ? 'selected' : '';
153
+            echo sprintf( '<option value="%s" %s >%s</option>', esc_attr( $v ), $default, esc_html( $w ) );
154
+        }
155
+        echo '</select>';
156
+    }
157
+
158
+    /**
159
+     * Server side response operations for the classification filter set in *restrict_manage_posts_classification_scope_filter*
160
+     *
161
+     * @since 3.3.0
162
+     *
163
+     * @param array $clauses WP main query clauses.
164
+     *
165
+     * @return array Modified clauses.
166
+     */
167
+    public function posts_clauses_classification_scope( $clauses ) {
168
+
169
+        // Run only on admin page.
170
+        if ( ! is_admin() ) {
171
+            return $clauses;
172
+        }
173
+
174
+        // Return safely if get_current_screen() is not defined (yet).
175
+        if ( false === function_exists( 'get_current_screen' ) ) {
176
+            return $clauses;
177
+        }
178
+
179
+        // Only apply on entity list page, only if this is the main query and if the wl-classification-scope query param is set.
180
+        $screen = get_current_screen();
181
+
182
+        // If there is any valid screen nothing to do.
183
+        if ( null === $screen ) {
184
+            return $clauses;
185
+        }
186
+
187
+        if ( ! ( $screen->post_type === Wordlift_Entity_Service::TYPE_NAME && is_main_query() && isset( $_GET['wl-classification-scope'] ) ) ) {
188
+            return $clauses;
189
+        }
190
+
191
+        // Check a valid W was requested.
192
+        $requested_w = $_GET['wl-classification-scope'];
193
+
194
+        $all_w = array(
195
+            WL_WHAT_RELATION,
196
+            WL_WHO_RELATION,
197
+            WL_WHERE_RELATION,
198
+            WL_WHEN_RELATION,
199
+        );
200
+
201
+        if ( ! in_array( $requested_w, $all_w ) ) {
202
+            return $clauses;
203
+        }
204
+
205
+        global $wpdb;
206
+        $wl_relation_table = wl_core_get_relation_instances_table_name();
207
+
208
+        // Change WP main query clauses.
209
+        $clauses['join'] .= "INNER JOIN {$wl_relation_table} ON {$wpdb->posts}.ID = {$wl_relation_table}.object_id";
210
+        $clauses['where'] .= $wpdb->prepare( "AND {$wl_relation_table}.predicate = %s", $requested_w );
211
+        $clauses['distinct'] .= "DISTINCT";
212
+
213
+        return $clauses;
214
+    }
215 215
 
216 216
 }
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 *
37 37
 	 * @param \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
38 38
 	 */
39
-	public function __construct( $rating_service ) {
39
+	public function __construct($rating_service) {
40 40
 
41 41
 		$this->rating_service = $rating_service;
42 42
 
@@ -53,20 +53,20 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @return array Enhanced columns array.
55 55
 	 */
56
-	public function register_custom_columns( $columns ) {
56
+	public function register_custom_columns($columns) {
57 57
 
58 58
 		// Take away first column and keep a reference,
59 59
 		// so we can later insert the thumbnail between the first and the rest of columns.
60 60
 		$columns_cb = $columns['cb'];
61
-		unset( $columns['cb'] );
61
+		unset($columns['cb']);
62 62
 
63 63
 		// Thumbnails column is inserted in second place, while the related posts on the end.
64 64
 		$columns = array_merge(
65
-			array( 'cb' => $columns_cb ),                      // re-add first column
66
-			array( 'wl_column_thumbnail' => __( 'Image', 'wordlift' ) ),        // thumb
67
-			$columns,                                                               // default columns (without the first)
68
-			array( 'wl_column_related_posts' => __( 'Related Posts', 'wordlift' ) ), // related posts
69
-			array( 'wl_column_rating' => __( 'Rating', 'wordlift' ) ) // related posts
65
+			array('cb' => $columns_cb), // re-add first column
66
+			array('wl_column_thumbnail' => __('Image', 'wordlift')), // thumb
67
+			$columns, // default columns (without the first)
68
+			array('wl_column_related_posts' => __('Related Posts', 'wordlift')), // related posts
69
+			array('wl_column_rating' => __('Rating', 'wordlift')) // related posts
70 70
 		);
71 71
 
72 72
 		return $columns;
@@ -82,32 +82,32 @@  discard block
 block discarded – undo
82 82
 	 * @param string $column    the current column.
83 83
 	 * @param int    $entity_id An entity post id.
84 84
 	 */
85
-	public function render_custom_columns( $column, $entity_id ) {
85
+	public function render_custom_columns($column, $entity_id) {
86 86
 
87
-		switch ( $column ) {
87
+		switch ($column) {
88 88
 
89 89
 			case 'wl_column_related_posts':
90
-				echo count( wl_core_get_related_post_ids( $entity_id ) );
90
+				echo count(wl_core_get_related_post_ids($entity_id));
91 91
 				break;
92 92
 
93 93
 			case 'wl_column_thumbnail':
94 94
 
95
-				$edit_link = get_edit_post_link( $entity_id );
96
-				$thumb     = get_the_post_thumbnail( $entity_id, array(
95
+				$edit_link = get_edit_post_link($entity_id);
96
+				$thumb     = get_the_post_thumbnail($entity_id, array(
97 97
 					self::THUMB_SIZE,
98 98
 					self::THUMB_SIZE,
99
-				) );
99
+				));
100 100
 
101
-				if ( ! $thumb ) {
102
-					$thumb = "<img src='" . WL_DEFAULT_THUMBNAIL_PATH . "' width='" . self::THUMB_SIZE . "' />";
101
+				if ( ! $thumb) {
102
+					$thumb = "<img src='".WL_DEFAULT_THUMBNAIL_PATH."' width='".self::THUMB_SIZE."' />";
103 103
 				}
104
-				echo "<a href='" . esc_url( $edit_link ) . "'>$thumb</a>";
104
+				echo "<a href='".esc_url($edit_link)."'>$thumb</a>";
105 105
 				break;
106 106
 
107 107
 			case 'wl_column_rating':
108 108
 
109
-				$rating = $this->rating_service->get_rating_for( $entity_id );
110
-				echo '<i class="wl-traffic-light wl-tl-' . $rating['traffic_light_score'] . '">' . $rating['percentage_score'] . '%</i>';
109
+				$rating = $this->rating_service->get_rating_for($entity_id);
110
+				echo '<i class="wl-traffic-light wl-tl-'.$rating['traffic_light_score'].'">'.$rating['percentage_score'].'%</i>';
111 111
 				break;
112 112
 		}
113 113
 
@@ -121,36 +121,36 @@  discard block
 block discarded – undo
121 121
 	public function restrict_manage_posts_classification_scope() {
122 122
 
123 123
 		// Return safely if get_current_screen() is not defined (yet)
124
-		if ( false === function_exists( 'get_current_screen' ) ) {
124
+		if (false === function_exists('get_current_screen')) {
125 125
 			return;
126 126
 		}
127 127
 
128 128
 		$screen = get_current_screen();
129 129
 		// If there is any valid screen nothing to do
130
-		if ( null === $screen ) {
130
+		if (null === $screen) {
131 131
 			return;
132 132
 		}
133 133
 
134
-		if ( Wordlift_Entity_Service::TYPE_NAME !== $screen->post_type ) {
134
+		if (Wordlift_Entity_Service::TYPE_NAME !== $screen->post_type) {
135 135
 			return;
136 136
 		}
137 137
 
138 138
 		// Was a W already selected?
139
-		$selected = isset( $_GET['wl-classification-scope'] ) ?
139
+		$selected = isset($_GET['wl-classification-scope']) ?
140 140
 			$_GET['wl-classification-scope'] : '';
141 141
 
142 142
 		// Print select box with the 4W
143 143
 		$all_w = array(
144
-			"All 'W'" => __( "All 'W'", 'wordlift' ),
145
-			WL_WHAT_RELATION => __( 'What', 'wordlift' ),
146
-			WL_WHO_RELATION => __( 'Who', 'wordlift' ),
147
-			WL_WHERE_RELATION => __( 'Where', 'wordlift' ),
148
-			WL_WHEN_RELATION => __( 'When', 'wordlift' ),
144
+			"All 'W'" => __("All 'W'", 'wordlift'),
145
+			WL_WHAT_RELATION => __('What', 'wordlift'),
146
+			WL_WHO_RELATION => __('Who', 'wordlift'),
147
+			WL_WHERE_RELATION => __('Where', 'wordlift'),
148
+			WL_WHEN_RELATION => __('When', 'wordlift'),
149 149
 		);
150 150
 		echo '<select name="wl-classification-scope" id="wl-dropdown-classification-scope">';
151
-		foreach ( $all_w as $v => $w ) {
152
-			$default = ( $selected === $v ) ? 'selected' : '';
153
-			echo sprintf( '<option value="%s" %s >%s</option>', esc_attr( $v ), $default, esc_html( $w ) );
151
+		foreach ($all_w as $v => $w) {
152
+			$default = ($selected === $v) ? 'selected' : '';
153
+			echo sprintf('<option value="%s" %s >%s</option>', esc_attr($v), $default, esc_html($w));
154 154
 		}
155 155
 		echo '</select>';
156 156
 	}
@@ -164,15 +164,15 @@  discard block
 block discarded – undo
164 164
 	 *
165 165
 	 * @return array Modified clauses.
166 166
 	 */
167
-	public function posts_clauses_classification_scope( $clauses ) {
167
+	public function posts_clauses_classification_scope($clauses) {
168 168
 
169 169
 		// Run only on admin page.
170
-		if ( ! is_admin() ) {
170
+		if ( ! is_admin()) {
171 171
 			return $clauses;
172 172
 		}
173 173
 
174 174
 		// Return safely if get_current_screen() is not defined (yet).
175
-		if ( false === function_exists( 'get_current_screen' ) ) {
175
+		if (false === function_exists('get_current_screen')) {
176 176
 			return $clauses;
177 177
 		}
178 178
 
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 		$screen = get_current_screen();
181 181
 
182 182
 		// If there is any valid screen nothing to do.
183
-		if ( null === $screen ) {
183
+		if (null === $screen) {
184 184
 			return $clauses;
185 185
 		}
186 186
 
187
-		if ( ! ( $screen->post_type === Wordlift_Entity_Service::TYPE_NAME && is_main_query() && isset( $_GET['wl-classification-scope'] ) ) ) {
187
+		if ( ! ($screen->post_type === Wordlift_Entity_Service::TYPE_NAME && is_main_query() && isset($_GET['wl-classification-scope']))) {
188 188
 			return $clauses;
189 189
 		}
190 190
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 			WL_WHEN_RELATION,
199 199
 		);
200 200
 
201
-		if ( ! in_array( $requested_w, $all_w ) ) {
201
+		if ( ! in_array($requested_w, $all_w)) {
202 202
 			return $clauses;
203 203
 		}
204 204
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
 		// Change WP main query clauses.
209 209
 		$clauses['join'] .= "INNER JOIN {$wl_relation_table} ON {$wpdb->posts}.ID = {$wl_relation_table}.object_id";
210
-		$clauses['where'] .= $wpdb->prepare( "AND {$wl_relation_table}.predicate = %s", $requested_w );
210
+		$clauses['where'] .= $wpdb->prepare("AND {$wl_relation_table}.predicate = %s", $requested_w);
211 211
 		$clauses['distinct'] .= "DISTINCT";
212 212
 
213 213
 		return $clauses;
Please login to merge, or discard this patch.
src/wordlift_entity_type_taxonomy.php 2 patches
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -9,54 +9,54 @@  discard block
 block discarded – undo
9 9
  */
10 10
 function wl_entity_type_taxonomy_register() {
11 11
 
12
-	$labels = array(
13
-		'name'              => _x( 'Entity Types', 'taxonomy general name', 'wordlift' ),
14
-		'singular_name'     => _x( 'Entity Type', 'taxonomy singular name', 'wordlift' ),
15
-		'search_items'      => __( 'Search Entity Types', 'wordlift' ),
16
-		'all_items'         => __( 'All Entity Types', 'wordlift' ),
17
-		'parent_item'       => __( 'Parent Entity Type', 'wordlift' ),
18
-		'parent_item_colon' => __( 'Parent Entity Type:', 'wordlift' ),
19
-		'edit_item'         => __( 'Edit Entity Type', 'wordlift' ),
20
-		'update_item'       => __( 'Update Entity Type', 'wordlift' ),
21
-		'add_new_item'      => __( 'Add New Entity Type', 'wordlift' ),
22
-		'new_item_name'     => __( 'New Entity Type', 'wordlift' ),
23
-		'menu_name'         => __( 'Entity Types', 'wordlift' ),
24
-	);
25
-
26
-	// Take away GUI for taxonomy editing.
27
-	// TODO: read capabilities when editing of the WL <-> schema.org mapping is possible.
28
-	$capabilities = array(
29
-		// We enable editors to change the title/description of terms:
30
-	    //
31
-		// See https://github.com/insideout10/wordlift-plugin/issues/398
32
-		'manage_terms' => 'manage_options',
33
-		'edit_terms'   => null,
34
-		'delete_terms' => null,
35
-		'assign_terms' => 'edit_posts',
36
-	);
37
-
38
-	/*
12
+    $labels = array(
13
+        'name'              => _x( 'Entity Types', 'taxonomy general name', 'wordlift' ),
14
+        'singular_name'     => _x( 'Entity Type', 'taxonomy singular name', 'wordlift' ),
15
+        'search_items'      => __( 'Search Entity Types', 'wordlift' ),
16
+        'all_items'         => __( 'All Entity Types', 'wordlift' ),
17
+        'parent_item'       => __( 'Parent Entity Type', 'wordlift' ),
18
+        'parent_item_colon' => __( 'Parent Entity Type:', 'wordlift' ),
19
+        'edit_item'         => __( 'Edit Entity Type', 'wordlift' ),
20
+        'update_item'       => __( 'Update Entity Type', 'wordlift' ),
21
+        'add_new_item'      => __( 'Add New Entity Type', 'wordlift' ),
22
+        'new_item_name'     => __( 'New Entity Type', 'wordlift' ),
23
+        'menu_name'         => __( 'Entity Types', 'wordlift' ),
24
+    );
25
+
26
+    // Take away GUI for taxonomy editing.
27
+    // TODO: read capabilities when editing of the WL <-> schema.org mapping is possible.
28
+    $capabilities = array(
29
+        // We enable editors to change the title/description of terms:
30
+        //
31
+        // See https://github.com/insideout10/wordlift-plugin/issues/398
32
+        'manage_terms' => 'manage_options',
33
+        'edit_terms'   => null,
34
+        'delete_terms' => null,
35
+        'assign_terms' => 'edit_posts',
36
+    );
37
+
38
+    /*
39 39
 	 * Special capabilities need to be set for multisite super admin to be able
40 40
 	 * to "disable" related actions them later, null just do not work well for
41 41
 	 * it.
42 42
 	 */
43
-	if ( is_super_admin() ) {
44
-		$capabilities['edit_terms'] = 'wl_entity_type_edit_term';
45
-		$capabilities['delete_terms'] = 'wl_entity_type_delete_term';
46
-	}
47
-
48
-	$args = array(
49
-		'labels'            => $labels,
50
-		'capabilities'      => $capabilities,
51
-		'hierarchical'      => true,
52
-		'show_admin_column' => true,
53
-		'show_in_quick_edit' => false,
54
-	);
55
-
56
-	register_taxonomy( Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, 'entity', $args );
57
-
58
-	// Add filter to change the metabox CSS class
59
-	add_filter( 'postbox_classes_entity_wl_entity_typediv', 'wl_admin_metaboxes_add_css_class' );
43
+    if ( is_super_admin() ) {
44
+        $capabilities['edit_terms'] = 'wl_entity_type_edit_term';
45
+        $capabilities['delete_terms'] = 'wl_entity_type_delete_term';
46
+    }
47
+
48
+    $args = array(
49
+        'labels'            => $labels,
50
+        'capabilities'      => $capabilities,
51
+        'hierarchical'      => true,
52
+        'show_admin_column' => true,
53
+        'show_in_quick_edit' => false,
54
+    );
55
+
56
+    register_taxonomy( Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, 'entity', $args );
57
+
58
+    // Add filter to change the metabox CSS class
59
+    add_filter( 'postbox_classes_entity_wl_entity_typediv', 'wl_admin_metaboxes_add_css_class' );
60 60
 }
61 61
 
62 62
 /**
@@ -70,23 +70,23 @@  discard block
 block discarded – undo
70 70
  */
71 71
 function wl_entity_type_taxonomy_get_type( $post_id ) {
72 72
 
73
-	return Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
74
-
75
-	//	$terms = wp_get_object_terms( $post_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
76
-	//
77
-	//	if ( is_wp_error( $terms ) ) {
78
-	//		// TODO: handle error
79
-	//		return NULL;
80
-	//	}
81
-	//
82
-	//	// If there are not terms associated, return null.
83
-	//	if ( 0 === count( $terms ) ) {
84
-	//		return NULL;
85
-	//	}
86
-	//
87
-	//	// Return the entity type with the specified id.
88
-	//	return Wordlift_Schema_Service::get_instance()
89
-	//	                              ->get_schema( $terms[0]->slug );
73
+    return Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
74
+
75
+    //	$terms = wp_get_object_terms( $post_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
76
+    //
77
+    //	if ( is_wp_error( $terms ) ) {
78
+    //		// TODO: handle error
79
+    //		return NULL;
80
+    //	}
81
+    //
82
+    //	// If there are not terms associated, return null.
83
+    //	if ( 0 === count( $terms ) ) {
84
+    //		return NULL;
85
+    //	}
86
+    //
87
+    //	// Return the entity type with the specified id.
88
+    //	return Wordlift_Schema_Service::get_instance()
89
+    //	                              ->get_schema( $terms[0]->slug );
90 90
 }
91 91
 
92 92
 /**
@@ -96,21 +96,21 @@  discard block
 block discarded – undo
96 96
  * @param string $by   Search key. Must be one of: 'id', 'slug', 'name', or 'term_taxonomy_id'.
97 97
  */
98 98
 function wl_entity_type_taxonomy_get_term_children( $term, $by = 'name' ) {
99
-	// TODO: test this method
100
-	// NOTE: WP taxonomy terms can have only one parent. This is a WP limit.
99
+    // TODO: test this method
100
+    // NOTE: WP taxonomy terms can have only one parent. This is a WP limit.
101 101
 
102
-	$children_terms = array();
102
+    $children_terms = array();
103 103
 
104
-	$term = get_term_by( $by, $term, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
104
+    $term = get_term_by( $by, $term, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
105 105
 
106
-	if ( isset( $term->term_id ) ) {
106
+    if ( isset( $term->term_id ) ) {
107 107
 
108
-		$children_ids = get_term_children( $term->term_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
108
+        $children_ids = get_term_children( $term->term_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
109 109
 
110
-		foreach ( $children_ids as $children_id ) {
111
-			$children_terms[] = get_term( $children_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
112
-		}
113
-	}
110
+        foreach ( $children_ids as $children_id ) {
111
+            $children_terms[] = get_term( $children_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
112
+        }
113
+    }
114 114
 
115
-	return $children_terms;
115
+    return $children_terms;
116 116
 }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@  discard block
 block discarded – undo
10 10
 function wl_entity_type_taxonomy_register() {
11 11
 
12 12
 	$labels = array(
13
-		'name'              => _x( 'Entity Types', 'taxonomy general name', 'wordlift' ),
14
-		'singular_name'     => _x( 'Entity Type', 'taxonomy singular name', 'wordlift' ),
15
-		'search_items'      => __( 'Search Entity Types', 'wordlift' ),
16
-		'all_items'         => __( 'All Entity Types', 'wordlift' ),
17
-		'parent_item'       => __( 'Parent Entity Type', 'wordlift' ),
18
-		'parent_item_colon' => __( 'Parent Entity Type:', 'wordlift' ),
19
-		'edit_item'         => __( 'Edit Entity Type', 'wordlift' ),
20
-		'update_item'       => __( 'Update Entity Type', 'wordlift' ),
21
-		'add_new_item'      => __( 'Add New Entity Type', 'wordlift' ),
22
-		'new_item_name'     => __( 'New Entity Type', 'wordlift' ),
23
-		'menu_name'         => __( 'Entity Types', 'wordlift' ),
13
+		'name'              => _x('Entity Types', 'taxonomy general name', 'wordlift'),
14
+		'singular_name'     => _x('Entity Type', 'taxonomy singular name', 'wordlift'),
15
+		'search_items'      => __('Search Entity Types', 'wordlift'),
16
+		'all_items'         => __('All Entity Types', 'wordlift'),
17
+		'parent_item'       => __('Parent Entity Type', 'wordlift'),
18
+		'parent_item_colon' => __('Parent Entity Type:', 'wordlift'),
19
+		'edit_item'         => __('Edit Entity Type', 'wordlift'),
20
+		'update_item'       => __('Update Entity Type', 'wordlift'),
21
+		'add_new_item'      => __('Add New Entity Type', 'wordlift'),
22
+		'new_item_name'     => __('New Entity Type', 'wordlift'),
23
+		'menu_name'         => __('Entity Types', 'wordlift'),
24 24
 	);
25 25
 
26 26
 	// Take away GUI for taxonomy editing.
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 * to "disable" related actions them later, null just do not work well for
41 41
 	 * it.
42 42
 	 */
43
-	if ( is_super_admin() ) {
43
+	if (is_super_admin()) {
44 44
 		$capabilities['edit_terms'] = 'wl_entity_type_edit_term';
45 45
 		$capabilities['delete_terms'] = 'wl_entity_type_delete_term';
46 46
 	}
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 		'show_in_quick_edit' => false,
54 54
 	);
55 55
 
56
-	register_taxonomy( Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, 'entity', $args );
56
+	register_taxonomy(Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, 'entity', $args);
57 57
 
58 58
 	// Add filter to change the metabox CSS class
59
-	add_filter( 'postbox_classes_entity_wl_entity_typediv', 'wl_admin_metaboxes_add_css_class' );
59
+	add_filter('postbox_classes_entity_wl_entity_typediv', 'wl_admin_metaboxes_add_css_class');
60 60
 }
61 61
 
62 62
 /**
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
  *
69 69
  * @return array|null An array of type properties or null if no term is associated
70 70
  */
71
-function wl_entity_type_taxonomy_get_type( $post_id ) {
71
+function wl_entity_type_taxonomy_get_type($post_id) {
72 72
 
73
-	return Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
73
+	return Wordlift_Entity_Type_Service::get_instance()->get($post_id);
74 74
 
75 75
 	//	$terms = wp_get_object_terms( $post_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
76 76
 	//
@@ -95,20 +95,20 @@  discard block
 block discarded – undo
95 95
  * @param mixes  $term Term ID (e.g. 12) or slug (e.g. 'creative-work') or name (e.g. 'CreativeWork').
96 96
  * @param string $by   Search key. Must be one of: 'id', 'slug', 'name', or 'term_taxonomy_id'.
97 97
  */
98
-function wl_entity_type_taxonomy_get_term_children( $term, $by = 'name' ) {
98
+function wl_entity_type_taxonomy_get_term_children($term, $by = 'name') {
99 99
 	// TODO: test this method
100 100
 	// NOTE: WP taxonomy terms can have only one parent. This is a WP limit.
101 101
 
102 102
 	$children_terms = array();
103 103
 
104
-	$term = get_term_by( $by, $term, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
104
+	$term = get_term_by($by, $term, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME);
105 105
 
106
-	if ( isset( $term->term_id ) ) {
106
+	if (isset($term->term_id)) {
107 107
 
108
-		$children_ids = get_term_children( $term->term_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
108
+		$children_ids = get_term_children($term->term_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME);
109 109
 
110
-		foreach ( $children_ids as $children_id ) {
111
-			$children_terms[] = get_term( $children_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
110
+		foreach ($children_ids as $children_id) {
111
+			$children_terms[] = get_term($children_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME);
112 112
 		}
113 113
 	}
114 114
 
Please login to merge, or discard this patch.
src/includes/class-wordlift.php 2 patches
Indentation   +1071 added lines, -1071 removed lines patch added patch discarded remove patch
@@ -29,1177 +29,1177 @@
 block discarded – undo
29 29
  */
30 30
 class Wordlift {
31 31
 
32
-	/**
33
-	 * The loader that's responsible for maintaining and registering all hooks that power
34
-	 * the plugin.
35
-	 *
36
-	 * @since    1.0.0
37
-	 * @access   protected
38
-	 * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
39
-	 */
40
-	protected $loader;
41
-
42
-	/**
43
-	 * The unique identifier of this plugin.
44
-	 *
45
-	 * @since    1.0.0
46
-	 * @access   protected
47
-	 * @var      string $plugin_name The string used to uniquely identify this plugin.
48
-	 */
49
-	protected $plugin_name;
50
-
51
-	/**
52
-	 * The current version of the plugin.
53
-	 *
54
-	 * @since    1.0.0
55
-	 * @access   protected
56
-	 * @var      string $version The current version of the plugin.
57
-	 */
58
-	protected $version;
59
-
60
-	/**
61
-	 * The {@link Wordlift_Tinymce_Adapter} instance.
62
-	 *
63
-	 * @since  3.12.0
64
-	 * @access protected
65
-	 * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
66
-	 */
67
-	protected $tinymce_adapter;
68
-
69
-	/**
70
-	 * The Thumbnail service.
71
-	 *
72
-	 * @since  3.1.5
73
-	 * @access private
74
-	 * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
75
-	 */
76
-	private $thumbnail_service;
77
-
78
-	/**
79
-	 * The UI service.
80
-	 *
81
-	 * @since  3.2.0
82
-	 * @access private
83
-	 * @var \Wordlift_UI_Service $ui_service The UI service.
84
-	 */
85
-	private $ui_service;
86
-
87
-	/**
88
-	 * The Schema service.
89
-	 *
90
-	 * @since  3.3.0
91
-	 * @access private
92
-	 * @var \Wordlift_Schema_Service $schema_service The Schema service.
93
-	 */
94
-	private $schema_service;
95
-
96
-	/**
97
-	 * The Entity service.
98
-	 *
99
-	 * @since  3.1.0
100
-	 * @access protected
101
-	 * @var \Wordlift_Entity_Service $entity_service The Entity service.
102
-	 */
103
-	protected $entity_service;
104
-
105
-	/**
106
-	 * The Topic Taxonomy service.
107
-	 *
108
-	 * @since  3.5.0
109
-	 * @access private
110
-	 * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
111
-	 */
112
-	private $topic_taxonomy_service;
113
-
114
-	/**
115
-	 * The User service.
116
-	 *
117
-	 * @since  3.1.7
118
-	 * @access protected
119
-	 * @var \Wordlift_User_Service $user_service The User service.
120
-	 */
121
-	protected $user_service;
122
-
123
-	/**
124
-	 * The Timeline service.
125
-	 *
126
-	 * @since  3.1.0
127
-	 * @access private
128
-	 * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
129
-	 */
130
-	private $timeline_service;
131
-
132
-	/**
133
-	 * The Redirect service.
134
-	 *
135
-	 * @since  3.2.0
136
-	 * @access private
137
-	 * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
138
-	 */
139
-	private $redirect_service;
140
-
141
-	/**
142
-	 * The Notice service.
143
-	 *
144
-	 * @since  3.3.0
145
-	 * @access private
146
-	 * @var \Wordlift_Notice_Service $notice_service The Notice service.
147
-	 */
148
-	private $notice_service;
149
-
150
-	/**
151
-	 * The Entity list customization.
152
-	 *
153
-	 * @since  3.3.0
154
-	 * @access private
155
-	 * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
156
-	 */
157
-	private $entity_list_service;
158
-
159
-	/**
160
-	 * The Entity Types Taxonomy Walker.
161
-	 *
162
-	 * @since  3.1.0
163
-	 * @access private
164
-	 * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
165
-	 */
166
-	private $entity_types_taxonomy_walker;
167
-
168
-	/**
169
-	 * The ShareThis service.
170
-	 *
171
-	 * @since  3.2.0
172
-	 * @access private
173
-	 * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
174
-	 */
175
-	private $sharethis_service;
176
-
177
-	/**
178
-	 * The PrimaShop adapter.
179
-	 *
180
-	 * @since  3.2.3
181
-	 * @access private
182
-	 * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
183
-	 */
184
-	private $primashop_adapter;
185
-
186
-	/**
187
-	 * The WordLift Dashboard adapter.
188
-	 *
189
-	 * @since  3.4.0
190
-	 * @access private
191
-	 * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
192
-	 */
193
-	private $dashboard_service;
194
-
195
-	/**
196
-	 * The entity type service.
197
-	 *
198
-	 * @since  3.6.0
199
-	 * @access private
200
-	 * @var \Wordlift_Entity_Post_Type_Service
201
-	 */
202
-	private $entity_post_type_service;
203
-
204
-	/**
205
-	 * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
206
-	 *
207
-	 * @since  3.6.0
208
-	 * @access private
209
-	 * @var \Wordlift_Entity_Link_Service
210
-	 */
211
-	private $entity_link_service;
212
-
213
-	/**
214
-	 * A {@link Wordlift_Sparql_Service} instance.
215
-	 *
216
-	 * @var    3.6.0
217
-	 * @access private
218
-	 * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
219
-	 */
220
-	private $sparql_service;
221
-
222
-	/**
223
-	 * A {@link Wordlift_Import_Service} instance.
224
-	 *
225
-	 * @since  3.6.0
226
-	 * @access private
227
-	 * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
228
-	 */
229
-	private $import_service;
230
-
231
-	/**
232
-	 * A {@link Wordlift_Rebuild_Service} instance.
233
-	 *
234
-	 * @since  3.6.0
235
-	 * @access private
236
-	 * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
237
-	 */
238
-	private $rebuild_service;
239
-
240
-	/**
241
-	 * A {@link Wordlift_Jsonld_Service} instance.
242
-	 *
243
-	 * @since  3.7.0
244
-	 * @access protected
245
-	 * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
246
-	 */
247
-	protected $jsonld_service;
248
-
249
-	/**
250
-	 *
251
-	 * @since  3.7.0
252
-	 * @access private
253
-	 * @var \Wordlift_Property_Factory $property_factory
254
-	 */
255
-	private $property_factory;
256
-
257
-	/**
258
-	 * The 'Download Your Data' page.
259
-	 *
260
-	 * @since  3.6.0
261
-	 * @access private
262
-	 * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
263
-	 */
264
-	private $download_your_data_page;
265
-
266
-	/**
267
-	 * The 'WordLift Settings' page.
268
-	 *
269
-	 * @since  3.11.0
270
-	 * @access protected
271
-	 * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
272
-	 */
273
-	protected $settings_page;
274
-
275
-	/**
276
-	 * The install wizard page.
277
-	 *
278
-	 * @since  3.9.0
279
-	 * @access private
280
-	 * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
281
-	 */
282
-	private $admin_setup;
283
-
284
-	/**
285
-	 * The Content Filter Service hooks up to the 'the_content' filter and provides
286
-	 * linking of entities to their pages.
287
-	 *
288
-	 * @since  3.8.0
289
-	 * @access private
290
-	 * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
291
-	 */
292
-	private $content_filter_service;
293
-
294
-	/**
295
-	 * A {@link Wordlift_Key_Validation_Service} instance.
296
-	 *
297
-	 * @since  3.9.0
298
-	 * @access private
299
-	 * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
300
-	 */
301
-	private $key_validation_service;
302
-
303
-	/**
304
-	 * A {@link Wordlift_Rating_Service} instance.
305
-	 *
306
-	 * @since  3.10.0
307
-	 * @access private
308
-	 * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
309
-	 */
310
-	private $rating_service;
311
-
312
-	/**
313
-	 * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
314
-	 *
315
-	 * @since  3.10.0
316
-	 * @access protected
317
-	 * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
318
-	 */
319
-	protected $post_to_jsonld_converter;
320
-
321
-	/**
322
-	 * A {@link Wordlift_Configuration_Service} instance.
323
-	 *
324
-	 * @since  3.10.0
325
-	 * @access protected
326
-	 * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
327
-	 */
328
-	protected $configuration_service;
329
-
330
-	/**
331
-	 * A {@link Wordlift_Entity_Type_Service} instance.
332
-	 *
333
-	 * @since  3.10.0
334
-	 * @access protected
335
-	 * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
336
-	 */
337
-	protected $entity_type_service;
338
-
339
-	/**
340
-	 * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
341
-	 *
342
-	 * @since  3.10.0
343
-	 * @access protected
344
-	 * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
345
-	 */
346
-	protected $entity_post_to_jsonld_converter;
347
-
348
-	/**
349
-	 * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
350
-	 *
351
-	 * @since  3.10.0
352
-	 * @access protected
353
-	 * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
354
-	 */
355
-	protected $postid_to_jsonld_converter;
356
-
357
-	/**
358
-	 * The {@link Wordlift_Admin_Status_Page} class.
359
-	 *
360
-	 * @since  3.9.8
361
-	 * @access private
362
-	 * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
363
-	 */
364
-	private $status_page;
365
-
366
-	/**
367
-	 * The {@link Wordlift_Category_Taxonomy_Service} instance.
368
-	 *
369
-	 * @since  3.11.0
370
-	 * @access protected
371
-	 * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
372
-	 */
373
-	protected $category_taxonomy_service;
374
-
375
-	/**
376
-	 * The {@link Wordlift_Event_Entity_Page_Service} instance.
377
-	 *
378
-	 * @since  3.11.0
379
-	 * @access protected
380
-	 * @var \Wordlift_Event_Entity_Page_Service $event_entity_page_service The {@link Wordlift_Event_Entity_Page_Service} instance.
381
-	 */
382
-	protected $event_entity_page_service;
383
-
384
-	/**
385
-	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
386
-	 *
387
-	 * @since  3.11.0
388
-	 * @access protected
389
-	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
390
-	 */
391
-	protected $settings_page_action_link;
392
-
393
-	/**
394
-	 * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
395
-	 *
396
-	 * @since  3.11.0
397
-	 * @access protected
398
-	 * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
399
-	 */
400
-	protected $publisher_ajax_adapter;
401
-
402
-	/**
403
-	 * The {@link Wordlift_Admin_Input_Element} element renderer.
404
-	 *
405
-	 * @since  3.11.0
406
-	 * @access protected
407
-	 * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
408
-	 */
409
-	protected $input_element;
410
-
411
-	/**
412
-	 * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
413
-	 *
414
-	 * @since  3.11.0
415
-	 * @access protected
416
-	 * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
417
-	 */
418
-	protected $language_select_element;
419
-
420
-	/**
421
-	 * The {@link Wordlift_Admin_Publisher_Element} element renderer.
422
-	 *
423
-	 * @since  3.11.0
424
-	 * @access protected
425
-	 * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
426
-	 */
427
-	protected $publisher_element;
428
-
429
-	/**
430
-	 * The {@link Wordlift_Admin_Select2_Element} element renderer.
431
-	 *
432
-	 * @since  3.11.0
433
-	 * @access protected
434
-	 * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
435
-	 */
436
-	protected $select2_element;
437
-
438
-	/**
439
-	 * The controller for the entity type list admin page
440
-	 *
441
-	 * @since  3.11.0
442
-	 * @access private
443
-	 * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
444
-	 */
445
-	private $entity_type_admin_page;
446
-
447
-	/**
448
-	 * The controller for the entity type settings admin page
449
-	 *
450
-	 * @since  3.11.0
451
-	 * @access private
452
-	 * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
453
-	 */
454
-	private $entity_type_settings_admin_page;
455
-
456
-	/**
457
-	 * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
458
-	 *
459
-	 * @since  3.11.0
460
-	 * @access protected
461
-	 * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
462
-	 */
463
-	protected $related_entities_cloud_widget;
464
-
465
-	/**
466
-	 * {@link Wordlift}'s singleton instance.
467
-	 *
468
-	 * @since  3.11.2
469
-	 *
470
-	 * @since  3.11.2
471
-	 * @access private
472
-	 * @var Wordlift $instance {@link Wordlift}'s singleton instance.
473
-	 */
474
-	private static $instance;
475
-
476
-	/**
477
-	 * Define the core functionality of the plugin.
478
-	 *
479
-	 * Set the plugin name and the plugin version that can be used throughout the plugin.
480
-	 * Load the dependencies, define the locale, and set the hooks for the admin area and
481
-	 * the public-facing side of the site.
482
-	 *
483
-	 * @since    1.0.0
484
-	 */
485
-	public function __construct() {
486
-
487
-		$this->plugin_name = 'wordlift';
488
-		$this->version     = '3.12.0-dev';
489
-		$this->load_dependencies();
490
-		$this->set_locale();
491
-		$this->define_admin_hooks();
492
-		$this->define_public_hooks();
493
-
494
-		self::$instance = $this;
495
-
496
-	}
497
-
498
-	/**
499
-	 * Get the singleton instance.
500
-	 *
501
-	 * @since 3.11.2
502
-	 *
503
-	 * @return Wordlift The {@link Wordlift} singleton instance.
504
-	 */
505
-	public static function get_instance() {
506
-
507
-		return self::$instance;
508
-	}
509
-
510
-	/**
511
-	 * Load the required dependencies for this plugin.
512
-	 *
513
-	 * Include the following files that make up the plugin:
514
-	 *
515
-	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
516
-	 * - Wordlift_i18n. Defines internationalization functionality.
517
-	 * - Wordlift_Admin. Defines all hooks for the admin area.
518
-	 * - Wordlift_Public. Defines all hooks for the public side of the site.
519
-	 *
520
-	 * Create an instance of the loader which will be used to register the hooks
521
-	 * with WordPress.
522
-	 *
523
-	 * @since    1.0.0
524
-	 * @access   private
525
-	 */
526
-	private function load_dependencies() {
527
-
528
-		/**
529
-		 * The class responsible for orchestrating the actions and filters of the
530
-		 * core plugin.
531
-		 */
532
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
533
-
534
-		/**
535
-		 * The class responsible for defining internationalization functionality
536
-		 * of the plugin.
537
-		 */
538
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
539
-
540
-		/**
541
-		 * WordLift's supported languages.
542
-		 */
543
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
544
-
545
-		/**
546
-		 * Provide support functions to sanitize data.
547
-		 */
548
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
549
-
550
-		/**
551
-		 * The Redirect service.
552
-		 */
553
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
554
-
555
-		/**
556
-		 * The Log service.
557
-		 */
558
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
559
-
560
-		/**
561
-		 * The configuration service.
562
-		 */
563
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
32
+    /**
33
+     * The loader that's responsible for maintaining and registering all hooks that power
34
+     * the plugin.
35
+     *
36
+     * @since    1.0.0
37
+     * @access   protected
38
+     * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
39
+     */
40
+    protected $loader;
41
+
42
+    /**
43
+     * The unique identifier of this plugin.
44
+     *
45
+     * @since    1.0.0
46
+     * @access   protected
47
+     * @var      string $plugin_name The string used to uniquely identify this plugin.
48
+     */
49
+    protected $plugin_name;
50
+
51
+    /**
52
+     * The current version of the plugin.
53
+     *
54
+     * @since    1.0.0
55
+     * @access   protected
56
+     * @var      string $version The current version of the plugin.
57
+     */
58
+    protected $version;
59
+
60
+    /**
61
+     * The {@link Wordlift_Tinymce_Adapter} instance.
62
+     *
63
+     * @since  3.12.0
64
+     * @access protected
65
+     * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
66
+     */
67
+    protected $tinymce_adapter;
68
+
69
+    /**
70
+     * The Thumbnail service.
71
+     *
72
+     * @since  3.1.5
73
+     * @access private
74
+     * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
75
+     */
76
+    private $thumbnail_service;
77
+
78
+    /**
79
+     * The UI service.
80
+     *
81
+     * @since  3.2.0
82
+     * @access private
83
+     * @var \Wordlift_UI_Service $ui_service The UI service.
84
+     */
85
+    private $ui_service;
86
+
87
+    /**
88
+     * The Schema service.
89
+     *
90
+     * @since  3.3.0
91
+     * @access private
92
+     * @var \Wordlift_Schema_Service $schema_service The Schema service.
93
+     */
94
+    private $schema_service;
95
+
96
+    /**
97
+     * The Entity service.
98
+     *
99
+     * @since  3.1.0
100
+     * @access protected
101
+     * @var \Wordlift_Entity_Service $entity_service The Entity service.
102
+     */
103
+    protected $entity_service;
104
+
105
+    /**
106
+     * The Topic Taxonomy service.
107
+     *
108
+     * @since  3.5.0
109
+     * @access private
110
+     * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
111
+     */
112
+    private $topic_taxonomy_service;
113
+
114
+    /**
115
+     * The User service.
116
+     *
117
+     * @since  3.1.7
118
+     * @access protected
119
+     * @var \Wordlift_User_Service $user_service The User service.
120
+     */
121
+    protected $user_service;
122
+
123
+    /**
124
+     * The Timeline service.
125
+     *
126
+     * @since  3.1.0
127
+     * @access private
128
+     * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
129
+     */
130
+    private $timeline_service;
131
+
132
+    /**
133
+     * The Redirect service.
134
+     *
135
+     * @since  3.2.0
136
+     * @access private
137
+     * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
138
+     */
139
+    private $redirect_service;
140
+
141
+    /**
142
+     * The Notice service.
143
+     *
144
+     * @since  3.3.0
145
+     * @access private
146
+     * @var \Wordlift_Notice_Service $notice_service The Notice service.
147
+     */
148
+    private $notice_service;
149
+
150
+    /**
151
+     * The Entity list customization.
152
+     *
153
+     * @since  3.3.0
154
+     * @access private
155
+     * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
156
+     */
157
+    private $entity_list_service;
158
+
159
+    /**
160
+     * The Entity Types Taxonomy Walker.
161
+     *
162
+     * @since  3.1.0
163
+     * @access private
164
+     * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
165
+     */
166
+    private $entity_types_taxonomy_walker;
167
+
168
+    /**
169
+     * The ShareThis service.
170
+     *
171
+     * @since  3.2.0
172
+     * @access private
173
+     * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
174
+     */
175
+    private $sharethis_service;
176
+
177
+    /**
178
+     * The PrimaShop adapter.
179
+     *
180
+     * @since  3.2.3
181
+     * @access private
182
+     * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
183
+     */
184
+    private $primashop_adapter;
185
+
186
+    /**
187
+     * The WordLift Dashboard adapter.
188
+     *
189
+     * @since  3.4.0
190
+     * @access private
191
+     * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
192
+     */
193
+    private $dashboard_service;
194
+
195
+    /**
196
+     * The entity type service.
197
+     *
198
+     * @since  3.6.0
199
+     * @access private
200
+     * @var \Wordlift_Entity_Post_Type_Service
201
+     */
202
+    private $entity_post_type_service;
203
+
204
+    /**
205
+     * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
206
+     *
207
+     * @since  3.6.0
208
+     * @access private
209
+     * @var \Wordlift_Entity_Link_Service
210
+     */
211
+    private $entity_link_service;
212
+
213
+    /**
214
+     * A {@link Wordlift_Sparql_Service} instance.
215
+     *
216
+     * @var    3.6.0
217
+     * @access private
218
+     * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
219
+     */
220
+    private $sparql_service;
221
+
222
+    /**
223
+     * A {@link Wordlift_Import_Service} instance.
224
+     *
225
+     * @since  3.6.0
226
+     * @access private
227
+     * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
228
+     */
229
+    private $import_service;
230
+
231
+    /**
232
+     * A {@link Wordlift_Rebuild_Service} instance.
233
+     *
234
+     * @since  3.6.0
235
+     * @access private
236
+     * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
237
+     */
238
+    private $rebuild_service;
239
+
240
+    /**
241
+     * A {@link Wordlift_Jsonld_Service} instance.
242
+     *
243
+     * @since  3.7.0
244
+     * @access protected
245
+     * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
246
+     */
247
+    protected $jsonld_service;
248
+
249
+    /**
250
+     *
251
+     * @since  3.7.0
252
+     * @access private
253
+     * @var \Wordlift_Property_Factory $property_factory
254
+     */
255
+    private $property_factory;
256
+
257
+    /**
258
+     * The 'Download Your Data' page.
259
+     *
260
+     * @since  3.6.0
261
+     * @access private
262
+     * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
263
+     */
264
+    private $download_your_data_page;
265
+
266
+    /**
267
+     * The 'WordLift Settings' page.
268
+     *
269
+     * @since  3.11.0
270
+     * @access protected
271
+     * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
272
+     */
273
+    protected $settings_page;
274
+
275
+    /**
276
+     * The install wizard page.
277
+     *
278
+     * @since  3.9.0
279
+     * @access private
280
+     * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
281
+     */
282
+    private $admin_setup;
283
+
284
+    /**
285
+     * The Content Filter Service hooks up to the 'the_content' filter and provides
286
+     * linking of entities to their pages.
287
+     *
288
+     * @since  3.8.0
289
+     * @access private
290
+     * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
291
+     */
292
+    private $content_filter_service;
293
+
294
+    /**
295
+     * A {@link Wordlift_Key_Validation_Service} instance.
296
+     *
297
+     * @since  3.9.0
298
+     * @access private
299
+     * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
300
+     */
301
+    private $key_validation_service;
302
+
303
+    /**
304
+     * A {@link Wordlift_Rating_Service} instance.
305
+     *
306
+     * @since  3.10.0
307
+     * @access private
308
+     * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
309
+     */
310
+    private $rating_service;
311
+
312
+    /**
313
+     * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
314
+     *
315
+     * @since  3.10.0
316
+     * @access protected
317
+     * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
318
+     */
319
+    protected $post_to_jsonld_converter;
320
+
321
+    /**
322
+     * A {@link Wordlift_Configuration_Service} instance.
323
+     *
324
+     * @since  3.10.0
325
+     * @access protected
326
+     * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
327
+     */
328
+    protected $configuration_service;
329
+
330
+    /**
331
+     * A {@link Wordlift_Entity_Type_Service} instance.
332
+     *
333
+     * @since  3.10.0
334
+     * @access protected
335
+     * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
336
+     */
337
+    protected $entity_type_service;
338
+
339
+    /**
340
+     * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
341
+     *
342
+     * @since  3.10.0
343
+     * @access protected
344
+     * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
345
+     */
346
+    protected $entity_post_to_jsonld_converter;
347
+
348
+    /**
349
+     * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
350
+     *
351
+     * @since  3.10.0
352
+     * @access protected
353
+     * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
354
+     */
355
+    protected $postid_to_jsonld_converter;
356
+
357
+    /**
358
+     * The {@link Wordlift_Admin_Status_Page} class.
359
+     *
360
+     * @since  3.9.8
361
+     * @access private
362
+     * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
363
+     */
364
+    private $status_page;
365
+
366
+    /**
367
+     * The {@link Wordlift_Category_Taxonomy_Service} instance.
368
+     *
369
+     * @since  3.11.0
370
+     * @access protected
371
+     * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
372
+     */
373
+    protected $category_taxonomy_service;
374
+
375
+    /**
376
+     * The {@link Wordlift_Event_Entity_Page_Service} instance.
377
+     *
378
+     * @since  3.11.0
379
+     * @access protected
380
+     * @var \Wordlift_Event_Entity_Page_Service $event_entity_page_service The {@link Wordlift_Event_Entity_Page_Service} instance.
381
+     */
382
+    protected $event_entity_page_service;
383
+
384
+    /**
385
+     * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
386
+     *
387
+     * @since  3.11.0
388
+     * @access protected
389
+     * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
390
+     */
391
+    protected $settings_page_action_link;
392
+
393
+    /**
394
+     * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
395
+     *
396
+     * @since  3.11.0
397
+     * @access protected
398
+     * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
399
+     */
400
+    protected $publisher_ajax_adapter;
401
+
402
+    /**
403
+     * The {@link Wordlift_Admin_Input_Element} element renderer.
404
+     *
405
+     * @since  3.11.0
406
+     * @access protected
407
+     * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
408
+     */
409
+    protected $input_element;
410
+
411
+    /**
412
+     * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
413
+     *
414
+     * @since  3.11.0
415
+     * @access protected
416
+     * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
417
+     */
418
+    protected $language_select_element;
419
+
420
+    /**
421
+     * The {@link Wordlift_Admin_Publisher_Element} element renderer.
422
+     *
423
+     * @since  3.11.0
424
+     * @access protected
425
+     * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
426
+     */
427
+    protected $publisher_element;
428
+
429
+    /**
430
+     * The {@link Wordlift_Admin_Select2_Element} element renderer.
431
+     *
432
+     * @since  3.11.0
433
+     * @access protected
434
+     * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
435
+     */
436
+    protected $select2_element;
437
+
438
+    /**
439
+     * The controller for the entity type list admin page
440
+     *
441
+     * @since  3.11.0
442
+     * @access private
443
+     * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
444
+     */
445
+    private $entity_type_admin_page;
446
+
447
+    /**
448
+     * The controller for the entity type settings admin page
449
+     *
450
+     * @since  3.11.0
451
+     * @access private
452
+     * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
453
+     */
454
+    private $entity_type_settings_admin_page;
455
+
456
+    /**
457
+     * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
458
+     *
459
+     * @since  3.11.0
460
+     * @access protected
461
+     * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
462
+     */
463
+    protected $related_entities_cloud_widget;
464
+
465
+    /**
466
+     * {@link Wordlift}'s singleton instance.
467
+     *
468
+     * @since  3.11.2
469
+     *
470
+     * @since  3.11.2
471
+     * @access private
472
+     * @var Wordlift $instance {@link Wordlift}'s singleton instance.
473
+     */
474
+    private static $instance;
475
+
476
+    /**
477
+     * Define the core functionality of the plugin.
478
+     *
479
+     * Set the plugin name and the plugin version that can be used throughout the plugin.
480
+     * Load the dependencies, define the locale, and set the hooks for the admin area and
481
+     * the public-facing side of the site.
482
+     *
483
+     * @since    1.0.0
484
+     */
485
+    public function __construct() {
486
+
487
+        $this->plugin_name = 'wordlift';
488
+        $this->version     = '3.12.0-dev';
489
+        $this->load_dependencies();
490
+        $this->set_locale();
491
+        $this->define_admin_hooks();
492
+        $this->define_public_hooks();
493
+
494
+        self::$instance = $this;
495
+
496
+    }
497
+
498
+    /**
499
+     * Get the singleton instance.
500
+     *
501
+     * @since 3.11.2
502
+     *
503
+     * @return Wordlift The {@link Wordlift} singleton instance.
504
+     */
505
+    public static function get_instance() {
506
+
507
+        return self::$instance;
508
+    }
509
+
510
+    /**
511
+     * Load the required dependencies for this plugin.
512
+     *
513
+     * Include the following files that make up the plugin:
514
+     *
515
+     * - Wordlift_Loader. Orchestrates the hooks of the plugin.
516
+     * - Wordlift_i18n. Defines internationalization functionality.
517
+     * - Wordlift_Admin. Defines all hooks for the admin area.
518
+     * - Wordlift_Public. Defines all hooks for the public side of the site.
519
+     *
520
+     * Create an instance of the loader which will be used to register the hooks
521
+     * with WordPress.
522
+     *
523
+     * @since    1.0.0
524
+     * @access   private
525
+     */
526
+    private function load_dependencies() {
527
+
528
+        /**
529
+         * The class responsible for orchestrating the actions and filters of the
530
+         * core plugin.
531
+         */
532
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
533
+
534
+        /**
535
+         * The class responsible for defining internationalization functionality
536
+         * of the plugin.
537
+         */
538
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
539
+
540
+        /**
541
+         * WordLift's supported languages.
542
+         */
543
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
544
+
545
+        /**
546
+         * Provide support functions to sanitize data.
547
+         */
548
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
549
+
550
+        /**
551
+         * The Redirect service.
552
+         */
553
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
554
+
555
+        /**
556
+         * The Log service.
557
+         */
558
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
559
+
560
+        /**
561
+         * The configuration service.
562
+         */
563
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
564
+
565
+        /**
566
+         * The entity post type service (this is the WordPress post type, not the entity schema type).
567
+         */
568
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
569
+
570
+        /**
571
+         * The entity type service (i.e. the schema type).
572
+         */
573
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
574
+
575
+        /**
576
+         * The entity link service.
577
+         */
578
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
579
+
580
+        /**
581
+         * The Query builder.
582
+         */
583
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
584
+
585
+        /**
586
+         * The Schema service.
587
+         */
588
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
589
+
590
+        /**
591
+         * The schema:url property service.
592
+         */
593
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
594
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
595
+
596
+        /**
597
+         * The UI service.
598
+         */
599
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
600
+
601
+        /**
602
+         * The Thumbnail service.
603
+         */
604
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
605
+
606
+        /**
607
+         * The Entity Types Taxonomy service.
608
+         */
609
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
610
+
611
+        /**
612
+         * The Entity service.
613
+         */
614
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
615
+
616
+        // Add the entity rating service.
617
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
618
+
619
+        /**
620
+         * The User service.
621
+         */
622
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
623
+
624
+        /**
625
+         * The Timeline service.
626
+         */
627
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
628
+
629
+        /**
630
+         * The Topic Taxonomy service.
631
+         */
632
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
633
+
634
+        /**
635
+         * The SPARQL service.
636
+         */
637
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
638
+
639
+        /**
640
+         * The WordLift import service.
641
+         */
642
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
643
+
644
+        /**
645
+         * The WordLift URI service.
646
+         */
647
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
648
+
649
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php';
650
+
651
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
652
+
653
+        /**
654
+         * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
655
+         */
656
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php';
657
+
658
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
659
+
660
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
661
+
662
+        /**
663
+         * Load the converters.
664
+         */
665
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
666
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
667
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
668
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
669
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
670
+
671
+        /**
672
+         * Load the content filter.
673
+         */
674
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
675
+
676
+        /**
677
+         * Load the JSON-LD service to publish entities using JSON-LD.s
678
+         *
679
+         * @since 3.8.0
680
+         */
681
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
682
+
683
+        // The Publisher Service and the AJAX adapter.
684
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
685
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
686
+
687
+        /**
688
+         * Load the WordLift key validation service.
689
+         */
690
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
691
+
692
+        // Load the `Wordlift_Category_Taxonomy_Service` class definition.
693
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
694
+
695
+        // Load the `Wordlift_Event_Entity_Page_Service` class definition.
696
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-event-entity-page-service.php';
697
+
698
+        /** Adapters. */
699
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
700
+
701
+        /**
702
+         * The class responsible for defining all actions that occur in the admin area.
703
+         */
704
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
705
+
706
+        /**
707
+         * The class to customize the entity list admin page.
708
+         */
709
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
710
+
711
+        /**
712
+         * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
713
+         */
714
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
715
+
716
+        /**
717
+         * The Notice service.
718
+         */
719
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
720
+
721
+        /**
722
+         * The PrimaShop adapter.
723
+         */
724
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
725
+
726
+        /**
727
+         * The WordLift Dashboard service.
728
+         */
729
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
730
+
731
+        /**
732
+         * The admin 'Install wizard' page.
733
+         */
734
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
735
+
736
+        /**
737
+         * The WordLift entity type list admin page controller.
738
+         */
739
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
740
+
741
+        /**
742
+         * The WordLift entity type settings admin page controller.
743
+         */
744
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
745
+
746
+        /**
747
+         * The admin 'Download Your Data' page.
748
+         */
749
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
750
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
751
+
752
+        /**
753
+         * The admin 'Download Your Data' page.
754
+         */
755
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
756
+
757
+        /**
758
+         * The admin 'WordLift Settings' page.
759
+         */
760
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
761
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
762
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
763
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
764
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
765
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
766
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
767
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
768
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
769
+
770
+        /** Admin Pages */
771
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
772
+
773
+        /**
774
+         * The class responsible for defining all actions that occur in the public-facing
775
+         * side of the site.
776
+         */
777
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
778
+
779
+        /**
780
+         * The shortcode abstract class.
781
+         */
782
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
783
+
784
+        /**
785
+         * The Timeline shortcode.
786
+         */
787
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
788
+
789
+        /**
790
+         * The Navigator shortcode.
791
+         */
792
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
793
+
794
+        /**
795
+         * The chord shortcode.
796
+         */
797
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
798
+
799
+        /**
800
+         * The geomap shortcode.
801
+         */
802
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
564 803
 
565
-		/**
566
-		 * The entity post type service (this is the WordPress post type, not the entity schema type).
567
-		 */
568
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
569
-
570
-		/**
571
-		 * The entity type service (i.e. the schema type).
572
-		 */
573
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
804
+        /**
805
+         * The entity cloud shortcode.
806
+         */
807
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
574 808
 
575
-		/**
576
-		 * The entity link service.
577
-		 */
578
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
809
+        /**
810
+         * The ShareThis service.
811
+         */
812
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
579 813
 
580
-		/**
581
-		 * The Query builder.
582
-		 */
583
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
584
-
585
-		/**
586
-		 * The Schema service.
587
-		 */
588
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
589
-
590
-		/**
591
-		 * The schema:url property service.
592
-		 */
593
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
594
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
595
-
596
-		/**
597
-		 * The UI service.
598
-		 */
599
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
600
-
601
-		/**
602
-		 * The Thumbnail service.
603
-		 */
604
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
605
-
606
-		/**
607
-		 * The Entity Types Taxonomy service.
608
-		 */
609
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
610
-
611
-		/**
612
-		 * The Entity service.
613
-		 */
614
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
615
-
616
-		// Add the entity rating service.
617
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
618
-
619
-		/**
620
-		 * The User service.
621
-		 */
622
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
623
-
624
-		/**
625
-		 * The Timeline service.
626
-		 */
627
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
628
-
629
-		/**
630
-		 * The Topic Taxonomy service.
631
-		 */
632
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
633
-
634
-		/**
635
-		 * The SPARQL service.
636
-		 */
637
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
638
-
639
-		/**
640
-		 * The WordLift import service.
641
-		 */
642
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
643
-
644
-		/**
645
-		 * The WordLift URI service.
646
-		 */
647
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
648
-
649
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php';
650
-
651
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
652
-
653
-		/**
654
-		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
655
-		 */
656
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php';
657
-
658
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
659
-
660
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
661
-
662
-		/**
663
-		 * Load the converters.
664
-		 */
665
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
666
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
667
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
668
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
669
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
670
-
671
-		/**
672
-		 * Load the content filter.
673
-		 */
674
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
675
-
676
-		/**
677
-		 * Load the JSON-LD service to publish entities using JSON-LD.s
678
-		 *
679
-		 * @since 3.8.0
680
-		 */
681
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
682
-
683
-		// The Publisher Service and the AJAX adapter.
684
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
685
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
686
-
687
-		/**
688
-		 * Load the WordLift key validation service.
689
-		 */
690
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
691
-
692
-		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
693
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
694
-
695
-		// Load the `Wordlift_Event_Entity_Page_Service` class definition.
696
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-event-entity-page-service.php';
697
-
698
-		/** Adapters. */
699
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
700
-
701
-		/**
702
-		 * The class responsible for defining all actions that occur in the admin area.
703
-		 */
704
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
705
-
706
-		/**
707
-		 * The class to customize the entity list admin page.
708
-		 */
709
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
710
-
711
-		/**
712
-		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
713
-		 */
714
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
715
-
716
-		/**
717
-		 * The Notice service.
718
-		 */
719
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
720
-
721
-		/**
722
-		 * The PrimaShop adapter.
723
-		 */
724
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
725
-
726
-		/**
727
-		 * The WordLift Dashboard service.
728
-		 */
729
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
730
-
731
-		/**
732
-		 * The admin 'Install wizard' page.
733
-		 */
734
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
735
-
736
-		/**
737
-		 * The WordLift entity type list admin page controller.
738
-		 */
739
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
740
-
741
-		/**
742
-		 * The WordLift entity type settings admin page controller.
743
-		 */
744
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
745
-
746
-		/**
747
-		 * The admin 'Download Your Data' page.
748
-		 */
749
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
750
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
751
-
752
-		/**
753
-		 * The admin 'Download Your Data' page.
754
-		 */
755
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
756
-
757
-		/**
758
-		 * The admin 'WordLift Settings' page.
759
-		 */
760
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
761
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
762
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
763
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
764
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
765
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
766
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
767
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
768
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
769
-
770
-		/** Admin Pages */
771
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
772
-
773
-		/**
774
-		 * The class responsible for defining all actions that occur in the public-facing
775
-		 * side of the site.
776
-		 */
777
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
778
-
779
-		/**
780
-		 * The shortcode abstract class.
781
-		 */
782
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
783
-
784
-		/**
785
-		 * The Timeline shortcode.
786
-		 */
787
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
788
-
789
-		/**
790
-		 * The Navigator shortcode.
791
-		 */
792
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
793
-
794
-		/**
795
-		 * The chord shortcode.
796
-		 */
797
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
798
-
799
-		/**
800
-		 * The geomap shortcode.
801
-		 */
802
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
803
-
804
-		/**
805
-		 * The entity cloud shortcode.
806
-		 */
807
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
808
-
809
-		/**
810
-		 * The ShareThis service.
811
-		 */
812
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
813
-
814
-		/**
815
-		 * The SEO service.
816
-		 */
817
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
814
+        /**
815
+         * The SEO service.
816
+         */
817
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
818 818
 
819
-		/** Widgets */
820
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
821
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
819
+        /** Widgets */
820
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
821
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
822 822
 
823
-		$this->loader = new Wordlift_Loader();
823
+        $this->loader = new Wordlift_Loader();
824 824
 
825
-		// Instantiate a global logger.
826
-		global $wl_logger;
827
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
825
+        // Instantiate a global logger.
826
+        global $wl_logger;
827
+        $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
828 828
 
829
-		// Create the configuration service.
830
-		$this->configuration_service = new Wordlift_Configuration_Service();
829
+        // Create the configuration service.
830
+        $this->configuration_service = new Wordlift_Configuration_Service();
831 831
 
832
-		// Create an entity type service instance. It'll be later bound to the init action.
833
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
832
+        // Create an entity type service instance. It'll be later bound to the init action.
833
+        $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
834 834
 
835
-		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
836
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
835
+        // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
836
+        $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
837 837
 
838
-		// Create an instance of the UI service.
839
-		$this->ui_service = new Wordlift_UI_Service();
838
+        // Create an instance of the UI service.
839
+        $this->ui_service = new Wordlift_UI_Service();
840 840
 
841
-		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
842
-		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
841
+        // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
842
+        $this->thumbnail_service = new Wordlift_Thumbnail_Service();
843 843
 
844
-		$this->sparql_service = new Wordlift_Sparql_Service();
844
+        $this->sparql_service = new Wordlift_Sparql_Service();
845 845
 
846
-		// Create an instance of the Schema service.
847
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
848
-		$this->schema_service        = new Wordlift_Schema_Service();
846
+        // Create an instance of the Schema service.
847
+        $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
848
+        $this->schema_service        = new Wordlift_Schema_Service();
849 849
 
850
-		// Create an instance of the Notice service.
851
-		$this->notice_service = new Wordlift_Notice_Service();
850
+        // Create an instance of the Notice service.
851
+        $this->notice_service = new Wordlift_Notice_Service();
852 852
 
853
-		// Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page.
854
-		$this->entity_service = new Wordlift_Entity_Service( $this->ui_service );
853
+        // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page.
854
+        $this->entity_service = new Wordlift_Entity_Service( $this->ui_service );
855 855
 
856
-		// Create an instance of the User service.
857
-		$this->user_service = new Wordlift_User_Service();
856
+        // Create an instance of the User service.
857
+        $this->user_service = new Wordlift_User_Service();
858 858
 
859
-		// Create a new instance of the Timeline service and Timeline shortcode.
860
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
859
+        // Create a new instance of the Timeline service and Timeline shortcode.
860
+        $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
861 861
 
862
-		// Create a new instance of the Redirect service.
863
-		$this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service );
862
+        // Create a new instance of the Redirect service.
863
+        $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service );
864 864
 
865
-		// Initialize the shortcodes.
866
-		new Wordlift_Navigator_Shortcode();
867
-		new Wordlift_Chord_Shortcode();
868
-		new Wordlift_Geomap_Shortcode();
869
-		new Wordlift_Timeline_Shortcode();
870
-		new Wordlift_Related_Entities_Cloud_Shortcode();
865
+        // Initialize the shortcodes.
866
+        new Wordlift_Navigator_Shortcode();
867
+        new Wordlift_Chord_Shortcode();
868
+        new Wordlift_Geomap_Shortcode();
869
+        new Wordlift_Timeline_Shortcode();
870
+        new Wordlift_Related_Entities_Cloud_Shortcode();
871 871
 
872
-		// Initialize the SEO service.
873
-		new Wordlift_Seo_Service();
872
+        // Initialize the SEO service.
873
+        new Wordlift_Seo_Service();
874 874
 
875
-		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
875
+        $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
876 876
 
877
-		$this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service();
877
+        $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service();
878 878
 
879
-		// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
880
-		$this->sharethis_service = new Wordlift_ShareThis_Service();
879
+        // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
880
+        $this->sharethis_service = new Wordlift_ShareThis_Service();
881 881
 
882
-		// Create an instance of the PrimaShop adapter.
883
-		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
882
+        // Create an instance of the PrimaShop adapter.
883
+        $this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
884 884
 
885
-		// Create an import service instance to hook later to WP's import function.
886
-		$this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() );
885
+        // Create an import service instance to hook later to WP's import function.
886
+        $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() );
887 887
 
888
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
888
+        $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
889 889
 
890
-		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
891
-		$this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service );
890
+        // Create a Rebuild Service instance, which we'll later bound to an ajax call.
891
+        $this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service );
892 892
 
893
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
893
+        $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
894 894
 
895
-		// Create the entity rating service.
896
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
895
+        // Create the entity rating service.
896
+        $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
897 897
 
898
-		// Create entity list customization (wp-admin/edit.php)
899
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
898
+        // Create entity list customization (wp-admin/edit.php)
899
+        $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
900 900
 
901
-		// Create a new instance of the Redirect service.
902
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service );
901
+        // Create a new instance of the Redirect service.
902
+        $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service );
903 903
 
904
-		$this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service );
905
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
904
+        $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service );
905
+        $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
906 906
 
907
-		$attachment_service = new Wordlift_Attachment_Service();
907
+        $attachment_service = new Wordlift_Attachment_Service();
908 908
 
909
-		// Instantiate the JSON-LD service.
910
-		$property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
911
-		$this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter );
912
-		$this->post_to_jsonld_converter        = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
913
-		$this->postid_to_jsonld_converter      = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter );
914
-		$this->jsonld_service                  = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter );
909
+        // Instantiate the JSON-LD service.
910
+        $property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
911
+        $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter );
912
+        $this->post_to_jsonld_converter        = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
913
+        $this->postid_to_jsonld_converter      = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter );
914
+        $this->jsonld_service                  = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter );
915 915
 
916
-		// Create an instance of the Key Validation service. This service is later hooked to provide an AJAX call (only for admins).
917
-		$this->key_validation_service = new Wordlift_Key_Validation_Service();
916
+        // Create an instance of the Key Validation service. This service is later hooked to provide an AJAX call (only for admins).
917
+        $this->key_validation_service = new Wordlift_Key_Validation_Service();
918 918
 
919
-		// Create an instance of the Publisher Service and the AJAX Adapter.
920
-		$publisher_service            = new Wordlift_Publisher_Service();
921
-		$this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $publisher_service );
919
+        // Create an instance of the Publisher Service and the AJAX Adapter.
920
+        $publisher_service            = new Wordlift_Publisher_Service();
921
+        $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $publisher_service );
922 922
 
923
-		/** Adapters. */
924
-		$this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this );
923
+        /** Adapters. */
924
+        $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this );
925 925
 
926
-		/** WordPress Admin UI. */
926
+        /** WordPress Admin UI. */
927 927
 
928
-		// UI elements.
929
-		$this->input_element           = new Wordlift_Admin_Input_Element();
930
-		$this->select2_element         = new Wordlift_Admin_Select2_Element();
931
-		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
932
-		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
933
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element );
928
+        // UI elements.
929
+        $this->input_element           = new Wordlift_Admin_Input_Element();
930
+        $this->select2_element         = new Wordlift_Admin_Select2_Element();
931
+        $this->language_select_element = new Wordlift_Admin_Language_Select_Element();
932
+        $tabs_element                  = new Wordlift_Admin_Tabs_Element();
933
+        $this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element );
934 934
 
935
-		$this->download_your_data_page   = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
936
-		$this->status_page               = new Wordlift_Admin_Status_Page();
937
-		$this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element );
938
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
935
+        $this->download_your_data_page   = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
936
+        $this->status_page               = new Wordlift_Admin_Status_Page();
937
+        $this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element );
938
+        $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
939 939
 
940
-		// Pages.
941
-		new Wordlift_Admin_Post_Edit_Page( $this );
940
+        // Pages.
941
+        new Wordlift_Admin_Post_Edit_Page( $this );
942 942
 
943
-		// create an instance of the entity type list admin page controller.
944
-		$this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
943
+        // create an instance of the entity type list admin page controller.
944
+        $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
945 945
 
946
-		// create an instance of the entity type etting admin page controller.
947
-		$this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
946
+        // create an instance of the entity type etting admin page controller.
947
+        $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
948 948
 
949
-		/** Widgets */
950
-		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
949
+        /** Widgets */
950
+        $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
951 951
 
952
-		//** WordPress Admin */
953
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
954
-		$this->status_page             = new Wordlift_Admin_Status_Page();
952
+        //** WordPress Admin */
953
+        $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
954
+        $this->status_page             = new Wordlift_Admin_Status_Page();
955 955
 
956
-		// Create an instance of the install wizard.
957
-		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
956
+        // Create an instance of the install wizard.
957
+        $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
958 958
 
959
-		// Create an instance of the content filter service.
960
-		$this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service );
959
+        // Create an instance of the content filter service.
960
+        $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service );
961 961
 
962
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
962
+        $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
963 963
 
964
-		$this->event_entity_page_service = new Wordlift_Event_Entity_Page_Service();
964
+        $this->event_entity_page_service = new Wordlift_Event_Entity_Page_Service();
965 965
 
966
-		// Load the debug service if WP is in debug mode.
967
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
968
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
969
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
970
-		}
966
+        // Load the debug service if WP is in debug mode.
967
+        if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
968
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
969
+            new Wordlift_Debug_Service( $this->entity_service, $uri_service );
970
+        }
971 971
 
972
-	}
972
+    }
973 973
 
974
-	/**
975
-	 * Define the locale for this plugin for internationalization.
976
-	 *
977
-	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
978
-	 * with WordPress.
979
-	 *
980
-	 * @since    1.0.0
981
-	 * @access   private
982
-	 */
983
-	private function set_locale() {
974
+    /**
975
+     * Define the locale for this plugin for internationalization.
976
+     *
977
+     * Uses the Wordlift_i18n class in order to set the domain and to register the hook
978
+     * with WordPress.
979
+     *
980
+     * @since    1.0.0
981
+     * @access   private
982
+     */
983
+    private function set_locale() {
984 984
 
985
-		$plugin_i18n = new Wordlift_i18n();
986
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
985
+        $plugin_i18n = new Wordlift_i18n();
986
+        $plugin_i18n->set_domain( $this->get_plugin_name() );
987 987
 
988
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
988
+        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
989 989
 
990
-	}
990
+    }
991 991
 
992
-	/**
993
-	 * Register all of the hooks related to the admin area functionality
994
-	 * of the plugin.
995
-	 *
996
-	 * @since    1.0.0
997
-	 * @access   private
998
-	 */
999
-	private function define_admin_hooks() {
992
+    /**
993
+     * Register all of the hooks related to the admin area functionality
994
+     * of the plugin.
995
+     *
996
+     * @since    1.0.0
997
+     * @access   private
998
+     */
999
+    private function define_admin_hooks() {
1000 1000
 
1001
-		$plugin_admin = new Wordlift_Admin(
1002
-			$this->get_plugin_name(),
1003
-			$this->get_version(),
1004
-			$this->configuration_service,
1005
-			$this->notice_service
1006
-		);
1001
+        $plugin_admin = new Wordlift_Admin(
1002
+            $this->get_plugin_name(),
1003
+            $this->get_version(),
1004
+            $this->configuration_service,
1005
+            $this->notice_service
1006
+        );
1007 1007
 
1008
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1009
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1008
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1009
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1010 1010
 
1011
-		// Hook the init action to the Topic Taxonomy service.
1012
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1011
+        // Hook the init action to the Topic Taxonomy service.
1012
+        $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1013 1013
 
1014
-		// Hook the deleted_post_meta action to the Thumbnail service.
1015
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1014
+        // Hook the deleted_post_meta action to the Thumbnail service.
1015
+        $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1016 1016
 
1017
-		// Hook the added_post_meta action to the Thumbnail service.
1018
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1017
+        // Hook the added_post_meta action to the Thumbnail service.
1018
+        $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1019 1019
 
1020
-		// Hook the updated_post_meta action to the Thumbnail service.
1021
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1020
+        // Hook the updated_post_meta action to the Thumbnail service.
1021
+        $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1022 1022
 
1023
-		// Hook posts inserts (or updates) to the user service.
1024
-		$this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
1023
+        // Hook posts inserts (or updates) to the user service.
1024
+        $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
1025 1025
 
1026
-		// Hook the AJAX wl_timeline action to the Timeline service.
1027
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1026
+        // Hook the AJAX wl_timeline action to the Timeline service.
1027
+        $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1028 1028
 
1029
-		// Register custom allowed redirect hosts.
1030
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1031
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1032
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1033
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1034
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1035
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1036
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1029
+        // Register custom allowed redirect hosts.
1030
+        $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1031
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1032
+        $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1033
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1034
+        $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1035
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1036
+        $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1037 1037
 
1038
-		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1039
-		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1040
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1041
-		$this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 );
1038
+        // Hook save_post to the entity service to update custom fields (such as alternate labels).
1039
+        // We have a priority of 9 because we want to be executed before data is sent to Redlink.
1040
+        $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1041
+        $this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 );
1042 1042
 
1043
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1044
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1043
+        $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1044
+        $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1045 1045
 
1046
-		// Entity listing customization (wp-admin/edit.php)
1047
-		// Add custom columns
1048
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1049
-		$this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1050
-		// Add 4W selection
1051
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1052
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1046
+        // Entity listing customization (wp-admin/edit.php)
1047
+        // Add custom columns
1048
+        $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1049
+        $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1050
+        // Add 4W selection
1051
+        $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1052
+        $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1053 1053
 
1054
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1054
+        $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1055 1055
 
1056
-		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1057
-		// entities.
1058
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1056
+        // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1057
+        // entities.
1058
+        $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1059 1059
 
1060
-		// Filter imported post meta.
1061
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1060
+        // Filter imported post meta.
1061
+        $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1062 1062
 
1063
-		// Notify the import service when an import starts and ends.
1064
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1065
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1063
+        // Notify the import service when an import starts and ends.
1064
+        $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1065
+        $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1066 1066
 
1067
-		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1068
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1067
+        // Hook the AJAX wl_rebuild action to the Rebuild Service.
1068
+        $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1069 1069
 
1070
-		// Hook the menu to the Download Your Data page.
1071
-		$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1072
-		$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1073
-		$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1070
+        // Hook the menu to the Download Your Data page.
1071
+        $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1072
+        $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1073
+        $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1074 1074
 
1075
-		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1076
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1075
+        // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1076
+        $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1077 1077
 
1078
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1079
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1078
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1079
+        $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1080 1080
 
1081
-		// Hook the AJAX wl_validate_key action to the Key Validation service.
1082
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1081
+        // Hook the AJAX wl_validate_key action to the Key Validation service.
1082
+        $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1083 1083
 
1084
-		// Hook the `admin_init` function to the Admin Setup.
1085
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1084
+        // Hook the `admin_init` function to the Admin Setup.
1085
+        $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1086 1086
 
1087
-		// Hook the admin_init to the settings page.
1088
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1087
+        // Hook the admin_init to the settings page.
1088
+        $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1089 1089
 
1090
-		// Hook the menu creation on the general wordlift menu creation
1091
-		$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1090
+        // Hook the menu creation on the general wordlift menu creation
1091
+        $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1092 1092
 
1093
-		// Hook key update.
1094
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1095
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1093
+        // Hook key update.
1094
+        $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1095
+        $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1096 1096
 
1097
-		// Add additional action links to the WordLift plugin in the plugins page.
1098
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1097
+        // Add additional action links to the WordLift plugin in the plugins page.
1098
+        $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1099 1099
 
1100
-		// Hook the AJAX `wl_publisher` action name.
1101
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1100
+        // Hook the AJAX `wl_publisher` action name.
1101
+        $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1102 1102
 
1103
-		// Hook row actions for the entity type list admin.
1104
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1103
+        // Hook row actions for the entity type list admin.
1104
+        $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1105 1105
 
1106
-		/** Adapters. */
1107
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1106
+        /** Adapters. */
1107
+        $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1108 1108
 
1109
-		// Hooks to restrict multisite super admin from manipulating entity types.
1110
-		if ( is_multisite() ) {
1111
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1112
-		}
1113
-	}
1109
+        // Hooks to restrict multisite super admin from manipulating entity types.
1110
+        if ( is_multisite() ) {
1111
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1112
+        }
1113
+    }
1114 1114
 
1115
-	/**
1116
-	 * Register all of the hooks related to the public-facing functionality
1117
-	 * of the plugin.
1118
-	 *
1119
-	 * @since    1.0.0
1120
-	 * @access   private
1121
-	 */
1122
-	private function define_public_hooks() {
1115
+    /**
1116
+     * Register all of the hooks related to the public-facing functionality
1117
+     * of the plugin.
1118
+     *
1119
+     * @since    1.0.0
1120
+     * @access   private
1121
+     */
1122
+    private function define_public_hooks() {
1123 1123
 
1124
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1124
+        $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1125 1125
 
1126
-		// Register the entity post type.
1127
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1126
+        // Register the entity post type.
1127
+        $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1128 1128
 
1129
-		// Bind the link generation and handling hooks to the entity link service.
1130
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1131
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', 10, 1 );
1132
-		$this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 );
1133
-		$this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 );
1129
+        // Bind the link generation and handling hooks to the entity link service.
1130
+        $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1131
+        $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', 10, 1 );
1132
+        $this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 );
1133
+        $this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 );
1134 1134
 
1135
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1136
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1135
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1136
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1137 1137
 
1138
-		// Hook the content filter service to add entity links.
1139
-		$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1138
+        // Hook the content filter service to add entity links.
1139
+        $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1140 1140
 
1141
-		// Hook the AJAX wl_timeline action to the Timeline service.
1142
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1141
+        // Hook the AJAX wl_timeline action to the Timeline service.
1142
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1143 1143
 
1144
-		// Hook the ShareThis service.
1145
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1146
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1144
+        // Hook the ShareThis service.
1145
+        $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1146
+        $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1147 1147
 
1148
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1149
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1148
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1149
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1150 1150
 
1151
-		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1152
-		// in order to tweak WP's `WP_Query` to include entities in queries related
1153
-		// to categories.
1154
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1151
+        // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1152
+        // in order to tweak WP's `WP_Query` to include entities in queries related
1153
+        // to categories.
1154
+        $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1155 1155
 
1156
-		/*
1156
+        /*
1157 1157
 		 * Hook the `pre_get_posts` action to the `Wordlift_Event_Entity_Page_Service`
1158 1158
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1159 1159
 		 * order of start time.
1160 1160
 		 */
1161
-		$this->loader->add_action( 'pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1 );
1162
-
1163
-	}
1164
-
1165
-	/**
1166
-	 * Run the loader to execute all of the hooks with WordPress.
1167
-	 *
1168
-	 * @since    1.0.0
1169
-	 */
1170
-	public function run() {
1171
-		$this->loader->run();
1172
-	}
1173
-
1174
-	/**
1175
-	 * The name of the plugin used to uniquely identify it within the context of
1176
-	 * WordPress and to define internationalization functionality.
1177
-	 *
1178
-	 * @since     1.0.0
1179
-	 * @return    string    The name of the plugin.
1180
-	 */
1181
-	public function get_plugin_name() {
1182
-		return $this->plugin_name;
1183
-	}
1184
-
1185
-	/**
1186
-	 * The reference to the class that orchestrates the hooks with the plugin.
1187
-	 *
1188
-	 * @since     1.0.0
1189
-	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1190
-	 */
1191
-	public function get_loader() {
1192
-		return $this->loader;
1193
-	}
1194
-
1195
-	/**
1196
-	 * Retrieve the version number of the plugin.
1197
-	 *
1198
-	 * @since     1.0.0
1199
-	 * @return    string    The version number of the plugin.
1200
-	 */
1201
-	public function get_version() {
1202
-		return $this->version;
1203
-	}
1161
+        $this->loader->add_action( 'pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1 );
1162
+
1163
+    }
1164
+
1165
+    /**
1166
+     * Run the loader to execute all of the hooks with WordPress.
1167
+     *
1168
+     * @since    1.0.0
1169
+     */
1170
+    public function run() {
1171
+        $this->loader->run();
1172
+    }
1173
+
1174
+    /**
1175
+     * The name of the plugin used to uniquely identify it within the context of
1176
+     * WordPress and to define internationalization functionality.
1177
+     *
1178
+     * @since     1.0.0
1179
+     * @return    string    The name of the plugin.
1180
+     */
1181
+    public function get_plugin_name() {
1182
+        return $this->plugin_name;
1183
+    }
1184
+
1185
+    /**
1186
+     * The reference to the class that orchestrates the hooks with the plugin.
1187
+     *
1188
+     * @since     1.0.0
1189
+     * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1190
+     */
1191
+    public function get_loader() {
1192
+        return $this->loader;
1193
+    }
1194
+
1195
+    /**
1196
+     * Retrieve the version number of the plugin.
1197
+     *
1198
+     * @since     1.0.0
1199
+     * @return    string    The version number of the plugin.
1200
+     */
1201
+    public function get_version() {
1202
+        return $this->version;
1203
+    }
1204 1204
 
1205 1205
 }
Please login to merge, or discard this patch.
Spacing   +171 added lines, -171 removed lines patch added patch discarded remove patch
@@ -529,311 +529,311 @@  discard block
 block discarded – undo
529 529
 		 * The class responsible for orchestrating the actions and filters of the
530 530
 		 * core plugin.
531 531
 		 */
532
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
532
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php';
533 533
 
534 534
 		/**
535 535
 		 * The class responsible for defining internationalization functionality
536 536
 		 * of the plugin.
537 537
 		 */
538
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
538
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php';
539 539
 
540 540
 		/**
541 541
 		 * WordLift's supported languages.
542 542
 		 */
543
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
543
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php';
544 544
 
545 545
 		/**
546 546
 		 * Provide support functions to sanitize data.
547 547
 		 */
548
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
548
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php';
549 549
 
550 550
 		/**
551 551
 		 * The Redirect service.
552 552
 		 */
553
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
553
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php';
554 554
 
555 555
 		/**
556 556
 		 * The Log service.
557 557
 		 */
558
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
558
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php';
559 559
 
560 560
 		/**
561 561
 		 * The configuration service.
562 562
 		 */
563
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
563
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php';
564 564
 
565 565
 		/**
566 566
 		 * The entity post type service (this is the WordPress post type, not the entity schema type).
567 567
 		 */
568
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
568
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php';
569 569
 
570 570
 		/**
571 571
 		 * The entity type service (i.e. the schema type).
572 572
 		 */
573
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
573
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php';
574 574
 
575 575
 		/**
576 576
 		 * The entity link service.
577 577
 		 */
578
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
578
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php';
579 579
 
580 580
 		/**
581 581
 		 * The Query builder.
582 582
 		 */
583
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
583
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php';
584 584
 
585 585
 		/**
586 586
 		 * The Schema service.
587 587
 		 */
588
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
588
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php';
589 589
 
590 590
 		/**
591 591
 		 * The schema:url property service.
592 592
 		 */
593
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
594
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
593
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php';
594
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php';
595 595
 
596 596
 		/**
597 597
 		 * The UI service.
598 598
 		 */
599
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
599
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php';
600 600
 
601 601
 		/**
602 602
 		 * The Thumbnail service.
603 603
 		 */
604
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
604
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php';
605 605
 
606 606
 		/**
607 607
 		 * The Entity Types Taxonomy service.
608 608
 		 */
609
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
609
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-types-taxonomy-service.php';
610 610
 
611 611
 		/**
612 612
 		 * The Entity service.
613 613
 		 */
614
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
614
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php';
615 615
 
616 616
 		// Add the entity rating service.
617
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
617
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php';
618 618
 
619 619
 		/**
620 620
 		 * The User service.
621 621
 		 */
622
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
622
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php';
623 623
 
624 624
 		/**
625 625
 		 * The Timeline service.
626 626
 		 */
627
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
627
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php';
628 628
 
629 629
 		/**
630 630
 		 * The Topic Taxonomy service.
631 631
 		 */
632
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
632
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php';
633 633
 
634 634
 		/**
635 635
 		 * The SPARQL service.
636 636
 		 */
637
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
637
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sparql-service.php';
638 638
 
639 639
 		/**
640 640
 		 * The WordLift import service.
641 641
 		 */
642
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
642
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-import-service.php';
643 643
 
644 644
 		/**
645 645
 		 * The WordLift URI service.
646 646
 		 */
647
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
647
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php';
648 648
 
649
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php';
649
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-listable.php';
650 650
 
651
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
651
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php';
652 652
 
653 653
 		/**
654 654
 		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
655 655
 		 */
656
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php';
656
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rebuild-service.php';
657 657
 
658
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
658
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php';
659 659
 
660
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
660
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php';
661 661
 
662 662
 		/**
663 663
 		 * Load the converters.
664 664
 		 */
665
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
666
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
667
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
668
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
669
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
665
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php';
666
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
667
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php';
668
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php';
669
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php';
670 670
 
671 671
 		/**
672 672
 		 * Load the content filter.
673 673
 		 */
674
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
674
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php';
675 675
 
676 676
 		/**
677 677
 		 * Load the JSON-LD service to publish entities using JSON-LD.s
678 678
 		 *
679 679
 		 * @since 3.8.0
680 680
 		 */
681
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
681
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php';
682 682
 
683 683
 		// The Publisher Service and the AJAX adapter.
684
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
685
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
684
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php';
685
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php';
686 686
 
687 687
 		/**
688 688
 		 * Load the WordLift key validation service.
689 689
 		 */
690
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
690
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php';
691 691
 
692 692
 		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
693
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
693
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php';
694 694
 
695 695
 		// Load the `Wordlift_Event_Entity_Page_Service` class definition.
696
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-event-entity-page-service.php';
696
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-event-entity-page-service.php';
697 697
 
698 698
 		/** Adapters. */
699
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
699
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php';
700 700
 
701 701
 		/**
702 702
 		 * The class responsible for defining all actions that occur in the admin area.
703 703
 		 */
704
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
704
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php';
705 705
 
706 706
 		/**
707 707
 		 * The class to customize the entity list admin page.
708 708
 		 */
709
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
709
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php';
710 710
 
711 711
 		/**
712 712
 		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
713 713
 		 */
714
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
714
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php';
715 715
 
716 716
 		/**
717 717
 		 * The Notice service.
718 718
 		 */
719
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
719
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php';
720 720
 
721 721
 		/**
722 722
 		 * The PrimaShop adapter.
723 723
 		 */
724
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
724
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php';
725 725
 
726 726
 		/**
727 727
 		 * The WordLift Dashboard service.
728 728
 		 */
729
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
729
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php';
730 730
 
731 731
 		/**
732 732
 		 * The admin 'Install wizard' page.
733 733
 		 */
734
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
734
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php';
735 735
 
736 736
 		/**
737 737
 		 * The WordLift entity type list admin page controller.
738 738
 		 */
739
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
739
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
740 740
 
741 741
 		/**
742 742
 		 * The WordLift entity type settings admin page controller.
743 743
 		 */
744
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
744
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php';
745 745
 
746 746
 		/**
747 747
 		 * The admin 'Download Your Data' page.
748 748
 		 */
749
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
750
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
749
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php';
750
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-status-page.php';
751 751
 
752 752
 		/**
753 753
 		 * The admin 'Download Your Data' page.
754 754
 		 */
755
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
755
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php';
756 756
 
757 757
 		/**
758 758
 		 * The admin 'WordLift Settings' page.
759 759
 		 */
760
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
761
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
762
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
763
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
764
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
765
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
766
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
767
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
768
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
760
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/intf-wordlift-admin-element.php';
761
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-input-element.php';
762
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-select2-element.php';
763
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-language-select-element.php';
764
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-tabs-element.php';
765
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-publisher-element.php';
766
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php';
767
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php';
768
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php';
769 769
 
770 770
 		/** Admin Pages */
771
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
771
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php';
772 772
 
773 773
 		/**
774 774
 		 * The class responsible for defining all actions that occur in the public-facing
775 775
 		 * side of the site.
776 776
 		 */
777
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
777
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php';
778 778
 
779 779
 		/**
780 780
 		 * The shortcode abstract class.
781 781
 		 */
782
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
782
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php';
783 783
 
784 784
 		/**
785 785
 		 * The Timeline shortcode.
786 786
 		 */
787
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
787
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php';
788 788
 
789 789
 		/**
790 790
 		 * The Navigator shortcode.
791 791
 		 */
792
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
792
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php';
793 793
 
794 794
 		/**
795 795
 		 * The chord shortcode.
796 796
 		 */
797
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
797
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php';
798 798
 
799 799
 		/**
800 800
 		 * The geomap shortcode.
801 801
 		 */
802
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
802
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php';
803 803
 
804 804
 		/**
805 805
 		 * The entity cloud shortcode.
806 806
 		 */
807
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
807
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php';
808 808
 
809 809
 		/**
810 810
 		 * The ShareThis service.
811 811
 		 */
812
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
812
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php';
813 813
 
814 814
 		/**
815 815
 		 * The SEO service.
816 816
 		 */
817
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
817
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php';
818 818
 
819 819
 		/** Widgets */
820
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
821
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
820
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php';
821
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php';
822 822
 
823 823
 		$this->loader = new Wordlift_Loader();
824 824
 
825 825
 		// Instantiate a global logger.
826 826
 		global $wl_logger;
827
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
827
+		$wl_logger = Wordlift_Log_Service::get_logger('WordLift');
828 828
 
829 829
 		// Create the configuration service.
830 830
 		$this->configuration_service = new Wordlift_Configuration_Service();
831 831
 
832 832
 		// Create an entity type service instance. It'll be later bound to the init action.
833
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
833
+		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path());
834 834
 
835 835
 		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
836
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
836
+		$this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_post_type_service, $this->configuration_service->get_entity_base_path());
837 837
 
838 838
 		// Create an instance of the UI service.
839 839
 		$this->ui_service = new Wordlift_UI_Service();
@@ -844,23 +844,23 @@  discard block
 block discarded – undo
844 844
 		$this->sparql_service = new Wordlift_Sparql_Service();
845 845
 
846 846
 		// Create an instance of the Schema service.
847
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
847
+		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service($this->sparql_service);
848 848
 		$this->schema_service        = new Wordlift_Schema_Service();
849 849
 
850 850
 		// Create an instance of the Notice service.
851 851
 		$this->notice_service = new Wordlift_Notice_Service();
852 852
 
853 853
 		// Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page.
854
-		$this->entity_service = new Wordlift_Entity_Service( $this->ui_service );
854
+		$this->entity_service = new Wordlift_Entity_Service($this->ui_service);
855 855
 
856 856
 		// Create an instance of the User service.
857 857
 		$this->user_service = new Wordlift_User_Service();
858 858
 
859 859
 		// Create a new instance of the Timeline service and Timeline shortcode.
860
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
860
+		$this->timeline_service = new Wordlift_Timeline_Service($this->entity_service);
861 861
 
862 862
 		// Create a new instance of the Redirect service.
863
-		$this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service );
863
+		$this->redirect_service = new Wordlift_Redirect_Service($this->entity_service);
864 864
 
865 865
 		// Initialize the shortcodes.
866 866
 		new Wordlift_Navigator_Shortcode();
@@ -883,45 +883,45 @@  discard block
 block discarded – undo
883 883
 		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
884 884
 
885 885
 		// Create an import service instance to hook later to WP's import function.
886
-		$this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() );
886
+		$this->import_service = new Wordlift_Import_Service($this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri());
887 887
 
888
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
888
+		$uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']);
889 889
 
890 890
 		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
891
-		$this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service );
891
+		$this->rebuild_service = new Wordlift_Rebuild_Service($this->sparql_service, $uri_service);
892 892
 
893
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
893
+		$this->entity_type_service = new Wordlift_Entity_Type_Service($this->schema_service);
894 894
 
895 895
 		// Create the entity rating service.
896
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
896
+		$this->rating_service = new Wordlift_Rating_Service($this->entity_service, $this->entity_type_service, $this->notice_service);
897 897
 
898 898
 		// Create entity list customization (wp-admin/edit.php)
899
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
899
+		$this->entity_list_service = new Wordlift_Entity_List_Service($this->rating_service);
900 900
 
901 901
 		// Create a new instance of the Redirect service.
902
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service );
902
+		$this->dashboard_service = new Wordlift_Dashboard_Service($this->rating_service);
903 903
 
904
-		$this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service );
905
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
904
+		$this->property_factory = new Wordlift_Property_Factory($schema_url_property_service);
905
+		$this->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service);
906 906
 
907 907
 		$attachment_service = new Wordlift_Attachment_Service();
908 908
 
909 909
 		// Instantiate the JSON-LD service.
910
-		$property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
911
-		$this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter );
912
-		$this->post_to_jsonld_converter        = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
913
-		$this->postid_to_jsonld_converter      = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter );
914
-		$this->jsonld_service                  = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter );
910
+		$property_getter                       = Wordlift_Property_Getter_Factory::create($this->entity_service);
911
+		$this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter);
912
+		$this->post_to_jsonld_converter        = new Wordlift_Post_To_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service);
913
+		$this->postid_to_jsonld_converter      = new Wordlift_Postid_To_Jsonld_Converter($this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter);
914
+		$this->jsonld_service                  = new Wordlift_Jsonld_Service($this->entity_service, $this->postid_to_jsonld_converter);
915 915
 
916 916
 		// Create an instance of the Key Validation service. This service is later hooked to provide an AJAX call (only for admins).
917 917
 		$this->key_validation_service = new Wordlift_Key_Validation_Service();
918 918
 
919 919
 		// Create an instance of the Publisher Service and the AJAX Adapter.
920 920
 		$publisher_service            = new Wordlift_Publisher_Service();
921
-		$this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $publisher_service );
921
+		$this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter($publisher_service);
922 922
 
923 923
 		/** Adapters. */
924
-		$this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this );
924
+		$this->tinymce_adapter = new Wordlift_Tinymce_Adapter($this);
925 925
 
926 926
 		/** WordPress Admin UI. */
927 927
 
@@ -930,15 +930,15 @@  discard block
 block discarded – undo
930 930
 		$this->select2_element         = new Wordlift_Admin_Select2_Element();
931 931
 		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
932 932
 		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
933
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element );
933
+		$this->publisher_element       = new Wordlift_Admin_Publisher_Element($this->configuration_service, $publisher_service, $tabs_element, $this->select2_element);
934 934
 
935
-		$this->download_your_data_page   = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
935
+		$this->download_your_data_page   = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service);
936 936
 		$this->status_page               = new Wordlift_Admin_Status_Page();
937
-		$this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element );
938
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
937
+		$this->settings_page             = new Wordlift_Admin_Settings_Page($this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element);
938
+		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($this->settings_page);
939 939
 
940 940
 		// Pages.
941
-		new Wordlift_Admin_Post_Edit_Page( $this );
941
+		new Wordlift_Admin_Post_Edit_Page($this);
942 942
 
943 943
 		// create an instance of the entity type list admin page controller.
944 944
 		$this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
@@ -950,23 +950,23 @@  discard block
 block discarded – undo
950 950
 		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
951 951
 
952 952
 		//** WordPress Admin */
953
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
953
+		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service);
954 954
 		$this->status_page             = new Wordlift_Admin_Status_Page();
955 955
 
956 956
 		// Create an instance of the install wizard.
957
-		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
957
+		$this->admin_setup = new Wordlift_Admin_Setup($this->configuration_service, $this->key_validation_service, $this->entity_service);
958 958
 
959 959
 		// Create an instance of the content filter service.
960
-		$this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service );
960
+		$this->content_filter_service = new Wordlift_Content_Filter_Service($this->entity_service);
961 961
 
962
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
962
+		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($this->entity_post_type_service);
963 963
 
964 964
 		$this->event_entity_page_service = new Wordlift_Event_Entity_Page_Service();
965 965
 
966 966
 		// Load the debug service if WP is in debug mode.
967
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
968
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
969
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
967
+		if (defined('WP_DEBUG') && WP_DEBUG) {
968
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php';
969
+			new Wordlift_Debug_Service($this->entity_service, $uri_service);
970 970
 		}
971 971
 
972 972
 	}
@@ -983,9 +983,9 @@  discard block
 block discarded – undo
983 983
 	private function set_locale() {
984 984
 
985 985
 		$plugin_i18n = new Wordlift_i18n();
986
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
986
+		$plugin_i18n->set_domain($this->get_plugin_name());
987 987
 
988
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
988
+		$this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain');
989 989
 
990 990
 	}
991 991
 
@@ -1005,110 +1005,110 @@  discard block
 block discarded – undo
1005 1005
 			$this->notice_service
1006 1006
 		);
1007 1007
 
1008
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1009
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1008
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles');
1009
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts');
1010 1010
 
1011 1011
 		// Hook the init action to the Topic Taxonomy service.
1012
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1012
+		$this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0);
1013 1013
 
1014 1014
 		// Hook the deleted_post_meta action to the Thumbnail service.
1015
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1015
+		$this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4);
1016 1016
 
1017 1017
 		// Hook the added_post_meta action to the Thumbnail service.
1018
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1018
+		$this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4);
1019 1019
 
1020 1020
 		// Hook the updated_post_meta action to the Thumbnail service.
1021
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1021
+		$this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4);
1022 1022
 
1023 1023
 		// Hook posts inserts (or updates) to the user service.
1024
-		$this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
1024
+		$this->loader->add_action('wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3);
1025 1025
 
1026 1026
 		// Hook the AJAX wl_timeline action to the Timeline service.
1027
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1027
+		$this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline');
1028 1028
 
1029 1029
 		// Register custom allowed redirect hosts.
1030
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1030
+		$this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts');
1031 1031
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1032
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1032
+		$this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect');
1033 1033
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1034
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1034
+		$this->loader->add_action('wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats');
1035 1035
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1036
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1036
+		$this->loader->add_action('wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets');
1037 1037
 
1038 1038
 		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1039 1039
 		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1040
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1041
-		$this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 );
1040
+		$this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3);
1041
+		$this->loader->add_action('save_post_entity', $this->rating_service, 'set_rating_for', 10, 1);
1042 1042
 
1043
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1044
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1043
+		$this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1);
1044
+		$this->loader->add_action('in_admin_header', $this->rating_service, 'in_admin_header');
1045 1045
 
1046 1046
 		// Entity listing customization (wp-admin/edit.php)
1047 1047
 		// Add custom columns
1048
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1049
-		$this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1048
+		$this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns');
1049
+		$this->loader->add_filter('manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2);
1050 1050
 		// Add 4W selection
1051
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1052
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1051
+		$this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope');
1052
+		$this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope');
1053 1053
 
1054
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1054
+		$this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args');
1055 1055
 
1056 1056
 		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1057 1057
 		// entities.
1058
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1058
+		$this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2);
1059 1059
 
1060 1060
 		// Filter imported post meta.
1061
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1061
+		$this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3);
1062 1062
 
1063 1063
 		// Notify the import service when an import starts and ends.
1064
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1065
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1064
+		$this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0);
1065
+		$this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0);
1066 1066
 
1067 1067
 		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1068
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1068
+		$this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild');
1069 1069
 
1070 1070
 		// Hook the menu to the Download Your Data page.
1071
-		$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1072
-		$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1073
-		$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1071
+		$this->loader->add_action('admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0);
1072
+		$this->loader->add_action('admin_menu', $this->status_page, 'admin_menu', 100, 0);
1073
+		$this->loader->add_action('admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0);
1074 1074
 
1075 1075
 		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1076
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1076
+		$this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10);
1077 1077
 
1078 1078
 		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1079
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1079
+		$this->loader->add_action('wp_ajax_wl_jsonld', $this->jsonld_service, 'get');
1080 1080
 
1081 1081
 		// Hook the AJAX wl_validate_key action to the Key Validation service.
1082
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1082
+		$this->loader->add_action('wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key');
1083 1083
 
1084 1084
 		// Hook the `admin_init` function to the Admin Setup.
1085
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1085
+		$this->loader->add_action('admin_init', $this->admin_setup, 'admin_init');
1086 1086
 
1087 1087
 		// Hook the admin_init to the settings page.
1088
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1088
+		$this->loader->add_action('admin_init', $this->settings_page, 'admin_init');
1089 1089
 
1090 1090
 		// Hook the menu creation on the general wordlift menu creation
1091
-		$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1091
+		$this->loader->add_action('wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2);
1092 1092
 
1093 1093
 		// Hook key update.
1094
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1095
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1094
+		$this->loader->add_action('pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2);
1095
+		$this->loader->add_action('update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2);
1096 1096
 
1097 1097
 		// Add additional action links to the WordLift plugin in the plugins page.
1098
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1098
+		$this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1);
1099 1099
 
1100 1100
 		// Hook the AJAX `wl_publisher` action name.
1101
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1101
+		$this->loader->add_action('wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher');
1102 1102
 
1103 1103
 		// Hook row actions for the entity type list admin.
1104
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1104
+		$this->loader->add_filter('wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2);
1105 1105
 
1106 1106
 		/** Adapters. */
1107
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1107
+		$this->loader->add_filter('mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1);
1108 1108
 
1109 1109
 		// Hooks to restrict multisite super admin from manipulating entity types.
1110
-		if ( is_multisite() ) {
1111
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1110
+		if (is_multisite()) {
1111
+			$this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4);
1112 1112
 		}
1113 1113
 	}
1114 1114
 
@@ -1121,44 +1121,44 @@  discard block
 block discarded – undo
1121 1121
 	 */
1122 1122
 	private function define_public_hooks() {
1123 1123
 
1124
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1124
+		$plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version());
1125 1125
 
1126 1126
 		// Register the entity post type.
1127
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1127
+		$this->loader->add_action('init', $this->entity_post_type_service, 'register');
1128 1128
 
1129 1129
 		// Bind the link generation and handling hooks to the entity link service.
1130
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1131
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', 10, 1 );
1132
-		$this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 );
1133
-		$this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 );
1130
+		$this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4);
1131
+		$this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', 10, 1);
1132
+		$this->loader->add_filter('wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3);
1133
+		$this->loader->add_filter('wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4);
1134 1134
 
1135
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1136
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1135
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles');
1136
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts');
1137 1137
 
1138 1138
 		// Hook the content filter service to add entity links.
1139
-		$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1139
+		$this->loader->add_filter('the_content', $this->content_filter_service, 'the_content');
1140 1140
 
1141 1141
 		// Hook the AJAX wl_timeline action to the Timeline service.
1142
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1142
+		$this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline');
1143 1143
 
1144 1144
 		// Hook the ShareThis service.
1145
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1146
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1145
+		$this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99);
1146
+		$this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99);
1147 1147
 
1148 1148
 		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1149
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1149
+		$this->loader->add_action('wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get');
1150 1150
 
1151 1151
 		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1152 1152
 		// in order to tweak WP's `WP_Query` to include entities in queries related
1153 1153
 		// to categories.
1154
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1154
+		$this->loader->add_action('pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1);
1155 1155
 
1156 1156
 		/*
1157 1157
 		 * Hook the `pre_get_posts` action to the `Wordlift_Event_Entity_Page_Service`
1158 1158
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1159 1159
 		 * order of start time.
1160 1160
 		 */
1161
-		$this->loader->add_action( 'pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1 );
1161
+		$this->loader->add_action('pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1);
1162 1162
 
1163 1163
 	}
1164 1164
 
Please login to merge, or discard this patch.
src/includes/class-wordlift-configuration-service.php 2 patches
Indentation   +358 added lines, -358 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 if ( ! defined( 'ABSPATH' ) ) {
14
-	exit;
14
+    exit;
15 15
 }
16 16
 
17 17
 /**
@@ -21,362 +21,362 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class Wordlift_Configuration_Service {
23 23
 
24
-	/**
25
-	 * The entity base path option name.
26
-	 *
27
-	 * @since 3.6.0
28
-	 */
29
-	const ENTITY_BASE_PATH_KEY = 'wl_entity_base_path';
30
-
31
-	/**
32
-	 * The skip wizard (admin installation wizard) option name.
33
-	 *
34
-	 * @since 3.9.0
35
-	 */
36
-	const SKIP_WIZARD = 'wl_skip_wizard';
37
-
38
-	/**
39
-	 * WordLift's key option name.
40
-	 *
41
-	 * @since 3.9.0
42
-	 */
43
-	const KEY = 'key';
44
-
45
-	/**
46
-	 * WordLift's configured language option name.
47
-	 *
48
-	 * @since 3.9.0
49
-	 */
50
-	const LANGUAGE = 'site_language';
51
-
52
-	/**
53
-	 * The publisher entity post ID option name.
54
-	 *
55
-	 * @since 3.9.0
56
-	 */
57
-	const PUBLISHER_ID = 'publisher_id';
58
-
59
-	/**
60
-	 * The dataset URI option name
61
-	 *
62
-	 * @since 3.10.0
63
-	 */
64
-	const DATASET_URI = 'redlink_dataset_uri';
65
-
66
-	/**
67
-	 * The Wordlift_Configuration_Service's singleton instance.
68
-	 *
69
-	 * @since  3.6.0
70
-	 *
71
-	 * @access private
72
-	 * @var \Wordlift_Configuration_Service $instance Wordlift_Configuration_Service's singleton instance.
73
-	 */
74
-	private static $instance;
75
-
76
-	/**
77
-	 * Create a Wordlift_Configuration_Service's instance.
78
-	 *
79
-	 * @since 3.6.0
80
-	 */
81
-	public function __construct() {
82
-
83
-		self::$instance = $this;
84
-
85
-	}
86
-
87
-	/**
88
-	 * Get the singleton instance.
89
-	 *
90
-	 * @since 3.6.0
91
-	 *
92
-	 * @return \Wordlift_Configuration_Service
93
-	 */
94
-	public static function get_instance() {
95
-
96
-		return self::$instance;
97
-	}
98
-
99
-	/**
100
-	 * Get a configuration given the option name and a key. The option value is
101
-	 * expected to be an array.
102
-	 *
103
-	 * @since 3.6.0
104
-	 *
105
-	 * @param string $option  The option name.
106
-	 * @param string $key     A key in the option value array.
107
-	 * @param string $default The default value in case the key is not found (by default an empty string).
108
-	 *
109
-	 * @return mixed The configuration value or the default value if not found.
110
-	 */
111
-	private function get( $option, $key, $default = '' ) {
112
-
113
-		$options = get_option( $option, array() );
114
-
115
-		return isset( $options[ $key ] ) ? $options[ $key ] : $default;
116
-	}
117
-
118
-	/**
119
-	 * Set a configuration parameter.
120
-	 *
121
-	 * @since 3.9.0
122
-	 *
123
-	 * @param string $option Name of option to retrieve. Expected to not be SQL-escaped.
124
-	 * @param string $key    The value key.
125
-	 * @param mixed  $value  The value.
126
-	 */
127
-	private function set( $option, $key, $value ) {
128
-
129
-		$values         = get_option( $option );
130
-		$values         = isset( $values ) ? $values : array();
131
-		$values[ $key ] = $value;
132
-		update_option( $option, $values );
133
-
134
-	}
135
-
136
-	/**
137
-	 * Get the entity base path, by default 'entity'.
138
-	 *
139
-	 * @since 3.6.0
140
-	 *
141
-	 * @return string The entity base path.
142
-	 */
143
-	public function get_entity_base_path() {
144
-
145
-		return $this->get( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, 'entity' );
146
-	}
147
-
148
-	/**
149
-	 * Get the entity base path.
150
-	 *
151
-	 * @since 3.9.0
152
-	 *
153
-	 * @param string $value The entity base path.
154
-	 */
155
-	public function set_entity_base_path( $value ) {
156
-
157
-		$this->set( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, $value );
158
-	}
159
-
160
-	/**
161
-	 * Whether the installation skip wizard should be skipped.
162
-	 *
163
-	 * @since 3.9.0
164
-	 *
165
-	 * @return bool True if it should be skipped otherwise false.
166
-	 */
167
-	public function is_skip_wizard() {
168
-
169
-		return $this->get( 'wl_general_settings', self::SKIP_WIZARD, false );
170
-	}
171
-
172
-	/**
173
-	 * Set the skip wizard parameter.
174
-	 *
175
-	 * @since 3.9.0
176
-	 *
177
-	 * @param bool $value True to skip the wizard. We expect a boolean value.
178
-	 */
179
-	public function set_skip_wizard( $value ) {
180
-
181
-		$this->set( 'wl_general_settings', self::SKIP_WIZARD, true === $value );
182
-
183
-	}
184
-
185
-	/**
186
-	 * Get WordLift's key.
187
-	 *
188
-	 * @since 3.9.0
189
-	 *
190
-	 * @return WordLift's key or an empty string if not set.
191
-	 */
192
-	public function get_key() {
193
-
194
-		return $this->get( 'wl_general_settings', self::KEY, '' );
195
-	}
196
-
197
-	/**
198
-	 * Set WordLift's key.
199
-	 *
200
-	 * @since 3.9.0
201
-	 *
202
-	 * @param string $value WordLift's key.
203
-	 */
204
-	public function set_key( $value ) {
205
-
206
-		$this->set( 'wl_general_settings', self::KEY, $value );
207
-	}
208
-
209
-	/**
210
-	 * Get WordLift's configured language, by default 'en'.
211
-	 *
212
-	 * Note that WordLift's language is used when writing strings to the Linked Data dataset, not for the analysis.
213
-	 *
214
-	 * @since 3.9.0
215
-	 *
216
-	 * @return string WordLift's configured language code ('en' by default).
217
-	 */
218
-	public function get_language_code() {
219
-
220
-		return $this->get( 'wl_general_settings', self::LANGUAGE, 'en' );
221
-	}
222
-
223
-	/**
224
-	 * Set WordLift's language code, used when storing strings to the Linked Data dataset.
225
-	 *
226
-	 * @since 3.9.0
227
-	 *
228
-	 * @param string $value WordLift's language code.
229
-	 */
230
-	public function set_language_code( $value ) {
231
-
232
-		$this->set( 'wl_general_settings', self::LANGUAGE, $value );
233
-
234
-	}
235
-
236
-	/**
237
-	 * Get the publisher entity post id.
238
-	 *
239
-	 * The publisher entity post id points to an entity post which contains the data for the publisher used in schema.org
240
-	 * Article markup.
241
-	 *
242
-	 * @since 3.9.0
243
-	 *
244
-	 * @return int|NULL The publisher entity post id or NULL if not set.
245
-	 */
246
-	public function get_publisher_id() {
247
-
248
-		return $this->get( 'wl_general_settings', self::PUBLISHER_ID, null );
249
-	}
250
-
251
-	/**
252
-	 * Set the publisher entity post id.
253
-	 *
254
-	 * @since 3.9.0
255
-	 *
256
-	 * @param int $value The publisher entity post id.
257
-	 */
258
-	public function set_publisher_id( $value ) {
259
-
260
-		$this->set( 'wl_general_settings', self::PUBLISHER_ID, $value );
261
-
262
-	}
263
-
264
-	/**
265
-	 * Get the dataset URI.
266
-	 *
267
-	 * @since 3.10.0
268
-	 *
269
-	 * @return string The dataset URI or an empty string if not set.
270
-	 */
271
-	public function get_dataset_uri() {
272
-
273
-		return $this->get( 'wl_advanced_settings', self::DATASET_URI, null );
274
-	}
275
-
276
-	/**
277
-	 * Set the dataset URI.
278
-	 *
279
-	 * @since 3.10.0
280
-	 *
281
-	 * @param string $value The dataset URI.
282
-	 */
283
-	public function set_dataset_uri( $value ) {
284
-
285
-		$this->set( 'wl_advanced_settings', self::DATASET_URI, $value );
286
-	}
287
-
288
-	/**
289
-	 * Intercept the change of the WordLift key in order to set the dataset URI.
290
-	 *
291
-	 * @since 3.11.0
292
-	 *
293
-	 * @param array $old_value The old settings.
294
-	 * @param array $new_value The new settings.
295
-	 */
296
-	public function update_key( $old_value, $new_value ) {
297
-
298
-		// Check the old key value and the new one. We're going to ask for the dataset URI only if the key has changed.
299
-		$old_key = isset( $old_value['key'] ) ? $old_value['key'] : '';
300
-		$new_key = isset( $new_value['key'] ) ? $new_value['key'] : '';
301
-
302
-		// If the key hasn't changed, don't do anything.
303
-		// WARN The 'update_option' hook is fired only if the new and old value are not equal
304
-		if ( $old_key === $new_key ) {
305
-			return;
306
-		}
307
-
308
-		// If the key is empty, empty the dataset URI.
309
-		if ( '' === $new_key ) {
310
-			$this->set_dataset_uri( '' );
311
-		}
312
-
313
-		// make the request to the remote server
314
-		$this->get_remote_dataset_uri( $new_key );
315
-	}
316
-
317
-	/**
318
-	 * Handle retrieving the dataset uri from the remote server.
319
-	 *
320
-	 * If a valid dataset uri is returned it is stored in the appropriate option,
321
-	 * otherwise the option is set to empty string.
322
-	 *
323
-	 * @since 3.12.0
324
-	 *
325
-	 * @param string  $key     The key to be used
326
-	 *
327
-	 */
328
-	private function get_remote_dataset_uri( $key ) {
329
-		// Request the dataset URI.
330
-		$response = wp_remote_get( $this->get_accounts_by_key_dataset_uri( $key ), unserialize( WL_REDLINK_API_HTTP_OPTIONS ) );
331
-
332
-		// If the response is valid, then set the value.
333
-		if ( ! is_wp_error( $response ) && 200 === (int) $response['response']['code'] ) {
334
-			$this->set_dataset_uri( $response['body'] );
335
-		} else {
336
-			$this->set_dataset_uri( '' );
337
-		}
338
-	}
339
-
340
-	/**
341
-	 * Handle the edge case where a user submits the same key again
342
-	 * when he does not have the dataset uri to regain it.
343
-	 *
344
-	 * This can not be handled in the normal option update hook because
345
-	 * it is not being triggered when the save value equals to the one already
346
-	 * in the DB.
347
-	 *
348
-	 * @since 3.12.0
349
-	 *
350
-	 * @param mixed  $value     The new, unserialized option value.
351
-	 * @param mixed  $old_value The old option value.
352
-	 *
353
-	 * @return mixed The same value in the $value parameter
354
-	 *
355
-	 */
356
-	function maybe_update_dataset_uri( $value, $old_value ) {
357
-		if ( ! empty( $value ) &&
358
-			( $value == $old_value ) &&
359
-			empty( $this->get_dataset_uri() ) ) {
360
-
361
-			// make the request to the remote server to try to get the dataset uri
362
-			$this->get_remote_dataset_uri( $value );
363
-		}
364
-
365
-		return $value;
366
-	}
367
-
368
-	/**
369
-	 * Get the API URI to retrieve the dataset URI using the WordLift Key.
370
-	 *
371
-	 * @since 3.11.0
372
-	 *
373
-	 * @param string $key The WordLift key to use.
374
-	 *
375
-	 * @return string The API URI.
376
-	 */
377
-	public function get_accounts_by_key_dataset_uri( $key ) {
378
-
379
-		return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "accounts/key=$key/dataset_uri";
380
-	}
24
+    /**
25
+     * The entity base path option name.
26
+     *
27
+     * @since 3.6.0
28
+     */
29
+    const ENTITY_BASE_PATH_KEY = 'wl_entity_base_path';
30
+
31
+    /**
32
+     * The skip wizard (admin installation wizard) option name.
33
+     *
34
+     * @since 3.9.0
35
+     */
36
+    const SKIP_WIZARD = 'wl_skip_wizard';
37
+
38
+    /**
39
+     * WordLift's key option name.
40
+     *
41
+     * @since 3.9.0
42
+     */
43
+    const KEY = 'key';
44
+
45
+    /**
46
+     * WordLift's configured language option name.
47
+     *
48
+     * @since 3.9.0
49
+     */
50
+    const LANGUAGE = 'site_language';
51
+
52
+    /**
53
+     * The publisher entity post ID option name.
54
+     *
55
+     * @since 3.9.0
56
+     */
57
+    const PUBLISHER_ID = 'publisher_id';
58
+
59
+    /**
60
+     * The dataset URI option name
61
+     *
62
+     * @since 3.10.0
63
+     */
64
+    const DATASET_URI = 'redlink_dataset_uri';
65
+
66
+    /**
67
+     * The Wordlift_Configuration_Service's singleton instance.
68
+     *
69
+     * @since  3.6.0
70
+     *
71
+     * @access private
72
+     * @var \Wordlift_Configuration_Service $instance Wordlift_Configuration_Service's singleton instance.
73
+     */
74
+    private static $instance;
75
+
76
+    /**
77
+     * Create a Wordlift_Configuration_Service's instance.
78
+     *
79
+     * @since 3.6.0
80
+     */
81
+    public function __construct() {
82
+
83
+        self::$instance = $this;
84
+
85
+    }
86
+
87
+    /**
88
+     * Get the singleton instance.
89
+     *
90
+     * @since 3.6.0
91
+     *
92
+     * @return \Wordlift_Configuration_Service
93
+     */
94
+    public static function get_instance() {
95
+
96
+        return self::$instance;
97
+    }
98
+
99
+    /**
100
+     * Get a configuration given the option name and a key. The option value is
101
+     * expected to be an array.
102
+     *
103
+     * @since 3.6.0
104
+     *
105
+     * @param string $option  The option name.
106
+     * @param string $key     A key in the option value array.
107
+     * @param string $default The default value in case the key is not found (by default an empty string).
108
+     *
109
+     * @return mixed The configuration value or the default value if not found.
110
+     */
111
+    private function get( $option, $key, $default = '' ) {
112
+
113
+        $options = get_option( $option, array() );
114
+
115
+        return isset( $options[ $key ] ) ? $options[ $key ] : $default;
116
+    }
117
+
118
+    /**
119
+     * Set a configuration parameter.
120
+     *
121
+     * @since 3.9.0
122
+     *
123
+     * @param string $option Name of option to retrieve. Expected to not be SQL-escaped.
124
+     * @param string $key    The value key.
125
+     * @param mixed  $value  The value.
126
+     */
127
+    private function set( $option, $key, $value ) {
128
+
129
+        $values         = get_option( $option );
130
+        $values         = isset( $values ) ? $values : array();
131
+        $values[ $key ] = $value;
132
+        update_option( $option, $values );
133
+
134
+    }
135
+
136
+    /**
137
+     * Get the entity base path, by default 'entity'.
138
+     *
139
+     * @since 3.6.0
140
+     *
141
+     * @return string The entity base path.
142
+     */
143
+    public function get_entity_base_path() {
144
+
145
+        return $this->get( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, 'entity' );
146
+    }
147
+
148
+    /**
149
+     * Get the entity base path.
150
+     *
151
+     * @since 3.9.0
152
+     *
153
+     * @param string $value The entity base path.
154
+     */
155
+    public function set_entity_base_path( $value ) {
156
+
157
+        $this->set( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, $value );
158
+    }
159
+
160
+    /**
161
+     * Whether the installation skip wizard should be skipped.
162
+     *
163
+     * @since 3.9.0
164
+     *
165
+     * @return bool True if it should be skipped otherwise false.
166
+     */
167
+    public function is_skip_wizard() {
168
+
169
+        return $this->get( 'wl_general_settings', self::SKIP_WIZARD, false );
170
+    }
171
+
172
+    /**
173
+     * Set the skip wizard parameter.
174
+     *
175
+     * @since 3.9.0
176
+     *
177
+     * @param bool $value True to skip the wizard. We expect a boolean value.
178
+     */
179
+    public function set_skip_wizard( $value ) {
180
+
181
+        $this->set( 'wl_general_settings', self::SKIP_WIZARD, true === $value );
182
+
183
+    }
184
+
185
+    /**
186
+     * Get WordLift's key.
187
+     *
188
+     * @since 3.9.0
189
+     *
190
+     * @return WordLift's key or an empty string if not set.
191
+     */
192
+    public function get_key() {
193
+
194
+        return $this->get( 'wl_general_settings', self::KEY, '' );
195
+    }
196
+
197
+    /**
198
+     * Set WordLift's key.
199
+     *
200
+     * @since 3.9.0
201
+     *
202
+     * @param string $value WordLift's key.
203
+     */
204
+    public function set_key( $value ) {
205
+
206
+        $this->set( 'wl_general_settings', self::KEY, $value );
207
+    }
208
+
209
+    /**
210
+     * Get WordLift's configured language, by default 'en'.
211
+     *
212
+     * Note that WordLift's language is used when writing strings to the Linked Data dataset, not for the analysis.
213
+     *
214
+     * @since 3.9.0
215
+     *
216
+     * @return string WordLift's configured language code ('en' by default).
217
+     */
218
+    public function get_language_code() {
219
+
220
+        return $this->get( 'wl_general_settings', self::LANGUAGE, 'en' );
221
+    }
222
+
223
+    /**
224
+     * Set WordLift's language code, used when storing strings to the Linked Data dataset.
225
+     *
226
+     * @since 3.9.0
227
+     *
228
+     * @param string $value WordLift's language code.
229
+     */
230
+    public function set_language_code( $value ) {
231
+
232
+        $this->set( 'wl_general_settings', self::LANGUAGE, $value );
233
+
234
+    }
235
+
236
+    /**
237
+     * Get the publisher entity post id.
238
+     *
239
+     * The publisher entity post id points to an entity post which contains the data for the publisher used in schema.org
240
+     * Article markup.
241
+     *
242
+     * @since 3.9.0
243
+     *
244
+     * @return int|NULL The publisher entity post id or NULL if not set.
245
+     */
246
+    public function get_publisher_id() {
247
+
248
+        return $this->get( 'wl_general_settings', self::PUBLISHER_ID, null );
249
+    }
250
+
251
+    /**
252
+     * Set the publisher entity post id.
253
+     *
254
+     * @since 3.9.0
255
+     *
256
+     * @param int $value The publisher entity post id.
257
+     */
258
+    public function set_publisher_id( $value ) {
259
+
260
+        $this->set( 'wl_general_settings', self::PUBLISHER_ID, $value );
261
+
262
+    }
263
+
264
+    /**
265
+     * Get the dataset URI.
266
+     *
267
+     * @since 3.10.0
268
+     *
269
+     * @return string The dataset URI or an empty string if not set.
270
+     */
271
+    public function get_dataset_uri() {
272
+
273
+        return $this->get( 'wl_advanced_settings', self::DATASET_URI, null );
274
+    }
275
+
276
+    /**
277
+     * Set the dataset URI.
278
+     *
279
+     * @since 3.10.0
280
+     *
281
+     * @param string $value The dataset URI.
282
+     */
283
+    public function set_dataset_uri( $value ) {
284
+
285
+        $this->set( 'wl_advanced_settings', self::DATASET_URI, $value );
286
+    }
287
+
288
+    /**
289
+     * Intercept the change of the WordLift key in order to set the dataset URI.
290
+     *
291
+     * @since 3.11.0
292
+     *
293
+     * @param array $old_value The old settings.
294
+     * @param array $new_value The new settings.
295
+     */
296
+    public function update_key( $old_value, $new_value ) {
297
+
298
+        // Check the old key value and the new one. We're going to ask for the dataset URI only if the key has changed.
299
+        $old_key = isset( $old_value['key'] ) ? $old_value['key'] : '';
300
+        $new_key = isset( $new_value['key'] ) ? $new_value['key'] : '';
301
+
302
+        // If the key hasn't changed, don't do anything.
303
+        // WARN The 'update_option' hook is fired only if the new and old value are not equal
304
+        if ( $old_key === $new_key ) {
305
+            return;
306
+        }
307
+
308
+        // If the key is empty, empty the dataset URI.
309
+        if ( '' === $new_key ) {
310
+            $this->set_dataset_uri( '' );
311
+        }
312
+
313
+        // make the request to the remote server
314
+        $this->get_remote_dataset_uri( $new_key );
315
+    }
316
+
317
+    /**
318
+     * Handle retrieving the dataset uri from the remote server.
319
+     *
320
+     * If a valid dataset uri is returned it is stored in the appropriate option,
321
+     * otherwise the option is set to empty string.
322
+     *
323
+     * @since 3.12.0
324
+     *
325
+     * @param string  $key     The key to be used
326
+     *
327
+     */
328
+    private function get_remote_dataset_uri( $key ) {
329
+        // Request the dataset URI.
330
+        $response = wp_remote_get( $this->get_accounts_by_key_dataset_uri( $key ), unserialize( WL_REDLINK_API_HTTP_OPTIONS ) );
331
+
332
+        // If the response is valid, then set the value.
333
+        if ( ! is_wp_error( $response ) && 200 === (int) $response['response']['code'] ) {
334
+            $this->set_dataset_uri( $response['body'] );
335
+        } else {
336
+            $this->set_dataset_uri( '' );
337
+        }
338
+    }
339
+
340
+    /**
341
+     * Handle the edge case where a user submits the same key again
342
+     * when he does not have the dataset uri to regain it.
343
+     *
344
+     * This can not be handled in the normal option update hook because
345
+     * it is not being triggered when the save value equals to the one already
346
+     * in the DB.
347
+     *
348
+     * @since 3.12.0
349
+     *
350
+     * @param mixed  $value     The new, unserialized option value.
351
+     * @param mixed  $old_value The old option value.
352
+     *
353
+     * @return mixed The same value in the $value parameter
354
+     *
355
+     */
356
+    function maybe_update_dataset_uri( $value, $old_value ) {
357
+        if ( ! empty( $value ) &&
358
+            ( $value == $old_value ) &&
359
+            empty( $this->get_dataset_uri() ) ) {
360
+
361
+            // make the request to the remote server to try to get the dataset uri
362
+            $this->get_remote_dataset_uri( $value );
363
+        }
364
+
365
+        return $value;
366
+    }
367
+
368
+    /**
369
+     * Get the API URI to retrieve the dataset URI using the WordLift Key.
370
+     *
371
+     * @since 3.11.0
372
+     *
373
+     * @param string $key The WordLift key to use.
374
+     *
375
+     * @return string The API URI.
376
+     */
377
+    public function get_accounts_by_key_dataset_uri( $key ) {
378
+
379
+        return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "accounts/key=$key/dataset_uri";
380
+    }
381 381
 
382 382
 }
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @since      3.6.0
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return mixed The configuration value or the default value if not found.
110 110
 	 */
111
-	private function get( $option, $key, $default = '' ) {
111
+	private function get($option, $key, $default = '') {
112 112
 
113
-		$options = get_option( $option, array() );
113
+		$options = get_option($option, array());
114 114
 
115
-		return isset( $options[ $key ] ) ? $options[ $key ] : $default;
115
+		return isset($options[$key]) ? $options[$key] : $default;
116 116
 	}
117 117
 
118 118
 	/**
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 	 * @param string $key    The value key.
125 125
 	 * @param mixed  $value  The value.
126 126
 	 */
127
-	private function set( $option, $key, $value ) {
127
+	private function set($option, $key, $value) {
128 128
 
129
-		$values         = get_option( $option );
130
-		$values         = isset( $values ) ? $values : array();
131
-		$values[ $key ] = $value;
132
-		update_option( $option, $values );
129
+		$values         = get_option($option);
130
+		$values         = isset($values) ? $values : array();
131
+		$values[$key] = $value;
132
+		update_option($option, $values);
133 133
 
134 134
 	}
135 135
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	public function get_entity_base_path() {
144 144
 
145
-		return $this->get( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, 'entity' );
145
+		return $this->get('wl_general_settings', self::ENTITY_BASE_PATH_KEY, 'entity');
146 146
 	}
147 147
 
148 148
 	/**
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 	 *
153 153
 	 * @param string $value The entity base path.
154 154
 	 */
155
-	public function set_entity_base_path( $value ) {
155
+	public function set_entity_base_path($value) {
156 156
 
157
-		$this->set( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, $value );
157
+		$this->set('wl_general_settings', self::ENTITY_BASE_PATH_KEY, $value);
158 158
 	}
159 159
 
160 160
 	/**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	public function is_skip_wizard() {
168 168
 
169
-		return $this->get( 'wl_general_settings', self::SKIP_WIZARD, false );
169
+		return $this->get('wl_general_settings', self::SKIP_WIZARD, false);
170 170
 	}
171 171
 
172 172
 	/**
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @param bool $value True to skip the wizard. We expect a boolean value.
178 178
 	 */
179
-	public function set_skip_wizard( $value ) {
179
+	public function set_skip_wizard($value) {
180 180
 
181
-		$this->set( 'wl_general_settings', self::SKIP_WIZARD, true === $value );
181
+		$this->set('wl_general_settings', self::SKIP_WIZARD, true === $value);
182 182
 
183 183
 	}
184 184
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	public function get_key() {
193 193
 
194
-		return $this->get( 'wl_general_settings', self::KEY, '' );
194
+		return $this->get('wl_general_settings', self::KEY, '');
195 195
 	}
196 196
 
197 197
 	/**
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
 	 *
202 202
 	 * @param string $value WordLift's key.
203 203
 	 */
204
-	public function set_key( $value ) {
204
+	public function set_key($value) {
205 205
 
206
-		$this->set( 'wl_general_settings', self::KEY, $value );
206
+		$this->set('wl_general_settings', self::KEY, $value);
207 207
 	}
208 208
 
209 209
 	/**
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 */
218 218
 	public function get_language_code() {
219 219
 
220
-		return $this->get( 'wl_general_settings', self::LANGUAGE, 'en' );
220
+		return $this->get('wl_general_settings', self::LANGUAGE, 'en');
221 221
 	}
222 222
 
223 223
 	/**
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 	 *
228 228
 	 * @param string $value WordLift's language code.
229 229
 	 */
230
-	public function set_language_code( $value ) {
230
+	public function set_language_code($value) {
231 231
 
232
-		$this->set( 'wl_general_settings', self::LANGUAGE, $value );
232
+		$this->set('wl_general_settings', self::LANGUAGE, $value);
233 233
 
234 234
 	}
235 235
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 */
246 246
 	public function get_publisher_id() {
247 247
 
248
-		return $this->get( 'wl_general_settings', self::PUBLISHER_ID, null );
248
+		return $this->get('wl_general_settings', self::PUBLISHER_ID, null);
249 249
 	}
250 250
 
251 251
 	/**
@@ -255,9 +255,9 @@  discard block
 block discarded – undo
255 255
 	 *
256 256
 	 * @param int $value The publisher entity post id.
257 257
 	 */
258
-	public function set_publisher_id( $value ) {
258
+	public function set_publisher_id($value) {
259 259
 
260
-		$this->set( 'wl_general_settings', self::PUBLISHER_ID, $value );
260
+		$this->set('wl_general_settings', self::PUBLISHER_ID, $value);
261 261
 
262 262
 	}
263 263
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	 */
271 271
 	public function get_dataset_uri() {
272 272
 
273
-		return $this->get( 'wl_advanced_settings', self::DATASET_URI, null );
273
+		return $this->get('wl_advanced_settings', self::DATASET_URI, null);
274 274
 	}
275 275
 
276 276
 	/**
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
 	 *
281 281
 	 * @param string $value The dataset URI.
282 282
 	 */
283
-	public function set_dataset_uri( $value ) {
283
+	public function set_dataset_uri($value) {
284 284
 
285
-		$this->set( 'wl_advanced_settings', self::DATASET_URI, $value );
285
+		$this->set('wl_advanced_settings', self::DATASET_URI, $value);
286 286
 	}
287 287
 
288 288
 	/**
@@ -293,25 +293,25 @@  discard block
 block discarded – undo
293 293
 	 * @param array $old_value The old settings.
294 294
 	 * @param array $new_value The new settings.
295 295
 	 */
296
-	public function update_key( $old_value, $new_value ) {
296
+	public function update_key($old_value, $new_value) {
297 297
 
298 298
 		// Check the old key value and the new one. We're going to ask for the dataset URI only if the key has changed.
299
-		$old_key = isset( $old_value['key'] ) ? $old_value['key'] : '';
300
-		$new_key = isset( $new_value['key'] ) ? $new_value['key'] : '';
299
+		$old_key = isset($old_value['key']) ? $old_value['key'] : '';
300
+		$new_key = isset($new_value['key']) ? $new_value['key'] : '';
301 301
 
302 302
 		// If the key hasn't changed, don't do anything.
303 303
 		// WARN The 'update_option' hook is fired only if the new and old value are not equal
304
-		if ( $old_key === $new_key ) {
304
+		if ($old_key === $new_key) {
305 305
 			return;
306 306
 		}
307 307
 
308 308
 		// If the key is empty, empty the dataset URI.
309
-		if ( '' === $new_key ) {
310
-			$this->set_dataset_uri( '' );
309
+		if ('' === $new_key) {
310
+			$this->set_dataset_uri('');
311 311
 		}
312 312
 
313 313
 		// make the request to the remote server
314
-		$this->get_remote_dataset_uri( $new_key );
314
+		$this->get_remote_dataset_uri($new_key);
315 315
 	}
316 316
 
317 317
 	/**
@@ -325,15 +325,15 @@  discard block
 block discarded – undo
325 325
 	 * @param string  $key     The key to be used
326 326
 	 *
327 327
 	 */
328
-	private function get_remote_dataset_uri( $key ) {
328
+	private function get_remote_dataset_uri($key) {
329 329
 		// Request the dataset URI.
330
-		$response = wp_remote_get( $this->get_accounts_by_key_dataset_uri( $key ), unserialize( WL_REDLINK_API_HTTP_OPTIONS ) );
330
+		$response = wp_remote_get($this->get_accounts_by_key_dataset_uri($key), unserialize(WL_REDLINK_API_HTTP_OPTIONS));
331 331
 
332 332
 		// If the response is valid, then set the value.
333
-		if ( ! is_wp_error( $response ) && 200 === (int) $response['response']['code'] ) {
334
-			$this->set_dataset_uri( $response['body'] );
333
+		if ( ! is_wp_error($response) && 200 === (int) $response['response']['code']) {
334
+			$this->set_dataset_uri($response['body']);
335 335
 		} else {
336
-			$this->set_dataset_uri( '' );
336
+			$this->set_dataset_uri('');
337 337
 		}
338 338
 	}
339 339
 
@@ -353,13 +353,13 @@  discard block
 block discarded – undo
353 353
 	 * @return mixed The same value in the $value parameter
354 354
 	 *
355 355
 	 */
356
-	function maybe_update_dataset_uri( $value, $old_value ) {
357
-		if ( ! empty( $value ) &&
358
-			( $value == $old_value ) &&
359
-			empty( $this->get_dataset_uri() ) ) {
356
+	function maybe_update_dataset_uri($value, $old_value) {
357
+		if ( ! empty($value) &&
358
+			($value == $old_value) &&
359
+			empty($this->get_dataset_uri())) {
360 360
 
361 361
 			// make the request to the remote server to try to get the dataset uri
362
-			$this->get_remote_dataset_uri( $value );
362
+			$this->get_remote_dataset_uri($value);
363 363
 		}
364 364
 
365 365
 		return $value;
@@ -374,9 +374,9 @@  discard block
 block discarded – undo
374 374
 	 *
375 375
 	 * @return string The API URI.
376 376
 	 */
377
-	public function get_accounts_by_key_dataset_uri( $key ) {
377
+	public function get_accounts_by_key_dataset_uri($key) {
378 378
 
379
-		return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "accounts/key=$key/dataset_uri";
379
+		return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE."accounts/key=$key/dataset_uri";
380 380
 	}
381 381
 
382 382
 }
Please login to merge, or discard this patch.
src/includes/class-wordlift-topic-taxonomy-service.php 2 patches
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -7,174 +7,174 @@
 block discarded – undo
7 7
  */
8 8
 class Wordlift_Topic_Taxonomy_Service {
9 9
 
10
-	/**
11
-	 * The Log service.
12
-	 *
13
-	 * @since 3.5.0
14
-	 * @access private
15
-	 * @var \Wordlift_Log_Service $log_service The Log service.
16
-	 */
17
-	private $log_service;
18
-
19
-	/**
20
-	 * Taxonomy name.
21
-	 *
22
-	 * @since 3.5.0
23
-	 */
24
-	const TAXONOMY_NAME = 'wl_topic';
25
-
26
-	/**
27
-	 * Taxonomy object type.
28
-	 *
29
-	 * @since 3.5.0
30
-	 */
31
-	const TAXONOMY_OBJECT_TYPE = 'post';
32
-
33
-	/**
34
-	 * Taxonomy slug.
35
-	 *
36
-	 * @since 3.5.0
37
-	 */
38
-	const TAXONOMY_SLUG = 'wl_topic';
39
-
40
-	/**
41
-	 * A singleton instance of the Wordlift_Topic_Taxonomy_Service service.
42
-	 *
43
-	 * @since 3.5.0
44
-	 * @access private
45
-	 * @var \Wordlift_Topic_Taxonomy_Service $instance A singleton instance of Wordlift_Topic_Taxonomy_Service.
46
-	 */
47
-	private static $instance;
48
-
49
-	/**
50
-	 * Create a Wordlift_Topic_Taxonomy_Service instance.
51
-	 *
52
-	 * @since 3.5.0
53
-	 *
54
-	 */
55
-	public function __construct() {
56
-
57
-		$this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' );
58
-
59
-		// Set the singleton instance.
60
-		self::$instance = $this;
61
-
62
-	}
63
-
64
-	/**
65
-	 * Get the singleton instance of the Entity service.
66
-	 *
67
-	 * @since 3.5.0
68
-	 * @return Wordlift_Topic_Taxonomy_Service
69
-	 */
70
-	public static function get_instance() {
71
-
72
-		return self::$instance;
73
-	}
74
-
75
-	/**
76
-	 * Just register the topic taxonomy.
77
-	 *
78
-	 * @since 3.5.0
79
-	 *
80
-	 */
81
-	public function init() {
82
-
83
-		// See https://codex.wordpress.org/Function_Reference/register_taxonomy
84
-		$labels = array(
85
-			'name'              => _x( 'Topics', 'taxonomy general name', 'wordlift' ),
86
-			'singular_name'     => _x( 'Topic', 'taxonomy singular name', 'wordlift' ),
87
-			'search_items'      => __( 'Search Topics', 'wordlift' ),
88
-			'all_items'         => __( 'All Topics', 'wordlift' ),
89
-			'parent_item'       => __( 'Parent Topic', 'wordlift' ),
90
-			'parent_item_colon' => __( 'Parent Topic:', 'wordlift' ),
91
-			'edit_item'         => __( 'Edit Topic', 'wordlift' ),
92
-			'update_item'       => __( 'Update Topic', 'wordlift' ),
93
-			'add_new_item'      => __( 'Add New Topic', 'wordlift' ),
94
-			'new_item_name'     => __( 'New Topic', 'wordlift' ),
95
-			'menu_name'         => __( 'Topics', 'wordlift' ),
96
-		);
97
-
98
-		$capabilities = array(
99
-			'manage_terms' => null,
100
-			'edit_terms'   => null,
101
-			'delete_terms' => null,
102
-			'assign_terms' => 'edit_posts',
103
-		);
104
-
105
-		$args = array(
106
-			'labels'            => $labels,
107
-			'capabilities'      => $capabilities,
108
-			'hierarchical'      => true,
109
-			'show_admin_column' => false,
110
-			'show_ui'			=> false,
111
-			'rewrite'			=> array(
112
-				'slug'	=> self::TAXONOMY_SLUG,
113
-			),
114
-		);
115
-
116
-		// Register taxonomy
117
-		register_taxonomy(
118
-			self::TAXONOMY_NAME, self::TAXONOMY_OBJECT_TYPE, $args
119
-		);
120
-
121
-	}
122
-
123
-	/**
124
-	 * Get or create a taxonomy term from a given entity topic.
125
-	 *
126
-	 * @since 3.5.0
127
-	 *
128
-	 */
129
-	public function get_or_create_term_from_topic_entity( $topic ) {
130
-
131
-		// Define taxonomy term slug
132
-		$term_slug = sanitize_title( $topic->post_title );
133
-		// Look for an existing taxonomy term with a given slug
134
-		if ( $term = get_term_by( 'slug', $term_slug, self::TAXONOMY_NAME ) ) {
135
-			return (int) $term->term_id;
136
-		}
137
-		// Otherwise create a new term and return it
138
-		$result = wp_insert_term(
139
-			$topic->post_title,
140
-			self::TAXONOMY_NAME,
141
-			array(
142
-				'slug'			=> $term_slug,
143
-				'description'	=> $topic->post_content,
144
-			)
145
-		);
146
-
147
-		return  (int) $result['term_id'];
148
-	}
149
-
150
-	/**
151
-	 * Set a topic for a given post.
152
-	 *
153
-	 * @since 3.5.0
154
-	 *
155
-	 */
156
-	public function set_topic_for( $post_id, $topic_id ) {
157
-		// Retrieve the topic entity post
158
-		$topic_entity_post = get_post( $topic_id );
159
-		// If current topic does not exist in db false is returned
160
-		if ( null === $topic_entity_post ) {
161
-			return false;
162
-		}
163
-		// Create the proper taxonomy term if needed
164
-		$term_id = $this->get_or_create_term_from_topic_entity( $topic_entity_post );
165
-		// Link the term to the current post
166
-		wp_set_post_terms( $post_id, $term_id, self::TAXONOMY_NAME, false );
167
-		return true;
168
-	}
169
-
170
-	/**
171
-	 * Unlink any topic for a given post.
172
-	 *
173
-	 * @since 3.5.0
174
-	 *
175
-	 */
176
-	public function unlink_topic_for( $post_id ) {
177
-		wp_delete_object_term_relationships( $post_id, self::TAXONOMY_NAME );
178
-	}
10
+    /**
11
+     * The Log service.
12
+     *
13
+     * @since 3.5.0
14
+     * @access private
15
+     * @var \Wordlift_Log_Service $log_service The Log service.
16
+     */
17
+    private $log_service;
18
+
19
+    /**
20
+     * Taxonomy name.
21
+     *
22
+     * @since 3.5.0
23
+     */
24
+    const TAXONOMY_NAME = 'wl_topic';
25
+
26
+    /**
27
+     * Taxonomy object type.
28
+     *
29
+     * @since 3.5.0
30
+     */
31
+    const TAXONOMY_OBJECT_TYPE = 'post';
32
+
33
+    /**
34
+     * Taxonomy slug.
35
+     *
36
+     * @since 3.5.0
37
+     */
38
+    const TAXONOMY_SLUG = 'wl_topic';
39
+
40
+    /**
41
+     * A singleton instance of the Wordlift_Topic_Taxonomy_Service service.
42
+     *
43
+     * @since 3.5.0
44
+     * @access private
45
+     * @var \Wordlift_Topic_Taxonomy_Service $instance A singleton instance of Wordlift_Topic_Taxonomy_Service.
46
+     */
47
+    private static $instance;
48
+
49
+    /**
50
+     * Create a Wordlift_Topic_Taxonomy_Service instance.
51
+     *
52
+     * @since 3.5.0
53
+     *
54
+     */
55
+    public function __construct() {
56
+
57
+        $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' );
58
+
59
+        // Set the singleton instance.
60
+        self::$instance = $this;
61
+
62
+    }
63
+
64
+    /**
65
+     * Get the singleton instance of the Entity service.
66
+     *
67
+     * @since 3.5.0
68
+     * @return Wordlift_Topic_Taxonomy_Service
69
+     */
70
+    public static function get_instance() {
71
+
72
+        return self::$instance;
73
+    }
74
+
75
+    /**
76
+     * Just register the topic taxonomy.
77
+     *
78
+     * @since 3.5.0
79
+     *
80
+     */
81
+    public function init() {
82
+
83
+        // See https://codex.wordpress.org/Function_Reference/register_taxonomy
84
+        $labels = array(
85
+            'name'              => _x( 'Topics', 'taxonomy general name', 'wordlift' ),
86
+            'singular_name'     => _x( 'Topic', 'taxonomy singular name', 'wordlift' ),
87
+            'search_items'      => __( 'Search Topics', 'wordlift' ),
88
+            'all_items'         => __( 'All Topics', 'wordlift' ),
89
+            'parent_item'       => __( 'Parent Topic', 'wordlift' ),
90
+            'parent_item_colon' => __( 'Parent Topic:', 'wordlift' ),
91
+            'edit_item'         => __( 'Edit Topic', 'wordlift' ),
92
+            'update_item'       => __( 'Update Topic', 'wordlift' ),
93
+            'add_new_item'      => __( 'Add New Topic', 'wordlift' ),
94
+            'new_item_name'     => __( 'New Topic', 'wordlift' ),
95
+            'menu_name'         => __( 'Topics', 'wordlift' ),
96
+        );
97
+
98
+        $capabilities = array(
99
+            'manage_terms' => null,
100
+            'edit_terms'   => null,
101
+            'delete_terms' => null,
102
+            'assign_terms' => 'edit_posts',
103
+        );
104
+
105
+        $args = array(
106
+            'labels'            => $labels,
107
+            'capabilities'      => $capabilities,
108
+            'hierarchical'      => true,
109
+            'show_admin_column' => false,
110
+            'show_ui'			=> false,
111
+            'rewrite'			=> array(
112
+                'slug'	=> self::TAXONOMY_SLUG,
113
+            ),
114
+        );
115
+
116
+        // Register taxonomy
117
+        register_taxonomy(
118
+            self::TAXONOMY_NAME, self::TAXONOMY_OBJECT_TYPE, $args
119
+        );
120
+
121
+    }
122
+
123
+    /**
124
+     * Get or create a taxonomy term from a given entity topic.
125
+     *
126
+     * @since 3.5.0
127
+     *
128
+     */
129
+    public function get_or_create_term_from_topic_entity( $topic ) {
130
+
131
+        // Define taxonomy term slug
132
+        $term_slug = sanitize_title( $topic->post_title );
133
+        // Look for an existing taxonomy term with a given slug
134
+        if ( $term = get_term_by( 'slug', $term_slug, self::TAXONOMY_NAME ) ) {
135
+            return (int) $term->term_id;
136
+        }
137
+        // Otherwise create a new term and return it
138
+        $result = wp_insert_term(
139
+            $topic->post_title,
140
+            self::TAXONOMY_NAME,
141
+            array(
142
+                'slug'			=> $term_slug,
143
+                'description'	=> $topic->post_content,
144
+            )
145
+        );
146
+
147
+        return  (int) $result['term_id'];
148
+    }
149
+
150
+    /**
151
+     * Set a topic for a given post.
152
+     *
153
+     * @since 3.5.0
154
+     *
155
+     */
156
+    public function set_topic_for( $post_id, $topic_id ) {
157
+        // Retrieve the topic entity post
158
+        $topic_entity_post = get_post( $topic_id );
159
+        // If current topic does not exist in db false is returned
160
+        if ( null === $topic_entity_post ) {
161
+            return false;
162
+        }
163
+        // Create the proper taxonomy term if needed
164
+        $term_id = $this->get_or_create_term_from_topic_entity( $topic_entity_post );
165
+        // Link the term to the current post
166
+        wp_set_post_terms( $post_id, $term_id, self::TAXONOMY_NAME, false );
167
+        return true;
168
+    }
169
+
170
+    /**
171
+     * Unlink any topic for a given post.
172
+     *
173
+     * @since 3.5.0
174
+     *
175
+     */
176
+    public function unlink_topic_for( $post_id ) {
177
+        wp_delete_object_term_relationships( $post_id, self::TAXONOMY_NAME );
178
+    }
179 179
 
180 180
 }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function __construct() {
56 56
 
57
-		$this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' );
57
+		$this->log_service = Wordlift_Log_Service::get_logger('Wordlift_Entity_Service');
58 58
 
59 59
 		// Set the singleton instance.
60 60
 		self::$instance = $this;
@@ -82,17 +82,17 @@  discard block
 block discarded – undo
82 82
 
83 83
 		// See https://codex.wordpress.org/Function_Reference/register_taxonomy
84 84
 		$labels = array(
85
-			'name'              => _x( 'Topics', 'taxonomy general name', 'wordlift' ),
86
-			'singular_name'     => _x( 'Topic', 'taxonomy singular name', 'wordlift' ),
87
-			'search_items'      => __( 'Search Topics', 'wordlift' ),
88
-			'all_items'         => __( 'All Topics', 'wordlift' ),
89
-			'parent_item'       => __( 'Parent Topic', 'wordlift' ),
90
-			'parent_item_colon' => __( 'Parent Topic:', 'wordlift' ),
91
-			'edit_item'         => __( 'Edit Topic', 'wordlift' ),
92
-			'update_item'       => __( 'Update Topic', 'wordlift' ),
93
-			'add_new_item'      => __( 'Add New Topic', 'wordlift' ),
94
-			'new_item_name'     => __( 'New Topic', 'wordlift' ),
95
-			'menu_name'         => __( 'Topics', 'wordlift' ),
85
+			'name'              => _x('Topics', 'taxonomy general name', 'wordlift'),
86
+			'singular_name'     => _x('Topic', 'taxonomy singular name', 'wordlift'),
87
+			'search_items'      => __('Search Topics', 'wordlift'),
88
+			'all_items'         => __('All Topics', 'wordlift'),
89
+			'parent_item'       => __('Parent Topic', 'wordlift'),
90
+			'parent_item_colon' => __('Parent Topic:', 'wordlift'),
91
+			'edit_item'         => __('Edit Topic', 'wordlift'),
92
+			'update_item'       => __('Update Topic', 'wordlift'),
93
+			'add_new_item'      => __('Add New Topic', 'wordlift'),
94
+			'new_item_name'     => __('New Topic', 'wordlift'),
95
+			'menu_name'         => __('Topics', 'wordlift'),
96 96
 		);
97 97
 
98 98
 		$capabilities = array(
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 	 * @since 3.5.0
127 127
 	 *
128 128
 	 */
129
-	public function get_or_create_term_from_topic_entity( $topic ) {
129
+	public function get_or_create_term_from_topic_entity($topic) {
130 130
 
131 131
 		// Define taxonomy term slug
132
-		$term_slug = sanitize_title( $topic->post_title );
132
+		$term_slug = sanitize_title($topic->post_title);
133 133
 		// Look for an existing taxonomy term with a given slug
134
-		if ( $term = get_term_by( 'slug', $term_slug, self::TAXONOMY_NAME ) ) {
134
+		if ($term = get_term_by('slug', $term_slug, self::TAXONOMY_NAME)) {
135 135
 			return (int) $term->term_id;
136 136
 		}
137 137
 		// Otherwise create a new term and return it
@@ -153,17 +153,17 @@  discard block
 block discarded – undo
153 153
 	 * @since 3.5.0
154 154
 	 *
155 155
 	 */
156
-	public function set_topic_for( $post_id, $topic_id ) {
156
+	public function set_topic_for($post_id, $topic_id) {
157 157
 		// Retrieve the topic entity post
158
-		$topic_entity_post = get_post( $topic_id );
158
+		$topic_entity_post = get_post($topic_id);
159 159
 		// If current topic does not exist in db false is returned
160
-		if ( null === $topic_entity_post ) {
160
+		if (null === $topic_entity_post) {
161 161
 			return false;
162 162
 		}
163 163
 		// Create the proper taxonomy term if needed
164
-		$term_id = $this->get_or_create_term_from_topic_entity( $topic_entity_post );
164
+		$term_id = $this->get_or_create_term_from_topic_entity($topic_entity_post);
165 165
 		// Link the term to the current post
166
-		wp_set_post_terms( $post_id, $term_id, self::TAXONOMY_NAME, false );
166
+		wp_set_post_terms($post_id, $term_id, self::TAXONOMY_NAME, false);
167 167
 		return true;
168 168
 	}
169 169
 
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @since 3.5.0
174 174
 	 *
175 175
 	 */
176
-	public function unlink_topic_for( $post_id ) {
177
-		wp_delete_object_term_relationships( $post_id, self::TAXONOMY_NAME );
176
+	public function unlink_topic_for($post_id) {
177
+		wp_delete_object_term_relationships($post_id, self::TAXONOMY_NAME);
178 178
 	}
179 179
 
180 180
 }
Please login to merge, or discard this patch.