@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * @since 3.9.0 |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @since 3.9.0 |
| 86 | 86 | * |
| 87 | 87 | */ |
| 88 | - public function __construct( $configuration_service, $key_validation_service, $entity_service, $language_select_element, $country_select_element ) { |
|
| 88 | + public function __construct($configuration_service, $key_validation_service, $entity_service, $language_select_element, $country_select_element) { |
|
| 89 | 89 | |
| 90 | 90 | // Set a reference to the configuration service. |
| 91 | 91 | $this->configuration_service = $configuration_service; |
@@ -102,13 +102,13 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | // Hook to some WP's events: |
| 104 | 104 | // When WP is loaded check whether the user decided to skip the set-up, i.e. don't show us even if WL is not set up. |
| 105 | - add_action( 'wp_loaded', array( $this, 'hide_notices' ) ); |
|
| 105 | + add_action('wp_loaded', array($this, 'hide_notices')); |
|
| 106 | 106 | |
| 107 | 107 | // Hook to `admin_menu` in order to add our own setup wizard page. |
| 108 | - add_action( 'admin_menu', array( $this, 'admin_menu' ) ); |
|
| 108 | + add_action('admin_menu', array($this, 'admin_menu')); |
|
| 109 | 109 | |
| 110 | 110 | // Triggered when the user accesses the admin area, we decide whether to show our own wizard. |
| 111 | - add_action( 'admin_init', array( $this, 'show_page' ) ); |
|
| 111 | + add_action('admin_init', array($this, 'show_page')); |
|
| 112 | 112 | |
| 113 | 113 | /** |
| 114 | 114 | * Filter: wl_feature__enable__notices. |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | * @return bool |
| 119 | 119 | * @since 3.27.6 |
| 120 | 120 | */ |
| 121 | - if ( apply_filters( 'wl_feature__enable__notices', true ) ) { |
|
| 121 | + if (apply_filters('wl_feature__enable__notices', true)) { |
|
| 122 | 122 | // Hook to `admin_notices` to display our notices. |
| 123 | - add_action( 'admin_notices', array( $this, 'admin_notices' ) ); |
|
| 123 | + add_action('admin_notices', array($this, 'admin_notices')); |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
@@ -132,21 +132,21 @@ discard block |
||
| 132 | 132 | public function admin_init() { |
| 133 | 133 | |
| 134 | 134 | // If the `_wl_activation_redirect` is set, the redirect to the setup page. |
| 135 | - if ( get_transient( '_wl_activation_redirect' ) ) { |
|
| 136 | - delete_transient( '_wl_activation_redirect' ); |
|
| 135 | + if (get_transient('_wl_activation_redirect')) { |
|
| 136 | + delete_transient('_wl_activation_redirect'); |
|
| 137 | 137 | |
| 138 | 138 | // If the user asked to skip the wizard then comply. |
| 139 | - if ( $this->configuration_service->is_skip_wizard() ) { |
|
| 139 | + if ($this->configuration_service->is_skip_wizard()) { |
|
| 140 | 140 | return; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | // If we're already on the page or the user doesn't have permissions, return. |
| 144 | - if ( ( ! empty( $_GET['page'] ) && 'wl-setup' === $_GET['page'] ) || is_network_admin() || isset( $_GET['activate-multi'] ) || ! current_user_can( 'manage_options' ) ) { |
|
| 144 | + if (( ! empty($_GET['page']) && 'wl-setup' === $_GET['page']) || is_network_admin() || isset($_GET['activate-multi']) || ! current_user_can('manage_options')) { |
|
| 145 | 145 | return; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | // Finally redirect to the setup page. |
| 149 | - wp_safe_redirect( admin_url( 'index.php?page=wl-setup' ) ); |
|
| 149 | + wp_safe_redirect(admin_url('index.php?page=wl-setup')); |
|
| 150 | 150 | |
| 151 | 151 | exit; |
| 152 | 152 | } |
@@ -161,14 +161,14 @@ discard block |
||
| 161 | 161 | public function admin_notices() { |
| 162 | 162 | |
| 163 | 163 | // Use `wl_configuration_get_key` to check whether WL's key is set and that the user didn't disable the wizard. |
| 164 | - if ( '' === $this->configuration_service->get_key() && ! $this->configuration_service->is_skip_wizard() ) { ?> |
|
| 164 | + if ('' === $this->configuration_service->get_key() && ! $this->configuration_service->is_skip_wizard()) { ?> |
|
| 165 | 165 | <div id="wl-message" class="updated"> |
| 166 | - <p><?php esc_html_e( 'Welcome to WordLift – You‘re almost ready to start', 'wordlift' ); ?></p> |
|
| 166 | + <p><?php esc_html_e('Welcome to WordLift – You‘re almost ready to start', 'wordlift'); ?></p> |
|
| 167 | 167 | <p class="submit"> |
| 168 | - <a href="<?php echo esc_url( admin_url( 'admin.php?page=wl-setup' ) ); ?>" |
|
| 169 | - class="button-primary"><?php esc_html_e( 'Run the Setup Wizard', 'wordlift' ); ?></a> |
|
| 168 | + <a href="<?php echo esc_url(admin_url('admin.php?page=wl-setup')); ?>" |
|
| 169 | + class="button-primary"><?php esc_html_e('Run the Setup Wizard', 'wordlift'); ?></a> |
|
| 170 | 170 | <a class="button-secondary skip" |
| 171 | - href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wl-hide-notice', 'install' ), 'wordlift_hide_notices_nonce', '_wl_notice_nonce' ) ); ?>"><?php esc_html_e( 'Skip Setup', 'wordlift' ); ?></a> |
|
| 171 | + href="<?php echo esc_url(wp_nonce_url(add_query_arg('wl-hide-notice', 'install'), 'wordlift_hide_notices_nonce', '_wl_notice_nonce')); ?>"><?php esc_html_e('Skip Setup', 'wordlift'); ?></a> |
|
| 172 | 172 | </p> |
| 173 | 173 | </div> |
| 174 | 174 | <?php } |
@@ -183,22 +183,22 @@ discard block |
||
| 183 | 183 | public function hide_notices() { |
| 184 | 184 | |
| 185 | 185 | // If it's not a `wl-hide-notice` or the nonce is not set, return. |
| 186 | - if ( ! isset( $_GET['wl-hide-notice'], $_GET['_wl_notice_nonce'] ) ) { |
|
| 186 | + if ( ! isset($_GET['wl-hide-notice'], $_GET['_wl_notice_nonce'])) { |
|
| 187 | 187 | return; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | // If the nonce is invalid, return an error. |
| 191 | - if ( ! wp_verify_nonce( $_GET['_wl_notice_nonce'], 'wordlift_hide_notices_nonce' ) ) { |
|
| 192 | - wp_die( __( 'Action failed. Please refresh the page and retry.', 'wordlift' ) ); |
|
| 191 | + if ( ! wp_verify_nonce($_GET['_wl_notice_nonce'], 'wordlift_hide_notices_nonce')) { |
|
| 192 | + wp_die(__('Action failed. Please refresh the page and retry.', 'wordlift')); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | // If the user doesn't have the right privileges, return an error. |
| 196 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
| 197 | - wp_die( __( 'Cheatin’ huh?', 'wordlift' ) ); |
|
| 196 | + if ( ! current_user_can('manage_options')) { |
|
| 197 | + wp_die(__('Cheatin’ huh?', 'wordlift')); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | // Store a flag telling to skip the wizard. |
| 201 | - $this->configuration_service->set_skip_wizard( true ); |
|
| 201 | + $this->configuration_service->set_skip_wizard(true); |
|
| 202 | 202 | |
| 203 | 203 | } |
| 204 | 204 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * @since 3.27.7 |
| 215 | 215 | */ |
| 216 | 216 | // @todo: find another way to do this, since this is adding an empty space in WP's dashboard menu. |
| 217 | - add_dashboard_page( '', '', 'manage_options', 'wl-setup', '' ); |
|
| 217 | + add_dashboard_page('', '', 'manage_options', 'wl-setup', ''); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -225,26 +225,26 @@ discard block |
||
| 225 | 225 | public function show_page() { |
| 226 | 226 | |
| 227 | 227 | // First check if we are in the wizard page at all, if not do nothing. |
| 228 | - if ( empty( $_GET['page'] ) || 'wl-setup' !== $_GET['page'] ) { |
|
| 228 | + if (empty($_GET['page']) || 'wl-setup' !== $_GET['page']) { |
|
| 229 | 229 | return; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | // If it's a POST and the `wl-save-configuration` action is set, save the configuration. |
| 233 | - if ( isset( $_POST['action'] ) && 'wl-save-configuration' === $_POST['action'] ) { |
|
| 233 | + if (isset($_POST['action']) && 'wl-save-configuration' === $_POST['action']) { |
|
| 234 | 234 | |
| 235 | 235 | // Check the nonce and the user capabilities. |
| 236 | - check_admin_referer( 'wl-save-configuration' ); |
|
| 236 | + check_admin_referer('wl-save-configuration'); |
|
| 237 | 237 | |
| 238 | 238 | // Check if the user has the right privileges. |
| 239 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
| 240 | - wp_die( __( 'Sorry, you do not have a permission to save the settings', 'wordlift' ) ); |
|
| 239 | + if ( ! current_user_can('manage_options')) { |
|
| 240 | + wp_die(__('Sorry, you do not have a permission to save the settings', 'wordlift')); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | // Save the configuration. |
| 244 | - $this->save_configuration( $_POST ); |
|
| 244 | + $this->save_configuration($_POST); |
|
| 245 | 245 | |
| 246 | 246 | // Redirect to the admin's page. |
| 247 | - wp_redirect( admin_url() ); |
|
| 247 | + wp_redirect(admin_url()); |
|
| 248 | 248 | |
| 249 | 249 | exit; |
| 250 | 250 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | $language_select = $this->language_select_element; |
| 253 | 253 | $country_select = $this->country_select_element; |
| 254 | 254 | |
| 255 | - include plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/wordlift-admin-setup.php'; |
|
| 255 | + include plugin_dir_path(dirname(__FILE__)).'admin/partials/wordlift-admin-setup.php'; |
|
| 256 | 256 | |
| 257 | 257 | exit; |
| 258 | 258 | } |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | * @since 3.9.0 |
| 266 | 266 | * |
| 267 | 267 | */ |
| 268 | - public function save_configuration( $params ) { |
|
| 268 | + public function save_configuration($params) { |
|
| 269 | 269 | |
| 270 | 270 | // We have the following parameters: |
| 271 | 271 | // `key`, holding WL's key, |
@@ -277,32 +277,32 @@ discard block |
||
| 277 | 277 | // `logo`, the attachment id for the `personal` or `company` entity. |
| 278 | 278 | |
| 279 | 279 | // Store the key: |
| 280 | - $this->configuration_service->set_key( $params['key'] ); |
|
| 280 | + $this->configuration_service->set_key($params['key']); |
|
| 281 | 281 | |
| 282 | 282 | // Store the vocabulary path: |
| 283 | - $this->configuration_service->set_entity_base_path( $params['vocabulary'] ); |
|
| 283 | + $this->configuration_service->set_entity_base_path($params['vocabulary']); |
|
| 284 | 284 | |
| 285 | 285 | // Store the site's language: |
| 286 | - $this->configuration_service->set_language_code( $params['wl-site-language'] ); |
|
| 286 | + $this->configuration_service->set_language_code($params['wl-site-language']); |
|
| 287 | 287 | |
| 288 | 288 | // Store the site's country: |
| 289 | - $this->configuration_service->set_country_code( $params['wl-country-code'] ); |
|
| 289 | + $this->configuration_service->set_country_code($params['wl-country-code']); |
|
| 290 | 290 | |
| 291 | 291 | // Store the preferences in variable, because if the checkbox is not checked |
| 292 | 292 | // the `share-diagnostic` will not exists in `$params` array. |
| 293 | - $share_diagnostic_preferences = empty( $params['share-diagnostic'] ) ? 'no' : 'yes'; |
|
| 293 | + $share_diagnostic_preferences = empty($params['share-diagnostic']) ? 'no' : 'yes'; |
|
| 294 | 294 | |
| 295 | 295 | // Store the diagnostic preferences: |
| 296 | - $this->configuration_service->set_diagnostic_preferences( $share_diagnostic_preferences ); |
|
| 296 | + $this->configuration_service->set_diagnostic_preferences($share_diagnostic_preferences); |
|
| 297 | 297 | |
| 298 | 298 | // Set the type URI, either http://schema.org/Person or http://schema.org/Organization. |
| 299 | - $type_uri = sprintf( 'http://schema.org/%s', 'organization' === $params['user_type'] ? 'Organization' : 'Person' ); |
|
| 299 | + $type_uri = sprintf('http://schema.org/%s', 'organization' === $params['user_type'] ? 'Organization' : 'Person'); |
|
| 300 | 300 | |
| 301 | 301 | // Create an entity for the publisher. |
| 302 | - $publisher_post_id = $this->entity_service->create( $params['name'], $type_uri, $params['logo'], 'publish' ); |
|
| 302 | + $publisher_post_id = $this->entity_service->create($params['name'], $type_uri, $params['logo'], 'publish'); |
|
| 303 | 303 | |
| 304 | 304 | // Store the publisher entity post id in the configuration. |
| 305 | - $this->configuration_service->set_publisher_id( $publisher_post_id ); |
|
| 305 | + $this->configuration_service->set_publisher_id($publisher_post_id); |
|
| 306 | 306 | |
| 307 | 307 | flush_rewrite_rules(); // Needed because of possible change to the entity base path. |
| 308 | 308 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | if ( ! defined( 'ABSPATH' ) ) { |
| 16 | - exit; |
|
| 16 | + exit; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -28,140 +28,140 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | class Wordlift_Admin_Setup { |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * A {@link Wordlift_Configuration_Service} instance. |
|
| 33 | - * |
|
| 34 | - * @since 3.9.0 |
|
| 35 | - * @access private |
|
| 36 | - * @var Wordlift_Configuration_Service A {@link Wordlift_Configuration_Service} instance. |
|
| 37 | - */ |
|
| 38 | - private $configuration_service; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 42 | - * |
|
| 43 | - * @since 3.9.0 |
|
| 44 | - * @access private |
|
| 45 | - * @var Wordlift_Key_Validation_Service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 46 | - */ |
|
| 47 | - private $key_validation_service; |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * A {@link Wordlift_Entity_Service} instance. |
|
| 51 | - * |
|
| 52 | - * @since 3.9.0 |
|
| 53 | - * @access private |
|
| 54 | - * @var Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
| 55 | - */ |
|
| 56 | - private $entity_service; |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * A {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 60 | - * |
|
| 61 | - * @since 3.20.0 |
|
| 62 | - * @access private |
|
| 63 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element A {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 64 | - */ |
|
| 65 | - private $language_select_element; |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * A {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 69 | - * |
|
| 70 | - * @since 3.20.0 |
|
| 71 | - * @access private |
|
| 72 | - * @var \Wordlift_Admin_Country_Select_Element $country_select_element A {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 73 | - */ |
|
| 74 | - private $country_select_element; |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * Initialize the class and set its properties. |
|
| 78 | - * |
|
| 79 | - * @param \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 80 | - * @param \Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 81 | - * @param \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
| 82 | - * @param \Wordlift_Admin_Language_Select_Element $language_select_element A {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 83 | - * @param \Wordlift_Admin_Country_Select_Element $country_select_element A {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 84 | - * |
|
| 85 | - * @since 3.9.0 |
|
| 86 | - * |
|
| 87 | - */ |
|
| 88 | - public function __construct( $configuration_service, $key_validation_service, $entity_service, $language_select_element, $country_select_element ) { |
|
| 89 | - |
|
| 90 | - // Set a reference to the configuration service. |
|
| 91 | - $this->configuration_service = $configuration_service; |
|
| 92 | - |
|
| 93 | - // Set a reference to the key validation service. |
|
| 94 | - $this->key_validation_service = $key_validation_service; |
|
| 95 | - |
|
| 96 | - // Set a reference to the entity service. |
|
| 97 | - $this->entity_service = $entity_service; |
|
| 98 | - |
|
| 99 | - // Set a reference to the UI elements language and country. |
|
| 100 | - $this->language_select_element = $language_select_element; |
|
| 101 | - $this->country_select_element = $country_select_element; |
|
| 102 | - |
|
| 103 | - // Hook to some WP's events: |
|
| 104 | - // When WP is loaded check whether the user decided to skip the set-up, i.e. don't show us even if WL is not set up. |
|
| 105 | - add_action( 'wp_loaded', array( $this, 'hide_notices' ) ); |
|
| 106 | - |
|
| 107 | - // Hook to `admin_menu` in order to add our own setup wizard page. |
|
| 108 | - add_action( 'admin_menu', array( $this, 'admin_menu' ) ); |
|
| 109 | - |
|
| 110 | - // Triggered when the user accesses the admin area, we decide whether to show our own wizard. |
|
| 111 | - add_action( 'admin_init', array( $this, 'show_page' ) ); |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * Filter: wl_feature__enable__notices. |
|
| 115 | - * |
|
| 116 | - * @param bool whether the notices needs to be enabled or not. |
|
| 117 | - * |
|
| 118 | - * @return bool |
|
| 119 | - * @since 3.27.6 |
|
| 120 | - */ |
|
| 121 | - if ( apply_filters( 'wl_feature__enable__notices', true ) ) { |
|
| 122 | - // Hook to `admin_notices` to display our notices. |
|
| 123 | - add_action( 'admin_notices', array( $this, 'admin_notices' ) ); |
|
| 124 | - } |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * Hook to `admin_init` and redirect to WordLift's setup page if the `_wl_activation_redirect` transient flag is set. |
|
| 129 | - * |
|
| 130 | - * @since 3.9.0 |
|
| 131 | - */ |
|
| 132 | - public function admin_init() { |
|
| 133 | - |
|
| 134 | - // If the `_wl_activation_redirect` is set, the redirect to the setup page. |
|
| 135 | - if ( get_transient( '_wl_activation_redirect' ) ) { |
|
| 136 | - delete_transient( '_wl_activation_redirect' ); |
|
| 137 | - |
|
| 138 | - // If the user asked to skip the wizard then comply. |
|
| 139 | - if ( $this->configuration_service->is_skip_wizard() ) { |
|
| 140 | - return; |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - // If we're already on the page or the user doesn't have permissions, return. |
|
| 144 | - if ( ( ! empty( $_GET['page'] ) && 'wl-setup' === $_GET['page'] ) || is_network_admin() || isset( $_GET['activate-multi'] ) || ! current_user_can( 'manage_options' ) ) { |
|
| 145 | - return; |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - // Finally redirect to the setup page. |
|
| 149 | - wp_safe_redirect( admin_url( 'index.php?page=wl-setup' ) ); |
|
| 150 | - |
|
| 151 | - exit; |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - /** |
|
| 157 | - * Generate an admin notice suggesting to start the wizard if there is no configuration. |
|
| 158 | - * |
|
| 159 | - * @since 3.9.0 |
|
| 160 | - */ |
|
| 161 | - public function admin_notices() { |
|
| 162 | - |
|
| 163 | - // Use `wl_configuration_get_key` to check whether WL's key is set and that the user didn't disable the wizard. |
|
| 164 | - if ( '' === $this->configuration_service->get_key() && ! $this->configuration_service->is_skip_wizard() ) { ?> |
|
| 31 | + /** |
|
| 32 | + * A {@link Wordlift_Configuration_Service} instance. |
|
| 33 | + * |
|
| 34 | + * @since 3.9.0 |
|
| 35 | + * @access private |
|
| 36 | + * @var Wordlift_Configuration_Service A {@link Wordlift_Configuration_Service} instance. |
|
| 37 | + */ |
|
| 38 | + private $configuration_service; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 42 | + * |
|
| 43 | + * @since 3.9.0 |
|
| 44 | + * @access private |
|
| 45 | + * @var Wordlift_Key_Validation_Service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 46 | + */ |
|
| 47 | + private $key_validation_service; |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * A {@link Wordlift_Entity_Service} instance. |
|
| 51 | + * |
|
| 52 | + * @since 3.9.0 |
|
| 53 | + * @access private |
|
| 54 | + * @var Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
| 55 | + */ |
|
| 56 | + private $entity_service; |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * A {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 60 | + * |
|
| 61 | + * @since 3.20.0 |
|
| 62 | + * @access private |
|
| 63 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element A {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 64 | + */ |
|
| 65 | + private $language_select_element; |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * A {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 69 | + * |
|
| 70 | + * @since 3.20.0 |
|
| 71 | + * @access private |
|
| 72 | + * @var \Wordlift_Admin_Country_Select_Element $country_select_element A {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 73 | + */ |
|
| 74 | + private $country_select_element; |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * Initialize the class and set its properties. |
|
| 78 | + * |
|
| 79 | + * @param \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 80 | + * @param \Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 81 | + * @param \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
| 82 | + * @param \Wordlift_Admin_Language_Select_Element $language_select_element A {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 83 | + * @param \Wordlift_Admin_Country_Select_Element $country_select_element A {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 84 | + * |
|
| 85 | + * @since 3.9.0 |
|
| 86 | + * |
|
| 87 | + */ |
|
| 88 | + public function __construct( $configuration_service, $key_validation_service, $entity_service, $language_select_element, $country_select_element ) { |
|
| 89 | + |
|
| 90 | + // Set a reference to the configuration service. |
|
| 91 | + $this->configuration_service = $configuration_service; |
|
| 92 | + |
|
| 93 | + // Set a reference to the key validation service. |
|
| 94 | + $this->key_validation_service = $key_validation_service; |
|
| 95 | + |
|
| 96 | + // Set a reference to the entity service. |
|
| 97 | + $this->entity_service = $entity_service; |
|
| 98 | + |
|
| 99 | + // Set a reference to the UI elements language and country. |
|
| 100 | + $this->language_select_element = $language_select_element; |
|
| 101 | + $this->country_select_element = $country_select_element; |
|
| 102 | + |
|
| 103 | + // Hook to some WP's events: |
|
| 104 | + // When WP is loaded check whether the user decided to skip the set-up, i.e. don't show us even if WL is not set up. |
|
| 105 | + add_action( 'wp_loaded', array( $this, 'hide_notices' ) ); |
|
| 106 | + |
|
| 107 | + // Hook to `admin_menu` in order to add our own setup wizard page. |
|
| 108 | + add_action( 'admin_menu', array( $this, 'admin_menu' ) ); |
|
| 109 | + |
|
| 110 | + // Triggered when the user accesses the admin area, we decide whether to show our own wizard. |
|
| 111 | + add_action( 'admin_init', array( $this, 'show_page' ) ); |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * Filter: wl_feature__enable__notices. |
|
| 115 | + * |
|
| 116 | + * @param bool whether the notices needs to be enabled or not. |
|
| 117 | + * |
|
| 118 | + * @return bool |
|
| 119 | + * @since 3.27.6 |
|
| 120 | + */ |
|
| 121 | + if ( apply_filters( 'wl_feature__enable__notices', true ) ) { |
|
| 122 | + // Hook to `admin_notices` to display our notices. |
|
| 123 | + add_action( 'admin_notices', array( $this, 'admin_notices' ) ); |
|
| 124 | + } |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * Hook to `admin_init` and redirect to WordLift's setup page if the `_wl_activation_redirect` transient flag is set. |
|
| 129 | + * |
|
| 130 | + * @since 3.9.0 |
|
| 131 | + */ |
|
| 132 | + public function admin_init() { |
|
| 133 | + |
|
| 134 | + // If the `_wl_activation_redirect` is set, the redirect to the setup page. |
|
| 135 | + if ( get_transient( '_wl_activation_redirect' ) ) { |
|
| 136 | + delete_transient( '_wl_activation_redirect' ); |
|
| 137 | + |
|
| 138 | + // If the user asked to skip the wizard then comply. |
|
| 139 | + if ( $this->configuration_service->is_skip_wizard() ) { |
|
| 140 | + return; |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + // If we're already on the page or the user doesn't have permissions, return. |
|
| 144 | + if ( ( ! empty( $_GET['page'] ) && 'wl-setup' === $_GET['page'] ) || is_network_admin() || isset( $_GET['activate-multi'] ) || ! current_user_can( 'manage_options' ) ) { |
|
| 145 | + return; |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + // Finally redirect to the setup page. |
|
| 149 | + wp_safe_redirect( admin_url( 'index.php?page=wl-setup' ) ); |
|
| 150 | + |
|
| 151 | + exit; |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + /** |
|
| 157 | + * Generate an admin notice suggesting to start the wizard if there is no configuration. |
|
| 158 | + * |
|
| 159 | + * @since 3.9.0 |
|
| 160 | + */ |
|
| 161 | + public function admin_notices() { |
|
| 162 | + |
|
| 163 | + // Use `wl_configuration_get_key` to check whether WL's key is set and that the user didn't disable the wizard. |
|
| 164 | + if ( '' === $this->configuration_service->get_key() && ! $this->configuration_service->is_skip_wizard() ) { ?> |
|
| 165 | 165 | <div id="wl-message" class="updated"> |
| 166 | 166 | <p><?php esc_html_e( 'Welcome to WordLift – You‘re almost ready to start', 'wordlift' ); ?></p> |
| 167 | 167 | <p class="submit"> |
@@ -173,140 +173,140 @@ discard block |
||
| 173 | 173 | </div> |
| 174 | 174 | <?php } |
| 175 | 175 | |
| 176 | - } |
|
| 177 | - |
|
| 178 | - /** |
|
| 179 | - * Handle hiding the wizard notices by user request. |
|
| 180 | - * |
|
| 181 | - * @since 3.9.0 |
|
| 182 | - */ |
|
| 183 | - public function hide_notices() { |
|
| 184 | - |
|
| 185 | - // If it's not a `wl-hide-notice` or the nonce is not set, return. |
|
| 186 | - if ( ! isset( $_GET['wl-hide-notice'], $_GET['_wl_notice_nonce'] ) ) { |
|
| 187 | - return; |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - // If the nonce is invalid, return an error. |
|
| 191 | - if ( ! wp_verify_nonce( $_GET['_wl_notice_nonce'], 'wordlift_hide_notices_nonce' ) ) { |
|
| 192 | - wp_die( __( 'Action failed. Please refresh the page and retry.', 'wordlift' ) ); |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - // If the user doesn't have the right privileges, return an error. |
|
| 196 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
| 197 | - wp_die( __( 'Cheatin’ huh?', 'wordlift' ) ); |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - // Store a flag telling to skip the wizard. |
|
| 201 | - $this->configuration_service->set_skip_wizard( true ); |
|
| 202 | - |
|
| 203 | - } |
|
| 204 | - |
|
| 205 | - /** |
|
| 206 | - * Register the wizard page to be able to access it. |
|
| 207 | - * |
|
| 208 | - * @since 3.9.0 |
|
| 209 | - */ |
|
| 210 | - public function admin_menu() { |
|
| 211 | - /** |
|
| 212 | - * |
|
| 176 | + } |
|
| 177 | + |
|
| 178 | + /** |
|
| 179 | + * Handle hiding the wizard notices by user request. |
|
| 180 | + * |
|
| 181 | + * @since 3.9.0 |
|
| 182 | + */ |
|
| 183 | + public function hide_notices() { |
|
| 184 | + |
|
| 185 | + // If it's not a `wl-hide-notice` or the nonce is not set, return. |
|
| 186 | + if ( ! isset( $_GET['wl-hide-notice'], $_GET['_wl_notice_nonce'] ) ) { |
|
| 187 | + return; |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + // If the nonce is invalid, return an error. |
|
| 191 | + if ( ! wp_verify_nonce( $_GET['_wl_notice_nonce'], 'wordlift_hide_notices_nonce' ) ) { |
|
| 192 | + wp_die( __( 'Action failed. Please refresh the page and retry.', 'wordlift' ) ); |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + // If the user doesn't have the right privileges, return an error. |
|
| 196 | + if ( ! current_user_can( 'manage_options' ) ) { |
|
| 197 | + wp_die( __( 'Cheatin’ huh?', 'wordlift' ) ); |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + // Store a flag telling to skip the wizard. |
|
| 201 | + $this->configuration_service->set_skip_wizard( true ); |
|
| 202 | + |
|
| 203 | + } |
|
| 204 | + |
|
| 205 | + /** |
|
| 206 | + * Register the wizard page to be able to access it. |
|
| 207 | + * |
|
| 208 | + * @since 3.9.0 |
|
| 209 | + */ |
|
| 210 | + public function admin_menu() { |
|
| 211 | + /** |
|
| 212 | + * |
|
| 213 | 213 | * @see https://github.com/insideout10/wordlift-plugin/issues/1209 |
| 214 | - * @since 3.27.7 |
|
| 215 | - */ |
|
| 216 | - // @todo: find another way to do this, since this is adding an empty space in WP's dashboard menu. |
|
| 217 | - add_dashboard_page( '', '', 'manage_options', 'wl-setup', '' ); |
|
| 218 | - } |
|
| 219 | - |
|
| 220 | - /** |
|
| 221 | - * Displays the wizard page. |
|
| 222 | - * |
|
| 223 | - * @since 3.9.0 |
|
| 224 | - */ |
|
| 225 | - public function show_page() { |
|
| 226 | - |
|
| 227 | - // First check if we are in the wizard page at all, if not do nothing. |
|
| 228 | - if ( empty( $_GET['page'] ) || 'wl-setup' !== $_GET['page'] ) { |
|
| 229 | - return; |
|
| 230 | - } |
|
| 231 | - |
|
| 232 | - // If it's a POST and the `wl-save-configuration` action is set, save the configuration. |
|
| 233 | - if ( isset( $_POST['action'] ) && 'wl-save-configuration' === $_POST['action'] ) { |
|
| 234 | - |
|
| 235 | - // Check the nonce and the user capabilities. |
|
| 236 | - check_admin_referer( 'wl-save-configuration' ); |
|
| 237 | - |
|
| 238 | - // Check if the user has the right privileges. |
|
| 239 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
| 240 | - wp_die( __( 'Sorry, you do not have a permission to save the settings', 'wordlift' ) ); |
|
| 241 | - } |
|
| 242 | - |
|
| 243 | - // Save the configuration. |
|
| 244 | - $this->save_configuration( $_POST ); |
|
| 245 | - |
|
| 246 | - // Redirect to the admin's page. |
|
| 247 | - wp_redirect( admin_url() ); |
|
| 248 | - |
|
| 249 | - exit; |
|
| 250 | - } |
|
| 251 | - |
|
| 252 | - $language_select = $this->language_select_element; |
|
| 253 | - $country_select = $this->country_select_element; |
|
| 254 | - |
|
| 255 | - include plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/wordlift-admin-setup.php'; |
|
| 256 | - |
|
| 257 | - exit; |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - /** |
|
| 261 | - * Save WordLift's configuration using the provided parameters. |
|
| 262 | - * |
|
| 263 | - * @param array $params An array of configuration parameters. |
|
| 264 | - * |
|
| 265 | - * @since 3.9.0 |
|
| 266 | - * |
|
| 267 | - */ |
|
| 268 | - public function save_configuration( $params ) { |
|
| 269 | - |
|
| 270 | - // We have the following parameters: |
|
| 271 | - // `key`, holding WL's key, |
|
| 272 | - // `vocabulary`, holding the vocabulary path, |
|
| 273 | - // `wl-site-language`, with the language code (e.g. `en`), |
|
| 214 | + * @since 3.27.7 |
|
| 215 | + */ |
|
| 216 | + // @todo: find another way to do this, since this is adding an empty space in WP's dashboard menu. |
|
| 217 | + add_dashboard_page( '', '', 'manage_options', 'wl-setup', '' ); |
|
| 218 | + } |
|
| 219 | + |
|
| 220 | + /** |
|
| 221 | + * Displays the wizard page. |
|
| 222 | + * |
|
| 223 | + * @since 3.9.0 |
|
| 224 | + */ |
|
| 225 | + public function show_page() { |
|
| 226 | + |
|
| 227 | + // First check if we are in the wizard page at all, if not do nothing. |
|
| 228 | + if ( empty( $_GET['page'] ) || 'wl-setup' !== $_GET['page'] ) { |
|
| 229 | + return; |
|
| 230 | + } |
|
| 231 | + |
|
| 232 | + // If it's a POST and the `wl-save-configuration` action is set, save the configuration. |
|
| 233 | + if ( isset( $_POST['action'] ) && 'wl-save-configuration' === $_POST['action'] ) { |
|
| 234 | + |
|
| 235 | + // Check the nonce and the user capabilities. |
|
| 236 | + check_admin_referer( 'wl-save-configuration' ); |
|
| 237 | + |
|
| 238 | + // Check if the user has the right privileges. |
|
| 239 | + if ( ! current_user_can( 'manage_options' ) ) { |
|
| 240 | + wp_die( __( 'Sorry, you do not have a permission to save the settings', 'wordlift' ) ); |
|
| 241 | + } |
|
| 242 | + |
|
| 243 | + // Save the configuration. |
|
| 244 | + $this->save_configuration( $_POST ); |
|
| 245 | + |
|
| 246 | + // Redirect to the admin's page. |
|
| 247 | + wp_redirect( admin_url() ); |
|
| 248 | + |
|
| 249 | + exit; |
|
| 250 | + } |
|
| 251 | + |
|
| 252 | + $language_select = $this->language_select_element; |
|
| 253 | + $country_select = $this->country_select_element; |
|
| 254 | + |
|
| 255 | + include plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/wordlift-admin-setup.php'; |
|
| 256 | + |
|
| 257 | + exit; |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + /** |
|
| 261 | + * Save WordLift's configuration using the provided parameters. |
|
| 262 | + * |
|
| 263 | + * @param array $params An array of configuration parameters. |
|
| 264 | + * |
|
| 265 | + * @since 3.9.0 |
|
| 266 | + * |
|
| 267 | + */ |
|
| 268 | + public function save_configuration( $params ) { |
|
| 269 | + |
|
| 270 | + // We have the following parameters: |
|
| 271 | + // `key`, holding WL's key, |
|
| 272 | + // `vocabulary`, holding the vocabulary path, |
|
| 273 | + // `wl-site-language`, with the language code (e.g. `en`), |
|
| 274 | 274 | // `wl-country-code` with the country code (e.g. `us`), |
| 275 | - // `share-diagnostic`, the user preferences about sharing data with us. |
|
| 276 | - // `user_type`, the user type either `personal` or `company`, |
|
| 277 | - // `name`, with the `personal` or `company`'s name, |
|
| 278 | - // `logo`, the attachment id for the `personal` or `company` entity. |
|
| 275 | + // `share-diagnostic`, the user preferences about sharing data with us. |
|
| 276 | + // `user_type`, the user type either `personal` or `company`, |
|
| 277 | + // `name`, with the `personal` or `company`'s name, |
|
| 278 | + // `logo`, the attachment id for the `personal` or `company` entity. |
|
| 279 | 279 | |
| 280 | - // Store the key: |
|
| 281 | - $this->configuration_service->set_key( $params['key'] ); |
|
| 280 | + // Store the key: |
|
| 281 | + $this->configuration_service->set_key( $params['key'] ); |
|
| 282 | 282 | |
| 283 | - // Store the vocabulary path: |
|
| 284 | - $this->configuration_service->set_entity_base_path( $params['vocabulary'] ); |
|
| 283 | + // Store the vocabulary path: |
|
| 284 | + $this->configuration_service->set_entity_base_path( $params['vocabulary'] ); |
|
| 285 | 285 | |
| 286 | - // Store the site's language: |
|
| 287 | - $this->configuration_service->set_language_code( $params['wl-site-language'] ); |
|
| 286 | + // Store the site's language: |
|
| 287 | + $this->configuration_service->set_language_code( $params['wl-site-language'] ); |
|
| 288 | 288 | |
| 289 | - // Store the site's country: |
|
| 290 | - $this->configuration_service->set_country_code( $params['wl-country-code'] ); |
|
| 289 | + // Store the site's country: |
|
| 290 | + $this->configuration_service->set_country_code( $params['wl-country-code'] ); |
|
| 291 | 291 | |
| 292 | - // Store the preferences in variable, because if the checkbox is not checked |
|
| 293 | - // the `share-diagnostic` will not exists in `$params` array. |
|
| 294 | - $share_diagnostic_preferences = empty( $params['share-diagnostic'] ) ? 'no' : 'yes'; |
|
| 292 | + // Store the preferences in variable, because if the checkbox is not checked |
|
| 293 | + // the `share-diagnostic` will not exists in `$params` array. |
|
| 294 | + $share_diagnostic_preferences = empty( $params['share-diagnostic'] ) ? 'no' : 'yes'; |
|
| 295 | 295 | |
| 296 | - // Store the diagnostic preferences: |
|
| 297 | - $this->configuration_service->set_diagnostic_preferences( $share_diagnostic_preferences ); |
|
| 296 | + // Store the diagnostic preferences: |
|
| 297 | + $this->configuration_service->set_diagnostic_preferences( $share_diagnostic_preferences ); |
|
| 298 | 298 | |
| 299 | - // Set the type URI, either http://schema.org/Person or http://schema.org/Organization. |
|
| 300 | - $type_uri = sprintf( 'http://schema.org/%s', 'organization' === $params['user_type'] ? 'Organization' : 'Person' ); |
|
| 299 | + // Set the type URI, either http://schema.org/Person or http://schema.org/Organization. |
|
| 300 | + $type_uri = sprintf( 'http://schema.org/%s', 'organization' === $params['user_type'] ? 'Organization' : 'Person' ); |
|
| 301 | 301 | |
| 302 | - // Create an entity for the publisher. |
|
| 303 | - $publisher_post_id = $this->entity_service->create( $params['name'], $type_uri, $params['logo'], 'publish' ); |
|
| 302 | + // Create an entity for the publisher. |
|
| 303 | + $publisher_post_id = $this->entity_service->create( $params['name'], $type_uri, $params['logo'], 'publish' ); |
|
| 304 | 304 | |
| 305 | - // Store the publisher entity post id in the configuration. |
|
| 306 | - $this->configuration_service->set_publisher_id( $publisher_post_id ); |
|
| 305 | + // Store the publisher entity post id in the configuration. |
|
| 306 | + $this->configuration_service->set_publisher_id( $publisher_post_id ); |
|
| 307 | 307 | |
| 308 | - flush_rewrite_rules(); // Needed because of possible change to the entity base path. |
|
| 308 | + flush_rewrite_rules(); // Needed because of possible change to the entity base path. |
|
| 309 | 309 | |
| 310 | - } |
|
| 310 | + } |
|
| 311 | 311 | |
| 312 | 312 | } |
@@ -20,9 +20,9 @@ discard block |
||
| 20 | 20 | /** |
| 21 | 21 | * Config constructor. |
| 22 | 22 | * |
| 23 | - * @param $admin_setup \Wordlift_Admin_Setup |
|
| 24 | - * @param $key_validation_service \Wordlift_Key_Validation_Service |
|
| 25 | - * @param $configuration_service \Wordlift_Configuration_Service |
|
| 23 | + * @param \Wordlift_Admin_Setup $admin_setup \Wordlift_Admin_Setup |
|
| 24 | + * @param \Wordlift_Key_Validation_Service $key_validation_service \Wordlift_Key_Validation_Service |
|
| 25 | + * @param \Wordlift_Configuration_Service $configuration_service \Wordlift_Configuration_Service |
|
| 26 | 26 | */ |
| 27 | 27 | public function __construct( $admin_setup, $key_validation_service, $configuration_service ) { |
| 28 | 28 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | /** |
| 37 | 37 | * Check if the key is valid and also not bound to any domain. |
| 38 | 38 | * |
| 39 | - * @param $key string |
|
| 39 | + * @param string $key string |
|
| 40 | 40 | * |
| 41 | 41 | * @return bool |
| 42 | 42 | */ |
@@ -24,12 +24,12 @@ discard block |
||
| 24 | 24 | * @param $key_validation_service \Wordlift_Key_Validation_Service |
| 25 | 25 | * @param $configuration_service \Wordlift_Configuration_Service |
| 26 | 26 | */ |
| 27 | - public function __construct( $admin_setup, $key_validation_service, $configuration_service ) { |
|
| 27 | + public function __construct($admin_setup, $key_validation_service, $configuration_service) { |
|
| 28 | 28 | |
| 29 | 29 | $this->admin_setup = $admin_setup; |
| 30 | 30 | $this->key_validation_service = $key_validation_service; |
| 31 | 31 | $this->configuration_service = $configuration_service; |
| 32 | - add_action( 'wp_ajax_nopriv_wl_config_plugin', array( $this, 'config' ) ); |
|
| 32 | + add_action('wp_ajax_nopriv_wl_config_plugin', array($this, 'config')); |
|
| 33 | 33 | |
| 34 | 34 | } |
| 35 | 35 | |
@@ -40,36 +40,36 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @return bool |
| 42 | 42 | */ |
| 43 | - private function is_key_valid_and_not_bound_to_any_domain( $key ) { |
|
| 44 | - $account_info = $this->key_validation_service->get_account_info( $key ); |
|
| 43 | + private function is_key_valid_and_not_bound_to_any_domain($key) { |
|
| 44 | + $account_info = $this->key_validation_service->get_account_info($key); |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * we need to check if the key is not associated with any account |
| 48 | 48 | * before setting it, we should check if the url is null. |
| 49 | 49 | */ |
| 50 | - if ( is_wp_error( $account_info ) |
|
| 51 | - || wp_remote_retrieve_response_code( $account_info ) !== 200 ) { |
|
| 50 | + if (is_wp_error($account_info) |
|
| 51 | + || wp_remote_retrieve_response_code($account_info) !== 200) { |
|
| 52 | 52 | return false; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $account_info_json = $account_info['body']; |
| 56 | 56 | |
| 57 | - $account_info_data = json_decode( $account_info_json, true ); |
|
| 57 | + $account_info_data = json_decode($account_info_json, true); |
|
| 58 | 58 | |
| 59 | - if ( ! $account_info_data ) { |
|
| 59 | + if ( ! $account_info_data) { |
|
| 60 | 60 | // Invalid json returned by api. |
| 61 | 61 | return false; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - $site_url = apply_filters( 'wl_production_site_url', untrailingslashit( get_option( 'home' ) ) ); |
|
| 64 | + $site_url = apply_filters('wl_production_site_url', untrailingslashit(get_option('home'))); |
|
| 65 | 65 | |
| 66 | 66 | |
| 67 | - if ( $account_info_data['url'] === null) { |
|
| 67 | + if ($account_info_data['url'] === null) { |
|
| 68 | 68 | return true; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | // Check if the key belongs to same site. |
| 72 | - if ( $site_url !== untrailingslashit( $account_info_data['url'] ) ) { |
|
| 72 | + if ($site_url !== untrailingslashit($account_info_data['url'])) { |
|
| 73 | 73 | // key already associated with another account. |
| 74 | 74 | return false; |
| 75 | 75 | } |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | header('Access-Control-Allow-Origin: *'); |
| 95 | 95 | |
| 96 | 96 | // validate all the fields before processing |
| 97 | - foreach ( $required_fields as $field ) { |
|
| 98 | - if ( ! array_key_exists( $field, $_POST ) ) { |
|
| 99 | - wp_send_json_error( sprintf( __( 'Field %s is required', 'wordlift' ), $field ), 422 ); |
|
| 97 | + foreach ($required_fields as $field) { |
|
| 98 | + if ( ! array_key_exists($field, $_POST)) { |
|
| 99 | + wp_send_json_error(sprintf(__('Field %s is required', 'wordlift'), $field), 422); |
|
| 100 | 100 | |
| 101 | 101 | return; |
| 102 | 102 | } |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | $key = (string) $_POST['license']; |
| 106 | 106 | |
| 107 | - if ( ! $this->is_key_valid_and_not_bound_to_any_domain( $key ) ) { |
|
| 108 | - wp_send_json_error( __( 'Key is not valid or associated with other domain', 'wordlift' ), 403 ); |
|
| 107 | + if ( ! $this->is_key_valid_and_not_bound_to_any_domain($key)) { |
|
| 108 | + wp_send_json_error(__('Key is not valid or associated with other domain', 'wordlift'), 403); |
|
| 109 | 109 | |
| 110 | 110 | // exit if not valid. |
| 111 | 111 | return; |
@@ -113,17 +113,17 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | |
| 115 | 115 | // check if key is already configured, if yes then dont save settings. |
| 116 | - if ( $this->configuration_service->get_key() ) { |
|
| 117 | - wp_send_json_error( __( 'Key already configured.', 'wordlift' ), 403 ); |
|
| 116 | + if ($this->configuration_service->get_key()) { |
|
| 117 | + wp_send_json_error(__('Key already configured.', 'wordlift'), 403); |
|
| 118 | 118 | |
| 119 | 119 | // key already configured |
| 120 | 120 | return; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - $this->admin_setup->save_configuration( $this->get_params() ); |
|
| 123 | + $this->admin_setup->save_configuration($this->get_params()); |
|
| 124 | 124 | |
| 125 | 125 | |
| 126 | - wp_send_json_success( __( 'Configuration Saved', 'wordlift' ) ); |
|
| 126 | + wp_send_json_success(__('Configuration Saved', 'wordlift')); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | 'logo' => $attachment_id |
| 145 | 145 | ); |
| 146 | 146 | |
| 147 | - if ( (bool) $_POST['diagnostic'] ) { |
|
| 147 | + if ((bool) $_POST['diagnostic']) { |
|
| 148 | 148 | $params['share-diagnostic'] = 'on'; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -157,35 +157,35 @@ discard block |
||
| 157 | 157 | private function may_be_get_attachment_id() { |
| 158 | 158 | |
| 159 | 159 | // if image or image extension not posted then return false. |
| 160 | - if ( ! isset( $_POST['image'] ) || ! isset( $_POST['imageExtension'] ) ) { |
|
| 160 | + if ( ! isset($_POST['image']) || ! isset($_POST['imageExtension'])) { |
|
| 161 | 161 | return false; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - $allowed_extensions = array( 'png', 'jpeg', 'jpg' ); |
|
| 164 | + $allowed_extensions = array('png', 'jpeg', 'jpg'); |
|
| 165 | 165 | $image_string = (string) $_POST['image']; |
| 166 | 166 | $image_ext = (string) $_POST['imageExtension']; |
| 167 | 167 | |
| 168 | - if ( ! in_array( $image_ext, $allowed_extensions ) ) { |
|
| 168 | + if ( ! in_array($image_ext, $allowed_extensions)) { |
|
| 169 | 169 | return false; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - $image_decoded_string = base64_decode( $image_string ); |
|
| 172 | + $image_decoded_string = base64_decode($image_string); |
|
| 173 | 173 | |
| 174 | 174 | $upload_dir = wp_upload_dir(); |
| 175 | 175 | |
| 176 | - $file_path = $upload_dir['path'] . DIRECTORY_SEPARATOR . md5( $image_string ) . "." . $image_ext; |
|
| 176 | + $file_path = $upload_dir['path'].DIRECTORY_SEPARATOR.md5($image_string).".".$image_ext; |
|
| 177 | 177 | |
| 178 | - file_put_contents( $file_path, $image_decoded_string ); |
|
| 178 | + file_put_contents($file_path, $image_decoded_string); |
|
| 179 | 179 | |
| 180 | - $attachment_id = wp_insert_attachment( array( |
|
| 180 | + $attachment_id = wp_insert_attachment(array( |
|
| 181 | 181 | 'post_status' => 'inherit', |
| 182 | 182 | 'post_mime_type' => "image/$image_ext" |
| 183 | - ), $file_path ); |
|
| 183 | + ), $file_path); |
|
| 184 | 184 | |
| 185 | 185 | // Generate the metadata for the attachment, and update the database record. |
| 186 | - $attachment_data = wp_generate_attachment_metadata( $attachment_id, $file_path ); |
|
| 186 | + $attachment_data = wp_generate_attachment_metadata($attachment_id, $file_path); |
|
| 187 | 187 | // Update the attachment metadata. |
| 188 | - wp_update_attachment_metadata( $attachment_id, $attachment_data ); |
|
| 188 | + wp_update_attachment_metadata($attachment_id, $attachment_data); |
|
| 189 | 189 | |
| 190 | 190 | return $attachment_id; |
| 191 | 191 | } |
@@ -4,191 +4,191 @@ |
||
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | class Config { |
| 7 | - /** |
|
| 8 | - * @var \Wordlift_Admin_Setup |
|
| 9 | - */ |
|
| 10 | - private $admin_setup; |
|
| 11 | - /** |
|
| 12 | - * @var \Wordlift_Key_Validation_Service |
|
| 13 | - */ |
|
| 14 | - private $key_validation_service; |
|
| 15 | - /** |
|
| 16 | - * @var \Wordlift_Configuration_Service |
|
| 17 | - */ |
|
| 18 | - private $configuration_service; |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * Config constructor. |
|
| 22 | - * |
|
| 23 | - * @param $admin_setup \Wordlift_Admin_Setup |
|
| 24 | - * @param $key_validation_service \Wordlift_Key_Validation_Service |
|
| 25 | - * @param $configuration_service \Wordlift_Configuration_Service |
|
| 26 | - */ |
|
| 27 | - public function __construct( $admin_setup, $key_validation_service, $configuration_service ) { |
|
| 28 | - |
|
| 29 | - $this->admin_setup = $admin_setup; |
|
| 30 | - $this->key_validation_service = $key_validation_service; |
|
| 31 | - $this->configuration_service = $configuration_service; |
|
| 32 | - add_action( 'wp_ajax_nopriv_wl_config_plugin', array( $this, 'config' ) ); |
|
| 33 | - |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * Check if the key is valid and also not bound to any domain. |
|
| 38 | - * |
|
| 39 | - * @param $key string |
|
| 40 | - * |
|
| 41 | - * @return bool |
|
| 42 | - */ |
|
| 43 | - private function is_key_valid_and_not_bound_to_any_domain( $key ) { |
|
| 44 | - $account_info = $this->key_validation_service->get_account_info( $key ); |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * we need to check if the key is not associated with any account |
|
| 48 | - * before setting it, we should check if the url is null. |
|
| 49 | - */ |
|
| 50 | - if ( is_wp_error( $account_info ) |
|
| 51 | - || wp_remote_retrieve_response_code( $account_info ) !== 200 ) { |
|
| 52 | - return false; |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - $account_info_json = $account_info['body']; |
|
| 56 | - |
|
| 57 | - $account_info_data = json_decode( $account_info_json, true ); |
|
| 58 | - |
|
| 59 | - if ( ! $account_info_data ) { |
|
| 60 | - // Invalid json returned by api. |
|
| 61 | - return false; |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - $site_url = apply_filters( 'wl_production_site_url', untrailingslashit( get_option( 'home' ) ) ); |
|
| 65 | - |
|
| 66 | - |
|
| 67 | - if ( $account_info_data['url'] === null) { |
|
| 68 | - return true; |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - // Check if the key belongs to same site. |
|
| 72 | - if ( $site_url !== untrailingslashit( $account_info_data['url'] ) ) { |
|
| 73 | - // key already associated with another account. |
|
| 74 | - return false; |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - // Return true if the key domain and site domain are the same. |
|
| 78 | - return true; |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - |
|
| 82 | - public function config() { |
|
| 83 | - |
|
| 84 | - // Perform validation check for all the parameters. |
|
| 85 | - $required_fields = array( |
|
| 86 | - 'diagnostic', |
|
| 87 | - 'vocabulary', |
|
| 88 | - 'language', |
|
| 89 | - 'country', |
|
| 90 | - 'publisherName', |
|
| 91 | - 'publisher', |
|
| 92 | - 'license' |
|
| 93 | - ); |
|
| 94 | - |
|
| 95 | - header('Access-Control-Allow-Origin: *'); |
|
| 96 | - |
|
| 97 | - // validate all the fields before processing |
|
| 98 | - foreach ( $required_fields as $field ) { |
|
| 99 | - if ( ! array_key_exists( $field, $_POST ) ) { |
|
| 100 | - wp_send_json_error( sprintf( __( 'Field %s is required', 'wordlift' ), $field ), 422 ); |
|
| 101 | - |
|
| 102 | - return; |
|
| 103 | - } |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - $key = (string) $_POST['license']; |
|
| 107 | - |
|
| 108 | - if ( ! $this->is_key_valid_and_not_bound_to_any_domain( $key ) ) { |
|
| 109 | - wp_send_json_error( __( 'Key is not valid or associated with other domain', 'wordlift' ), 403 ); |
|
| 110 | - |
|
| 111 | - // exit if not valid. |
|
| 112 | - return; |
|
| 113 | - } |
|
| 7 | + /** |
|
| 8 | + * @var \Wordlift_Admin_Setup |
|
| 9 | + */ |
|
| 10 | + private $admin_setup; |
|
| 11 | + /** |
|
| 12 | + * @var \Wordlift_Key_Validation_Service |
|
| 13 | + */ |
|
| 14 | + private $key_validation_service; |
|
| 15 | + /** |
|
| 16 | + * @var \Wordlift_Configuration_Service |
|
| 17 | + */ |
|
| 18 | + private $configuration_service; |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * Config constructor. |
|
| 22 | + * |
|
| 23 | + * @param $admin_setup \Wordlift_Admin_Setup |
|
| 24 | + * @param $key_validation_service \Wordlift_Key_Validation_Service |
|
| 25 | + * @param $configuration_service \Wordlift_Configuration_Service |
|
| 26 | + */ |
|
| 27 | + public function __construct( $admin_setup, $key_validation_service, $configuration_service ) { |
|
| 28 | + |
|
| 29 | + $this->admin_setup = $admin_setup; |
|
| 30 | + $this->key_validation_service = $key_validation_service; |
|
| 31 | + $this->configuration_service = $configuration_service; |
|
| 32 | + add_action( 'wp_ajax_nopriv_wl_config_plugin', array( $this, 'config' ) ); |
|
| 33 | + |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * Check if the key is valid and also not bound to any domain. |
|
| 38 | + * |
|
| 39 | + * @param $key string |
|
| 40 | + * |
|
| 41 | + * @return bool |
|
| 42 | + */ |
|
| 43 | + private function is_key_valid_and_not_bound_to_any_domain( $key ) { |
|
| 44 | + $account_info = $this->key_validation_service->get_account_info( $key ); |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * we need to check if the key is not associated with any account |
|
| 48 | + * before setting it, we should check if the url is null. |
|
| 49 | + */ |
|
| 50 | + if ( is_wp_error( $account_info ) |
|
| 51 | + || wp_remote_retrieve_response_code( $account_info ) !== 200 ) { |
|
| 52 | + return false; |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + $account_info_json = $account_info['body']; |
|
| 56 | + |
|
| 57 | + $account_info_data = json_decode( $account_info_json, true ); |
|
| 58 | + |
|
| 59 | + if ( ! $account_info_data ) { |
|
| 60 | + // Invalid json returned by api. |
|
| 61 | + return false; |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + $site_url = apply_filters( 'wl_production_site_url', untrailingslashit( get_option( 'home' ) ) ); |
|
| 65 | + |
|
| 66 | + |
|
| 67 | + if ( $account_info_data['url'] === null) { |
|
| 68 | + return true; |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + // Check if the key belongs to same site. |
|
| 72 | + if ( $site_url !== untrailingslashit( $account_info_data['url'] ) ) { |
|
| 73 | + // key already associated with another account. |
|
| 74 | + return false; |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + // Return true if the key domain and site domain are the same. |
|
| 78 | + return true; |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + |
|
| 82 | + public function config() { |
|
| 83 | + |
|
| 84 | + // Perform validation check for all the parameters. |
|
| 85 | + $required_fields = array( |
|
| 86 | + 'diagnostic', |
|
| 87 | + 'vocabulary', |
|
| 88 | + 'language', |
|
| 89 | + 'country', |
|
| 90 | + 'publisherName', |
|
| 91 | + 'publisher', |
|
| 92 | + 'license' |
|
| 93 | + ); |
|
| 94 | + |
|
| 95 | + header('Access-Control-Allow-Origin: *'); |
|
| 96 | + |
|
| 97 | + // validate all the fields before processing |
|
| 98 | + foreach ( $required_fields as $field ) { |
|
| 99 | + if ( ! array_key_exists( $field, $_POST ) ) { |
|
| 100 | + wp_send_json_error( sprintf( __( 'Field %s is required', 'wordlift' ), $field ), 422 ); |
|
| 101 | + |
|
| 102 | + return; |
|
| 103 | + } |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + $key = (string) $_POST['license']; |
|
| 107 | + |
|
| 108 | + if ( ! $this->is_key_valid_and_not_bound_to_any_domain( $key ) ) { |
|
| 109 | + wp_send_json_error( __( 'Key is not valid or associated with other domain', 'wordlift' ), 403 ); |
|
| 110 | + |
|
| 111 | + // exit if not valid. |
|
| 112 | + return; |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | 115 | |
| 116 | - // check if key is already configured, if yes then dont save settings. |
|
| 117 | - if ( $this->configuration_service->get_key() ) { |
|
| 118 | - wp_send_json_error( __( 'Key already configured.', 'wordlift' ), 403 ); |
|
| 116 | + // check if key is already configured, if yes then dont save settings. |
|
| 117 | + if ( $this->configuration_service->get_key() ) { |
|
| 118 | + wp_send_json_error( __( 'Key already configured.', 'wordlift' ), 403 ); |
|
| 119 | 119 | |
| 120 | - // key already configured |
|
| 121 | - return; |
|
| 122 | - } |
|
| 120 | + // key already configured |
|
| 121 | + return; |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - $this->admin_setup->save_configuration( $this->get_params() ); |
|
| 124 | + $this->admin_setup->save_configuration( $this->get_params() ); |
|
| 125 | 125 | |
| 126 | 126 | |
| 127 | - wp_send_json_success( __( 'Configuration Saved', 'wordlift' ) ); |
|
| 128 | - } |
|
| 127 | + wp_send_json_success( __( 'Configuration Saved', 'wordlift' ) ); |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - /** |
|
| 131 | - * |
|
| 132 | - * @return array |
|
| 133 | - */ |
|
| 134 | - private function get_params() { |
|
| 130 | + /** |
|
| 131 | + * |
|
| 132 | + * @return array |
|
| 133 | + */ |
|
| 134 | + private function get_params() { |
|
| 135 | 135 | |
| 136 | - $attachment_id = $this->may_be_get_attachment_id(); |
|
| 136 | + $attachment_id = $this->may_be_get_attachment_id(); |
|
| 137 | 137 | |
| 138 | - $params = array( |
|
| 139 | - 'key' => (string) $_POST['license'], |
|
| 140 | - 'vocabulary' => (string) $_POST['vocabulary'], |
|
| 141 | - 'wl-site-language' => (string) $_POST['language'], |
|
| 142 | - 'wl-country-code' => (string) $_POST['country'], |
|
| 143 | - 'name' => (string) $_POST['publisherName'], |
|
| 144 | - 'user_type' => (string) $_POST['publisher'], |
|
| 145 | - 'logo' => $attachment_id |
|
| 146 | - ); |
|
| 138 | + $params = array( |
|
| 139 | + 'key' => (string) $_POST['license'], |
|
| 140 | + 'vocabulary' => (string) $_POST['vocabulary'], |
|
| 141 | + 'wl-site-language' => (string) $_POST['language'], |
|
| 142 | + 'wl-country-code' => (string) $_POST['country'], |
|
| 143 | + 'name' => (string) $_POST['publisherName'], |
|
| 144 | + 'user_type' => (string) $_POST['publisher'], |
|
| 145 | + 'logo' => $attachment_id |
|
| 146 | + ); |
|
| 147 | 147 | |
| 148 | - if ( (bool) $_POST['diagnostic'] ) { |
|
| 149 | - $params['share-diagnostic'] = 'on'; |
|
| 150 | - } |
|
| 148 | + if ( (bool) $_POST['diagnostic'] ) { |
|
| 149 | + $params['share-diagnostic'] = 'on'; |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - return $params; |
|
| 153 | - } |
|
| 152 | + return $params; |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | - /** |
|
| 156 | - * @return int | bool |
|
| 157 | - */ |
|
| 158 | - private function may_be_get_attachment_id() { |
|
| 155 | + /** |
|
| 156 | + * @return int | bool |
|
| 157 | + */ |
|
| 158 | + private function may_be_get_attachment_id() { |
|
| 159 | 159 | |
| 160 | - // if image or image extension not posted then return false. |
|
| 161 | - if ( ! isset( $_POST['image'] ) || ! isset( $_POST['imageExtension'] ) ) { |
|
| 162 | - return false; |
|
| 163 | - } |
|
| 160 | + // if image or image extension not posted then return false. |
|
| 161 | + if ( ! isset( $_POST['image'] ) || ! isset( $_POST['imageExtension'] ) ) { |
|
| 162 | + return false; |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | - $allowed_extensions = array( 'png', 'jpeg', 'jpg' ); |
|
| 166 | - $image_string = (string) $_POST['image']; |
|
| 167 | - $image_ext = (string) $_POST['imageExtension']; |
|
| 165 | + $allowed_extensions = array( 'png', 'jpeg', 'jpg' ); |
|
| 166 | + $image_string = (string) $_POST['image']; |
|
| 167 | + $image_ext = (string) $_POST['imageExtension']; |
|
| 168 | 168 | |
| 169 | - if ( ! in_array( $image_ext, $allowed_extensions ) ) { |
|
| 170 | - return false; |
|
| 171 | - } |
|
| 169 | + if ( ! in_array( $image_ext, $allowed_extensions ) ) { |
|
| 170 | + return false; |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | - $image_decoded_string = base64_decode( $image_string ); |
|
| 173 | + $image_decoded_string = base64_decode( $image_string ); |
|
| 174 | 174 | |
| 175 | - $upload_dir = wp_upload_dir(); |
|
| 175 | + $upload_dir = wp_upload_dir(); |
|
| 176 | 176 | |
| 177 | - $file_path = $upload_dir['path'] . DIRECTORY_SEPARATOR . md5( $image_string ) . "." . $image_ext; |
|
| 177 | + $file_path = $upload_dir['path'] . DIRECTORY_SEPARATOR . md5( $image_string ) . "." . $image_ext; |
|
| 178 | 178 | |
| 179 | - file_put_contents( $file_path, $image_decoded_string ); |
|
| 179 | + file_put_contents( $file_path, $image_decoded_string ); |
|
| 180 | 180 | |
| 181 | - $attachment_id = wp_insert_attachment( array( |
|
| 182 | - 'post_status' => 'inherit', |
|
| 183 | - 'post_mime_type' => "image/$image_ext" |
|
| 184 | - ), $file_path ); |
|
| 181 | + $attachment_id = wp_insert_attachment( array( |
|
| 182 | + 'post_status' => 'inherit', |
|
| 183 | + 'post_mime_type' => "image/$image_ext" |
|
| 184 | + ), $file_path ); |
|
| 185 | 185 | |
| 186 | - // Generate the metadata for the attachment, and update the database record. |
|
| 187 | - $attachment_data = wp_generate_attachment_metadata( $attachment_id, $file_path ); |
|
| 188 | - // Update the attachment metadata. |
|
| 189 | - wp_update_attachment_metadata( $attachment_id, $attachment_data ); |
|
| 186 | + // Generate the metadata for the attachment, and update the database record. |
|
| 187 | + $attachment_data = wp_generate_attachment_metadata( $attachment_id, $file_path ); |
|
| 188 | + // Update the attachment metadata. |
|
| 189 | + wp_update_attachment_metadata( $attachment_id, $attachment_data ); |
|
| 190 | 190 | |
| 191 | - return $attachment_id; |
|
| 192 | - } |
|
| 191 | + return $attachment_id; |
|
| 192 | + } |
|
| 193 | 193 | |
| 194 | 194 | } |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | $this->define_public_hooks(); |
| 775 | 775 | |
| 776 | 776 | // If we're in `WP_CLI` load the related files. |
| 777 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 777 | + if (class_exists('WP_CLI')) { |
|
| 778 | 778 | $this->load_cli_dependencies(); |
| 779 | 779 | } |
| 780 | 780 | |
@@ -815,381 +815,381 @@ discard block |
||
| 815 | 815 | * The class responsible for orchestrating the actions and filters of the |
| 816 | 816 | * core plugin. |
| 817 | 817 | */ |
| 818 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 818 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php'; |
|
| 819 | 819 | |
| 820 | 820 | // The class responsible for plugin uninstall. |
| 821 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 821 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-deactivator-feedback.php'; |
|
| 822 | 822 | |
| 823 | 823 | /** |
| 824 | 824 | * The class responsible for defining internationalization functionality |
| 825 | 825 | * of the plugin. |
| 826 | 826 | */ |
| 827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 827 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php'; |
|
| 828 | 828 | |
| 829 | 829 | /** |
| 830 | 830 | * WordLift's supported languages. |
| 831 | 831 | */ |
| 832 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 832 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php'; |
|
| 833 | 833 | |
| 834 | 834 | /** |
| 835 | 835 | * WordLift's supported countries. |
| 836 | 836 | */ |
| 837 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 837 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-countries.php'; |
|
| 838 | 838 | |
| 839 | 839 | /** |
| 840 | 840 | * Provide support functions to sanitize data. |
| 841 | 841 | */ |
| 842 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 842 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php'; |
|
| 843 | 843 | |
| 844 | 844 | /** Services. */ |
| 845 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 846 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 847 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 848 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 849 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 850 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 851 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 852 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 853 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 854 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 845 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php'; |
|
| 846 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-http-api.php'; |
|
| 847 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php'; |
|
| 848 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php'; |
|
| 849 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php'; |
|
| 850 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php'; |
|
| 851 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php'; |
|
| 852 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-linked-data-service.php'; |
|
| 853 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-service.php'; |
|
| 854 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-image-service.php'; |
|
| 855 | 855 | |
| 856 | 856 | /** |
| 857 | 857 | * The Query builder. |
| 858 | 858 | */ |
| 859 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 859 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php'; |
|
| 860 | 860 | |
| 861 | 861 | /** |
| 862 | 862 | * The Schema service. |
| 863 | 863 | */ |
| 864 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 864 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php'; |
|
| 865 | 865 | |
| 866 | 866 | /** |
| 867 | 867 | * The schema:url property service. |
| 868 | 868 | */ |
| 869 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 870 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 869 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php'; |
|
| 870 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php'; |
|
| 871 | 871 | |
| 872 | 872 | /** |
| 873 | 873 | * The UI service. |
| 874 | 874 | */ |
| 875 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 875 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php'; |
|
| 876 | 876 | |
| 877 | 877 | /** |
| 878 | 878 | * The Thumbnail service. |
| 879 | 879 | */ |
| 880 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 880 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php'; |
|
| 881 | 881 | |
| 882 | 882 | /** |
| 883 | 883 | * The Entity Types Taxonomy service. |
| 884 | 884 | */ |
| 885 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 885 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 886 | 886 | |
| 887 | 887 | /** |
| 888 | 888 | * The Entity service. |
| 889 | 889 | */ |
| 890 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 891 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 890 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-uri-service.php'; |
|
| 891 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php'; |
|
| 892 | 892 | |
| 893 | 893 | // Add the entity rating service. |
| 894 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 894 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php'; |
|
| 895 | 895 | |
| 896 | 896 | /** |
| 897 | 897 | * The User service. |
| 898 | 898 | */ |
| 899 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 899 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php'; |
|
| 900 | 900 | |
| 901 | 901 | /** |
| 902 | 902 | * The Timeline service. |
| 903 | 903 | */ |
| 904 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 904 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php'; |
|
| 905 | 905 | |
| 906 | 906 | /** |
| 907 | 907 | * The Topic Taxonomy service. |
| 908 | 908 | */ |
| 909 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 909 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 910 | 910 | |
| 911 | 911 | /** |
| 912 | 912 | * The SPARQL service. |
| 913 | 913 | */ |
| 914 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 914 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sparql-service.php'; |
|
| 915 | 915 | |
| 916 | 916 | /** |
| 917 | 917 | * The WordLift import service. |
| 918 | 918 | */ |
| 919 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 919 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-import-service.php'; |
|
| 920 | 920 | |
| 921 | 921 | /** |
| 922 | 922 | * The WordLift URI service. |
| 923 | 923 | */ |
| 924 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 925 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 926 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 924 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php'; |
|
| 925 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php'; |
|
| 926 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-service.php'; |
|
| 927 | 927 | |
| 928 | 928 | /** |
| 929 | 929 | * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
| 930 | 930 | */ |
| 931 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 932 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 933 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 934 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 935 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 931 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-listable.php'; |
|
| 932 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 933 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 934 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 935 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 936 | 936 | |
| 937 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 938 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 937 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 938 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php'; |
|
| 939 | 939 | |
| 940 | 940 | /** |
| 941 | 941 | * Load the converters. |
| 942 | 942 | */ |
| 943 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 944 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 945 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 946 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 947 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 948 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 943 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php'; |
|
| 944 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 945 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 946 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 947 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 948 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 949 | 949 | |
| 950 | 950 | /** |
| 951 | 951 | * Load cache-related files. |
| 952 | 952 | */ |
| 953 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 953 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/cache/require.php'; |
|
| 954 | 954 | |
| 955 | 955 | /** |
| 956 | 956 | * Load the content filter. |
| 957 | 957 | */ |
| 958 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 958 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php'; |
|
| 959 | 959 | |
| 960 | 960 | /* |
| 961 | 961 | * Load the excerpt helper. |
| 962 | 962 | */ |
| 963 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 963 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 964 | 964 | |
| 965 | 965 | /** |
| 966 | 966 | * Load the JSON-LD service to publish entities using JSON-LD.s |
| 967 | 967 | * |
| 968 | 968 | * @since 3.8.0 |
| 969 | 969 | */ |
| 970 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 970 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php'; |
|
| 971 | 971 | |
| 972 | 972 | // The Publisher Service and the AJAX adapter. |
| 973 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 974 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 973 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php'; |
|
| 974 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 975 | 975 | |
| 976 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 976 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-adapter.php'; |
|
| 977 | 977 | |
| 978 | 978 | /** |
| 979 | 979 | * Load the WordLift key validation service. |
| 980 | 980 | */ |
| 981 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 981 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php'; |
|
| 982 | 982 | |
| 983 | 983 | // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
| 984 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 984 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 985 | 985 | |
| 986 | 986 | // Load the `Wordlift_Entity_Page_Service` class definition. |
| 987 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 987 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-page-service.php'; |
|
| 988 | 988 | |
| 989 | 989 | /** Linked Data. */ |
| 990 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 991 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 992 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 993 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 994 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 996 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 997 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 999 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 1000 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 990 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 991 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 992 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 993 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 994 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 995 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 996 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 997 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 998 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 999 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 1000 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 1001 | 1001 | |
| 1002 | 1002 | /** Linked Data Rendition. */ |
| 1003 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 1004 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 1005 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 1006 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 1003 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 1004 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 1005 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 1006 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 1007 | 1007 | |
| 1008 | 1008 | /** Services. */ |
| 1009 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 1010 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 1009 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 1010 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-api-service.php'; |
|
| 1011 | 1011 | |
| 1012 | 1012 | /** Adapters. */ |
| 1013 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 1014 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 1015 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 1016 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 1017 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 1013 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php'; |
|
| 1014 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php'; |
|
| 1015 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 1016 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-adapter.php'; |
|
| 1017 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-wprocket-adapter.php'; |
|
| 1018 | 1018 | |
| 1019 | 1019 | /** Async Tasks. */ |
| 1020 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 1021 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1022 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1020 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 1021 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1022 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1023 | 1023 | |
| 1024 | 1024 | /** Autocomplete. */ |
| 1025 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1025 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1026 | 1026 | |
| 1027 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1027 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-remote-image-service.php'; |
|
| 1028 | 1028 | |
| 1029 | 1029 | /** Analytics */ |
| 1030 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1030 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1031 | 1031 | |
| 1032 | 1032 | /** |
| 1033 | 1033 | * The class responsible for defining all actions that occur in the admin area. |
| 1034 | 1034 | */ |
| 1035 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1035 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php'; |
|
| 1036 | 1036 | |
| 1037 | 1037 | /** |
| 1038 | 1038 | * The class to customize the entity list admin page. |
| 1039 | 1039 | */ |
| 1040 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1040 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php'; |
|
| 1041 | 1041 | |
| 1042 | 1042 | /** |
| 1043 | 1043 | * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
| 1044 | 1044 | */ |
| 1045 | 1045 | global $wp_version; |
| 1046 | - if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 1047 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1046 | + if (version_compare($wp_version, '5.3', '<')) { |
|
| 1047 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1048 | 1048 | } else { |
| 1049 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1049 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1050 | 1050 | } |
| 1051 | 1051 | |
| 1052 | 1052 | /** |
| 1053 | 1053 | * The Notice service. |
| 1054 | 1054 | */ |
| 1055 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1055 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php'; |
|
| 1056 | 1056 | |
| 1057 | 1057 | /** |
| 1058 | 1058 | * The PrimaShop adapter. |
| 1059 | 1059 | */ |
| 1060 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1060 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php'; |
|
| 1061 | 1061 | |
| 1062 | 1062 | /** |
| 1063 | 1063 | * The WordLift Dashboard service. |
| 1064 | 1064 | */ |
| 1065 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1065 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php'; |
|
| 1066 | 1066 | |
| 1067 | 1067 | /** |
| 1068 | 1068 | * The admin 'Install wizard' page. |
| 1069 | 1069 | */ |
| 1070 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1070 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php'; |
|
| 1071 | 1071 | |
| 1072 | 1072 | /** |
| 1073 | 1073 | * The WordLift entity type list admin page controller. |
| 1074 | 1074 | */ |
| 1075 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1075 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1076 | 1076 | |
| 1077 | 1077 | /** |
| 1078 | 1078 | * The WordLift entity type settings admin page controller. |
| 1079 | 1079 | */ |
| 1080 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1080 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php'; |
|
| 1081 | 1081 | |
| 1082 | 1082 | /** |
| 1083 | 1083 | * The admin 'Download Your Data' page. |
| 1084 | 1084 | */ |
| 1085 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1085 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php'; |
|
| 1086 | 1086 | |
| 1087 | 1087 | /** |
| 1088 | 1088 | * The admin 'WordLift Settings' page. |
| 1089 | 1089 | */ |
| 1090 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1091 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1092 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1093 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1094 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1095 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1096 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1097 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1098 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1099 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1100 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1101 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1102 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1103 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1104 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1090 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1091 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1092 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1093 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1094 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1095 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1096 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1097 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1098 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1099 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1100 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php'; |
|
| 1101 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php'; |
|
| 1102 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1103 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1104 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1105 | 1105 | |
| 1106 | 1106 | /** Admin Pages */ |
| 1107 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1108 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1109 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1110 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1107 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1108 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-status-page.php'; |
|
| 1109 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1110 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1111 | 1111 | |
| 1112 | 1112 | /** |
| 1113 | 1113 | * The class responsible for defining all actions that occur in the public-facing |
| 1114 | 1114 | * side of the site. |
| 1115 | 1115 | */ |
| 1116 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1116 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php'; |
|
| 1117 | 1117 | |
| 1118 | 1118 | /** |
| 1119 | 1119 | * The shortcode abstract class. |
| 1120 | 1120 | */ |
| 1121 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1121 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php'; |
|
| 1122 | 1122 | |
| 1123 | 1123 | /** |
| 1124 | 1124 | * The Timeline shortcode. |
| 1125 | 1125 | */ |
| 1126 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1126 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php'; |
|
| 1127 | 1127 | |
| 1128 | 1128 | /** |
| 1129 | 1129 | * The Navigator shortcode. |
| 1130 | 1130 | */ |
| 1131 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1131 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php'; |
|
| 1132 | 1132 | |
| 1133 | 1133 | /** |
| 1134 | 1134 | * The Products Navigator shortcode. |
| 1135 | 1135 | */ |
| 1136 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 1136 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 1137 | 1137 | |
| 1138 | 1138 | /** |
| 1139 | 1139 | * The chord shortcode. |
| 1140 | 1140 | */ |
| 1141 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1141 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php'; |
|
| 1142 | 1142 | |
| 1143 | 1143 | /** |
| 1144 | 1144 | * The geomap shortcode. |
| 1145 | 1145 | */ |
| 1146 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1146 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php'; |
|
| 1147 | 1147 | |
| 1148 | 1148 | /** |
| 1149 | 1149 | * The entity cloud shortcode. |
| 1150 | 1150 | */ |
| 1151 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1151 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1152 | 1152 | |
| 1153 | 1153 | /** |
| 1154 | 1154 | * The entity glossary shortcode. |
| 1155 | 1155 | */ |
| 1156 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1157 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1156 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-alphabet-service.php'; |
|
| 1157 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1158 | 1158 | |
| 1159 | 1159 | /** |
| 1160 | 1160 | * Faceted Search shortcode. |
| 1161 | 1161 | */ |
| 1162 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1162 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1163 | 1163 | |
| 1164 | 1164 | /** |
| 1165 | 1165 | * The ShareThis service. |
| 1166 | 1166 | */ |
| 1167 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1167 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php'; |
|
| 1168 | 1168 | |
| 1169 | 1169 | /** |
| 1170 | 1170 | * The SEO service. |
| 1171 | 1171 | */ |
| 1172 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1172 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php'; |
|
| 1173 | 1173 | |
| 1174 | 1174 | /** |
| 1175 | 1175 | * The AMP service. |
| 1176 | 1176 | */ |
| 1177 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1177 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php'; |
|
| 1178 | 1178 | |
| 1179 | 1179 | /** Widgets */ |
| 1180 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1181 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1182 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1180 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php'; |
|
| 1181 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1182 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-context-cards.php'; |
|
| 1183 | 1183 | |
| 1184 | 1184 | /* |
| 1185 | 1185 | * Schema.org Services. |
| 1186 | 1186 | * |
| 1187 | 1187 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1188 | 1188 | */ |
| 1189 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1190 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1191 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1192 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1189 | + if (WL_ALL_ENTITY_TYPES) { |
|
| 1190 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1191 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1192 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1193 | 1193 | new Wordlift_Schemaorg_Sync_Service(); |
| 1194 | 1194 | $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
| 1195 | 1195 | new Wordlift_Schemaorg_Class_Service(); |
@@ -1205,25 +1205,25 @@ discard block |
||
| 1205 | 1205 | |
| 1206 | 1206 | // Instantiate a global logger. |
| 1207 | 1207 | global $wl_logger; |
| 1208 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1208 | + $wl_logger = Wordlift_Log_Service::get_logger('WordLift'); |
|
| 1209 | 1209 | |
| 1210 | 1210 | // Load the `wl-api` end-point. |
| 1211 | 1211 | new Wordlift_Http_Api(); |
| 1212 | 1212 | |
| 1213 | 1213 | // Load the Install Service. |
| 1214 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1214 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-service.php'; |
|
| 1215 | 1215 | $this->install_service = new Wordlift_Install_Service(); |
| 1216 | 1216 | |
| 1217 | 1217 | /** Services. */ |
| 1218 | 1218 | // Create the configuration service. |
| 1219 | 1219 | $this->configuration_service = new Wordlift_Configuration_Service(); |
| 1220 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1220 | + $api_service = new Wordlift_Api_Service($this->configuration_service); |
|
| 1221 | 1221 | |
| 1222 | 1222 | // Create an entity type service instance. It'll be later bound to the init action. |
| 1223 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1223 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path()); |
|
| 1224 | 1224 | |
| 1225 | 1225 | // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
| 1226 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1226 | + $this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_post_type_service, $this->configuration_service->get_entity_base_path()); |
|
| 1227 | 1227 | |
| 1228 | 1228 | // Create an instance of the UI service. |
| 1229 | 1229 | $this->ui_service = new Wordlift_UI_Service(); |
@@ -1232,30 +1232,30 @@ discard block |
||
| 1232 | 1232 | $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
| 1233 | 1233 | |
| 1234 | 1234 | $this->sparql_service = new Wordlift_Sparql_Service(); |
| 1235 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1235 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service($this->sparql_service); |
|
| 1236 | 1236 | $this->notice_service = new Wordlift_Notice_Service(); |
| 1237 | 1237 | $this->relation_service = new Wordlift_Relation_Service(); |
| 1238 | 1238 | |
| 1239 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1240 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1241 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1242 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1239 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'entity_uri/'); |
|
| 1240 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service($this->configuration_service, $entity_uri_cache_service); |
|
| 1241 | + $this->entity_service = new Wordlift_Entity_Service($this->ui_service, $this->relation_service, $this->entity_uri_service); |
|
| 1242 | + $this->user_service = new Wordlift_User_Service($this->sparql_service, $this->entity_service); |
|
| 1243 | 1243 | |
| 1244 | 1244 | // Instantiate the JSON-LD service. |
| 1245 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1245 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
| 1246 | 1246 | |
| 1247 | 1247 | /** Linked Data. */ |
| 1248 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1249 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1248 | + $this->storage_factory = new Wordlift_Storage_Factory($this->entity_service, $this->user_service, $property_getter); |
|
| 1249 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory($this->entity_service); |
|
| 1250 | 1250 | |
| 1251 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1251 | + $this->schema_service = new Wordlift_Schema_Service($this->storage_factory, $this->rendition_factory, $this->configuration_service); |
|
| 1252 | 1252 | |
| 1253 | 1253 | // Create a new instance of the Redirect service. |
| 1254 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1255 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1254 | + $this->redirect_service = new Wordlift_Redirect_Service($this->entity_uri_service); |
|
| 1255 | + $this->entity_type_service = new Wordlift_Entity_Type_Service($this->schema_service); |
|
| 1256 | 1256 | |
| 1257 | 1257 | // Create a new instance of the Timeline service and Timeline shortcode. |
| 1258 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1258 | + $this->timeline_service = new Wordlift_Timeline_Service($this->entity_service, $this->entity_type_service); |
|
| 1259 | 1259 | |
| 1260 | 1260 | $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
| 1261 | 1261 | |
@@ -1269,36 +1269,36 @@ discard block |
||
| 1269 | 1269 | $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
| 1270 | 1270 | |
| 1271 | 1271 | // Create an import service instance to hook later to WP's import function. |
| 1272 | - $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() ); |
|
| 1272 | + $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()); |
|
| 1273 | 1273 | |
| 1274 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1274 | + $uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']); |
|
| 1275 | 1275 | |
| 1276 | 1276 | // Create the entity rating service. |
| 1277 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1277 | + $this->rating_service = new Wordlift_Rating_Service($this->entity_service, $this->entity_type_service, $this->notice_service); |
|
| 1278 | 1278 | |
| 1279 | 1279 | // Create entity list customization (wp-admin/edit.php). |
| 1280 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1280 | + $this->entity_list_service = new Wordlift_Entity_List_Service($this->rating_service); |
|
| 1281 | 1281 | |
| 1282 | 1282 | // Create a new instance of the Redirect service. |
| 1283 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1283 | + $this->dashboard_service = new Wordlift_Dashboard_Service($this->rating_service, $this->entity_service); |
|
| 1284 | 1284 | |
| 1285 | 1285 | // Create an instance of the Publisher Service and the AJAX Adapter. |
| 1286 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1287 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1288 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1286 | + $this->publisher_service = new Wordlift_Publisher_Service($this->configuration_service); |
|
| 1287 | + $this->property_factory = new Wordlift_Property_Factory($schema_url_property_service); |
|
| 1288 | + $this->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service); |
|
| 1289 | 1289 | |
| 1290 | 1290 | $attachment_service = new Wordlift_Attachment_Service(); |
| 1291 | 1291 | |
| 1292 | 1292 | // Instantiate the JSON-LD service. |
| 1293 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1294 | - $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 ); |
|
| 1295 | - $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $this->post_to_jsonld_converter ); |
|
| 1296 | - $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 ); |
|
| 1297 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1293 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
| 1294 | + $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); |
|
| 1295 | + $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $this->post_to_jsonld_converter); |
|
| 1296 | + $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); |
|
| 1297 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service); |
|
| 1298 | 1298 | |
| 1299 | - $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1300 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache ); |
|
| 1301 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1299 | + $jsonld_cache = new Ttl_Cache('jsonld', 86400); |
|
| 1300 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter($this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache); |
|
| 1301 | + $this->jsonld_service = new Wordlift_Jsonld_Service($this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter); |
|
| 1302 | 1302 | |
| 1303 | 1303 | /* |
| 1304 | 1304 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
@@ -1307,30 +1307,30 @@ discard block |
||
| 1307 | 1307 | * |
| 1308 | 1308 | * @since 3.20.0 |
| 1309 | 1309 | */ |
| 1310 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1311 | - $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1310 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1311 | + $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter($this->entity_uri_service, $this->jsonld_service); |
|
| 1312 | 1312 | $jsonld_service = new Jsonld_Service( |
| 1313 | 1313 | $this->jsonld_service, |
| 1314 | 1314 | $term_jsonld_adapter, |
| 1315 | - new Jsonld_User_Service( $this->user_service ) ); |
|
| 1316 | - new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service ); |
|
| 1315 | + new Jsonld_User_Service($this->user_service) ); |
|
| 1316 | + new Jsonld_Endpoint($jsonld_service, $this->entity_uri_service); |
|
| 1317 | 1317 | |
| 1318 | 1318 | // Prints the JSON-LD in the head. |
| 1319 | - new Jsonld_Adapter( $this->jsonld_service ); |
|
| 1319 | + new Jsonld_Adapter($this->jsonld_service); |
|
| 1320 | 1320 | |
| 1321 | - new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service ); |
|
| 1321 | + new Jsonld_By_Id_Endpoint($this->jsonld_service, $this->entity_uri_service); |
|
| 1322 | 1322 | |
| 1323 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1324 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1323 | + $this->key_validation_service = new Wordlift_Key_Validation_Service($this->configuration_service); |
|
| 1324 | + $this->content_filter_service = new Wordlift_Content_Filter_Service($this->entity_service, $this->configuration_service, $this->entity_uri_service); |
|
| 1325 | 1325 | // Creating Faq Content filter service. |
| 1326 | 1326 | $this->faq_content_filter_service = new Faq_Content_Filter(); |
| 1327 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1328 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1329 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1330 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->entity_service ); |
|
| 1327 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service($this->content_filter_service, $this->entity_service); |
|
| 1328 | + $this->sample_data_service = new Wordlift_Sample_Data_Service($this->entity_type_service, $this->configuration_service, $this->user_service); |
|
| 1329 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter($this->sample_data_service); |
|
| 1330 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service($this->entity_service); |
|
| 1331 | 1331 | |
| 1332 | - $this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' ); |
|
| 1333 | - $this->loader->add_action( 'admin_enqueue_scripts', $this, 'add_wl_enabled_blocks' ); |
|
| 1332 | + $this->loader->add_action('enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks'); |
|
| 1333 | + $this->loader->add_action('admin_enqueue_scripts', $this, 'add_wl_enabled_blocks'); |
|
| 1334 | 1334 | |
| 1335 | 1335 | /** |
| 1336 | 1336 | * Filter: wl_feature__enable__blocks. |
@@ -1340,15 +1340,15 @@ discard block |
||
| 1340 | 1340 | * @return bool |
| 1341 | 1341 | * @since 3.27.6 |
| 1342 | 1342 | */ |
| 1343 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1343 | + if (apply_filters('wl_feature__enable__blocks', true)) { |
|
| 1344 | 1344 | // Initialize the short-codes. |
| 1345 | - new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
| 1345 | + new Async_Template_Decorator(new Wordlift_Navigator_Shortcode()); |
|
| 1346 | 1346 | new Wordlift_Chord_Shortcode(); |
| 1347 | 1347 | new Wordlift_Geomap_Shortcode(); |
| 1348 | 1348 | new Wordlift_Timeline_Shortcode(); |
| 1349 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service, $this->entity_service ); |
|
| 1350 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1351 | - new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
| 1349 | + new Wordlift_Related_Entities_Cloud_Shortcode($this->relation_service, $this->entity_service); |
|
| 1350 | + new Wordlift_Vocabulary_Shortcode($this->configuration_service); |
|
| 1351 | + new Async_Template_Decorator(new Wordlift_Faceted_Search_Shortcode()); |
|
| 1352 | 1352 | } |
| 1353 | 1353 | |
| 1354 | 1354 | new Wordlift_Products_Navigator_Shortcode(); |
@@ -1361,18 +1361,18 @@ discard block |
||
| 1361 | 1361 | new Wordlift_Seo_Service(); |
| 1362 | 1362 | |
| 1363 | 1363 | // Initialize the AMP service. |
| 1364 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1364 | + new Wordlift_AMP_Service($this->jsonld_service); |
|
| 1365 | 1365 | |
| 1366 | 1366 | /** Services. */ |
| 1367 | 1367 | $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
| 1368 | 1368 | new Wordlift_Image_Service(); |
| 1369 | 1369 | |
| 1370 | 1370 | /** Adapters. */ |
| 1371 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1372 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1373 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1371 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter($this->entity_type_service); |
|
| 1372 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter($this->publisher_service); |
|
| 1373 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter($this); |
|
| 1374 | 1374 | //$this->faq_tinymce_adapter = new Faq_Tinymce_Adapter(); |
| 1375 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1375 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter($this->relation_rebuild_service); |
|
| 1376 | 1376 | |
| 1377 | 1377 | /* |
| 1378 | 1378 | * Exclude our public js from WP-Rocket. |
@@ -1390,9 +1390,9 @@ discard block |
||
| 1390 | 1390 | ); |
| 1391 | 1391 | |
| 1392 | 1392 | $that = $this; |
| 1393 | - add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1394 | - if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) { |
|
| 1395 | - new Wordlift_Linked_Data_Service( $that->entity_service, $that->entity_type_service, $that->schema_service, $that->sparql_service ); |
|
| 1393 | + add_action('plugins_loaded', function() use ($that) { |
|
| 1394 | + if ( ! apply_filters('wl_feature__enable__dataset-ng', false)) { |
|
| 1395 | + new Wordlift_Linked_Data_Service($that->entity_service, $that->entity_type_service, $that->schema_service, $that->sparql_service); |
|
| 1396 | 1396 | new Wordlift_Sparql_Query_Async_Task(); |
| 1397 | 1397 | new Wordlift_Push_References_Async_Task(); |
| 1398 | 1398 | } |
@@ -1407,14 +1407,14 @@ discard block |
||
| 1407 | 1407 | $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
| 1408 | 1408 | $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
| 1409 | 1409 | $tabs_element = new Wordlift_Admin_Tabs_Element(); |
| 1410 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1411 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1410 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element($this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element); |
|
| 1411 | + $this->author_element = new Wordlift_Admin_Author_Element($this->publisher_service, $this->select2_element); |
|
| 1412 | 1412 | |
| 1413 | - $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 1414 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1413 | + $this->settings_page = new Wordlift_Admin_Settings_Page($this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element); |
|
| 1414 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($this->settings_page); |
|
| 1415 | 1415 | |
| 1416 | - $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1417 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1416 | + $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page($this->configuration_service, $this->input_element, $this->radio_input_element); |
|
| 1417 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link($this->analytics_settings_page); |
|
| 1418 | 1418 | $this->analytics_connect = new Wordlift_Analytics_Connect(); |
| 1419 | 1419 | |
| 1420 | 1420 | // Pages. |
@@ -1425,9 +1425,9 @@ discard block |
||
| 1425 | 1425 | * |
| 1426 | 1426 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1427 | 1427 | */ |
| 1428 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1429 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1430 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1428 | + if (apply_filters('wl_can_see_classification_box', true)) { |
|
| 1429 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1430 | + new Wordlift_Admin_Post_Edit_Page($this); |
|
| 1431 | 1431 | } |
| 1432 | 1432 | new Wordlift_Entity_Type_Admin_Service(); |
| 1433 | 1433 | |
@@ -1441,23 +1441,23 @@ discard block |
||
| 1441 | 1441 | $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
| 1442 | 1442 | |
| 1443 | 1443 | /* WordPress Admin. */ |
| 1444 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1445 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1444 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service); |
|
| 1445 | + $this->status_page = new Wordlift_Admin_Status_Page($this->entity_service, $this->sparql_service); |
|
| 1446 | 1446 | |
| 1447 | 1447 | // Create an instance of the install wizard. |
| 1448 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
| 1448 | + $this->admin_setup = new Wordlift_Admin_Setup($this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element); |
|
| 1449 | 1449 | |
| 1450 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1450 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($this->entity_post_type_service); |
|
| 1451 | 1451 | |
| 1452 | 1452 | // User Profile. |
| 1453 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1453 | + new Wordlift_Admin_User_Profile_Page($this->author_element, $this->user_service); |
|
| 1454 | 1454 | |
| 1455 | 1455 | $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
| 1456 | 1456 | |
| 1457 | 1457 | // Load the debug service if WP is in debug mode. |
| 1458 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1459 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1460 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1458 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 1459 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php'; |
|
| 1460 | + new Wordlift_Debug_Service($this->entity_service, $uri_service); |
|
| 1461 | 1461 | } |
| 1462 | 1462 | |
| 1463 | 1463 | // Remote Image Service. |
@@ -1470,12 +1470,12 @@ discard block |
||
| 1470 | 1470 | * |
| 1471 | 1471 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1472 | 1472 | */ |
| 1473 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1474 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1475 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1473 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-batch-action.php'; |
|
| 1474 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1475 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1476 | 1476 | |
| 1477 | 1477 | // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
| 1478 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1478 | + new Wordlift_Mapping_Ajax_Adapter(new Wordlift_Mapping_Service(Wordlift_Entity_Type_Service::get_instance())); |
|
| 1479 | 1479 | |
| 1480 | 1480 | /* |
| 1481 | 1481 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
@@ -1484,8 +1484,8 @@ discard block |
||
| 1484 | 1484 | * |
| 1485 | 1485 | * @since 3.20.0 |
| 1486 | 1486 | */ |
| 1487 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1488 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1487 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1488 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1489 | 1489 | |
| 1490 | 1490 | /* |
| 1491 | 1491 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
@@ -1494,8 +1494,8 @@ discard block |
||
| 1494 | 1494 | * |
| 1495 | 1495 | * @since 3.20.0 |
| 1496 | 1496 | */ |
| 1497 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1498 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1497 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1498 | + new Wordlift_Search_Keyword_Taxonomy($api_service); |
|
| 1499 | 1499 | |
| 1500 | 1500 | /* |
| 1501 | 1501 | * Load the Mappings JSON-LD post processing. |
@@ -1509,11 +1509,11 @@ discard block |
||
| 1509 | 1509 | // Taxonomy term rule validator for validating rules for term pages. |
| 1510 | 1510 | new Taxonomy_Term_Rule_Validator(); |
| 1511 | 1511 | new Post_Taxonomy_Term_Rule_Validator(); |
| 1512 | - $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1513 | - $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1514 | - $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1512 | + $rule_validators_registry = new Rule_Validators_Registry($default_rule_validator); |
|
| 1513 | + $rule_groups_validator = new Rule_Groups_Validator($rule_validators_registry); |
|
| 1514 | + $mappings_validator = new Mappings_Validator($mappings_dbo, $rule_groups_validator); |
|
| 1515 | 1515 | |
| 1516 | - new Url_To_Entity_Transform_Function( $this->entity_uri_service ); |
|
| 1516 | + new Url_To_Entity_Transform_Function($this->entity_uri_service); |
|
| 1517 | 1517 | new Taxonomy_To_Terms_Transform_Function(); |
| 1518 | 1518 | new Post_Id_To_Entity_Transform_Function(); |
| 1519 | 1519 | $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
@@ -1523,7 +1523,7 @@ discard block |
||
| 1523 | 1523 | * Intiailize the acf group data formatter. |
| 1524 | 1524 | */ |
| 1525 | 1525 | new Acf_Group_Formatter(); |
| 1526 | - new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1526 | + new Jsonld_Converter($mappings_validator, $mappings_transform_functions_registry); |
|
| 1527 | 1527 | |
| 1528 | 1528 | /** |
| 1529 | 1529 | * @since 3.26.0 |
@@ -1544,7 +1544,7 @@ discard block |
||
| 1544 | 1544 | /* |
| 1545 | 1545 | * Create a singleton for the Analysis_Response_Ops_Factory. |
| 1546 | 1546 | */ |
| 1547 | - $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service ); |
|
| 1547 | + $entity_helper = new Entity_Helper($this->entity_uri_service, $this->entity_service); |
|
| 1548 | 1548 | new Analysis_Response_Ops_Factory( |
| 1549 | 1549 | $this->entity_uri_service, |
| 1550 | 1550 | $this->entity_service, |
@@ -1554,11 +1554,11 @@ discard block |
||
| 1554 | 1554 | ); |
| 1555 | 1555 | |
| 1556 | 1556 | /** WL Autocomplete. */ |
| 1557 | - $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1557 | + $autocomplete_service = new All_Autocomplete_Service(array( |
|
| 1558 | 1558 | new Local_Autocomplete_Service(), |
| 1559 | - new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ), |
|
| 1560 | - ) ); |
|
| 1561 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1559 | + new Linked_Data_Autocomplete_Service($this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service), |
|
| 1560 | + )); |
|
| 1561 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter($autocomplete_service); |
|
| 1562 | 1562 | |
| 1563 | 1563 | /** |
| 1564 | 1564 | * @since 3.27.2 |
@@ -1567,10 +1567,10 @@ discard block |
||
| 1567 | 1567 | */ |
| 1568 | 1568 | new Recipe_Maker_Post_Type_Hook(); |
| 1569 | 1569 | $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
| 1570 | - new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1571 | - new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1572 | - new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1573 | - new Yoast_Jsonld( $recipe_maker_validation_service ); |
|
| 1570 | + new Recipe_Maker_Jsonld_Hook($attachment_service, $recipe_maker_validation_service); |
|
| 1571 | + new Recipe_Maker_After_Get_Jsonld_Hook($recipe_maker_validation_service); |
|
| 1572 | + new Recipe_Maker_Warning($recipe_maker_validation_service); |
|
| 1573 | + new Yoast_Jsonld($recipe_maker_validation_service); |
|
| 1574 | 1574 | |
| 1575 | 1575 | /** |
| 1576 | 1576 | * @since 3.27.4 |
@@ -1581,7 +1581,7 @@ discard block |
||
| 1581 | 1581 | * @since 3.27.8 |
| 1582 | 1582 | * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
| 1583 | 1583 | */ |
| 1584 | - new Key_Validation_Notice( $this->key_validation_service, $this->configuration_service ); |
|
| 1584 | + new Key_Validation_Notice($this->key_validation_service, $this->configuration_service); |
|
| 1585 | 1585 | /** |
| 1586 | 1586 | * @since 3.28.0 |
| 1587 | 1587 | * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen |
@@ -1592,7 +1592,7 @@ discard block |
||
| 1592 | 1592 | * @since 3.29.0 |
| 1593 | 1593 | * @see https://github.com/insideout10/wordlift-plugin/issues/1304 |
| 1594 | 1594 | */ |
| 1595 | - new Entity_Rest_Service( $this->entity_type_service ); |
|
| 1595 | + new Entity_Rest_Service($this->entity_type_service); |
|
| 1596 | 1596 | |
| 1597 | 1597 | /** |
| 1598 | 1598 | * Expand author in to references. |
@@ -1600,13 +1600,13 @@ discard block |
||
| 1600 | 1600 | * @see https://github.com/insideout10/wordlift-plugin/issues/1318 |
| 1601 | 1601 | */ |
| 1602 | 1602 | |
| 1603 | - add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1603 | + add_action('plugins_loaded', function() use ($that) { |
|
| 1604 | 1604 | |
| 1605 | - if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) { |
|
| 1606 | - new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter ); |
|
| 1605 | + if (apply_filters('wl_feature__enable__article-wrapper', false)) { |
|
| 1606 | + new Jsonld_Article_Wrapper(Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter); |
|
| 1607 | 1607 | } |
| 1608 | 1608 | |
| 1609 | - if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) { |
|
| 1609 | + if (apply_filters('wl_feature__enable__match-terms', false)) { |
|
| 1610 | 1610 | $vocabulary_loader = new Vocabulary_Loader(); |
| 1611 | 1611 | $vocabulary_loader->init_vocabulary(); |
| 1612 | 1612 | } |
@@ -1629,7 +1629,7 @@ discard block |
||
| 1629 | 1629 | * @since 3.31.5 |
| 1630 | 1630 | * Create configuration endpoint for webapp to configure. |
| 1631 | 1631 | */ |
| 1632 | - new Config( $this->admin_setup, $this->key_validation_service, $this->configuration_service ); |
|
| 1632 | + new Config($this->admin_setup, $this->key_validation_service, $this->configuration_service); |
|
| 1633 | 1633 | } |
| 1634 | 1634 | |
| 1635 | 1635 | /** |
@@ -1644,9 +1644,9 @@ discard block |
||
| 1644 | 1644 | private function set_locale() { |
| 1645 | 1645 | |
| 1646 | 1646 | $plugin_i18n = new Wordlift_i18n(); |
| 1647 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1647 | + $plugin_i18n->set_domain($this->get_plugin_name()); |
|
| 1648 | 1648 | |
| 1649 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1649 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
| 1650 | 1650 | |
| 1651 | 1651 | } |
| 1652 | 1652 | |
@@ -1667,29 +1667,29 @@ discard block |
||
| 1667 | 1667 | $this->user_service |
| 1668 | 1668 | ); |
| 1669 | 1669 | |
| 1670 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1671 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1670 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
| 1671 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11); |
|
| 1672 | 1672 | |
| 1673 | 1673 | // Hook the init action to taxonomy services. |
| 1674 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1675 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1674 | + $this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0); |
|
| 1675 | + $this->loader->add_action('init', $this->entity_types_taxonomy_service, 'init', 0); |
|
| 1676 | 1676 | |
| 1677 | 1677 | // Hook the deleted_post_meta action to the Thumbnail service. |
| 1678 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1678 | + $this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4); |
|
| 1679 | 1679 | |
| 1680 | 1680 | // Hook the added_post_meta action to the Thumbnail service. |
| 1681 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1681 | + $this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 1682 | 1682 | |
| 1683 | 1683 | // Hook the updated_post_meta action to the Thumbnail service. |
| 1684 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1684 | + $this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 1685 | 1685 | |
| 1686 | 1686 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1687 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1687 | + $this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 1688 | 1688 | |
| 1689 | 1689 | // Register custom allowed redirect hosts. |
| 1690 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1690 | + $this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts'); |
|
| 1691 | 1691 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
| 1692 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1692 | + $this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect'); |
|
| 1693 | 1693 | |
| 1694 | 1694 | /* |
| 1695 | 1695 | * The old dashboard is replaced with dashboard v2. |
@@ -1707,46 +1707,46 @@ discard block |
||
| 1707 | 1707 | |
| 1708 | 1708 | // Hook save_post to the entity service to update custom fields (such as alternate labels). |
| 1709 | 1709 | // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
| 1710 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1711 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1710 | + $this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3); |
|
| 1711 | + $this->loader->add_action('save_post', $this->rating_service, 'set_rating_for', 20, 1); |
|
| 1712 | 1712 | |
| 1713 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1714 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1713 | + $this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1); |
|
| 1714 | + $this->loader->add_action('in_admin_header', $this->rating_service, 'in_admin_header'); |
|
| 1715 | 1715 | |
| 1716 | 1716 | // Entity listing customization (wp-admin/edit.php) |
| 1717 | 1717 | // Add custom columns. |
| 1718 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1718 | + $this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns'); |
|
| 1719 | 1719 | // no explicit entity as it prevents handling of other post types. |
| 1720 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1720 | + $this->loader->add_filter('manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2); |
|
| 1721 | 1721 | // Add 4W selection. |
| 1722 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1723 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1724 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1725 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1722 | + $this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope'); |
|
| 1723 | + $this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope'); |
|
| 1724 | + $this->loader->add_action('pre_get_posts', $this->entity_list_service, 'pre_get_posts'); |
|
| 1725 | + $this->loader->add_action('load-edit.php', $this->entity_list_service, 'load_edit'); |
|
| 1726 | 1726 | |
| 1727 | 1727 | /* |
| 1728 | 1728 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1729 | 1729 | * |
| 1730 | 1730 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1731 | 1731 | */ |
| 1732 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1733 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1732 | + if ( ! WL_ALL_ENTITY_TYPES) { |
|
| 1733 | + $this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args'); |
|
| 1734 | 1734 | } |
| 1735 | 1735 | |
| 1736 | 1736 | // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
| 1737 | 1737 | // entities. |
| 1738 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1738 | + $this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2); |
|
| 1739 | 1739 | |
| 1740 | 1740 | // Filter imported post meta. |
| 1741 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1741 | + $this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3); |
|
| 1742 | 1742 | |
| 1743 | 1743 | // Notify the import service when an import starts and ends. |
| 1744 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1745 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1744 | + $this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0); |
|
| 1745 | + $this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0); |
|
| 1746 | 1746 | |
| 1747 | 1747 | // Hook the AJAX wl_rebuild action to the Rebuild Service. |
| 1748 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1749 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1748 | + $this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild'); |
|
| 1749 | + $this->loader->add_action('wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild'); |
|
| 1750 | 1750 | |
| 1751 | 1751 | /** |
| 1752 | 1752 | * Filter: wl_feature__enable__settings-download. |
@@ -1756,34 +1756,34 @@ discard block |
||
| 1756 | 1756 | * @return bool |
| 1757 | 1757 | * @since 3.27.6 |
| 1758 | 1758 | */ |
| 1759 | - $this->features_registry->register_feature_from_slug( 'settings-download', true, array( |
|
| 1759 | + $this->features_registry->register_feature_from_slug('settings-download', true, array( |
|
| 1760 | 1760 | $this, |
| 1761 | 1761 | 'register_screens' |
| 1762 | - ) ); |
|
| 1762 | + )); |
|
| 1763 | 1763 | |
| 1764 | 1764 | |
| 1765 | 1765 | // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
| 1766 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1766 | + $this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10); |
|
| 1767 | 1767 | |
| 1768 | 1768 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1769 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1770 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1771 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1769 | + $this->loader->add_action('wp_ajax_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1770 | + $this->loader->add_action('admin_post_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1771 | + $this->loader->add_action('admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1772 | 1772 | |
| 1773 | 1773 | // Hook the AJAX wl_validate_key action to the Key Validation service. |
| 1774 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1774 | + $this->loader->add_action('wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key'); |
|
| 1775 | 1775 | |
| 1776 | 1776 | // Hook the AJAX wl_update_country_options action to the countries. |
| 1777 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1777 | + $this->loader->add_action('wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html'); |
|
| 1778 | 1778 | |
| 1779 | 1779 | // Hook the `admin_init` function to the Admin Setup. |
| 1780 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1780 | + $this->loader->add_action('admin_init', $this->admin_setup, 'admin_init'); |
|
| 1781 | 1781 | |
| 1782 | 1782 | // Hook the admin_init to the settings page. |
| 1783 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1784 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1783 | + $this->loader->add_action('admin_init', $this->settings_page, 'admin_init'); |
|
| 1784 | + $this->loader->add_action('admin_init', $this->analytics_settings_page, 'admin_init'); |
|
| 1785 | 1785 | |
| 1786 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1786 | + $this->loader->add_filter('admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction'); |
|
| 1787 | 1787 | |
| 1788 | 1788 | // Hook the menu creation on the general wordlift menu creation. |
| 1789 | 1789 | /** |
@@ -1796,18 +1796,18 @@ discard block |
||
| 1796 | 1796 | * |
| 1797 | 1797 | * Since 3.30.0 this feature is registered using registry. |
| 1798 | 1798 | */ |
| 1799 | - add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1800 | - if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) { |
|
| 1801 | - add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 ); |
|
| 1799 | + add_action('plugins_loaded', function() use ($that) { |
|
| 1800 | + if (apply_filters('wl_feature__enable__settings-screen', true) || Admin_User_Option::is_wordlift_admin()) { |
|
| 1801 | + add_action('wl_admin_menu', array($that->settings_page, 'admin_menu'), 10, 2); |
|
| 1802 | 1802 | } |
| 1803 | 1803 | } ); |
| 1804 | 1804 | |
| 1805 | 1805 | // Hook key update. |
| 1806 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1807 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1806 | + $this->loader->add_action('pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2); |
|
| 1807 | + $this->loader->add_action('update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2); |
|
| 1808 | 1808 | |
| 1809 | 1809 | // Add additional action links to the WordLift plugin in the plugins page. |
| 1810 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1810 | + $this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1); |
|
| 1811 | 1811 | |
| 1812 | 1812 | /* |
| 1813 | 1813 | * Remove the Analytics Settings link from the plugin page. |
@@ -1818,25 +1818,25 @@ discard block |
||
| 1818 | 1818 | // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
| 1819 | 1819 | |
| 1820 | 1820 | // Hook the AJAX `wl_publisher` action name. |
| 1821 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1821 | + $this->loader->add_action('wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher'); |
|
| 1822 | 1822 | |
| 1823 | 1823 | // Hook row actions for the entity type list admin. |
| 1824 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1824 | + $this->loader->add_filter('wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2); |
|
| 1825 | 1825 | |
| 1826 | 1826 | /** Ajax actions. */ |
| 1827 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1827 | + $this->loader->add_action('wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export'); |
|
| 1828 | 1828 | |
| 1829 | 1829 | // Hook capabilities manipulation to allow access to entity type admin |
| 1830 | 1830 | // page on WordPress versions before 4.7. |
| 1831 | 1831 | global $wp_version; |
| 1832 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1833 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1832 | + if (version_compare($wp_version, '4.7', '<')) { |
|
| 1833 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4); |
|
| 1834 | 1834 | } |
| 1835 | 1835 | |
| 1836 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1836 | + $this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
| 1837 | 1837 | |
| 1838 | 1838 | /** Adapters. */ |
| 1839 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1839 | + $this->loader->add_filter('mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1); |
|
| 1840 | 1840 | /** |
| 1841 | 1841 | * Disabling Faq temporarily. |
| 1842 | 1842 | * Load the tinymce editor button on the tool bar. |
@@ -1847,54 +1847,54 @@ discard block |
||
| 1847 | 1847 | //$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
| 1848 | 1848 | |
| 1849 | 1849 | |
| 1850 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1851 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1852 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1850 | + $this->loader->add_action('wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all'); |
|
| 1851 | + $this->loader->add_action('wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create'); |
|
| 1852 | + $this->loader->add_action('wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete'); |
|
| 1853 | 1853 | /** |
| 1854 | 1854 | * @since 3.26.0 |
| 1855 | 1855 | */ |
| 1856 | 1856 | $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
| 1857 | - $this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1857 | + $this->loader->add_action('do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box'); |
|
| 1858 | 1858 | // Adding Rest route for the post excerpt |
| 1859 | 1859 | Post_Excerpt_Rest_Controller::register_routes(); |
| 1860 | 1860 | |
| 1861 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1862 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1861 | + $this->loader->add_action('update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5); |
|
| 1862 | + $this->loader->add_action('delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5); |
|
| 1863 | 1863 | |
| 1864 | 1864 | // Handle the autocomplete request. |
| 1865 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1865 | + add_action('wp_ajax_wl_autocomplete', array( |
|
| 1866 | 1866 | $this->autocomplete_adapter, |
| 1867 | 1867 | 'wl_autocomplete', |
| 1868 | - ) ); |
|
| 1869 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1868 | + )); |
|
| 1869 | + add_action('wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1870 | 1870 | $this->autocomplete_adapter, |
| 1871 | 1871 | 'wl_autocomplete', |
| 1872 | - ) ); |
|
| 1872 | + )); |
|
| 1873 | 1873 | |
| 1874 | 1874 | // Hooks to restrict multisite super admin from manipulating entity types. |
| 1875 | - if ( is_multisite() ) { |
|
| 1876 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1875 | + if (is_multisite()) { |
|
| 1876 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4); |
|
| 1877 | 1877 | } |
| 1878 | 1878 | |
| 1879 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1879 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback($this->configuration_service); |
|
| 1880 | 1880 | |
| 1881 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1882 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1883 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1881 | + add_action('admin_footer', array($deactivator_feedback, 'render_feedback_popup')); |
|
| 1882 | + add_action('admin_enqueue_scripts', array($deactivator_feedback, 'enqueue_popup_scripts')); |
|
| 1883 | + add_action('wp_ajax_wl_deactivation_feedback', array($deactivator_feedback, 'wl_deactivation_feedback')); |
|
| 1884 | 1884 | |
| 1885 | 1885 | /** |
| 1886 | 1886 | * Always allow the `wordlift/classification` block. |
| 1887 | 1887 | * |
| 1888 | 1888 | * @since 3.23.0 |
| 1889 | 1889 | */ |
| 1890 | - add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1890 | + add_filter('allowed_block_types', function($value) { |
|
| 1891 | 1891 | |
| 1892 | - if ( true === $value ) { |
|
| 1892 | + if (true === $value) { |
|
| 1893 | 1893 | return $value; |
| 1894 | 1894 | } |
| 1895 | 1895 | |
| 1896 | - return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1897 | - }, PHP_INT_MAX ); |
|
| 1896 | + return array_merge((array) $value, array('wordlift/classification')); |
|
| 1897 | + }, PHP_INT_MAX); |
|
| 1898 | 1898 | |
| 1899 | 1899 | /** |
| 1900 | 1900 | * @since 3.27.7 |
@@ -1912,58 +1912,58 @@ discard block |
||
| 1912 | 1912 | */ |
| 1913 | 1913 | private function define_public_hooks() { |
| 1914 | 1914 | |
| 1915 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1915 | + $plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version()); |
|
| 1916 | 1916 | |
| 1917 | 1917 | // Register the entity post type. |
| 1918 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1918 | + $this->loader->add_action('init', $this->entity_post_type_service, 'register'); |
|
| 1919 | 1919 | |
| 1920 | 1920 | // Bind the link generation and handling hooks to the entity link service. |
| 1921 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1922 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1921 | + $this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4); |
|
| 1922 | + $this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1); |
|
| 1923 | 1923 | // $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 ); |
| 1924 | 1924 | // $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 ); |
| 1925 | 1925 | |
| 1926 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1927 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1928 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1926 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
| 1927 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
| 1928 | + $this->loader->add_action('wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts'); |
|
| 1929 | 1929 | |
| 1930 | 1930 | // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
| 1931 | - $this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1931 | + $this->loader->add_filter('the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags'); |
|
| 1932 | 1932 | // Hook the content filter service to add entity links. |
| 1933 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1934 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1933 | + if ( ! defined('WL_DISABLE_CONTENT_FILTER') || ! WL_DISABLE_CONTENT_FILTER) { |
|
| 1934 | + $this->loader->add_filter('the_content', $this->content_filter_service, 'the_content'); |
|
| 1935 | 1935 | } |
| 1936 | 1936 | |
| 1937 | 1937 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1938 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1938 | + $this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 1939 | 1939 | |
| 1940 | 1940 | // Hook the ShareThis service. |
| 1941 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1942 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1941 | + $this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99); |
|
| 1942 | + $this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99); |
|
| 1943 | 1943 | |
| 1944 | 1944 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1945 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1945 | + $this->loader->add_action('wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1946 | 1946 | |
| 1947 | 1947 | // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
| 1948 | 1948 | // in order to tweak WP's `WP_Query` to include entities in queries related |
| 1949 | 1949 | // to categories. |
| 1950 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1950 | + $this->loader->add_action('pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1); |
|
| 1951 | 1951 | |
| 1952 | 1952 | /* |
| 1953 | 1953 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1954 | 1954 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1955 | 1955 | * order of start time. |
| 1956 | 1956 | */ |
| 1957 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1957 | + $this->loader->add_action('pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1); |
|
| 1958 | 1958 | |
| 1959 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1959 | + $this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
| 1960 | 1960 | |
| 1961 | 1961 | // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
| 1962 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1962 | + $this->loader->add_action('save_post', $this->entity_type_adapter, 'save_post', 9, 3); |
|
| 1963 | 1963 | |
| 1964 | 1964 | // Analytics Script Frontend. |
| 1965 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1966 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1965 | + if ($this->configuration_service->is_analytics_enable()) { |
|
| 1966 | + $this->loader->add_action('wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10); |
|
| 1967 | 1967 | } |
| 1968 | 1968 | |
| 1969 | 1969 | } |
@@ -2016,11 +2016,11 @@ discard block |
||
| 2016 | 2016 | */ |
| 2017 | 2017 | private function load_cli_dependencies() { |
| 2018 | 2018 | |
| 2019 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 2019 | + require_once plugin_dir_path(dirname(__FILE__)).'cli/class-wordlift-push-reference-data-command.php'; |
|
| 2020 | 2020 | |
| 2021 | - $push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service ); |
|
| 2021 | + $push_reference_data_command = new Wordlift_Push_Reference_Data_Command($this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service); |
|
| 2022 | 2022 | |
| 2023 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 2023 | + WP_CLI::add_command('wl references push', $push_reference_data_command); |
|
| 2024 | 2024 | |
| 2025 | 2025 | } |
| 2026 | 2026 | |
@@ -2045,7 +2045,7 @@ discard block |
||
| 2045 | 2045 | * @since 3.27.6 |
| 2046 | 2046 | */ |
| 2047 | 2047 | |
| 2048 | - wp_register_script( 'wl_enabled_blocks', false ); |
|
| 2048 | + wp_register_script('wl_enabled_blocks', false); |
|
| 2049 | 2049 | |
| 2050 | 2050 | $enabled_blocks = array(); |
| 2051 | 2051 | |
@@ -2053,13 +2053,13 @@ discard block |
||
| 2053 | 2053 | * Filter name: wl_feature_enable__product_navigator |
| 2054 | 2054 | * @since 3.30.0 |
| 2055 | 2055 | */ |
| 2056 | - if ( apply_filters( 'wl_feature_enable__product-navigator', true ) ) { |
|
| 2056 | + if (apply_filters('wl_feature_enable__product-navigator', true)) { |
|
| 2057 | 2057 | $enabled_blocks[] = 'wordlift/products-navigator'; |
| 2058 | 2058 | } |
| 2059 | 2059 | |
| 2060 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 2060 | + if (apply_filters('wl_feature__enable__blocks', true)) { |
|
| 2061 | 2061 | // To intimate JS |
| 2062 | - $enabled_blocks = array_merge( $enabled_blocks, array( |
|
| 2062 | + $enabled_blocks = array_merge($enabled_blocks, array( |
|
| 2063 | 2063 | 'wordlift/navigator', |
| 2064 | 2064 | 'wordlift/chord', |
| 2065 | 2065 | 'wordlift/geomap', |
@@ -2067,11 +2067,11 @@ discard block |
||
| 2067 | 2067 | 'wordlift/cloud', |
| 2068 | 2068 | 'wordlift/vocabulary', |
| 2069 | 2069 | 'wordlift/faceted-search' |
| 2070 | - ) ); |
|
| 2070 | + )); |
|
| 2071 | 2071 | } |
| 2072 | 2072 | |
| 2073 | - wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 2074 | - wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 2073 | + wp_localize_script('wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks); |
|
| 2074 | + wp_enqueue_script('wl_enabled_blocks'); |
|
| 2075 | 2075 | } |
| 2076 | 2076 | |
| 2077 | 2077 | /** |
@@ -2079,11 +2079,11 @@ discard block |
||
| 2079 | 2079 | */ |
| 2080 | 2080 | public function register_screens() { |
| 2081 | 2081 | // Hook the menu to the Download Your Data page. |
| 2082 | - if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) { |
|
| 2083 | - add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 ); |
|
| 2082 | + if (apply_filters('wl_feature__enable__settings-download', true)) { |
|
| 2083 | + add_action('admin_menu', array($this->download_your_data_page, 'admin_menu'), 100, 0); |
|
| 2084 | 2084 | } |
| 2085 | - add_action( 'admin_menu', array( $this->status_page, 'admin_menu' ), 100, 0 ); |
|
| 2086 | - add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 ); |
|
| 2085 | + add_action('admin_menu', array($this->status_page, 'admin_menu'), 100, 0); |
|
| 2086 | + add_action('admin_menu', array($this->entity_type_settings_admin_page, 'admin_menu'), 100, 0); |
|
| 2087 | 2087 | |
| 2088 | 2088 | } |
| 2089 | 2089 | |
@@ -77,1621 +77,1621 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | class Wordlift { |
| 79 | 79 | |
| 80 | - //<editor-fold desc="## FIELDS"> |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
| 84 | - * the plugin. |
|
| 85 | - * |
|
| 86 | - * @since 1.0.0 |
|
| 87 | - * @access protected |
|
| 88 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 89 | - */ |
|
| 90 | - protected $loader; |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * The unique identifier of this plugin. |
|
| 94 | - * |
|
| 95 | - * @since 1.0.0 |
|
| 96 | - * @access protected |
|
| 97 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 98 | - */ |
|
| 99 | - protected $plugin_name; |
|
| 100 | - |
|
| 101 | - /** |
|
| 102 | - * The current version of the plugin. |
|
| 103 | - * |
|
| 104 | - * @since 1.0.0 |
|
| 105 | - * @access protected |
|
| 106 | - * @var string $version The current version of the plugin. |
|
| 107 | - */ |
|
| 108 | - protected $version; |
|
| 109 | - |
|
| 110 | - /** |
|
| 111 | - * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 112 | - * |
|
| 113 | - * @since 3.12.0 |
|
| 114 | - * @access protected |
|
| 115 | - * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 116 | - */ |
|
| 117 | - protected $tinymce_adapter; |
|
| 118 | - |
|
| 119 | - /** |
|
| 120 | - * The {@link Faq_Tinymce_Adapter} instance |
|
| 121 | - * @since 3.26.0 |
|
| 122 | - * @access protected |
|
| 123 | - * @var Faq_Tinymce_Adapter $faq_tinymce_adapter . |
|
| 124 | - */ |
|
| 125 | - //protected $faq_tinymce_adapter; |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * The Thumbnail service. |
|
| 129 | - * |
|
| 130 | - * @since 3.1.5 |
|
| 131 | - * @access private |
|
| 132 | - * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 133 | - */ |
|
| 134 | - private $thumbnail_service; |
|
| 135 | - |
|
| 136 | - /** |
|
| 137 | - * The UI service. |
|
| 138 | - * |
|
| 139 | - * @since 3.2.0 |
|
| 140 | - * @access private |
|
| 141 | - * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 142 | - */ |
|
| 143 | - private $ui_service; |
|
| 144 | - |
|
| 145 | - /** |
|
| 146 | - * The Schema service. |
|
| 147 | - * |
|
| 148 | - * @since 3.3.0 |
|
| 149 | - * @access protected |
|
| 150 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 151 | - */ |
|
| 152 | - protected $schema_service; |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * The Entity service. |
|
| 156 | - * |
|
| 157 | - * @since 3.1.0 |
|
| 158 | - * @access protected |
|
| 159 | - * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 160 | - */ |
|
| 161 | - protected $entity_service; |
|
| 162 | - |
|
| 163 | - /** |
|
| 164 | - * The Topic Taxonomy service. |
|
| 165 | - * |
|
| 166 | - * @since 3.5.0 |
|
| 167 | - * @access private |
|
| 168 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 169 | - */ |
|
| 170 | - private $topic_taxonomy_service; |
|
| 171 | - |
|
| 172 | - /** |
|
| 173 | - * The Entity Types Taxonomy service. |
|
| 174 | - * |
|
| 175 | - * @since 3.18.0 |
|
| 176 | - * @access private |
|
| 177 | - * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 178 | - */ |
|
| 179 | - private $entity_types_taxonomy_service; |
|
| 180 | - |
|
| 181 | - /** |
|
| 182 | - * The User service. |
|
| 183 | - * |
|
| 184 | - * @since 3.1.7 |
|
| 185 | - * @access protected |
|
| 186 | - * @var \Wordlift_User_Service $user_service The User service. |
|
| 187 | - */ |
|
| 188 | - protected $user_service; |
|
| 189 | - |
|
| 190 | - /** |
|
| 191 | - * The Timeline service. |
|
| 192 | - * |
|
| 193 | - * @since 3.1.0 |
|
| 194 | - * @access private |
|
| 195 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 196 | - */ |
|
| 197 | - private $timeline_service; |
|
| 198 | - |
|
| 199 | - /** |
|
| 200 | - * The Redirect service. |
|
| 201 | - * |
|
| 202 | - * @since 3.2.0 |
|
| 203 | - * @access private |
|
| 204 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 205 | - */ |
|
| 206 | - private $redirect_service; |
|
| 207 | - |
|
| 208 | - /** |
|
| 209 | - * The Notice service. |
|
| 210 | - * |
|
| 211 | - * @since 3.3.0 |
|
| 212 | - * @access private |
|
| 213 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 214 | - */ |
|
| 215 | - private $notice_service; |
|
| 216 | - |
|
| 217 | - /** |
|
| 218 | - * The Entity list customization. |
|
| 219 | - * |
|
| 220 | - * @since 3.3.0 |
|
| 221 | - * @access protected |
|
| 222 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 223 | - */ |
|
| 224 | - protected $entity_list_service; |
|
| 225 | - |
|
| 226 | - /** |
|
| 227 | - * The Entity Types Taxonomy Walker. |
|
| 228 | - * |
|
| 229 | - * @since 3.1.0 |
|
| 230 | - * @access private |
|
| 231 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 232 | - */ |
|
| 233 | - private $entity_types_taxonomy_walker; |
|
| 234 | - |
|
| 235 | - /** |
|
| 236 | - * The ShareThis service. |
|
| 237 | - * |
|
| 238 | - * @since 3.2.0 |
|
| 239 | - * @access private |
|
| 240 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 241 | - */ |
|
| 242 | - private $sharethis_service; |
|
| 243 | - |
|
| 244 | - /** |
|
| 245 | - * The PrimaShop adapter. |
|
| 246 | - * |
|
| 247 | - * @since 3.2.3 |
|
| 248 | - * @access private |
|
| 249 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 250 | - */ |
|
| 251 | - private $primashop_adapter; |
|
| 252 | - |
|
| 253 | - /** |
|
| 254 | - * The WordLift Dashboard adapter. |
|
| 255 | - * |
|
| 256 | - * @since 3.4.0 |
|
| 257 | - * @access private |
|
| 258 | - * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 259 | - */ |
|
| 260 | - private $dashboard_service; |
|
| 261 | - |
|
| 262 | - /** |
|
| 263 | - * The entity type service. |
|
| 264 | - * |
|
| 265 | - * @since 3.6.0 |
|
| 266 | - * @access private |
|
| 267 | - * @var \Wordlift_Entity_Post_Type_Service |
|
| 268 | - */ |
|
| 269 | - private $entity_post_type_service; |
|
| 270 | - |
|
| 271 | - /** |
|
| 272 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 273 | - * |
|
| 274 | - * @since 3.6.0 |
|
| 275 | - * @access private |
|
| 276 | - * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 277 | - */ |
|
| 278 | - private $entity_link_service; |
|
| 279 | - |
|
| 280 | - /** |
|
| 281 | - * A {@link Wordlift_Sparql_Service} instance. |
|
| 282 | - * |
|
| 283 | - * @since 3.6.0 |
|
| 284 | - * @access protected |
|
| 285 | - * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 286 | - */ |
|
| 287 | - protected $sparql_service; |
|
| 288 | - |
|
| 289 | - /** |
|
| 290 | - * A {@link Wordlift_Import_Service} instance. |
|
| 291 | - * |
|
| 292 | - * @since 3.6.0 |
|
| 293 | - * @access private |
|
| 294 | - * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 295 | - */ |
|
| 296 | - private $import_service; |
|
| 297 | - |
|
| 298 | - /** |
|
| 299 | - * A {@link Wordlift_Rebuild_Service} instance. |
|
| 300 | - * |
|
| 301 | - * @since 3.6.0 |
|
| 302 | - * @access private |
|
| 303 | - * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 304 | - */ |
|
| 305 | - private $rebuild_service; |
|
| 306 | - |
|
| 307 | - /** |
|
| 308 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
| 309 | - * |
|
| 310 | - * @since 3.7.0 |
|
| 311 | - * @access protected |
|
| 312 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 313 | - */ |
|
| 314 | - protected $jsonld_service; |
|
| 315 | - |
|
| 316 | - /** |
|
| 317 | - * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 318 | - * |
|
| 319 | - * @since 3.14.0 |
|
| 320 | - * @access protected |
|
| 321 | - * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 322 | - */ |
|
| 323 | - protected $jsonld_website_converter; |
|
| 324 | - |
|
| 325 | - /** |
|
| 326 | - * A {@link Wordlift_Property_Factory} instance. |
|
| 327 | - * |
|
| 328 | - * @since 3.7.0 |
|
| 329 | - * @access private |
|
| 330 | - * @var \Wordlift_Property_Factory $property_factory |
|
| 331 | - */ |
|
| 332 | - private $property_factory; |
|
| 333 | - |
|
| 334 | - /** |
|
| 335 | - * The 'Download Your Data' page. |
|
| 336 | - * |
|
| 337 | - * @since 3.6.0 |
|
| 338 | - * @access private |
|
| 339 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 340 | - */ |
|
| 341 | - private $download_your_data_page; |
|
| 342 | - |
|
| 343 | - /** |
|
| 344 | - * The 'WordLift Settings' page. |
|
| 345 | - * |
|
| 346 | - * @since 3.11.0 |
|
| 347 | - * @access protected |
|
| 348 | - * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 349 | - */ |
|
| 350 | - protected $settings_page; |
|
| 351 | - |
|
| 352 | - /** |
|
| 353 | - * The install wizard page. |
|
| 354 | - * |
|
| 355 | - * @since 3.9.0 |
|
| 356 | - * @access private |
|
| 357 | - * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 358 | - */ |
|
| 359 | - public $admin_setup; |
|
| 360 | - |
|
| 361 | - /** |
|
| 362 | - * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 363 | - * linking of entities to their pages. |
|
| 364 | - * |
|
| 365 | - * @since 3.8.0 |
|
| 366 | - * @access private |
|
| 367 | - * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 368 | - */ |
|
| 369 | - private $content_filter_service; |
|
| 370 | - |
|
| 371 | - /** |
|
| 372 | - * The Faq Content filter service |
|
| 373 | - * @since 3.26.0 |
|
| 374 | - * @access private |
|
| 375 | - * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
| 376 | - */ |
|
| 377 | - private $faq_content_filter_service; |
|
| 378 | - |
|
| 379 | - /** |
|
| 380 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 381 | - * |
|
| 382 | - * @since 3.9.0 |
|
| 383 | - * @access private |
|
| 384 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 385 | - */ |
|
| 386 | - private $key_validation_service; |
|
| 387 | - |
|
| 388 | - /** |
|
| 389 | - * A {@link Wordlift_Rating_Service} instance. |
|
| 390 | - * |
|
| 391 | - * @since 3.10.0 |
|
| 392 | - * @access private |
|
| 393 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 394 | - */ |
|
| 395 | - private $rating_service; |
|
| 396 | - |
|
| 397 | - /** |
|
| 398 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 399 | - * |
|
| 400 | - * @since 3.10.0 |
|
| 401 | - * @access protected |
|
| 402 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 403 | - */ |
|
| 404 | - protected $post_to_jsonld_converter; |
|
| 405 | - |
|
| 406 | - /** |
|
| 407 | - * A {@link Wordlift_Configuration_Service} instance. |
|
| 408 | - * |
|
| 409 | - * @since 3.10.0 |
|
| 410 | - * @access protected |
|
| 411 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 412 | - */ |
|
| 413 | - protected $configuration_service; |
|
| 414 | - |
|
| 415 | - /** |
|
| 416 | - * A {@link Wordlift_Install_Service} instance. |
|
| 417 | - * |
|
| 418 | - * @since 3.18.0 |
|
| 419 | - * @access protected |
|
| 420 | - * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 421 | - */ |
|
| 422 | - protected $install_service; |
|
| 423 | - |
|
| 424 | - /** |
|
| 425 | - * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 426 | - * |
|
| 427 | - * @since 3.10.0 |
|
| 428 | - * @access protected |
|
| 429 | - * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 430 | - */ |
|
| 431 | - protected $entity_type_service; |
|
| 432 | - |
|
| 433 | - /** |
|
| 434 | - * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 435 | - * |
|
| 436 | - * @since 3.10.0 |
|
| 437 | - * @access protected |
|
| 438 | - * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 439 | - */ |
|
| 440 | - protected $entity_post_to_jsonld_converter; |
|
| 441 | - |
|
| 442 | - /** |
|
| 443 | - * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 444 | - * |
|
| 445 | - * @since 3.10.0 |
|
| 446 | - * @access protected |
|
| 447 | - * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 448 | - */ |
|
| 449 | - protected $postid_to_jsonld_converter; |
|
| 450 | - |
|
| 451 | - /** |
|
| 452 | - * The {@link Wordlift_Admin_Status_Page} class. |
|
| 453 | - * |
|
| 454 | - * @since 3.9.8 |
|
| 455 | - * @access private |
|
| 456 | - * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 457 | - */ |
|
| 458 | - private $status_page; |
|
| 459 | - |
|
| 460 | - /** |
|
| 461 | - * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 462 | - * |
|
| 463 | - * @since 3.11.0 |
|
| 464 | - * @access protected |
|
| 465 | - * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 466 | - */ |
|
| 467 | - protected $category_taxonomy_service; |
|
| 468 | - |
|
| 469 | - /** |
|
| 470 | - * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 471 | - * |
|
| 472 | - * @since 3.11.0 |
|
| 473 | - * @access protected |
|
| 474 | - * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 475 | - */ |
|
| 476 | - protected $entity_page_service; |
|
| 477 | - |
|
| 478 | - /** |
|
| 479 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 480 | - * |
|
| 481 | - * @since 3.11.0 |
|
| 482 | - * @access protected |
|
| 483 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 484 | - */ |
|
| 485 | - protected $settings_page_action_link; |
|
| 486 | - |
|
| 487 | - /** |
|
| 488 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 489 | - * |
|
| 490 | - * @since 3.11.0 |
|
| 491 | - * @access protected |
|
| 492 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 493 | - */ |
|
| 494 | - protected $analytics_settings_page_action_link; |
|
| 495 | - |
|
| 496 | - /** |
|
| 497 | - * The {@link Wordlift_Analytics_Connect} class. |
|
| 498 | - * |
|
| 499 | - * @since 3.11.0 |
|
| 500 | - * @access protected |
|
| 501 | - * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 502 | - */ |
|
| 503 | - protected $analytics_connect; |
|
| 504 | - |
|
| 505 | - /** |
|
| 506 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 507 | - * |
|
| 508 | - * @since 3.11.0 |
|
| 509 | - * @access protected |
|
| 510 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 511 | - */ |
|
| 512 | - protected $publisher_ajax_adapter; |
|
| 513 | - |
|
| 514 | - /** |
|
| 515 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 516 | - * |
|
| 517 | - * @since 3.11.0 |
|
| 518 | - * @access protected |
|
| 519 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 520 | - */ |
|
| 521 | - protected $input_element; |
|
| 522 | - |
|
| 523 | - /** |
|
| 524 | - * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 525 | - * |
|
| 526 | - * @since 3.13.0 |
|
| 527 | - * @access protected |
|
| 528 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 529 | - */ |
|
| 530 | - protected $radio_input_element; |
|
| 531 | - |
|
| 532 | - /** |
|
| 533 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 534 | - * |
|
| 535 | - * @since 3.11.0 |
|
| 536 | - * @access protected |
|
| 537 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 538 | - */ |
|
| 539 | - protected $language_select_element; |
|
| 540 | - |
|
| 541 | - /** |
|
| 542 | - * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 543 | - * |
|
| 544 | - * @since 3.18.0 |
|
| 545 | - * @access protected |
|
| 546 | - * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 547 | - */ |
|
| 548 | - protected $country_select_element; |
|
| 549 | - |
|
| 550 | - /** |
|
| 551 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 552 | - * |
|
| 553 | - * @since 3.11.0 |
|
| 554 | - * @access protected |
|
| 555 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 556 | - */ |
|
| 557 | - protected $publisher_element; |
|
| 558 | - |
|
| 559 | - /** |
|
| 560 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 561 | - * |
|
| 562 | - * @since 3.11.0 |
|
| 563 | - * @access protected |
|
| 564 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 565 | - */ |
|
| 566 | - protected $select2_element; |
|
| 567 | - |
|
| 568 | - /** |
|
| 569 | - * The controller for the entity type list admin page |
|
| 570 | - * |
|
| 571 | - * @since 3.11.0 |
|
| 572 | - * @access private |
|
| 573 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 574 | - */ |
|
| 575 | - private $entity_type_admin_page; |
|
| 576 | - |
|
| 577 | - /** |
|
| 578 | - * The controller for the entity type settings admin page |
|
| 579 | - * |
|
| 580 | - * @since 3.11.0 |
|
| 581 | - * @access private |
|
| 582 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 583 | - */ |
|
| 584 | - private $entity_type_settings_admin_page; |
|
| 585 | - |
|
| 586 | - /** |
|
| 587 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 588 | - * |
|
| 589 | - * @since 3.11.0 |
|
| 590 | - * @access protected |
|
| 591 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 592 | - */ |
|
| 593 | - protected $related_entities_cloud_widget; |
|
| 594 | - |
|
| 595 | - /** |
|
| 596 | - * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 597 | - * |
|
| 598 | - * @since 3.14.0 |
|
| 599 | - * @access protected |
|
| 600 | - * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 601 | - */ |
|
| 602 | - protected $author_element; |
|
| 603 | - |
|
| 604 | - /** |
|
| 605 | - * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 606 | - * |
|
| 607 | - * @since 3.12.0 |
|
| 608 | - * @access protected |
|
| 609 | - * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 610 | - */ |
|
| 611 | - protected $sample_data_service; |
|
| 612 | - |
|
| 613 | - /** |
|
| 614 | - * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 615 | - * |
|
| 616 | - * @since 3.12.0 |
|
| 617 | - * @access protected |
|
| 618 | - * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 619 | - */ |
|
| 620 | - protected $sample_data_ajax_adapter; |
|
| 621 | - |
|
| 622 | - /** |
|
| 623 | - * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 624 | - * |
|
| 625 | - * @since 3.14.3 |
|
| 626 | - * @access private |
|
| 627 | - * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 628 | - */ |
|
| 629 | - private $relation_rebuild_service; |
|
| 630 | - |
|
| 631 | - /** |
|
| 632 | - * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 633 | - * |
|
| 634 | - * @since 3.14.3 |
|
| 635 | - * @access private |
|
| 636 | - * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 637 | - */ |
|
| 638 | - private $relation_rebuild_adapter; |
|
| 639 | - |
|
| 640 | - /** |
|
| 641 | - * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 642 | - * |
|
| 643 | - * @since 3.18.0 |
|
| 644 | - * @access private |
|
| 645 | - * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 646 | - */ |
|
| 647 | - private $reference_rebuild_service; |
|
| 648 | - |
|
| 649 | - /** |
|
| 650 | - * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 651 | - * |
|
| 652 | - * @since 3.16.0 |
|
| 653 | - * @access protected |
|
| 654 | - * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 655 | - */ |
|
| 656 | - protected $google_analytics_export_service; |
|
| 657 | - |
|
| 658 | - /** |
|
| 659 | - * {@link Wordlift}'s singleton instance. |
|
| 660 | - * |
|
| 661 | - * @since 3.15.0 |
|
| 662 | - * @access protected |
|
| 663 | - * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 664 | - */ |
|
| 665 | - protected $entity_type_adapter; |
|
| 666 | - |
|
| 667 | - /** |
|
| 668 | - * The {@link Wordlift_Storage_Factory} instance. |
|
| 669 | - * |
|
| 670 | - * @since 3.15.0 |
|
| 671 | - * @access protected |
|
| 672 | - * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 673 | - */ |
|
| 674 | - protected $storage_factory; |
|
| 675 | - |
|
| 676 | - /** |
|
| 677 | - * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 678 | - * |
|
| 679 | - * @since 3.15.0 |
|
| 680 | - * @access protected |
|
| 681 | - * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 682 | - */ |
|
| 683 | - protected $rendition_factory; |
|
| 684 | - |
|
| 685 | - /** |
|
| 686 | - * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 687 | - * |
|
| 688 | - * @since 3.15.0 |
|
| 689 | - * @access private |
|
| 690 | - * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 691 | - */ |
|
| 692 | - private $autocomplete_adapter; |
|
| 693 | - |
|
| 694 | - /** |
|
| 695 | - * The {@link Wordlift_Relation_Service} instance. |
|
| 696 | - * |
|
| 697 | - * @since 3.15.0 |
|
| 698 | - * @access protected |
|
| 699 | - * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 700 | - */ |
|
| 701 | - protected $relation_service; |
|
| 702 | - |
|
| 703 | - /** |
|
| 704 | - * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 705 | - * |
|
| 706 | - * @since 3.16.0 |
|
| 707 | - * @access protected |
|
| 708 | - * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 709 | - * |
|
| 710 | - */ |
|
| 711 | - protected $cached_postid_to_jsonld_converter; |
|
| 712 | - |
|
| 713 | - /** |
|
| 714 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 715 | - * |
|
| 716 | - * @since 3.16.3 |
|
| 717 | - * @access protected |
|
| 718 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 719 | - */ |
|
| 720 | - protected $entity_uri_service; |
|
| 721 | - |
|
| 722 | - /** |
|
| 723 | - * The {@link Wordlift_Publisher_Service} instance. |
|
| 724 | - * |
|
| 725 | - * @since 3.19.0 |
|
| 726 | - * @access protected |
|
| 727 | - * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 728 | - */ |
|
| 729 | - protected $publisher_service; |
|
| 730 | - |
|
| 731 | - /** |
|
| 732 | - * The {@link Wordlift_Context_Cards_Service} instance. |
|
| 733 | - * |
|
| 734 | - * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
| 735 | - */ |
|
| 736 | - protected $context_cards_service; |
|
| 737 | - |
|
| 738 | - /** |
|
| 739 | - * {@link Wordlift}'s singleton instance. |
|
| 740 | - * |
|
| 741 | - * @since 3.11.2 |
|
| 742 | - * @access private |
|
| 743 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 744 | - */ |
|
| 745 | - private static $instance; |
|
| 746 | - |
|
| 747 | - /** |
|
| 748 | - * A singleton instance of features registry. |
|
| 749 | - * @since 3.30.0 |
|
| 750 | - * @var Features_Registry |
|
| 751 | - */ |
|
| 752 | - private $features_registry; |
|
| 753 | - |
|
| 754 | - //</editor-fold> |
|
| 755 | - |
|
| 756 | - /** |
|
| 757 | - * Define the core functionality of the plugin. |
|
| 758 | - * |
|
| 759 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 760 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 761 | - * the public-facing side of the site. |
|
| 762 | - * |
|
| 763 | - * @since 1.0.0 |
|
| 764 | - */ |
|
| 765 | - public function __construct() { |
|
| 766 | - |
|
| 767 | - self::$instance = $this; |
|
| 768 | - |
|
| 769 | - $this->plugin_name = 'wordlift'; |
|
| 770 | - $this->version = '3.31.6'; |
|
| 771 | - $this->load_dependencies(); |
|
| 772 | - $this->set_locale(); |
|
| 773 | - $this->define_admin_hooks(); |
|
| 774 | - $this->define_public_hooks(); |
|
| 775 | - |
|
| 776 | - // If we're in `WP_CLI` load the related files. |
|
| 777 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 778 | - $this->load_cli_dependencies(); |
|
| 779 | - } |
|
| 780 | - |
|
| 781 | - } |
|
| 782 | - |
|
| 783 | - /** |
|
| 784 | - * Get the singleton instance. |
|
| 785 | - * |
|
| 786 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 787 | - * @since 3.11.2 |
|
| 788 | - * |
|
| 789 | - */ |
|
| 790 | - public static function get_instance() { |
|
| 791 | - |
|
| 792 | - return self::$instance; |
|
| 793 | - } |
|
| 794 | - |
|
| 795 | - /** |
|
| 796 | - * Load the required dependencies for this plugin. |
|
| 797 | - * |
|
| 798 | - * Include the following files that make up the plugin: |
|
| 799 | - * |
|
| 800 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 801 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 802 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 803 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 804 | - * |
|
| 805 | - * Create an instance of the loader which will be used to register the hooks |
|
| 806 | - * with WordPress. |
|
| 807 | - * |
|
| 808 | - * @throws Exception |
|
| 809 | - * @since 1.0.0 |
|
| 810 | - * @access private |
|
| 811 | - */ |
|
| 812 | - private function load_dependencies() { |
|
| 813 | - |
|
| 814 | - /** |
|
| 815 | - * The class responsible for orchestrating the actions and filters of the |
|
| 816 | - * core plugin. |
|
| 817 | - */ |
|
| 818 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 819 | - |
|
| 820 | - // The class responsible for plugin uninstall. |
|
| 821 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 822 | - |
|
| 823 | - /** |
|
| 824 | - * The class responsible for defining internationalization functionality |
|
| 825 | - * of the plugin. |
|
| 826 | - */ |
|
| 827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 828 | - |
|
| 829 | - /** |
|
| 830 | - * WordLift's supported languages. |
|
| 831 | - */ |
|
| 832 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 833 | - |
|
| 834 | - /** |
|
| 835 | - * WordLift's supported countries. |
|
| 836 | - */ |
|
| 837 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 838 | - |
|
| 839 | - /** |
|
| 840 | - * Provide support functions to sanitize data. |
|
| 841 | - */ |
|
| 842 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 843 | - |
|
| 844 | - /** Services. */ |
|
| 845 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 846 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 847 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 848 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 849 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 850 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 851 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 852 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 853 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 854 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 855 | - |
|
| 856 | - /** |
|
| 857 | - * The Query builder. |
|
| 858 | - */ |
|
| 859 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 860 | - |
|
| 861 | - /** |
|
| 862 | - * The Schema service. |
|
| 863 | - */ |
|
| 864 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 865 | - |
|
| 866 | - /** |
|
| 867 | - * The schema:url property service. |
|
| 868 | - */ |
|
| 869 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 870 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 871 | - |
|
| 872 | - /** |
|
| 873 | - * The UI service. |
|
| 874 | - */ |
|
| 875 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 876 | - |
|
| 877 | - /** |
|
| 878 | - * The Thumbnail service. |
|
| 879 | - */ |
|
| 880 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 881 | - |
|
| 882 | - /** |
|
| 883 | - * The Entity Types Taxonomy service. |
|
| 884 | - */ |
|
| 885 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 886 | - |
|
| 887 | - /** |
|
| 888 | - * The Entity service. |
|
| 889 | - */ |
|
| 890 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 891 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 892 | - |
|
| 893 | - // Add the entity rating service. |
|
| 894 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 895 | - |
|
| 896 | - /** |
|
| 897 | - * The User service. |
|
| 898 | - */ |
|
| 899 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 900 | - |
|
| 901 | - /** |
|
| 902 | - * The Timeline service. |
|
| 903 | - */ |
|
| 904 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 905 | - |
|
| 906 | - /** |
|
| 907 | - * The Topic Taxonomy service. |
|
| 908 | - */ |
|
| 909 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 910 | - |
|
| 911 | - /** |
|
| 912 | - * The SPARQL service. |
|
| 913 | - */ |
|
| 914 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 915 | - |
|
| 916 | - /** |
|
| 917 | - * The WordLift import service. |
|
| 918 | - */ |
|
| 919 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 920 | - |
|
| 921 | - /** |
|
| 922 | - * The WordLift URI service. |
|
| 923 | - */ |
|
| 924 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 925 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 926 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 927 | - |
|
| 928 | - /** |
|
| 929 | - * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 930 | - */ |
|
| 931 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 932 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 933 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 934 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 935 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 936 | - |
|
| 937 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 938 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 939 | - |
|
| 940 | - /** |
|
| 941 | - * Load the converters. |
|
| 942 | - */ |
|
| 943 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 944 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 945 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 946 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 947 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 948 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 949 | - |
|
| 950 | - /** |
|
| 951 | - * Load cache-related files. |
|
| 952 | - */ |
|
| 953 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 954 | - |
|
| 955 | - /** |
|
| 956 | - * Load the content filter. |
|
| 957 | - */ |
|
| 958 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 959 | - |
|
| 960 | - /* |
|
| 80 | + //<editor-fold desc="## FIELDS"> |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
| 84 | + * the plugin. |
|
| 85 | + * |
|
| 86 | + * @since 1.0.0 |
|
| 87 | + * @access protected |
|
| 88 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 89 | + */ |
|
| 90 | + protected $loader; |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * The unique identifier of this plugin. |
|
| 94 | + * |
|
| 95 | + * @since 1.0.0 |
|
| 96 | + * @access protected |
|
| 97 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 98 | + */ |
|
| 99 | + protected $plugin_name; |
|
| 100 | + |
|
| 101 | + /** |
|
| 102 | + * The current version of the plugin. |
|
| 103 | + * |
|
| 104 | + * @since 1.0.0 |
|
| 105 | + * @access protected |
|
| 106 | + * @var string $version The current version of the plugin. |
|
| 107 | + */ |
|
| 108 | + protected $version; |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | + * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 112 | + * |
|
| 113 | + * @since 3.12.0 |
|
| 114 | + * @access protected |
|
| 115 | + * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 116 | + */ |
|
| 117 | + protected $tinymce_adapter; |
|
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * The {@link Faq_Tinymce_Adapter} instance |
|
| 121 | + * @since 3.26.0 |
|
| 122 | + * @access protected |
|
| 123 | + * @var Faq_Tinymce_Adapter $faq_tinymce_adapter . |
|
| 124 | + */ |
|
| 125 | + //protected $faq_tinymce_adapter; |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * The Thumbnail service. |
|
| 129 | + * |
|
| 130 | + * @since 3.1.5 |
|
| 131 | + * @access private |
|
| 132 | + * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 133 | + */ |
|
| 134 | + private $thumbnail_service; |
|
| 135 | + |
|
| 136 | + /** |
|
| 137 | + * The UI service. |
|
| 138 | + * |
|
| 139 | + * @since 3.2.0 |
|
| 140 | + * @access private |
|
| 141 | + * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 142 | + */ |
|
| 143 | + private $ui_service; |
|
| 144 | + |
|
| 145 | + /** |
|
| 146 | + * The Schema service. |
|
| 147 | + * |
|
| 148 | + * @since 3.3.0 |
|
| 149 | + * @access protected |
|
| 150 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 151 | + */ |
|
| 152 | + protected $schema_service; |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * The Entity service. |
|
| 156 | + * |
|
| 157 | + * @since 3.1.0 |
|
| 158 | + * @access protected |
|
| 159 | + * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 160 | + */ |
|
| 161 | + protected $entity_service; |
|
| 162 | + |
|
| 163 | + /** |
|
| 164 | + * The Topic Taxonomy service. |
|
| 165 | + * |
|
| 166 | + * @since 3.5.0 |
|
| 167 | + * @access private |
|
| 168 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 169 | + */ |
|
| 170 | + private $topic_taxonomy_service; |
|
| 171 | + |
|
| 172 | + /** |
|
| 173 | + * The Entity Types Taxonomy service. |
|
| 174 | + * |
|
| 175 | + * @since 3.18.0 |
|
| 176 | + * @access private |
|
| 177 | + * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 178 | + */ |
|
| 179 | + private $entity_types_taxonomy_service; |
|
| 180 | + |
|
| 181 | + /** |
|
| 182 | + * The User service. |
|
| 183 | + * |
|
| 184 | + * @since 3.1.7 |
|
| 185 | + * @access protected |
|
| 186 | + * @var \Wordlift_User_Service $user_service The User service. |
|
| 187 | + */ |
|
| 188 | + protected $user_service; |
|
| 189 | + |
|
| 190 | + /** |
|
| 191 | + * The Timeline service. |
|
| 192 | + * |
|
| 193 | + * @since 3.1.0 |
|
| 194 | + * @access private |
|
| 195 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 196 | + */ |
|
| 197 | + private $timeline_service; |
|
| 198 | + |
|
| 199 | + /** |
|
| 200 | + * The Redirect service. |
|
| 201 | + * |
|
| 202 | + * @since 3.2.0 |
|
| 203 | + * @access private |
|
| 204 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 205 | + */ |
|
| 206 | + private $redirect_service; |
|
| 207 | + |
|
| 208 | + /** |
|
| 209 | + * The Notice service. |
|
| 210 | + * |
|
| 211 | + * @since 3.3.0 |
|
| 212 | + * @access private |
|
| 213 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 214 | + */ |
|
| 215 | + private $notice_service; |
|
| 216 | + |
|
| 217 | + /** |
|
| 218 | + * The Entity list customization. |
|
| 219 | + * |
|
| 220 | + * @since 3.3.0 |
|
| 221 | + * @access protected |
|
| 222 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 223 | + */ |
|
| 224 | + protected $entity_list_service; |
|
| 225 | + |
|
| 226 | + /** |
|
| 227 | + * The Entity Types Taxonomy Walker. |
|
| 228 | + * |
|
| 229 | + * @since 3.1.0 |
|
| 230 | + * @access private |
|
| 231 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 232 | + */ |
|
| 233 | + private $entity_types_taxonomy_walker; |
|
| 234 | + |
|
| 235 | + /** |
|
| 236 | + * The ShareThis service. |
|
| 237 | + * |
|
| 238 | + * @since 3.2.0 |
|
| 239 | + * @access private |
|
| 240 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 241 | + */ |
|
| 242 | + private $sharethis_service; |
|
| 243 | + |
|
| 244 | + /** |
|
| 245 | + * The PrimaShop adapter. |
|
| 246 | + * |
|
| 247 | + * @since 3.2.3 |
|
| 248 | + * @access private |
|
| 249 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 250 | + */ |
|
| 251 | + private $primashop_adapter; |
|
| 252 | + |
|
| 253 | + /** |
|
| 254 | + * The WordLift Dashboard adapter. |
|
| 255 | + * |
|
| 256 | + * @since 3.4.0 |
|
| 257 | + * @access private |
|
| 258 | + * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 259 | + */ |
|
| 260 | + private $dashboard_service; |
|
| 261 | + |
|
| 262 | + /** |
|
| 263 | + * The entity type service. |
|
| 264 | + * |
|
| 265 | + * @since 3.6.0 |
|
| 266 | + * @access private |
|
| 267 | + * @var \Wordlift_Entity_Post_Type_Service |
|
| 268 | + */ |
|
| 269 | + private $entity_post_type_service; |
|
| 270 | + |
|
| 271 | + /** |
|
| 272 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 273 | + * |
|
| 274 | + * @since 3.6.0 |
|
| 275 | + * @access private |
|
| 276 | + * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 277 | + */ |
|
| 278 | + private $entity_link_service; |
|
| 279 | + |
|
| 280 | + /** |
|
| 281 | + * A {@link Wordlift_Sparql_Service} instance. |
|
| 282 | + * |
|
| 283 | + * @since 3.6.0 |
|
| 284 | + * @access protected |
|
| 285 | + * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 286 | + */ |
|
| 287 | + protected $sparql_service; |
|
| 288 | + |
|
| 289 | + /** |
|
| 290 | + * A {@link Wordlift_Import_Service} instance. |
|
| 291 | + * |
|
| 292 | + * @since 3.6.0 |
|
| 293 | + * @access private |
|
| 294 | + * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 295 | + */ |
|
| 296 | + private $import_service; |
|
| 297 | + |
|
| 298 | + /** |
|
| 299 | + * A {@link Wordlift_Rebuild_Service} instance. |
|
| 300 | + * |
|
| 301 | + * @since 3.6.0 |
|
| 302 | + * @access private |
|
| 303 | + * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 304 | + */ |
|
| 305 | + private $rebuild_service; |
|
| 306 | + |
|
| 307 | + /** |
|
| 308 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
| 309 | + * |
|
| 310 | + * @since 3.7.0 |
|
| 311 | + * @access protected |
|
| 312 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 313 | + */ |
|
| 314 | + protected $jsonld_service; |
|
| 315 | + |
|
| 316 | + /** |
|
| 317 | + * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 318 | + * |
|
| 319 | + * @since 3.14.0 |
|
| 320 | + * @access protected |
|
| 321 | + * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 322 | + */ |
|
| 323 | + protected $jsonld_website_converter; |
|
| 324 | + |
|
| 325 | + /** |
|
| 326 | + * A {@link Wordlift_Property_Factory} instance. |
|
| 327 | + * |
|
| 328 | + * @since 3.7.0 |
|
| 329 | + * @access private |
|
| 330 | + * @var \Wordlift_Property_Factory $property_factory |
|
| 331 | + */ |
|
| 332 | + private $property_factory; |
|
| 333 | + |
|
| 334 | + /** |
|
| 335 | + * The 'Download Your Data' page. |
|
| 336 | + * |
|
| 337 | + * @since 3.6.0 |
|
| 338 | + * @access private |
|
| 339 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 340 | + */ |
|
| 341 | + private $download_your_data_page; |
|
| 342 | + |
|
| 343 | + /** |
|
| 344 | + * The 'WordLift Settings' page. |
|
| 345 | + * |
|
| 346 | + * @since 3.11.0 |
|
| 347 | + * @access protected |
|
| 348 | + * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 349 | + */ |
|
| 350 | + protected $settings_page; |
|
| 351 | + |
|
| 352 | + /** |
|
| 353 | + * The install wizard page. |
|
| 354 | + * |
|
| 355 | + * @since 3.9.0 |
|
| 356 | + * @access private |
|
| 357 | + * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 358 | + */ |
|
| 359 | + public $admin_setup; |
|
| 360 | + |
|
| 361 | + /** |
|
| 362 | + * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 363 | + * linking of entities to their pages. |
|
| 364 | + * |
|
| 365 | + * @since 3.8.0 |
|
| 366 | + * @access private |
|
| 367 | + * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 368 | + */ |
|
| 369 | + private $content_filter_service; |
|
| 370 | + |
|
| 371 | + /** |
|
| 372 | + * The Faq Content filter service |
|
| 373 | + * @since 3.26.0 |
|
| 374 | + * @access private |
|
| 375 | + * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
| 376 | + */ |
|
| 377 | + private $faq_content_filter_service; |
|
| 378 | + |
|
| 379 | + /** |
|
| 380 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 381 | + * |
|
| 382 | + * @since 3.9.0 |
|
| 383 | + * @access private |
|
| 384 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 385 | + */ |
|
| 386 | + private $key_validation_service; |
|
| 387 | + |
|
| 388 | + /** |
|
| 389 | + * A {@link Wordlift_Rating_Service} instance. |
|
| 390 | + * |
|
| 391 | + * @since 3.10.0 |
|
| 392 | + * @access private |
|
| 393 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 394 | + */ |
|
| 395 | + private $rating_service; |
|
| 396 | + |
|
| 397 | + /** |
|
| 398 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 399 | + * |
|
| 400 | + * @since 3.10.0 |
|
| 401 | + * @access protected |
|
| 402 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 403 | + */ |
|
| 404 | + protected $post_to_jsonld_converter; |
|
| 405 | + |
|
| 406 | + /** |
|
| 407 | + * A {@link Wordlift_Configuration_Service} instance. |
|
| 408 | + * |
|
| 409 | + * @since 3.10.0 |
|
| 410 | + * @access protected |
|
| 411 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 412 | + */ |
|
| 413 | + protected $configuration_service; |
|
| 414 | + |
|
| 415 | + /** |
|
| 416 | + * A {@link Wordlift_Install_Service} instance. |
|
| 417 | + * |
|
| 418 | + * @since 3.18.0 |
|
| 419 | + * @access protected |
|
| 420 | + * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 421 | + */ |
|
| 422 | + protected $install_service; |
|
| 423 | + |
|
| 424 | + /** |
|
| 425 | + * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 426 | + * |
|
| 427 | + * @since 3.10.0 |
|
| 428 | + * @access protected |
|
| 429 | + * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 430 | + */ |
|
| 431 | + protected $entity_type_service; |
|
| 432 | + |
|
| 433 | + /** |
|
| 434 | + * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 435 | + * |
|
| 436 | + * @since 3.10.0 |
|
| 437 | + * @access protected |
|
| 438 | + * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 439 | + */ |
|
| 440 | + protected $entity_post_to_jsonld_converter; |
|
| 441 | + |
|
| 442 | + /** |
|
| 443 | + * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 444 | + * |
|
| 445 | + * @since 3.10.0 |
|
| 446 | + * @access protected |
|
| 447 | + * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 448 | + */ |
|
| 449 | + protected $postid_to_jsonld_converter; |
|
| 450 | + |
|
| 451 | + /** |
|
| 452 | + * The {@link Wordlift_Admin_Status_Page} class. |
|
| 453 | + * |
|
| 454 | + * @since 3.9.8 |
|
| 455 | + * @access private |
|
| 456 | + * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 457 | + */ |
|
| 458 | + private $status_page; |
|
| 459 | + |
|
| 460 | + /** |
|
| 461 | + * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 462 | + * |
|
| 463 | + * @since 3.11.0 |
|
| 464 | + * @access protected |
|
| 465 | + * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 466 | + */ |
|
| 467 | + protected $category_taxonomy_service; |
|
| 468 | + |
|
| 469 | + /** |
|
| 470 | + * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 471 | + * |
|
| 472 | + * @since 3.11.0 |
|
| 473 | + * @access protected |
|
| 474 | + * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 475 | + */ |
|
| 476 | + protected $entity_page_service; |
|
| 477 | + |
|
| 478 | + /** |
|
| 479 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 480 | + * |
|
| 481 | + * @since 3.11.0 |
|
| 482 | + * @access protected |
|
| 483 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 484 | + */ |
|
| 485 | + protected $settings_page_action_link; |
|
| 486 | + |
|
| 487 | + /** |
|
| 488 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 489 | + * |
|
| 490 | + * @since 3.11.0 |
|
| 491 | + * @access protected |
|
| 492 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 493 | + */ |
|
| 494 | + protected $analytics_settings_page_action_link; |
|
| 495 | + |
|
| 496 | + /** |
|
| 497 | + * The {@link Wordlift_Analytics_Connect} class. |
|
| 498 | + * |
|
| 499 | + * @since 3.11.0 |
|
| 500 | + * @access protected |
|
| 501 | + * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 502 | + */ |
|
| 503 | + protected $analytics_connect; |
|
| 504 | + |
|
| 505 | + /** |
|
| 506 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 507 | + * |
|
| 508 | + * @since 3.11.0 |
|
| 509 | + * @access protected |
|
| 510 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 511 | + */ |
|
| 512 | + protected $publisher_ajax_adapter; |
|
| 513 | + |
|
| 514 | + /** |
|
| 515 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 516 | + * |
|
| 517 | + * @since 3.11.0 |
|
| 518 | + * @access protected |
|
| 519 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 520 | + */ |
|
| 521 | + protected $input_element; |
|
| 522 | + |
|
| 523 | + /** |
|
| 524 | + * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 525 | + * |
|
| 526 | + * @since 3.13.0 |
|
| 527 | + * @access protected |
|
| 528 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 529 | + */ |
|
| 530 | + protected $radio_input_element; |
|
| 531 | + |
|
| 532 | + /** |
|
| 533 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 534 | + * |
|
| 535 | + * @since 3.11.0 |
|
| 536 | + * @access protected |
|
| 537 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 538 | + */ |
|
| 539 | + protected $language_select_element; |
|
| 540 | + |
|
| 541 | + /** |
|
| 542 | + * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 543 | + * |
|
| 544 | + * @since 3.18.0 |
|
| 545 | + * @access protected |
|
| 546 | + * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 547 | + */ |
|
| 548 | + protected $country_select_element; |
|
| 549 | + |
|
| 550 | + /** |
|
| 551 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 552 | + * |
|
| 553 | + * @since 3.11.0 |
|
| 554 | + * @access protected |
|
| 555 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 556 | + */ |
|
| 557 | + protected $publisher_element; |
|
| 558 | + |
|
| 559 | + /** |
|
| 560 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 561 | + * |
|
| 562 | + * @since 3.11.0 |
|
| 563 | + * @access protected |
|
| 564 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 565 | + */ |
|
| 566 | + protected $select2_element; |
|
| 567 | + |
|
| 568 | + /** |
|
| 569 | + * The controller for the entity type list admin page |
|
| 570 | + * |
|
| 571 | + * @since 3.11.0 |
|
| 572 | + * @access private |
|
| 573 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 574 | + */ |
|
| 575 | + private $entity_type_admin_page; |
|
| 576 | + |
|
| 577 | + /** |
|
| 578 | + * The controller for the entity type settings admin page |
|
| 579 | + * |
|
| 580 | + * @since 3.11.0 |
|
| 581 | + * @access private |
|
| 582 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 583 | + */ |
|
| 584 | + private $entity_type_settings_admin_page; |
|
| 585 | + |
|
| 586 | + /** |
|
| 587 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 588 | + * |
|
| 589 | + * @since 3.11.0 |
|
| 590 | + * @access protected |
|
| 591 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 592 | + */ |
|
| 593 | + protected $related_entities_cloud_widget; |
|
| 594 | + |
|
| 595 | + /** |
|
| 596 | + * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 597 | + * |
|
| 598 | + * @since 3.14.0 |
|
| 599 | + * @access protected |
|
| 600 | + * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 601 | + */ |
|
| 602 | + protected $author_element; |
|
| 603 | + |
|
| 604 | + /** |
|
| 605 | + * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 606 | + * |
|
| 607 | + * @since 3.12.0 |
|
| 608 | + * @access protected |
|
| 609 | + * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 610 | + */ |
|
| 611 | + protected $sample_data_service; |
|
| 612 | + |
|
| 613 | + /** |
|
| 614 | + * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 615 | + * |
|
| 616 | + * @since 3.12.0 |
|
| 617 | + * @access protected |
|
| 618 | + * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 619 | + */ |
|
| 620 | + protected $sample_data_ajax_adapter; |
|
| 621 | + |
|
| 622 | + /** |
|
| 623 | + * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 624 | + * |
|
| 625 | + * @since 3.14.3 |
|
| 626 | + * @access private |
|
| 627 | + * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 628 | + */ |
|
| 629 | + private $relation_rebuild_service; |
|
| 630 | + |
|
| 631 | + /** |
|
| 632 | + * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 633 | + * |
|
| 634 | + * @since 3.14.3 |
|
| 635 | + * @access private |
|
| 636 | + * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 637 | + */ |
|
| 638 | + private $relation_rebuild_adapter; |
|
| 639 | + |
|
| 640 | + /** |
|
| 641 | + * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 642 | + * |
|
| 643 | + * @since 3.18.0 |
|
| 644 | + * @access private |
|
| 645 | + * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 646 | + */ |
|
| 647 | + private $reference_rebuild_service; |
|
| 648 | + |
|
| 649 | + /** |
|
| 650 | + * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 651 | + * |
|
| 652 | + * @since 3.16.0 |
|
| 653 | + * @access protected |
|
| 654 | + * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 655 | + */ |
|
| 656 | + protected $google_analytics_export_service; |
|
| 657 | + |
|
| 658 | + /** |
|
| 659 | + * {@link Wordlift}'s singleton instance. |
|
| 660 | + * |
|
| 661 | + * @since 3.15.0 |
|
| 662 | + * @access protected |
|
| 663 | + * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 664 | + */ |
|
| 665 | + protected $entity_type_adapter; |
|
| 666 | + |
|
| 667 | + /** |
|
| 668 | + * The {@link Wordlift_Storage_Factory} instance. |
|
| 669 | + * |
|
| 670 | + * @since 3.15.0 |
|
| 671 | + * @access protected |
|
| 672 | + * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 673 | + */ |
|
| 674 | + protected $storage_factory; |
|
| 675 | + |
|
| 676 | + /** |
|
| 677 | + * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 678 | + * |
|
| 679 | + * @since 3.15.0 |
|
| 680 | + * @access protected |
|
| 681 | + * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 682 | + */ |
|
| 683 | + protected $rendition_factory; |
|
| 684 | + |
|
| 685 | + /** |
|
| 686 | + * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 687 | + * |
|
| 688 | + * @since 3.15.0 |
|
| 689 | + * @access private |
|
| 690 | + * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 691 | + */ |
|
| 692 | + private $autocomplete_adapter; |
|
| 693 | + |
|
| 694 | + /** |
|
| 695 | + * The {@link Wordlift_Relation_Service} instance. |
|
| 696 | + * |
|
| 697 | + * @since 3.15.0 |
|
| 698 | + * @access protected |
|
| 699 | + * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 700 | + */ |
|
| 701 | + protected $relation_service; |
|
| 702 | + |
|
| 703 | + /** |
|
| 704 | + * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 705 | + * |
|
| 706 | + * @since 3.16.0 |
|
| 707 | + * @access protected |
|
| 708 | + * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 709 | + * |
|
| 710 | + */ |
|
| 711 | + protected $cached_postid_to_jsonld_converter; |
|
| 712 | + |
|
| 713 | + /** |
|
| 714 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 715 | + * |
|
| 716 | + * @since 3.16.3 |
|
| 717 | + * @access protected |
|
| 718 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 719 | + */ |
|
| 720 | + protected $entity_uri_service; |
|
| 721 | + |
|
| 722 | + /** |
|
| 723 | + * The {@link Wordlift_Publisher_Service} instance. |
|
| 724 | + * |
|
| 725 | + * @since 3.19.0 |
|
| 726 | + * @access protected |
|
| 727 | + * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 728 | + */ |
|
| 729 | + protected $publisher_service; |
|
| 730 | + |
|
| 731 | + /** |
|
| 732 | + * The {@link Wordlift_Context_Cards_Service} instance. |
|
| 733 | + * |
|
| 734 | + * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
| 735 | + */ |
|
| 736 | + protected $context_cards_service; |
|
| 737 | + |
|
| 738 | + /** |
|
| 739 | + * {@link Wordlift}'s singleton instance. |
|
| 740 | + * |
|
| 741 | + * @since 3.11.2 |
|
| 742 | + * @access private |
|
| 743 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 744 | + */ |
|
| 745 | + private static $instance; |
|
| 746 | + |
|
| 747 | + /** |
|
| 748 | + * A singleton instance of features registry. |
|
| 749 | + * @since 3.30.0 |
|
| 750 | + * @var Features_Registry |
|
| 751 | + */ |
|
| 752 | + private $features_registry; |
|
| 753 | + |
|
| 754 | + //</editor-fold> |
|
| 755 | + |
|
| 756 | + /** |
|
| 757 | + * Define the core functionality of the plugin. |
|
| 758 | + * |
|
| 759 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 760 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 761 | + * the public-facing side of the site. |
|
| 762 | + * |
|
| 763 | + * @since 1.0.0 |
|
| 764 | + */ |
|
| 765 | + public function __construct() { |
|
| 766 | + |
|
| 767 | + self::$instance = $this; |
|
| 768 | + |
|
| 769 | + $this->plugin_name = 'wordlift'; |
|
| 770 | + $this->version = '3.31.6'; |
|
| 771 | + $this->load_dependencies(); |
|
| 772 | + $this->set_locale(); |
|
| 773 | + $this->define_admin_hooks(); |
|
| 774 | + $this->define_public_hooks(); |
|
| 775 | + |
|
| 776 | + // If we're in `WP_CLI` load the related files. |
|
| 777 | + if ( class_exists( 'WP_CLI' ) ) { |
|
| 778 | + $this->load_cli_dependencies(); |
|
| 779 | + } |
|
| 780 | + |
|
| 781 | + } |
|
| 782 | + |
|
| 783 | + /** |
|
| 784 | + * Get the singleton instance. |
|
| 785 | + * |
|
| 786 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 787 | + * @since 3.11.2 |
|
| 788 | + * |
|
| 789 | + */ |
|
| 790 | + public static function get_instance() { |
|
| 791 | + |
|
| 792 | + return self::$instance; |
|
| 793 | + } |
|
| 794 | + |
|
| 795 | + /** |
|
| 796 | + * Load the required dependencies for this plugin. |
|
| 797 | + * |
|
| 798 | + * Include the following files that make up the plugin: |
|
| 799 | + * |
|
| 800 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 801 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 802 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 803 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 804 | + * |
|
| 805 | + * Create an instance of the loader which will be used to register the hooks |
|
| 806 | + * with WordPress. |
|
| 807 | + * |
|
| 808 | + * @throws Exception |
|
| 809 | + * @since 1.0.0 |
|
| 810 | + * @access private |
|
| 811 | + */ |
|
| 812 | + private function load_dependencies() { |
|
| 813 | + |
|
| 814 | + /** |
|
| 815 | + * The class responsible for orchestrating the actions and filters of the |
|
| 816 | + * core plugin. |
|
| 817 | + */ |
|
| 818 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 819 | + |
|
| 820 | + // The class responsible for plugin uninstall. |
|
| 821 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 822 | + |
|
| 823 | + /** |
|
| 824 | + * The class responsible for defining internationalization functionality |
|
| 825 | + * of the plugin. |
|
| 826 | + */ |
|
| 827 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 828 | + |
|
| 829 | + /** |
|
| 830 | + * WordLift's supported languages. |
|
| 831 | + */ |
|
| 832 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 833 | + |
|
| 834 | + /** |
|
| 835 | + * WordLift's supported countries. |
|
| 836 | + */ |
|
| 837 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 838 | + |
|
| 839 | + /** |
|
| 840 | + * Provide support functions to sanitize data. |
|
| 841 | + */ |
|
| 842 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 843 | + |
|
| 844 | + /** Services. */ |
|
| 845 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 846 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 847 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 848 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 849 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 850 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 851 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 852 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 853 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 854 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 855 | + |
|
| 856 | + /** |
|
| 857 | + * The Query builder. |
|
| 858 | + */ |
|
| 859 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 860 | + |
|
| 861 | + /** |
|
| 862 | + * The Schema service. |
|
| 863 | + */ |
|
| 864 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 865 | + |
|
| 866 | + /** |
|
| 867 | + * The schema:url property service. |
|
| 868 | + */ |
|
| 869 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 870 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 871 | + |
|
| 872 | + /** |
|
| 873 | + * The UI service. |
|
| 874 | + */ |
|
| 875 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 876 | + |
|
| 877 | + /** |
|
| 878 | + * The Thumbnail service. |
|
| 879 | + */ |
|
| 880 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 881 | + |
|
| 882 | + /** |
|
| 883 | + * The Entity Types Taxonomy service. |
|
| 884 | + */ |
|
| 885 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 886 | + |
|
| 887 | + /** |
|
| 888 | + * The Entity service. |
|
| 889 | + */ |
|
| 890 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 891 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 892 | + |
|
| 893 | + // Add the entity rating service. |
|
| 894 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 895 | + |
|
| 896 | + /** |
|
| 897 | + * The User service. |
|
| 898 | + */ |
|
| 899 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 900 | + |
|
| 901 | + /** |
|
| 902 | + * The Timeline service. |
|
| 903 | + */ |
|
| 904 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 905 | + |
|
| 906 | + /** |
|
| 907 | + * The Topic Taxonomy service. |
|
| 908 | + */ |
|
| 909 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 910 | + |
|
| 911 | + /** |
|
| 912 | + * The SPARQL service. |
|
| 913 | + */ |
|
| 914 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 915 | + |
|
| 916 | + /** |
|
| 917 | + * The WordLift import service. |
|
| 918 | + */ |
|
| 919 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 920 | + |
|
| 921 | + /** |
|
| 922 | + * The WordLift URI service. |
|
| 923 | + */ |
|
| 924 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 925 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 926 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 927 | + |
|
| 928 | + /** |
|
| 929 | + * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 930 | + */ |
|
| 931 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 932 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 933 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 934 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 935 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 936 | + |
|
| 937 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 938 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 939 | + |
|
| 940 | + /** |
|
| 941 | + * Load the converters. |
|
| 942 | + */ |
|
| 943 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 944 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 945 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 946 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 947 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 948 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 949 | + |
|
| 950 | + /** |
|
| 951 | + * Load cache-related files. |
|
| 952 | + */ |
|
| 953 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 954 | + |
|
| 955 | + /** |
|
| 956 | + * Load the content filter. |
|
| 957 | + */ |
|
| 958 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 959 | + |
|
| 960 | + /* |
|
| 961 | 961 | * Load the excerpt helper. |
| 962 | 962 | */ |
| 963 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 964 | - |
|
| 965 | - /** |
|
| 966 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 967 | - * |
|
| 968 | - * @since 3.8.0 |
|
| 969 | - */ |
|
| 970 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 971 | - |
|
| 972 | - // The Publisher Service and the AJAX adapter. |
|
| 973 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 974 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 975 | - |
|
| 976 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 977 | - |
|
| 978 | - /** |
|
| 979 | - * Load the WordLift key validation service. |
|
| 980 | - */ |
|
| 981 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 982 | - |
|
| 983 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 984 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 985 | - |
|
| 986 | - // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 987 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 988 | - |
|
| 989 | - /** Linked Data. */ |
|
| 990 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 991 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 992 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 993 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 994 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 996 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 997 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 999 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 1000 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 1001 | - |
|
| 1002 | - /** Linked Data Rendition. */ |
|
| 1003 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 1004 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 1005 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 1006 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 1007 | - |
|
| 1008 | - /** Services. */ |
|
| 1009 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 1010 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 1011 | - |
|
| 1012 | - /** Adapters. */ |
|
| 1013 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 1014 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 1015 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 1016 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 1017 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 1018 | - |
|
| 1019 | - /** Async Tasks. */ |
|
| 1020 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 1021 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1022 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1023 | - |
|
| 1024 | - /** Autocomplete. */ |
|
| 1025 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1026 | - |
|
| 1027 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1028 | - |
|
| 1029 | - /** Analytics */ |
|
| 1030 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1031 | - |
|
| 1032 | - /** |
|
| 1033 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 1034 | - */ |
|
| 1035 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1036 | - |
|
| 1037 | - /** |
|
| 1038 | - * The class to customize the entity list admin page. |
|
| 1039 | - */ |
|
| 1040 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1041 | - |
|
| 1042 | - /** |
|
| 1043 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1044 | - */ |
|
| 1045 | - global $wp_version; |
|
| 1046 | - if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 1047 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1048 | - } else { |
|
| 1049 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1050 | - } |
|
| 1051 | - |
|
| 1052 | - /** |
|
| 1053 | - * The Notice service. |
|
| 1054 | - */ |
|
| 1055 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1056 | - |
|
| 1057 | - /** |
|
| 1058 | - * The PrimaShop adapter. |
|
| 1059 | - */ |
|
| 1060 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1061 | - |
|
| 1062 | - /** |
|
| 1063 | - * The WordLift Dashboard service. |
|
| 1064 | - */ |
|
| 1065 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1066 | - |
|
| 1067 | - /** |
|
| 1068 | - * The admin 'Install wizard' page. |
|
| 1069 | - */ |
|
| 1070 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1071 | - |
|
| 1072 | - /** |
|
| 1073 | - * The WordLift entity type list admin page controller. |
|
| 1074 | - */ |
|
| 1075 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1076 | - |
|
| 1077 | - /** |
|
| 1078 | - * The WordLift entity type settings admin page controller. |
|
| 1079 | - */ |
|
| 1080 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1081 | - |
|
| 1082 | - /** |
|
| 1083 | - * The admin 'Download Your Data' page. |
|
| 1084 | - */ |
|
| 1085 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1086 | - |
|
| 1087 | - /** |
|
| 1088 | - * The admin 'WordLift Settings' page. |
|
| 1089 | - */ |
|
| 1090 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1091 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1092 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1093 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1094 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1095 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1096 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1097 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1098 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1099 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1100 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1101 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1102 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1103 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1104 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1105 | - |
|
| 1106 | - /** Admin Pages */ |
|
| 1107 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1108 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1109 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1110 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1111 | - |
|
| 1112 | - /** |
|
| 1113 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 1114 | - * side of the site. |
|
| 1115 | - */ |
|
| 1116 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1117 | - |
|
| 1118 | - /** |
|
| 1119 | - * The shortcode abstract class. |
|
| 1120 | - */ |
|
| 1121 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1122 | - |
|
| 1123 | - /** |
|
| 1124 | - * The Timeline shortcode. |
|
| 1125 | - */ |
|
| 1126 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1127 | - |
|
| 1128 | - /** |
|
| 1129 | - * The Navigator shortcode. |
|
| 1130 | - */ |
|
| 1131 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1132 | - |
|
| 1133 | - /** |
|
| 1134 | - * The Products Navigator shortcode. |
|
| 1135 | - */ |
|
| 1136 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 1137 | - |
|
| 1138 | - /** |
|
| 1139 | - * The chord shortcode. |
|
| 1140 | - */ |
|
| 1141 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1142 | - |
|
| 1143 | - /** |
|
| 1144 | - * The geomap shortcode. |
|
| 1145 | - */ |
|
| 1146 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1147 | - |
|
| 1148 | - /** |
|
| 1149 | - * The entity cloud shortcode. |
|
| 1150 | - */ |
|
| 1151 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1152 | - |
|
| 1153 | - /** |
|
| 1154 | - * The entity glossary shortcode. |
|
| 1155 | - */ |
|
| 1156 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1157 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1158 | - |
|
| 1159 | - /** |
|
| 1160 | - * Faceted Search shortcode. |
|
| 1161 | - */ |
|
| 1162 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1163 | - |
|
| 1164 | - /** |
|
| 1165 | - * The ShareThis service. |
|
| 1166 | - */ |
|
| 1167 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1168 | - |
|
| 1169 | - /** |
|
| 1170 | - * The SEO service. |
|
| 1171 | - */ |
|
| 1172 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1173 | - |
|
| 1174 | - /** |
|
| 1175 | - * The AMP service. |
|
| 1176 | - */ |
|
| 1177 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1178 | - |
|
| 1179 | - /** Widgets */ |
|
| 1180 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1181 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1182 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1183 | - |
|
| 1184 | - /* |
|
| 963 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 964 | + |
|
| 965 | + /** |
|
| 966 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 967 | + * |
|
| 968 | + * @since 3.8.0 |
|
| 969 | + */ |
|
| 970 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 971 | + |
|
| 972 | + // The Publisher Service and the AJAX adapter. |
|
| 973 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 974 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 975 | + |
|
| 976 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 977 | + |
|
| 978 | + /** |
|
| 979 | + * Load the WordLift key validation service. |
|
| 980 | + */ |
|
| 981 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 982 | + |
|
| 983 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 984 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 985 | + |
|
| 986 | + // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 987 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 988 | + |
|
| 989 | + /** Linked Data. */ |
|
| 990 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 991 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 992 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 993 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 994 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 995 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 996 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 997 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 998 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 999 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 1000 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 1001 | + |
|
| 1002 | + /** Linked Data Rendition. */ |
|
| 1003 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 1004 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 1005 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 1006 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 1007 | + |
|
| 1008 | + /** Services. */ |
|
| 1009 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 1010 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 1011 | + |
|
| 1012 | + /** Adapters. */ |
|
| 1013 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 1014 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 1015 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 1016 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 1017 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 1018 | + |
|
| 1019 | + /** Async Tasks. */ |
|
| 1020 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 1021 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1022 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1023 | + |
|
| 1024 | + /** Autocomplete. */ |
|
| 1025 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1026 | + |
|
| 1027 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1028 | + |
|
| 1029 | + /** Analytics */ |
|
| 1030 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1031 | + |
|
| 1032 | + /** |
|
| 1033 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 1034 | + */ |
|
| 1035 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1036 | + |
|
| 1037 | + /** |
|
| 1038 | + * The class to customize the entity list admin page. |
|
| 1039 | + */ |
|
| 1040 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1041 | + |
|
| 1042 | + /** |
|
| 1043 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1044 | + */ |
|
| 1045 | + global $wp_version; |
|
| 1046 | + if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 1047 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1048 | + } else { |
|
| 1049 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1050 | + } |
|
| 1051 | + |
|
| 1052 | + /** |
|
| 1053 | + * The Notice service. |
|
| 1054 | + */ |
|
| 1055 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1056 | + |
|
| 1057 | + /** |
|
| 1058 | + * The PrimaShop adapter. |
|
| 1059 | + */ |
|
| 1060 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1061 | + |
|
| 1062 | + /** |
|
| 1063 | + * The WordLift Dashboard service. |
|
| 1064 | + */ |
|
| 1065 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1066 | + |
|
| 1067 | + /** |
|
| 1068 | + * The admin 'Install wizard' page. |
|
| 1069 | + */ |
|
| 1070 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1071 | + |
|
| 1072 | + /** |
|
| 1073 | + * The WordLift entity type list admin page controller. |
|
| 1074 | + */ |
|
| 1075 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1076 | + |
|
| 1077 | + /** |
|
| 1078 | + * The WordLift entity type settings admin page controller. |
|
| 1079 | + */ |
|
| 1080 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1081 | + |
|
| 1082 | + /** |
|
| 1083 | + * The admin 'Download Your Data' page. |
|
| 1084 | + */ |
|
| 1085 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1086 | + |
|
| 1087 | + /** |
|
| 1088 | + * The admin 'WordLift Settings' page. |
|
| 1089 | + */ |
|
| 1090 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1091 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1092 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1093 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1094 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1095 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1096 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1097 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1098 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1099 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1100 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1101 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1102 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1103 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1104 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1105 | + |
|
| 1106 | + /** Admin Pages */ |
|
| 1107 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1108 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1109 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1110 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1111 | + |
|
| 1112 | + /** |
|
| 1113 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 1114 | + * side of the site. |
|
| 1115 | + */ |
|
| 1116 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1117 | + |
|
| 1118 | + /** |
|
| 1119 | + * The shortcode abstract class. |
|
| 1120 | + */ |
|
| 1121 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1122 | + |
|
| 1123 | + /** |
|
| 1124 | + * The Timeline shortcode. |
|
| 1125 | + */ |
|
| 1126 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1127 | + |
|
| 1128 | + /** |
|
| 1129 | + * The Navigator shortcode. |
|
| 1130 | + */ |
|
| 1131 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1132 | + |
|
| 1133 | + /** |
|
| 1134 | + * The Products Navigator shortcode. |
|
| 1135 | + */ |
|
| 1136 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 1137 | + |
|
| 1138 | + /** |
|
| 1139 | + * The chord shortcode. |
|
| 1140 | + */ |
|
| 1141 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1142 | + |
|
| 1143 | + /** |
|
| 1144 | + * The geomap shortcode. |
|
| 1145 | + */ |
|
| 1146 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1147 | + |
|
| 1148 | + /** |
|
| 1149 | + * The entity cloud shortcode. |
|
| 1150 | + */ |
|
| 1151 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1152 | + |
|
| 1153 | + /** |
|
| 1154 | + * The entity glossary shortcode. |
|
| 1155 | + */ |
|
| 1156 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1157 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1158 | + |
|
| 1159 | + /** |
|
| 1160 | + * Faceted Search shortcode. |
|
| 1161 | + */ |
|
| 1162 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1163 | + |
|
| 1164 | + /** |
|
| 1165 | + * The ShareThis service. |
|
| 1166 | + */ |
|
| 1167 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1168 | + |
|
| 1169 | + /** |
|
| 1170 | + * The SEO service. |
|
| 1171 | + */ |
|
| 1172 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1173 | + |
|
| 1174 | + /** |
|
| 1175 | + * The AMP service. |
|
| 1176 | + */ |
|
| 1177 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1178 | + |
|
| 1179 | + /** Widgets */ |
|
| 1180 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1181 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1182 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1183 | + |
|
| 1184 | + /* |
|
| 1185 | 1185 | * Schema.org Services. |
| 1186 | 1186 | * |
| 1187 | 1187 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1188 | 1188 | */ |
| 1189 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1190 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1191 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1192 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1193 | - new Wordlift_Schemaorg_Sync_Service(); |
|
| 1194 | - $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1195 | - new Wordlift_Schemaorg_Class_Service(); |
|
| 1196 | - } else { |
|
| 1197 | - $schemaorg_property_service = null; |
|
| 1198 | - } |
|
| 1199 | - |
|
| 1200 | - $this->loader = new Wordlift_Loader(); |
|
| 1201 | - /** |
|
| 1202 | - * @since 3.30.0 |
|
| 1203 | - */ |
|
| 1204 | - $this->features_registry = Features_Registry::get_instance(); |
|
| 1189 | + if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1190 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1191 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1192 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1193 | + new Wordlift_Schemaorg_Sync_Service(); |
|
| 1194 | + $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1195 | + new Wordlift_Schemaorg_Class_Service(); |
|
| 1196 | + } else { |
|
| 1197 | + $schemaorg_property_service = null; |
|
| 1198 | + } |
|
| 1199 | + |
|
| 1200 | + $this->loader = new Wordlift_Loader(); |
|
| 1201 | + /** |
|
| 1202 | + * @since 3.30.0 |
|
| 1203 | + */ |
|
| 1204 | + $this->features_registry = Features_Registry::get_instance(); |
|
| 1205 | 1205 | |
| 1206 | - // Instantiate a global logger. |
|
| 1207 | - global $wl_logger; |
|
| 1208 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1206 | + // Instantiate a global logger. |
|
| 1207 | + global $wl_logger; |
|
| 1208 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1209 | 1209 | |
| 1210 | - // Load the `wl-api` end-point. |
|
| 1211 | - new Wordlift_Http_Api(); |
|
| 1210 | + // Load the `wl-api` end-point. |
|
| 1211 | + new Wordlift_Http_Api(); |
|
| 1212 | 1212 | |
| 1213 | - // Load the Install Service. |
|
| 1214 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1215 | - $this->install_service = new Wordlift_Install_Service(); |
|
| 1213 | + // Load the Install Service. |
|
| 1214 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1215 | + $this->install_service = new Wordlift_Install_Service(); |
|
| 1216 | 1216 | |
| 1217 | - /** Services. */ |
|
| 1218 | - // Create the configuration service. |
|
| 1219 | - $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1220 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1217 | + /** Services. */ |
|
| 1218 | + // Create the configuration service. |
|
| 1219 | + $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1220 | + $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1221 | 1221 | |
| 1222 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1223 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1222 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1223 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1224 | 1224 | |
| 1225 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1226 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1225 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1226 | + $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1227 | 1227 | |
| 1228 | - // Create an instance of the UI service. |
|
| 1229 | - $this->ui_service = new Wordlift_UI_Service(); |
|
| 1228 | + // Create an instance of the UI service. |
|
| 1229 | + $this->ui_service = new Wordlift_UI_Service(); |
|
| 1230 | 1230 | |
| 1231 | - // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1232 | - $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1231 | + // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1232 | + $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1233 | 1233 | |
| 1234 | - $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1235 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1236 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1237 | - $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1234 | + $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1235 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1236 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1237 | + $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1238 | 1238 | |
| 1239 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1240 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1241 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1242 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1239 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1240 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1241 | + $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1242 | + $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1243 | 1243 | |
| 1244 | - // Instantiate the JSON-LD service. |
|
| 1245 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1244 | + // Instantiate the JSON-LD service. |
|
| 1245 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1246 | 1246 | |
| 1247 | - /** Linked Data. */ |
|
| 1248 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1249 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1247 | + /** Linked Data. */ |
|
| 1248 | + $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1249 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1250 | 1250 | |
| 1251 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1251 | + $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1252 | 1252 | |
| 1253 | - // Create a new instance of the Redirect service. |
|
| 1254 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1255 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1253 | + // Create a new instance of the Redirect service. |
|
| 1254 | + $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1255 | + $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1256 | 1256 | |
| 1257 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1258 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1257 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1258 | + $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1259 | 1259 | |
| 1260 | - $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1260 | + $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1261 | 1261 | |
| 1262 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1263 | - $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1262 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1263 | + $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1264 | 1264 | |
| 1265 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1266 | - $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1265 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1266 | + $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1267 | 1267 | |
| 1268 | - // Create an instance of the PrimaShop adapter. |
|
| 1269 | - $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1268 | + // Create an instance of the PrimaShop adapter. |
|
| 1269 | + $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1270 | 1270 | |
| 1271 | - // Create an import service instance to hook later to WP's import function. |
|
| 1272 | - $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() ); |
|
| 1271 | + // Create an import service instance to hook later to WP's import function. |
|
| 1272 | + $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() ); |
|
| 1273 | 1273 | |
| 1274 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1274 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1275 | 1275 | |
| 1276 | - // Create the entity rating service. |
|
| 1277 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1276 | + // Create the entity rating service. |
|
| 1277 | + $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1278 | 1278 | |
| 1279 | - // Create entity list customization (wp-admin/edit.php). |
|
| 1280 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1279 | + // Create entity list customization (wp-admin/edit.php). |
|
| 1280 | + $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1281 | 1281 | |
| 1282 | - // Create a new instance of the Redirect service. |
|
| 1283 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1282 | + // Create a new instance of the Redirect service. |
|
| 1283 | + $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1284 | 1284 | |
| 1285 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1286 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1287 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1288 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1285 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1286 | + $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1287 | + $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1288 | + $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1289 | 1289 | |
| 1290 | - $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1290 | + $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1291 | 1291 | |
| 1292 | - // Instantiate the JSON-LD service. |
|
| 1293 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1294 | - $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 ); |
|
| 1295 | - $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $this->post_to_jsonld_converter ); |
|
| 1296 | - $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 ); |
|
| 1297 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1292 | + // Instantiate the JSON-LD service. |
|
| 1293 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1294 | + $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 ); |
|
| 1295 | + $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $this->post_to_jsonld_converter ); |
|
| 1296 | + $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 ); |
|
| 1297 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1298 | 1298 | |
| 1299 | - $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1300 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache ); |
|
| 1301 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1299 | + $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1300 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache ); |
|
| 1301 | + $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1302 | 1302 | |
| 1303 | - /* |
|
| 1303 | + /* |
|
| 1304 | 1304 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
| 1305 | 1305 | * |
| 1306 | 1306 | * @see https://github.com/insideout10/wordlift-plugin/issues/892 |
| 1307 | 1307 | * |
| 1308 | 1308 | * @since 3.20.0 |
| 1309 | 1309 | */ |
| 1310 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1311 | - $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1312 | - $jsonld_service = new Jsonld_Service( |
|
| 1313 | - $this->jsonld_service, |
|
| 1314 | - $term_jsonld_adapter, |
|
| 1315 | - new Jsonld_User_Service( $this->user_service ) ); |
|
| 1316 | - new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service ); |
|
| 1317 | - |
|
| 1318 | - // Prints the JSON-LD in the head. |
|
| 1319 | - new Jsonld_Adapter( $this->jsonld_service ); |
|
| 1320 | - |
|
| 1321 | - new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service ); |
|
| 1322 | - |
|
| 1323 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1324 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1325 | - // Creating Faq Content filter service. |
|
| 1326 | - $this->faq_content_filter_service = new Faq_Content_Filter(); |
|
| 1327 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1328 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1329 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1330 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->entity_service ); |
|
| 1331 | - |
|
| 1332 | - $this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' ); |
|
| 1333 | - $this->loader->add_action( 'admin_enqueue_scripts', $this, 'add_wl_enabled_blocks' ); |
|
| 1334 | - |
|
| 1335 | - /** |
|
| 1336 | - * Filter: wl_feature__enable__blocks. |
|
| 1337 | - * |
|
| 1338 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1339 | - * |
|
| 1340 | - * @return bool |
|
| 1341 | - * @since 3.27.6 |
|
| 1342 | - */ |
|
| 1343 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1344 | - // Initialize the short-codes. |
|
| 1345 | - new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
| 1346 | - new Wordlift_Chord_Shortcode(); |
|
| 1347 | - new Wordlift_Geomap_Shortcode(); |
|
| 1348 | - new Wordlift_Timeline_Shortcode(); |
|
| 1349 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service, $this->entity_service ); |
|
| 1350 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1351 | - new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
| 1352 | - } |
|
| 1353 | - |
|
| 1354 | - new Wordlift_Products_Navigator_Shortcode(); |
|
| 1355 | - |
|
| 1356 | - |
|
| 1357 | - // Initialize the Context Cards Service |
|
| 1358 | - $this->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
| 1359 | - |
|
| 1360 | - // Initialize the SEO service. |
|
| 1361 | - new Wordlift_Seo_Service(); |
|
| 1362 | - |
|
| 1363 | - // Initialize the AMP service. |
|
| 1364 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1365 | - |
|
| 1366 | - /** Services. */ |
|
| 1367 | - $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1368 | - new Wordlift_Image_Service(); |
|
| 1369 | - |
|
| 1370 | - /** Adapters. */ |
|
| 1371 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1372 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1373 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1374 | - //$this->faq_tinymce_adapter = new Faq_Tinymce_Adapter(); |
|
| 1375 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1376 | - |
|
| 1377 | - /* |
|
| 1310 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1311 | + $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1312 | + $jsonld_service = new Jsonld_Service( |
|
| 1313 | + $this->jsonld_service, |
|
| 1314 | + $term_jsonld_adapter, |
|
| 1315 | + new Jsonld_User_Service( $this->user_service ) ); |
|
| 1316 | + new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service ); |
|
| 1317 | + |
|
| 1318 | + // Prints the JSON-LD in the head. |
|
| 1319 | + new Jsonld_Adapter( $this->jsonld_service ); |
|
| 1320 | + |
|
| 1321 | + new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service ); |
|
| 1322 | + |
|
| 1323 | + $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1324 | + $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1325 | + // Creating Faq Content filter service. |
|
| 1326 | + $this->faq_content_filter_service = new Faq_Content_Filter(); |
|
| 1327 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1328 | + $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1329 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1330 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->entity_service ); |
|
| 1331 | + |
|
| 1332 | + $this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' ); |
|
| 1333 | + $this->loader->add_action( 'admin_enqueue_scripts', $this, 'add_wl_enabled_blocks' ); |
|
| 1334 | + |
|
| 1335 | + /** |
|
| 1336 | + * Filter: wl_feature__enable__blocks. |
|
| 1337 | + * |
|
| 1338 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1339 | + * |
|
| 1340 | + * @return bool |
|
| 1341 | + * @since 3.27.6 |
|
| 1342 | + */ |
|
| 1343 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1344 | + // Initialize the short-codes. |
|
| 1345 | + new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
| 1346 | + new Wordlift_Chord_Shortcode(); |
|
| 1347 | + new Wordlift_Geomap_Shortcode(); |
|
| 1348 | + new Wordlift_Timeline_Shortcode(); |
|
| 1349 | + new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service, $this->entity_service ); |
|
| 1350 | + new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1351 | + new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
| 1352 | + } |
|
| 1353 | + |
|
| 1354 | + new Wordlift_Products_Navigator_Shortcode(); |
|
| 1355 | + |
|
| 1356 | + |
|
| 1357 | + // Initialize the Context Cards Service |
|
| 1358 | + $this->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
| 1359 | + |
|
| 1360 | + // Initialize the SEO service. |
|
| 1361 | + new Wordlift_Seo_Service(); |
|
| 1362 | + |
|
| 1363 | + // Initialize the AMP service. |
|
| 1364 | + new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1365 | + |
|
| 1366 | + /** Services. */ |
|
| 1367 | + $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1368 | + new Wordlift_Image_Service(); |
|
| 1369 | + |
|
| 1370 | + /** Adapters. */ |
|
| 1371 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1372 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1373 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1374 | + //$this->faq_tinymce_adapter = new Faq_Tinymce_Adapter(); |
|
| 1375 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1376 | + |
|
| 1377 | + /* |
|
| 1378 | 1378 | * Exclude our public js from WP-Rocket. |
| 1379 | 1379 | * |
| 1380 | 1380 | * @since 3.19.4 |
| 1381 | 1381 | * |
| 1382 | 1382 | * @see https://github.com/insideout10/wordlift-plugin/issues/842. |
| 1383 | 1383 | */ |
| 1384 | - new Wordlift_WpRocket_Adapter(); |
|
| 1385 | - |
|
| 1386 | - // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1387 | - $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1388 | - $this->sparql_service, |
|
| 1389 | - $uri_service |
|
| 1390 | - ); |
|
| 1391 | - |
|
| 1392 | - $that = $this; |
|
| 1393 | - add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1394 | - if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) { |
|
| 1395 | - new Wordlift_Linked_Data_Service( $that->entity_service, $that->entity_type_service, $that->schema_service, $that->sparql_service ); |
|
| 1396 | - new Wordlift_Sparql_Query_Async_Task(); |
|
| 1397 | - new Wordlift_Push_References_Async_Task(); |
|
| 1398 | - } |
|
| 1399 | - } ); |
|
| 1400 | - |
|
| 1401 | - /** WordPress Admin UI. */ |
|
| 1402 | - |
|
| 1403 | - // UI elements. |
|
| 1404 | - $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1405 | - $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1406 | - $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1407 | - $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1408 | - $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1409 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1410 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1411 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1412 | - |
|
| 1413 | - $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 1414 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1415 | - |
|
| 1416 | - $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1417 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1418 | - $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1419 | - |
|
| 1420 | - // Pages. |
|
| 1421 | - /* |
|
| 1384 | + new Wordlift_WpRocket_Adapter(); |
|
| 1385 | + |
|
| 1386 | + // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1387 | + $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1388 | + $this->sparql_service, |
|
| 1389 | + $uri_service |
|
| 1390 | + ); |
|
| 1391 | + |
|
| 1392 | + $that = $this; |
|
| 1393 | + add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1394 | + if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) { |
|
| 1395 | + new Wordlift_Linked_Data_Service( $that->entity_service, $that->entity_type_service, $that->schema_service, $that->sparql_service ); |
|
| 1396 | + new Wordlift_Sparql_Query_Async_Task(); |
|
| 1397 | + new Wordlift_Push_References_Async_Task(); |
|
| 1398 | + } |
|
| 1399 | + } ); |
|
| 1400 | + |
|
| 1401 | + /** WordPress Admin UI. */ |
|
| 1402 | + |
|
| 1403 | + // UI elements. |
|
| 1404 | + $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1405 | + $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1406 | + $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1407 | + $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1408 | + $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1409 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1410 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1411 | + $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1412 | + |
|
| 1413 | + $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 1414 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1415 | + |
|
| 1416 | + $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1417 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1418 | + $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1419 | + |
|
| 1420 | + // Pages. |
|
| 1421 | + /* |
|
| 1422 | 1422 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
| 1423 | 1423 | * |
| 1424 | 1424 | * @since 3.20.3 |
| 1425 | 1425 | * |
| 1426 | 1426 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1427 | 1427 | */ |
| 1428 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1429 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1430 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1431 | - } |
|
| 1432 | - new Wordlift_Entity_Type_Admin_Service(); |
|
| 1428 | + if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1429 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1430 | + new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1431 | + } |
|
| 1432 | + new Wordlift_Entity_Type_Admin_Service(); |
|
| 1433 | 1433 | |
| 1434 | - // create an instance of the entity type list admin page controller. |
|
| 1435 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1434 | + // create an instance of the entity type list admin page controller. |
|
| 1435 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1436 | 1436 | |
| 1437 | - // create an instance of the entity type setting admin page controller. |
|
| 1438 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1437 | + // create an instance of the entity type setting admin page controller. |
|
| 1438 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1439 | 1439 | |
| 1440 | - /** Widgets */ |
|
| 1441 | - $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1440 | + /** Widgets */ |
|
| 1441 | + $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1442 | 1442 | |
| 1443 | - /* WordPress Admin. */ |
|
| 1444 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1445 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1443 | + /* WordPress Admin. */ |
|
| 1444 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1445 | + $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1446 | 1446 | |
| 1447 | - // Create an instance of the install wizard. |
|
| 1448 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
| 1447 | + // Create an instance of the install wizard. |
|
| 1448 | + $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
| 1449 | 1449 | |
| 1450 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1450 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1451 | 1451 | |
| 1452 | - // User Profile. |
|
| 1453 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1452 | + // User Profile. |
|
| 1453 | + new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1454 | 1454 | |
| 1455 | - $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1455 | + $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1456 | 1456 | |
| 1457 | - // Load the debug service if WP is in debug mode. |
|
| 1458 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1459 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1460 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1461 | - } |
|
| 1457 | + // Load the debug service if WP is in debug mode. |
|
| 1458 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1459 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1460 | + new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1461 | + } |
|
| 1462 | 1462 | |
| 1463 | - // Remote Image Service. |
|
| 1464 | - new Wordlift_Remote_Image_Service(); |
|
| 1463 | + // Remote Image Service. |
|
| 1464 | + new Wordlift_Remote_Image_Service(); |
|
| 1465 | 1465 | |
| 1466 | - /* |
|
| 1466 | + /* |
|
| 1467 | 1467 | * Provides mappings between post types and entity types. |
| 1468 | 1468 | * |
| 1469 | 1469 | * @since 3.20.0 |
| 1470 | 1470 | * |
| 1471 | 1471 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1472 | 1472 | */ |
| 1473 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1474 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1475 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1473 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1474 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1475 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1476 | 1476 | |
| 1477 | - // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1478 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1477 | + // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1478 | + new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1479 | 1479 | |
| 1480 | - /* |
|
| 1480 | + /* |
|
| 1481 | 1481 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
| 1482 | 1482 | * |
| 1483 | 1483 | * Eventually Batch Actions will become Batch Operations. |
| 1484 | 1484 | * |
| 1485 | 1485 | * @since 3.20.0 |
| 1486 | 1486 | */ |
| 1487 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1488 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1487 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1488 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1489 | 1489 | |
| 1490 | - /* |
|
| 1490 | + /* |
|
| 1491 | 1491 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
| 1492 | 1492 | * |
| 1493 | 1493 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
| 1494 | 1494 | * |
| 1495 | 1495 | * @since 3.20.0 |
| 1496 | 1496 | */ |
| 1497 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1498 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1497 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1498 | + new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1499 | 1499 | |
| 1500 | - /* |
|
| 1500 | + /* |
|
| 1501 | 1501 | * Load the Mappings JSON-LD post processing. |
| 1502 | 1502 | * |
| 1503 | 1503 | * @since 3.25.0 |
| 1504 | 1504 | */ |
| 1505 | 1505 | |
| 1506 | - $mappings_dbo = new Mappings_DBO(); |
|
| 1507 | - $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
| 1508 | - new Post_Type_Rule_Validator(); |
|
| 1509 | - // Taxonomy term rule validator for validating rules for term pages. |
|
| 1510 | - new Taxonomy_Term_Rule_Validator(); |
|
| 1511 | - new Post_Taxonomy_Term_Rule_Validator(); |
|
| 1512 | - $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1513 | - $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1514 | - $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1515 | - |
|
| 1516 | - new Url_To_Entity_Transform_Function( $this->entity_uri_service ); |
|
| 1517 | - new Taxonomy_To_Terms_Transform_Function(); |
|
| 1518 | - new Post_Id_To_Entity_Transform_Function(); |
|
| 1519 | - $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
| 1520 | - |
|
| 1521 | - /** |
|
| 1522 | - * @since 3.27.1 |
|
| 1523 | - * Intiailize the acf group data formatter. |
|
| 1524 | - */ |
|
| 1525 | - new Acf_Group_Formatter(); |
|
| 1526 | - new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1527 | - |
|
| 1528 | - /** |
|
| 1529 | - * @since 3.26.0 |
|
| 1530 | - * Initialize the Faq JSON LD converter here - disabled. |
|
| 1531 | - */ |
|
| 1532 | - // new Faq_To_Jsonld_Converter(); |
|
| 1533 | - /* |
|
| 1506 | + $mappings_dbo = new Mappings_DBO(); |
|
| 1507 | + $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
| 1508 | + new Post_Type_Rule_Validator(); |
|
| 1509 | + // Taxonomy term rule validator for validating rules for term pages. |
|
| 1510 | + new Taxonomy_Term_Rule_Validator(); |
|
| 1511 | + new Post_Taxonomy_Term_Rule_Validator(); |
|
| 1512 | + $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1513 | + $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1514 | + $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1515 | + |
|
| 1516 | + new Url_To_Entity_Transform_Function( $this->entity_uri_service ); |
|
| 1517 | + new Taxonomy_To_Terms_Transform_Function(); |
|
| 1518 | + new Post_Id_To_Entity_Transform_Function(); |
|
| 1519 | + $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
| 1520 | + |
|
| 1521 | + /** |
|
| 1522 | + * @since 3.27.1 |
|
| 1523 | + * Intiailize the acf group data formatter. |
|
| 1524 | + */ |
|
| 1525 | + new Acf_Group_Formatter(); |
|
| 1526 | + new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1527 | + |
|
| 1528 | + /** |
|
| 1529 | + * @since 3.26.0 |
|
| 1530 | + * Initialize the Faq JSON LD converter here - disabled. |
|
| 1531 | + */ |
|
| 1532 | + // new Faq_To_Jsonld_Converter(); |
|
| 1533 | + /* |
|
| 1534 | 1534 | * Use the Templates Ajax Endpoint to load HTML templates for the legacy Angular app via admin-ajax.php |
| 1535 | 1535 | * end-point. |
| 1536 | 1536 | * |
| 1537 | 1537 | * @see https://github.com/insideout10/wordlift-plugin/issues/834 |
| 1538 | 1538 | * @since 3.24.4 |
| 1539 | 1539 | */ |
| 1540 | - new Templates_Ajax_Endpoint(); |
|
| 1541 | - // Call this static method to register FAQ routes to rest api - disabled |
|
| 1542 | - //Faq_Rest_Controller::register_routes(); |
|
| 1540 | + new Templates_Ajax_Endpoint(); |
|
| 1541 | + // Call this static method to register FAQ routes to rest api - disabled |
|
| 1542 | + //Faq_Rest_Controller::register_routes(); |
|
| 1543 | 1543 | |
| 1544 | - /* |
|
| 1544 | + /* |
|
| 1545 | 1545 | * Create a singleton for the Analysis_Response_Ops_Factory. |
| 1546 | 1546 | */ |
| 1547 | - $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service ); |
|
| 1548 | - new Analysis_Response_Ops_Factory( |
|
| 1549 | - $this->entity_uri_service, |
|
| 1550 | - $this->entity_service, |
|
| 1551 | - $this->entity_type_service, |
|
| 1552 | - $this->storage_factory->post_images(), |
|
| 1553 | - $entity_helper |
|
| 1554 | - ); |
|
| 1555 | - |
|
| 1556 | - /** WL Autocomplete. */ |
|
| 1557 | - $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1558 | - new Local_Autocomplete_Service(), |
|
| 1559 | - new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ), |
|
| 1560 | - ) ); |
|
| 1561 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1562 | - |
|
| 1563 | - /** |
|
| 1564 | - * @since 3.27.2 |
|
| 1565 | - * Integrate the recipe maker jsonld & set recipe |
|
| 1566 | - * as default entity type to the wprm_recipe CPT. |
|
| 1567 | - */ |
|
| 1568 | - new Recipe_Maker_Post_Type_Hook(); |
|
| 1569 | - $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
| 1570 | - new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1571 | - new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1572 | - new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1573 | - new Yoast_Jsonld( $recipe_maker_validation_service ); |
|
| 1574 | - |
|
| 1575 | - /** |
|
| 1576 | - * @since 3.27.4 |
|
| 1577 | - * Add the faq duplicate markup hook. |
|
| 1578 | - */ |
|
| 1579 | - new Faq_Duplicate_Markup_Remover(); |
|
| 1580 | - /** |
|
| 1581 | - * @since 3.27.8 |
|
| 1582 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
|
| 1583 | - */ |
|
| 1584 | - new Key_Validation_Notice( $this->key_validation_service, $this->configuration_service ); |
|
| 1585 | - /** |
|
| 1586 | - * @since 3.28.0 |
|
| 1587 | - * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen |
|
| 1588 | - */ |
|
| 1589 | - new Entity_No_Index_Flag(); |
|
| 1590 | - |
|
| 1591 | - /** |
|
| 1592 | - * @since 3.29.0 |
|
| 1593 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1304 |
|
| 1594 | - */ |
|
| 1595 | - new Entity_Rest_Service( $this->entity_type_service ); |
|
| 1596 | - |
|
| 1597 | - /** |
|
| 1598 | - * Expand author in to references. |
|
| 1599 | - * @since 3.30.0 |
|
| 1600 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1318 |
|
| 1601 | - */ |
|
| 1602 | - |
|
| 1603 | - add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1604 | - |
|
| 1605 | - if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) { |
|
| 1606 | - new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter ); |
|
| 1607 | - } |
|
| 1608 | - |
|
| 1609 | - if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) { |
|
| 1610 | - $vocabulary_loader = new Vocabulary_Loader(); |
|
| 1611 | - $vocabulary_loader->init_vocabulary(); |
|
| 1612 | - } |
|
| 1613 | - |
|
| 1614 | - } ); |
|
| 1615 | - |
|
| 1616 | - /** |
|
| 1617 | - * @since 3.30.0 |
|
| 1618 | - * Add a checkbox to user option screen for wordlift admin. |
|
| 1619 | - */ |
|
| 1620 | - $wordlift_admin_checkbox = new Admin_User_Option(); |
|
| 1621 | - $wordlift_admin_checkbox->connect_hook(); |
|
| 1622 | - /** |
|
| 1623 | - * @since 3.31.0 |
|
| 1624 | - * Init loader class for videoobject. |
|
| 1625 | - */ |
|
| 1626 | - $videoobject_loader = new Loader(); |
|
| 1627 | - $videoobject_loader->init_feature(); |
|
| 1628 | - /** |
|
| 1629 | - * @since 3.31.5 |
|
| 1630 | - * Create configuration endpoint for webapp to configure. |
|
| 1631 | - */ |
|
| 1632 | - new Config( $this->admin_setup, $this->key_validation_service, $this->configuration_service ); |
|
| 1633 | - } |
|
| 1634 | - |
|
| 1635 | - /** |
|
| 1636 | - * Define the locale for this plugin for internationalization. |
|
| 1637 | - * |
|
| 1638 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1639 | - * with WordPress. |
|
| 1640 | - * |
|
| 1641 | - * @since 1.0.0 |
|
| 1642 | - * @access private |
|
| 1643 | - */ |
|
| 1644 | - private function set_locale() { |
|
| 1645 | - |
|
| 1646 | - $plugin_i18n = new Wordlift_i18n(); |
|
| 1647 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1648 | - |
|
| 1649 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1650 | - |
|
| 1651 | - } |
|
| 1652 | - |
|
| 1653 | - /** |
|
| 1654 | - * Register all of the hooks related to the admin area functionality |
|
| 1655 | - * of the plugin. |
|
| 1656 | - * |
|
| 1657 | - * @since 1.0.0 |
|
| 1658 | - * @access private |
|
| 1659 | - */ |
|
| 1660 | - private function define_admin_hooks() { |
|
| 1661 | - $that = $this; |
|
| 1662 | - $plugin_admin = new Wordlift_Admin( |
|
| 1663 | - $this->get_plugin_name(), |
|
| 1664 | - $this->get_version(), |
|
| 1665 | - $this->configuration_service, |
|
| 1666 | - $this->notice_service, |
|
| 1667 | - $this->user_service |
|
| 1668 | - ); |
|
| 1669 | - |
|
| 1670 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1671 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1672 | - |
|
| 1673 | - // Hook the init action to taxonomy services. |
|
| 1674 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1675 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1676 | - |
|
| 1677 | - // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1678 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1679 | - |
|
| 1680 | - // Hook the added_post_meta action to the Thumbnail service. |
|
| 1681 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1682 | - |
|
| 1683 | - // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1684 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1685 | - |
|
| 1686 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1687 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1688 | - |
|
| 1689 | - // Register custom allowed redirect hosts. |
|
| 1690 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1691 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1692 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1693 | - |
|
| 1694 | - /* |
|
| 1547 | + $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service ); |
|
| 1548 | + new Analysis_Response_Ops_Factory( |
|
| 1549 | + $this->entity_uri_service, |
|
| 1550 | + $this->entity_service, |
|
| 1551 | + $this->entity_type_service, |
|
| 1552 | + $this->storage_factory->post_images(), |
|
| 1553 | + $entity_helper |
|
| 1554 | + ); |
|
| 1555 | + |
|
| 1556 | + /** WL Autocomplete. */ |
|
| 1557 | + $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1558 | + new Local_Autocomplete_Service(), |
|
| 1559 | + new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ), |
|
| 1560 | + ) ); |
|
| 1561 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1562 | + |
|
| 1563 | + /** |
|
| 1564 | + * @since 3.27.2 |
|
| 1565 | + * Integrate the recipe maker jsonld & set recipe |
|
| 1566 | + * as default entity type to the wprm_recipe CPT. |
|
| 1567 | + */ |
|
| 1568 | + new Recipe_Maker_Post_Type_Hook(); |
|
| 1569 | + $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
| 1570 | + new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1571 | + new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1572 | + new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1573 | + new Yoast_Jsonld( $recipe_maker_validation_service ); |
|
| 1574 | + |
|
| 1575 | + /** |
|
| 1576 | + * @since 3.27.4 |
|
| 1577 | + * Add the faq duplicate markup hook. |
|
| 1578 | + */ |
|
| 1579 | + new Faq_Duplicate_Markup_Remover(); |
|
| 1580 | + /** |
|
| 1581 | + * @since 3.27.8 |
|
| 1582 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
|
| 1583 | + */ |
|
| 1584 | + new Key_Validation_Notice( $this->key_validation_service, $this->configuration_service ); |
|
| 1585 | + /** |
|
| 1586 | + * @since 3.28.0 |
|
| 1587 | + * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen |
|
| 1588 | + */ |
|
| 1589 | + new Entity_No_Index_Flag(); |
|
| 1590 | + |
|
| 1591 | + /** |
|
| 1592 | + * @since 3.29.0 |
|
| 1593 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1304 |
|
| 1594 | + */ |
|
| 1595 | + new Entity_Rest_Service( $this->entity_type_service ); |
|
| 1596 | + |
|
| 1597 | + /** |
|
| 1598 | + * Expand author in to references. |
|
| 1599 | + * @since 3.30.0 |
|
| 1600 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1318 |
|
| 1601 | + */ |
|
| 1602 | + |
|
| 1603 | + add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1604 | + |
|
| 1605 | + if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) { |
|
| 1606 | + new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter ); |
|
| 1607 | + } |
|
| 1608 | + |
|
| 1609 | + if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) { |
|
| 1610 | + $vocabulary_loader = new Vocabulary_Loader(); |
|
| 1611 | + $vocabulary_loader->init_vocabulary(); |
|
| 1612 | + } |
|
| 1613 | + |
|
| 1614 | + } ); |
|
| 1615 | + |
|
| 1616 | + /** |
|
| 1617 | + * @since 3.30.0 |
|
| 1618 | + * Add a checkbox to user option screen for wordlift admin. |
|
| 1619 | + */ |
|
| 1620 | + $wordlift_admin_checkbox = new Admin_User_Option(); |
|
| 1621 | + $wordlift_admin_checkbox->connect_hook(); |
|
| 1622 | + /** |
|
| 1623 | + * @since 3.31.0 |
|
| 1624 | + * Init loader class for videoobject. |
|
| 1625 | + */ |
|
| 1626 | + $videoobject_loader = new Loader(); |
|
| 1627 | + $videoobject_loader->init_feature(); |
|
| 1628 | + /** |
|
| 1629 | + * @since 3.31.5 |
|
| 1630 | + * Create configuration endpoint for webapp to configure. |
|
| 1631 | + */ |
|
| 1632 | + new Config( $this->admin_setup, $this->key_validation_service, $this->configuration_service ); |
|
| 1633 | + } |
|
| 1634 | + |
|
| 1635 | + /** |
|
| 1636 | + * Define the locale for this plugin for internationalization. |
|
| 1637 | + * |
|
| 1638 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1639 | + * with WordPress. |
|
| 1640 | + * |
|
| 1641 | + * @since 1.0.0 |
|
| 1642 | + * @access private |
|
| 1643 | + */ |
|
| 1644 | + private function set_locale() { |
|
| 1645 | + |
|
| 1646 | + $plugin_i18n = new Wordlift_i18n(); |
|
| 1647 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1648 | + |
|
| 1649 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1650 | + |
|
| 1651 | + } |
|
| 1652 | + |
|
| 1653 | + /** |
|
| 1654 | + * Register all of the hooks related to the admin area functionality |
|
| 1655 | + * of the plugin. |
|
| 1656 | + * |
|
| 1657 | + * @since 1.0.0 |
|
| 1658 | + * @access private |
|
| 1659 | + */ |
|
| 1660 | + private function define_admin_hooks() { |
|
| 1661 | + $that = $this; |
|
| 1662 | + $plugin_admin = new Wordlift_Admin( |
|
| 1663 | + $this->get_plugin_name(), |
|
| 1664 | + $this->get_version(), |
|
| 1665 | + $this->configuration_service, |
|
| 1666 | + $this->notice_service, |
|
| 1667 | + $this->user_service |
|
| 1668 | + ); |
|
| 1669 | + |
|
| 1670 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1671 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1672 | + |
|
| 1673 | + // Hook the init action to taxonomy services. |
|
| 1674 | + $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1675 | + $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1676 | + |
|
| 1677 | + // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1678 | + $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1679 | + |
|
| 1680 | + // Hook the added_post_meta action to the Thumbnail service. |
|
| 1681 | + $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1682 | + |
|
| 1683 | + // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1684 | + $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1685 | + |
|
| 1686 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1687 | + $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1688 | + |
|
| 1689 | + // Register custom allowed redirect hosts. |
|
| 1690 | + $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1691 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1692 | + $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1693 | + |
|
| 1694 | + /* |
|
| 1695 | 1695 | * The old dashboard is replaced with dashboard v2. |
| 1696 | 1696 | * |
| 1697 | 1697 | * The old dashboard service is still loaded because its functions are used. |
@@ -1700,391 +1700,391 @@ discard block |
||
| 1700 | 1700 | * |
| 1701 | 1701 | * @since 3.20.0 |
| 1702 | 1702 | */ |
| 1703 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1704 | - // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1705 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1706 | - // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1707 | - |
|
| 1708 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1709 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1710 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1711 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1712 | - |
|
| 1713 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1714 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1715 | - |
|
| 1716 | - // Entity listing customization (wp-admin/edit.php) |
|
| 1717 | - // Add custom columns. |
|
| 1718 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1719 | - // no explicit entity as it prevents handling of other post types. |
|
| 1720 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1721 | - // Add 4W selection. |
|
| 1722 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1723 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1724 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1725 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1726 | - |
|
| 1727 | - /* |
|
| 1703 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1704 | + // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1705 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1706 | + // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1707 | + |
|
| 1708 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1709 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1710 | + $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1711 | + $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1712 | + |
|
| 1713 | + $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1714 | + $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1715 | + |
|
| 1716 | + // Entity listing customization (wp-admin/edit.php) |
|
| 1717 | + // Add custom columns. |
|
| 1718 | + $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1719 | + // no explicit entity as it prevents handling of other post types. |
|
| 1720 | + $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1721 | + // Add 4W selection. |
|
| 1722 | + $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1723 | + $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1724 | + $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1725 | + $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1726 | + |
|
| 1727 | + /* |
|
| 1728 | 1728 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1729 | 1729 | * |
| 1730 | 1730 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1731 | 1731 | */ |
| 1732 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1733 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1734 | - } |
|
| 1735 | - |
|
| 1736 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1737 | - // entities. |
|
| 1738 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1739 | - |
|
| 1740 | - // Filter imported post meta. |
|
| 1741 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1742 | - |
|
| 1743 | - // Notify the import service when an import starts and ends. |
|
| 1744 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1745 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1746 | - |
|
| 1747 | - // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1748 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1749 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1750 | - |
|
| 1751 | - /** |
|
| 1752 | - * Filter: wl_feature__enable__settings-download. |
|
| 1753 | - * |
|
| 1754 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1755 | - * |
|
| 1756 | - * @return bool |
|
| 1757 | - * @since 3.27.6 |
|
| 1758 | - */ |
|
| 1759 | - $this->features_registry->register_feature_from_slug( 'settings-download', true, array( |
|
| 1760 | - $this, |
|
| 1761 | - 'register_screens' |
|
| 1762 | - ) ); |
|
| 1763 | - |
|
| 1764 | - |
|
| 1765 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1766 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1767 | - |
|
| 1768 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1769 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1770 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1771 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1772 | - |
|
| 1773 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1774 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1775 | - |
|
| 1776 | - // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1777 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1778 | - |
|
| 1779 | - // Hook the `admin_init` function to the Admin Setup. |
|
| 1780 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1781 | - |
|
| 1782 | - // Hook the admin_init to the settings page. |
|
| 1783 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1784 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1785 | - |
|
| 1786 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1787 | - |
|
| 1788 | - // Hook the menu creation on the general wordlift menu creation. |
|
| 1789 | - /** |
|
| 1790 | - * Filter: wl_feature__enable__screens. |
|
| 1791 | - * |
|
| 1792 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1793 | - * |
|
| 1794 | - * @return bool |
|
| 1795 | - * @since 3.27.6 |
|
| 1796 | - * |
|
| 1797 | - * Since 3.30.0 this feature is registered using registry. |
|
| 1798 | - */ |
|
| 1799 | - add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1800 | - if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) { |
|
| 1801 | - add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 ); |
|
| 1802 | - } |
|
| 1803 | - } ); |
|
| 1804 | - |
|
| 1805 | - // Hook key update. |
|
| 1806 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1807 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1808 | - |
|
| 1809 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1810 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1811 | - |
|
| 1812 | - /* |
|
| 1732 | + if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1733 | + $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1734 | + } |
|
| 1735 | + |
|
| 1736 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1737 | + // entities. |
|
| 1738 | + $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1739 | + |
|
| 1740 | + // Filter imported post meta. |
|
| 1741 | + $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1742 | + |
|
| 1743 | + // Notify the import service when an import starts and ends. |
|
| 1744 | + $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1745 | + $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1746 | + |
|
| 1747 | + // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1748 | + $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1749 | + $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1750 | + |
|
| 1751 | + /** |
|
| 1752 | + * Filter: wl_feature__enable__settings-download. |
|
| 1753 | + * |
|
| 1754 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1755 | + * |
|
| 1756 | + * @return bool |
|
| 1757 | + * @since 3.27.6 |
|
| 1758 | + */ |
|
| 1759 | + $this->features_registry->register_feature_from_slug( 'settings-download', true, array( |
|
| 1760 | + $this, |
|
| 1761 | + 'register_screens' |
|
| 1762 | + ) ); |
|
| 1763 | + |
|
| 1764 | + |
|
| 1765 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1766 | + $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1767 | + |
|
| 1768 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1769 | + $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1770 | + $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1771 | + $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1772 | + |
|
| 1773 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1774 | + $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1775 | + |
|
| 1776 | + // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1777 | + $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1778 | + |
|
| 1779 | + // Hook the `admin_init` function to the Admin Setup. |
|
| 1780 | + $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1781 | + |
|
| 1782 | + // Hook the admin_init to the settings page. |
|
| 1783 | + $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1784 | + $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1785 | + |
|
| 1786 | + $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1787 | + |
|
| 1788 | + // Hook the menu creation on the general wordlift menu creation. |
|
| 1789 | + /** |
|
| 1790 | + * Filter: wl_feature__enable__screens. |
|
| 1791 | + * |
|
| 1792 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1793 | + * |
|
| 1794 | + * @return bool |
|
| 1795 | + * @since 3.27.6 |
|
| 1796 | + * |
|
| 1797 | + * Since 3.30.0 this feature is registered using registry. |
|
| 1798 | + */ |
|
| 1799 | + add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1800 | + if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) { |
|
| 1801 | + add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 ); |
|
| 1802 | + } |
|
| 1803 | + } ); |
|
| 1804 | + |
|
| 1805 | + // Hook key update. |
|
| 1806 | + $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1807 | + $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1808 | + |
|
| 1809 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1810 | + $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1811 | + |
|
| 1812 | + /* |
|
| 1813 | 1813 | * Remove the Analytics Settings link from the plugin page. |
| 1814 | 1814 | * |
| 1815 | 1815 | * @see https://github.com/insideout10/wordlift-plugin/issues/932 |
| 1816 | 1816 | * @since 3.21.1 |
| 1817 | 1817 | */ |
| 1818 | - // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1819 | - |
|
| 1820 | - // Hook the AJAX `wl_publisher` action name. |
|
| 1821 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1822 | - |
|
| 1823 | - // Hook row actions for the entity type list admin. |
|
| 1824 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1825 | - |
|
| 1826 | - /** Ajax actions. */ |
|
| 1827 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1828 | - |
|
| 1829 | - // Hook capabilities manipulation to allow access to entity type admin |
|
| 1830 | - // page on WordPress versions before 4.7. |
|
| 1831 | - global $wp_version; |
|
| 1832 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1833 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1834 | - } |
|
| 1835 | - |
|
| 1836 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1837 | - |
|
| 1838 | - /** Adapters. */ |
|
| 1839 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1840 | - /** |
|
| 1841 | - * Disabling Faq temporarily. |
|
| 1842 | - * Load the tinymce editor button on the tool bar. |
|
| 1843 | - * @since 3.26.0 |
|
| 1844 | - */ |
|
| 1845 | - //$this->loader->add_filter( 'tiny_mce_before_init', $this->faq_tinymce_adapter, 'register_custom_tags' ); |
|
| 1846 | - //$this->loader->add_filter( 'mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
| 1847 | - //$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
| 1848 | - |
|
| 1849 | - |
|
| 1850 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1851 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1852 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1853 | - /** |
|
| 1854 | - * @since 3.26.0 |
|
| 1855 | - */ |
|
| 1856 | - $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
| 1857 | - $this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1858 | - // Adding Rest route for the post excerpt |
|
| 1859 | - Post_Excerpt_Rest_Controller::register_routes(); |
|
| 1860 | - |
|
| 1861 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1862 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1863 | - |
|
| 1864 | - // Handle the autocomplete request. |
|
| 1865 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1866 | - $this->autocomplete_adapter, |
|
| 1867 | - 'wl_autocomplete', |
|
| 1868 | - ) ); |
|
| 1869 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1870 | - $this->autocomplete_adapter, |
|
| 1871 | - 'wl_autocomplete', |
|
| 1872 | - ) ); |
|
| 1873 | - |
|
| 1874 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1875 | - if ( is_multisite() ) { |
|
| 1876 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1877 | - } |
|
| 1878 | - |
|
| 1879 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1880 | - |
|
| 1881 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1882 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1883 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1884 | - |
|
| 1885 | - /** |
|
| 1886 | - * Always allow the `wordlift/classification` block. |
|
| 1887 | - * |
|
| 1888 | - * @since 3.23.0 |
|
| 1889 | - */ |
|
| 1890 | - add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1891 | - |
|
| 1892 | - if ( true === $value ) { |
|
| 1893 | - return $value; |
|
| 1894 | - } |
|
| 1895 | - |
|
| 1896 | - return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1897 | - }, PHP_INT_MAX ); |
|
| 1898 | - |
|
| 1899 | - /** |
|
| 1900 | - * @since 3.27.7 |
|
| 1901 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
| 1902 | - */ |
|
| 1903 | - new Top_Entities(); |
|
| 1904 | - } |
|
| 1905 | - |
|
| 1906 | - /** |
|
| 1907 | - * Register all of the hooks related to the public-facing functionality |
|
| 1908 | - * of the plugin. |
|
| 1909 | - * |
|
| 1910 | - * @since 1.0.0 |
|
| 1911 | - * @access private |
|
| 1912 | - */ |
|
| 1913 | - private function define_public_hooks() { |
|
| 1914 | - |
|
| 1915 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1916 | - |
|
| 1917 | - // Register the entity post type. |
|
| 1918 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1919 | - |
|
| 1920 | - // Bind the link generation and handling hooks to the entity link service. |
|
| 1921 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1922 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1923 | - // $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 ); |
|
| 1924 | - // $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 ); |
|
| 1925 | - |
|
| 1926 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1927 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1928 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1929 | - |
|
| 1930 | - // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
| 1931 | - $this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1932 | - // Hook the content filter service to add entity links. |
|
| 1933 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1934 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1935 | - } |
|
| 1936 | - |
|
| 1937 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1938 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1939 | - |
|
| 1940 | - // Hook the ShareThis service. |
|
| 1941 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1942 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1943 | - |
|
| 1944 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1945 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1946 | - |
|
| 1947 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1948 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1949 | - // to categories. |
|
| 1950 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1951 | - |
|
| 1952 | - /* |
|
| 1818 | + // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1819 | + |
|
| 1820 | + // Hook the AJAX `wl_publisher` action name. |
|
| 1821 | + $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1822 | + |
|
| 1823 | + // Hook row actions for the entity type list admin. |
|
| 1824 | + $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1825 | + |
|
| 1826 | + /** Ajax actions. */ |
|
| 1827 | + $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1828 | + |
|
| 1829 | + // Hook capabilities manipulation to allow access to entity type admin |
|
| 1830 | + // page on WordPress versions before 4.7. |
|
| 1831 | + global $wp_version; |
|
| 1832 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1833 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1834 | + } |
|
| 1835 | + |
|
| 1836 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1837 | + |
|
| 1838 | + /** Adapters. */ |
|
| 1839 | + $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1840 | + /** |
|
| 1841 | + * Disabling Faq temporarily. |
|
| 1842 | + * Load the tinymce editor button on the tool bar. |
|
| 1843 | + * @since 3.26.0 |
|
| 1844 | + */ |
|
| 1845 | + //$this->loader->add_filter( 'tiny_mce_before_init', $this->faq_tinymce_adapter, 'register_custom_tags' ); |
|
| 1846 | + //$this->loader->add_filter( 'mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
| 1847 | + //$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
| 1848 | + |
|
| 1849 | + |
|
| 1850 | + $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1851 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1852 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1853 | + /** |
|
| 1854 | + * @since 3.26.0 |
|
| 1855 | + */ |
|
| 1856 | + $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
| 1857 | + $this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1858 | + // Adding Rest route for the post excerpt |
|
| 1859 | + Post_Excerpt_Rest_Controller::register_routes(); |
|
| 1860 | + |
|
| 1861 | + $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1862 | + $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1863 | + |
|
| 1864 | + // Handle the autocomplete request. |
|
| 1865 | + add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1866 | + $this->autocomplete_adapter, |
|
| 1867 | + 'wl_autocomplete', |
|
| 1868 | + ) ); |
|
| 1869 | + add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1870 | + $this->autocomplete_adapter, |
|
| 1871 | + 'wl_autocomplete', |
|
| 1872 | + ) ); |
|
| 1873 | + |
|
| 1874 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1875 | + if ( is_multisite() ) { |
|
| 1876 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1877 | + } |
|
| 1878 | + |
|
| 1879 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1880 | + |
|
| 1881 | + add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1882 | + add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1883 | + add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1884 | + |
|
| 1885 | + /** |
|
| 1886 | + * Always allow the `wordlift/classification` block. |
|
| 1887 | + * |
|
| 1888 | + * @since 3.23.0 |
|
| 1889 | + */ |
|
| 1890 | + add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1891 | + |
|
| 1892 | + if ( true === $value ) { |
|
| 1893 | + return $value; |
|
| 1894 | + } |
|
| 1895 | + |
|
| 1896 | + return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1897 | + }, PHP_INT_MAX ); |
|
| 1898 | + |
|
| 1899 | + /** |
|
| 1900 | + * @since 3.27.7 |
|
| 1901 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
| 1902 | + */ |
|
| 1903 | + new Top_Entities(); |
|
| 1904 | + } |
|
| 1905 | + |
|
| 1906 | + /** |
|
| 1907 | + * Register all of the hooks related to the public-facing functionality |
|
| 1908 | + * of the plugin. |
|
| 1909 | + * |
|
| 1910 | + * @since 1.0.0 |
|
| 1911 | + * @access private |
|
| 1912 | + */ |
|
| 1913 | + private function define_public_hooks() { |
|
| 1914 | + |
|
| 1915 | + $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1916 | + |
|
| 1917 | + // Register the entity post type. |
|
| 1918 | + $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1919 | + |
|
| 1920 | + // Bind the link generation and handling hooks to the entity link service. |
|
| 1921 | + $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1922 | + $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1923 | + // $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 ); |
|
| 1924 | + // $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 ); |
|
| 1925 | + |
|
| 1926 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1927 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1928 | + $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1929 | + |
|
| 1930 | + // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
| 1931 | + $this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1932 | + // Hook the content filter service to add entity links. |
|
| 1933 | + if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1934 | + $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1935 | + } |
|
| 1936 | + |
|
| 1937 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1938 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1939 | + |
|
| 1940 | + // Hook the ShareThis service. |
|
| 1941 | + $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1942 | + $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1943 | + |
|
| 1944 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1945 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1946 | + |
|
| 1947 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1948 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1949 | + // to categories. |
|
| 1950 | + $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1951 | + |
|
| 1952 | + /* |
|
| 1953 | 1953 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1954 | 1954 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1955 | 1955 | * order of start time. |
| 1956 | 1956 | */ |
| 1957 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1958 | - |
|
| 1959 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1960 | - |
|
| 1961 | - // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1962 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1963 | - |
|
| 1964 | - // Analytics Script Frontend. |
|
| 1965 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1966 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1967 | - } |
|
| 1968 | - |
|
| 1969 | - } |
|
| 1970 | - |
|
| 1971 | - /** |
|
| 1972 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 1973 | - * |
|
| 1974 | - * @since 1.0.0 |
|
| 1975 | - */ |
|
| 1976 | - public function run() { |
|
| 1977 | - $this->loader->run(); |
|
| 1978 | - } |
|
| 1979 | - |
|
| 1980 | - /** |
|
| 1981 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 1982 | - * WordPress and to define internationalization functionality. |
|
| 1983 | - * |
|
| 1984 | - * @return string The name of the plugin. |
|
| 1985 | - * @since 1.0.0 |
|
| 1986 | - */ |
|
| 1987 | - public function get_plugin_name() { |
|
| 1988 | - return $this->plugin_name; |
|
| 1989 | - } |
|
| 1990 | - |
|
| 1991 | - /** |
|
| 1992 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1993 | - * |
|
| 1994 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1995 | - * @since 1.0.0 |
|
| 1996 | - */ |
|
| 1997 | - public function get_loader() { |
|
| 1998 | - return $this->loader; |
|
| 1999 | - } |
|
| 2000 | - |
|
| 2001 | - /** |
|
| 2002 | - * Retrieve the version number of the plugin. |
|
| 2003 | - * |
|
| 2004 | - * @return string The version number of the plugin. |
|
| 2005 | - * @since 1.0.0 |
|
| 2006 | - */ |
|
| 2007 | - public function get_version() { |
|
| 2008 | - return $this->version; |
|
| 2009 | - } |
|
| 2010 | - |
|
| 2011 | - /** |
|
| 2012 | - * Load dependencies for WP-CLI. |
|
| 2013 | - * |
|
| 2014 | - * @throws Exception |
|
| 2015 | - * @since 3.18.0 |
|
| 2016 | - */ |
|
| 2017 | - private function load_cli_dependencies() { |
|
| 2018 | - |
|
| 2019 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 2020 | - |
|
| 2021 | - $push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service ); |
|
| 2022 | - |
|
| 2023 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 2024 | - |
|
| 2025 | - } |
|
| 2026 | - |
|
| 2027 | - /** |
|
| 2028 | - * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 2029 | - * |
|
| 2030 | - * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 2031 | - * @since 3.20.0 |
|
| 2032 | - */ |
|
| 2033 | - public function get_dashboard_service() { |
|
| 2034 | - |
|
| 2035 | - return $this->dashboard_service; |
|
| 2036 | - } |
|
| 2037 | - |
|
| 2038 | - public function add_wl_enabled_blocks() { |
|
| 2039 | - /** |
|
| 2040 | - * Filter: wl_feature__enable__blocks. |
|
| 2041 | - * |
|
| 2042 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 2043 | - * |
|
| 2044 | - * @return bool |
|
| 2045 | - * @since 3.27.6 |
|
| 2046 | - */ |
|
| 2047 | - |
|
| 2048 | - wp_register_script( 'wl_enabled_blocks', false ); |
|
| 2049 | - |
|
| 2050 | - $enabled_blocks = array(); |
|
| 2051 | - |
|
| 2052 | - /** |
|
| 2053 | - * Filter name: wl_feature_enable__product_navigator |
|
| 2054 | - * @since 3.30.0 |
|
| 2055 | - */ |
|
| 2056 | - if ( apply_filters( 'wl_feature_enable__product-navigator', true ) ) { |
|
| 2057 | - $enabled_blocks[] = 'wordlift/products-navigator'; |
|
| 2058 | - } |
|
| 2059 | - |
|
| 2060 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 2061 | - // To intimate JS |
|
| 2062 | - $enabled_blocks = array_merge( $enabled_blocks, array( |
|
| 2063 | - 'wordlift/navigator', |
|
| 2064 | - 'wordlift/chord', |
|
| 2065 | - 'wordlift/geomap', |
|
| 2066 | - 'wordlift/timeline', |
|
| 2067 | - 'wordlift/cloud', |
|
| 2068 | - 'wordlift/vocabulary', |
|
| 2069 | - 'wordlift/faceted-search' |
|
| 2070 | - ) ); |
|
| 2071 | - } |
|
| 2072 | - |
|
| 2073 | - wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 2074 | - wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 2075 | - } |
|
| 2076 | - |
|
| 2077 | - /** |
|
| 2078 | - * Register screens based on the filter. |
|
| 2079 | - */ |
|
| 2080 | - public function register_screens() { |
|
| 2081 | - // Hook the menu to the Download Your Data page. |
|
| 2082 | - if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) { |
|
| 2083 | - add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 ); |
|
| 2084 | - } |
|
| 2085 | - add_action( 'admin_menu', array( $this->status_page, 'admin_menu' ), 100, 0 ); |
|
| 2086 | - add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 ); |
|
| 2087 | - |
|
| 2088 | - } |
|
| 1957 | + $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1958 | + |
|
| 1959 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1960 | + |
|
| 1961 | + // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1962 | + $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1963 | + |
|
| 1964 | + // Analytics Script Frontend. |
|
| 1965 | + if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1966 | + $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1967 | + } |
|
| 1968 | + |
|
| 1969 | + } |
|
| 1970 | + |
|
| 1971 | + /** |
|
| 1972 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 1973 | + * |
|
| 1974 | + * @since 1.0.0 |
|
| 1975 | + */ |
|
| 1976 | + public function run() { |
|
| 1977 | + $this->loader->run(); |
|
| 1978 | + } |
|
| 1979 | + |
|
| 1980 | + /** |
|
| 1981 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 1982 | + * WordPress and to define internationalization functionality. |
|
| 1983 | + * |
|
| 1984 | + * @return string The name of the plugin. |
|
| 1985 | + * @since 1.0.0 |
|
| 1986 | + */ |
|
| 1987 | + public function get_plugin_name() { |
|
| 1988 | + return $this->plugin_name; |
|
| 1989 | + } |
|
| 1990 | + |
|
| 1991 | + /** |
|
| 1992 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1993 | + * |
|
| 1994 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1995 | + * @since 1.0.0 |
|
| 1996 | + */ |
|
| 1997 | + public function get_loader() { |
|
| 1998 | + return $this->loader; |
|
| 1999 | + } |
|
| 2000 | + |
|
| 2001 | + /** |
|
| 2002 | + * Retrieve the version number of the plugin. |
|
| 2003 | + * |
|
| 2004 | + * @return string The version number of the plugin. |
|
| 2005 | + * @since 1.0.0 |
|
| 2006 | + */ |
|
| 2007 | + public function get_version() { |
|
| 2008 | + return $this->version; |
|
| 2009 | + } |
|
| 2010 | + |
|
| 2011 | + /** |
|
| 2012 | + * Load dependencies for WP-CLI. |
|
| 2013 | + * |
|
| 2014 | + * @throws Exception |
|
| 2015 | + * @since 3.18.0 |
|
| 2016 | + */ |
|
| 2017 | + private function load_cli_dependencies() { |
|
| 2018 | + |
|
| 2019 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 2020 | + |
|
| 2021 | + $push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service ); |
|
| 2022 | + |
|
| 2023 | + WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 2024 | + |
|
| 2025 | + } |
|
| 2026 | + |
|
| 2027 | + /** |
|
| 2028 | + * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 2029 | + * |
|
| 2030 | + * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 2031 | + * @since 3.20.0 |
|
| 2032 | + */ |
|
| 2033 | + public function get_dashboard_service() { |
|
| 2034 | + |
|
| 2035 | + return $this->dashboard_service; |
|
| 2036 | + } |
|
| 2037 | + |
|
| 2038 | + public function add_wl_enabled_blocks() { |
|
| 2039 | + /** |
|
| 2040 | + * Filter: wl_feature__enable__blocks. |
|
| 2041 | + * |
|
| 2042 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 2043 | + * |
|
| 2044 | + * @return bool |
|
| 2045 | + * @since 3.27.6 |
|
| 2046 | + */ |
|
| 2047 | + |
|
| 2048 | + wp_register_script( 'wl_enabled_blocks', false ); |
|
| 2049 | + |
|
| 2050 | + $enabled_blocks = array(); |
|
| 2051 | + |
|
| 2052 | + /** |
|
| 2053 | + * Filter name: wl_feature_enable__product_navigator |
|
| 2054 | + * @since 3.30.0 |
|
| 2055 | + */ |
|
| 2056 | + if ( apply_filters( 'wl_feature_enable__product-navigator', true ) ) { |
|
| 2057 | + $enabled_blocks[] = 'wordlift/products-navigator'; |
|
| 2058 | + } |
|
| 2059 | + |
|
| 2060 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 2061 | + // To intimate JS |
|
| 2062 | + $enabled_blocks = array_merge( $enabled_blocks, array( |
|
| 2063 | + 'wordlift/navigator', |
|
| 2064 | + 'wordlift/chord', |
|
| 2065 | + 'wordlift/geomap', |
|
| 2066 | + 'wordlift/timeline', |
|
| 2067 | + 'wordlift/cloud', |
|
| 2068 | + 'wordlift/vocabulary', |
|
| 2069 | + 'wordlift/faceted-search' |
|
| 2070 | + ) ); |
|
| 2071 | + } |
|
| 2072 | + |
|
| 2073 | + wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 2074 | + wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 2075 | + } |
|
| 2076 | + |
|
| 2077 | + /** |
|
| 2078 | + * Register screens based on the filter. |
|
| 2079 | + */ |
|
| 2080 | + public function register_screens() { |
|
| 2081 | + // Hook the menu to the Download Your Data page. |
|
| 2082 | + if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) { |
|
| 2083 | + add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 ); |
|
| 2084 | + } |
|
| 2085 | + add_action( 'admin_menu', array( $this->status_page, 'admin_menu' ), 100, 0 ); |
|
| 2086 | + add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 ); |
|
| 2087 | + |
|
| 2088 | + } |
|
| 2089 | 2089 | |
| 2090 | 2090 | } |
@@ -5,113 +5,113 @@ |
||
| 5 | 5 | use Wordlift\Object_Type_Enum; |
| 6 | 6 | |
| 7 | 7 | class Sync_Post_Hooks extends Abstract_Sync_Hooks { |
| 8 | - /** |
|
| 9 | - * @var \Wordlift_Log_Service |
|
| 10 | - */ |
|
| 11 | - private $log; |
|
| 12 | - |
|
| 13 | - /** |
|
| 14 | - * @var Sync_Service |
|
| 15 | - */ |
|
| 16 | - private $sync_service; |
|
| 17 | - |
|
| 18 | - /** |
|
| 19 | - * @var Sync_Object_Adapter_Factory |
|
| 20 | - */ |
|
| 21 | - private $sync_object_factory; |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * Sync_Post_Hooks constructor. |
|
| 25 | - * |
|
| 26 | - * @param Sync_Service $sync_service |
|
| 27 | - * @param Sync_Object_Adapter_Factory $sync_object_factory |
|
| 28 | - */ |
|
| 29 | - function __construct( $sync_service, $sync_object_factory ) { |
|
| 30 | - parent::__construct(); |
|
| 31 | - |
|
| 32 | - $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 33 | - |
|
| 34 | - $this->sync_service = $sync_service; |
|
| 35 | - $this->sync_object_factory = $sync_object_factory; |
|
| 36 | - |
|
| 37 | - $this->register_hooks(); |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - private function register_hooks() { |
|
| 41 | - /** |
|
| 42 | - * Register hooks for post and meta. |
|
| 43 | - */ |
|
| 44 | - add_action( 'save_post', array( $this, 'save_post' ) ); |
|
| 45 | - add_action( 'added_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 46 | - add_action( 'updated_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 47 | - add_action( 'deleted_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 48 | - add_action( 'delete_post', array( $this, 'delete_post' ) ); |
|
| 49 | - // Remove post when its trashed. |
|
| 50 | - add_action( 'trashed_post', array( $this, 'delete_post' ) ); |
|
| 51 | - // Save the post when its untrashed. |
|
| 52 | - add_action( 'untrashed_post', array( $this, 'save_post' ) ); |
|
| 53 | - |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - public function save_post( $post_id ) { |
|
| 57 | - |
|
| 58 | - if ( ! in_array( get_post_type( $post_id ), \Wordlift_Entity_Service::valid_entity_post_types() ) ) { |
|
| 59 | - return; |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - $this->sync( $post_id ); |
|
| 63 | - |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - public function changed_post_meta( $meta_id, $post_id, $meta_key, $_meta_value ) { |
|
| 67 | - |
|
| 68 | - if ( in_array( $meta_key, |
|
| 69 | - apply_filters( 'wl_dataset__sync_post_hooks__ignored_meta_keys', |
|
| 70 | - apply_filters( 'wl_dataset__sync_hooks__ignored_meta_keys', |
|
| 71 | - array( |
|
| 72 | - '_pingme', |
|
| 73 | - '_encloseme', |
|
| 74 | - 'entity_url', |
|
| 75 | - ) ) ) ) |
|
| 76 | - || ! in_array( get_post_type( $post_id ), \Wordlift_Entity_Service::valid_entity_post_types() ) |
|
| 77 | - ) { |
|
| 78 | - return; |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - $this->sync( $post_id ); |
|
| 82 | - |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - private function sync( $post_id ) { |
|
| 86 | - $this->enqueue( array( 'do_sync', $post_id ) ); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - public function do_sync( $post_id ) { |
|
| 90 | - try { |
|
| 91 | - $post = get_post( $post_id ); |
|
| 92 | - if ( ! isset( $post ) ) { |
|
| 93 | - return; |
|
| 94 | - } |
|
| 95 | - $this->sync_service->sync_many( array( |
|
| 96 | - $this->sync_object_factory->create( Object_Type_Enum::POST, $post_id ), |
|
| 97 | - $this->sync_object_factory->create( Object_Type_Enum::USER, $post->post_author ) |
|
| 98 | - ) ); |
|
| 99 | - } catch ( \Exception $e ) { |
|
| 100 | - $this->log->error( "An error occurred while trying to sync post $post_id: " . $e->getMessage(), $e ); |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - public function delete_post( $post_id ) { |
|
| 106 | - $this->enqueue( array( 'do_delete', $post_id ) ); |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - public function do_delete( $post_id ) { |
|
| 110 | - try { |
|
| 111 | - $this->sync_service->delete_one( Object_Type_Enum::POST, $post_id ); |
|
| 112 | - } catch ( \Exception $e ) { |
|
| 113 | - $this->log->error( "An error occurred while trying to delete post $post_id: " . $e->getMessage(), $e ); |
|
| 114 | - } |
|
| 115 | - } |
|
| 8 | + /** |
|
| 9 | + * @var \Wordlift_Log_Service |
|
| 10 | + */ |
|
| 11 | + private $log; |
|
| 12 | + |
|
| 13 | + /** |
|
| 14 | + * @var Sync_Service |
|
| 15 | + */ |
|
| 16 | + private $sync_service; |
|
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * @var Sync_Object_Adapter_Factory |
|
| 20 | + */ |
|
| 21 | + private $sync_object_factory; |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * Sync_Post_Hooks constructor. |
|
| 25 | + * |
|
| 26 | + * @param Sync_Service $sync_service |
|
| 27 | + * @param Sync_Object_Adapter_Factory $sync_object_factory |
|
| 28 | + */ |
|
| 29 | + function __construct( $sync_service, $sync_object_factory ) { |
|
| 30 | + parent::__construct(); |
|
| 31 | + |
|
| 32 | + $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 33 | + |
|
| 34 | + $this->sync_service = $sync_service; |
|
| 35 | + $this->sync_object_factory = $sync_object_factory; |
|
| 36 | + |
|
| 37 | + $this->register_hooks(); |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + private function register_hooks() { |
|
| 41 | + /** |
|
| 42 | + * Register hooks for post and meta. |
|
| 43 | + */ |
|
| 44 | + add_action( 'save_post', array( $this, 'save_post' ) ); |
|
| 45 | + add_action( 'added_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 46 | + add_action( 'updated_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 47 | + add_action( 'deleted_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 48 | + add_action( 'delete_post', array( $this, 'delete_post' ) ); |
|
| 49 | + // Remove post when its trashed. |
|
| 50 | + add_action( 'trashed_post', array( $this, 'delete_post' ) ); |
|
| 51 | + // Save the post when its untrashed. |
|
| 52 | + add_action( 'untrashed_post', array( $this, 'save_post' ) ); |
|
| 53 | + |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + public function save_post( $post_id ) { |
|
| 57 | + |
|
| 58 | + if ( ! in_array( get_post_type( $post_id ), \Wordlift_Entity_Service::valid_entity_post_types() ) ) { |
|
| 59 | + return; |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + $this->sync( $post_id ); |
|
| 63 | + |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + public function changed_post_meta( $meta_id, $post_id, $meta_key, $_meta_value ) { |
|
| 67 | + |
|
| 68 | + if ( in_array( $meta_key, |
|
| 69 | + apply_filters( 'wl_dataset__sync_post_hooks__ignored_meta_keys', |
|
| 70 | + apply_filters( 'wl_dataset__sync_hooks__ignored_meta_keys', |
|
| 71 | + array( |
|
| 72 | + '_pingme', |
|
| 73 | + '_encloseme', |
|
| 74 | + 'entity_url', |
|
| 75 | + ) ) ) ) |
|
| 76 | + || ! in_array( get_post_type( $post_id ), \Wordlift_Entity_Service::valid_entity_post_types() ) |
|
| 77 | + ) { |
|
| 78 | + return; |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + $this->sync( $post_id ); |
|
| 82 | + |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + private function sync( $post_id ) { |
|
| 86 | + $this->enqueue( array( 'do_sync', $post_id ) ); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + public function do_sync( $post_id ) { |
|
| 90 | + try { |
|
| 91 | + $post = get_post( $post_id ); |
|
| 92 | + if ( ! isset( $post ) ) { |
|
| 93 | + return; |
|
| 94 | + } |
|
| 95 | + $this->sync_service->sync_many( array( |
|
| 96 | + $this->sync_object_factory->create( Object_Type_Enum::POST, $post_id ), |
|
| 97 | + $this->sync_object_factory->create( Object_Type_Enum::USER, $post->post_author ) |
|
| 98 | + ) ); |
|
| 99 | + } catch ( \Exception $e ) { |
|
| 100 | + $this->log->error( "An error occurred while trying to sync post $post_id: " . $e->getMessage(), $e ); |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + public function delete_post( $post_id ) { |
|
| 106 | + $this->enqueue( array( 'do_delete', $post_id ) ); |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + public function do_delete( $post_id ) { |
|
| 110 | + try { |
|
| 111 | + $this->sync_service->delete_one( Object_Type_Enum::POST, $post_id ); |
|
| 112 | + } catch ( \Exception $e ) { |
|
| 113 | + $this->log->error( "An error occurred while trying to delete post $post_id: " . $e->getMessage(), $e ); |
|
| 114 | + } |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | 117 | } |
@@ -26,10 +26,10 @@ discard block |
||
| 26 | 26 | * @param Sync_Service $sync_service |
| 27 | 27 | * @param Sync_Object_Adapter_Factory $sync_object_factory |
| 28 | 28 | */ |
| 29 | - function __construct( $sync_service, $sync_object_factory ) { |
|
| 29 | + function __construct($sync_service, $sync_object_factory) { |
|
| 30 | 30 | parent::__construct(); |
| 31 | 31 | |
| 32 | - $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 32 | + $this->log = \Wordlift_Log_Service::get_logger(get_class()); |
|
| 33 | 33 | |
| 34 | 34 | $this->sync_service = $sync_service; |
| 35 | 35 | $this->sync_object_factory = $sync_object_factory; |
@@ -41,76 +41,76 @@ discard block |
||
| 41 | 41 | /** |
| 42 | 42 | * Register hooks for post and meta. |
| 43 | 43 | */ |
| 44 | - add_action( 'save_post', array( $this, 'save_post' ) ); |
|
| 45 | - add_action( 'added_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 46 | - add_action( 'updated_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 47 | - add_action( 'deleted_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 48 | - add_action( 'delete_post', array( $this, 'delete_post' ) ); |
|
| 44 | + add_action('save_post', array($this, 'save_post')); |
|
| 45 | + add_action('added_post_meta', array($this, 'changed_post_meta'), 10, 4); |
|
| 46 | + add_action('updated_post_meta', array($this, 'changed_post_meta'), 10, 4); |
|
| 47 | + add_action('deleted_post_meta', array($this, 'changed_post_meta'), 10, 4); |
|
| 48 | + add_action('delete_post', array($this, 'delete_post')); |
|
| 49 | 49 | // Remove post when its trashed. |
| 50 | - add_action( 'trashed_post', array( $this, 'delete_post' ) ); |
|
| 50 | + add_action('trashed_post', array($this, 'delete_post')); |
|
| 51 | 51 | // Save the post when its untrashed. |
| 52 | - add_action( 'untrashed_post', array( $this, 'save_post' ) ); |
|
| 52 | + add_action('untrashed_post', array($this, 'save_post')); |
|
| 53 | 53 | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - public function save_post( $post_id ) { |
|
| 56 | + public function save_post($post_id) { |
|
| 57 | 57 | |
| 58 | - if ( ! in_array( get_post_type( $post_id ), \Wordlift_Entity_Service::valid_entity_post_types() ) ) { |
|
| 58 | + if ( ! in_array(get_post_type($post_id), \Wordlift_Entity_Service::valid_entity_post_types())) { |
|
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - $this->sync( $post_id ); |
|
| 62 | + $this->sync($post_id); |
|
| 63 | 63 | |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - public function changed_post_meta( $meta_id, $post_id, $meta_key, $_meta_value ) { |
|
| 66 | + public function changed_post_meta($meta_id, $post_id, $meta_key, $_meta_value) { |
|
| 67 | 67 | |
| 68 | - if ( in_array( $meta_key, |
|
| 69 | - apply_filters( 'wl_dataset__sync_post_hooks__ignored_meta_keys', |
|
| 70 | - apply_filters( 'wl_dataset__sync_hooks__ignored_meta_keys', |
|
| 68 | + if (in_array($meta_key, |
|
| 69 | + apply_filters('wl_dataset__sync_post_hooks__ignored_meta_keys', |
|
| 70 | + apply_filters('wl_dataset__sync_hooks__ignored_meta_keys', |
|
| 71 | 71 | array( |
| 72 | 72 | '_pingme', |
| 73 | 73 | '_encloseme', |
| 74 | 74 | 'entity_url', |
| 75 | - ) ) ) ) |
|
| 76 | - || ! in_array( get_post_type( $post_id ), \Wordlift_Entity_Service::valid_entity_post_types() ) |
|
| 75 | + )))) |
|
| 76 | + || ! in_array(get_post_type($post_id), \Wordlift_Entity_Service::valid_entity_post_types()) |
|
| 77 | 77 | ) { |
| 78 | 78 | return; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - $this->sync( $post_id ); |
|
| 81 | + $this->sync($post_id); |
|
| 82 | 82 | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - private function sync( $post_id ) { |
|
| 86 | - $this->enqueue( array( 'do_sync', $post_id ) ); |
|
| 85 | + private function sync($post_id) { |
|
| 86 | + $this->enqueue(array('do_sync', $post_id)); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - public function do_sync( $post_id ) { |
|
| 89 | + public function do_sync($post_id) { |
|
| 90 | 90 | try { |
| 91 | - $post = get_post( $post_id ); |
|
| 92 | - if ( ! isset( $post ) ) { |
|
| 91 | + $post = get_post($post_id); |
|
| 92 | + if ( ! isset($post)) { |
|
| 93 | 93 | return; |
| 94 | 94 | } |
| 95 | - $this->sync_service->sync_many( array( |
|
| 96 | - $this->sync_object_factory->create( Object_Type_Enum::POST, $post_id ), |
|
| 97 | - $this->sync_object_factory->create( Object_Type_Enum::USER, $post->post_author ) |
|
| 98 | - ) ); |
|
| 99 | - } catch ( \Exception $e ) { |
|
| 100 | - $this->log->error( "An error occurred while trying to sync post $post_id: " . $e->getMessage(), $e ); |
|
| 95 | + $this->sync_service->sync_many(array( |
|
| 96 | + $this->sync_object_factory->create(Object_Type_Enum::POST, $post_id), |
|
| 97 | + $this->sync_object_factory->create(Object_Type_Enum::USER, $post->post_author) |
|
| 98 | + )); |
|
| 99 | + } catch (\Exception $e) { |
|
| 100 | + $this->log->error("An error occurred while trying to sync post $post_id: ".$e->getMessage(), $e); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - public function delete_post( $post_id ) { |
|
| 106 | - $this->enqueue( array( 'do_delete', $post_id ) ); |
|
| 105 | + public function delete_post($post_id) { |
|
| 106 | + $this->enqueue(array('do_delete', $post_id)); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - public function do_delete( $post_id ) { |
|
| 109 | + public function do_delete($post_id) { |
|
| 110 | 110 | try { |
| 111 | - $this->sync_service->delete_one( Object_Type_Enum::POST, $post_id ); |
|
| 112 | - } catch ( \Exception $e ) { |
|
| 113 | - $this->log->error( "An error occurred while trying to delete post $post_id: " . $e->getMessage(), $e ); |
|
| 111 | + $this->sync_service->delete_one(Object_Type_Enum::POST, $post_id); |
|
| 112 | + } catch (\Exception $e) { |
|
| 113 | + $this->log->error("An error occurred while trying to delete post $post_id: ".$e->getMessage(), $e); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
@@ -12,110 +12,110 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | class Xml_Generator { |
| 14 | 14 | |
| 15 | - private static function iso8601_to_seconds( $iso8601_interval_string ) { |
|
| 16 | - try { |
|
| 17 | - $interval = new \DateInterval( $iso8601_interval_string ); |
|
| 18 | - } catch ( \Exception $e ) { |
|
| 19 | - return 0; |
|
| 20 | - } |
|
| 21 | - |
|
| 22 | - $days_to_seconds = $interval->d * 60 * 60 * 24; |
|
| 23 | - $hours_to_seconds = $interval->h * 60 * 60; |
|
| 24 | - $minutes_to_seconds = $interval->i * 60; |
|
| 25 | - $seconds = $interval->s; |
|
| 26 | - |
|
| 27 | - return $days_to_seconds + $hours_to_seconds + $minutes_to_seconds + $seconds; |
|
| 28 | - |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - public static function get_xml_for_all_posts_with_videos() { |
|
| 32 | - /** |
|
| 33 | - * @since 3.31.6 |
|
| 34 | - * Filter the query args, add support for all custom public post types. |
|
| 35 | - */ |
|
| 36 | - $video_sitemap_query_args = apply_filters( 'wl_videoobject_sitemap_query_args', array( |
|
| 37 | - 'fields' => 'ids', |
|
| 38 | - 'numberposts' => - 1, |
|
| 39 | - 'post_type' => get_post_types( array( 'public' => true ) ), |
|
| 40 | - 'meta_query' => array( |
|
| 41 | - array( |
|
| 42 | - 'key' => Meta_Storage::META_KEY, |
|
| 43 | - 'compare' => 'EXISTS' |
|
| 44 | - ) |
|
| 45 | - ) |
|
| 46 | - ) ); |
|
| 47 | - |
|
| 48 | - $posts = get_posts( $video_sitemap_query_args ); |
|
| 49 | - |
|
| 50 | - $all_posts_xml = ""; |
|
| 51 | - |
|
| 52 | - if ( ! $posts ) { |
|
| 53 | - return $all_posts_xml; |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - foreach ( $posts as $post_id ) { |
|
| 57 | - $all_posts_xml .= self::get_xml_for_single_post( $post_id ); |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - return $all_posts_xml; |
|
| 61 | - |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * @param $post_id |
|
| 67 | - * |
|
| 68 | - * @return string XML string for single post. |
|
| 69 | - */ |
|
| 70 | - public static function get_xml_for_single_post( $post_id ) { |
|
| 71 | - $videos = Video_Storage_Factory::get_storage()->get_all_videos( $post_id ); |
|
| 72 | - if ( ! $videos ) { |
|
| 73 | - return ""; |
|
| 74 | - } |
|
| 75 | - $single_post_xml = ""; |
|
| 76 | - foreach ( $videos as $video ) { |
|
| 77 | - $single_post_xml .= self::get_xml_for_single_video( $video, $post_id ); |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - return $single_post_xml; |
|
| 81 | - |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * @param $video Video |
|
| 87 | - * @param $post_id int |
|
| 88 | - * |
|
| 89 | - * @return string |
|
| 90 | - */ |
|
| 91 | - public static function get_xml_for_single_video( $video, $post_id ) { |
|
| 92 | - |
|
| 93 | - $permalink = get_permalink( $post_id ); |
|
| 94 | - $title = esc_html( $video->name ); |
|
| 95 | - $description = esc_html( $video->description ); |
|
| 96 | - $thumbnail_url = $video->thumbnail_urls[0]; |
|
| 97 | - |
|
| 98 | - // If description is empty use title. |
|
| 99 | - if ( ! $description ) { |
|
| 100 | - $description = $title; |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - $optional_fields = array( |
|
| 104 | - 'content_loc' => $video->content_url, |
|
| 105 | - 'player_loc' => $video->embed_url, |
|
| 106 | - 'duration' => self::iso8601_to_seconds( $video->duration ), |
|
| 107 | - 'view_count' => $video->views, |
|
| 108 | - 'live' => $video->is_live_video ? 'yes' : 'no' |
|
| 109 | - ); |
|
| 110 | - |
|
| 111 | - $optional_data = ""; |
|
| 112 | - foreach ( $optional_fields as $xml_key => $xml_value ) { |
|
| 113 | - if ( $xml_value ) { |
|
| 114 | - $optional_data .= "<video:${xml_key}>${xml_value}</video:${xml_key}>"; |
|
| 115 | - } |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - return <<<EOF |
|
| 15 | + private static function iso8601_to_seconds( $iso8601_interval_string ) { |
|
| 16 | + try { |
|
| 17 | + $interval = new \DateInterval( $iso8601_interval_string ); |
|
| 18 | + } catch ( \Exception $e ) { |
|
| 19 | + return 0; |
|
| 20 | + } |
|
| 21 | + |
|
| 22 | + $days_to_seconds = $interval->d * 60 * 60 * 24; |
|
| 23 | + $hours_to_seconds = $interval->h * 60 * 60; |
|
| 24 | + $minutes_to_seconds = $interval->i * 60; |
|
| 25 | + $seconds = $interval->s; |
|
| 26 | + |
|
| 27 | + return $days_to_seconds + $hours_to_seconds + $minutes_to_seconds + $seconds; |
|
| 28 | + |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + public static function get_xml_for_all_posts_with_videos() { |
|
| 32 | + /** |
|
| 33 | + * @since 3.31.6 |
|
| 34 | + * Filter the query args, add support for all custom public post types. |
|
| 35 | + */ |
|
| 36 | + $video_sitemap_query_args = apply_filters( 'wl_videoobject_sitemap_query_args', array( |
|
| 37 | + 'fields' => 'ids', |
|
| 38 | + 'numberposts' => - 1, |
|
| 39 | + 'post_type' => get_post_types( array( 'public' => true ) ), |
|
| 40 | + 'meta_query' => array( |
|
| 41 | + array( |
|
| 42 | + 'key' => Meta_Storage::META_KEY, |
|
| 43 | + 'compare' => 'EXISTS' |
|
| 44 | + ) |
|
| 45 | + ) |
|
| 46 | + ) ); |
|
| 47 | + |
|
| 48 | + $posts = get_posts( $video_sitemap_query_args ); |
|
| 49 | + |
|
| 50 | + $all_posts_xml = ""; |
|
| 51 | + |
|
| 52 | + if ( ! $posts ) { |
|
| 53 | + return $all_posts_xml; |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + foreach ( $posts as $post_id ) { |
|
| 57 | + $all_posts_xml .= self::get_xml_for_single_post( $post_id ); |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + return $all_posts_xml; |
|
| 61 | + |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * @param $post_id |
|
| 67 | + * |
|
| 68 | + * @return string XML string for single post. |
|
| 69 | + */ |
|
| 70 | + public static function get_xml_for_single_post( $post_id ) { |
|
| 71 | + $videos = Video_Storage_Factory::get_storage()->get_all_videos( $post_id ); |
|
| 72 | + if ( ! $videos ) { |
|
| 73 | + return ""; |
|
| 74 | + } |
|
| 75 | + $single_post_xml = ""; |
|
| 76 | + foreach ( $videos as $video ) { |
|
| 77 | + $single_post_xml .= self::get_xml_for_single_video( $video, $post_id ); |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + return $single_post_xml; |
|
| 81 | + |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * @param $video Video |
|
| 87 | + * @param $post_id int |
|
| 88 | + * |
|
| 89 | + * @return string |
|
| 90 | + */ |
|
| 91 | + public static function get_xml_for_single_video( $video, $post_id ) { |
|
| 92 | + |
|
| 93 | + $permalink = get_permalink( $post_id ); |
|
| 94 | + $title = esc_html( $video->name ); |
|
| 95 | + $description = esc_html( $video->description ); |
|
| 96 | + $thumbnail_url = $video->thumbnail_urls[0]; |
|
| 97 | + |
|
| 98 | + // If description is empty use title. |
|
| 99 | + if ( ! $description ) { |
|
| 100 | + $description = $title; |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + $optional_fields = array( |
|
| 104 | + 'content_loc' => $video->content_url, |
|
| 105 | + 'player_loc' => $video->embed_url, |
|
| 106 | + 'duration' => self::iso8601_to_seconds( $video->duration ), |
|
| 107 | + 'view_count' => $video->views, |
|
| 108 | + 'live' => $video->is_live_video ? 'yes' : 'no' |
|
| 109 | + ); |
|
| 110 | + |
|
| 111 | + $optional_data = ""; |
|
| 112 | + foreach ( $optional_fields as $xml_key => $xml_value ) { |
|
| 113 | + if ( $xml_value ) { |
|
| 114 | + $optional_data .= "<video:${xml_key}>${xml_value}</video:${xml_key}>"; |
|
| 115 | + } |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + return <<<EOF |
|
| 119 | 119 | <url> |
| 120 | 120 | <loc>${permalink}</loc> |
| 121 | 121 | <video:video> |
@@ -127,6 +127,6 @@ discard block |
||
| 127 | 127 | </url> |
| 128 | 128 | EOF; |
| 129 | 129 | |
| 130 | - } |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | 132 | } |
| 133 | 133 | \ No newline at end of file |
@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | class Xml_Generator { |
| 14 | 14 | |
| 15 | - private static function iso8601_to_seconds( $iso8601_interval_string ) { |
|
| 15 | + private static function iso8601_to_seconds($iso8601_interval_string) { |
|
| 16 | 16 | try { |
| 17 | - $interval = new \DateInterval( $iso8601_interval_string ); |
|
| 18 | - } catch ( \Exception $e ) { |
|
| 17 | + $interval = new \DateInterval($iso8601_interval_string); |
|
| 18 | + } catch (\Exception $e) { |
|
| 19 | 19 | return 0; |
| 20 | 20 | } |
| 21 | 21 | |
@@ -33,28 +33,28 @@ discard block |
||
| 33 | 33 | * @since 3.31.6 |
| 34 | 34 | * Filter the query args, add support for all custom public post types. |
| 35 | 35 | */ |
| 36 | - $video_sitemap_query_args = apply_filters( 'wl_videoobject_sitemap_query_args', array( |
|
| 36 | + $video_sitemap_query_args = apply_filters('wl_videoobject_sitemap_query_args', array( |
|
| 37 | 37 | 'fields' => 'ids', |
| 38 | - 'numberposts' => - 1, |
|
| 39 | - 'post_type' => get_post_types( array( 'public' => true ) ), |
|
| 38 | + 'numberposts' => -1, |
|
| 39 | + 'post_type' => get_post_types(array('public' => true)), |
|
| 40 | 40 | 'meta_query' => array( |
| 41 | 41 | array( |
| 42 | 42 | 'key' => Meta_Storage::META_KEY, |
| 43 | 43 | 'compare' => 'EXISTS' |
| 44 | 44 | ) |
| 45 | 45 | ) |
| 46 | - ) ); |
|
| 46 | + )); |
|
| 47 | 47 | |
| 48 | - $posts = get_posts( $video_sitemap_query_args ); |
|
| 48 | + $posts = get_posts($video_sitemap_query_args); |
|
| 49 | 49 | |
| 50 | 50 | $all_posts_xml = ""; |
| 51 | 51 | |
| 52 | - if ( ! $posts ) { |
|
| 52 | + if ( ! $posts) { |
|
| 53 | 53 | return $all_posts_xml; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - foreach ( $posts as $post_id ) { |
|
| 57 | - $all_posts_xml .= self::get_xml_for_single_post( $post_id ); |
|
| 56 | + foreach ($posts as $post_id) { |
|
| 57 | + $all_posts_xml .= self::get_xml_for_single_post($post_id); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | return $all_posts_xml; |
@@ -67,14 +67,14 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @return string XML string for single post. |
| 69 | 69 | */ |
| 70 | - public static function get_xml_for_single_post( $post_id ) { |
|
| 71 | - $videos = Video_Storage_Factory::get_storage()->get_all_videos( $post_id ); |
|
| 72 | - if ( ! $videos ) { |
|
| 70 | + public static function get_xml_for_single_post($post_id) { |
|
| 71 | + $videos = Video_Storage_Factory::get_storage()->get_all_videos($post_id); |
|
| 72 | + if ( ! $videos) { |
|
| 73 | 73 | return ""; |
| 74 | 74 | } |
| 75 | 75 | $single_post_xml = ""; |
| 76 | - foreach ( $videos as $video ) { |
|
| 77 | - $single_post_xml .= self::get_xml_for_single_video( $video, $post_id ); |
|
| 76 | + foreach ($videos as $video) { |
|
| 77 | + $single_post_xml .= self::get_xml_for_single_video($video, $post_id); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | return $single_post_xml; |
@@ -88,29 +88,29 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @return string |
| 90 | 90 | */ |
| 91 | - public static function get_xml_for_single_video( $video, $post_id ) { |
|
| 91 | + public static function get_xml_for_single_video($video, $post_id) { |
|
| 92 | 92 | |
| 93 | - $permalink = get_permalink( $post_id ); |
|
| 94 | - $title = esc_html( $video->name ); |
|
| 95 | - $description = esc_html( $video->description ); |
|
| 93 | + $permalink = get_permalink($post_id); |
|
| 94 | + $title = esc_html($video->name); |
|
| 95 | + $description = esc_html($video->description); |
|
| 96 | 96 | $thumbnail_url = $video->thumbnail_urls[0]; |
| 97 | 97 | |
| 98 | 98 | // If description is empty use title. |
| 99 | - if ( ! $description ) { |
|
| 99 | + if ( ! $description) { |
|
| 100 | 100 | $description = $title; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | $optional_fields = array( |
| 104 | 104 | 'content_loc' => $video->content_url, |
| 105 | 105 | 'player_loc' => $video->embed_url, |
| 106 | - 'duration' => self::iso8601_to_seconds( $video->duration ), |
|
| 106 | + 'duration' => self::iso8601_to_seconds($video->duration), |
|
| 107 | 107 | 'view_count' => $video->views, |
| 108 | 108 | 'live' => $video->is_live_video ? 'yes' : 'no' |
| 109 | 109 | ); |
| 110 | 110 | |
| 111 | 111 | $optional_data = ""; |
| 112 | - foreach ( $optional_fields as $xml_key => $xml_value ) { |
|
| 113 | - if ( $xml_value ) { |
|
| 112 | + foreach ($optional_fields as $xml_key => $xml_value) { |
|
| 113 | + if ($xml_value) { |
|
| 114 | 114 | $optional_data .= "<video:${xml_key}>${xml_value}</video:${xml_key}>"; |
| 115 | 115 | } |
| 116 | 116 | } |
@@ -11,172 +11,172 @@ |
||
| 11 | 11 | use Wordlift\Videoobject\Data\Video_Storage\Storage; |
| 12 | 12 | |
| 13 | 13 | class Jsonld { |
| 14 | - /** |
|
| 15 | - * @var Storage |
|
| 16 | - */ |
|
| 17 | - private $video_storage; |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * Jsonld constructor. |
|
| 21 | - * |
|
| 22 | - * @param $video_storage Storage |
|
| 23 | - */ |
|
| 24 | - public function __construct( $video_storage ) { |
|
| 25 | - add_action( 'wl_post_jsonld', array( $this, 'wl_post_jsonld' ), 10, 3 ); |
|
| 26 | - add_action( 'wl_after_get_jsonld', array( $this, 'wl_after_get_jsonld' ), 10, 3 ); |
|
| 27 | - $this->video_storage = $video_storage; |
|
| 28 | - } |
|
| 29 | - |
|
| 30 | - |
|
| 31 | - public function wl_after_get_jsonld( $jsonld, $post_id, $context ) { |
|
| 32 | - if ( 0 === count( $jsonld ) ) { |
|
| 33 | - return $jsonld; |
|
| 34 | - } |
|
| 35 | - $current_item = $jsonld[0]; |
|
| 36 | - |
|
| 37 | - if ( ! array_key_exists( '@type', $current_item ) ) { |
|
| 38 | - // Cant determine type return early. |
|
| 39 | - return $jsonld; |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - $type = $current_item['@type']; |
|
| 43 | - if ( ( is_string( $type ) && $type === 'Article' ) || |
|
| 44 | - ( is_array( $type ) && in_array( 'Article', $type ) ) ) { |
|
| 45 | - return $jsonld; |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - $videos_jsonld = $this->get_videos_jsonld( $post_id ); |
|
| 49 | - if ( 0 === count( $videos_jsonld ) ) { |
|
| 50 | - return $jsonld; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - // check if we have @id in jsonld for first item. |
|
| 54 | - $id = array_key_exists( '@id', $current_item ) ? $current_item['@id'] : ''; |
|
| 55 | - |
|
| 56 | - foreach ( $videos_jsonld as &$video_jsonld ) { |
|
| 57 | - if ( ! $id ) { |
|
| 58 | - continue; |
|
| 59 | - } |
|
| 60 | - if ( ! array_key_exists( 'mentions', $video_jsonld ) ) { |
|
| 61 | - $video_jsonld['mentions'] = array( '@id' => $id ); |
|
| 62 | - } else { |
|
| 63 | - $video_jsonld['mentions'] = array_merge( $video_jsonld['mentions'], array( '@id' => $id ) ); |
|
| 64 | - } |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - return array_merge( $jsonld, $videos_jsonld ); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * @param $existing_video_data string | array associative or sequential array. |
|
| 72 | - * @param $new_video_data array Sequential array. |
|
| 73 | - * |
|
| 74 | - * @return array |
|
| 75 | - */ |
|
| 76 | - private function merge_video_data( $existing_video_data, $new_video_data ) { |
|
| 77 | - if ( ! is_array( $existing_video_data ) ) { |
|
| 78 | - $new_video_data[] = $existing_video_data; |
|
| 79 | - |
|
| 80 | - return $new_video_data; |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - if ( $this->is_associative_array( $existing_video_data ) ) { |
|
| 84 | - $new_video_data[] = $existing_video_data; |
|
| 85 | - |
|
| 86 | - return $new_video_data; |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - return array_merge( $existing_video_data, $new_video_data ); |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - public function wl_post_jsonld( $jsonld, $post_id, $references ) { |
|
| 93 | - |
|
| 94 | - $video_jsonld = $this->get_videos_jsonld( $post_id ); |
|
| 95 | - if ( count( $video_jsonld ) === 0 ) { |
|
| 96 | - return $jsonld; |
|
| 97 | - } |
|
| 98 | - // Before adding the video jsonld check if the key |
|
| 99 | - // is present and additional data might be present, |
|
| 100 | - // if not present just add the data and return early. |
|
| 101 | - if ( ! array_key_exists( 'video', $jsonld ) ) { |
|
| 102 | - $jsonld['video'] = $video_jsonld; |
|
| 103 | - |
|
| 104 | - return $jsonld; |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - // since key exists, we need to merge the data based on type. |
|
| 108 | - $previous_video_data = $jsonld['video']; |
|
| 109 | - $jsonld['video'] = $this->merge_video_data( $previous_video_data, $video_jsonld ); |
|
| 110 | - |
|
| 111 | - return $jsonld; |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * @param $post_id int Post id. |
|
| 117 | - * |
|
| 118 | - * @return array |
|
| 119 | - */ |
|
| 120 | - public function get_videos_jsonld( $post_id ) { |
|
| 121 | - |
|
| 122 | - $videos = $this->video_storage->get_all_videos( $post_id ); |
|
| 123 | - |
|
| 124 | - $jsonld = array(); |
|
| 125 | - |
|
| 126 | - foreach ( $videos as $video ) { |
|
| 127 | - /** |
|
| 128 | - * @var $video Video |
|
| 129 | - */ |
|
| 130 | - $description = $video->description; |
|
| 131 | - if ( ! $video->description ) { |
|
| 132 | - // If description is empty then use the video title as description |
|
| 133 | - $description = $video->name; |
|
| 134 | - } |
|
| 135 | - $single_jsonld = array( |
|
| 136 | - '@context' => 'http://schema.org', |
|
| 137 | - '@type' => 'VideoObject', |
|
| 138 | - 'name' => $video->name, |
|
| 139 | - 'description' => $description, |
|
| 140 | - 'contentUrl' => $video->content_url, |
|
| 141 | - 'embedUrl' => $video->embed_url, |
|
| 142 | - 'uploadDate' => $video->upload_date, |
|
| 143 | - 'thumbnailUrl' => $video->thumbnail_urls, |
|
| 144 | - 'duration' => $video->duration, |
|
| 145 | - ); |
|
| 146 | - |
|
| 147 | - if ( $video->views ) { |
|
| 148 | - $single_jsonld['interactionStatistic'] = array( |
|
| 149 | - '@type' => 'InteractionCounter', |
|
| 150 | - 'interactionType' => array( |
|
| 151 | - '@type' => 'http://schema.org/WatchAction' |
|
| 152 | - ), |
|
| 153 | - 'userInteractionCount' => $video->views |
|
| 154 | - ); |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - if ( $video->is_live_video ) { |
|
| 158 | - $single_jsonld['publication'] = array( |
|
| 159 | - '@type' => 'BroadcastEvent', |
|
| 160 | - 'isLiveBroadcast' => true, |
|
| 161 | - 'startDate' => $video->live_video_start_date, |
|
| 162 | - 'endDate' => $video->live_video_end_date |
|
| 163 | - ); |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - $jsonld[] = $single_jsonld; |
|
| 167 | - } |
|
| 168 | - |
|
| 169 | - return $jsonld; |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - |
|
| 173 | - private function is_associative_array( $arr ) { |
|
| 174 | - if ( array() === $arr ) { |
|
| 175 | - return false; |
|
| 176 | - } |
|
| 177 | - |
|
| 178 | - return array_keys( $arr ) !== range( 0, count( $arr ) - 1 ); |
|
| 179 | - } |
|
| 14 | + /** |
|
| 15 | + * @var Storage |
|
| 16 | + */ |
|
| 17 | + private $video_storage; |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * Jsonld constructor. |
|
| 21 | + * |
|
| 22 | + * @param $video_storage Storage |
|
| 23 | + */ |
|
| 24 | + public function __construct( $video_storage ) { |
|
| 25 | + add_action( 'wl_post_jsonld', array( $this, 'wl_post_jsonld' ), 10, 3 ); |
|
| 26 | + add_action( 'wl_after_get_jsonld', array( $this, 'wl_after_get_jsonld' ), 10, 3 ); |
|
| 27 | + $this->video_storage = $video_storage; |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + |
|
| 31 | + public function wl_after_get_jsonld( $jsonld, $post_id, $context ) { |
|
| 32 | + if ( 0 === count( $jsonld ) ) { |
|
| 33 | + return $jsonld; |
|
| 34 | + } |
|
| 35 | + $current_item = $jsonld[0]; |
|
| 36 | + |
|
| 37 | + if ( ! array_key_exists( '@type', $current_item ) ) { |
|
| 38 | + // Cant determine type return early. |
|
| 39 | + return $jsonld; |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + $type = $current_item['@type']; |
|
| 43 | + if ( ( is_string( $type ) && $type === 'Article' ) || |
|
| 44 | + ( is_array( $type ) && in_array( 'Article', $type ) ) ) { |
|
| 45 | + return $jsonld; |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + $videos_jsonld = $this->get_videos_jsonld( $post_id ); |
|
| 49 | + if ( 0 === count( $videos_jsonld ) ) { |
|
| 50 | + return $jsonld; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + // check if we have @id in jsonld for first item. |
|
| 54 | + $id = array_key_exists( '@id', $current_item ) ? $current_item['@id'] : ''; |
|
| 55 | + |
|
| 56 | + foreach ( $videos_jsonld as &$video_jsonld ) { |
|
| 57 | + if ( ! $id ) { |
|
| 58 | + continue; |
|
| 59 | + } |
|
| 60 | + if ( ! array_key_exists( 'mentions', $video_jsonld ) ) { |
|
| 61 | + $video_jsonld['mentions'] = array( '@id' => $id ); |
|
| 62 | + } else { |
|
| 63 | + $video_jsonld['mentions'] = array_merge( $video_jsonld['mentions'], array( '@id' => $id ) ); |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + return array_merge( $jsonld, $videos_jsonld ); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * @param $existing_video_data string | array associative or sequential array. |
|
| 72 | + * @param $new_video_data array Sequential array. |
|
| 73 | + * |
|
| 74 | + * @return array |
|
| 75 | + */ |
|
| 76 | + private function merge_video_data( $existing_video_data, $new_video_data ) { |
|
| 77 | + if ( ! is_array( $existing_video_data ) ) { |
|
| 78 | + $new_video_data[] = $existing_video_data; |
|
| 79 | + |
|
| 80 | + return $new_video_data; |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + if ( $this->is_associative_array( $existing_video_data ) ) { |
|
| 84 | + $new_video_data[] = $existing_video_data; |
|
| 85 | + |
|
| 86 | + return $new_video_data; |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + return array_merge( $existing_video_data, $new_video_data ); |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + public function wl_post_jsonld( $jsonld, $post_id, $references ) { |
|
| 93 | + |
|
| 94 | + $video_jsonld = $this->get_videos_jsonld( $post_id ); |
|
| 95 | + if ( count( $video_jsonld ) === 0 ) { |
|
| 96 | + return $jsonld; |
|
| 97 | + } |
|
| 98 | + // Before adding the video jsonld check if the key |
|
| 99 | + // is present and additional data might be present, |
|
| 100 | + // if not present just add the data and return early. |
|
| 101 | + if ( ! array_key_exists( 'video', $jsonld ) ) { |
|
| 102 | + $jsonld['video'] = $video_jsonld; |
|
| 103 | + |
|
| 104 | + return $jsonld; |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + // since key exists, we need to merge the data based on type. |
|
| 108 | + $previous_video_data = $jsonld['video']; |
|
| 109 | + $jsonld['video'] = $this->merge_video_data( $previous_video_data, $video_jsonld ); |
|
| 110 | + |
|
| 111 | + return $jsonld; |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * @param $post_id int Post id. |
|
| 117 | + * |
|
| 118 | + * @return array |
|
| 119 | + */ |
|
| 120 | + public function get_videos_jsonld( $post_id ) { |
|
| 121 | + |
|
| 122 | + $videos = $this->video_storage->get_all_videos( $post_id ); |
|
| 123 | + |
|
| 124 | + $jsonld = array(); |
|
| 125 | + |
|
| 126 | + foreach ( $videos as $video ) { |
|
| 127 | + /** |
|
| 128 | + * @var $video Video |
|
| 129 | + */ |
|
| 130 | + $description = $video->description; |
|
| 131 | + if ( ! $video->description ) { |
|
| 132 | + // If description is empty then use the video title as description |
|
| 133 | + $description = $video->name; |
|
| 134 | + } |
|
| 135 | + $single_jsonld = array( |
|
| 136 | + '@context' => 'http://schema.org', |
|
| 137 | + '@type' => 'VideoObject', |
|
| 138 | + 'name' => $video->name, |
|
| 139 | + 'description' => $description, |
|
| 140 | + 'contentUrl' => $video->content_url, |
|
| 141 | + 'embedUrl' => $video->embed_url, |
|
| 142 | + 'uploadDate' => $video->upload_date, |
|
| 143 | + 'thumbnailUrl' => $video->thumbnail_urls, |
|
| 144 | + 'duration' => $video->duration, |
|
| 145 | + ); |
|
| 146 | + |
|
| 147 | + if ( $video->views ) { |
|
| 148 | + $single_jsonld['interactionStatistic'] = array( |
|
| 149 | + '@type' => 'InteractionCounter', |
|
| 150 | + 'interactionType' => array( |
|
| 151 | + '@type' => 'http://schema.org/WatchAction' |
|
| 152 | + ), |
|
| 153 | + 'userInteractionCount' => $video->views |
|
| 154 | + ); |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + if ( $video->is_live_video ) { |
|
| 158 | + $single_jsonld['publication'] = array( |
|
| 159 | + '@type' => 'BroadcastEvent', |
|
| 160 | + 'isLiveBroadcast' => true, |
|
| 161 | + 'startDate' => $video->live_video_start_date, |
|
| 162 | + 'endDate' => $video->live_video_end_date |
|
| 163 | + ); |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + $jsonld[] = $single_jsonld; |
|
| 167 | + } |
|
| 168 | + |
|
| 169 | + return $jsonld; |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + |
|
| 173 | + private function is_associative_array( $arr ) { |
|
| 174 | + if ( array() === $arr ) { |
|
| 175 | + return false; |
|
| 176 | + } |
|
| 177 | + |
|
| 178 | + return array_keys( $arr ) !== range( 0, count( $arr ) - 1 ); |
|
| 179 | + } |
|
| 180 | 180 | |
| 181 | 181 | |
| 182 | 182 | } |
@@ -21,50 +21,50 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param $video_storage Storage |
| 23 | 23 | */ |
| 24 | - public function __construct( $video_storage ) { |
|
| 25 | - add_action( 'wl_post_jsonld', array( $this, 'wl_post_jsonld' ), 10, 3 ); |
|
| 26 | - add_action( 'wl_after_get_jsonld', array( $this, 'wl_after_get_jsonld' ), 10, 3 ); |
|
| 24 | + public function __construct($video_storage) { |
|
| 25 | + add_action('wl_post_jsonld', array($this, 'wl_post_jsonld'), 10, 3); |
|
| 26 | + add_action('wl_after_get_jsonld', array($this, 'wl_after_get_jsonld'), 10, 3); |
|
| 27 | 27 | $this->video_storage = $video_storage; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | |
| 31 | - public function wl_after_get_jsonld( $jsonld, $post_id, $context ) { |
|
| 32 | - if ( 0 === count( $jsonld ) ) { |
|
| 31 | + public function wl_after_get_jsonld($jsonld, $post_id, $context) { |
|
| 32 | + if (0 === count($jsonld)) { |
|
| 33 | 33 | return $jsonld; |
| 34 | 34 | } |
| 35 | 35 | $current_item = $jsonld[0]; |
| 36 | 36 | |
| 37 | - if ( ! array_key_exists( '@type', $current_item ) ) { |
|
| 37 | + if ( ! array_key_exists('@type', $current_item)) { |
|
| 38 | 38 | // Cant determine type return early. |
| 39 | 39 | return $jsonld; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $type = $current_item['@type']; |
| 43 | - if ( ( is_string( $type ) && $type === 'Article' ) || |
|
| 44 | - ( is_array( $type ) && in_array( 'Article', $type ) ) ) { |
|
| 43 | + if ((is_string($type) && $type === 'Article') || |
|
| 44 | + (is_array($type) && in_array('Article', $type))) { |
|
| 45 | 45 | return $jsonld; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - $videos_jsonld = $this->get_videos_jsonld( $post_id ); |
|
| 49 | - if ( 0 === count( $videos_jsonld ) ) { |
|
| 48 | + $videos_jsonld = $this->get_videos_jsonld($post_id); |
|
| 49 | + if (0 === count($videos_jsonld)) { |
|
| 50 | 50 | return $jsonld; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // check if we have @id in jsonld for first item. |
| 54 | - $id = array_key_exists( '@id', $current_item ) ? $current_item['@id'] : ''; |
|
| 54 | + $id = array_key_exists('@id', $current_item) ? $current_item['@id'] : ''; |
|
| 55 | 55 | |
| 56 | - foreach ( $videos_jsonld as &$video_jsonld ) { |
|
| 57 | - if ( ! $id ) { |
|
| 56 | + foreach ($videos_jsonld as &$video_jsonld) { |
|
| 57 | + if ( ! $id) { |
|
| 58 | 58 | continue; |
| 59 | 59 | } |
| 60 | - if ( ! array_key_exists( 'mentions', $video_jsonld ) ) { |
|
| 61 | - $video_jsonld['mentions'] = array( '@id' => $id ); |
|
| 60 | + if ( ! array_key_exists('mentions', $video_jsonld)) { |
|
| 61 | + $video_jsonld['mentions'] = array('@id' => $id); |
|
| 62 | 62 | } else { |
| 63 | - $video_jsonld['mentions'] = array_merge( $video_jsonld['mentions'], array( '@id' => $id ) ); |
|
| 63 | + $video_jsonld['mentions'] = array_merge($video_jsonld['mentions'], array('@id' => $id)); |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - return array_merge( $jsonld, $videos_jsonld ); |
|
| 67 | + return array_merge($jsonld, $videos_jsonld); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -73,32 +73,32 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @return array |
| 75 | 75 | */ |
| 76 | - private function merge_video_data( $existing_video_data, $new_video_data ) { |
|
| 77 | - if ( ! is_array( $existing_video_data ) ) { |
|
| 76 | + private function merge_video_data($existing_video_data, $new_video_data) { |
|
| 77 | + if ( ! is_array($existing_video_data)) { |
|
| 78 | 78 | $new_video_data[] = $existing_video_data; |
| 79 | 79 | |
| 80 | 80 | return $new_video_data; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if ( $this->is_associative_array( $existing_video_data ) ) { |
|
| 83 | + if ($this->is_associative_array($existing_video_data)) { |
|
| 84 | 84 | $new_video_data[] = $existing_video_data; |
| 85 | 85 | |
| 86 | 86 | return $new_video_data; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - return array_merge( $existing_video_data, $new_video_data ); |
|
| 89 | + return array_merge($existing_video_data, $new_video_data); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - public function wl_post_jsonld( $jsonld, $post_id, $references ) { |
|
| 92 | + public function wl_post_jsonld($jsonld, $post_id, $references) { |
|
| 93 | 93 | |
| 94 | - $video_jsonld = $this->get_videos_jsonld( $post_id ); |
|
| 95 | - if ( count( $video_jsonld ) === 0 ) { |
|
| 94 | + $video_jsonld = $this->get_videos_jsonld($post_id); |
|
| 95 | + if (count($video_jsonld) === 0) { |
|
| 96 | 96 | return $jsonld; |
| 97 | 97 | } |
| 98 | 98 | // Before adding the video jsonld check if the key |
| 99 | 99 | // is present and additional data might be present, |
| 100 | 100 | // if not present just add the data and return early. |
| 101 | - if ( ! array_key_exists( 'video', $jsonld ) ) { |
|
| 101 | + if ( ! array_key_exists('video', $jsonld)) { |
|
| 102 | 102 | $jsonld['video'] = $video_jsonld; |
| 103 | 103 | |
| 104 | 104 | return $jsonld; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | // since key exists, we need to merge the data based on type. |
| 108 | 108 | $previous_video_data = $jsonld['video']; |
| 109 | - $jsonld['video'] = $this->merge_video_data( $previous_video_data, $video_jsonld ); |
|
| 109 | + $jsonld['video'] = $this->merge_video_data($previous_video_data, $video_jsonld); |
|
| 110 | 110 | |
| 111 | 111 | return $jsonld; |
| 112 | 112 | } |
@@ -117,18 +117,18 @@ discard block |
||
| 117 | 117 | * |
| 118 | 118 | * @return array |
| 119 | 119 | */ |
| 120 | - public function get_videos_jsonld( $post_id ) { |
|
| 120 | + public function get_videos_jsonld($post_id) { |
|
| 121 | 121 | |
| 122 | - $videos = $this->video_storage->get_all_videos( $post_id ); |
|
| 122 | + $videos = $this->video_storage->get_all_videos($post_id); |
|
| 123 | 123 | |
| 124 | 124 | $jsonld = array(); |
| 125 | 125 | |
| 126 | - foreach ( $videos as $video ) { |
|
| 126 | + foreach ($videos as $video) { |
|
| 127 | 127 | /** |
| 128 | 128 | * @var $video Video |
| 129 | 129 | */ |
| 130 | 130 | $description = $video->description; |
| 131 | - if ( ! $video->description ) { |
|
| 131 | + if ( ! $video->description) { |
|
| 132 | 132 | // If description is empty then use the video title as description |
| 133 | 133 | $description = $video->name; |
| 134 | 134 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | 'duration' => $video->duration, |
| 145 | 145 | ); |
| 146 | 146 | |
| 147 | - if ( $video->views ) { |
|
| 147 | + if ($video->views) { |
|
| 148 | 148 | $single_jsonld['interactionStatistic'] = array( |
| 149 | 149 | '@type' => 'InteractionCounter', |
| 150 | 150 | 'interactionType' => array( |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | ); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - if ( $video->is_live_video ) { |
|
| 157 | + if ($video->is_live_video) { |
|
| 158 | 158 | $single_jsonld['publication'] = array( |
| 159 | 159 | '@type' => 'BroadcastEvent', |
| 160 | 160 | 'isLiveBroadcast' => true, |
@@ -170,12 +170,12 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | |
| 173 | - private function is_associative_array( $arr ) { |
|
| 174 | - if ( array() === $arr ) { |
|
| 173 | + private function is_associative_array($arr) { |
|
| 174 | + if (array() === $arr) { |
|
| 175 | 175 | return false; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - return array_keys( $arr ) !== range( 0, count( $arr ) - 1 ); |
|
| 178 | + return array_keys($arr) !== range(0, count($arr) - 1); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | |