@@ -13,135 +13,135 @@ discard block |
||
| 13 | 13 | * @subpackage Wordlift/includes/sync-mappings |
| 14 | 14 | */ |
| 15 | 15 | class Mappings_REST_Controller { |
| 16 | - // Namespace for CRUD mappings. |
|
| 17 | - const MAPPINGS_NAMESPACE = '/mappings'; |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * Registers route on rest api initialisation. |
|
| 21 | - */ |
|
| 22 | - public static function register_routes() { |
|
| 23 | - |
|
| 24 | - add_action( 'rest_api_init', 'Wordlift\Mappings\Mappings_REST_Controller::register_route_callback' ); |
|
| 25 | - |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Get a single mapping item by its mapping_id |
|
| 30 | - * |
|
| 31 | - * @param WP_REST_Request $request {@link WP_REST_Request instance}. |
|
| 32 | - * |
|
| 33 | - * @return array |
|
| 34 | - */ |
|
| 35 | - public static function get_mapping_item( $request ) { |
|
| 36 | - $dbo = new Mappings_DBO(); |
|
| 37 | - $mapping_id = $request['id']; |
|
| 38 | - $mapping_id_data = array(); |
|
| 39 | - $rule_groups = $dbo->get_rule_groups_by_mapping( $mapping_id ); |
|
| 40 | - $properties = $dbo->get_properties( $mapping_id ); |
|
| 41 | - $mapping_row = $dbo->get_mapping_item_data( $mapping_id ); |
|
| 42 | - |
|
| 43 | - $mapping_id_data['mapping_id'] = $mapping_id; |
|
| 44 | - $mapping_id_data['property_list'] = $properties; |
|
| 45 | - $mapping_id_data['rule_group_list'] = $rule_groups; |
|
| 46 | - $mapping_id_data['mapping_title'] = $mapping_row['mapping_title']; |
|
| 47 | - |
|
| 48 | - return $mapping_id_data; |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * Register route call back function, called when rest api gets initialised |
|
| 53 | - * |
|
| 54 | - * @return void |
|
| 55 | - */ |
|
| 56 | - public static function register_route_callback() { |
|
| 57 | - register_rest_route( |
|
| 58 | - WL_REST_ROUTE_DEFAULT_NAMESPACE, |
|
| 59 | - '/mappings', |
|
| 60 | - array( |
|
| 61 | - 'methods' => WP_REST_Server::CREATABLE, |
|
| 62 | - 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::insert_or_update_mapping_item', |
|
| 63 | - 'permission_callback' => function () { |
|
| 64 | - return current_user_can( 'manage_options' ); |
|
| 65 | - }, |
|
| 66 | - ) |
|
| 67 | - ); |
|
| 68 | - // Get list of mapping items. |
|
| 69 | - register_rest_route( |
|
| 70 | - WL_REST_ROUTE_DEFAULT_NAMESPACE, |
|
| 71 | - '/mappings', |
|
| 72 | - array( |
|
| 73 | - 'methods' => WP_REST_Server::READABLE, |
|
| 74 | - 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::list_mapping_items', |
|
| 75 | - 'permission_callback' => function () { |
|
| 76 | - return current_user_can( 'manage_options' ); |
|
| 77 | - }, |
|
| 78 | - ) |
|
| 79 | - ); |
|
| 80 | - |
|
| 81 | - // Delete mapping items by id. |
|
| 82 | - register_rest_route( |
|
| 83 | - WL_REST_ROUTE_DEFAULT_NAMESPACE, |
|
| 84 | - 'mappings', |
|
| 85 | - array( |
|
| 86 | - 'methods' => WP_REST_Server::DELETABLE, |
|
| 87 | - 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::delete_mapping_items', |
|
| 88 | - 'permission_callback' => function () { |
|
| 89 | - return current_user_can( 'manage_options' ); |
|
| 90 | - }, |
|
| 91 | - ) |
|
| 92 | - ); |
|
| 93 | - |
|
| 94 | - // Get single mapping item route. |
|
| 95 | - register_rest_route( |
|
| 96 | - WL_REST_ROUTE_DEFAULT_NAMESPACE, |
|
| 97 | - 'mappings/(?P<id>\d+)', |
|
| 98 | - array( |
|
| 99 | - 'methods' => WP_REST_Server::READABLE, |
|
| 100 | - 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::get_mapping_item', |
|
| 101 | - 'permission_callback' => function () { |
|
| 102 | - return current_user_can( 'manage_options' ); |
|
| 103 | - }, |
|
| 104 | - ) |
|
| 105 | - ); |
|
| 106 | - |
|
| 107 | - // Update mapping items. |
|
| 108 | - register_rest_route( |
|
| 109 | - WL_REST_ROUTE_DEFAULT_NAMESPACE, |
|
| 110 | - 'mappings', |
|
| 111 | - array( |
|
| 112 | - 'methods' => WP_REST_Server::EDITABLE, |
|
| 113 | - 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::update_mapping_items', |
|
| 114 | - 'permission_callback' => function () { |
|
| 115 | - return current_user_can( 'manage_options' ); |
|
| 116 | - }, |
|
| 117 | - ) |
|
| 118 | - ); |
|
| 119 | - |
|
| 120 | - // Clone mapping items. |
|
| 121 | - register_rest_route( |
|
| 122 | - WL_REST_ROUTE_DEFAULT_NAMESPACE, |
|
| 123 | - 'mappings/clone', |
|
| 124 | - array( |
|
| 125 | - 'methods' => WP_REST_Server::CREATABLE, |
|
| 126 | - 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::clone_mapping_items', |
|
| 127 | - 'permission_callback' => function () { |
|
| 128 | - return current_user_can( 'manage_options' ); |
|
| 129 | - }, |
|
| 130 | - ) |
|
| 131 | - ); |
|
| 132 | - |
|
| 133 | - // Register rest endpoint to get the terms. |
|
| 134 | - register_rest_route( |
|
| 135 | - WL_REST_ROUTE_DEFAULT_NAMESPACE, |
|
| 136 | - 'mappings/get_terms', |
|
| 137 | - array( |
|
| 138 | - 'methods' => WP_REST_Server::CREATABLE, |
|
| 139 | - 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::get_terms_for_the_posted_taxonomy', |
|
| 140 | - 'permission_callback' => function () { |
|
| 141 | - return current_user_can( 'manage_options' ); |
|
| 142 | - }, |
|
| 143 | - ) |
|
| 144 | - ); |
|
| 16 | + // Namespace for CRUD mappings. |
|
| 17 | + const MAPPINGS_NAMESPACE = '/mappings'; |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * Registers route on rest api initialisation. |
|
| 21 | + */ |
|
| 22 | + public static function register_routes() { |
|
| 23 | + |
|
| 24 | + add_action( 'rest_api_init', 'Wordlift\Mappings\Mappings_REST_Controller::register_route_callback' ); |
|
| 25 | + |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Get a single mapping item by its mapping_id |
|
| 30 | + * |
|
| 31 | + * @param WP_REST_Request $request {@link WP_REST_Request instance}. |
|
| 32 | + * |
|
| 33 | + * @return array |
|
| 34 | + */ |
|
| 35 | + public static function get_mapping_item( $request ) { |
|
| 36 | + $dbo = new Mappings_DBO(); |
|
| 37 | + $mapping_id = $request['id']; |
|
| 38 | + $mapping_id_data = array(); |
|
| 39 | + $rule_groups = $dbo->get_rule_groups_by_mapping( $mapping_id ); |
|
| 40 | + $properties = $dbo->get_properties( $mapping_id ); |
|
| 41 | + $mapping_row = $dbo->get_mapping_item_data( $mapping_id ); |
|
| 42 | + |
|
| 43 | + $mapping_id_data['mapping_id'] = $mapping_id; |
|
| 44 | + $mapping_id_data['property_list'] = $properties; |
|
| 45 | + $mapping_id_data['rule_group_list'] = $rule_groups; |
|
| 46 | + $mapping_id_data['mapping_title'] = $mapping_row['mapping_title']; |
|
| 47 | + |
|
| 48 | + return $mapping_id_data; |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * Register route call back function, called when rest api gets initialised |
|
| 53 | + * |
|
| 54 | + * @return void |
|
| 55 | + */ |
|
| 56 | + public static function register_route_callback() { |
|
| 57 | + register_rest_route( |
|
| 58 | + WL_REST_ROUTE_DEFAULT_NAMESPACE, |
|
| 59 | + '/mappings', |
|
| 60 | + array( |
|
| 61 | + 'methods' => WP_REST_Server::CREATABLE, |
|
| 62 | + 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::insert_or_update_mapping_item', |
|
| 63 | + 'permission_callback' => function () { |
|
| 64 | + return current_user_can( 'manage_options' ); |
|
| 65 | + }, |
|
| 66 | + ) |
|
| 67 | + ); |
|
| 68 | + // Get list of mapping items. |
|
| 69 | + register_rest_route( |
|
| 70 | + WL_REST_ROUTE_DEFAULT_NAMESPACE, |
|
| 71 | + '/mappings', |
|
| 72 | + array( |
|
| 73 | + 'methods' => WP_REST_Server::READABLE, |
|
| 74 | + 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::list_mapping_items', |
|
| 75 | + 'permission_callback' => function () { |
|
| 76 | + return current_user_can( 'manage_options' ); |
|
| 77 | + }, |
|
| 78 | + ) |
|
| 79 | + ); |
|
| 80 | + |
|
| 81 | + // Delete mapping items by id. |
|
| 82 | + register_rest_route( |
|
| 83 | + WL_REST_ROUTE_DEFAULT_NAMESPACE, |
|
| 84 | + 'mappings', |
|
| 85 | + array( |
|
| 86 | + 'methods' => WP_REST_Server::DELETABLE, |
|
| 87 | + 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::delete_mapping_items', |
|
| 88 | + 'permission_callback' => function () { |
|
| 89 | + return current_user_can( 'manage_options' ); |
|
| 90 | + }, |
|
| 91 | + ) |
|
| 92 | + ); |
|
| 93 | + |
|
| 94 | + // Get single mapping item route. |
|
| 95 | + register_rest_route( |
|
| 96 | + WL_REST_ROUTE_DEFAULT_NAMESPACE, |
|
| 97 | + 'mappings/(?P<id>\d+)', |
|
| 98 | + array( |
|
| 99 | + 'methods' => WP_REST_Server::READABLE, |
|
| 100 | + 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::get_mapping_item', |
|
| 101 | + 'permission_callback' => function () { |
|
| 102 | + return current_user_can( 'manage_options' ); |
|
| 103 | + }, |
|
| 104 | + ) |
|
| 105 | + ); |
|
| 106 | + |
|
| 107 | + // Update mapping items. |
|
| 108 | + register_rest_route( |
|
| 109 | + WL_REST_ROUTE_DEFAULT_NAMESPACE, |
|
| 110 | + 'mappings', |
|
| 111 | + array( |
|
| 112 | + 'methods' => WP_REST_Server::EDITABLE, |
|
| 113 | + 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::update_mapping_items', |
|
| 114 | + 'permission_callback' => function () { |
|
| 115 | + return current_user_can( 'manage_options' ); |
|
| 116 | + }, |
|
| 117 | + ) |
|
| 118 | + ); |
|
| 119 | + |
|
| 120 | + // Clone mapping items. |
|
| 121 | + register_rest_route( |
|
| 122 | + WL_REST_ROUTE_DEFAULT_NAMESPACE, |
|
| 123 | + 'mappings/clone', |
|
| 124 | + array( |
|
| 125 | + 'methods' => WP_REST_Server::CREATABLE, |
|
| 126 | + 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::clone_mapping_items', |
|
| 127 | + 'permission_callback' => function () { |
|
| 128 | + return current_user_can( 'manage_options' ); |
|
| 129 | + }, |
|
| 130 | + ) |
|
| 131 | + ); |
|
| 132 | + |
|
| 133 | + // Register rest endpoint to get the terms. |
|
| 134 | + register_rest_route( |
|
| 135 | + WL_REST_ROUTE_DEFAULT_NAMESPACE, |
|
| 136 | + 'mappings/get_terms', |
|
| 137 | + array( |
|
| 138 | + 'methods' => WP_REST_Server::CREATABLE, |
|
| 139 | + 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::get_terms_for_the_posted_taxonomy', |
|
| 140 | + 'permission_callback' => function () { |
|
| 141 | + return current_user_can( 'manage_options' ); |
|
| 142 | + }, |
|
| 143 | + ) |
|
| 144 | + ); |
|
| 145 | 145 | |
| 146 | 146 | // Register rest endpoint to get the terms. |
| 147 | 147 | register_rest_route( |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | }, |
| 156 | 156 | ) |
| 157 | 157 | ); |
| 158 | - } |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | 160 | /** |
| 161 | 161 | * Get the taxonomy & terms |
@@ -206,334 +206,334 @@ discard block |
||
| 206 | 206 | return $taxonomy_terms; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - /** |
|
| 210 | - * Get the terms for the posted taxonomy name. |
|
| 211 | - * |
|
| 212 | - * @param WP_REST_Request $request {@link WP_REST_Request instance}. |
|
| 213 | - * |
|
| 214 | - * @return array The array of the terms for the taxonomy. |
|
| 215 | - */ |
|
| 216 | - public static function get_terms_for_the_posted_taxonomy( $request ) { |
|
| 217 | - $post_data = $request->get_params(); |
|
| 218 | - if ( ! array_key_exists( 'taxonomy', $post_data ) ) { |
|
| 219 | - return array( |
|
| 220 | - 'status' => 'failure', |
|
| 221 | - 'message' => __( 'Request not valid, must post a taxonomy to get terms', 'wordlift' ) |
|
| 222 | - ); |
|
| 223 | - } else { |
|
| 224 | - $taxonomy = $post_data['taxonomy']; |
|
| 225 | - $terms = get_terms( $taxonomy, array( 'hide_empty' => false, ) ); |
|
| 226 | - if ( is_wp_error( $terms ) ) { |
|
| 227 | - // Return error response, if the taxonomy is not valid. |
|
| 228 | - return array( |
|
| 229 | - 'status' => 'failure', |
|
| 230 | - 'message' => __( 'Request not valid, must post a valid taxonomy', 'wordlift' ) |
|
| 231 | - ); |
|
| 232 | - } |
|
| 233 | - |
|
| 234 | - return $terms; |
|
| 235 | - } |
|
| 236 | - } |
|
| 237 | - |
|
| 238 | - /** |
|
| 239 | - * Clone posted mapping items. |
|
| 240 | - * |
|
| 241 | - * @param WP_REST_Request $request {@link WP_REST_Request instance}. |
|
| 242 | - * |
|
| 243 | - * @return array |
|
| 244 | - */ |
|
| 245 | - public static function clone_mapping_items( $request ) { |
|
| 246 | - $dbo = new Mappings_DBO(); |
|
| 247 | - $post_data = (array) $request->get_params(); |
|
| 248 | - $mapping_items = (array) $post_data['mapping_items']; |
|
| 249 | - foreach ( $mapping_items as $mapping_item ) { |
|
| 250 | - $mapping_id = (int) $mapping_item['mapping_id']; |
|
| 251 | - // Clone the current mapping item. |
|
| 252 | - $cloned_mapping_id = $dbo->insert_mapping_item( $mapping_item['mapping_title'] ); |
|
| 253 | - // Clone all the rule groups. |
|
| 254 | - $rule_groups_to_be_cloned = $dbo->get_rule_groups_by_mapping( $mapping_id ); |
|
| 255 | - // Clone all the properties. |
|
| 256 | - $properties_to_be_cloned = $dbo->get_properties( $mapping_id ); |
|
| 257 | - foreach ( $properties_to_be_cloned as $property ) { |
|
| 258 | - // Assign a new mapping id. |
|
| 259 | - $property['mapping_id'] = $cloned_mapping_id; |
|
| 260 | - // Removing this property id, since a new id needed to be created for |
|
| 261 | - // new property. |
|
| 262 | - unset( $property['property_id'] ); |
|
| 263 | - $dbo->insert_or_update_property( $property ); |
|
| 264 | - } |
|
| 265 | - // Loop through the rule groups and insert them in table with the mapping id. |
|
| 266 | - foreach ( $rule_groups_to_be_cloned as $rule_group ) { |
|
| 267 | - $cloned_rule_group_id = $dbo->insert_rule_group( $cloned_mapping_id ); |
|
| 268 | - $original_rules = (array) $rule_group['rules']; |
|
| 269 | - // Now we need to insert these rules for the cloned rule group id. |
|
| 270 | - foreach ( $original_rules as $clone_rule ) { |
|
| 271 | - // We should replace only rule group id in the cloned rules. |
|
| 272 | - $clone_rule['rule_group_id'] = (int) $cloned_rule_group_id; |
|
| 273 | - unset( $clone_rule['rule_id'] ); |
|
| 274 | - $dbo->insert_or_update_rule_item( $clone_rule ); |
|
| 275 | - } |
|
| 276 | - } |
|
| 277 | - } |
|
| 278 | - |
|
| 279 | - return array( |
|
| 280 | - 'status' => 'success', |
|
| 281 | - 'message' => __( 'Successfully cloned mapping items', 'wordlift' ), |
|
| 282 | - ); |
|
| 283 | - } |
|
| 284 | - |
|
| 285 | - /** |
|
| 286 | - * Update posted mapping items. |
|
| 287 | - * |
|
| 288 | - * @param WP_REST_Request $request {@link WP_REST_Request instance}. |
|
| 289 | - * |
|
| 290 | - * @return array |
|
| 291 | - */ |
|
| 292 | - public static function update_mapping_items( $request ) { |
|
| 293 | - $dbo = new Mappings_DBO(); |
|
| 294 | - $post_data = $request->get_params(); |
|
| 295 | - if ( array_key_exists( 'mapping_items', $post_data ) ) { |
|
| 296 | - $mapping_items = (array) $post_data['mapping_items']; |
|
| 297 | - foreach ( $mapping_items as $mapping_item ) { |
|
| 298 | - $dbo->insert_or_update_mapping_item( $mapping_item ); |
|
| 299 | - } |
|
| 300 | - |
|
| 301 | - return array( |
|
| 302 | - 'status' => 'success', |
|
| 303 | - 'message' => __( 'Mapping items successfully updated', 'wordlift' ), |
|
| 304 | - ); |
|
| 305 | - } else { |
|
| 306 | - return array( |
|
| 307 | - 'status' => 'failure', |
|
| 308 | - 'message' => __( 'Unable to update mapping item', 'wordlift' ), |
|
| 309 | - ); |
|
| 310 | - } |
|
| 311 | - } |
|
| 312 | - |
|
| 313 | - /** |
|
| 314 | - * Delete mapping items by mapping id |
|
| 315 | - * |
|
| 316 | - * @param WP_REST_Request $request {@link WP_REST_Request instance}. |
|
| 317 | - * |
|
| 318 | - * @return array |
|
| 319 | - */ |
|
| 320 | - public static function delete_mapping_items( $request ) { |
|
| 321 | - $dbo = new Mappings_DBO(); |
|
| 322 | - $post_data = $request->get_params(); |
|
| 323 | - if ( array_key_exists( 'mapping_items', $post_data ) ) { |
|
| 324 | - $mapping_items = (array) $post_data['mapping_items']; |
|
| 325 | - foreach ( $mapping_items as $mapping_item ) { |
|
| 326 | - $dbo->delete_mapping_item( $mapping_item['mapping_id'] ); |
|
| 327 | - } |
|
| 328 | - |
|
| 329 | - return array( |
|
| 330 | - 'status' => 'success', |
|
| 331 | - 'message' => __( 'successfully deleted mapping items', 'wordlift' ) |
|
| 332 | - ); |
|
| 333 | - } else { |
|
| 334 | - return array( |
|
| 335 | - 'status' => 'failure', |
|
| 336 | - 'message' => __( 'Unable to delete mapping items', 'wordlift' ) |
|
| 337 | - ); |
|
| 338 | - } |
|
| 339 | - } |
|
| 340 | - |
|
| 341 | - /** |
|
| 342 | - * Get all mapping items |
|
| 343 | - * |
|
| 344 | - * @param WP_REST_Request $request {@link WP_REST_Request instance}. |
|
| 345 | - * |
|
| 346 | - * @return array |
|
| 347 | - */ |
|
| 348 | - public static function list_mapping_items( $request ) { |
|
| 349 | - $dbo = new Mappings_DBO(); |
|
| 350 | - |
|
| 351 | - return $dbo->get_mappings(); |
|
| 352 | - } |
|
| 353 | - |
|
| 354 | - /** |
|
| 355 | - * Returns a array of rule ids for the rule group id |
|
| 356 | - * |
|
| 357 | - * @param Object $dbo Instance of {@link Mappings_DBO } class. |
|
| 358 | - * @param int $rule_group_id Primary key of rule group table. |
|
| 359 | - * |
|
| 360 | - * @return array A list of rule ids. |
|
| 361 | - */ |
|
| 362 | - private static function get_rule_ids( $dbo, $rule_group_id ) { |
|
| 363 | - $rule_rows_in_db = $dbo->get_rules_by_rule_group( $rule_group_id ); |
|
| 364 | - $rule_ids = array(); |
|
| 365 | - foreach ( $rule_rows_in_db as $rule_row ) { |
|
| 366 | - array_push( $rule_ids, (int) $rule_row['rule_id'] ); |
|
| 367 | - } |
|
| 368 | - |
|
| 369 | - return $rule_ids; |
|
| 370 | - } |
|
| 371 | - |
|
| 372 | - /** |
|
| 373 | - * Insert or update mapping item depends on data |
|
| 374 | - * |
|
| 375 | - * @param Object $dbo Instance of {@link Mappings_DBO } class. |
|
| 376 | - * @param int $rule_group_id Refers to a rule group which this rule belongs to. |
|
| 377 | - * @param array $rule_list Array of rule items. |
|
| 378 | - * |
|
| 379 | - * @return void |
|
| 380 | - */ |
|
| 381 | - private static function save_rules( $dbo, $rule_group_id, $rule_list ) { |
|
| 382 | - $rule_ids = self::get_rule_ids( $dbo, $rule_group_id ); |
|
| 383 | - foreach ( $rule_list as $rule ) { |
|
| 384 | - // Some rules may not have rule group id, because they are inserted |
|
| 385 | - // in ui, so lets add them any way. |
|
| 386 | - $rule['rule_group_id'] = $rule_group_id; |
|
| 387 | - $dbo->insert_or_update_rule_item( $rule ); |
|
| 388 | - if ( array_key_exists( 'rule_id', $rule ) ) { |
|
| 389 | - $index_to_be_removed = array_search( |
|
| 390 | - (int) $rule['rule_id'], |
|
| 391 | - $rule_ids, |
|
| 392 | - true |
|
| 393 | - ); |
|
| 394 | - if ( false !== $index_to_be_removed ) { |
|
| 395 | - unset( $rule_ids[ $index_to_be_removed ] ); |
|
| 396 | - } |
|
| 397 | - } |
|
| 398 | - } |
|
| 399 | - foreach ( $rule_ids as $rule_id ) { |
|
| 400 | - // Delete all the rule ids which are not posted. |
|
| 401 | - $dbo->delete_rule_item( $rule_id ); |
|
| 402 | - } |
|
| 403 | - } |
|
| 404 | - |
|
| 405 | - /** |
|
| 406 | - * Insert or update rule group list based on data |
|
| 407 | - * |
|
| 408 | - * @param Object $dbo Instance of {@link Mappings_DBO } class. |
|
| 409 | - * @param int $mapping_id Primary key of mapping table. |
|
| 410 | - * @param array $property_list { Array of property items }. |
|
| 411 | - * |
|
| 412 | - * @return void |
|
| 413 | - */ |
|
| 414 | - private static function save_property_list( $dbo, $mapping_id, $property_list ) { |
|
| 415 | - $properties_needed_to_be_deleted = $dbo->get_properties( $mapping_id ); |
|
| 416 | - $property_ids = array(); |
|
| 417 | - foreach ( $properties_needed_to_be_deleted as $property ) { |
|
| 418 | - array_push( $property_ids, (int) $property['property_id'] ); |
|
| 419 | - } |
|
| 420 | - foreach ( $property_list as $property ) { |
|
| 421 | - if ( array_key_exists( 'property_id', $property ) ) { |
|
| 422 | - // Remove the id from the list of property ids needed to be deleted |
|
| 423 | - // because it is posted. |
|
| 424 | - $index_to_be_removed = array_search( |
|
| 425 | - (int) $property['property_id'], |
|
| 426 | - $property_ids, |
|
| 427 | - true |
|
| 428 | - ); |
|
| 429 | - if ( false !== $index_to_be_removed ) { |
|
| 430 | - unset( $property_ids[ $index_to_be_removed ] ); |
|
| 431 | - } |
|
| 432 | - } |
|
| 433 | - // Add mapping id to property data. |
|
| 434 | - $property['mapping_id'] = $mapping_id; |
|
| 435 | - $dbo->insert_or_update_property( $property ); |
|
| 436 | - |
|
| 437 | - } |
|
| 438 | - // At the end remove all the property ids which are not posted. |
|
| 439 | - foreach ( $property_ids as $property_id ) { |
|
| 440 | - $dbo->delete_property( $property_id ); |
|
| 441 | - } |
|
| 442 | - |
|
| 443 | - } |
|
| 444 | - |
|
| 445 | - /** |
|
| 446 | - * Returns a array of rule group ids for the mapping id |
|
| 447 | - * |
|
| 448 | - * @param Object $dbo Instance of {@link Mappings_DBO } class. |
|
| 449 | - * @param int $mapping_id Primary key of mapping table. |
|
| 450 | - * |
|
| 451 | - * @return array $rule_group_ids A list of rule group ids. |
|
| 452 | - */ |
|
| 453 | - private static function get_rule_group_ids( $dbo, $mapping_id ) { |
|
| 454 | - $rule_group_rows = $dbo->get_rule_group_list( $mapping_id ); |
|
| 455 | - $rule_group_ids = array(); |
|
| 456 | - foreach ( $rule_group_rows as $rule_group_row ) { |
|
| 457 | - array_push( $rule_group_ids, (int) $rule_group_row['rule_group_id'] ); |
|
| 458 | - } |
|
| 459 | - |
|
| 460 | - return $rule_group_ids; |
|
| 461 | - } |
|
| 462 | - |
|
| 463 | - /** |
|
| 464 | - * Insert or update rule group list |
|
| 465 | - * |
|
| 466 | - * @param Object $dbo Instance of {@link Mappings_DBO } class. |
|
| 467 | - * @param int $mapping_id Primary key of mapping table. |
|
| 468 | - * @param array $rule_group_list { Array of rule group items }. |
|
| 469 | - * |
|
| 470 | - * @return void |
|
| 471 | - */ |
|
| 472 | - private static function save_rule_group_list( $dbo, $mapping_id, $rule_group_list ) { |
|
| 473 | - // The rule groups not posted should be deleted. |
|
| 474 | - $rule_group_ids = self::get_rule_group_ids( $dbo, $mapping_id ); |
|
| 475 | - // Loop through rule group list and save the rule group. |
|
| 476 | - foreach ( $rule_group_list as $rule_group ) { |
|
| 477 | - if ( array_key_exists( 'rule_group_id', $rule_group ) ) { |
|
| 478 | - $rule_group_id = $rule_group['rule_group_id']; |
|
| 479 | - } else { |
|
| 480 | - // New rule group, should create new rule group id. |
|
| 481 | - $rule_group_id = $dbo->insert_rule_group( $mapping_id ); |
|
| 482 | - } |
|
| 483 | - $index_to_be_removed = array_search( |
|
| 484 | - (int) $rule_group_id, |
|
| 485 | - $rule_group_ids, |
|
| 486 | - true |
|
| 487 | - ); |
|
| 488 | - if ( false !== $index_to_be_removed ) { |
|
| 489 | - unset( $rule_group_ids[ $index_to_be_removed ] ); |
|
| 490 | - } |
|
| 491 | - self::save_rules( $dbo, $rule_group_id, $rule_group['rules'] ); |
|
| 492 | - } |
|
| 493 | - |
|
| 494 | - // Remove all the rule groups which are not posted. |
|
| 495 | - foreach ( $rule_group_ids as $rule_group_id ) { |
|
| 496 | - $dbo->delete_rule_group_item( $rule_group_id ); |
|
| 497 | - } |
|
| 498 | - } |
|
| 499 | - |
|
| 500 | - /** |
|
| 501 | - * Insert or update mapping item depends on data |
|
| 502 | - * |
|
| 503 | - * @param WP_REST_Request $request {@link WP_REST_Request instance}. |
|
| 504 | - * |
|
| 505 | - * @return array |
|
| 506 | - */ |
|
| 507 | - public static function insert_or_update_mapping_item( $request ) { |
|
| 508 | - $post_data = $request->get_params() === null ? array() : $request->get_params(); |
|
| 509 | - $dbo = new Mappings_DBO(); |
|
| 510 | - // check if valid object is posted. |
|
| 511 | - if ( array_key_exists( 'mapping_title', $post_data ) && |
|
| 512 | - array_key_exists( 'rule_group_list', $post_data ) && |
|
| 513 | - array_key_exists( 'property_list', $post_data ) ) { |
|
| 514 | - // Do validation, remove all incomplete data. |
|
| 515 | - $mapping_item = array(); |
|
| 516 | - if ( array_key_exists( 'mapping_id', $post_data ) ) { |
|
| 517 | - $mapping_item['mapping_id'] = $post_data['mapping_id']; |
|
| 518 | - } |
|
| 519 | - $mapping_item['mapping_title'] = $post_data['mapping_title']; |
|
| 520 | - // lets save the mapping item. |
|
| 521 | - $mapping_id = $dbo->insert_or_update_mapping_item( $mapping_item ); |
|
| 522 | - self::save_rule_group_list( $dbo, $mapping_id, $post_data['rule_group_list'] ); |
|
| 523 | - self::save_property_list( $dbo, $mapping_id, $post_data['property_list'] ); |
|
| 524 | - |
|
| 525 | - return array( |
|
| 526 | - 'status' => 'success', |
|
| 527 | - 'message' => __( 'Successfully saved mapping item', 'wordlift' ), |
|
| 528 | - 'mapping_id' => (int) $mapping_id, |
|
| 529 | - ); |
|
| 530 | - } else { |
|
| 531 | - return array( |
|
| 532 | - 'status' => 'error', |
|
| 533 | - 'message' => __( 'Unable to save mapping item', 'wordlift' ), |
|
| 534 | - ); |
|
| 535 | - } |
|
| 536 | - } |
|
| 209 | + /** |
|
| 210 | + * Get the terms for the posted taxonomy name. |
|
| 211 | + * |
|
| 212 | + * @param WP_REST_Request $request {@link WP_REST_Request instance}. |
|
| 213 | + * |
|
| 214 | + * @return array The array of the terms for the taxonomy. |
|
| 215 | + */ |
|
| 216 | + public static function get_terms_for_the_posted_taxonomy( $request ) { |
|
| 217 | + $post_data = $request->get_params(); |
|
| 218 | + if ( ! array_key_exists( 'taxonomy', $post_data ) ) { |
|
| 219 | + return array( |
|
| 220 | + 'status' => 'failure', |
|
| 221 | + 'message' => __( 'Request not valid, must post a taxonomy to get terms', 'wordlift' ) |
|
| 222 | + ); |
|
| 223 | + } else { |
|
| 224 | + $taxonomy = $post_data['taxonomy']; |
|
| 225 | + $terms = get_terms( $taxonomy, array( 'hide_empty' => false, ) ); |
|
| 226 | + if ( is_wp_error( $terms ) ) { |
|
| 227 | + // Return error response, if the taxonomy is not valid. |
|
| 228 | + return array( |
|
| 229 | + 'status' => 'failure', |
|
| 230 | + 'message' => __( 'Request not valid, must post a valid taxonomy', 'wordlift' ) |
|
| 231 | + ); |
|
| 232 | + } |
|
| 233 | + |
|
| 234 | + return $terms; |
|
| 235 | + } |
|
| 236 | + } |
|
| 237 | + |
|
| 238 | + /** |
|
| 239 | + * Clone posted mapping items. |
|
| 240 | + * |
|
| 241 | + * @param WP_REST_Request $request {@link WP_REST_Request instance}. |
|
| 242 | + * |
|
| 243 | + * @return array |
|
| 244 | + */ |
|
| 245 | + public static function clone_mapping_items( $request ) { |
|
| 246 | + $dbo = new Mappings_DBO(); |
|
| 247 | + $post_data = (array) $request->get_params(); |
|
| 248 | + $mapping_items = (array) $post_data['mapping_items']; |
|
| 249 | + foreach ( $mapping_items as $mapping_item ) { |
|
| 250 | + $mapping_id = (int) $mapping_item['mapping_id']; |
|
| 251 | + // Clone the current mapping item. |
|
| 252 | + $cloned_mapping_id = $dbo->insert_mapping_item( $mapping_item['mapping_title'] ); |
|
| 253 | + // Clone all the rule groups. |
|
| 254 | + $rule_groups_to_be_cloned = $dbo->get_rule_groups_by_mapping( $mapping_id ); |
|
| 255 | + // Clone all the properties. |
|
| 256 | + $properties_to_be_cloned = $dbo->get_properties( $mapping_id ); |
|
| 257 | + foreach ( $properties_to_be_cloned as $property ) { |
|
| 258 | + // Assign a new mapping id. |
|
| 259 | + $property['mapping_id'] = $cloned_mapping_id; |
|
| 260 | + // Removing this property id, since a new id needed to be created for |
|
| 261 | + // new property. |
|
| 262 | + unset( $property['property_id'] ); |
|
| 263 | + $dbo->insert_or_update_property( $property ); |
|
| 264 | + } |
|
| 265 | + // Loop through the rule groups and insert them in table with the mapping id. |
|
| 266 | + foreach ( $rule_groups_to_be_cloned as $rule_group ) { |
|
| 267 | + $cloned_rule_group_id = $dbo->insert_rule_group( $cloned_mapping_id ); |
|
| 268 | + $original_rules = (array) $rule_group['rules']; |
|
| 269 | + // Now we need to insert these rules for the cloned rule group id. |
|
| 270 | + foreach ( $original_rules as $clone_rule ) { |
|
| 271 | + // We should replace only rule group id in the cloned rules. |
|
| 272 | + $clone_rule['rule_group_id'] = (int) $cloned_rule_group_id; |
|
| 273 | + unset( $clone_rule['rule_id'] ); |
|
| 274 | + $dbo->insert_or_update_rule_item( $clone_rule ); |
|
| 275 | + } |
|
| 276 | + } |
|
| 277 | + } |
|
| 278 | + |
|
| 279 | + return array( |
|
| 280 | + 'status' => 'success', |
|
| 281 | + 'message' => __( 'Successfully cloned mapping items', 'wordlift' ), |
|
| 282 | + ); |
|
| 283 | + } |
|
| 284 | + |
|
| 285 | + /** |
|
| 286 | + * Update posted mapping items. |
|
| 287 | + * |
|
| 288 | + * @param WP_REST_Request $request {@link WP_REST_Request instance}. |
|
| 289 | + * |
|
| 290 | + * @return array |
|
| 291 | + */ |
|
| 292 | + public static function update_mapping_items( $request ) { |
|
| 293 | + $dbo = new Mappings_DBO(); |
|
| 294 | + $post_data = $request->get_params(); |
|
| 295 | + if ( array_key_exists( 'mapping_items', $post_data ) ) { |
|
| 296 | + $mapping_items = (array) $post_data['mapping_items']; |
|
| 297 | + foreach ( $mapping_items as $mapping_item ) { |
|
| 298 | + $dbo->insert_or_update_mapping_item( $mapping_item ); |
|
| 299 | + } |
|
| 300 | + |
|
| 301 | + return array( |
|
| 302 | + 'status' => 'success', |
|
| 303 | + 'message' => __( 'Mapping items successfully updated', 'wordlift' ), |
|
| 304 | + ); |
|
| 305 | + } else { |
|
| 306 | + return array( |
|
| 307 | + 'status' => 'failure', |
|
| 308 | + 'message' => __( 'Unable to update mapping item', 'wordlift' ), |
|
| 309 | + ); |
|
| 310 | + } |
|
| 311 | + } |
|
| 312 | + |
|
| 313 | + /** |
|
| 314 | + * Delete mapping items by mapping id |
|
| 315 | + * |
|
| 316 | + * @param WP_REST_Request $request {@link WP_REST_Request instance}. |
|
| 317 | + * |
|
| 318 | + * @return array |
|
| 319 | + */ |
|
| 320 | + public static function delete_mapping_items( $request ) { |
|
| 321 | + $dbo = new Mappings_DBO(); |
|
| 322 | + $post_data = $request->get_params(); |
|
| 323 | + if ( array_key_exists( 'mapping_items', $post_data ) ) { |
|
| 324 | + $mapping_items = (array) $post_data['mapping_items']; |
|
| 325 | + foreach ( $mapping_items as $mapping_item ) { |
|
| 326 | + $dbo->delete_mapping_item( $mapping_item['mapping_id'] ); |
|
| 327 | + } |
|
| 328 | + |
|
| 329 | + return array( |
|
| 330 | + 'status' => 'success', |
|
| 331 | + 'message' => __( 'successfully deleted mapping items', 'wordlift' ) |
|
| 332 | + ); |
|
| 333 | + } else { |
|
| 334 | + return array( |
|
| 335 | + 'status' => 'failure', |
|
| 336 | + 'message' => __( 'Unable to delete mapping items', 'wordlift' ) |
|
| 337 | + ); |
|
| 338 | + } |
|
| 339 | + } |
|
| 340 | + |
|
| 341 | + /** |
|
| 342 | + * Get all mapping items |
|
| 343 | + * |
|
| 344 | + * @param WP_REST_Request $request {@link WP_REST_Request instance}. |
|
| 345 | + * |
|
| 346 | + * @return array |
|
| 347 | + */ |
|
| 348 | + public static function list_mapping_items( $request ) { |
|
| 349 | + $dbo = new Mappings_DBO(); |
|
| 350 | + |
|
| 351 | + return $dbo->get_mappings(); |
|
| 352 | + } |
|
| 353 | + |
|
| 354 | + /** |
|
| 355 | + * Returns a array of rule ids for the rule group id |
|
| 356 | + * |
|
| 357 | + * @param Object $dbo Instance of {@link Mappings_DBO } class. |
|
| 358 | + * @param int $rule_group_id Primary key of rule group table. |
|
| 359 | + * |
|
| 360 | + * @return array A list of rule ids. |
|
| 361 | + */ |
|
| 362 | + private static function get_rule_ids( $dbo, $rule_group_id ) { |
|
| 363 | + $rule_rows_in_db = $dbo->get_rules_by_rule_group( $rule_group_id ); |
|
| 364 | + $rule_ids = array(); |
|
| 365 | + foreach ( $rule_rows_in_db as $rule_row ) { |
|
| 366 | + array_push( $rule_ids, (int) $rule_row['rule_id'] ); |
|
| 367 | + } |
|
| 368 | + |
|
| 369 | + return $rule_ids; |
|
| 370 | + } |
|
| 371 | + |
|
| 372 | + /** |
|
| 373 | + * Insert or update mapping item depends on data |
|
| 374 | + * |
|
| 375 | + * @param Object $dbo Instance of {@link Mappings_DBO } class. |
|
| 376 | + * @param int $rule_group_id Refers to a rule group which this rule belongs to. |
|
| 377 | + * @param array $rule_list Array of rule items. |
|
| 378 | + * |
|
| 379 | + * @return void |
|
| 380 | + */ |
|
| 381 | + private static function save_rules( $dbo, $rule_group_id, $rule_list ) { |
|
| 382 | + $rule_ids = self::get_rule_ids( $dbo, $rule_group_id ); |
|
| 383 | + foreach ( $rule_list as $rule ) { |
|
| 384 | + // Some rules may not have rule group id, because they are inserted |
|
| 385 | + // in ui, so lets add them any way. |
|
| 386 | + $rule['rule_group_id'] = $rule_group_id; |
|
| 387 | + $dbo->insert_or_update_rule_item( $rule ); |
|
| 388 | + if ( array_key_exists( 'rule_id', $rule ) ) { |
|
| 389 | + $index_to_be_removed = array_search( |
|
| 390 | + (int) $rule['rule_id'], |
|
| 391 | + $rule_ids, |
|
| 392 | + true |
|
| 393 | + ); |
|
| 394 | + if ( false !== $index_to_be_removed ) { |
|
| 395 | + unset( $rule_ids[ $index_to_be_removed ] ); |
|
| 396 | + } |
|
| 397 | + } |
|
| 398 | + } |
|
| 399 | + foreach ( $rule_ids as $rule_id ) { |
|
| 400 | + // Delete all the rule ids which are not posted. |
|
| 401 | + $dbo->delete_rule_item( $rule_id ); |
|
| 402 | + } |
|
| 403 | + } |
|
| 404 | + |
|
| 405 | + /** |
|
| 406 | + * Insert or update rule group list based on data |
|
| 407 | + * |
|
| 408 | + * @param Object $dbo Instance of {@link Mappings_DBO } class. |
|
| 409 | + * @param int $mapping_id Primary key of mapping table. |
|
| 410 | + * @param array $property_list { Array of property items }. |
|
| 411 | + * |
|
| 412 | + * @return void |
|
| 413 | + */ |
|
| 414 | + private static function save_property_list( $dbo, $mapping_id, $property_list ) { |
|
| 415 | + $properties_needed_to_be_deleted = $dbo->get_properties( $mapping_id ); |
|
| 416 | + $property_ids = array(); |
|
| 417 | + foreach ( $properties_needed_to_be_deleted as $property ) { |
|
| 418 | + array_push( $property_ids, (int) $property['property_id'] ); |
|
| 419 | + } |
|
| 420 | + foreach ( $property_list as $property ) { |
|
| 421 | + if ( array_key_exists( 'property_id', $property ) ) { |
|
| 422 | + // Remove the id from the list of property ids needed to be deleted |
|
| 423 | + // because it is posted. |
|
| 424 | + $index_to_be_removed = array_search( |
|
| 425 | + (int) $property['property_id'], |
|
| 426 | + $property_ids, |
|
| 427 | + true |
|
| 428 | + ); |
|
| 429 | + if ( false !== $index_to_be_removed ) { |
|
| 430 | + unset( $property_ids[ $index_to_be_removed ] ); |
|
| 431 | + } |
|
| 432 | + } |
|
| 433 | + // Add mapping id to property data. |
|
| 434 | + $property['mapping_id'] = $mapping_id; |
|
| 435 | + $dbo->insert_or_update_property( $property ); |
|
| 436 | + |
|
| 437 | + } |
|
| 438 | + // At the end remove all the property ids which are not posted. |
|
| 439 | + foreach ( $property_ids as $property_id ) { |
|
| 440 | + $dbo->delete_property( $property_id ); |
|
| 441 | + } |
|
| 442 | + |
|
| 443 | + } |
|
| 444 | + |
|
| 445 | + /** |
|
| 446 | + * Returns a array of rule group ids for the mapping id |
|
| 447 | + * |
|
| 448 | + * @param Object $dbo Instance of {@link Mappings_DBO } class. |
|
| 449 | + * @param int $mapping_id Primary key of mapping table. |
|
| 450 | + * |
|
| 451 | + * @return array $rule_group_ids A list of rule group ids. |
|
| 452 | + */ |
|
| 453 | + private static function get_rule_group_ids( $dbo, $mapping_id ) { |
|
| 454 | + $rule_group_rows = $dbo->get_rule_group_list( $mapping_id ); |
|
| 455 | + $rule_group_ids = array(); |
|
| 456 | + foreach ( $rule_group_rows as $rule_group_row ) { |
|
| 457 | + array_push( $rule_group_ids, (int) $rule_group_row['rule_group_id'] ); |
|
| 458 | + } |
|
| 459 | + |
|
| 460 | + return $rule_group_ids; |
|
| 461 | + } |
|
| 462 | + |
|
| 463 | + /** |
|
| 464 | + * Insert or update rule group list |
|
| 465 | + * |
|
| 466 | + * @param Object $dbo Instance of {@link Mappings_DBO } class. |
|
| 467 | + * @param int $mapping_id Primary key of mapping table. |
|
| 468 | + * @param array $rule_group_list { Array of rule group items }. |
|
| 469 | + * |
|
| 470 | + * @return void |
|
| 471 | + */ |
|
| 472 | + private static function save_rule_group_list( $dbo, $mapping_id, $rule_group_list ) { |
|
| 473 | + // The rule groups not posted should be deleted. |
|
| 474 | + $rule_group_ids = self::get_rule_group_ids( $dbo, $mapping_id ); |
|
| 475 | + // Loop through rule group list and save the rule group. |
|
| 476 | + foreach ( $rule_group_list as $rule_group ) { |
|
| 477 | + if ( array_key_exists( 'rule_group_id', $rule_group ) ) { |
|
| 478 | + $rule_group_id = $rule_group['rule_group_id']; |
|
| 479 | + } else { |
|
| 480 | + // New rule group, should create new rule group id. |
|
| 481 | + $rule_group_id = $dbo->insert_rule_group( $mapping_id ); |
|
| 482 | + } |
|
| 483 | + $index_to_be_removed = array_search( |
|
| 484 | + (int) $rule_group_id, |
|
| 485 | + $rule_group_ids, |
|
| 486 | + true |
|
| 487 | + ); |
|
| 488 | + if ( false !== $index_to_be_removed ) { |
|
| 489 | + unset( $rule_group_ids[ $index_to_be_removed ] ); |
|
| 490 | + } |
|
| 491 | + self::save_rules( $dbo, $rule_group_id, $rule_group['rules'] ); |
|
| 492 | + } |
|
| 493 | + |
|
| 494 | + // Remove all the rule groups which are not posted. |
|
| 495 | + foreach ( $rule_group_ids as $rule_group_id ) { |
|
| 496 | + $dbo->delete_rule_group_item( $rule_group_id ); |
|
| 497 | + } |
|
| 498 | + } |
|
| 499 | + |
|
| 500 | + /** |
|
| 501 | + * Insert or update mapping item depends on data |
|
| 502 | + * |
|
| 503 | + * @param WP_REST_Request $request {@link WP_REST_Request instance}. |
|
| 504 | + * |
|
| 505 | + * @return array |
|
| 506 | + */ |
|
| 507 | + public static function insert_or_update_mapping_item( $request ) { |
|
| 508 | + $post_data = $request->get_params() === null ? array() : $request->get_params(); |
|
| 509 | + $dbo = new Mappings_DBO(); |
|
| 510 | + // check if valid object is posted. |
|
| 511 | + if ( array_key_exists( 'mapping_title', $post_data ) && |
|
| 512 | + array_key_exists( 'rule_group_list', $post_data ) && |
|
| 513 | + array_key_exists( 'property_list', $post_data ) ) { |
|
| 514 | + // Do validation, remove all incomplete data. |
|
| 515 | + $mapping_item = array(); |
|
| 516 | + if ( array_key_exists( 'mapping_id', $post_data ) ) { |
|
| 517 | + $mapping_item['mapping_id'] = $post_data['mapping_id']; |
|
| 518 | + } |
|
| 519 | + $mapping_item['mapping_title'] = $post_data['mapping_title']; |
|
| 520 | + // lets save the mapping item. |
|
| 521 | + $mapping_id = $dbo->insert_or_update_mapping_item( $mapping_item ); |
|
| 522 | + self::save_rule_group_list( $dbo, $mapping_id, $post_data['rule_group_list'] ); |
|
| 523 | + self::save_property_list( $dbo, $mapping_id, $post_data['property_list'] ); |
|
| 524 | + |
|
| 525 | + return array( |
|
| 526 | + 'status' => 'success', |
|
| 527 | + 'message' => __( 'Successfully saved mapping item', 'wordlift' ), |
|
| 528 | + 'mapping_id' => (int) $mapping_id, |
|
| 529 | + ); |
|
| 530 | + } else { |
|
| 531 | + return array( |
|
| 532 | + 'status' => 'error', |
|
| 533 | + 'message' => __( 'Unable to save mapping item', 'wordlift' ), |
|
| 534 | + ); |
|
| 535 | + } |
|
| 536 | + } |
|
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | Mappings_REST_Controller::register_routes(); |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public static function register_routes() { |
| 23 | 23 | |
| 24 | - add_action( 'rest_api_init', 'Wordlift\Mappings\Mappings_REST_Controller::register_route_callback' ); |
|
| 24 | + add_action('rest_api_init', 'Wordlift\Mappings\Mappings_REST_Controller::register_route_callback'); |
|
| 25 | 25 | |
| 26 | 26 | } |
| 27 | 27 | |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @return array |
| 34 | 34 | */ |
| 35 | - public static function get_mapping_item( $request ) { |
|
| 35 | + public static function get_mapping_item($request) { |
|
| 36 | 36 | $dbo = new Mappings_DBO(); |
| 37 | 37 | $mapping_id = $request['id']; |
| 38 | 38 | $mapping_id_data = array(); |
| 39 | - $rule_groups = $dbo->get_rule_groups_by_mapping( $mapping_id ); |
|
| 40 | - $properties = $dbo->get_properties( $mapping_id ); |
|
| 41 | - $mapping_row = $dbo->get_mapping_item_data( $mapping_id ); |
|
| 39 | + $rule_groups = $dbo->get_rule_groups_by_mapping($mapping_id); |
|
| 40 | + $properties = $dbo->get_properties($mapping_id); |
|
| 41 | + $mapping_row = $dbo->get_mapping_item_data($mapping_id); |
|
| 42 | 42 | |
| 43 | 43 | $mapping_id_data['mapping_id'] = $mapping_id; |
| 44 | 44 | $mapping_id_data['property_list'] = $properties; |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | array( |
| 61 | 61 | 'methods' => WP_REST_Server::CREATABLE, |
| 62 | 62 | 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::insert_or_update_mapping_item', |
| 63 | - 'permission_callback' => function () { |
|
| 64 | - return current_user_can( 'manage_options' ); |
|
| 63 | + 'permission_callback' => function() { |
|
| 64 | + return current_user_can('manage_options'); |
|
| 65 | 65 | }, |
| 66 | 66 | ) |
| 67 | 67 | ); |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | array( |
| 73 | 73 | 'methods' => WP_REST_Server::READABLE, |
| 74 | 74 | 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::list_mapping_items', |
| 75 | - 'permission_callback' => function () { |
|
| 76 | - return current_user_can( 'manage_options' ); |
|
| 75 | + 'permission_callback' => function() { |
|
| 76 | + return current_user_can('manage_options'); |
|
| 77 | 77 | }, |
| 78 | 78 | ) |
| 79 | 79 | ); |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | array( |
| 86 | 86 | 'methods' => WP_REST_Server::DELETABLE, |
| 87 | 87 | 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::delete_mapping_items', |
| 88 | - 'permission_callback' => function () { |
|
| 89 | - return current_user_can( 'manage_options' ); |
|
| 88 | + 'permission_callback' => function() { |
|
| 89 | + return current_user_can('manage_options'); |
|
| 90 | 90 | }, |
| 91 | 91 | ) |
| 92 | 92 | ); |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | array( |
| 99 | 99 | 'methods' => WP_REST_Server::READABLE, |
| 100 | 100 | 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::get_mapping_item', |
| 101 | - 'permission_callback' => function () { |
|
| 102 | - return current_user_can( 'manage_options' ); |
|
| 101 | + 'permission_callback' => function() { |
|
| 102 | + return current_user_can('manage_options'); |
|
| 103 | 103 | }, |
| 104 | 104 | ) |
| 105 | 105 | ); |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | array( |
| 112 | 112 | 'methods' => WP_REST_Server::EDITABLE, |
| 113 | 113 | 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::update_mapping_items', |
| 114 | - 'permission_callback' => function () { |
|
| 115 | - return current_user_can( 'manage_options' ); |
|
| 114 | + 'permission_callback' => function() { |
|
| 115 | + return current_user_can('manage_options'); |
|
| 116 | 116 | }, |
| 117 | 117 | ) |
| 118 | 118 | ); |
@@ -124,8 +124,8 @@ discard block |
||
| 124 | 124 | array( |
| 125 | 125 | 'methods' => WP_REST_Server::CREATABLE, |
| 126 | 126 | 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::clone_mapping_items', |
| 127 | - 'permission_callback' => function () { |
|
| 128 | - return current_user_can( 'manage_options' ); |
|
| 127 | + 'permission_callback' => function() { |
|
| 128 | + return current_user_can('manage_options'); |
|
| 129 | 129 | }, |
| 130 | 130 | ) |
| 131 | 131 | ); |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | array( |
| 138 | 138 | 'methods' => WP_REST_Server::CREATABLE, |
| 139 | 139 | 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::get_terms_for_the_posted_taxonomy', |
| 140 | - 'permission_callback' => function () { |
|
| 141 | - return current_user_can( 'manage_options' ); |
|
| 140 | + 'permission_callback' => function() { |
|
| 141 | + return current_user_can('manage_options'); |
|
| 142 | 142 | }, |
| 143 | 143 | ) |
| 144 | 144 | ); |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | array( |
| 151 | 151 | 'methods' => WP_REST_Server::CREATABLE, |
| 152 | 152 | 'callback' => 'Wordlift\Mappings\Mappings_REST_Controller::get_taxonomy_terms_for_the_posted_taxonomy', |
| 153 | - 'permission_callback' => function () { |
|
| 154 | - return current_user_can( 'manage_options' ); |
|
| 153 | + 'permission_callback' => function() { |
|
| 154 | + return current_user_can('manage_options'); |
|
| 155 | 155 | }, |
| 156 | 156 | ) |
| 157 | 157 | ); |
@@ -164,11 +164,11 @@ discard block |
||
| 164 | 164 | * |
| 165 | 165 | * @return array The array of the taxonomies & terms. |
| 166 | 166 | */ |
| 167 | - public static function get_taxonomy_terms_for_the_posted_taxonomy( $request ) { |
|
| 167 | + public static function get_taxonomy_terms_for_the_posted_taxonomy($request) { |
|
| 168 | 168 | $taxonomy_terms = array(); |
| 169 | - $post_taxonomies = get_taxonomies( array(), 'objects' ); |
|
| 169 | + $post_taxonomies = get_taxonomies(array(), 'objects'); |
|
| 170 | 170 | |
| 171 | - foreach ( $post_taxonomies as $post_taxonomy ) { |
|
| 171 | + foreach ($post_taxonomies as $post_taxonomy) { |
|
| 172 | 172 | $taxonomy_config = array( |
| 173 | 173 | 'taxonomy' => $post_taxonomy->name, |
| 174 | 174 | 'hide_empty' => false |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | $total_terms = wp_count_terms($taxonomy_config); |
| 178 | 178 | |
| 179 | - $post_taxonomy_terms = get_terms( $taxonomy_config ); |
|
| 179 | + $post_taxonomy_terms = get_terms($taxonomy_config); |
|
| 180 | 180 | |
| 181 | 181 | if ($total_terms) { |
| 182 | 182 | $group_taxonomy = array('parentValue' => 'post_taxonomy', 'group_name' => $post_taxonomy->label, 'group_options' => array()); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | foreach ($post_taxonomy_terms as $post_taxonomy_term) { |
| 185 | 185 | array_push($group_taxonomy['group_options'], |
| 186 | 186 | array( |
| 187 | - 'label' => ' - ' . $post_taxonomy_term->name, |
|
| 187 | + 'label' => ' - '.$post_taxonomy_term->name, |
|
| 188 | 188 | 'value' => $post_taxonomy_term->slug, |
| 189 | 189 | 'taxonomy' => 'post_taxonomy', |
| 190 | 190 | ) |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | array_push($group_taxonomy['group_options'], |
| 199 | 199 | array( |
| 200 | - 'label' => ' -- ' . $child_term->name, |
|
| 200 | + 'label' => ' -- '.$child_term->name, |
|
| 201 | 201 | 'value' => $child_term->slug, |
| 202 | 202 | 'taxonomy' => 'post_taxonomy', |
| 203 | 203 | ) |
@@ -218,21 +218,21 @@ discard block |
||
| 218 | 218 | * |
| 219 | 219 | * @return array The array of the terms for the taxonomy. |
| 220 | 220 | */ |
| 221 | - public static function get_terms_for_the_posted_taxonomy( $request ) { |
|
| 221 | + public static function get_terms_for_the_posted_taxonomy($request) { |
|
| 222 | 222 | $post_data = $request->get_params(); |
| 223 | - if ( ! array_key_exists( 'taxonomy', $post_data ) ) { |
|
| 223 | + if ( ! array_key_exists('taxonomy', $post_data)) { |
|
| 224 | 224 | return array( |
| 225 | 225 | 'status' => 'failure', |
| 226 | - 'message' => __( 'Request not valid, must post a taxonomy to get terms', 'wordlift' ) |
|
| 226 | + 'message' => __('Request not valid, must post a taxonomy to get terms', 'wordlift') |
|
| 227 | 227 | ); |
| 228 | 228 | } else { |
| 229 | 229 | $taxonomy = $post_data['taxonomy']; |
| 230 | - $terms = get_terms( $taxonomy, array( 'hide_empty' => false, ) ); |
|
| 231 | - if ( is_wp_error( $terms ) ) { |
|
| 230 | + $terms = get_terms($taxonomy, array('hide_empty' => false,)); |
|
| 231 | + if (is_wp_error($terms)) { |
|
| 232 | 232 | // Return error response, if the taxonomy is not valid. |
| 233 | 233 | return array( |
| 234 | 234 | 'status' => 'failure', |
| 235 | - 'message' => __( 'Request not valid, must post a valid taxonomy', 'wordlift' ) |
|
| 235 | + 'message' => __('Request not valid, must post a valid taxonomy', 'wordlift') |
|
| 236 | 236 | ); |
| 237 | 237 | } |
| 238 | 238 | |
@@ -247,43 +247,43 @@ discard block |
||
| 247 | 247 | * |
| 248 | 248 | * @return array |
| 249 | 249 | */ |
| 250 | - public static function clone_mapping_items( $request ) { |
|
| 250 | + public static function clone_mapping_items($request) { |
|
| 251 | 251 | $dbo = new Mappings_DBO(); |
| 252 | 252 | $post_data = (array) $request->get_params(); |
| 253 | 253 | $mapping_items = (array) $post_data['mapping_items']; |
| 254 | - foreach ( $mapping_items as $mapping_item ) { |
|
| 254 | + foreach ($mapping_items as $mapping_item) { |
|
| 255 | 255 | $mapping_id = (int) $mapping_item['mapping_id']; |
| 256 | 256 | // Clone the current mapping item. |
| 257 | - $cloned_mapping_id = $dbo->insert_mapping_item( $mapping_item['mapping_title'] ); |
|
| 257 | + $cloned_mapping_id = $dbo->insert_mapping_item($mapping_item['mapping_title']); |
|
| 258 | 258 | // Clone all the rule groups. |
| 259 | - $rule_groups_to_be_cloned = $dbo->get_rule_groups_by_mapping( $mapping_id ); |
|
| 259 | + $rule_groups_to_be_cloned = $dbo->get_rule_groups_by_mapping($mapping_id); |
|
| 260 | 260 | // Clone all the properties. |
| 261 | - $properties_to_be_cloned = $dbo->get_properties( $mapping_id ); |
|
| 262 | - foreach ( $properties_to_be_cloned as $property ) { |
|
| 261 | + $properties_to_be_cloned = $dbo->get_properties($mapping_id); |
|
| 262 | + foreach ($properties_to_be_cloned as $property) { |
|
| 263 | 263 | // Assign a new mapping id. |
| 264 | 264 | $property['mapping_id'] = $cloned_mapping_id; |
| 265 | 265 | // Removing this property id, since a new id needed to be created for |
| 266 | 266 | // new property. |
| 267 | - unset( $property['property_id'] ); |
|
| 268 | - $dbo->insert_or_update_property( $property ); |
|
| 267 | + unset($property['property_id']); |
|
| 268 | + $dbo->insert_or_update_property($property); |
|
| 269 | 269 | } |
| 270 | 270 | // Loop through the rule groups and insert them in table with the mapping id. |
| 271 | - foreach ( $rule_groups_to_be_cloned as $rule_group ) { |
|
| 272 | - $cloned_rule_group_id = $dbo->insert_rule_group( $cloned_mapping_id ); |
|
| 271 | + foreach ($rule_groups_to_be_cloned as $rule_group) { |
|
| 272 | + $cloned_rule_group_id = $dbo->insert_rule_group($cloned_mapping_id); |
|
| 273 | 273 | $original_rules = (array) $rule_group['rules']; |
| 274 | 274 | // Now we need to insert these rules for the cloned rule group id. |
| 275 | - foreach ( $original_rules as $clone_rule ) { |
|
| 275 | + foreach ($original_rules as $clone_rule) { |
|
| 276 | 276 | // We should replace only rule group id in the cloned rules. |
| 277 | 277 | $clone_rule['rule_group_id'] = (int) $cloned_rule_group_id; |
| 278 | - unset( $clone_rule['rule_id'] ); |
|
| 279 | - $dbo->insert_or_update_rule_item( $clone_rule ); |
|
| 278 | + unset($clone_rule['rule_id']); |
|
| 279 | + $dbo->insert_or_update_rule_item($clone_rule); |
|
| 280 | 280 | } |
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | return array( |
| 285 | 285 | 'status' => 'success', |
| 286 | - 'message' => __( 'Successfully cloned mapping items', 'wordlift' ), |
|
| 286 | + 'message' => __('Successfully cloned mapping items', 'wordlift'), |
|
| 287 | 287 | ); |
| 288 | 288 | } |
| 289 | 289 | |
@@ -294,23 +294,23 @@ discard block |
||
| 294 | 294 | * |
| 295 | 295 | * @return array |
| 296 | 296 | */ |
| 297 | - public static function update_mapping_items( $request ) { |
|
| 297 | + public static function update_mapping_items($request) { |
|
| 298 | 298 | $dbo = new Mappings_DBO(); |
| 299 | 299 | $post_data = $request->get_params(); |
| 300 | - if ( array_key_exists( 'mapping_items', $post_data ) ) { |
|
| 300 | + if (array_key_exists('mapping_items', $post_data)) { |
|
| 301 | 301 | $mapping_items = (array) $post_data['mapping_items']; |
| 302 | - foreach ( $mapping_items as $mapping_item ) { |
|
| 303 | - $dbo->insert_or_update_mapping_item( $mapping_item ); |
|
| 302 | + foreach ($mapping_items as $mapping_item) { |
|
| 303 | + $dbo->insert_or_update_mapping_item($mapping_item); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | return array( |
| 307 | 307 | 'status' => 'success', |
| 308 | - 'message' => __( 'Mapping items successfully updated', 'wordlift' ), |
|
| 308 | + 'message' => __('Mapping items successfully updated', 'wordlift'), |
|
| 309 | 309 | ); |
| 310 | 310 | } else { |
| 311 | 311 | return array( |
| 312 | 312 | 'status' => 'failure', |
| 313 | - 'message' => __( 'Unable to update mapping item', 'wordlift' ), |
|
| 313 | + 'message' => __('Unable to update mapping item', 'wordlift'), |
|
| 314 | 314 | ); |
| 315 | 315 | } |
| 316 | 316 | } |
@@ -322,23 +322,23 @@ discard block |
||
| 322 | 322 | * |
| 323 | 323 | * @return array |
| 324 | 324 | */ |
| 325 | - public static function delete_mapping_items( $request ) { |
|
| 325 | + public static function delete_mapping_items($request) { |
|
| 326 | 326 | $dbo = new Mappings_DBO(); |
| 327 | 327 | $post_data = $request->get_params(); |
| 328 | - if ( array_key_exists( 'mapping_items', $post_data ) ) { |
|
| 328 | + if (array_key_exists('mapping_items', $post_data)) { |
|
| 329 | 329 | $mapping_items = (array) $post_data['mapping_items']; |
| 330 | - foreach ( $mapping_items as $mapping_item ) { |
|
| 331 | - $dbo->delete_mapping_item( $mapping_item['mapping_id'] ); |
|
| 330 | + foreach ($mapping_items as $mapping_item) { |
|
| 331 | + $dbo->delete_mapping_item($mapping_item['mapping_id']); |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | return array( |
| 335 | 335 | 'status' => 'success', |
| 336 | - 'message' => __( 'successfully deleted mapping items', 'wordlift' ) |
|
| 336 | + 'message' => __('successfully deleted mapping items', 'wordlift') |
|
| 337 | 337 | ); |
| 338 | 338 | } else { |
| 339 | 339 | return array( |
| 340 | 340 | 'status' => 'failure', |
| 341 | - 'message' => __( 'Unable to delete mapping items', 'wordlift' ) |
|
| 341 | + 'message' => __('Unable to delete mapping items', 'wordlift') |
|
| 342 | 342 | ); |
| 343 | 343 | } |
| 344 | 344 | } |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | * |
| 351 | 351 | * @return array |
| 352 | 352 | */ |
| 353 | - public static function list_mapping_items( $request ) { |
|
| 353 | + public static function list_mapping_items($request) { |
|
| 354 | 354 | $dbo = new Mappings_DBO(); |
| 355 | 355 | |
| 356 | 356 | return $dbo->get_mappings(); |
@@ -364,11 +364,11 @@ discard block |
||
| 364 | 364 | * |
| 365 | 365 | * @return array A list of rule ids. |
| 366 | 366 | */ |
| 367 | - private static function get_rule_ids( $dbo, $rule_group_id ) { |
|
| 368 | - $rule_rows_in_db = $dbo->get_rules_by_rule_group( $rule_group_id ); |
|
| 367 | + private static function get_rule_ids($dbo, $rule_group_id) { |
|
| 368 | + $rule_rows_in_db = $dbo->get_rules_by_rule_group($rule_group_id); |
|
| 369 | 369 | $rule_ids = array(); |
| 370 | - foreach ( $rule_rows_in_db as $rule_row ) { |
|
| 371 | - array_push( $rule_ids, (int) $rule_row['rule_id'] ); |
|
| 370 | + foreach ($rule_rows_in_db as $rule_row) { |
|
| 371 | + array_push($rule_ids, (int) $rule_row['rule_id']); |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | return $rule_ids; |
@@ -383,27 +383,27 @@ discard block |
||
| 383 | 383 | * |
| 384 | 384 | * @return void |
| 385 | 385 | */ |
| 386 | - private static function save_rules( $dbo, $rule_group_id, $rule_list ) { |
|
| 387 | - $rule_ids = self::get_rule_ids( $dbo, $rule_group_id ); |
|
| 388 | - foreach ( $rule_list as $rule ) { |
|
| 386 | + private static function save_rules($dbo, $rule_group_id, $rule_list) { |
|
| 387 | + $rule_ids = self::get_rule_ids($dbo, $rule_group_id); |
|
| 388 | + foreach ($rule_list as $rule) { |
|
| 389 | 389 | // Some rules may not have rule group id, because they are inserted |
| 390 | 390 | // in ui, so lets add them any way. |
| 391 | 391 | $rule['rule_group_id'] = $rule_group_id; |
| 392 | - $dbo->insert_or_update_rule_item( $rule ); |
|
| 393 | - if ( array_key_exists( 'rule_id', $rule ) ) { |
|
| 392 | + $dbo->insert_or_update_rule_item($rule); |
|
| 393 | + if (array_key_exists('rule_id', $rule)) { |
|
| 394 | 394 | $index_to_be_removed = array_search( |
| 395 | 395 | (int) $rule['rule_id'], |
| 396 | 396 | $rule_ids, |
| 397 | 397 | true |
| 398 | 398 | ); |
| 399 | - if ( false !== $index_to_be_removed ) { |
|
| 400 | - unset( $rule_ids[ $index_to_be_removed ] ); |
|
| 399 | + if (false !== $index_to_be_removed) { |
|
| 400 | + unset($rule_ids[$index_to_be_removed]); |
|
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | - foreach ( $rule_ids as $rule_id ) { |
|
| 404 | + foreach ($rule_ids as $rule_id) { |
|
| 405 | 405 | // Delete all the rule ids which are not posted. |
| 406 | - $dbo->delete_rule_item( $rule_id ); |
|
| 406 | + $dbo->delete_rule_item($rule_id); |
|
| 407 | 407 | } |
| 408 | 408 | } |
| 409 | 409 | |
@@ -416,14 +416,14 @@ discard block |
||
| 416 | 416 | * |
| 417 | 417 | * @return void |
| 418 | 418 | */ |
| 419 | - private static function save_property_list( $dbo, $mapping_id, $property_list ) { |
|
| 420 | - $properties_needed_to_be_deleted = $dbo->get_properties( $mapping_id ); |
|
| 419 | + private static function save_property_list($dbo, $mapping_id, $property_list) { |
|
| 420 | + $properties_needed_to_be_deleted = $dbo->get_properties($mapping_id); |
|
| 421 | 421 | $property_ids = array(); |
| 422 | - foreach ( $properties_needed_to_be_deleted as $property ) { |
|
| 423 | - array_push( $property_ids, (int) $property['property_id'] ); |
|
| 422 | + foreach ($properties_needed_to_be_deleted as $property) { |
|
| 423 | + array_push($property_ids, (int) $property['property_id']); |
|
| 424 | 424 | } |
| 425 | - foreach ( $property_list as $property ) { |
|
| 426 | - if ( array_key_exists( 'property_id', $property ) ) { |
|
| 425 | + foreach ($property_list as $property) { |
|
| 426 | + if (array_key_exists('property_id', $property)) { |
|
| 427 | 427 | // Remove the id from the list of property ids needed to be deleted |
| 428 | 428 | // because it is posted. |
| 429 | 429 | $index_to_be_removed = array_search( |
@@ -431,18 +431,18 @@ discard block |
||
| 431 | 431 | $property_ids, |
| 432 | 432 | true |
| 433 | 433 | ); |
| 434 | - if ( false !== $index_to_be_removed ) { |
|
| 435 | - unset( $property_ids[ $index_to_be_removed ] ); |
|
| 434 | + if (false !== $index_to_be_removed) { |
|
| 435 | + unset($property_ids[$index_to_be_removed]); |
|
| 436 | 436 | } |
| 437 | 437 | } |
| 438 | 438 | // Add mapping id to property data. |
| 439 | 439 | $property['mapping_id'] = $mapping_id; |
| 440 | - $dbo->insert_or_update_property( $property ); |
|
| 440 | + $dbo->insert_or_update_property($property); |
|
| 441 | 441 | |
| 442 | 442 | } |
| 443 | 443 | // At the end remove all the property ids which are not posted. |
| 444 | - foreach ( $property_ids as $property_id ) { |
|
| 445 | - $dbo->delete_property( $property_id ); |
|
| 444 | + foreach ($property_ids as $property_id) { |
|
| 445 | + $dbo->delete_property($property_id); |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | } |
@@ -455,11 +455,11 @@ discard block |
||
| 455 | 455 | * |
| 456 | 456 | * @return array $rule_group_ids A list of rule group ids. |
| 457 | 457 | */ |
| 458 | - private static function get_rule_group_ids( $dbo, $mapping_id ) { |
|
| 459 | - $rule_group_rows = $dbo->get_rule_group_list( $mapping_id ); |
|
| 458 | + private static function get_rule_group_ids($dbo, $mapping_id) { |
|
| 459 | + $rule_group_rows = $dbo->get_rule_group_list($mapping_id); |
|
| 460 | 460 | $rule_group_ids = array(); |
| 461 | - foreach ( $rule_group_rows as $rule_group_row ) { |
|
| 462 | - array_push( $rule_group_ids, (int) $rule_group_row['rule_group_id'] ); |
|
| 461 | + foreach ($rule_group_rows as $rule_group_row) { |
|
| 462 | + array_push($rule_group_ids, (int) $rule_group_row['rule_group_id']); |
|
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | return $rule_group_ids; |
@@ -474,31 +474,31 @@ discard block |
||
| 474 | 474 | * |
| 475 | 475 | * @return void |
| 476 | 476 | */ |
| 477 | - private static function save_rule_group_list( $dbo, $mapping_id, $rule_group_list ) { |
|
| 477 | + private static function save_rule_group_list($dbo, $mapping_id, $rule_group_list) { |
|
| 478 | 478 | // The rule groups not posted should be deleted. |
| 479 | - $rule_group_ids = self::get_rule_group_ids( $dbo, $mapping_id ); |
|
| 479 | + $rule_group_ids = self::get_rule_group_ids($dbo, $mapping_id); |
|
| 480 | 480 | // Loop through rule group list and save the rule group. |
| 481 | - foreach ( $rule_group_list as $rule_group ) { |
|
| 482 | - if ( array_key_exists( 'rule_group_id', $rule_group ) ) { |
|
| 481 | + foreach ($rule_group_list as $rule_group) { |
|
| 482 | + if (array_key_exists('rule_group_id', $rule_group)) { |
|
| 483 | 483 | $rule_group_id = $rule_group['rule_group_id']; |
| 484 | 484 | } else { |
| 485 | 485 | // New rule group, should create new rule group id. |
| 486 | - $rule_group_id = $dbo->insert_rule_group( $mapping_id ); |
|
| 486 | + $rule_group_id = $dbo->insert_rule_group($mapping_id); |
|
| 487 | 487 | } |
| 488 | 488 | $index_to_be_removed = array_search( |
| 489 | 489 | (int) $rule_group_id, |
| 490 | 490 | $rule_group_ids, |
| 491 | 491 | true |
| 492 | 492 | ); |
| 493 | - if ( false !== $index_to_be_removed ) { |
|
| 494 | - unset( $rule_group_ids[ $index_to_be_removed ] ); |
|
| 493 | + if (false !== $index_to_be_removed) { |
|
| 494 | + unset($rule_group_ids[$index_to_be_removed]); |
|
| 495 | 495 | } |
| 496 | - self::save_rules( $dbo, $rule_group_id, $rule_group['rules'] ); |
|
| 496 | + self::save_rules($dbo, $rule_group_id, $rule_group['rules']); |
|
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | // Remove all the rule groups which are not posted. |
| 500 | - foreach ( $rule_group_ids as $rule_group_id ) { |
|
| 501 | - $dbo->delete_rule_group_item( $rule_group_id ); |
|
| 500 | + foreach ($rule_group_ids as $rule_group_id) { |
|
| 501 | + $dbo->delete_rule_group_item($rule_group_id); |
|
| 502 | 502 | } |
| 503 | 503 | } |
| 504 | 504 | |
@@ -509,33 +509,33 @@ discard block |
||
| 509 | 509 | * |
| 510 | 510 | * @return array |
| 511 | 511 | */ |
| 512 | - public static function insert_or_update_mapping_item( $request ) { |
|
| 512 | + public static function insert_or_update_mapping_item($request) { |
|
| 513 | 513 | $post_data = $request->get_params() === null ? array() : $request->get_params(); |
| 514 | 514 | $dbo = new Mappings_DBO(); |
| 515 | 515 | // check if valid object is posted. |
| 516 | - if ( array_key_exists( 'mapping_title', $post_data ) && |
|
| 517 | - array_key_exists( 'rule_group_list', $post_data ) && |
|
| 518 | - array_key_exists( 'property_list', $post_data ) ) { |
|
| 516 | + if (array_key_exists('mapping_title', $post_data) && |
|
| 517 | + array_key_exists('rule_group_list', $post_data) && |
|
| 518 | + array_key_exists('property_list', $post_data)) { |
|
| 519 | 519 | // Do validation, remove all incomplete data. |
| 520 | 520 | $mapping_item = array(); |
| 521 | - if ( array_key_exists( 'mapping_id', $post_data ) ) { |
|
| 521 | + if (array_key_exists('mapping_id', $post_data)) { |
|
| 522 | 522 | $mapping_item['mapping_id'] = $post_data['mapping_id']; |
| 523 | 523 | } |
| 524 | 524 | $mapping_item['mapping_title'] = $post_data['mapping_title']; |
| 525 | 525 | // lets save the mapping item. |
| 526 | - $mapping_id = $dbo->insert_or_update_mapping_item( $mapping_item ); |
|
| 527 | - self::save_rule_group_list( $dbo, $mapping_id, $post_data['rule_group_list'] ); |
|
| 528 | - self::save_property_list( $dbo, $mapping_id, $post_data['property_list'] ); |
|
| 526 | + $mapping_id = $dbo->insert_or_update_mapping_item($mapping_item); |
|
| 527 | + self::save_rule_group_list($dbo, $mapping_id, $post_data['rule_group_list']); |
|
| 528 | + self::save_property_list($dbo, $mapping_id, $post_data['property_list']); |
|
| 529 | 529 | |
| 530 | 530 | return array( |
| 531 | 531 | 'status' => 'success', |
| 532 | - 'message' => __( 'Successfully saved mapping item', 'wordlift' ), |
|
| 532 | + 'message' => __('Successfully saved mapping item', 'wordlift'), |
|
| 533 | 533 | 'mapping_id' => (int) $mapping_id, |
| 534 | 534 | ); |
| 535 | 535 | } else { |
| 536 | 536 | return array( |
| 537 | 537 | 'status' => 'error', |
| 538 | - 'message' => __( 'Unable to save mapping item', 'wordlift' ), |
|
| 538 | + 'message' => __('Unable to save mapping item', 'wordlift'), |
|
| 539 | 539 | ); |
| 540 | 540 | } |
| 541 | 541 | } |
@@ -24,235 +24,235 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | class Edit_Mappings_Page extends Wordlift_Admin_Page { |
| 26 | 26 | |
| 27 | - /** Instance to store the registry class. |
|
| 28 | - * @var Mappings_Transform_Functions_Registry { @link Mappings_Transform_Functions_Registry instance} |
|
| 29 | - */ |
|
| 30 | - public $transform_function_registry; |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * Edit_Mappings_Page constructor. |
|
| 34 | - * |
|
| 35 | - * @param $transform_function_registry Mappings_Transform_Functions_Registry { @link Mappings_Transform_Functions_Registry instance } |
|
| 36 | - */ |
|
| 37 | - public function __construct( $transform_function_registry ) { |
|
| 38 | - parent::__construct(); |
|
| 39 | - $this->transform_function_registry = $transform_function_registry; |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - public function render() { |
|
| 43 | - // Render all the settings when this method is called, because the partial page is loaded after |
|
| 44 | - // this method. |
|
| 45 | - // Load the UI dependencies. |
|
| 46 | - $edit_mapping_settings = $this->get_ui_settings_array(); |
|
| 47 | - // Supply the settings to js client. |
|
| 48 | - wp_localize_script( 'wl-mappings-edit', 'wl_edit_mappings_config', $edit_mapping_settings ); |
|
| 49 | - |
|
| 50 | - parent::render(); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * Load the text settings needed for the edit_mappings_page. |
|
| 55 | - * @param array $edit_mapping_settings Key value pair of settings used by edit mappings page. |
|
| 56 | - * |
|
| 57 | - * @return array Adding text settings to the main settings array. |
|
| 58 | - */ |
|
| 59 | - private function load_text_settings_for_edit_mapping_page( array $edit_mapping_settings ) { |
|
| 60 | - $edit_mapping_settings['wl_add_mapping_text'] = __( 'Add Mapping', 'wordlift' ); |
|
| 61 | - $edit_mapping_settings['wl_edit_mapping_text'] = __( 'Edit Mapping', 'wordlift' ); |
|
| 62 | - $edit_mapping_settings['wl_edit_mapping_no_item'] = __( 'Unable to find the mapping item', 'wordlift' ); |
|
| 63 | - $edit_mapping_settings['page'] = 'wl_edit_mapping'; |
|
| 64 | - return $edit_mapping_settings; |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * The base class {@link Wordlift_Admin_Page} will add the admin page to the WordLift menu. |
|
| 69 | - * |
|
| 70 | - * We don't want this page to be in the menu though. Therefore we override the `parent_slug` so that WordPress won't |
|
| 71 | - * show it there. |
|
| 72 | - * |
|
| 73 | - * @return null return null to avoid this page to be displayed in WordLift's menu. |
|
| 74 | - */ |
|
| 75 | - protected function get_parent_slug() { |
|
| 76 | - return null; |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * {@inheritdoc} |
|
| 81 | - */ |
|
| 82 | - public function get_page_title() { |
|
| 83 | - |
|
| 84 | - return __( 'Edit Mappings', 'wordlift' ); |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * {@inheritdoc} |
|
| 89 | - */ |
|
| 90 | - public function get_menu_title() { |
|
| 91 | - |
|
| 92 | - return __( 'Edit Mappings', 'wordlift' ); |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * {@inheritdoc} |
|
| 97 | - */ |
|
| 98 | - public function get_menu_slug() { |
|
| 99 | - |
|
| 100 | - return 'wl_edit_mapping'; |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * {@inheritdoc} |
|
| 105 | - */ |
|
| 106 | - public function get_partial_name() { |
|
| 107 | - return 'wordlift-admin-mappings-edit.php'; |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - /** |
|
| 111 | - * {@inheritdoc} |
|
| 112 | - */ |
|
| 113 | - public function enqueue_scripts() { |
|
| 114 | - |
|
| 115 | - // Enqueue the script. |
|
| 116 | - Scripts_Helper::enqueue_based_on_wordpress_version( |
|
| 117 | - 'wl-mappings-edit', |
|
| 118 | - plugin_dir_url( dirname( dirname( dirname( __FILE__ ) ) ) ) . 'js/dist/mappings-edit', |
|
| 119 | - array( 'react', 'react-dom', 'wp-polyfill' ), |
|
| 120 | - true |
|
| 121 | - ); |
|
| 122 | - |
|
| 123 | - // Enqueue the style. |
|
| 124 | - wp_enqueue_style( |
|
| 125 | - 'wl-mappings-edit', |
|
| 126 | - plugin_dir_url( dirname( dirname( dirname( __FILE__ ) ) ) ) . 'js/dist/mappings-edit.css', |
|
| 127 | - Wordlift::get_instance()->get_version() |
|
| 128 | - ); |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - /** |
|
| 132 | - * Returns field name options based on the chosen field type. |
|
| 133 | - * if string is returned a text field would be shown to user, if an array of options is returned |
|
| 134 | - * then the select box would be shown to user. |
|
| 135 | - * |
|
| 136 | - * @return array Array of the options. |
|
| 137 | - */ |
|
| 138 | - public static function get_all_field_name_options() { |
|
| 139 | - |
|
| 140 | - $options = array( |
|
| 141 | - array( |
|
| 142 | - 'field_type' => Wordlift\Mappings\Jsonld_Converter::FIELD_TYPE_TEXT_FIELD, |
|
| 143 | - 'value' => '', |
|
| 144 | - 'label' => __( 'Fixed Text', 'wordlift' ), |
|
| 145 | - ), |
|
| 146 | - // @@todo maybe it makes sense to move this one as well to Wordlift/Mappings/Custom_Fields_Mappings. |
|
| 147 | - array( |
|
| 148 | - 'field_type' => Wordlift\Mappings\Jsonld_Converter::FIELD_TYPE_CUSTOM_FIELD, |
|
| 149 | - 'value' => '', |
|
| 150 | - 'label' => __( 'Custom Field', 'wordlift' ), |
|
| 151 | - ), |
|
| 152 | - ); |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * Allow 3rd parties to add field types. |
|
| 156 | - * |
|
| 157 | - * @param array An array of Field Types. |
|
| 158 | - * |
|
| 159 | - * @return array An array of Field Types. |
|
| 160 | - * |
|
| 161 | - * @since 3.25.0 |
|
| 162 | - */ |
|
| 163 | - return apply_filters( 'wl_mappings_field_types', $options ); |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - /** |
|
| 167 | - * @since 3.25.0 |
|
| 168 | - * Load dependencies required for js client. |
|
| 169 | - * @return array An Array containing key value pairs of settings. |
|
| 170 | - */ |
|
| 171 | - public function get_ui_settings_array() { |
|
| 172 | - // Create ui settings array to be used by js client. |
|
| 173 | - $edit_mapping_settings = array(); |
|
| 174 | - $edit_mapping_settings = $this->load_rest_settings( $edit_mapping_settings ); |
|
| 175 | - $edit_mapping_settings = $this->load_text_settings_for_edit_mapping_page( $edit_mapping_settings ); |
|
| 176 | - $edit_mapping_settings['wl_transform_function_options'] = $this->transform_function_registry->get_options(); |
|
| 177 | - $edit_mapping_settings = $this->load_field_type_and_name_options( $edit_mapping_settings ); |
|
| 178 | - // Load logic field options. |
|
| 179 | - $edit_mapping_settings = $this->load_logic_field_options( $edit_mapping_settings ); |
|
| 180 | - $edit_mapping_settings = $this->load_rule_field_options( $edit_mapping_settings ); |
|
| 181 | - |
|
| 182 | - return $edit_mapping_settings; |
|
| 183 | - } |
|
| 184 | - |
|
| 185 | - /** |
|
| 186 | - * Returns post type, post category, or any other post taxonomies |
|
| 187 | - * @return array An array of select options |
|
| 188 | - */ |
|
| 189 | - private static function get_post_taxonomies_and_terms() { |
|
| 190 | - $taxonomy_options = array(); |
|
| 191 | - $term_options = array(); |
|
| 192 | - $taxonomies = get_object_taxonomies( 'post', 'objects' ); |
|
| 193 | - |
|
| 194 | - foreach ( $taxonomies as $taxonomy ) { |
|
| 195 | - array_push( |
|
| 196 | - $taxonomy_options, |
|
| 197 | - array( |
|
| 198 | - 'label' => $taxonomy->label, |
|
| 199 | - 'value' => $taxonomy->name, |
|
| 200 | - 'api_source' => 'taxonomy' |
|
| 201 | - ) |
|
| 202 | - ); |
|
| 203 | - } |
|
| 204 | - // Post type is also included in the list of taxonomies, so get the post type and merge with options. |
|
| 205 | - $post_type_array = self::get_post_type_key_and_value(); |
|
| 206 | - $post_type_option = $post_type_array['post_type_option_name']; |
|
| 207 | - // Get also the list of post types from the post_type_array. |
|
| 208 | - $post_type_option_values = $post_type_array['post_type_option_values']; |
|
| 27 | + /** Instance to store the registry class. |
|
| 28 | + * @var Mappings_Transform_Functions_Registry { @link Mappings_Transform_Functions_Registry instance} |
|
| 29 | + */ |
|
| 30 | + public $transform_function_registry; |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * Edit_Mappings_Page constructor. |
|
| 34 | + * |
|
| 35 | + * @param $transform_function_registry Mappings_Transform_Functions_Registry { @link Mappings_Transform_Functions_Registry instance } |
|
| 36 | + */ |
|
| 37 | + public function __construct( $transform_function_registry ) { |
|
| 38 | + parent::__construct(); |
|
| 39 | + $this->transform_function_registry = $transform_function_registry; |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + public function render() { |
|
| 43 | + // Render all the settings when this method is called, because the partial page is loaded after |
|
| 44 | + // this method. |
|
| 45 | + // Load the UI dependencies. |
|
| 46 | + $edit_mapping_settings = $this->get_ui_settings_array(); |
|
| 47 | + // Supply the settings to js client. |
|
| 48 | + wp_localize_script( 'wl-mappings-edit', 'wl_edit_mappings_config', $edit_mapping_settings ); |
|
| 49 | + |
|
| 50 | + parent::render(); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * Load the text settings needed for the edit_mappings_page. |
|
| 55 | + * @param array $edit_mapping_settings Key value pair of settings used by edit mappings page. |
|
| 56 | + * |
|
| 57 | + * @return array Adding text settings to the main settings array. |
|
| 58 | + */ |
|
| 59 | + private function load_text_settings_for_edit_mapping_page( array $edit_mapping_settings ) { |
|
| 60 | + $edit_mapping_settings['wl_add_mapping_text'] = __( 'Add Mapping', 'wordlift' ); |
|
| 61 | + $edit_mapping_settings['wl_edit_mapping_text'] = __( 'Edit Mapping', 'wordlift' ); |
|
| 62 | + $edit_mapping_settings['wl_edit_mapping_no_item'] = __( 'Unable to find the mapping item', 'wordlift' ); |
|
| 63 | + $edit_mapping_settings['page'] = 'wl_edit_mapping'; |
|
| 64 | + return $edit_mapping_settings; |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * The base class {@link Wordlift_Admin_Page} will add the admin page to the WordLift menu. |
|
| 69 | + * |
|
| 70 | + * We don't want this page to be in the menu though. Therefore we override the `parent_slug` so that WordPress won't |
|
| 71 | + * show it there. |
|
| 72 | + * |
|
| 73 | + * @return null return null to avoid this page to be displayed in WordLift's menu. |
|
| 74 | + */ |
|
| 75 | + protected function get_parent_slug() { |
|
| 76 | + return null; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * {@inheritdoc} |
|
| 81 | + */ |
|
| 82 | + public function get_page_title() { |
|
| 83 | + |
|
| 84 | + return __( 'Edit Mappings', 'wordlift' ); |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * {@inheritdoc} |
|
| 89 | + */ |
|
| 90 | + public function get_menu_title() { |
|
| 91 | + |
|
| 92 | + return __( 'Edit Mappings', 'wordlift' ); |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * {@inheritdoc} |
|
| 97 | + */ |
|
| 98 | + public function get_menu_slug() { |
|
| 99 | + |
|
| 100 | + return 'wl_edit_mapping'; |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * {@inheritdoc} |
|
| 105 | + */ |
|
| 106 | + public function get_partial_name() { |
|
| 107 | + return 'wordlift-admin-mappings-edit.php'; |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | + * {@inheritdoc} |
|
| 112 | + */ |
|
| 113 | + public function enqueue_scripts() { |
|
| 114 | + |
|
| 115 | + // Enqueue the script. |
|
| 116 | + Scripts_Helper::enqueue_based_on_wordpress_version( |
|
| 117 | + 'wl-mappings-edit', |
|
| 118 | + plugin_dir_url( dirname( dirname( dirname( __FILE__ ) ) ) ) . 'js/dist/mappings-edit', |
|
| 119 | + array( 'react', 'react-dom', 'wp-polyfill' ), |
|
| 120 | + true |
|
| 121 | + ); |
|
| 122 | + |
|
| 123 | + // Enqueue the style. |
|
| 124 | + wp_enqueue_style( |
|
| 125 | + 'wl-mappings-edit', |
|
| 126 | + plugin_dir_url( dirname( dirname( dirname( __FILE__ ) ) ) ) . 'js/dist/mappings-edit.css', |
|
| 127 | + Wordlift::get_instance()->get_version() |
|
| 128 | + ); |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + /** |
|
| 132 | + * Returns field name options based on the chosen field type. |
|
| 133 | + * if string is returned a text field would be shown to user, if an array of options is returned |
|
| 134 | + * then the select box would be shown to user. |
|
| 135 | + * |
|
| 136 | + * @return array Array of the options. |
|
| 137 | + */ |
|
| 138 | + public static function get_all_field_name_options() { |
|
| 139 | + |
|
| 140 | + $options = array( |
|
| 141 | + array( |
|
| 142 | + 'field_type' => Wordlift\Mappings\Jsonld_Converter::FIELD_TYPE_TEXT_FIELD, |
|
| 143 | + 'value' => '', |
|
| 144 | + 'label' => __( 'Fixed Text', 'wordlift' ), |
|
| 145 | + ), |
|
| 146 | + // @@todo maybe it makes sense to move this one as well to Wordlift/Mappings/Custom_Fields_Mappings. |
|
| 147 | + array( |
|
| 148 | + 'field_type' => Wordlift\Mappings\Jsonld_Converter::FIELD_TYPE_CUSTOM_FIELD, |
|
| 149 | + 'value' => '', |
|
| 150 | + 'label' => __( 'Custom Field', 'wordlift' ), |
|
| 151 | + ), |
|
| 152 | + ); |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * Allow 3rd parties to add field types. |
|
| 156 | + * |
|
| 157 | + * @param array An array of Field Types. |
|
| 158 | + * |
|
| 159 | + * @return array An array of Field Types. |
|
| 160 | + * |
|
| 161 | + * @since 3.25.0 |
|
| 162 | + */ |
|
| 163 | + return apply_filters( 'wl_mappings_field_types', $options ); |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + /** |
|
| 167 | + * @since 3.25.0 |
|
| 168 | + * Load dependencies required for js client. |
|
| 169 | + * @return array An Array containing key value pairs of settings. |
|
| 170 | + */ |
|
| 171 | + public function get_ui_settings_array() { |
|
| 172 | + // Create ui settings array to be used by js client. |
|
| 173 | + $edit_mapping_settings = array(); |
|
| 174 | + $edit_mapping_settings = $this->load_rest_settings( $edit_mapping_settings ); |
|
| 175 | + $edit_mapping_settings = $this->load_text_settings_for_edit_mapping_page( $edit_mapping_settings ); |
|
| 176 | + $edit_mapping_settings['wl_transform_function_options'] = $this->transform_function_registry->get_options(); |
|
| 177 | + $edit_mapping_settings = $this->load_field_type_and_name_options( $edit_mapping_settings ); |
|
| 178 | + // Load logic field options. |
|
| 179 | + $edit_mapping_settings = $this->load_logic_field_options( $edit_mapping_settings ); |
|
| 180 | + $edit_mapping_settings = $this->load_rule_field_options( $edit_mapping_settings ); |
|
| 181 | + |
|
| 182 | + return $edit_mapping_settings; |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + /** |
|
| 186 | + * Returns post type, post category, or any other post taxonomies |
|
| 187 | + * @return array An array of select options |
|
| 188 | + */ |
|
| 189 | + private static function get_post_taxonomies_and_terms() { |
|
| 190 | + $taxonomy_options = array(); |
|
| 191 | + $term_options = array(); |
|
| 192 | + $taxonomies = get_object_taxonomies( 'post', 'objects' ); |
|
| 193 | + |
|
| 194 | + foreach ( $taxonomies as $taxonomy ) { |
|
| 195 | + array_push( |
|
| 196 | + $taxonomy_options, |
|
| 197 | + array( |
|
| 198 | + 'label' => $taxonomy->label, |
|
| 199 | + 'value' => $taxonomy->name, |
|
| 200 | + 'api_source' => 'taxonomy' |
|
| 201 | + ) |
|
| 202 | + ); |
|
| 203 | + } |
|
| 204 | + // Post type is also included in the list of taxonomies, so get the post type and merge with options. |
|
| 205 | + $post_type_array = self::get_post_type_key_and_value(); |
|
| 206 | + $post_type_option = $post_type_array['post_type_option_name']; |
|
| 207 | + // Get also the list of post types from the post_type_array. |
|
| 208 | + $post_type_option_values = $post_type_array['post_type_option_values']; |
|
| 209 | 209 | |
| 210 | 210 | $post_taxonomy_array = self::get_post_taxonomy_key_and_value(); |
| 211 | 211 | $post_taxonomy_option = $post_taxonomy_array['post_taxonomy_option_name']; |
| 212 | 212 | |
| 213 | - // Merge the post type option and post types in the taxonomy options |
|
| 214 | - array_push( $taxonomy_options, $post_type_option, $post_taxonomy_option); |
|
| 215 | - $term_options = array_merge( $term_options, $post_type_option_values ); |
|
| 216 | - return array( |
|
| 217 | - 'taxonomy_options' => $taxonomy_options, |
|
| 218 | - 'term_options' => $term_options |
|
| 219 | - ); |
|
| 220 | - } |
|
| 221 | - |
|
| 222 | - /** |
|
| 223 | - * Return post type option and post type option values. |
|
| 224 | - * |
|
| 225 | - * @return array Array of post_type_option and post_type_option_values. |
|
| 226 | - */ |
|
| 227 | - private static function get_post_type_key_and_value() { |
|
| 228 | - $post_type_option_name = array( |
|
| 229 | - 'label' => __( 'Post type', 'wordlift' ), |
|
| 230 | - 'value' => Wordlift\Mappings\Validators\Post_Type_Rule_Validator::POST_TYPE, |
|
| 231 | - // Left empty since post types are provided locally. |
|
| 232 | - 'api_source' => '', |
|
| 233 | - ); |
|
| 234 | - $post_type_option_values = array(); |
|
| 235 | - $post_types = get_post_types( |
|
| 236 | - array(), |
|
| 237 | - 'objects' |
|
| 238 | - ); |
|
| 239 | - |
|
| 240 | - foreach ( $post_types as $post_type ) { |
|
| 241 | - array_push( |
|
| 242 | - $post_type_option_values, |
|
| 243 | - array( |
|
| 244 | - 'label' => $post_type->label, |
|
| 245 | - 'value' => $post_type->name, |
|
| 246 | - 'parent_value' => 'post_type', |
|
| 247 | - ) |
|
| 248 | - ); |
|
| 249 | - } |
|
| 250 | - |
|
| 251 | - return array( |
|
| 252 | - 'post_type_option_name' => $post_type_option_name, |
|
| 253 | - 'post_type_option_values' => $post_type_option_values |
|
| 254 | - ); |
|
| 255 | - } |
|
| 213 | + // Merge the post type option and post types in the taxonomy options |
|
| 214 | + array_push( $taxonomy_options, $post_type_option, $post_taxonomy_option); |
|
| 215 | + $term_options = array_merge( $term_options, $post_type_option_values ); |
|
| 216 | + return array( |
|
| 217 | + 'taxonomy_options' => $taxonomy_options, |
|
| 218 | + 'term_options' => $term_options |
|
| 219 | + ); |
|
| 220 | + } |
|
| 221 | + |
|
| 222 | + /** |
|
| 223 | + * Return post type option and post type option values. |
|
| 224 | + * |
|
| 225 | + * @return array Array of post_type_option and post_type_option_values. |
|
| 226 | + */ |
|
| 227 | + private static function get_post_type_key_and_value() { |
|
| 228 | + $post_type_option_name = array( |
|
| 229 | + 'label' => __( 'Post type', 'wordlift' ), |
|
| 230 | + 'value' => Wordlift\Mappings\Validators\Post_Type_Rule_Validator::POST_TYPE, |
|
| 231 | + // Left empty since post types are provided locally. |
|
| 232 | + 'api_source' => '', |
|
| 233 | + ); |
|
| 234 | + $post_type_option_values = array(); |
|
| 235 | + $post_types = get_post_types( |
|
| 236 | + array(), |
|
| 237 | + 'objects' |
|
| 238 | + ); |
|
| 239 | + |
|
| 240 | + foreach ( $post_types as $post_type ) { |
|
| 241 | + array_push( |
|
| 242 | + $post_type_option_values, |
|
| 243 | + array( |
|
| 244 | + 'label' => $post_type->label, |
|
| 245 | + 'value' => $post_type->name, |
|
| 246 | + 'parent_value' => 'post_type', |
|
| 247 | + ) |
|
| 248 | + ); |
|
| 249 | + } |
|
| 250 | + |
|
| 251 | + return array( |
|
| 252 | + 'post_type_option_name' => $post_type_option_name, |
|
| 253 | + 'post_type_option_values' => $post_type_option_values |
|
| 254 | + ); |
|
| 255 | + } |
|
| 256 | 256 | |
| 257 | 257 | /** |
| 258 | 258 | * Return post type option and post type option values. |
@@ -275,132 +275,132 @@ discard block |
||
| 275 | 275 | ); |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - /** |
|
| 279 | - * This function loads the equal to, not equal to operator to the edit mapping settings. |
|
| 280 | - * |
|
| 281 | - * @param array $edit_mapping_settings |
|
| 282 | - * @return array Loads the logic field options to the $edit_mapping_settings. |
|
| 283 | - */ |
|
| 284 | - private function load_logic_field_options( array $edit_mapping_settings ) { |
|
| 285 | - $edit_mapping_settings['wl_logic_field_options'] = array( |
|
| 286 | - array( |
|
| 287 | - 'label' => __( 'is equal to', 'wordlift' ), |
|
| 288 | - 'value' => Wordlift\Mappings\Validators\Rule_Validator::IS_EQUAL_TO, |
|
| 289 | - ), |
|
| 290 | - array( |
|
| 291 | - 'label' => __( 'is not equal to', 'wordlift' ), |
|
| 292 | - 'value' => Wordlift\Mappings\Validators\Rule_Validator::IS_NOT_EQUAL_TO, |
|
| 293 | - ), |
|
| 294 | - ); |
|
| 295 | - |
|
| 296 | - return $edit_mapping_settings; |
|
| 297 | - } |
|
| 298 | - |
|
| 299 | - /** |
|
| 300 | - * Validates the nonce posted by client and then assign the mapping id which should be edited. |
|
| 301 | - * |
|
| 302 | - * @param array $edit_mapping_settings |
|
| 303 | - * @return array Edit mapping settings array with the mapping id if the nonce is valid. |
|
| 304 | - */ |
|
| 305 | - private function validate_nonce_and_assign_mapping_id( array $edit_mapping_settings ) { |
|
| 278 | + /** |
|
| 279 | + * This function loads the equal to, not equal to operator to the edit mapping settings. |
|
| 280 | + * |
|
| 281 | + * @param array $edit_mapping_settings |
|
| 282 | + * @return array Loads the logic field options to the $edit_mapping_settings. |
|
| 283 | + */ |
|
| 284 | + private function load_logic_field_options( array $edit_mapping_settings ) { |
|
| 285 | + $edit_mapping_settings['wl_logic_field_options'] = array( |
|
| 286 | + array( |
|
| 287 | + 'label' => __( 'is equal to', 'wordlift' ), |
|
| 288 | + 'value' => Wordlift\Mappings\Validators\Rule_Validator::IS_EQUAL_TO, |
|
| 289 | + ), |
|
| 290 | + array( |
|
| 291 | + 'label' => __( 'is not equal to', 'wordlift' ), |
|
| 292 | + 'value' => Wordlift\Mappings\Validators\Rule_Validator::IS_NOT_EQUAL_TO, |
|
| 293 | + ), |
|
| 294 | + ); |
|
| 295 | + |
|
| 296 | + return $edit_mapping_settings; |
|
| 297 | + } |
|
| 298 | + |
|
| 299 | + /** |
|
| 300 | + * Validates the nonce posted by client and then assign the mapping id which should be edited. |
|
| 301 | + * |
|
| 302 | + * @param array $edit_mapping_settings |
|
| 303 | + * @return array Edit mapping settings array with the mapping id if the nonce is valid. |
|
| 304 | + */ |
|
| 305 | + private function validate_nonce_and_assign_mapping_id( array $edit_mapping_settings ) { |
|
| 306 | 306 | // We verify the nonce before making to load the edit mapping page for the wl_edit_mapping_id |
| 307 | - if ( isset( $_REQUEST['_wl_edit_mapping_nonce'] ) |
|
| 308 | - && wp_verify_nonce( $_REQUEST['_wl_edit_mapping_nonce'], 'wl-edit-mapping-nonce' ) ) { |
|
| 309 | - // We're using `INPUT_GET` here because this is a link from the UI, i.e. no POST. |
|
| 310 | - $edit_mapping_settings['wl_edit_mapping_id'] = (int) filter_var( $_REQUEST['wl_edit_mapping_id'], FILTER_VALIDATE_INT ); |
|
| 311 | - } |
|
| 312 | - |
|
| 313 | - return $edit_mapping_settings; |
|
| 314 | - } |
|
| 315 | - |
|
| 316 | - /** |
|
| 317 | - * Load the rest settings required for the edit_mappings js client. |
|
| 318 | - * |
|
| 319 | - * @param array $edit_mapping_settings |
|
| 320 | - * @return array |
|
| 321 | - */ |
|
| 322 | - private function load_rest_settings( array $edit_mapping_settings ) { |
|
| 323 | - $edit_mapping_settings['rest_url'] = get_rest_url( |
|
| 324 | - null, |
|
| 325 | - WL_REST_ROUTE_DEFAULT_NAMESPACE . Mappings_REST_Controller::MAPPINGS_NAMESPACE |
|
| 326 | - ); |
|
| 327 | - $edit_mapping_settings['wl_edit_mapping_rest_nonce'] = wp_create_nonce( 'wp_rest' ); |
|
| 328 | - $edit_mapping_settings = $this->validate_nonce_and_assign_mapping_id( $edit_mapping_settings ); |
|
| 329 | - |
|
| 330 | - return $edit_mapping_settings; |
|
| 331 | - } |
|
| 332 | - |
|
| 333 | - /** |
|
| 334 | - * Load the rule field options in to the settings. |
|
| 335 | - * |
|
| 336 | - * @param array $edit_mapping_settings |
|
| 337 | - * |
|
| 338 | - * @return array Return the settings. |
|
| 339 | - */ |
|
| 340 | - private function load_rule_field_options( array $edit_mapping_settings ) { |
|
| 341 | - // Load the rule field options. |
|
| 342 | - $rule_field_data = self::get_post_taxonomies_and_terms(); |
|
| 343 | - $edit_mapping_settings['wl_rule_field_one_options'] = $rule_field_data['taxonomy_options']; |
|
| 344 | - $edit_mapping_settings['wl_rule_field_two_options'] = $rule_field_data['term_options']; |
|
| 345 | - |
|
| 346 | - /** |
|
| 347 | - * Allow 3rd parties to add ui options. |
|
| 348 | - * |
|
| 349 | - * @param array Array of Rule field one options where each item is in format |
|
| 350 | - * |
|
| 351 | - * array ( 'label' => string, 'value' => string, 'api_source'=>string); |
|
| 352 | - * |
|
| 353 | - * Leave api_source empty string to ensure didnt fetch rule field two options |
|
| 354 | - * from api. |
|
| 355 | - * |
|
| 356 | - * @return array Array of Rule field one options |
|
| 357 | - * |
|
| 358 | - * @since 3.27.0 |
|
| 359 | - */ |
|
| 360 | - $edit_mapping_settings['wl_rule_field_one_options'] = apply_filters( |
|
| 361 | - 'wl_mappings_rule_field_one_options', |
|
| 362 | - $edit_mapping_settings['wl_rule_field_one_options'] |
|
| 363 | - ); |
|
| 364 | - |
|
| 365 | - /** |
|
| 366 | - * Allow 3rd parties to add rule field two options. |
|
| 367 | - * |
|
| 368 | - * @param array Array of Rule field two option where each item is in format |
|
| 369 | - * |
|
| 370 | - * array ( 'label' => string, 'value' => string, 'parent_value' => string ); |
|
| 371 | - * |
|
| 372 | - * where parent_value is the value of the parent option in the rule_field_one_option. |
|
| 373 | - * |
|
| 374 | - * @since 3.27.0 |
|
| 375 | - */ |
|
| 376 | - $edit_mapping_settings['wl_rule_field_two_options'] = apply_filters( |
|
| 377 | - 'wl_mappings_rule_field_two_options', |
|
| 378 | - $edit_mapping_settings['wl_rule_field_two_options'] |
|
| 379 | - ); |
|
| 380 | - |
|
| 381 | - return $edit_mapping_settings; |
|
| 382 | - } |
|
| 383 | - |
|
| 384 | - /** |
|
| 385 | - * Load field type and field name options to the settings array. |
|
| 386 | - * @param array $edit_mapping_settings |
|
| 387 | - * |
|
| 388 | - * @return array |
|
| 389 | - */ |
|
| 390 | - private function load_field_type_and_name_options( array $edit_mapping_settings ) { |
|
| 391 | - $all_field_name_options = self::get_all_field_name_options(); |
|
| 392 | - $all_field_types_options = array_map( function ( $item ) { |
|
| 393 | - return array( |
|
| 394 | - 'label' => $item['label'], |
|
| 395 | - 'value' => $item['field_type'], |
|
| 396 | - ); |
|
| 397 | - }, $all_field_name_options ); |
|
| 398 | - |
|
| 399 | - $edit_mapping_settings['wl_field_type_options'] = $all_field_types_options; |
|
| 400 | - // Add wl_edit_field_name_options. |
|
| 401 | - $edit_mapping_settings['wl_field_name_options'] = $all_field_name_options; |
|
| 402 | - |
|
| 403 | - return $edit_mapping_settings; |
|
| 404 | - } |
|
| 307 | + if ( isset( $_REQUEST['_wl_edit_mapping_nonce'] ) |
|
| 308 | + && wp_verify_nonce( $_REQUEST['_wl_edit_mapping_nonce'], 'wl-edit-mapping-nonce' ) ) { |
|
| 309 | + // We're using `INPUT_GET` here because this is a link from the UI, i.e. no POST. |
|
| 310 | + $edit_mapping_settings['wl_edit_mapping_id'] = (int) filter_var( $_REQUEST['wl_edit_mapping_id'], FILTER_VALIDATE_INT ); |
|
| 311 | + } |
|
| 312 | + |
|
| 313 | + return $edit_mapping_settings; |
|
| 314 | + } |
|
| 315 | + |
|
| 316 | + /** |
|
| 317 | + * Load the rest settings required for the edit_mappings js client. |
|
| 318 | + * |
|
| 319 | + * @param array $edit_mapping_settings |
|
| 320 | + * @return array |
|
| 321 | + */ |
|
| 322 | + private function load_rest_settings( array $edit_mapping_settings ) { |
|
| 323 | + $edit_mapping_settings['rest_url'] = get_rest_url( |
|
| 324 | + null, |
|
| 325 | + WL_REST_ROUTE_DEFAULT_NAMESPACE . Mappings_REST_Controller::MAPPINGS_NAMESPACE |
|
| 326 | + ); |
|
| 327 | + $edit_mapping_settings['wl_edit_mapping_rest_nonce'] = wp_create_nonce( 'wp_rest' ); |
|
| 328 | + $edit_mapping_settings = $this->validate_nonce_and_assign_mapping_id( $edit_mapping_settings ); |
|
| 329 | + |
|
| 330 | + return $edit_mapping_settings; |
|
| 331 | + } |
|
| 332 | + |
|
| 333 | + /** |
|
| 334 | + * Load the rule field options in to the settings. |
|
| 335 | + * |
|
| 336 | + * @param array $edit_mapping_settings |
|
| 337 | + * |
|
| 338 | + * @return array Return the settings. |
|
| 339 | + */ |
|
| 340 | + private function load_rule_field_options( array $edit_mapping_settings ) { |
|
| 341 | + // Load the rule field options. |
|
| 342 | + $rule_field_data = self::get_post_taxonomies_and_terms(); |
|
| 343 | + $edit_mapping_settings['wl_rule_field_one_options'] = $rule_field_data['taxonomy_options']; |
|
| 344 | + $edit_mapping_settings['wl_rule_field_two_options'] = $rule_field_data['term_options']; |
|
| 345 | + |
|
| 346 | + /** |
|
| 347 | + * Allow 3rd parties to add ui options. |
|
| 348 | + * |
|
| 349 | + * @param array Array of Rule field one options where each item is in format |
|
| 350 | + * |
|
| 351 | + * array ( 'label' => string, 'value' => string, 'api_source'=>string); |
|
| 352 | + * |
|
| 353 | + * Leave api_source empty string to ensure didnt fetch rule field two options |
|
| 354 | + * from api. |
|
| 355 | + * |
|
| 356 | + * @return array Array of Rule field one options |
|
| 357 | + * |
|
| 358 | + * @since 3.27.0 |
|
| 359 | + */ |
|
| 360 | + $edit_mapping_settings['wl_rule_field_one_options'] = apply_filters( |
|
| 361 | + 'wl_mappings_rule_field_one_options', |
|
| 362 | + $edit_mapping_settings['wl_rule_field_one_options'] |
|
| 363 | + ); |
|
| 364 | + |
|
| 365 | + /** |
|
| 366 | + * Allow 3rd parties to add rule field two options. |
|
| 367 | + * |
|
| 368 | + * @param array Array of Rule field two option where each item is in format |
|
| 369 | + * |
|
| 370 | + * array ( 'label' => string, 'value' => string, 'parent_value' => string ); |
|
| 371 | + * |
|
| 372 | + * where parent_value is the value of the parent option in the rule_field_one_option. |
|
| 373 | + * |
|
| 374 | + * @since 3.27.0 |
|
| 375 | + */ |
|
| 376 | + $edit_mapping_settings['wl_rule_field_two_options'] = apply_filters( |
|
| 377 | + 'wl_mappings_rule_field_two_options', |
|
| 378 | + $edit_mapping_settings['wl_rule_field_two_options'] |
|
| 379 | + ); |
|
| 380 | + |
|
| 381 | + return $edit_mapping_settings; |
|
| 382 | + } |
|
| 383 | + |
|
| 384 | + /** |
|
| 385 | + * Load field type and field name options to the settings array. |
|
| 386 | + * @param array $edit_mapping_settings |
|
| 387 | + * |
|
| 388 | + * @return array |
|
| 389 | + */ |
|
| 390 | + private function load_field_type_and_name_options( array $edit_mapping_settings ) { |
|
| 391 | + $all_field_name_options = self::get_all_field_name_options(); |
|
| 392 | + $all_field_types_options = array_map( function ( $item ) { |
|
| 393 | + return array( |
|
| 394 | + 'label' => $item['label'], |
|
| 395 | + 'value' => $item['field_type'], |
|
| 396 | + ); |
|
| 397 | + }, $all_field_name_options ); |
|
| 398 | + |
|
| 399 | + $edit_mapping_settings['wl_field_type_options'] = $all_field_types_options; |
|
| 400 | + // Add wl_edit_field_name_options. |
|
| 401 | + $edit_mapping_settings['wl_field_name_options'] = $all_field_name_options; |
|
| 402 | + |
|
| 403 | + return $edit_mapping_settings; |
|
| 404 | + } |
|
| 405 | 405 | |
| 406 | 406 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @param $transform_function_registry Mappings_Transform_Functions_Registry { @link Mappings_Transform_Functions_Registry instance } |
| 36 | 36 | */ |
| 37 | - public function __construct( $transform_function_registry ) { |
|
| 37 | + public function __construct($transform_function_registry) { |
|
| 38 | 38 | parent::__construct(); |
| 39 | 39 | $this->transform_function_registry = $transform_function_registry; |
| 40 | 40 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | // Load the UI dependencies. |
| 46 | 46 | $edit_mapping_settings = $this->get_ui_settings_array(); |
| 47 | 47 | // Supply the settings to js client. |
| 48 | - wp_localize_script( 'wl-mappings-edit', 'wl_edit_mappings_config', $edit_mapping_settings ); |
|
| 48 | + wp_localize_script('wl-mappings-edit', 'wl_edit_mappings_config', $edit_mapping_settings); |
|
| 49 | 49 | |
| 50 | 50 | parent::render(); |
| 51 | 51 | } |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | * |
| 57 | 57 | * @return array Adding text settings to the main settings array. |
| 58 | 58 | */ |
| 59 | - private function load_text_settings_for_edit_mapping_page( array $edit_mapping_settings ) { |
|
| 60 | - $edit_mapping_settings['wl_add_mapping_text'] = __( 'Add Mapping', 'wordlift' ); |
|
| 61 | - $edit_mapping_settings['wl_edit_mapping_text'] = __( 'Edit Mapping', 'wordlift' ); |
|
| 62 | - $edit_mapping_settings['wl_edit_mapping_no_item'] = __( 'Unable to find the mapping item', 'wordlift' ); |
|
| 59 | + private function load_text_settings_for_edit_mapping_page(array $edit_mapping_settings) { |
|
| 60 | + $edit_mapping_settings['wl_add_mapping_text'] = __('Add Mapping', 'wordlift'); |
|
| 61 | + $edit_mapping_settings['wl_edit_mapping_text'] = __('Edit Mapping', 'wordlift'); |
|
| 62 | + $edit_mapping_settings['wl_edit_mapping_no_item'] = __('Unable to find the mapping item', 'wordlift'); |
|
| 63 | 63 | $edit_mapping_settings['page'] = 'wl_edit_mapping'; |
| 64 | 64 | return $edit_mapping_settings; |
| 65 | 65 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function get_page_title() { |
| 83 | 83 | |
| 84 | - return __( 'Edit Mappings', 'wordlift' ); |
|
| 84 | + return __('Edit Mappings', 'wordlift'); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function get_menu_title() { |
| 91 | 91 | |
| 92 | - return __( 'Edit Mappings', 'wordlift' ); |
|
| 92 | + return __('Edit Mappings', 'wordlift'); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -115,15 +115,15 @@ discard block |
||
| 115 | 115 | // Enqueue the script. |
| 116 | 116 | Scripts_Helper::enqueue_based_on_wordpress_version( |
| 117 | 117 | 'wl-mappings-edit', |
| 118 | - plugin_dir_url( dirname( dirname( dirname( __FILE__ ) ) ) ) . 'js/dist/mappings-edit', |
|
| 119 | - array( 'react', 'react-dom', 'wp-polyfill' ), |
|
| 118 | + plugin_dir_url(dirname(dirname(dirname(__FILE__)))).'js/dist/mappings-edit', |
|
| 119 | + array('react', 'react-dom', 'wp-polyfill'), |
|
| 120 | 120 | true |
| 121 | 121 | ); |
| 122 | 122 | |
| 123 | 123 | // Enqueue the style. |
| 124 | 124 | wp_enqueue_style( |
| 125 | 125 | 'wl-mappings-edit', |
| 126 | - plugin_dir_url( dirname( dirname( dirname( __FILE__ ) ) ) ) . 'js/dist/mappings-edit.css', |
|
| 126 | + plugin_dir_url(dirname(dirname(dirname(__FILE__)))).'js/dist/mappings-edit.css', |
|
| 127 | 127 | Wordlift::get_instance()->get_version() |
| 128 | 128 | ); |
| 129 | 129 | } |
@@ -141,13 +141,13 @@ discard block |
||
| 141 | 141 | array( |
| 142 | 142 | 'field_type' => Wordlift\Mappings\Jsonld_Converter::FIELD_TYPE_TEXT_FIELD, |
| 143 | 143 | 'value' => '', |
| 144 | - 'label' => __( 'Fixed Text', 'wordlift' ), |
|
| 144 | + 'label' => __('Fixed Text', 'wordlift'), |
|
| 145 | 145 | ), |
| 146 | 146 | // @@todo maybe it makes sense to move this one as well to Wordlift/Mappings/Custom_Fields_Mappings. |
| 147 | 147 | array( |
| 148 | 148 | 'field_type' => Wordlift\Mappings\Jsonld_Converter::FIELD_TYPE_CUSTOM_FIELD, |
| 149 | 149 | 'value' => '', |
| 150 | - 'label' => __( 'Custom Field', 'wordlift' ), |
|
| 150 | + 'label' => __('Custom Field', 'wordlift'), |
|
| 151 | 151 | ), |
| 152 | 152 | ); |
| 153 | 153 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * |
| 161 | 161 | * @since 3.25.0 |
| 162 | 162 | */ |
| 163 | - return apply_filters( 'wl_mappings_field_types', $options ); |
|
| 163 | + return apply_filters('wl_mappings_field_types', $options); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
@@ -171,13 +171,13 @@ discard block |
||
| 171 | 171 | public function get_ui_settings_array() { |
| 172 | 172 | // Create ui settings array to be used by js client. |
| 173 | 173 | $edit_mapping_settings = array(); |
| 174 | - $edit_mapping_settings = $this->load_rest_settings( $edit_mapping_settings ); |
|
| 175 | - $edit_mapping_settings = $this->load_text_settings_for_edit_mapping_page( $edit_mapping_settings ); |
|
| 174 | + $edit_mapping_settings = $this->load_rest_settings($edit_mapping_settings); |
|
| 175 | + $edit_mapping_settings = $this->load_text_settings_for_edit_mapping_page($edit_mapping_settings); |
|
| 176 | 176 | $edit_mapping_settings['wl_transform_function_options'] = $this->transform_function_registry->get_options(); |
| 177 | - $edit_mapping_settings = $this->load_field_type_and_name_options( $edit_mapping_settings ); |
|
| 177 | + $edit_mapping_settings = $this->load_field_type_and_name_options($edit_mapping_settings); |
|
| 178 | 178 | // Load logic field options. |
| 179 | - $edit_mapping_settings = $this->load_logic_field_options( $edit_mapping_settings ); |
|
| 180 | - $edit_mapping_settings = $this->load_rule_field_options( $edit_mapping_settings ); |
|
| 179 | + $edit_mapping_settings = $this->load_logic_field_options($edit_mapping_settings); |
|
| 180 | + $edit_mapping_settings = $this->load_rule_field_options($edit_mapping_settings); |
|
| 181 | 181 | |
| 182 | 182 | return $edit_mapping_settings; |
| 183 | 183 | } |
@@ -189,9 +189,9 @@ discard block |
||
| 189 | 189 | private static function get_post_taxonomies_and_terms() { |
| 190 | 190 | $taxonomy_options = array(); |
| 191 | 191 | $term_options = array(); |
| 192 | - $taxonomies = get_object_taxonomies( 'post', 'objects' ); |
|
| 192 | + $taxonomies = get_object_taxonomies('post', 'objects'); |
|
| 193 | 193 | |
| 194 | - foreach ( $taxonomies as $taxonomy ) { |
|
| 194 | + foreach ($taxonomies as $taxonomy) { |
|
| 195 | 195 | array_push( |
| 196 | 196 | $taxonomy_options, |
| 197 | 197 | array( |
@@ -202,17 +202,17 @@ discard block |
||
| 202 | 202 | ); |
| 203 | 203 | } |
| 204 | 204 | // Post type is also included in the list of taxonomies, so get the post type and merge with options. |
| 205 | - $post_type_array = self::get_post_type_key_and_value(); |
|
| 205 | + $post_type_array = self::get_post_type_key_and_value(); |
|
| 206 | 206 | $post_type_option = $post_type_array['post_type_option_name']; |
| 207 | 207 | // Get also the list of post types from the post_type_array. |
| 208 | 208 | $post_type_option_values = $post_type_array['post_type_option_values']; |
| 209 | 209 | |
| 210 | - $post_taxonomy_array = self::get_post_taxonomy_key_and_value(); |
|
| 210 | + $post_taxonomy_array = self::get_post_taxonomy_key_and_value(); |
|
| 211 | 211 | $post_taxonomy_option = $post_taxonomy_array['post_taxonomy_option_name']; |
| 212 | 212 | |
| 213 | 213 | // Merge the post type option and post types in the taxonomy options |
| 214 | - array_push( $taxonomy_options, $post_type_option, $post_taxonomy_option); |
|
| 215 | - $term_options = array_merge( $term_options, $post_type_option_values ); |
|
| 214 | + array_push($taxonomy_options, $post_type_option, $post_taxonomy_option); |
|
| 215 | + $term_options = array_merge($term_options, $post_type_option_values); |
|
| 216 | 216 | return array( |
| 217 | 217 | 'taxonomy_options' => $taxonomy_options, |
| 218 | 218 | 'term_options' => $term_options |
@@ -225,8 +225,8 @@ discard block |
||
| 225 | 225 | * @return array Array of post_type_option and post_type_option_values. |
| 226 | 226 | */ |
| 227 | 227 | private static function get_post_type_key_and_value() { |
| 228 | - $post_type_option_name = array( |
|
| 229 | - 'label' => __( 'Post type', 'wordlift' ), |
|
| 228 | + $post_type_option_name = array( |
|
| 229 | + 'label' => __('Post type', 'wordlift'), |
|
| 230 | 230 | 'value' => Wordlift\Mappings\Validators\Post_Type_Rule_Validator::POST_TYPE, |
| 231 | 231 | // Left empty since post types are provided locally. |
| 232 | 232 | 'api_source' => '', |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | 'objects' |
| 238 | 238 | ); |
| 239 | 239 | |
| 240 | - foreach ( $post_types as $post_type ) { |
|
| 240 | + foreach ($post_types as $post_type) { |
|
| 241 | 241 | array_push( |
| 242 | 242 | $post_type_option_values, |
| 243 | 243 | array( |
@@ -261,8 +261,8 @@ discard block |
||
| 261 | 261 | */ |
| 262 | 262 | private static function get_post_taxonomy_key_and_value() { |
| 263 | 263 | |
| 264 | - $post_taxonomy_option_name = array( |
|
| 265 | - 'label' => __( 'Post Taxonomy', 'wordlift' ), |
|
| 264 | + $post_taxonomy_option_name = array( |
|
| 265 | + 'label' => __('Post Taxonomy', 'wordlift'), |
|
| 266 | 266 | 'value' => Wordlift\Mappings\Validators\Post_Taxonomy_Term_Rule_Validator::POST_TAXONOMY, |
| 267 | 267 | 'api_source' => 'post_taxonomy' |
| 268 | 268 | ); |
@@ -280,14 +280,14 @@ discard block |
||
| 280 | 280 | * @param array $edit_mapping_settings |
| 281 | 281 | * @return array Loads the logic field options to the $edit_mapping_settings. |
| 282 | 282 | */ |
| 283 | - private function load_logic_field_options( array $edit_mapping_settings ) { |
|
| 283 | + private function load_logic_field_options(array $edit_mapping_settings) { |
|
| 284 | 284 | $edit_mapping_settings['wl_logic_field_options'] = array( |
| 285 | 285 | array( |
| 286 | - 'label' => __( 'is equal to', 'wordlift' ), |
|
| 286 | + 'label' => __('is equal to', 'wordlift'), |
|
| 287 | 287 | 'value' => Wordlift\Mappings\Validators\Rule_Validator::IS_EQUAL_TO, |
| 288 | 288 | ), |
| 289 | 289 | array( |
| 290 | - 'label' => __( 'is not equal to', 'wordlift' ), |
|
| 290 | + 'label' => __('is not equal to', 'wordlift'), |
|
| 291 | 291 | 'value' => Wordlift\Mappings\Validators\Rule_Validator::IS_NOT_EQUAL_TO, |
| 292 | 292 | ), |
| 293 | 293 | ); |
@@ -301,12 +301,12 @@ discard block |
||
| 301 | 301 | * @param array $edit_mapping_settings |
| 302 | 302 | * @return array Edit mapping settings array with the mapping id if the nonce is valid. |
| 303 | 303 | */ |
| 304 | - private function validate_nonce_and_assign_mapping_id( array $edit_mapping_settings ) { |
|
| 304 | + private function validate_nonce_and_assign_mapping_id(array $edit_mapping_settings) { |
|
| 305 | 305 | // We verify the nonce before making to load the edit mapping page for the wl_edit_mapping_id |
| 306 | - if ( isset( $_REQUEST['_wl_edit_mapping_nonce'] ) |
|
| 307 | - && wp_verify_nonce( $_REQUEST['_wl_edit_mapping_nonce'], 'wl-edit-mapping-nonce' ) ) { |
|
| 306 | + if (isset($_REQUEST['_wl_edit_mapping_nonce']) |
|
| 307 | + && wp_verify_nonce($_REQUEST['_wl_edit_mapping_nonce'], 'wl-edit-mapping-nonce')) { |
|
| 308 | 308 | // We're using `INPUT_GET` here because this is a link from the UI, i.e. no POST. |
| 309 | - $edit_mapping_settings['wl_edit_mapping_id'] = (int) filter_var( $_REQUEST['wl_edit_mapping_id'], FILTER_VALIDATE_INT ); |
|
| 309 | + $edit_mapping_settings['wl_edit_mapping_id'] = (int) filter_var($_REQUEST['wl_edit_mapping_id'], FILTER_VALIDATE_INT); |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | return $edit_mapping_settings; |
@@ -318,13 +318,13 @@ discard block |
||
| 318 | 318 | * @param array $edit_mapping_settings |
| 319 | 319 | * @return array |
| 320 | 320 | */ |
| 321 | - private function load_rest_settings( array $edit_mapping_settings ) { |
|
| 322 | - $edit_mapping_settings['rest_url'] = get_rest_url( |
|
| 321 | + private function load_rest_settings(array $edit_mapping_settings) { |
|
| 322 | + $edit_mapping_settings['rest_url'] = get_rest_url( |
|
| 323 | 323 | null, |
| 324 | - WL_REST_ROUTE_DEFAULT_NAMESPACE . Mappings_REST_Controller::MAPPINGS_NAMESPACE |
|
| 324 | + WL_REST_ROUTE_DEFAULT_NAMESPACE.Mappings_REST_Controller::MAPPINGS_NAMESPACE |
|
| 325 | 325 | ); |
| 326 | - $edit_mapping_settings['wl_edit_mapping_rest_nonce'] = wp_create_nonce( 'wp_rest' ); |
|
| 327 | - $edit_mapping_settings = $this->validate_nonce_and_assign_mapping_id( $edit_mapping_settings ); |
|
| 326 | + $edit_mapping_settings['wl_edit_mapping_rest_nonce'] = wp_create_nonce('wp_rest'); |
|
| 327 | + $edit_mapping_settings = $this->validate_nonce_and_assign_mapping_id($edit_mapping_settings); |
|
| 328 | 328 | |
| 329 | 329 | return $edit_mapping_settings; |
| 330 | 330 | } |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | * |
| 337 | 337 | * @return array Return the settings. |
| 338 | 338 | */ |
| 339 | - private function load_rule_field_options( array $edit_mapping_settings ) { |
|
| 339 | + private function load_rule_field_options(array $edit_mapping_settings) { |
|
| 340 | 340 | // Load the rule field options. |
| 341 | 341 | $rule_field_data = self::get_post_taxonomies_and_terms(); |
| 342 | 342 | $edit_mapping_settings['wl_rule_field_one_options'] = $rule_field_data['taxonomy_options']; |
@@ -386,14 +386,14 @@ discard block |
||
| 386 | 386 | * |
| 387 | 387 | * @return array |
| 388 | 388 | */ |
| 389 | - private function load_field_type_and_name_options( array $edit_mapping_settings ) { |
|
| 389 | + private function load_field_type_and_name_options(array $edit_mapping_settings) { |
|
| 390 | 390 | $all_field_name_options = self::get_all_field_name_options(); |
| 391 | - $all_field_types_options = array_map( function ( $item ) { |
|
| 391 | + $all_field_types_options = array_map(function($item) { |
|
| 392 | 392 | return array( |
| 393 | 393 | 'label' => $item['label'], |
| 394 | 394 | 'value' => $item['field_type'], |
| 395 | 395 | ); |
| 396 | - }, $all_field_name_options ); |
|
| 396 | + }, $all_field_name_options); |
|
| 397 | 397 | |
| 398 | 398 | $edit_mapping_settings['wl_field_type_options'] = $all_field_types_options; |
| 399 | 399 | // Add wl_edit_field_name_options. |
@@ -69,1561 +69,1561 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | class Wordlift { |
| 71 | 71 | |
| 72 | - //<editor-fold desc="## FIELDS"> |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
| 76 | - * the plugin. |
|
| 77 | - * |
|
| 78 | - * @since 1.0.0 |
|
| 79 | - * @access protected |
|
| 80 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 81 | - */ |
|
| 82 | - protected $loader; |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * The unique identifier of this plugin. |
|
| 86 | - * |
|
| 87 | - * @since 1.0.0 |
|
| 88 | - * @access protected |
|
| 89 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 90 | - */ |
|
| 91 | - protected $plugin_name; |
|
| 92 | - |
|
| 93 | - /** |
|
| 94 | - * The current version of the plugin. |
|
| 95 | - * |
|
| 96 | - * @since 1.0.0 |
|
| 97 | - * @access protected |
|
| 98 | - * @var string $version The current version of the plugin. |
|
| 99 | - */ |
|
| 100 | - protected $version; |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 104 | - * |
|
| 105 | - * @since 3.12.0 |
|
| 106 | - * @access protected |
|
| 107 | - * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 108 | - */ |
|
| 109 | - protected $tinymce_adapter; |
|
| 110 | - |
|
| 111 | - /** |
|
| 112 | - * The {@link Faq_Tinymce_Adapter} instance |
|
| 113 | - * @since 3.26.0 |
|
| 114 | - * @access protected |
|
| 115 | - * @var Faq_Tinymce_Adapter $faq_tinymce_adapter . |
|
| 116 | - */ |
|
| 117 | - //protected $faq_tinymce_adapter; |
|
| 118 | - |
|
| 119 | - /** |
|
| 120 | - * The Thumbnail service. |
|
| 121 | - * |
|
| 122 | - * @since 3.1.5 |
|
| 123 | - * @access private |
|
| 124 | - * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 125 | - */ |
|
| 126 | - private $thumbnail_service; |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * The UI service. |
|
| 130 | - * |
|
| 131 | - * @since 3.2.0 |
|
| 132 | - * @access private |
|
| 133 | - * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 134 | - */ |
|
| 135 | - private $ui_service; |
|
| 136 | - |
|
| 137 | - /** |
|
| 138 | - * The Schema service. |
|
| 139 | - * |
|
| 140 | - * @since 3.3.0 |
|
| 141 | - * @access protected |
|
| 142 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 143 | - */ |
|
| 144 | - protected $schema_service; |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * The Entity service. |
|
| 148 | - * |
|
| 149 | - * @since 3.1.0 |
|
| 150 | - * @access protected |
|
| 151 | - * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 152 | - */ |
|
| 153 | - protected $entity_service; |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * The Topic Taxonomy service. |
|
| 157 | - * |
|
| 158 | - * @since 3.5.0 |
|
| 159 | - * @access private |
|
| 160 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 161 | - */ |
|
| 162 | - private $topic_taxonomy_service; |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * The Entity Types Taxonomy service. |
|
| 166 | - * |
|
| 167 | - * @since 3.18.0 |
|
| 168 | - * @access private |
|
| 169 | - * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 170 | - */ |
|
| 171 | - private $entity_types_taxonomy_service; |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * The User service. |
|
| 175 | - * |
|
| 176 | - * @since 3.1.7 |
|
| 177 | - * @access protected |
|
| 178 | - * @var \Wordlift_User_Service $user_service The User service. |
|
| 179 | - */ |
|
| 180 | - protected $user_service; |
|
| 181 | - |
|
| 182 | - /** |
|
| 183 | - * The Timeline service. |
|
| 184 | - * |
|
| 185 | - * @since 3.1.0 |
|
| 186 | - * @access private |
|
| 187 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 188 | - */ |
|
| 189 | - private $timeline_service; |
|
| 190 | - |
|
| 191 | - /** |
|
| 192 | - * The Redirect service. |
|
| 193 | - * |
|
| 194 | - * @since 3.2.0 |
|
| 195 | - * @access private |
|
| 196 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 197 | - */ |
|
| 198 | - private $redirect_service; |
|
| 199 | - |
|
| 200 | - /** |
|
| 201 | - * The Notice service. |
|
| 202 | - * |
|
| 203 | - * @since 3.3.0 |
|
| 204 | - * @access private |
|
| 205 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 206 | - */ |
|
| 207 | - private $notice_service; |
|
| 208 | - |
|
| 209 | - /** |
|
| 210 | - * The Entity list customization. |
|
| 211 | - * |
|
| 212 | - * @since 3.3.0 |
|
| 213 | - * @access protected |
|
| 214 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 215 | - */ |
|
| 216 | - protected $entity_list_service; |
|
| 217 | - |
|
| 218 | - /** |
|
| 219 | - * The Entity Types Taxonomy Walker. |
|
| 220 | - * |
|
| 221 | - * @since 3.1.0 |
|
| 222 | - * @access private |
|
| 223 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 224 | - */ |
|
| 225 | - private $entity_types_taxonomy_walker; |
|
| 226 | - |
|
| 227 | - /** |
|
| 228 | - * The ShareThis service. |
|
| 229 | - * |
|
| 230 | - * @since 3.2.0 |
|
| 231 | - * @access private |
|
| 232 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 233 | - */ |
|
| 234 | - private $sharethis_service; |
|
| 235 | - |
|
| 236 | - /** |
|
| 237 | - * The PrimaShop adapter. |
|
| 238 | - * |
|
| 239 | - * @since 3.2.3 |
|
| 240 | - * @access private |
|
| 241 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 242 | - */ |
|
| 243 | - private $primashop_adapter; |
|
| 244 | - |
|
| 245 | - /** |
|
| 246 | - * The WordLift Dashboard adapter. |
|
| 247 | - * |
|
| 248 | - * @since 3.4.0 |
|
| 249 | - * @access private |
|
| 250 | - * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 251 | - */ |
|
| 252 | - private $dashboard_service; |
|
| 253 | - |
|
| 254 | - /** |
|
| 255 | - * The entity type service. |
|
| 256 | - * |
|
| 257 | - * @since 3.6.0 |
|
| 258 | - * @access private |
|
| 259 | - * @var \Wordlift_Entity_Post_Type_Service |
|
| 260 | - */ |
|
| 261 | - private $entity_post_type_service; |
|
| 262 | - |
|
| 263 | - /** |
|
| 264 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 265 | - * |
|
| 266 | - * @since 3.6.0 |
|
| 267 | - * @access private |
|
| 268 | - * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 269 | - */ |
|
| 270 | - private $entity_link_service; |
|
| 271 | - |
|
| 272 | - /** |
|
| 273 | - * A {@link Wordlift_Sparql_Service} instance. |
|
| 274 | - * |
|
| 275 | - * @since 3.6.0 |
|
| 276 | - * @access protected |
|
| 277 | - * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 278 | - */ |
|
| 279 | - protected $sparql_service; |
|
| 280 | - |
|
| 281 | - /** |
|
| 282 | - * A {@link Wordlift_Import_Service} instance. |
|
| 283 | - * |
|
| 284 | - * @since 3.6.0 |
|
| 285 | - * @access private |
|
| 286 | - * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 287 | - */ |
|
| 288 | - private $import_service; |
|
| 289 | - |
|
| 290 | - /** |
|
| 291 | - * A {@link Wordlift_Rebuild_Service} instance. |
|
| 292 | - * |
|
| 293 | - * @since 3.6.0 |
|
| 294 | - * @access private |
|
| 295 | - * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 296 | - */ |
|
| 297 | - private $rebuild_service; |
|
| 298 | - |
|
| 299 | - /** |
|
| 300 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
| 301 | - * |
|
| 302 | - * @since 3.7.0 |
|
| 303 | - * @access protected |
|
| 304 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 305 | - */ |
|
| 306 | - protected $jsonld_service; |
|
| 307 | - |
|
| 308 | - /** |
|
| 309 | - * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 310 | - * |
|
| 311 | - * @since 3.14.0 |
|
| 312 | - * @access protected |
|
| 313 | - * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 314 | - */ |
|
| 315 | - protected $jsonld_website_converter; |
|
| 316 | - |
|
| 317 | - /** |
|
| 318 | - * A {@link Wordlift_Property_Factory} instance. |
|
| 319 | - * |
|
| 320 | - * @since 3.7.0 |
|
| 321 | - * @access private |
|
| 322 | - * @var \Wordlift_Property_Factory $property_factory |
|
| 323 | - */ |
|
| 324 | - private $property_factory; |
|
| 325 | - |
|
| 326 | - /** |
|
| 327 | - * The 'Download Your Data' page. |
|
| 328 | - * |
|
| 329 | - * @since 3.6.0 |
|
| 330 | - * @access private |
|
| 331 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 332 | - */ |
|
| 333 | - private $download_your_data_page; |
|
| 334 | - |
|
| 335 | - /** |
|
| 336 | - * The 'WordLift Settings' page. |
|
| 337 | - * |
|
| 338 | - * @since 3.11.0 |
|
| 339 | - * @access protected |
|
| 340 | - * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 341 | - */ |
|
| 342 | - protected $settings_page; |
|
| 343 | - |
|
| 344 | - /** |
|
| 345 | - * The install wizard page. |
|
| 346 | - * |
|
| 347 | - * @since 3.9.0 |
|
| 348 | - * @access private |
|
| 349 | - * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 350 | - */ |
|
| 351 | - public $admin_setup; |
|
| 352 | - |
|
| 353 | - /** |
|
| 354 | - * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 355 | - * linking of entities to their pages. |
|
| 356 | - * |
|
| 357 | - * @since 3.8.0 |
|
| 358 | - * @access private |
|
| 359 | - * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 360 | - */ |
|
| 361 | - private $content_filter_service; |
|
| 362 | - |
|
| 363 | - /** |
|
| 364 | - * The Faq Content filter service |
|
| 365 | - * @since 3.26.0 |
|
| 366 | - * @access private |
|
| 367 | - * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
| 368 | - */ |
|
| 369 | - private $faq_content_filter_service; |
|
| 370 | - |
|
| 371 | - /** |
|
| 372 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 373 | - * |
|
| 374 | - * @since 3.9.0 |
|
| 375 | - * @access private |
|
| 376 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 377 | - */ |
|
| 378 | - private $key_validation_service; |
|
| 379 | - |
|
| 380 | - /** |
|
| 381 | - * A {@link Wordlift_Rating_Service} instance. |
|
| 382 | - * |
|
| 383 | - * @since 3.10.0 |
|
| 384 | - * @access private |
|
| 385 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 386 | - */ |
|
| 387 | - private $rating_service; |
|
| 388 | - |
|
| 389 | - /** |
|
| 390 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 391 | - * |
|
| 392 | - * @since 3.10.0 |
|
| 393 | - * @access protected |
|
| 394 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 395 | - */ |
|
| 396 | - protected $post_to_jsonld_converter; |
|
| 397 | - |
|
| 398 | - /** |
|
| 399 | - * A {@link Wordlift_Configuration_Service} instance. |
|
| 400 | - * |
|
| 401 | - * @since 3.10.0 |
|
| 402 | - * @access protected |
|
| 403 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 404 | - */ |
|
| 405 | - protected $configuration_service; |
|
| 406 | - |
|
| 407 | - /** |
|
| 408 | - * A {@link Wordlift_Install_Service} instance. |
|
| 409 | - * |
|
| 410 | - * @since 3.18.0 |
|
| 411 | - * @access protected |
|
| 412 | - * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 413 | - */ |
|
| 414 | - protected $install_service; |
|
| 415 | - |
|
| 416 | - /** |
|
| 417 | - * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 418 | - * |
|
| 419 | - * @since 3.10.0 |
|
| 420 | - * @access protected |
|
| 421 | - * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 422 | - */ |
|
| 423 | - protected $entity_type_service; |
|
| 424 | - |
|
| 425 | - /** |
|
| 426 | - * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 427 | - * |
|
| 428 | - * @since 3.10.0 |
|
| 429 | - * @access protected |
|
| 430 | - * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 431 | - */ |
|
| 432 | - protected $entity_post_to_jsonld_converter; |
|
| 433 | - |
|
| 434 | - /** |
|
| 435 | - * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 436 | - * |
|
| 437 | - * @since 3.10.0 |
|
| 438 | - * @access protected |
|
| 439 | - * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 440 | - */ |
|
| 441 | - protected $postid_to_jsonld_converter; |
|
| 442 | - |
|
| 443 | - /** |
|
| 444 | - * The {@link Wordlift_Admin_Status_Page} class. |
|
| 445 | - * |
|
| 446 | - * @since 3.9.8 |
|
| 447 | - * @access private |
|
| 448 | - * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 449 | - */ |
|
| 450 | - private $status_page; |
|
| 451 | - |
|
| 452 | - /** |
|
| 453 | - * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 454 | - * |
|
| 455 | - * @since 3.11.0 |
|
| 456 | - * @access protected |
|
| 457 | - * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 458 | - */ |
|
| 459 | - protected $category_taxonomy_service; |
|
| 460 | - |
|
| 461 | - /** |
|
| 462 | - * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 463 | - * |
|
| 464 | - * @since 3.11.0 |
|
| 465 | - * @access protected |
|
| 466 | - * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 467 | - */ |
|
| 468 | - protected $entity_page_service; |
|
| 469 | - |
|
| 470 | - /** |
|
| 471 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 472 | - * |
|
| 473 | - * @since 3.11.0 |
|
| 474 | - * @access protected |
|
| 475 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 476 | - */ |
|
| 477 | - protected $settings_page_action_link; |
|
| 478 | - |
|
| 479 | - /** |
|
| 480 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 481 | - * |
|
| 482 | - * @since 3.11.0 |
|
| 483 | - * @access protected |
|
| 484 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 485 | - */ |
|
| 486 | - protected $analytics_settings_page_action_link; |
|
| 487 | - |
|
| 488 | - /** |
|
| 489 | - * The {@link Wordlift_Analytics_Connect} class. |
|
| 490 | - * |
|
| 491 | - * @since 3.11.0 |
|
| 492 | - * @access protected |
|
| 493 | - * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 494 | - */ |
|
| 495 | - protected $analytics_connect; |
|
| 496 | - |
|
| 497 | - /** |
|
| 498 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 499 | - * |
|
| 500 | - * @since 3.11.0 |
|
| 501 | - * @access protected |
|
| 502 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 503 | - */ |
|
| 504 | - protected $publisher_ajax_adapter; |
|
| 505 | - |
|
| 506 | - /** |
|
| 507 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 508 | - * |
|
| 509 | - * @since 3.11.0 |
|
| 510 | - * @access protected |
|
| 511 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 512 | - */ |
|
| 513 | - protected $input_element; |
|
| 514 | - |
|
| 515 | - /** |
|
| 516 | - * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 517 | - * |
|
| 518 | - * @since 3.13.0 |
|
| 519 | - * @access protected |
|
| 520 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 521 | - */ |
|
| 522 | - protected $radio_input_element; |
|
| 523 | - |
|
| 524 | - /** |
|
| 525 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 526 | - * |
|
| 527 | - * @since 3.11.0 |
|
| 528 | - * @access protected |
|
| 529 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 530 | - */ |
|
| 531 | - protected $language_select_element; |
|
| 532 | - |
|
| 533 | - /** |
|
| 534 | - * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 535 | - * |
|
| 536 | - * @since 3.18.0 |
|
| 537 | - * @access protected |
|
| 538 | - * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 539 | - */ |
|
| 540 | - protected $country_select_element; |
|
| 541 | - |
|
| 542 | - /** |
|
| 543 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 544 | - * |
|
| 545 | - * @since 3.11.0 |
|
| 546 | - * @access protected |
|
| 547 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 548 | - */ |
|
| 549 | - protected $publisher_element; |
|
| 550 | - |
|
| 551 | - /** |
|
| 552 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 553 | - * |
|
| 554 | - * @since 3.11.0 |
|
| 555 | - * @access protected |
|
| 556 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 557 | - */ |
|
| 558 | - protected $select2_element; |
|
| 559 | - |
|
| 560 | - /** |
|
| 561 | - * The controller for the entity type list admin page |
|
| 562 | - * |
|
| 563 | - * @since 3.11.0 |
|
| 564 | - * @access private |
|
| 565 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 566 | - */ |
|
| 567 | - private $entity_type_admin_page; |
|
| 568 | - |
|
| 569 | - /** |
|
| 570 | - * The controller for the entity type settings admin page |
|
| 571 | - * |
|
| 572 | - * @since 3.11.0 |
|
| 573 | - * @access private |
|
| 574 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 575 | - */ |
|
| 576 | - private $entity_type_settings_admin_page; |
|
| 577 | - |
|
| 578 | - /** |
|
| 579 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 580 | - * |
|
| 581 | - * @since 3.11.0 |
|
| 582 | - * @access protected |
|
| 583 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 584 | - */ |
|
| 585 | - protected $related_entities_cloud_widget; |
|
| 586 | - |
|
| 587 | - /** |
|
| 588 | - * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 589 | - * |
|
| 590 | - * @since 3.14.0 |
|
| 591 | - * @access protected |
|
| 592 | - * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 593 | - */ |
|
| 594 | - protected $author_element; |
|
| 595 | - |
|
| 596 | - /** |
|
| 597 | - * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 598 | - * |
|
| 599 | - * @since 3.12.0 |
|
| 600 | - * @access protected |
|
| 601 | - * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 602 | - */ |
|
| 603 | - protected $sample_data_service; |
|
| 604 | - |
|
| 605 | - /** |
|
| 606 | - * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 607 | - * |
|
| 608 | - * @since 3.12.0 |
|
| 609 | - * @access protected |
|
| 610 | - * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 611 | - */ |
|
| 612 | - protected $sample_data_ajax_adapter; |
|
| 613 | - |
|
| 614 | - /** |
|
| 615 | - * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 616 | - * |
|
| 617 | - * @since 3.14.3 |
|
| 618 | - * @access private |
|
| 619 | - * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 620 | - */ |
|
| 621 | - private $relation_rebuild_service; |
|
| 622 | - |
|
| 623 | - /** |
|
| 624 | - * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 625 | - * |
|
| 626 | - * @since 3.14.3 |
|
| 627 | - * @access private |
|
| 628 | - * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 629 | - */ |
|
| 630 | - private $relation_rebuild_adapter; |
|
| 631 | - |
|
| 632 | - /** |
|
| 633 | - * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 634 | - * |
|
| 635 | - * @since 3.18.0 |
|
| 636 | - * @access private |
|
| 637 | - * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 638 | - */ |
|
| 639 | - private $reference_rebuild_service; |
|
| 640 | - |
|
| 641 | - /** |
|
| 642 | - * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 643 | - * |
|
| 644 | - * @since 3.16.0 |
|
| 645 | - * @access protected |
|
| 646 | - * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 647 | - */ |
|
| 648 | - protected $google_analytics_export_service; |
|
| 649 | - |
|
| 650 | - /** |
|
| 651 | - * {@link Wordlift}'s singleton instance. |
|
| 652 | - * |
|
| 653 | - * @since 3.15.0 |
|
| 654 | - * @access protected |
|
| 655 | - * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 656 | - */ |
|
| 657 | - protected $entity_type_adapter; |
|
| 658 | - |
|
| 659 | - /** |
|
| 660 | - * The {@link Wordlift_Storage_Factory} instance. |
|
| 661 | - * |
|
| 662 | - * @since 3.15.0 |
|
| 663 | - * @access protected |
|
| 664 | - * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 665 | - */ |
|
| 666 | - protected $storage_factory; |
|
| 667 | - |
|
| 668 | - /** |
|
| 669 | - * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 670 | - * |
|
| 671 | - * @since 3.15.0 |
|
| 672 | - * @access protected |
|
| 673 | - * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 674 | - */ |
|
| 675 | - protected $rendition_factory; |
|
| 676 | - |
|
| 677 | - /** |
|
| 678 | - * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 679 | - * |
|
| 680 | - * @since 3.15.0 |
|
| 681 | - * @access private |
|
| 682 | - * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 683 | - */ |
|
| 684 | - private $autocomplete_adapter; |
|
| 685 | - |
|
| 686 | - /** |
|
| 687 | - * The {@link Wordlift_Relation_Service} instance. |
|
| 688 | - * |
|
| 689 | - * @since 3.15.0 |
|
| 690 | - * @access protected |
|
| 691 | - * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 692 | - */ |
|
| 693 | - protected $relation_service; |
|
| 694 | - |
|
| 695 | - /** |
|
| 696 | - * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 697 | - * |
|
| 698 | - * @since 3.16.0 |
|
| 699 | - * @access protected |
|
| 700 | - * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 701 | - * |
|
| 702 | - */ |
|
| 703 | - protected $cached_postid_to_jsonld_converter; |
|
| 704 | - |
|
| 705 | - /** |
|
| 706 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 707 | - * |
|
| 708 | - * @since 3.16.3 |
|
| 709 | - * @access protected |
|
| 710 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 711 | - */ |
|
| 712 | - protected $entity_uri_service; |
|
| 713 | - |
|
| 714 | - /** |
|
| 715 | - * The {@link Wordlift_Publisher_Service} instance. |
|
| 716 | - * |
|
| 717 | - * @since 3.19.0 |
|
| 718 | - * @access protected |
|
| 719 | - * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 720 | - */ |
|
| 721 | - protected $publisher_service; |
|
| 722 | - |
|
| 723 | - /** |
|
| 724 | - * The {@link Wordlift_Context_Cards_Service} instance. |
|
| 725 | - * |
|
| 726 | - * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
| 727 | - */ |
|
| 728 | - protected $context_cards_service; |
|
| 729 | - |
|
| 730 | - /** |
|
| 731 | - * {@link Wordlift}'s singleton instance. |
|
| 732 | - * |
|
| 733 | - * @since 3.11.2 |
|
| 734 | - * @access private |
|
| 735 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 736 | - */ |
|
| 737 | - private static $instance; |
|
| 738 | - |
|
| 739 | - //</editor-fold> |
|
| 740 | - |
|
| 741 | - /** |
|
| 742 | - * Define the core functionality of the plugin. |
|
| 743 | - * |
|
| 744 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 745 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 746 | - * the public-facing side of the site. |
|
| 747 | - * |
|
| 748 | - * @since 1.0.0 |
|
| 749 | - */ |
|
| 750 | - public function __construct() { |
|
| 751 | - |
|
| 752 | - self::$instance = $this; |
|
| 753 | - |
|
| 754 | - $this->plugin_name = 'wordlift'; |
|
| 755 | - $this->version = '3.27.8'; |
|
| 756 | - $this->load_dependencies(); |
|
| 757 | - $this->set_locale(); |
|
| 758 | - $this->define_admin_hooks(); |
|
| 759 | - $this->define_public_hooks(); |
|
| 760 | - |
|
| 761 | - // If we're in `WP_CLI` load the related files. |
|
| 762 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 763 | - $this->load_cli_dependencies(); |
|
| 764 | - } |
|
| 765 | - |
|
| 766 | - } |
|
| 767 | - |
|
| 768 | - /** |
|
| 769 | - * Get the singleton instance. |
|
| 770 | - * |
|
| 771 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 772 | - * @since 3.11.2 |
|
| 773 | - * |
|
| 774 | - */ |
|
| 775 | - public static function get_instance() { |
|
| 776 | - |
|
| 777 | - return self::$instance; |
|
| 778 | - } |
|
| 779 | - |
|
| 780 | - /** |
|
| 781 | - * Load the required dependencies for this plugin. |
|
| 782 | - * |
|
| 783 | - * Include the following files that make up the plugin: |
|
| 784 | - * |
|
| 785 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 786 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 787 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 788 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 789 | - * |
|
| 790 | - * Create an instance of the loader which will be used to register the hooks |
|
| 791 | - * with WordPress. |
|
| 792 | - * |
|
| 793 | - * @throws Exception |
|
| 794 | - * @since 1.0.0 |
|
| 795 | - * @access private |
|
| 796 | - */ |
|
| 797 | - private function load_dependencies() { |
|
| 798 | - |
|
| 799 | - /** |
|
| 800 | - * The class responsible for orchestrating the actions and filters of the |
|
| 801 | - * core plugin. |
|
| 802 | - */ |
|
| 803 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 804 | - |
|
| 805 | - // The class responsible for plugin uninstall. |
|
| 806 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 807 | - |
|
| 808 | - /** |
|
| 809 | - * The class responsible for defining internationalization functionality |
|
| 810 | - * of the plugin. |
|
| 811 | - */ |
|
| 812 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 813 | - |
|
| 814 | - /** |
|
| 815 | - * WordLift's supported languages. |
|
| 816 | - */ |
|
| 817 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 818 | - |
|
| 819 | - /** |
|
| 820 | - * WordLift's supported countries. |
|
| 821 | - */ |
|
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 823 | - |
|
| 824 | - /** |
|
| 825 | - * Provide support functions to sanitize data. |
|
| 826 | - */ |
|
| 827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 828 | - |
|
| 829 | - /** Services. */ |
|
| 830 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 831 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 832 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 833 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 834 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 835 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 836 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 837 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 838 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 839 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 840 | - |
|
| 841 | - /** |
|
| 842 | - * The Query builder. |
|
| 843 | - */ |
|
| 844 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 845 | - |
|
| 846 | - /** |
|
| 847 | - * The Schema service. |
|
| 848 | - */ |
|
| 849 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 850 | - |
|
| 851 | - /** |
|
| 852 | - * The schema:url property service. |
|
| 853 | - */ |
|
| 854 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 855 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 856 | - |
|
| 857 | - /** |
|
| 858 | - * The UI service. |
|
| 859 | - */ |
|
| 860 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 861 | - |
|
| 862 | - /** |
|
| 863 | - * The Thumbnail service. |
|
| 864 | - */ |
|
| 865 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 866 | - |
|
| 867 | - /** |
|
| 868 | - * The Entity Types Taxonomy service. |
|
| 869 | - */ |
|
| 870 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 871 | - |
|
| 872 | - /** |
|
| 873 | - * The Entity service. |
|
| 874 | - */ |
|
| 875 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 876 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 877 | - |
|
| 878 | - // Add the entity rating service. |
|
| 879 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 880 | - |
|
| 881 | - /** |
|
| 882 | - * The User service. |
|
| 883 | - */ |
|
| 884 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 885 | - |
|
| 886 | - /** |
|
| 887 | - * The Timeline service. |
|
| 888 | - */ |
|
| 889 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 890 | - |
|
| 891 | - /** |
|
| 892 | - * The Topic Taxonomy service. |
|
| 893 | - */ |
|
| 894 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 895 | - |
|
| 896 | - /** |
|
| 897 | - * The SPARQL service. |
|
| 898 | - */ |
|
| 899 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 900 | - |
|
| 901 | - /** |
|
| 902 | - * The WordLift import service. |
|
| 903 | - */ |
|
| 904 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 905 | - |
|
| 906 | - /** |
|
| 907 | - * The WordLift URI service. |
|
| 908 | - */ |
|
| 909 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 910 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 911 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 912 | - |
|
| 913 | - /** |
|
| 914 | - * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 915 | - */ |
|
| 916 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 917 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 918 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 919 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 920 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 921 | - |
|
| 922 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 923 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 924 | - |
|
| 925 | - /** |
|
| 926 | - * Load the converters. |
|
| 927 | - */ |
|
| 928 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 929 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 930 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 931 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 932 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 933 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 934 | - |
|
| 935 | - /** |
|
| 936 | - * Load cache-related files. |
|
| 937 | - */ |
|
| 938 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 939 | - |
|
| 940 | - /** |
|
| 941 | - * Load the content filter. |
|
| 942 | - */ |
|
| 943 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 944 | - |
|
| 945 | - /* |
|
| 72 | + //<editor-fold desc="## FIELDS"> |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
| 76 | + * the plugin. |
|
| 77 | + * |
|
| 78 | + * @since 1.0.0 |
|
| 79 | + * @access protected |
|
| 80 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 81 | + */ |
|
| 82 | + protected $loader; |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * The unique identifier of this plugin. |
|
| 86 | + * |
|
| 87 | + * @since 1.0.0 |
|
| 88 | + * @access protected |
|
| 89 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 90 | + */ |
|
| 91 | + protected $plugin_name; |
|
| 92 | + |
|
| 93 | + /** |
|
| 94 | + * The current version of the plugin. |
|
| 95 | + * |
|
| 96 | + * @since 1.0.0 |
|
| 97 | + * @access protected |
|
| 98 | + * @var string $version The current version of the plugin. |
|
| 99 | + */ |
|
| 100 | + protected $version; |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 104 | + * |
|
| 105 | + * @since 3.12.0 |
|
| 106 | + * @access protected |
|
| 107 | + * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 108 | + */ |
|
| 109 | + protected $tinymce_adapter; |
|
| 110 | + |
|
| 111 | + /** |
|
| 112 | + * The {@link Faq_Tinymce_Adapter} instance |
|
| 113 | + * @since 3.26.0 |
|
| 114 | + * @access protected |
|
| 115 | + * @var Faq_Tinymce_Adapter $faq_tinymce_adapter . |
|
| 116 | + */ |
|
| 117 | + //protected $faq_tinymce_adapter; |
|
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * The Thumbnail service. |
|
| 121 | + * |
|
| 122 | + * @since 3.1.5 |
|
| 123 | + * @access private |
|
| 124 | + * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 125 | + */ |
|
| 126 | + private $thumbnail_service; |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * The UI service. |
|
| 130 | + * |
|
| 131 | + * @since 3.2.0 |
|
| 132 | + * @access private |
|
| 133 | + * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 134 | + */ |
|
| 135 | + private $ui_service; |
|
| 136 | + |
|
| 137 | + /** |
|
| 138 | + * The Schema service. |
|
| 139 | + * |
|
| 140 | + * @since 3.3.0 |
|
| 141 | + * @access protected |
|
| 142 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 143 | + */ |
|
| 144 | + protected $schema_service; |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * The Entity service. |
|
| 148 | + * |
|
| 149 | + * @since 3.1.0 |
|
| 150 | + * @access protected |
|
| 151 | + * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 152 | + */ |
|
| 153 | + protected $entity_service; |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * The Topic Taxonomy service. |
|
| 157 | + * |
|
| 158 | + * @since 3.5.0 |
|
| 159 | + * @access private |
|
| 160 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 161 | + */ |
|
| 162 | + private $topic_taxonomy_service; |
|
| 163 | + |
|
| 164 | + /** |
|
| 165 | + * The Entity Types Taxonomy service. |
|
| 166 | + * |
|
| 167 | + * @since 3.18.0 |
|
| 168 | + * @access private |
|
| 169 | + * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 170 | + */ |
|
| 171 | + private $entity_types_taxonomy_service; |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * The User service. |
|
| 175 | + * |
|
| 176 | + * @since 3.1.7 |
|
| 177 | + * @access protected |
|
| 178 | + * @var \Wordlift_User_Service $user_service The User service. |
|
| 179 | + */ |
|
| 180 | + protected $user_service; |
|
| 181 | + |
|
| 182 | + /** |
|
| 183 | + * The Timeline service. |
|
| 184 | + * |
|
| 185 | + * @since 3.1.0 |
|
| 186 | + * @access private |
|
| 187 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 188 | + */ |
|
| 189 | + private $timeline_service; |
|
| 190 | + |
|
| 191 | + /** |
|
| 192 | + * The Redirect service. |
|
| 193 | + * |
|
| 194 | + * @since 3.2.0 |
|
| 195 | + * @access private |
|
| 196 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 197 | + */ |
|
| 198 | + private $redirect_service; |
|
| 199 | + |
|
| 200 | + /** |
|
| 201 | + * The Notice service. |
|
| 202 | + * |
|
| 203 | + * @since 3.3.0 |
|
| 204 | + * @access private |
|
| 205 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 206 | + */ |
|
| 207 | + private $notice_service; |
|
| 208 | + |
|
| 209 | + /** |
|
| 210 | + * The Entity list customization. |
|
| 211 | + * |
|
| 212 | + * @since 3.3.0 |
|
| 213 | + * @access protected |
|
| 214 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 215 | + */ |
|
| 216 | + protected $entity_list_service; |
|
| 217 | + |
|
| 218 | + /** |
|
| 219 | + * The Entity Types Taxonomy Walker. |
|
| 220 | + * |
|
| 221 | + * @since 3.1.0 |
|
| 222 | + * @access private |
|
| 223 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 224 | + */ |
|
| 225 | + private $entity_types_taxonomy_walker; |
|
| 226 | + |
|
| 227 | + /** |
|
| 228 | + * The ShareThis service. |
|
| 229 | + * |
|
| 230 | + * @since 3.2.0 |
|
| 231 | + * @access private |
|
| 232 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 233 | + */ |
|
| 234 | + private $sharethis_service; |
|
| 235 | + |
|
| 236 | + /** |
|
| 237 | + * The PrimaShop adapter. |
|
| 238 | + * |
|
| 239 | + * @since 3.2.3 |
|
| 240 | + * @access private |
|
| 241 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 242 | + */ |
|
| 243 | + private $primashop_adapter; |
|
| 244 | + |
|
| 245 | + /** |
|
| 246 | + * The WordLift Dashboard adapter. |
|
| 247 | + * |
|
| 248 | + * @since 3.4.0 |
|
| 249 | + * @access private |
|
| 250 | + * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 251 | + */ |
|
| 252 | + private $dashboard_service; |
|
| 253 | + |
|
| 254 | + /** |
|
| 255 | + * The entity type service. |
|
| 256 | + * |
|
| 257 | + * @since 3.6.0 |
|
| 258 | + * @access private |
|
| 259 | + * @var \Wordlift_Entity_Post_Type_Service |
|
| 260 | + */ |
|
| 261 | + private $entity_post_type_service; |
|
| 262 | + |
|
| 263 | + /** |
|
| 264 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 265 | + * |
|
| 266 | + * @since 3.6.0 |
|
| 267 | + * @access private |
|
| 268 | + * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 269 | + */ |
|
| 270 | + private $entity_link_service; |
|
| 271 | + |
|
| 272 | + /** |
|
| 273 | + * A {@link Wordlift_Sparql_Service} instance. |
|
| 274 | + * |
|
| 275 | + * @since 3.6.0 |
|
| 276 | + * @access protected |
|
| 277 | + * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 278 | + */ |
|
| 279 | + protected $sparql_service; |
|
| 280 | + |
|
| 281 | + /** |
|
| 282 | + * A {@link Wordlift_Import_Service} instance. |
|
| 283 | + * |
|
| 284 | + * @since 3.6.0 |
|
| 285 | + * @access private |
|
| 286 | + * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 287 | + */ |
|
| 288 | + private $import_service; |
|
| 289 | + |
|
| 290 | + /** |
|
| 291 | + * A {@link Wordlift_Rebuild_Service} instance. |
|
| 292 | + * |
|
| 293 | + * @since 3.6.0 |
|
| 294 | + * @access private |
|
| 295 | + * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 296 | + */ |
|
| 297 | + private $rebuild_service; |
|
| 298 | + |
|
| 299 | + /** |
|
| 300 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
| 301 | + * |
|
| 302 | + * @since 3.7.0 |
|
| 303 | + * @access protected |
|
| 304 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 305 | + */ |
|
| 306 | + protected $jsonld_service; |
|
| 307 | + |
|
| 308 | + /** |
|
| 309 | + * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 310 | + * |
|
| 311 | + * @since 3.14.0 |
|
| 312 | + * @access protected |
|
| 313 | + * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 314 | + */ |
|
| 315 | + protected $jsonld_website_converter; |
|
| 316 | + |
|
| 317 | + /** |
|
| 318 | + * A {@link Wordlift_Property_Factory} instance. |
|
| 319 | + * |
|
| 320 | + * @since 3.7.0 |
|
| 321 | + * @access private |
|
| 322 | + * @var \Wordlift_Property_Factory $property_factory |
|
| 323 | + */ |
|
| 324 | + private $property_factory; |
|
| 325 | + |
|
| 326 | + /** |
|
| 327 | + * The 'Download Your Data' page. |
|
| 328 | + * |
|
| 329 | + * @since 3.6.0 |
|
| 330 | + * @access private |
|
| 331 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 332 | + */ |
|
| 333 | + private $download_your_data_page; |
|
| 334 | + |
|
| 335 | + /** |
|
| 336 | + * The 'WordLift Settings' page. |
|
| 337 | + * |
|
| 338 | + * @since 3.11.0 |
|
| 339 | + * @access protected |
|
| 340 | + * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 341 | + */ |
|
| 342 | + protected $settings_page; |
|
| 343 | + |
|
| 344 | + /** |
|
| 345 | + * The install wizard page. |
|
| 346 | + * |
|
| 347 | + * @since 3.9.0 |
|
| 348 | + * @access private |
|
| 349 | + * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 350 | + */ |
|
| 351 | + public $admin_setup; |
|
| 352 | + |
|
| 353 | + /** |
|
| 354 | + * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 355 | + * linking of entities to their pages. |
|
| 356 | + * |
|
| 357 | + * @since 3.8.0 |
|
| 358 | + * @access private |
|
| 359 | + * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 360 | + */ |
|
| 361 | + private $content_filter_service; |
|
| 362 | + |
|
| 363 | + /** |
|
| 364 | + * The Faq Content filter service |
|
| 365 | + * @since 3.26.0 |
|
| 366 | + * @access private |
|
| 367 | + * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
| 368 | + */ |
|
| 369 | + private $faq_content_filter_service; |
|
| 370 | + |
|
| 371 | + /** |
|
| 372 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 373 | + * |
|
| 374 | + * @since 3.9.0 |
|
| 375 | + * @access private |
|
| 376 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 377 | + */ |
|
| 378 | + private $key_validation_service; |
|
| 379 | + |
|
| 380 | + /** |
|
| 381 | + * A {@link Wordlift_Rating_Service} instance. |
|
| 382 | + * |
|
| 383 | + * @since 3.10.0 |
|
| 384 | + * @access private |
|
| 385 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 386 | + */ |
|
| 387 | + private $rating_service; |
|
| 388 | + |
|
| 389 | + /** |
|
| 390 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 391 | + * |
|
| 392 | + * @since 3.10.0 |
|
| 393 | + * @access protected |
|
| 394 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 395 | + */ |
|
| 396 | + protected $post_to_jsonld_converter; |
|
| 397 | + |
|
| 398 | + /** |
|
| 399 | + * A {@link Wordlift_Configuration_Service} instance. |
|
| 400 | + * |
|
| 401 | + * @since 3.10.0 |
|
| 402 | + * @access protected |
|
| 403 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 404 | + */ |
|
| 405 | + protected $configuration_service; |
|
| 406 | + |
|
| 407 | + /** |
|
| 408 | + * A {@link Wordlift_Install_Service} instance. |
|
| 409 | + * |
|
| 410 | + * @since 3.18.0 |
|
| 411 | + * @access protected |
|
| 412 | + * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 413 | + */ |
|
| 414 | + protected $install_service; |
|
| 415 | + |
|
| 416 | + /** |
|
| 417 | + * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 418 | + * |
|
| 419 | + * @since 3.10.0 |
|
| 420 | + * @access protected |
|
| 421 | + * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 422 | + */ |
|
| 423 | + protected $entity_type_service; |
|
| 424 | + |
|
| 425 | + /** |
|
| 426 | + * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 427 | + * |
|
| 428 | + * @since 3.10.0 |
|
| 429 | + * @access protected |
|
| 430 | + * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 431 | + */ |
|
| 432 | + protected $entity_post_to_jsonld_converter; |
|
| 433 | + |
|
| 434 | + /** |
|
| 435 | + * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 436 | + * |
|
| 437 | + * @since 3.10.0 |
|
| 438 | + * @access protected |
|
| 439 | + * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 440 | + */ |
|
| 441 | + protected $postid_to_jsonld_converter; |
|
| 442 | + |
|
| 443 | + /** |
|
| 444 | + * The {@link Wordlift_Admin_Status_Page} class. |
|
| 445 | + * |
|
| 446 | + * @since 3.9.8 |
|
| 447 | + * @access private |
|
| 448 | + * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 449 | + */ |
|
| 450 | + private $status_page; |
|
| 451 | + |
|
| 452 | + /** |
|
| 453 | + * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 454 | + * |
|
| 455 | + * @since 3.11.0 |
|
| 456 | + * @access protected |
|
| 457 | + * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 458 | + */ |
|
| 459 | + protected $category_taxonomy_service; |
|
| 460 | + |
|
| 461 | + /** |
|
| 462 | + * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 463 | + * |
|
| 464 | + * @since 3.11.0 |
|
| 465 | + * @access protected |
|
| 466 | + * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 467 | + */ |
|
| 468 | + protected $entity_page_service; |
|
| 469 | + |
|
| 470 | + /** |
|
| 471 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 472 | + * |
|
| 473 | + * @since 3.11.0 |
|
| 474 | + * @access protected |
|
| 475 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 476 | + */ |
|
| 477 | + protected $settings_page_action_link; |
|
| 478 | + |
|
| 479 | + /** |
|
| 480 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 481 | + * |
|
| 482 | + * @since 3.11.0 |
|
| 483 | + * @access protected |
|
| 484 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 485 | + */ |
|
| 486 | + protected $analytics_settings_page_action_link; |
|
| 487 | + |
|
| 488 | + /** |
|
| 489 | + * The {@link Wordlift_Analytics_Connect} class. |
|
| 490 | + * |
|
| 491 | + * @since 3.11.0 |
|
| 492 | + * @access protected |
|
| 493 | + * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 494 | + */ |
|
| 495 | + protected $analytics_connect; |
|
| 496 | + |
|
| 497 | + /** |
|
| 498 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 499 | + * |
|
| 500 | + * @since 3.11.0 |
|
| 501 | + * @access protected |
|
| 502 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 503 | + */ |
|
| 504 | + protected $publisher_ajax_adapter; |
|
| 505 | + |
|
| 506 | + /** |
|
| 507 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 508 | + * |
|
| 509 | + * @since 3.11.0 |
|
| 510 | + * @access protected |
|
| 511 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 512 | + */ |
|
| 513 | + protected $input_element; |
|
| 514 | + |
|
| 515 | + /** |
|
| 516 | + * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 517 | + * |
|
| 518 | + * @since 3.13.0 |
|
| 519 | + * @access protected |
|
| 520 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 521 | + */ |
|
| 522 | + protected $radio_input_element; |
|
| 523 | + |
|
| 524 | + /** |
|
| 525 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 526 | + * |
|
| 527 | + * @since 3.11.0 |
|
| 528 | + * @access protected |
|
| 529 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 530 | + */ |
|
| 531 | + protected $language_select_element; |
|
| 532 | + |
|
| 533 | + /** |
|
| 534 | + * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 535 | + * |
|
| 536 | + * @since 3.18.0 |
|
| 537 | + * @access protected |
|
| 538 | + * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 539 | + */ |
|
| 540 | + protected $country_select_element; |
|
| 541 | + |
|
| 542 | + /** |
|
| 543 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 544 | + * |
|
| 545 | + * @since 3.11.0 |
|
| 546 | + * @access protected |
|
| 547 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 548 | + */ |
|
| 549 | + protected $publisher_element; |
|
| 550 | + |
|
| 551 | + /** |
|
| 552 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 553 | + * |
|
| 554 | + * @since 3.11.0 |
|
| 555 | + * @access protected |
|
| 556 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 557 | + */ |
|
| 558 | + protected $select2_element; |
|
| 559 | + |
|
| 560 | + /** |
|
| 561 | + * The controller for the entity type list admin page |
|
| 562 | + * |
|
| 563 | + * @since 3.11.0 |
|
| 564 | + * @access private |
|
| 565 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 566 | + */ |
|
| 567 | + private $entity_type_admin_page; |
|
| 568 | + |
|
| 569 | + /** |
|
| 570 | + * The controller for the entity type settings admin page |
|
| 571 | + * |
|
| 572 | + * @since 3.11.0 |
|
| 573 | + * @access private |
|
| 574 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 575 | + */ |
|
| 576 | + private $entity_type_settings_admin_page; |
|
| 577 | + |
|
| 578 | + /** |
|
| 579 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 580 | + * |
|
| 581 | + * @since 3.11.0 |
|
| 582 | + * @access protected |
|
| 583 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 584 | + */ |
|
| 585 | + protected $related_entities_cloud_widget; |
|
| 586 | + |
|
| 587 | + /** |
|
| 588 | + * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 589 | + * |
|
| 590 | + * @since 3.14.0 |
|
| 591 | + * @access protected |
|
| 592 | + * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 593 | + */ |
|
| 594 | + protected $author_element; |
|
| 595 | + |
|
| 596 | + /** |
|
| 597 | + * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 598 | + * |
|
| 599 | + * @since 3.12.0 |
|
| 600 | + * @access protected |
|
| 601 | + * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 602 | + */ |
|
| 603 | + protected $sample_data_service; |
|
| 604 | + |
|
| 605 | + /** |
|
| 606 | + * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 607 | + * |
|
| 608 | + * @since 3.12.0 |
|
| 609 | + * @access protected |
|
| 610 | + * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 611 | + */ |
|
| 612 | + protected $sample_data_ajax_adapter; |
|
| 613 | + |
|
| 614 | + /** |
|
| 615 | + * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 616 | + * |
|
| 617 | + * @since 3.14.3 |
|
| 618 | + * @access private |
|
| 619 | + * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 620 | + */ |
|
| 621 | + private $relation_rebuild_service; |
|
| 622 | + |
|
| 623 | + /** |
|
| 624 | + * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 625 | + * |
|
| 626 | + * @since 3.14.3 |
|
| 627 | + * @access private |
|
| 628 | + * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 629 | + */ |
|
| 630 | + private $relation_rebuild_adapter; |
|
| 631 | + |
|
| 632 | + /** |
|
| 633 | + * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 634 | + * |
|
| 635 | + * @since 3.18.0 |
|
| 636 | + * @access private |
|
| 637 | + * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 638 | + */ |
|
| 639 | + private $reference_rebuild_service; |
|
| 640 | + |
|
| 641 | + /** |
|
| 642 | + * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 643 | + * |
|
| 644 | + * @since 3.16.0 |
|
| 645 | + * @access protected |
|
| 646 | + * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 647 | + */ |
|
| 648 | + protected $google_analytics_export_service; |
|
| 649 | + |
|
| 650 | + /** |
|
| 651 | + * {@link Wordlift}'s singleton instance. |
|
| 652 | + * |
|
| 653 | + * @since 3.15.0 |
|
| 654 | + * @access protected |
|
| 655 | + * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 656 | + */ |
|
| 657 | + protected $entity_type_adapter; |
|
| 658 | + |
|
| 659 | + /** |
|
| 660 | + * The {@link Wordlift_Storage_Factory} instance. |
|
| 661 | + * |
|
| 662 | + * @since 3.15.0 |
|
| 663 | + * @access protected |
|
| 664 | + * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 665 | + */ |
|
| 666 | + protected $storage_factory; |
|
| 667 | + |
|
| 668 | + /** |
|
| 669 | + * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 670 | + * |
|
| 671 | + * @since 3.15.0 |
|
| 672 | + * @access protected |
|
| 673 | + * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 674 | + */ |
|
| 675 | + protected $rendition_factory; |
|
| 676 | + |
|
| 677 | + /** |
|
| 678 | + * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 679 | + * |
|
| 680 | + * @since 3.15.0 |
|
| 681 | + * @access private |
|
| 682 | + * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 683 | + */ |
|
| 684 | + private $autocomplete_adapter; |
|
| 685 | + |
|
| 686 | + /** |
|
| 687 | + * The {@link Wordlift_Relation_Service} instance. |
|
| 688 | + * |
|
| 689 | + * @since 3.15.0 |
|
| 690 | + * @access protected |
|
| 691 | + * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 692 | + */ |
|
| 693 | + protected $relation_service; |
|
| 694 | + |
|
| 695 | + /** |
|
| 696 | + * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 697 | + * |
|
| 698 | + * @since 3.16.0 |
|
| 699 | + * @access protected |
|
| 700 | + * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 701 | + * |
|
| 702 | + */ |
|
| 703 | + protected $cached_postid_to_jsonld_converter; |
|
| 704 | + |
|
| 705 | + /** |
|
| 706 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 707 | + * |
|
| 708 | + * @since 3.16.3 |
|
| 709 | + * @access protected |
|
| 710 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 711 | + */ |
|
| 712 | + protected $entity_uri_service; |
|
| 713 | + |
|
| 714 | + /** |
|
| 715 | + * The {@link Wordlift_Publisher_Service} instance. |
|
| 716 | + * |
|
| 717 | + * @since 3.19.0 |
|
| 718 | + * @access protected |
|
| 719 | + * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 720 | + */ |
|
| 721 | + protected $publisher_service; |
|
| 722 | + |
|
| 723 | + /** |
|
| 724 | + * The {@link Wordlift_Context_Cards_Service} instance. |
|
| 725 | + * |
|
| 726 | + * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
| 727 | + */ |
|
| 728 | + protected $context_cards_service; |
|
| 729 | + |
|
| 730 | + /** |
|
| 731 | + * {@link Wordlift}'s singleton instance. |
|
| 732 | + * |
|
| 733 | + * @since 3.11.2 |
|
| 734 | + * @access private |
|
| 735 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 736 | + */ |
|
| 737 | + private static $instance; |
|
| 738 | + |
|
| 739 | + //</editor-fold> |
|
| 740 | + |
|
| 741 | + /** |
|
| 742 | + * Define the core functionality of the plugin. |
|
| 743 | + * |
|
| 744 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 745 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 746 | + * the public-facing side of the site. |
|
| 747 | + * |
|
| 748 | + * @since 1.0.0 |
|
| 749 | + */ |
|
| 750 | + public function __construct() { |
|
| 751 | + |
|
| 752 | + self::$instance = $this; |
|
| 753 | + |
|
| 754 | + $this->plugin_name = 'wordlift'; |
|
| 755 | + $this->version = '3.27.8'; |
|
| 756 | + $this->load_dependencies(); |
|
| 757 | + $this->set_locale(); |
|
| 758 | + $this->define_admin_hooks(); |
|
| 759 | + $this->define_public_hooks(); |
|
| 760 | + |
|
| 761 | + // If we're in `WP_CLI` load the related files. |
|
| 762 | + if ( class_exists( 'WP_CLI' ) ) { |
|
| 763 | + $this->load_cli_dependencies(); |
|
| 764 | + } |
|
| 765 | + |
|
| 766 | + } |
|
| 767 | + |
|
| 768 | + /** |
|
| 769 | + * Get the singleton instance. |
|
| 770 | + * |
|
| 771 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 772 | + * @since 3.11.2 |
|
| 773 | + * |
|
| 774 | + */ |
|
| 775 | + public static function get_instance() { |
|
| 776 | + |
|
| 777 | + return self::$instance; |
|
| 778 | + } |
|
| 779 | + |
|
| 780 | + /** |
|
| 781 | + * Load the required dependencies for this plugin. |
|
| 782 | + * |
|
| 783 | + * Include the following files that make up the plugin: |
|
| 784 | + * |
|
| 785 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 786 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 787 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 788 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 789 | + * |
|
| 790 | + * Create an instance of the loader which will be used to register the hooks |
|
| 791 | + * with WordPress. |
|
| 792 | + * |
|
| 793 | + * @throws Exception |
|
| 794 | + * @since 1.0.0 |
|
| 795 | + * @access private |
|
| 796 | + */ |
|
| 797 | + private function load_dependencies() { |
|
| 798 | + |
|
| 799 | + /** |
|
| 800 | + * The class responsible for orchestrating the actions and filters of the |
|
| 801 | + * core plugin. |
|
| 802 | + */ |
|
| 803 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 804 | + |
|
| 805 | + // The class responsible for plugin uninstall. |
|
| 806 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 807 | + |
|
| 808 | + /** |
|
| 809 | + * The class responsible for defining internationalization functionality |
|
| 810 | + * of the plugin. |
|
| 811 | + */ |
|
| 812 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 813 | + |
|
| 814 | + /** |
|
| 815 | + * WordLift's supported languages. |
|
| 816 | + */ |
|
| 817 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 818 | + |
|
| 819 | + /** |
|
| 820 | + * WordLift's supported countries. |
|
| 821 | + */ |
|
| 822 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 823 | + |
|
| 824 | + /** |
|
| 825 | + * Provide support functions to sanitize data. |
|
| 826 | + */ |
|
| 827 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 828 | + |
|
| 829 | + /** Services. */ |
|
| 830 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 831 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 832 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 833 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 834 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 835 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 836 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 837 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 838 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 839 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 840 | + |
|
| 841 | + /** |
|
| 842 | + * The Query builder. |
|
| 843 | + */ |
|
| 844 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 845 | + |
|
| 846 | + /** |
|
| 847 | + * The Schema service. |
|
| 848 | + */ |
|
| 849 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 850 | + |
|
| 851 | + /** |
|
| 852 | + * The schema:url property service. |
|
| 853 | + */ |
|
| 854 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 855 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 856 | + |
|
| 857 | + /** |
|
| 858 | + * The UI service. |
|
| 859 | + */ |
|
| 860 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 861 | + |
|
| 862 | + /** |
|
| 863 | + * The Thumbnail service. |
|
| 864 | + */ |
|
| 865 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 866 | + |
|
| 867 | + /** |
|
| 868 | + * The Entity Types Taxonomy service. |
|
| 869 | + */ |
|
| 870 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 871 | + |
|
| 872 | + /** |
|
| 873 | + * The Entity service. |
|
| 874 | + */ |
|
| 875 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 876 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 877 | + |
|
| 878 | + // Add the entity rating service. |
|
| 879 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 880 | + |
|
| 881 | + /** |
|
| 882 | + * The User service. |
|
| 883 | + */ |
|
| 884 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 885 | + |
|
| 886 | + /** |
|
| 887 | + * The Timeline service. |
|
| 888 | + */ |
|
| 889 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 890 | + |
|
| 891 | + /** |
|
| 892 | + * The Topic Taxonomy service. |
|
| 893 | + */ |
|
| 894 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 895 | + |
|
| 896 | + /** |
|
| 897 | + * The SPARQL service. |
|
| 898 | + */ |
|
| 899 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 900 | + |
|
| 901 | + /** |
|
| 902 | + * The WordLift import service. |
|
| 903 | + */ |
|
| 904 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 905 | + |
|
| 906 | + /** |
|
| 907 | + * The WordLift URI service. |
|
| 908 | + */ |
|
| 909 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 910 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 911 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 912 | + |
|
| 913 | + /** |
|
| 914 | + * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 915 | + */ |
|
| 916 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 917 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 918 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 919 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 920 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 921 | + |
|
| 922 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 923 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 924 | + |
|
| 925 | + /** |
|
| 926 | + * Load the converters. |
|
| 927 | + */ |
|
| 928 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 929 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 930 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 931 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 932 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 933 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 934 | + |
|
| 935 | + /** |
|
| 936 | + * Load cache-related files. |
|
| 937 | + */ |
|
| 938 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 939 | + |
|
| 940 | + /** |
|
| 941 | + * Load the content filter. |
|
| 942 | + */ |
|
| 943 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 944 | + |
|
| 945 | + /* |
|
| 946 | 946 | * Load the excerpt helper. |
| 947 | 947 | */ |
| 948 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 949 | - |
|
| 950 | - /** |
|
| 951 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 952 | - * |
|
| 953 | - * @since 3.8.0 |
|
| 954 | - */ |
|
| 955 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 956 | - |
|
| 957 | - // The Publisher Service and the AJAX adapter. |
|
| 958 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 959 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 960 | - |
|
| 961 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 962 | - |
|
| 963 | - /** |
|
| 964 | - * Load the WordLift key validation service. |
|
| 965 | - */ |
|
| 966 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 967 | - |
|
| 968 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 969 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 970 | - |
|
| 971 | - // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 972 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 973 | - |
|
| 974 | - /** Linked Data. */ |
|
| 975 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 976 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 977 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 978 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 979 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 980 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 981 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 982 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 983 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 984 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 986 | - |
|
| 987 | - /** Linked Data Rendition. */ |
|
| 988 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 989 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 990 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 991 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 992 | - |
|
| 993 | - /** Services. */ |
|
| 994 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 996 | - |
|
| 997 | - /** Adapters. */ |
|
| 998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 999 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 1000 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 1001 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 1002 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 1003 | - |
|
| 1004 | - /** Async Tasks. */ |
|
| 1005 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 1006 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1007 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1008 | - |
|
| 1009 | - /** Autocomplete. */ |
|
| 1010 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1011 | - |
|
| 1012 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1013 | - |
|
| 1014 | - /** Analytics */ |
|
| 1015 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1016 | - |
|
| 1017 | - /** |
|
| 1018 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 1019 | - */ |
|
| 1020 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1021 | - |
|
| 1022 | - /** |
|
| 1023 | - * The class to customize the entity list admin page. |
|
| 1024 | - */ |
|
| 1025 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1026 | - |
|
| 1027 | - /** |
|
| 1028 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1029 | - */ |
|
| 1030 | - global $wp_version; |
|
| 1031 | - if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 1032 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1033 | - } else { |
|
| 1034 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1035 | - } |
|
| 1036 | - |
|
| 1037 | - /** |
|
| 1038 | - * The Notice service. |
|
| 1039 | - */ |
|
| 1040 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1041 | - |
|
| 1042 | - /** |
|
| 1043 | - * The PrimaShop adapter. |
|
| 1044 | - */ |
|
| 1045 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1046 | - |
|
| 1047 | - /** |
|
| 1048 | - * The WordLift Dashboard service. |
|
| 1049 | - */ |
|
| 1050 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1051 | - |
|
| 1052 | - /** |
|
| 1053 | - * The admin 'Install wizard' page. |
|
| 1054 | - */ |
|
| 1055 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1056 | - |
|
| 1057 | - /** |
|
| 1058 | - * The WordLift entity type list admin page controller. |
|
| 1059 | - */ |
|
| 1060 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1061 | - |
|
| 1062 | - /** |
|
| 1063 | - * The WordLift entity type settings admin page controller. |
|
| 1064 | - */ |
|
| 1065 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1066 | - |
|
| 1067 | - /** |
|
| 1068 | - * The admin 'Download Your Data' page. |
|
| 1069 | - */ |
|
| 1070 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1071 | - |
|
| 1072 | - /** |
|
| 1073 | - * The admin 'WordLift Settings' page. |
|
| 1074 | - */ |
|
| 1075 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1077 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1078 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1079 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1080 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1081 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1082 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1083 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1084 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1085 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1086 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1087 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1088 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1089 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1090 | - |
|
| 1091 | - /** Admin Pages */ |
|
| 1092 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1093 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1094 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1095 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1096 | - |
|
| 1097 | - /** |
|
| 1098 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 1099 | - * side of the site. |
|
| 1100 | - */ |
|
| 1101 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1102 | - |
|
| 1103 | - /** |
|
| 1104 | - * The shortcode abstract class. |
|
| 1105 | - */ |
|
| 1106 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1107 | - |
|
| 1108 | - /** |
|
| 1109 | - * The Timeline shortcode. |
|
| 1110 | - */ |
|
| 1111 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1112 | - |
|
| 1113 | - /** |
|
| 1114 | - * The Navigator shortcode. |
|
| 1115 | - */ |
|
| 1116 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1117 | - |
|
| 1118 | - /** |
|
| 1119 | - * The Products Navigator shortcode. |
|
| 1120 | - */ |
|
| 1121 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 1122 | - |
|
| 1123 | - /** |
|
| 1124 | - * The chord shortcode. |
|
| 1125 | - */ |
|
| 1126 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1127 | - |
|
| 1128 | - /** |
|
| 1129 | - * The geomap shortcode. |
|
| 1130 | - */ |
|
| 1131 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1132 | - |
|
| 1133 | - /** |
|
| 1134 | - * The entity cloud shortcode. |
|
| 1135 | - */ |
|
| 1136 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1137 | - |
|
| 1138 | - /** |
|
| 1139 | - * The entity glossary shortcode. |
|
| 1140 | - */ |
|
| 1141 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1142 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1143 | - |
|
| 1144 | - /** |
|
| 1145 | - * Faceted Search shortcode. |
|
| 1146 | - */ |
|
| 1147 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1148 | - |
|
| 1149 | - /** |
|
| 1150 | - * The ShareThis service. |
|
| 1151 | - */ |
|
| 1152 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1153 | - |
|
| 1154 | - /** |
|
| 1155 | - * The SEO service. |
|
| 1156 | - */ |
|
| 1157 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1158 | - |
|
| 1159 | - /** |
|
| 1160 | - * The AMP service. |
|
| 1161 | - */ |
|
| 1162 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1163 | - |
|
| 1164 | - /** Widgets */ |
|
| 1165 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1166 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1167 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1168 | - |
|
| 1169 | - /* |
|
| 948 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 949 | + |
|
| 950 | + /** |
|
| 951 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 952 | + * |
|
| 953 | + * @since 3.8.0 |
|
| 954 | + */ |
|
| 955 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 956 | + |
|
| 957 | + // The Publisher Service and the AJAX adapter. |
|
| 958 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 959 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 960 | + |
|
| 961 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 962 | + |
|
| 963 | + /** |
|
| 964 | + * Load the WordLift key validation service. |
|
| 965 | + */ |
|
| 966 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 967 | + |
|
| 968 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 969 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 970 | + |
|
| 971 | + // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 972 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 973 | + |
|
| 974 | + /** Linked Data. */ |
|
| 975 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 976 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 977 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 978 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 979 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 980 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 981 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 982 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 983 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 984 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 985 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 986 | + |
|
| 987 | + /** Linked Data Rendition. */ |
|
| 988 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 989 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 990 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 991 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 992 | + |
|
| 993 | + /** Services. */ |
|
| 994 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 995 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 996 | + |
|
| 997 | + /** Adapters. */ |
|
| 998 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 999 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 1000 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 1001 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 1002 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 1003 | + |
|
| 1004 | + /** Async Tasks. */ |
|
| 1005 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 1006 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1007 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1008 | + |
|
| 1009 | + /** Autocomplete. */ |
|
| 1010 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1011 | + |
|
| 1012 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1013 | + |
|
| 1014 | + /** Analytics */ |
|
| 1015 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1016 | + |
|
| 1017 | + /** |
|
| 1018 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 1019 | + */ |
|
| 1020 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1021 | + |
|
| 1022 | + /** |
|
| 1023 | + * The class to customize the entity list admin page. |
|
| 1024 | + */ |
|
| 1025 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1026 | + |
|
| 1027 | + /** |
|
| 1028 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1029 | + */ |
|
| 1030 | + global $wp_version; |
|
| 1031 | + if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 1032 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1033 | + } else { |
|
| 1034 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1035 | + } |
|
| 1036 | + |
|
| 1037 | + /** |
|
| 1038 | + * The Notice service. |
|
| 1039 | + */ |
|
| 1040 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1041 | + |
|
| 1042 | + /** |
|
| 1043 | + * The PrimaShop adapter. |
|
| 1044 | + */ |
|
| 1045 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1046 | + |
|
| 1047 | + /** |
|
| 1048 | + * The WordLift Dashboard service. |
|
| 1049 | + */ |
|
| 1050 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1051 | + |
|
| 1052 | + /** |
|
| 1053 | + * The admin 'Install wizard' page. |
|
| 1054 | + */ |
|
| 1055 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1056 | + |
|
| 1057 | + /** |
|
| 1058 | + * The WordLift entity type list admin page controller. |
|
| 1059 | + */ |
|
| 1060 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1061 | + |
|
| 1062 | + /** |
|
| 1063 | + * The WordLift entity type settings admin page controller. |
|
| 1064 | + */ |
|
| 1065 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1066 | + |
|
| 1067 | + /** |
|
| 1068 | + * The admin 'Download Your Data' page. |
|
| 1069 | + */ |
|
| 1070 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1071 | + |
|
| 1072 | + /** |
|
| 1073 | + * The admin 'WordLift Settings' page. |
|
| 1074 | + */ |
|
| 1075 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1076 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1077 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1078 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1079 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1080 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1081 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1082 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1083 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1084 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1085 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1086 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1087 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1088 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1089 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1090 | + |
|
| 1091 | + /** Admin Pages */ |
|
| 1092 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1093 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1094 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1095 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1096 | + |
|
| 1097 | + /** |
|
| 1098 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 1099 | + * side of the site. |
|
| 1100 | + */ |
|
| 1101 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1102 | + |
|
| 1103 | + /** |
|
| 1104 | + * The shortcode abstract class. |
|
| 1105 | + */ |
|
| 1106 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1107 | + |
|
| 1108 | + /** |
|
| 1109 | + * The Timeline shortcode. |
|
| 1110 | + */ |
|
| 1111 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1112 | + |
|
| 1113 | + /** |
|
| 1114 | + * The Navigator shortcode. |
|
| 1115 | + */ |
|
| 1116 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1117 | + |
|
| 1118 | + /** |
|
| 1119 | + * The Products Navigator shortcode. |
|
| 1120 | + */ |
|
| 1121 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 1122 | + |
|
| 1123 | + /** |
|
| 1124 | + * The chord shortcode. |
|
| 1125 | + */ |
|
| 1126 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1127 | + |
|
| 1128 | + /** |
|
| 1129 | + * The geomap shortcode. |
|
| 1130 | + */ |
|
| 1131 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1132 | + |
|
| 1133 | + /** |
|
| 1134 | + * The entity cloud shortcode. |
|
| 1135 | + */ |
|
| 1136 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1137 | + |
|
| 1138 | + /** |
|
| 1139 | + * The entity glossary shortcode. |
|
| 1140 | + */ |
|
| 1141 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1142 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1143 | + |
|
| 1144 | + /** |
|
| 1145 | + * Faceted Search shortcode. |
|
| 1146 | + */ |
|
| 1147 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1148 | + |
|
| 1149 | + /** |
|
| 1150 | + * The ShareThis service. |
|
| 1151 | + */ |
|
| 1152 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1153 | + |
|
| 1154 | + /** |
|
| 1155 | + * The SEO service. |
|
| 1156 | + */ |
|
| 1157 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1158 | + |
|
| 1159 | + /** |
|
| 1160 | + * The AMP service. |
|
| 1161 | + */ |
|
| 1162 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1163 | + |
|
| 1164 | + /** Widgets */ |
|
| 1165 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1166 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1167 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1168 | + |
|
| 1169 | + /* |
|
| 1170 | 1170 | * Schema.org Services. |
| 1171 | 1171 | * |
| 1172 | 1172 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1173 | 1173 | */ |
| 1174 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1175 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1176 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1177 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1178 | - new Wordlift_Schemaorg_Sync_Service(); |
|
| 1179 | - $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1180 | - new Wordlift_Schemaorg_Class_Service(); |
|
| 1181 | - } else { |
|
| 1182 | - $schemaorg_property_service = null; |
|
| 1183 | - } |
|
| 1174 | + if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1175 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1176 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1177 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1178 | + new Wordlift_Schemaorg_Sync_Service(); |
|
| 1179 | + $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1180 | + new Wordlift_Schemaorg_Class_Service(); |
|
| 1181 | + } else { |
|
| 1182 | + $schemaorg_property_service = null; |
|
| 1183 | + } |
|
| 1184 | 1184 | |
| 1185 | - $this->loader = new Wordlift_Loader(); |
|
| 1185 | + $this->loader = new Wordlift_Loader(); |
|
| 1186 | 1186 | |
| 1187 | - // Instantiate a global logger. |
|
| 1188 | - global $wl_logger; |
|
| 1189 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1187 | + // Instantiate a global logger. |
|
| 1188 | + global $wl_logger; |
|
| 1189 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1190 | 1190 | |
| 1191 | - // Load the `wl-api` end-point. |
|
| 1192 | - new Wordlift_Http_Api(); |
|
| 1191 | + // Load the `wl-api` end-point. |
|
| 1192 | + new Wordlift_Http_Api(); |
|
| 1193 | 1193 | |
| 1194 | - // Load the Install Service. |
|
| 1195 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1196 | - $this->install_service = new Wordlift_Install_Service(); |
|
| 1194 | + // Load the Install Service. |
|
| 1195 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1196 | + $this->install_service = new Wordlift_Install_Service(); |
|
| 1197 | 1197 | |
| 1198 | - /** Services. */ |
|
| 1199 | - // Create the configuration service. |
|
| 1200 | - $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1201 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1198 | + /** Services. */ |
|
| 1199 | + // Create the configuration service. |
|
| 1200 | + $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1201 | + $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1202 | 1202 | |
| 1203 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1204 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1203 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1204 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1205 | 1205 | |
| 1206 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1207 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1206 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1207 | + $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1208 | 1208 | |
| 1209 | - // Create an instance of the UI service. |
|
| 1210 | - $this->ui_service = new Wordlift_UI_Service(); |
|
| 1209 | + // Create an instance of the UI service. |
|
| 1210 | + $this->ui_service = new Wordlift_UI_Service(); |
|
| 1211 | 1211 | |
| 1212 | - // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1213 | - $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1212 | + // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1213 | + $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1214 | 1214 | |
| 1215 | - $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1216 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1217 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1218 | - $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1215 | + $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1216 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1217 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1218 | + $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1219 | 1219 | |
| 1220 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1221 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1222 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1223 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1220 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1221 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1222 | + $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1223 | + $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1224 | 1224 | |
| 1225 | - // Instantiate the JSON-LD service. |
|
| 1226 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1225 | + // Instantiate the JSON-LD service. |
|
| 1226 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1227 | 1227 | |
| 1228 | - /** Linked Data. */ |
|
| 1229 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1230 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1228 | + /** Linked Data. */ |
|
| 1229 | + $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1230 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1231 | 1231 | |
| 1232 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1232 | + $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1233 | 1233 | |
| 1234 | - // Create a new instance of the Redirect service. |
|
| 1235 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1236 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1234 | + // Create a new instance of the Redirect service. |
|
| 1235 | + $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1236 | + $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1237 | 1237 | |
| 1238 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1239 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1238 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1239 | + $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1240 | 1240 | |
| 1241 | - $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1241 | + $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1242 | 1242 | |
| 1243 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1244 | - $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1243 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1244 | + $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1245 | 1245 | |
| 1246 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1247 | - $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1246 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1247 | + $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1248 | 1248 | |
| 1249 | - // Create an instance of the PrimaShop adapter. |
|
| 1250 | - $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1249 | + // Create an instance of the PrimaShop adapter. |
|
| 1250 | + $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1251 | 1251 | |
| 1252 | - // Create an import service instance to hook later to WP's import function. |
|
| 1253 | - $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() ); |
|
| 1252 | + // Create an import service instance to hook later to WP's import function. |
|
| 1253 | + $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() ); |
|
| 1254 | 1254 | |
| 1255 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1255 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1256 | 1256 | |
| 1257 | - // Create the entity rating service. |
|
| 1258 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1257 | + // Create the entity rating service. |
|
| 1258 | + $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1259 | 1259 | |
| 1260 | - // Create entity list customization (wp-admin/edit.php). |
|
| 1261 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1260 | + // Create entity list customization (wp-admin/edit.php). |
|
| 1261 | + $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1262 | 1262 | |
| 1263 | - // Create a new instance of the Redirect service. |
|
| 1264 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1263 | + // Create a new instance of the Redirect service. |
|
| 1264 | + $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1265 | 1265 | |
| 1266 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1267 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1268 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1269 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1266 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1267 | + $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1268 | + $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1269 | + $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1270 | 1270 | |
| 1271 | - $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1271 | + $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1272 | 1272 | |
| 1273 | - // Instantiate the JSON-LD service. |
|
| 1274 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1275 | - $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 ); |
|
| 1276 | - $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 ); |
|
| 1277 | - $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 ); |
|
| 1278 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1273 | + // Instantiate the JSON-LD service. |
|
| 1274 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1275 | + $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 ); |
|
| 1276 | + $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 ); |
|
| 1277 | + $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 ); |
|
| 1278 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1279 | 1279 | |
| 1280 | - $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1281 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache ); |
|
| 1282 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1280 | + $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1281 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache ); |
|
| 1282 | + $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1283 | 1283 | |
| 1284 | - /* |
|
| 1284 | + /* |
|
| 1285 | 1285 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
| 1286 | 1286 | * |
| 1287 | 1287 | * @see https://github.com/insideout10/wordlift-plugin/issues/892 |
| 1288 | 1288 | * |
| 1289 | 1289 | * @since 3.20.0 |
| 1290 | 1290 | */ |
| 1291 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1292 | - $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1293 | - $jsonld_service = new Jsonld_Service( |
|
| 1294 | - $this->jsonld_service, |
|
| 1295 | - $term_jsonld_adapter, |
|
| 1296 | - new Jsonld_User_Service( $this->user_service ) ); |
|
| 1297 | - new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service ); |
|
| 1298 | - |
|
| 1299 | - // Prints the JSON-LD in the head. |
|
| 1300 | - new Jsonld_Adapter( $this->jsonld_service ); |
|
| 1301 | - |
|
| 1302 | - new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service ); |
|
| 1303 | - |
|
| 1304 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1305 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1306 | - // Creating Faq Content filter service. |
|
| 1307 | - $this->faq_content_filter_service = new Faq_Content_Filter(); |
|
| 1308 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1309 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1310 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1311 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->entity_service ); |
|
| 1312 | - |
|
| 1313 | - $this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' ); |
|
| 1314 | - |
|
| 1315 | - /** |
|
| 1316 | - * Filter: wl_feature__enable__blocks. |
|
| 1317 | - * |
|
| 1318 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1319 | - * |
|
| 1320 | - * @return bool |
|
| 1321 | - * @since 3.27.6 |
|
| 1322 | - */ |
|
| 1323 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1324 | - // Initialize the short-codes. |
|
| 1325 | - new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
| 1326 | - new Wordlift_Chord_Shortcode(); |
|
| 1327 | - new Wordlift_Geomap_Shortcode(); |
|
| 1328 | - new Wordlift_Timeline_Shortcode(); |
|
| 1329 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1330 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1331 | - new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
| 1332 | - } |
|
| 1333 | - |
|
| 1334 | - new Wordlift_Products_Navigator_Shortcode(); |
|
| 1335 | - |
|
| 1336 | - |
|
| 1337 | - // Initialize the Context Cards Service |
|
| 1338 | - $this->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
| 1339 | - |
|
| 1340 | - // Initialize the SEO service. |
|
| 1341 | - new Wordlift_Seo_Service(); |
|
| 1342 | - |
|
| 1343 | - // Initialize the AMP service. |
|
| 1344 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1345 | - |
|
| 1346 | - /** Services. */ |
|
| 1347 | - $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1348 | - new Wordlift_Image_Service(); |
|
| 1349 | - |
|
| 1350 | - /** Adapters. */ |
|
| 1351 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1352 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1353 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1354 | - //$this->faq_tinymce_adapter = new Faq_Tinymce_Adapter(); |
|
| 1355 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1356 | - |
|
| 1357 | - /* |
|
| 1291 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1292 | + $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1293 | + $jsonld_service = new Jsonld_Service( |
|
| 1294 | + $this->jsonld_service, |
|
| 1295 | + $term_jsonld_adapter, |
|
| 1296 | + new Jsonld_User_Service( $this->user_service ) ); |
|
| 1297 | + new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service ); |
|
| 1298 | + |
|
| 1299 | + // Prints the JSON-LD in the head. |
|
| 1300 | + new Jsonld_Adapter( $this->jsonld_service ); |
|
| 1301 | + |
|
| 1302 | + new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service ); |
|
| 1303 | + |
|
| 1304 | + $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1305 | + $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1306 | + // Creating Faq Content filter service. |
|
| 1307 | + $this->faq_content_filter_service = new Faq_Content_Filter(); |
|
| 1308 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1309 | + $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1310 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1311 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->entity_service ); |
|
| 1312 | + |
|
| 1313 | + $this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' ); |
|
| 1314 | + |
|
| 1315 | + /** |
|
| 1316 | + * Filter: wl_feature__enable__blocks. |
|
| 1317 | + * |
|
| 1318 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1319 | + * |
|
| 1320 | + * @return bool |
|
| 1321 | + * @since 3.27.6 |
|
| 1322 | + */ |
|
| 1323 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1324 | + // Initialize the short-codes. |
|
| 1325 | + new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
| 1326 | + new Wordlift_Chord_Shortcode(); |
|
| 1327 | + new Wordlift_Geomap_Shortcode(); |
|
| 1328 | + new Wordlift_Timeline_Shortcode(); |
|
| 1329 | + new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1330 | + new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1331 | + new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
| 1332 | + } |
|
| 1333 | + |
|
| 1334 | + new Wordlift_Products_Navigator_Shortcode(); |
|
| 1335 | + |
|
| 1336 | + |
|
| 1337 | + // Initialize the Context Cards Service |
|
| 1338 | + $this->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
| 1339 | + |
|
| 1340 | + // Initialize the SEO service. |
|
| 1341 | + new Wordlift_Seo_Service(); |
|
| 1342 | + |
|
| 1343 | + // Initialize the AMP service. |
|
| 1344 | + new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1345 | + |
|
| 1346 | + /** Services. */ |
|
| 1347 | + $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1348 | + new Wordlift_Image_Service(); |
|
| 1349 | + |
|
| 1350 | + /** Adapters. */ |
|
| 1351 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1352 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1353 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1354 | + //$this->faq_tinymce_adapter = new Faq_Tinymce_Adapter(); |
|
| 1355 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1356 | + |
|
| 1357 | + /* |
|
| 1358 | 1358 | * Exclude our public js from WP-Rocket. |
| 1359 | 1359 | * |
| 1360 | 1360 | * @since 3.19.4 |
| 1361 | 1361 | * |
| 1362 | 1362 | * @see https://github.com/insideout10/wordlift-plugin/issues/842. |
| 1363 | 1363 | */ |
| 1364 | - new Wordlift_WpRocket_Adapter(); |
|
| 1365 | - |
|
| 1366 | - // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1367 | - $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1368 | - $this->sparql_service, |
|
| 1369 | - $uri_service |
|
| 1370 | - ); |
|
| 1371 | - |
|
| 1372 | - $that = $this; |
|
| 1373 | - add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1374 | - if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) { |
|
| 1375 | - new Wordlift_Linked_Data_Service( $that->entity_service, $that->entity_type_service, $that->schema_service, $that->sparql_service ); |
|
| 1376 | - new Wordlift_Sparql_Query_Async_Task(); |
|
| 1377 | - new Wordlift_Push_References_Async_Task(); |
|
| 1378 | - } |
|
| 1379 | - } ); |
|
| 1380 | - |
|
| 1381 | - /** WordPress Admin UI. */ |
|
| 1382 | - |
|
| 1383 | - // UI elements. |
|
| 1384 | - $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1385 | - $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1386 | - $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1387 | - $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1388 | - $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1389 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1390 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1391 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1392 | - |
|
| 1393 | - $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 ); |
|
| 1394 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1395 | - |
|
| 1396 | - $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1397 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1398 | - $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1399 | - |
|
| 1400 | - // Pages. |
|
| 1401 | - /* |
|
| 1364 | + new Wordlift_WpRocket_Adapter(); |
|
| 1365 | + |
|
| 1366 | + // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1367 | + $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1368 | + $this->sparql_service, |
|
| 1369 | + $uri_service |
|
| 1370 | + ); |
|
| 1371 | + |
|
| 1372 | + $that = $this; |
|
| 1373 | + add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1374 | + if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) { |
|
| 1375 | + new Wordlift_Linked_Data_Service( $that->entity_service, $that->entity_type_service, $that->schema_service, $that->sparql_service ); |
|
| 1376 | + new Wordlift_Sparql_Query_Async_Task(); |
|
| 1377 | + new Wordlift_Push_References_Async_Task(); |
|
| 1378 | + } |
|
| 1379 | + } ); |
|
| 1380 | + |
|
| 1381 | + /** WordPress Admin UI. */ |
|
| 1382 | + |
|
| 1383 | + // UI elements. |
|
| 1384 | + $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1385 | + $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1386 | + $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1387 | + $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1388 | + $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1389 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1390 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1391 | + $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1392 | + |
|
| 1393 | + $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 ); |
|
| 1394 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1395 | + |
|
| 1396 | + $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1397 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1398 | + $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1399 | + |
|
| 1400 | + // Pages. |
|
| 1401 | + /* |
|
| 1402 | 1402 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
| 1403 | 1403 | * |
| 1404 | 1404 | * @since 3.20.3 |
| 1405 | 1405 | * |
| 1406 | 1406 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1407 | 1407 | */ |
| 1408 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1409 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1410 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1411 | - } |
|
| 1412 | - new Wordlift_Entity_Type_Admin_Service(); |
|
| 1408 | + if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1409 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1410 | + new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1411 | + } |
|
| 1412 | + new Wordlift_Entity_Type_Admin_Service(); |
|
| 1413 | 1413 | |
| 1414 | - // create an instance of the entity type list admin page controller. |
|
| 1415 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1414 | + // create an instance of the entity type list admin page controller. |
|
| 1415 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1416 | 1416 | |
| 1417 | - // create an instance of the entity type setting admin page controller. |
|
| 1418 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1417 | + // create an instance of the entity type setting admin page controller. |
|
| 1418 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1419 | 1419 | |
| 1420 | - /** Widgets */ |
|
| 1421 | - $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1420 | + /** Widgets */ |
|
| 1421 | + $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1422 | 1422 | |
| 1423 | - /* WordPress Admin. */ |
|
| 1424 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1425 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1423 | + /* WordPress Admin. */ |
|
| 1424 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1425 | + $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1426 | 1426 | |
| 1427 | - // Create an instance of the install wizard. |
|
| 1428 | - $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 ); |
|
| 1427 | + // Create an instance of the install wizard. |
|
| 1428 | + $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 ); |
|
| 1429 | 1429 | |
| 1430 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1430 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1431 | 1431 | |
| 1432 | - // User Profile. |
|
| 1433 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1432 | + // User Profile. |
|
| 1433 | + new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1434 | 1434 | |
| 1435 | - $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1435 | + $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1436 | 1436 | |
| 1437 | - // Load the debug service if WP is in debug mode. |
|
| 1438 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1439 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1440 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1441 | - } |
|
| 1437 | + // Load the debug service if WP is in debug mode. |
|
| 1438 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1439 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1440 | + new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1441 | + } |
|
| 1442 | 1442 | |
| 1443 | - // Remote Image Service. |
|
| 1444 | - new Wordlift_Remote_Image_Service(); |
|
| 1443 | + // Remote Image Service. |
|
| 1444 | + new Wordlift_Remote_Image_Service(); |
|
| 1445 | 1445 | |
| 1446 | - /* |
|
| 1446 | + /* |
|
| 1447 | 1447 | * Provides mappings between post types and entity types. |
| 1448 | 1448 | * |
| 1449 | 1449 | * @since 3.20.0 |
| 1450 | 1450 | * |
| 1451 | 1451 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1452 | 1452 | */ |
| 1453 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1454 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1455 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1453 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1454 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1455 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1456 | 1456 | |
| 1457 | - // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1458 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1457 | + // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1458 | + new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1459 | 1459 | |
| 1460 | - /* |
|
| 1460 | + /* |
|
| 1461 | 1461 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
| 1462 | 1462 | * |
| 1463 | 1463 | * Eventually Batch Actions will become Batch Operations. |
| 1464 | 1464 | * |
| 1465 | 1465 | * @since 3.20.0 |
| 1466 | 1466 | */ |
| 1467 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1468 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1467 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1468 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1469 | 1469 | |
| 1470 | - /* |
|
| 1470 | + /* |
|
| 1471 | 1471 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
| 1472 | 1472 | * |
| 1473 | 1473 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
| 1474 | 1474 | * |
| 1475 | 1475 | * @since 3.20.0 |
| 1476 | 1476 | */ |
| 1477 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1478 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1477 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1478 | + new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1479 | 1479 | |
| 1480 | - /* |
|
| 1480 | + /* |
|
| 1481 | 1481 | * Load the Mappings JSON-LD post processing. |
| 1482 | 1482 | * |
| 1483 | 1483 | * @since 3.25.0 |
| 1484 | 1484 | */ |
| 1485 | 1485 | |
| 1486 | - $mappings_dbo = new Mappings_DBO(); |
|
| 1487 | - $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
| 1488 | - new Post_Type_Rule_Validator(); |
|
| 1489 | - // Taxonomy term rule validator for validating rules for term pages. |
|
| 1490 | - new Taxonomy_Term_Rule_Validator(); |
|
| 1486 | + $mappings_dbo = new Mappings_DBO(); |
|
| 1487 | + $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
| 1488 | + new Post_Type_Rule_Validator(); |
|
| 1489 | + // Taxonomy term rule validator for validating rules for term pages. |
|
| 1490 | + new Taxonomy_Term_Rule_Validator(); |
|
| 1491 | 1491 | new Post_Taxonomy_Term_Rule_Validator(); |
| 1492 | - $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1493 | - $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1494 | - $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1495 | - |
|
| 1496 | - new Url_To_Entity_Transform_Function( $this->entity_uri_service ); |
|
| 1497 | - new Taxonomy_To_Terms_Transform_Function(); |
|
| 1498 | - new Post_Id_To_Entity_Transform_Function(); |
|
| 1499 | - $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
| 1500 | - |
|
| 1501 | - /** |
|
| 1502 | - * @since 3.27.1 |
|
| 1503 | - * Intiailize the acf group data formatter. |
|
| 1504 | - */ |
|
| 1505 | - new Acf_Group_Formatter(); |
|
| 1506 | - new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1507 | - |
|
| 1508 | - /** |
|
| 1509 | - * @since 3.26.0 |
|
| 1510 | - * Initialize the Faq JSON LD converter here - disabled. |
|
| 1511 | - */ |
|
| 1512 | - // new Faq_To_Jsonld_Converter(); |
|
| 1513 | - /* |
|
| 1492 | + $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1493 | + $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1494 | + $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1495 | + |
|
| 1496 | + new Url_To_Entity_Transform_Function( $this->entity_uri_service ); |
|
| 1497 | + new Taxonomy_To_Terms_Transform_Function(); |
|
| 1498 | + new Post_Id_To_Entity_Transform_Function(); |
|
| 1499 | + $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
| 1500 | + |
|
| 1501 | + /** |
|
| 1502 | + * @since 3.27.1 |
|
| 1503 | + * Intiailize the acf group data formatter. |
|
| 1504 | + */ |
|
| 1505 | + new Acf_Group_Formatter(); |
|
| 1506 | + new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1507 | + |
|
| 1508 | + /** |
|
| 1509 | + * @since 3.26.0 |
|
| 1510 | + * Initialize the Faq JSON LD converter here - disabled. |
|
| 1511 | + */ |
|
| 1512 | + // new Faq_To_Jsonld_Converter(); |
|
| 1513 | + /* |
|
| 1514 | 1514 | * Use the Templates Ajax Endpoint to load HTML templates for the legacy Angular app via admin-ajax.php |
| 1515 | 1515 | * end-point. |
| 1516 | 1516 | * |
| 1517 | 1517 | * @see https://github.com/insideout10/wordlift-plugin/issues/834 |
| 1518 | 1518 | * @since 3.24.4 |
| 1519 | 1519 | */ |
| 1520 | - new Templates_Ajax_Endpoint(); |
|
| 1521 | - // Call this static method to register FAQ routes to rest api - disabled |
|
| 1522 | - //Faq_Rest_Controller::register_routes(); |
|
| 1520 | + new Templates_Ajax_Endpoint(); |
|
| 1521 | + // Call this static method to register FAQ routes to rest api - disabled |
|
| 1522 | + //Faq_Rest_Controller::register_routes(); |
|
| 1523 | 1523 | |
| 1524 | - /* |
|
| 1524 | + /* |
|
| 1525 | 1525 | * Create a singleton for the Analysis_Response_Ops_Factory. |
| 1526 | 1526 | */ |
| 1527 | - $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service ); |
|
| 1528 | - new Analysis_Response_Ops_Factory( |
|
| 1529 | - $this->entity_uri_service, |
|
| 1530 | - $this->entity_service, |
|
| 1531 | - $this->entity_type_service, |
|
| 1532 | - $this->storage_factory->post_images(), |
|
| 1533 | - $entity_helper |
|
| 1534 | - ); |
|
| 1535 | - |
|
| 1536 | - /** WL Autocomplete. */ |
|
| 1537 | - $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1538 | - new Local_Autocomplete_Service(), |
|
| 1539 | - new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ), |
|
| 1540 | - ) ); |
|
| 1541 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1542 | - |
|
| 1543 | - /** |
|
| 1544 | - * @since 3.27.2 |
|
| 1545 | - * Integrate the recipe maker jsonld & set recipe |
|
| 1546 | - * as default entity type to the wprm_recipe CPT. |
|
| 1547 | - */ |
|
| 1548 | - new Recipe_Maker_Post_Type_Hook(); |
|
| 1549 | - $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
| 1550 | - new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1551 | - new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1552 | - new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1553 | - new Yoast_Jsonld( $recipe_maker_validation_service ); |
|
| 1554 | - |
|
| 1555 | - /** |
|
| 1556 | - * @since 3.27.4 |
|
| 1557 | - * Add the faq duplicate markup hook. |
|
| 1558 | - */ |
|
| 1559 | - new Faq_Duplicate_Markup_Remover(); |
|
| 1560 | - /** |
|
| 1561 | - * @since 3.27.8 |
|
| 1562 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
|
| 1563 | - */ |
|
| 1564 | - new Key_Validation_Notice( $this->key_validation_service, $this->configuration_service ); |
|
| 1565 | - } |
|
| 1566 | - |
|
| 1567 | - /** |
|
| 1568 | - * Define the locale for this plugin for internationalization. |
|
| 1569 | - * |
|
| 1570 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1571 | - * with WordPress. |
|
| 1572 | - * |
|
| 1573 | - * @since 1.0.0 |
|
| 1574 | - * @access private |
|
| 1575 | - */ |
|
| 1576 | - private function set_locale() { |
|
| 1577 | - |
|
| 1578 | - $plugin_i18n = new Wordlift_i18n(); |
|
| 1579 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1580 | - |
|
| 1581 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1582 | - |
|
| 1583 | - } |
|
| 1584 | - |
|
| 1585 | - /** |
|
| 1586 | - * Register all of the hooks related to the admin area functionality |
|
| 1587 | - * of the plugin. |
|
| 1588 | - * |
|
| 1589 | - * @since 1.0.0 |
|
| 1590 | - * @access private |
|
| 1591 | - */ |
|
| 1592 | - private function define_admin_hooks() { |
|
| 1593 | - |
|
| 1594 | - $plugin_admin = new Wordlift_Admin( |
|
| 1595 | - $this->get_plugin_name(), |
|
| 1596 | - $this->get_version(), |
|
| 1597 | - $this->configuration_service, |
|
| 1598 | - $this->notice_service, |
|
| 1599 | - $this->user_service |
|
| 1600 | - ); |
|
| 1601 | - |
|
| 1602 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1603 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1604 | - |
|
| 1605 | - // Hook the init action to taxonomy services. |
|
| 1606 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1607 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1608 | - |
|
| 1609 | - // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1610 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1611 | - |
|
| 1612 | - // Hook the added_post_meta action to the Thumbnail service. |
|
| 1613 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1614 | - |
|
| 1615 | - // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1616 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1617 | - |
|
| 1618 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1619 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1620 | - |
|
| 1621 | - // Register custom allowed redirect hosts. |
|
| 1622 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1623 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1624 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1625 | - |
|
| 1626 | - /* |
|
| 1527 | + $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service ); |
|
| 1528 | + new Analysis_Response_Ops_Factory( |
|
| 1529 | + $this->entity_uri_service, |
|
| 1530 | + $this->entity_service, |
|
| 1531 | + $this->entity_type_service, |
|
| 1532 | + $this->storage_factory->post_images(), |
|
| 1533 | + $entity_helper |
|
| 1534 | + ); |
|
| 1535 | + |
|
| 1536 | + /** WL Autocomplete. */ |
|
| 1537 | + $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1538 | + new Local_Autocomplete_Service(), |
|
| 1539 | + new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ), |
|
| 1540 | + ) ); |
|
| 1541 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1542 | + |
|
| 1543 | + /** |
|
| 1544 | + * @since 3.27.2 |
|
| 1545 | + * Integrate the recipe maker jsonld & set recipe |
|
| 1546 | + * as default entity type to the wprm_recipe CPT. |
|
| 1547 | + */ |
|
| 1548 | + new Recipe_Maker_Post_Type_Hook(); |
|
| 1549 | + $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
| 1550 | + new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1551 | + new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1552 | + new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1553 | + new Yoast_Jsonld( $recipe_maker_validation_service ); |
|
| 1554 | + |
|
| 1555 | + /** |
|
| 1556 | + * @since 3.27.4 |
|
| 1557 | + * Add the faq duplicate markup hook. |
|
| 1558 | + */ |
|
| 1559 | + new Faq_Duplicate_Markup_Remover(); |
|
| 1560 | + /** |
|
| 1561 | + * @since 3.27.8 |
|
| 1562 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
|
| 1563 | + */ |
|
| 1564 | + new Key_Validation_Notice( $this->key_validation_service, $this->configuration_service ); |
|
| 1565 | + } |
|
| 1566 | + |
|
| 1567 | + /** |
|
| 1568 | + * Define the locale for this plugin for internationalization. |
|
| 1569 | + * |
|
| 1570 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1571 | + * with WordPress. |
|
| 1572 | + * |
|
| 1573 | + * @since 1.0.0 |
|
| 1574 | + * @access private |
|
| 1575 | + */ |
|
| 1576 | + private function set_locale() { |
|
| 1577 | + |
|
| 1578 | + $plugin_i18n = new Wordlift_i18n(); |
|
| 1579 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1580 | + |
|
| 1581 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1582 | + |
|
| 1583 | + } |
|
| 1584 | + |
|
| 1585 | + /** |
|
| 1586 | + * Register all of the hooks related to the admin area functionality |
|
| 1587 | + * of the plugin. |
|
| 1588 | + * |
|
| 1589 | + * @since 1.0.0 |
|
| 1590 | + * @access private |
|
| 1591 | + */ |
|
| 1592 | + private function define_admin_hooks() { |
|
| 1593 | + |
|
| 1594 | + $plugin_admin = new Wordlift_Admin( |
|
| 1595 | + $this->get_plugin_name(), |
|
| 1596 | + $this->get_version(), |
|
| 1597 | + $this->configuration_service, |
|
| 1598 | + $this->notice_service, |
|
| 1599 | + $this->user_service |
|
| 1600 | + ); |
|
| 1601 | + |
|
| 1602 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1603 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1604 | + |
|
| 1605 | + // Hook the init action to taxonomy services. |
|
| 1606 | + $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1607 | + $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1608 | + |
|
| 1609 | + // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1610 | + $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1611 | + |
|
| 1612 | + // Hook the added_post_meta action to the Thumbnail service. |
|
| 1613 | + $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1614 | + |
|
| 1615 | + // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1616 | + $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1617 | + |
|
| 1618 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1619 | + $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1620 | + |
|
| 1621 | + // Register custom allowed redirect hosts. |
|
| 1622 | + $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1623 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1624 | + $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1625 | + |
|
| 1626 | + /* |
|
| 1627 | 1627 | * The old dashboard is replaced with dashboard v2. |
| 1628 | 1628 | * |
| 1629 | 1629 | * The old dashboard service is still loaded because its functions are used. |
@@ -1632,389 +1632,389 @@ discard block |
||
| 1632 | 1632 | * |
| 1633 | 1633 | * @since 3.20.0 |
| 1634 | 1634 | */ |
| 1635 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1636 | - // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1637 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1638 | - // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1639 | - |
|
| 1640 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1641 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1642 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1643 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1644 | - |
|
| 1645 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1646 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1647 | - |
|
| 1648 | - // Entity listing customization (wp-admin/edit.php) |
|
| 1649 | - // Add custom columns. |
|
| 1650 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1651 | - // no explicit entity as it prevents handling of other post types. |
|
| 1652 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1653 | - // Add 4W selection. |
|
| 1654 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1655 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1656 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1657 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1658 | - |
|
| 1659 | - /* |
|
| 1635 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1636 | + // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1637 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1638 | + // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1639 | + |
|
| 1640 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1641 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1642 | + $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1643 | + $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1644 | + |
|
| 1645 | + $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1646 | + $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1647 | + |
|
| 1648 | + // Entity listing customization (wp-admin/edit.php) |
|
| 1649 | + // Add custom columns. |
|
| 1650 | + $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1651 | + // no explicit entity as it prevents handling of other post types. |
|
| 1652 | + $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1653 | + // Add 4W selection. |
|
| 1654 | + $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1655 | + $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1656 | + $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1657 | + $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1658 | + |
|
| 1659 | + /* |
|
| 1660 | 1660 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1661 | 1661 | * |
| 1662 | 1662 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1663 | 1663 | */ |
| 1664 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1665 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1666 | - } |
|
| 1667 | - |
|
| 1668 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1669 | - // entities. |
|
| 1670 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1671 | - |
|
| 1672 | - // Filter imported post meta. |
|
| 1673 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1674 | - |
|
| 1675 | - // Notify the import service when an import starts and ends. |
|
| 1676 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1677 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1678 | - |
|
| 1679 | - // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1680 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1681 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1682 | - |
|
| 1683 | - /** |
|
| 1684 | - * Filter: wl_feature__enable__screens. |
|
| 1685 | - * |
|
| 1686 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1687 | - * |
|
| 1688 | - * @return bool |
|
| 1689 | - * @since 3.27.6 |
|
| 1690 | - */ |
|
| 1691 | - if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1692 | - // Hook the menu to the Download Your Data page. |
|
| 1693 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1694 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1695 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1696 | - } |
|
| 1697 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1698 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1699 | - |
|
| 1700 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1701 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1702 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1703 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1704 | - |
|
| 1705 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1706 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1707 | - |
|
| 1708 | - // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1709 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1710 | - |
|
| 1711 | - // Hook the `admin_init` function to the Admin Setup. |
|
| 1712 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1713 | - |
|
| 1714 | - // Hook the admin_init to the settings page. |
|
| 1715 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1716 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1717 | - |
|
| 1718 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1719 | - |
|
| 1720 | - // Hook the menu creation on the general wordlift menu creation. |
|
| 1721 | - /** |
|
| 1722 | - * Filter: wl_feature__enable__screens. |
|
| 1723 | - * |
|
| 1724 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1725 | - * |
|
| 1726 | - * @return bool |
|
| 1727 | - * @since 3.27.6 |
|
| 1728 | - */ |
|
| 1729 | - if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1730 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1731 | - } |
|
| 1732 | - /* |
|
| 1664 | + if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1665 | + $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1666 | + } |
|
| 1667 | + |
|
| 1668 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1669 | + // entities. |
|
| 1670 | + $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1671 | + |
|
| 1672 | + // Filter imported post meta. |
|
| 1673 | + $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1674 | + |
|
| 1675 | + // Notify the import service when an import starts and ends. |
|
| 1676 | + $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1677 | + $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1678 | + |
|
| 1679 | + // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1680 | + $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1681 | + $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1682 | + |
|
| 1683 | + /** |
|
| 1684 | + * Filter: wl_feature__enable__screens. |
|
| 1685 | + * |
|
| 1686 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1687 | + * |
|
| 1688 | + * @return bool |
|
| 1689 | + * @since 3.27.6 |
|
| 1690 | + */ |
|
| 1691 | + if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1692 | + // Hook the menu to the Download Your Data page. |
|
| 1693 | + $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1694 | + $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1695 | + $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1696 | + } |
|
| 1697 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1698 | + $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1699 | + |
|
| 1700 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1701 | + $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1702 | + $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1703 | + $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1704 | + |
|
| 1705 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1706 | + $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1707 | + |
|
| 1708 | + // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1709 | + $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1710 | + |
|
| 1711 | + // Hook the `admin_init` function to the Admin Setup. |
|
| 1712 | + $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1713 | + |
|
| 1714 | + // Hook the admin_init to the settings page. |
|
| 1715 | + $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1716 | + $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1717 | + |
|
| 1718 | + $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1719 | + |
|
| 1720 | + // Hook the menu creation on the general wordlift menu creation. |
|
| 1721 | + /** |
|
| 1722 | + * Filter: wl_feature__enable__screens. |
|
| 1723 | + * |
|
| 1724 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1725 | + * |
|
| 1726 | + * @return bool |
|
| 1727 | + * @since 3.27.6 |
|
| 1728 | + */ |
|
| 1729 | + if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1730 | + $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1731 | + } |
|
| 1732 | + /* |
|
| 1733 | 1733 | * Display the `Wordlift_Admin_Search_Rankings_Page` page. |
| 1734 | 1734 | * |
| 1735 | 1735 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
| 1736 | 1736 | * |
| 1737 | 1737 | * @since 3.20.0 |
| 1738 | 1738 | */ |
| 1739 | - if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1740 | - /** |
|
| 1741 | - * Filter: wl_feature__enable__screens. |
|
| 1742 | - * |
|
| 1743 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1744 | - * |
|
| 1745 | - * @return bool |
|
| 1746 | - * @since 3.27.6 |
|
| 1747 | - */ |
|
| 1748 | - if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1749 | - $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
|
| 1750 | - $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1751 | - } |
|
| 1752 | - } |
|
| 1753 | - |
|
| 1754 | - // Hook key update. |
|
| 1755 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1756 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1757 | - |
|
| 1758 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1759 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1760 | - |
|
| 1761 | - /* |
|
| 1739 | + if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1740 | + /** |
|
| 1741 | + * Filter: wl_feature__enable__screens. |
|
| 1742 | + * |
|
| 1743 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1744 | + * |
|
| 1745 | + * @return bool |
|
| 1746 | + * @since 3.27.6 |
|
| 1747 | + */ |
|
| 1748 | + if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1749 | + $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
|
| 1750 | + $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1751 | + } |
|
| 1752 | + } |
|
| 1753 | + |
|
| 1754 | + // Hook key update. |
|
| 1755 | + $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1756 | + $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1757 | + |
|
| 1758 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1759 | + $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1760 | + |
|
| 1761 | + /* |
|
| 1762 | 1762 | * Remove the Analytics Settings link from the plugin page. |
| 1763 | 1763 | * |
| 1764 | 1764 | * @see https://github.com/insideout10/wordlift-plugin/issues/932 |
| 1765 | 1765 | * @since 3.21.1 |
| 1766 | 1766 | */ |
| 1767 | - // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1768 | - |
|
| 1769 | - // Hook the AJAX `wl_publisher` action name. |
|
| 1770 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1771 | - |
|
| 1772 | - // Hook row actions for the entity type list admin. |
|
| 1773 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1774 | - |
|
| 1775 | - /** Ajax actions. */ |
|
| 1776 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1777 | - |
|
| 1778 | - // Hook capabilities manipulation to allow access to entity type admin |
|
| 1779 | - // page on WordPress versions before 4.7. |
|
| 1780 | - global $wp_version; |
|
| 1781 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1782 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1783 | - } |
|
| 1784 | - |
|
| 1785 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1786 | - |
|
| 1787 | - /** Adapters. */ |
|
| 1788 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1789 | - /** |
|
| 1790 | - * Disabling Faq temporarily. |
|
| 1791 | - * Load the tinymce editor button on the tool bar. |
|
| 1792 | - * @since 3.26.0 |
|
| 1793 | - */ |
|
| 1794 | - //$this->loader->add_filter( 'tiny_mce_before_init', $this->faq_tinymce_adapter, 'register_custom_tags' ); |
|
| 1795 | - //$this->loader->add_filter( 'mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
| 1796 | - //$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
| 1797 | - |
|
| 1798 | - |
|
| 1799 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1800 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1801 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1802 | - /** |
|
| 1803 | - * @since 3.26.0 |
|
| 1804 | - */ |
|
| 1805 | - if ( apply_filters( 'wl_feature__enable__post_excerpt', true ) ) { |
|
| 1806 | - $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
| 1807 | - $this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1808 | - // Adding Rest route for the post excerpt |
|
| 1809 | - Post_Excerpt_Rest_Controller::register_routes(); |
|
| 1810 | - } |
|
| 1811 | - |
|
| 1812 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1813 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1814 | - |
|
| 1815 | - // Handle the autocomplete request. |
|
| 1816 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1817 | - $this->autocomplete_adapter, |
|
| 1818 | - 'wl_autocomplete', |
|
| 1819 | - ) ); |
|
| 1820 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1821 | - $this->autocomplete_adapter, |
|
| 1822 | - 'wl_autocomplete', |
|
| 1823 | - ) ); |
|
| 1824 | - |
|
| 1825 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1826 | - if ( is_multisite() ) { |
|
| 1827 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1828 | - } |
|
| 1829 | - |
|
| 1830 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1831 | - |
|
| 1832 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1833 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1834 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1835 | - |
|
| 1836 | - /** |
|
| 1837 | - * Always allow the `wordlift/classification` block. |
|
| 1838 | - * |
|
| 1839 | - * @since 3.23.0 |
|
| 1840 | - */ |
|
| 1841 | - add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1842 | - |
|
| 1843 | - if ( true === $value ) { |
|
| 1844 | - return $value; |
|
| 1845 | - } |
|
| 1846 | - |
|
| 1847 | - return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1848 | - }, PHP_INT_MAX ); |
|
| 1849 | - |
|
| 1850 | - /** |
|
| 1851 | - * @since 3.27.7 |
|
| 1852 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
| 1853 | - */ |
|
| 1854 | - new Top_Entities(); |
|
| 1855 | - } |
|
| 1856 | - |
|
| 1857 | - /** |
|
| 1858 | - * Register all of the hooks related to the public-facing functionality |
|
| 1859 | - * of the plugin. |
|
| 1860 | - * |
|
| 1861 | - * @since 1.0.0 |
|
| 1862 | - * @access private |
|
| 1863 | - */ |
|
| 1864 | - private function define_public_hooks() { |
|
| 1865 | - |
|
| 1866 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1867 | - |
|
| 1868 | - // Register the entity post type. |
|
| 1869 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1870 | - |
|
| 1871 | - // Bind the link generation and handling hooks to the entity link service. |
|
| 1872 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1873 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1874 | - // $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 ); |
|
| 1875 | - // $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 ); |
|
| 1876 | - |
|
| 1877 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1878 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1879 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1880 | - |
|
| 1881 | - // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
| 1882 | - $this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1883 | - // Hook the content filter service to add entity links. |
|
| 1884 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1885 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1886 | - } |
|
| 1887 | - |
|
| 1888 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1889 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1890 | - |
|
| 1891 | - // Hook the ShareThis service. |
|
| 1892 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1893 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1894 | - |
|
| 1895 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1896 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1897 | - |
|
| 1898 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1899 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1900 | - // to categories. |
|
| 1901 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1902 | - |
|
| 1903 | - /* |
|
| 1767 | + // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1768 | + |
|
| 1769 | + // Hook the AJAX `wl_publisher` action name. |
|
| 1770 | + $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1771 | + |
|
| 1772 | + // Hook row actions for the entity type list admin. |
|
| 1773 | + $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1774 | + |
|
| 1775 | + /** Ajax actions. */ |
|
| 1776 | + $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1777 | + |
|
| 1778 | + // Hook capabilities manipulation to allow access to entity type admin |
|
| 1779 | + // page on WordPress versions before 4.7. |
|
| 1780 | + global $wp_version; |
|
| 1781 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1782 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1783 | + } |
|
| 1784 | + |
|
| 1785 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1786 | + |
|
| 1787 | + /** Adapters. */ |
|
| 1788 | + $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1789 | + /** |
|
| 1790 | + * Disabling Faq temporarily. |
|
| 1791 | + * Load the tinymce editor button on the tool bar. |
|
| 1792 | + * @since 3.26.0 |
|
| 1793 | + */ |
|
| 1794 | + //$this->loader->add_filter( 'tiny_mce_before_init', $this->faq_tinymce_adapter, 'register_custom_tags' ); |
|
| 1795 | + //$this->loader->add_filter( 'mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
| 1796 | + //$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
| 1797 | + |
|
| 1798 | + |
|
| 1799 | + $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1800 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1801 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1802 | + /** |
|
| 1803 | + * @since 3.26.0 |
|
| 1804 | + */ |
|
| 1805 | + if ( apply_filters( 'wl_feature__enable__post_excerpt', true ) ) { |
|
| 1806 | + $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
| 1807 | + $this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1808 | + // Adding Rest route for the post excerpt |
|
| 1809 | + Post_Excerpt_Rest_Controller::register_routes(); |
|
| 1810 | + } |
|
| 1811 | + |
|
| 1812 | + $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1813 | + $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1814 | + |
|
| 1815 | + // Handle the autocomplete request. |
|
| 1816 | + add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1817 | + $this->autocomplete_adapter, |
|
| 1818 | + 'wl_autocomplete', |
|
| 1819 | + ) ); |
|
| 1820 | + add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1821 | + $this->autocomplete_adapter, |
|
| 1822 | + 'wl_autocomplete', |
|
| 1823 | + ) ); |
|
| 1824 | + |
|
| 1825 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1826 | + if ( is_multisite() ) { |
|
| 1827 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1828 | + } |
|
| 1829 | + |
|
| 1830 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1831 | + |
|
| 1832 | + add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1833 | + add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1834 | + add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1835 | + |
|
| 1836 | + /** |
|
| 1837 | + * Always allow the `wordlift/classification` block. |
|
| 1838 | + * |
|
| 1839 | + * @since 3.23.0 |
|
| 1840 | + */ |
|
| 1841 | + add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1842 | + |
|
| 1843 | + if ( true === $value ) { |
|
| 1844 | + return $value; |
|
| 1845 | + } |
|
| 1846 | + |
|
| 1847 | + return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1848 | + }, PHP_INT_MAX ); |
|
| 1849 | + |
|
| 1850 | + /** |
|
| 1851 | + * @since 3.27.7 |
|
| 1852 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
| 1853 | + */ |
|
| 1854 | + new Top_Entities(); |
|
| 1855 | + } |
|
| 1856 | + |
|
| 1857 | + /** |
|
| 1858 | + * Register all of the hooks related to the public-facing functionality |
|
| 1859 | + * of the plugin. |
|
| 1860 | + * |
|
| 1861 | + * @since 1.0.0 |
|
| 1862 | + * @access private |
|
| 1863 | + */ |
|
| 1864 | + private function define_public_hooks() { |
|
| 1865 | + |
|
| 1866 | + $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1867 | + |
|
| 1868 | + // Register the entity post type. |
|
| 1869 | + $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1870 | + |
|
| 1871 | + // Bind the link generation and handling hooks to the entity link service. |
|
| 1872 | + $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1873 | + $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1874 | + // $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 ); |
|
| 1875 | + // $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 ); |
|
| 1876 | + |
|
| 1877 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1878 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1879 | + $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1880 | + |
|
| 1881 | + // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
| 1882 | + $this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1883 | + // Hook the content filter service to add entity links. |
|
| 1884 | + if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1885 | + $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1886 | + } |
|
| 1887 | + |
|
| 1888 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1889 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1890 | + |
|
| 1891 | + // Hook the ShareThis service. |
|
| 1892 | + $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1893 | + $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1894 | + |
|
| 1895 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1896 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1897 | + |
|
| 1898 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1899 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1900 | + // to categories. |
|
| 1901 | + $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1902 | + |
|
| 1903 | + /* |
|
| 1904 | 1904 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1905 | 1905 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1906 | 1906 | * order of start time. |
| 1907 | 1907 | */ |
| 1908 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1909 | - |
|
| 1910 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1911 | - |
|
| 1912 | - // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1913 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1914 | - |
|
| 1915 | - // Analytics Script Frontend. |
|
| 1916 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1917 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1918 | - } |
|
| 1919 | - |
|
| 1920 | - } |
|
| 1921 | - |
|
| 1922 | - /** |
|
| 1923 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 1924 | - * |
|
| 1925 | - * @since 1.0.0 |
|
| 1926 | - */ |
|
| 1927 | - public function run() { |
|
| 1928 | - $this->loader->run(); |
|
| 1929 | - } |
|
| 1930 | - |
|
| 1931 | - /** |
|
| 1932 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 1933 | - * WordPress and to define internationalization functionality. |
|
| 1934 | - * |
|
| 1935 | - * @return string The name of the plugin. |
|
| 1936 | - * @since 1.0.0 |
|
| 1937 | - */ |
|
| 1938 | - public function get_plugin_name() { |
|
| 1939 | - return $this->plugin_name; |
|
| 1940 | - } |
|
| 1941 | - |
|
| 1942 | - /** |
|
| 1943 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1944 | - * |
|
| 1945 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1946 | - * @since 1.0.0 |
|
| 1947 | - */ |
|
| 1948 | - public function get_loader() { |
|
| 1949 | - return $this->loader; |
|
| 1950 | - } |
|
| 1951 | - |
|
| 1952 | - /** |
|
| 1953 | - * Retrieve the version number of the plugin. |
|
| 1954 | - * |
|
| 1955 | - * @return string The version number of the plugin. |
|
| 1956 | - * @since 1.0.0 |
|
| 1957 | - */ |
|
| 1958 | - public function get_version() { |
|
| 1959 | - return $this->version; |
|
| 1960 | - } |
|
| 1961 | - |
|
| 1962 | - /** |
|
| 1963 | - * Load dependencies for WP-CLI. |
|
| 1964 | - * |
|
| 1965 | - * @throws Exception |
|
| 1966 | - * @since 3.18.0 |
|
| 1967 | - */ |
|
| 1968 | - private function load_cli_dependencies() { |
|
| 1969 | - |
|
| 1970 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1971 | - |
|
| 1972 | - $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 ); |
|
| 1973 | - |
|
| 1974 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1975 | - |
|
| 1976 | - } |
|
| 1977 | - |
|
| 1978 | - /** |
|
| 1979 | - * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 1980 | - * |
|
| 1981 | - * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 1982 | - * @since 3.20.0 |
|
| 1983 | - */ |
|
| 1984 | - public function get_dashboard_service() { |
|
| 1985 | - |
|
| 1986 | - return $this->dashboard_service; |
|
| 1987 | - } |
|
| 1988 | - |
|
| 1989 | - public function add_wl_enabled_blocks() { |
|
| 1990 | - /** |
|
| 1991 | - * Filter: wl_feature__enable__blocks. |
|
| 1992 | - * |
|
| 1993 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1994 | - * |
|
| 1995 | - * @return bool |
|
| 1996 | - * @since 3.27.6 |
|
| 1997 | - */ |
|
| 1998 | - |
|
| 1999 | - wp_register_script( 'wl_enabled_blocks', false ); |
|
| 2000 | - |
|
| 2001 | - $enabled_blocks = array( 'wordlift/products-navigator' ); |
|
| 2002 | - |
|
| 2003 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 2004 | - // To intimate JS |
|
| 2005 | - $enabled_blocks = array_merge( $enabled_blocks, array( |
|
| 2006 | - 'wordlift/navigator', |
|
| 2007 | - 'wordlift/chord', |
|
| 2008 | - 'wordlift/geomap', |
|
| 2009 | - 'wordlift/timeline', |
|
| 2010 | - 'wordlift/cloud', |
|
| 2011 | - 'wordlift/vocabulary', |
|
| 2012 | - 'wordlift/faceted-search' |
|
| 2013 | - ) ); |
|
| 2014 | - } |
|
| 2015 | - |
|
| 2016 | - wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 2017 | - wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 2018 | - } |
|
| 1908 | + $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1909 | + |
|
| 1910 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1911 | + |
|
| 1912 | + // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1913 | + $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1914 | + |
|
| 1915 | + // Analytics Script Frontend. |
|
| 1916 | + if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1917 | + $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1918 | + } |
|
| 1919 | + |
|
| 1920 | + } |
|
| 1921 | + |
|
| 1922 | + /** |
|
| 1923 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 1924 | + * |
|
| 1925 | + * @since 1.0.0 |
|
| 1926 | + */ |
|
| 1927 | + public function run() { |
|
| 1928 | + $this->loader->run(); |
|
| 1929 | + } |
|
| 1930 | + |
|
| 1931 | + /** |
|
| 1932 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 1933 | + * WordPress and to define internationalization functionality. |
|
| 1934 | + * |
|
| 1935 | + * @return string The name of the plugin. |
|
| 1936 | + * @since 1.0.0 |
|
| 1937 | + */ |
|
| 1938 | + public function get_plugin_name() { |
|
| 1939 | + return $this->plugin_name; |
|
| 1940 | + } |
|
| 1941 | + |
|
| 1942 | + /** |
|
| 1943 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1944 | + * |
|
| 1945 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1946 | + * @since 1.0.0 |
|
| 1947 | + */ |
|
| 1948 | + public function get_loader() { |
|
| 1949 | + return $this->loader; |
|
| 1950 | + } |
|
| 1951 | + |
|
| 1952 | + /** |
|
| 1953 | + * Retrieve the version number of the plugin. |
|
| 1954 | + * |
|
| 1955 | + * @return string The version number of the plugin. |
|
| 1956 | + * @since 1.0.0 |
|
| 1957 | + */ |
|
| 1958 | + public function get_version() { |
|
| 1959 | + return $this->version; |
|
| 1960 | + } |
|
| 1961 | + |
|
| 1962 | + /** |
|
| 1963 | + * Load dependencies for WP-CLI. |
|
| 1964 | + * |
|
| 1965 | + * @throws Exception |
|
| 1966 | + * @since 3.18.0 |
|
| 1967 | + */ |
|
| 1968 | + private function load_cli_dependencies() { |
|
| 1969 | + |
|
| 1970 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1971 | + |
|
| 1972 | + $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 ); |
|
| 1973 | + |
|
| 1974 | + WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1975 | + |
|
| 1976 | + } |
|
| 1977 | + |
|
| 1978 | + /** |
|
| 1979 | + * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 1980 | + * |
|
| 1981 | + * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 1982 | + * @since 3.20.0 |
|
| 1983 | + */ |
|
| 1984 | + public function get_dashboard_service() { |
|
| 1985 | + |
|
| 1986 | + return $this->dashboard_service; |
|
| 1987 | + } |
|
| 1988 | + |
|
| 1989 | + public function add_wl_enabled_blocks() { |
|
| 1990 | + /** |
|
| 1991 | + * Filter: wl_feature__enable__blocks. |
|
| 1992 | + * |
|
| 1993 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1994 | + * |
|
| 1995 | + * @return bool |
|
| 1996 | + * @since 3.27.6 |
|
| 1997 | + */ |
|
| 1998 | + |
|
| 1999 | + wp_register_script( 'wl_enabled_blocks', false ); |
|
| 2000 | + |
|
| 2001 | + $enabled_blocks = array( 'wordlift/products-navigator' ); |
|
| 2002 | + |
|
| 2003 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 2004 | + // To intimate JS |
|
| 2005 | + $enabled_blocks = array_merge( $enabled_blocks, array( |
|
| 2006 | + 'wordlift/navigator', |
|
| 2007 | + 'wordlift/chord', |
|
| 2008 | + 'wordlift/geomap', |
|
| 2009 | + 'wordlift/timeline', |
|
| 2010 | + 'wordlift/cloud', |
|
| 2011 | + 'wordlift/vocabulary', |
|
| 2012 | + 'wordlift/faceted-search' |
|
| 2013 | + ) ); |
|
| 2014 | + } |
|
| 2015 | + |
|
| 2016 | + wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 2017 | + wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 2018 | + } |
|
| 2019 | 2019 | |
| 2020 | 2020 | } |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | $this->define_public_hooks(); |
| 760 | 760 | |
| 761 | 761 | // If we're in `WP_CLI` load the related files. |
| 762 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 762 | + if (class_exists('WP_CLI')) { |
|
| 763 | 763 | $this->load_cli_dependencies(); |
| 764 | 764 | } |
| 765 | 765 | |
@@ -800,381 +800,381 @@ discard block |
||
| 800 | 800 | * The class responsible for orchestrating the actions and filters of the |
| 801 | 801 | * core plugin. |
| 802 | 802 | */ |
| 803 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 803 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php'; |
|
| 804 | 804 | |
| 805 | 805 | // The class responsible for plugin uninstall. |
| 806 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 806 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-deactivator-feedback.php'; |
|
| 807 | 807 | |
| 808 | 808 | /** |
| 809 | 809 | * The class responsible for defining internationalization functionality |
| 810 | 810 | * of the plugin. |
| 811 | 811 | */ |
| 812 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 812 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php'; |
|
| 813 | 813 | |
| 814 | 814 | /** |
| 815 | 815 | * WordLift's supported languages. |
| 816 | 816 | */ |
| 817 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 817 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php'; |
|
| 818 | 818 | |
| 819 | 819 | /** |
| 820 | 820 | * WordLift's supported countries. |
| 821 | 821 | */ |
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 822 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-countries.php'; |
|
| 823 | 823 | |
| 824 | 824 | /** |
| 825 | 825 | * Provide support functions to sanitize data. |
| 826 | 826 | */ |
| 827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 827 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php'; |
|
| 828 | 828 | |
| 829 | 829 | /** Services. */ |
| 830 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 831 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 832 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 833 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 834 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 835 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 836 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 837 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 838 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 839 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 830 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php'; |
|
| 831 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-http-api.php'; |
|
| 832 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php'; |
|
| 833 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php'; |
|
| 834 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php'; |
|
| 835 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php'; |
|
| 836 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php'; |
|
| 837 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-linked-data-service.php'; |
|
| 838 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-service.php'; |
|
| 839 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-image-service.php'; |
|
| 840 | 840 | |
| 841 | 841 | /** |
| 842 | 842 | * The Query builder. |
| 843 | 843 | */ |
| 844 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 844 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php'; |
|
| 845 | 845 | |
| 846 | 846 | /** |
| 847 | 847 | * The Schema service. |
| 848 | 848 | */ |
| 849 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 849 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php'; |
|
| 850 | 850 | |
| 851 | 851 | /** |
| 852 | 852 | * The schema:url property service. |
| 853 | 853 | */ |
| 854 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 855 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 854 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php'; |
|
| 855 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php'; |
|
| 856 | 856 | |
| 857 | 857 | /** |
| 858 | 858 | * The UI service. |
| 859 | 859 | */ |
| 860 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 860 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php'; |
|
| 861 | 861 | |
| 862 | 862 | /** |
| 863 | 863 | * The Thumbnail service. |
| 864 | 864 | */ |
| 865 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 865 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php'; |
|
| 866 | 866 | |
| 867 | 867 | /** |
| 868 | 868 | * The Entity Types Taxonomy service. |
| 869 | 869 | */ |
| 870 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 870 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 871 | 871 | |
| 872 | 872 | /** |
| 873 | 873 | * The Entity service. |
| 874 | 874 | */ |
| 875 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 876 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 875 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-uri-service.php'; |
|
| 876 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php'; |
|
| 877 | 877 | |
| 878 | 878 | // Add the entity rating service. |
| 879 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 879 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php'; |
|
| 880 | 880 | |
| 881 | 881 | /** |
| 882 | 882 | * The User service. |
| 883 | 883 | */ |
| 884 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 884 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php'; |
|
| 885 | 885 | |
| 886 | 886 | /** |
| 887 | 887 | * The Timeline service. |
| 888 | 888 | */ |
| 889 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 889 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php'; |
|
| 890 | 890 | |
| 891 | 891 | /** |
| 892 | 892 | * The Topic Taxonomy service. |
| 893 | 893 | */ |
| 894 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 894 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 895 | 895 | |
| 896 | 896 | /** |
| 897 | 897 | * The SPARQL service. |
| 898 | 898 | */ |
| 899 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 899 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sparql-service.php'; |
|
| 900 | 900 | |
| 901 | 901 | /** |
| 902 | 902 | * The WordLift import service. |
| 903 | 903 | */ |
| 904 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 904 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-import-service.php'; |
|
| 905 | 905 | |
| 906 | 906 | /** |
| 907 | 907 | * The WordLift URI service. |
| 908 | 908 | */ |
| 909 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 910 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 911 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 909 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php'; |
|
| 910 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php'; |
|
| 911 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-service.php'; |
|
| 912 | 912 | |
| 913 | 913 | /** |
| 914 | 914 | * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
| 915 | 915 | */ |
| 916 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 917 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 918 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 919 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 920 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 916 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-listable.php'; |
|
| 917 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 918 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 919 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 920 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 921 | 921 | |
| 922 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 923 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 922 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 923 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php'; |
|
| 924 | 924 | |
| 925 | 925 | /** |
| 926 | 926 | * Load the converters. |
| 927 | 927 | */ |
| 928 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 929 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 930 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 931 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 932 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 933 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 928 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php'; |
|
| 929 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 930 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 931 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 932 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 933 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 934 | 934 | |
| 935 | 935 | /** |
| 936 | 936 | * Load cache-related files. |
| 937 | 937 | */ |
| 938 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 938 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/cache/require.php'; |
|
| 939 | 939 | |
| 940 | 940 | /** |
| 941 | 941 | * Load the content filter. |
| 942 | 942 | */ |
| 943 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 943 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php'; |
|
| 944 | 944 | |
| 945 | 945 | /* |
| 946 | 946 | * Load the excerpt helper. |
| 947 | 947 | */ |
| 948 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 948 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 949 | 949 | |
| 950 | 950 | /** |
| 951 | 951 | * Load the JSON-LD service to publish entities using JSON-LD.s |
| 952 | 952 | * |
| 953 | 953 | * @since 3.8.0 |
| 954 | 954 | */ |
| 955 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 955 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php'; |
|
| 956 | 956 | |
| 957 | 957 | // The Publisher Service and the AJAX adapter. |
| 958 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 959 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 958 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php'; |
|
| 959 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 960 | 960 | |
| 961 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 961 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-adapter.php'; |
|
| 962 | 962 | |
| 963 | 963 | /** |
| 964 | 964 | * Load the WordLift key validation service. |
| 965 | 965 | */ |
| 966 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 966 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php'; |
|
| 967 | 967 | |
| 968 | 968 | // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
| 969 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 969 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 970 | 970 | |
| 971 | 971 | // Load the `Wordlift_Entity_Page_Service` class definition. |
| 972 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 972 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-page-service.php'; |
|
| 973 | 973 | |
| 974 | 974 | /** Linked Data. */ |
| 975 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 976 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 977 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 978 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 979 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 980 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 981 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 982 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 983 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 984 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 975 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 976 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 977 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 978 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 979 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 980 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 981 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 982 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 983 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 984 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 985 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 986 | 986 | |
| 987 | 987 | /** Linked Data Rendition. */ |
| 988 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 989 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 990 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 991 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 988 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 989 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 990 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 991 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 992 | 992 | |
| 993 | 993 | /** Services. */ |
| 994 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 994 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 995 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-api-service.php'; |
|
| 996 | 996 | |
| 997 | 997 | /** Adapters. */ |
| 998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 999 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 1000 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 1001 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 1002 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 998 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php'; |
|
| 999 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php'; |
|
| 1000 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 1001 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-adapter.php'; |
|
| 1002 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-wprocket-adapter.php'; |
|
| 1003 | 1003 | |
| 1004 | 1004 | /** Async Tasks. */ |
| 1005 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 1006 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1007 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1005 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 1006 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1007 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1008 | 1008 | |
| 1009 | 1009 | /** Autocomplete. */ |
| 1010 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1010 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1011 | 1011 | |
| 1012 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1012 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-remote-image-service.php'; |
|
| 1013 | 1013 | |
| 1014 | 1014 | /** Analytics */ |
| 1015 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1015 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1016 | 1016 | |
| 1017 | 1017 | /** |
| 1018 | 1018 | * The class responsible for defining all actions that occur in the admin area. |
| 1019 | 1019 | */ |
| 1020 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1020 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php'; |
|
| 1021 | 1021 | |
| 1022 | 1022 | /** |
| 1023 | 1023 | * The class to customize the entity list admin page. |
| 1024 | 1024 | */ |
| 1025 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1025 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php'; |
|
| 1026 | 1026 | |
| 1027 | 1027 | /** |
| 1028 | 1028 | * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
| 1029 | 1029 | */ |
| 1030 | 1030 | global $wp_version; |
| 1031 | - if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 1032 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1031 | + if (version_compare($wp_version, '5.3', '<')) { |
|
| 1032 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1033 | 1033 | } else { |
| 1034 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1034 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1035 | 1035 | } |
| 1036 | 1036 | |
| 1037 | 1037 | /** |
| 1038 | 1038 | * The Notice service. |
| 1039 | 1039 | */ |
| 1040 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1040 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php'; |
|
| 1041 | 1041 | |
| 1042 | 1042 | /** |
| 1043 | 1043 | * The PrimaShop adapter. |
| 1044 | 1044 | */ |
| 1045 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1045 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php'; |
|
| 1046 | 1046 | |
| 1047 | 1047 | /** |
| 1048 | 1048 | * The WordLift Dashboard service. |
| 1049 | 1049 | */ |
| 1050 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1050 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php'; |
|
| 1051 | 1051 | |
| 1052 | 1052 | /** |
| 1053 | 1053 | * The admin 'Install wizard' page. |
| 1054 | 1054 | */ |
| 1055 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1055 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php'; |
|
| 1056 | 1056 | |
| 1057 | 1057 | /** |
| 1058 | 1058 | * The WordLift entity type list admin page controller. |
| 1059 | 1059 | */ |
| 1060 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1060 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1061 | 1061 | |
| 1062 | 1062 | /** |
| 1063 | 1063 | * The WordLift entity type settings admin page controller. |
| 1064 | 1064 | */ |
| 1065 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1065 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php'; |
|
| 1066 | 1066 | |
| 1067 | 1067 | /** |
| 1068 | 1068 | * The admin 'Download Your Data' page. |
| 1069 | 1069 | */ |
| 1070 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1070 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php'; |
|
| 1071 | 1071 | |
| 1072 | 1072 | /** |
| 1073 | 1073 | * The admin 'WordLift Settings' page. |
| 1074 | 1074 | */ |
| 1075 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1077 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1078 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1079 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1080 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1081 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1082 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1083 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1084 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1085 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1086 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1087 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1088 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1089 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1075 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1076 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1077 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1078 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1079 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1080 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1081 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1082 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1083 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1084 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1085 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php'; |
|
| 1086 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php'; |
|
| 1087 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1088 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1089 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1090 | 1090 | |
| 1091 | 1091 | /** Admin Pages */ |
| 1092 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1093 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1094 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1095 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1092 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1093 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-status-page.php'; |
|
| 1094 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1095 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1096 | 1096 | |
| 1097 | 1097 | /** |
| 1098 | 1098 | * The class responsible for defining all actions that occur in the public-facing |
| 1099 | 1099 | * side of the site. |
| 1100 | 1100 | */ |
| 1101 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1101 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php'; |
|
| 1102 | 1102 | |
| 1103 | 1103 | /** |
| 1104 | 1104 | * The shortcode abstract class. |
| 1105 | 1105 | */ |
| 1106 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1106 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php'; |
|
| 1107 | 1107 | |
| 1108 | 1108 | /** |
| 1109 | 1109 | * The Timeline shortcode. |
| 1110 | 1110 | */ |
| 1111 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1111 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php'; |
|
| 1112 | 1112 | |
| 1113 | 1113 | /** |
| 1114 | 1114 | * The Navigator shortcode. |
| 1115 | 1115 | */ |
| 1116 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1116 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php'; |
|
| 1117 | 1117 | |
| 1118 | 1118 | /** |
| 1119 | 1119 | * The Products Navigator shortcode. |
| 1120 | 1120 | */ |
| 1121 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 1121 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 1122 | 1122 | |
| 1123 | 1123 | /** |
| 1124 | 1124 | * The chord shortcode. |
| 1125 | 1125 | */ |
| 1126 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1126 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php'; |
|
| 1127 | 1127 | |
| 1128 | 1128 | /** |
| 1129 | 1129 | * The geomap shortcode. |
| 1130 | 1130 | */ |
| 1131 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1131 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php'; |
|
| 1132 | 1132 | |
| 1133 | 1133 | /** |
| 1134 | 1134 | * The entity cloud shortcode. |
| 1135 | 1135 | */ |
| 1136 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1136 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1137 | 1137 | |
| 1138 | 1138 | /** |
| 1139 | 1139 | * The entity glossary shortcode. |
| 1140 | 1140 | */ |
| 1141 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1142 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1141 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-alphabet-service.php'; |
|
| 1142 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1143 | 1143 | |
| 1144 | 1144 | /** |
| 1145 | 1145 | * Faceted Search shortcode. |
| 1146 | 1146 | */ |
| 1147 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1147 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1148 | 1148 | |
| 1149 | 1149 | /** |
| 1150 | 1150 | * The ShareThis service. |
| 1151 | 1151 | */ |
| 1152 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1152 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php'; |
|
| 1153 | 1153 | |
| 1154 | 1154 | /** |
| 1155 | 1155 | * The SEO service. |
| 1156 | 1156 | */ |
| 1157 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1157 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php'; |
|
| 1158 | 1158 | |
| 1159 | 1159 | /** |
| 1160 | 1160 | * The AMP service. |
| 1161 | 1161 | */ |
| 1162 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1162 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php'; |
|
| 1163 | 1163 | |
| 1164 | 1164 | /** Widgets */ |
| 1165 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1166 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1167 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1165 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php'; |
|
| 1166 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1167 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-context-cards.php'; |
|
| 1168 | 1168 | |
| 1169 | 1169 | /* |
| 1170 | 1170 | * Schema.org Services. |
| 1171 | 1171 | * |
| 1172 | 1172 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1173 | 1173 | */ |
| 1174 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1175 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1176 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1177 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1174 | + if (WL_ALL_ENTITY_TYPES) { |
|
| 1175 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1176 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1177 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1178 | 1178 | new Wordlift_Schemaorg_Sync_Service(); |
| 1179 | 1179 | $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
| 1180 | 1180 | new Wordlift_Schemaorg_Class_Service(); |
@@ -1186,25 +1186,25 @@ discard block |
||
| 1186 | 1186 | |
| 1187 | 1187 | // Instantiate a global logger. |
| 1188 | 1188 | global $wl_logger; |
| 1189 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1189 | + $wl_logger = Wordlift_Log_Service::get_logger('WordLift'); |
|
| 1190 | 1190 | |
| 1191 | 1191 | // Load the `wl-api` end-point. |
| 1192 | 1192 | new Wordlift_Http_Api(); |
| 1193 | 1193 | |
| 1194 | 1194 | // Load the Install Service. |
| 1195 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1195 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-service.php'; |
|
| 1196 | 1196 | $this->install_service = new Wordlift_Install_Service(); |
| 1197 | 1197 | |
| 1198 | 1198 | /** Services. */ |
| 1199 | 1199 | // Create the configuration service. |
| 1200 | 1200 | $this->configuration_service = new Wordlift_Configuration_Service(); |
| 1201 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1201 | + $api_service = new Wordlift_Api_Service($this->configuration_service); |
|
| 1202 | 1202 | |
| 1203 | 1203 | // Create an entity type service instance. It'll be later bound to the init action. |
| 1204 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1204 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path()); |
|
| 1205 | 1205 | |
| 1206 | 1206 | // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
| 1207 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1207 | + $this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_post_type_service, $this->configuration_service->get_entity_base_path()); |
|
| 1208 | 1208 | |
| 1209 | 1209 | // Create an instance of the UI service. |
| 1210 | 1210 | $this->ui_service = new Wordlift_UI_Service(); |
@@ -1213,30 +1213,30 @@ discard block |
||
| 1213 | 1213 | $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
| 1214 | 1214 | |
| 1215 | 1215 | $this->sparql_service = new Wordlift_Sparql_Service(); |
| 1216 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1216 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service($this->sparql_service); |
|
| 1217 | 1217 | $this->notice_service = new Wordlift_Notice_Service(); |
| 1218 | 1218 | $this->relation_service = new Wordlift_Relation_Service(); |
| 1219 | 1219 | |
| 1220 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1221 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1222 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1223 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1220 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'entity_uri/'); |
|
| 1221 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service($this->configuration_service, $entity_uri_cache_service); |
|
| 1222 | + $this->entity_service = new Wordlift_Entity_Service($this->ui_service, $this->relation_service, $this->entity_uri_service); |
|
| 1223 | + $this->user_service = new Wordlift_User_Service($this->sparql_service, $this->entity_service); |
|
| 1224 | 1224 | |
| 1225 | 1225 | // Instantiate the JSON-LD service. |
| 1226 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1226 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
| 1227 | 1227 | |
| 1228 | 1228 | /** Linked Data. */ |
| 1229 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1230 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1229 | + $this->storage_factory = new Wordlift_Storage_Factory($this->entity_service, $this->user_service, $property_getter); |
|
| 1230 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory($this->entity_service); |
|
| 1231 | 1231 | |
| 1232 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1232 | + $this->schema_service = new Wordlift_Schema_Service($this->storage_factory, $this->rendition_factory, $this->configuration_service); |
|
| 1233 | 1233 | |
| 1234 | 1234 | // Create a new instance of the Redirect service. |
| 1235 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1236 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1235 | + $this->redirect_service = new Wordlift_Redirect_Service($this->entity_uri_service); |
|
| 1236 | + $this->entity_type_service = new Wordlift_Entity_Type_Service($this->schema_service); |
|
| 1237 | 1237 | |
| 1238 | 1238 | // Create a new instance of the Timeline service and Timeline shortcode. |
| 1239 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1239 | + $this->timeline_service = new Wordlift_Timeline_Service($this->entity_service, $this->entity_type_service); |
|
| 1240 | 1240 | |
| 1241 | 1241 | $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
| 1242 | 1242 | |
@@ -1250,36 +1250,36 @@ discard block |
||
| 1250 | 1250 | $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
| 1251 | 1251 | |
| 1252 | 1252 | // Create an import service instance to hook later to WP's import function. |
| 1253 | - $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() ); |
|
| 1253 | + $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()); |
|
| 1254 | 1254 | |
| 1255 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1255 | + $uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']); |
|
| 1256 | 1256 | |
| 1257 | 1257 | // Create the entity rating service. |
| 1258 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1258 | + $this->rating_service = new Wordlift_Rating_Service($this->entity_service, $this->entity_type_service, $this->notice_service); |
|
| 1259 | 1259 | |
| 1260 | 1260 | // Create entity list customization (wp-admin/edit.php). |
| 1261 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1261 | + $this->entity_list_service = new Wordlift_Entity_List_Service($this->rating_service); |
|
| 1262 | 1262 | |
| 1263 | 1263 | // Create a new instance of the Redirect service. |
| 1264 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1264 | + $this->dashboard_service = new Wordlift_Dashboard_Service($this->rating_service, $this->entity_service); |
|
| 1265 | 1265 | |
| 1266 | 1266 | // Create an instance of the Publisher Service and the AJAX Adapter. |
| 1267 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1268 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1269 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1267 | + $this->publisher_service = new Wordlift_Publisher_Service($this->configuration_service); |
|
| 1268 | + $this->property_factory = new Wordlift_Property_Factory($schema_url_property_service); |
|
| 1269 | + $this->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service); |
|
| 1270 | 1270 | |
| 1271 | 1271 | $attachment_service = new Wordlift_Attachment_Service(); |
| 1272 | 1272 | |
| 1273 | 1273 | // Instantiate the JSON-LD service. |
| 1274 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1275 | - $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 ); |
|
| 1276 | - $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 ); |
|
| 1277 | - $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 ); |
|
| 1278 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1274 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
| 1275 | + $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); |
|
| 1276 | + $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); |
|
| 1277 | + $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); |
|
| 1278 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service); |
|
| 1279 | 1279 | |
| 1280 | - $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1281 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache ); |
|
| 1282 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1280 | + $jsonld_cache = new Ttl_Cache('jsonld', 86400); |
|
| 1281 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter($this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache); |
|
| 1282 | + $this->jsonld_service = new Wordlift_Jsonld_Service($this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter); |
|
| 1283 | 1283 | |
| 1284 | 1284 | /* |
| 1285 | 1285 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
@@ -1288,29 +1288,29 @@ discard block |
||
| 1288 | 1288 | * |
| 1289 | 1289 | * @since 3.20.0 |
| 1290 | 1290 | */ |
| 1291 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1292 | - $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1291 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1292 | + $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter($this->entity_uri_service, $this->jsonld_service); |
|
| 1293 | 1293 | $jsonld_service = new Jsonld_Service( |
| 1294 | 1294 | $this->jsonld_service, |
| 1295 | 1295 | $term_jsonld_adapter, |
| 1296 | - new Jsonld_User_Service( $this->user_service ) ); |
|
| 1297 | - new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service ); |
|
| 1296 | + new Jsonld_User_Service($this->user_service) ); |
|
| 1297 | + new Jsonld_Endpoint($jsonld_service, $this->entity_uri_service); |
|
| 1298 | 1298 | |
| 1299 | 1299 | // Prints the JSON-LD in the head. |
| 1300 | - new Jsonld_Adapter( $this->jsonld_service ); |
|
| 1300 | + new Jsonld_Adapter($this->jsonld_service); |
|
| 1301 | 1301 | |
| 1302 | - new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service ); |
|
| 1302 | + new Jsonld_By_Id_Endpoint($this->jsonld_service, $this->entity_uri_service); |
|
| 1303 | 1303 | |
| 1304 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1305 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1304 | + $this->key_validation_service = new Wordlift_Key_Validation_Service($this->configuration_service); |
|
| 1305 | + $this->content_filter_service = new Wordlift_Content_Filter_Service($this->entity_service, $this->configuration_service, $this->entity_uri_service); |
|
| 1306 | 1306 | // Creating Faq Content filter service. |
| 1307 | 1307 | $this->faq_content_filter_service = new Faq_Content_Filter(); |
| 1308 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1309 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1310 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1311 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->entity_service ); |
|
| 1308 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service($this->content_filter_service, $this->entity_service); |
|
| 1309 | + $this->sample_data_service = new Wordlift_Sample_Data_Service($this->entity_type_service, $this->configuration_service, $this->user_service); |
|
| 1310 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter($this->sample_data_service); |
|
| 1311 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service($this->entity_service); |
|
| 1312 | 1312 | |
| 1313 | - $this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' ); |
|
| 1313 | + $this->loader->add_action('enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks'); |
|
| 1314 | 1314 | |
| 1315 | 1315 | /** |
| 1316 | 1316 | * Filter: wl_feature__enable__blocks. |
@@ -1320,15 +1320,15 @@ discard block |
||
| 1320 | 1320 | * @return bool |
| 1321 | 1321 | * @since 3.27.6 |
| 1322 | 1322 | */ |
| 1323 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1323 | + if (apply_filters('wl_feature__enable__blocks', true)) { |
|
| 1324 | 1324 | // Initialize the short-codes. |
| 1325 | - new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
| 1325 | + new Async_Template_Decorator(new Wordlift_Navigator_Shortcode()); |
|
| 1326 | 1326 | new Wordlift_Chord_Shortcode(); |
| 1327 | 1327 | new Wordlift_Geomap_Shortcode(); |
| 1328 | 1328 | new Wordlift_Timeline_Shortcode(); |
| 1329 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1330 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1331 | - new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
| 1329 | + new Wordlift_Related_Entities_Cloud_Shortcode($this->relation_service); |
|
| 1330 | + new Wordlift_Vocabulary_Shortcode($this->configuration_service); |
|
| 1331 | + new Async_Template_Decorator(new Wordlift_Faceted_Search_Shortcode()); |
|
| 1332 | 1332 | } |
| 1333 | 1333 | |
| 1334 | 1334 | new Wordlift_Products_Navigator_Shortcode(); |
@@ -1341,18 +1341,18 @@ discard block |
||
| 1341 | 1341 | new Wordlift_Seo_Service(); |
| 1342 | 1342 | |
| 1343 | 1343 | // Initialize the AMP service. |
| 1344 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1344 | + new Wordlift_AMP_Service($this->jsonld_service); |
|
| 1345 | 1345 | |
| 1346 | 1346 | /** Services. */ |
| 1347 | 1347 | $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
| 1348 | 1348 | new Wordlift_Image_Service(); |
| 1349 | 1349 | |
| 1350 | 1350 | /** Adapters. */ |
| 1351 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1352 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1353 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1351 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter($this->entity_type_service); |
|
| 1352 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter($this->publisher_service); |
|
| 1353 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter($this); |
|
| 1354 | 1354 | //$this->faq_tinymce_adapter = new Faq_Tinymce_Adapter(); |
| 1355 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1355 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter($this->relation_rebuild_service); |
|
| 1356 | 1356 | |
| 1357 | 1357 | /* |
| 1358 | 1358 | * Exclude our public js from WP-Rocket. |
@@ -1370,9 +1370,9 @@ discard block |
||
| 1370 | 1370 | ); |
| 1371 | 1371 | |
| 1372 | 1372 | $that = $this; |
| 1373 | - add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1374 | - if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) { |
|
| 1375 | - new Wordlift_Linked_Data_Service( $that->entity_service, $that->entity_type_service, $that->schema_service, $that->sparql_service ); |
|
| 1373 | + add_action('plugins_loaded', function() use ($that) { |
|
| 1374 | + if ( ! apply_filters('wl_feature__enable__dataset-ng', false)) { |
|
| 1375 | + new Wordlift_Linked_Data_Service($that->entity_service, $that->entity_type_service, $that->schema_service, $that->sparql_service); |
|
| 1376 | 1376 | new Wordlift_Sparql_Query_Async_Task(); |
| 1377 | 1377 | new Wordlift_Push_References_Async_Task(); |
| 1378 | 1378 | } |
@@ -1387,14 +1387,14 @@ discard block |
||
| 1387 | 1387 | $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
| 1388 | 1388 | $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
| 1389 | 1389 | $tabs_element = new Wordlift_Admin_Tabs_Element(); |
| 1390 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1391 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1390 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element($this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element); |
|
| 1391 | + $this->author_element = new Wordlift_Admin_Author_Element($this->publisher_service, $this->select2_element); |
|
| 1392 | 1392 | |
| 1393 | - $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 ); |
|
| 1394 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1393 | + $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); |
|
| 1394 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($this->settings_page); |
|
| 1395 | 1395 | |
| 1396 | - $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1397 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1396 | + $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page($this->configuration_service, $this->input_element, $this->radio_input_element); |
|
| 1397 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link($this->analytics_settings_page); |
|
| 1398 | 1398 | $this->analytics_connect = new Wordlift_Analytics_Connect(); |
| 1399 | 1399 | |
| 1400 | 1400 | // Pages. |
@@ -1405,9 +1405,9 @@ discard block |
||
| 1405 | 1405 | * |
| 1406 | 1406 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1407 | 1407 | */ |
| 1408 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1409 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1410 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1408 | + if (apply_filters('wl_can_see_classification_box', true)) { |
|
| 1409 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1410 | + new Wordlift_Admin_Post_Edit_Page($this); |
|
| 1411 | 1411 | } |
| 1412 | 1412 | new Wordlift_Entity_Type_Admin_Service(); |
| 1413 | 1413 | |
@@ -1421,23 +1421,23 @@ discard block |
||
| 1421 | 1421 | $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
| 1422 | 1422 | |
| 1423 | 1423 | /* WordPress Admin. */ |
| 1424 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1425 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1424 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service); |
|
| 1425 | + $this->status_page = new Wordlift_Admin_Status_Page($this->entity_service, $this->sparql_service); |
|
| 1426 | 1426 | |
| 1427 | 1427 | // Create an instance of the install wizard. |
| 1428 | - $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 ); |
|
| 1428 | + $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); |
|
| 1429 | 1429 | |
| 1430 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1430 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($this->entity_post_type_service); |
|
| 1431 | 1431 | |
| 1432 | 1432 | // User Profile. |
| 1433 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1433 | + new Wordlift_Admin_User_Profile_Page($this->author_element, $this->user_service); |
|
| 1434 | 1434 | |
| 1435 | 1435 | $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
| 1436 | 1436 | |
| 1437 | 1437 | // Load the debug service if WP is in debug mode. |
| 1438 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1439 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1440 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1438 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 1439 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php'; |
|
| 1440 | + new Wordlift_Debug_Service($this->entity_service, $uri_service); |
|
| 1441 | 1441 | } |
| 1442 | 1442 | |
| 1443 | 1443 | // Remote Image Service. |
@@ -1450,12 +1450,12 @@ discard block |
||
| 1450 | 1450 | * |
| 1451 | 1451 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1452 | 1452 | */ |
| 1453 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1454 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1455 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1453 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-batch-action.php'; |
|
| 1454 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1455 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1456 | 1456 | |
| 1457 | 1457 | // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
| 1458 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1458 | + new Wordlift_Mapping_Ajax_Adapter(new Wordlift_Mapping_Service(Wordlift_Entity_Type_Service::get_instance())); |
|
| 1459 | 1459 | |
| 1460 | 1460 | /* |
| 1461 | 1461 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
@@ -1464,8 +1464,8 @@ discard block |
||
| 1464 | 1464 | * |
| 1465 | 1465 | * @since 3.20.0 |
| 1466 | 1466 | */ |
| 1467 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1468 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1467 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1468 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1469 | 1469 | |
| 1470 | 1470 | /* |
| 1471 | 1471 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
@@ -1474,8 +1474,8 @@ discard block |
||
| 1474 | 1474 | * |
| 1475 | 1475 | * @since 3.20.0 |
| 1476 | 1476 | */ |
| 1477 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1478 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1477 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1478 | + new Wordlift_Search_Keyword_Taxonomy($api_service); |
|
| 1479 | 1479 | |
| 1480 | 1480 | /* |
| 1481 | 1481 | * Load the Mappings JSON-LD post processing. |
@@ -1489,11 +1489,11 @@ discard block |
||
| 1489 | 1489 | // Taxonomy term rule validator for validating rules for term pages. |
| 1490 | 1490 | new Taxonomy_Term_Rule_Validator(); |
| 1491 | 1491 | new Post_Taxonomy_Term_Rule_Validator(); |
| 1492 | - $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1493 | - $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1494 | - $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1492 | + $rule_validators_registry = new Rule_Validators_Registry($default_rule_validator); |
|
| 1493 | + $rule_groups_validator = new Rule_Groups_Validator($rule_validators_registry); |
|
| 1494 | + $mappings_validator = new Mappings_Validator($mappings_dbo, $rule_groups_validator); |
|
| 1495 | 1495 | |
| 1496 | - new Url_To_Entity_Transform_Function( $this->entity_uri_service ); |
|
| 1496 | + new Url_To_Entity_Transform_Function($this->entity_uri_service); |
|
| 1497 | 1497 | new Taxonomy_To_Terms_Transform_Function(); |
| 1498 | 1498 | new Post_Id_To_Entity_Transform_Function(); |
| 1499 | 1499 | $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
@@ -1503,7 +1503,7 @@ discard block |
||
| 1503 | 1503 | * Intiailize the acf group data formatter. |
| 1504 | 1504 | */ |
| 1505 | 1505 | new Acf_Group_Formatter(); |
| 1506 | - new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1506 | + new Jsonld_Converter($mappings_validator, $mappings_transform_functions_registry); |
|
| 1507 | 1507 | |
| 1508 | 1508 | /** |
| 1509 | 1509 | * @since 3.26.0 |
@@ -1524,7 +1524,7 @@ discard block |
||
| 1524 | 1524 | /* |
| 1525 | 1525 | * Create a singleton for the Analysis_Response_Ops_Factory. |
| 1526 | 1526 | */ |
| 1527 | - $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service ); |
|
| 1527 | + $entity_helper = new Entity_Helper($this->entity_uri_service, $this->entity_service); |
|
| 1528 | 1528 | new Analysis_Response_Ops_Factory( |
| 1529 | 1529 | $this->entity_uri_service, |
| 1530 | 1530 | $this->entity_service, |
@@ -1534,11 +1534,11 @@ discard block |
||
| 1534 | 1534 | ); |
| 1535 | 1535 | |
| 1536 | 1536 | /** WL Autocomplete. */ |
| 1537 | - $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1537 | + $autocomplete_service = new All_Autocomplete_Service(array( |
|
| 1538 | 1538 | new Local_Autocomplete_Service(), |
| 1539 | - new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ), |
|
| 1540 | - ) ); |
|
| 1541 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1539 | + new Linked_Data_Autocomplete_Service($this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service), |
|
| 1540 | + )); |
|
| 1541 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter($autocomplete_service); |
|
| 1542 | 1542 | |
| 1543 | 1543 | /** |
| 1544 | 1544 | * @since 3.27.2 |
@@ -1547,10 +1547,10 @@ discard block |
||
| 1547 | 1547 | */ |
| 1548 | 1548 | new Recipe_Maker_Post_Type_Hook(); |
| 1549 | 1549 | $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
| 1550 | - new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1551 | - new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1552 | - new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1553 | - new Yoast_Jsonld( $recipe_maker_validation_service ); |
|
| 1550 | + new Recipe_Maker_Jsonld_Hook($attachment_service, $recipe_maker_validation_service); |
|
| 1551 | + new Recipe_Maker_After_Get_Jsonld_Hook($recipe_maker_validation_service); |
|
| 1552 | + new Recipe_Maker_Warning($recipe_maker_validation_service); |
|
| 1553 | + new Yoast_Jsonld($recipe_maker_validation_service); |
|
| 1554 | 1554 | |
| 1555 | 1555 | /** |
| 1556 | 1556 | * @since 3.27.4 |
@@ -1561,7 +1561,7 @@ discard block |
||
| 1561 | 1561 | * @since 3.27.8 |
| 1562 | 1562 | * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
| 1563 | 1563 | */ |
| 1564 | - new Key_Validation_Notice( $this->key_validation_service, $this->configuration_service ); |
|
| 1564 | + new Key_Validation_Notice($this->key_validation_service, $this->configuration_service); |
|
| 1565 | 1565 | } |
| 1566 | 1566 | |
| 1567 | 1567 | /** |
@@ -1576,9 +1576,9 @@ discard block |
||
| 1576 | 1576 | private function set_locale() { |
| 1577 | 1577 | |
| 1578 | 1578 | $plugin_i18n = new Wordlift_i18n(); |
| 1579 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1579 | + $plugin_i18n->set_domain($this->get_plugin_name()); |
|
| 1580 | 1580 | |
| 1581 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1581 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
| 1582 | 1582 | |
| 1583 | 1583 | } |
| 1584 | 1584 | |
@@ -1599,29 +1599,29 @@ discard block |
||
| 1599 | 1599 | $this->user_service |
| 1600 | 1600 | ); |
| 1601 | 1601 | |
| 1602 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1603 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1602 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
| 1603 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11); |
|
| 1604 | 1604 | |
| 1605 | 1605 | // Hook the init action to taxonomy services. |
| 1606 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1607 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1606 | + $this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0); |
|
| 1607 | + $this->loader->add_action('init', $this->entity_types_taxonomy_service, 'init', 0); |
|
| 1608 | 1608 | |
| 1609 | 1609 | // Hook the deleted_post_meta action to the Thumbnail service. |
| 1610 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1610 | + $this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4); |
|
| 1611 | 1611 | |
| 1612 | 1612 | // Hook the added_post_meta action to the Thumbnail service. |
| 1613 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1613 | + $this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 1614 | 1614 | |
| 1615 | 1615 | // Hook the updated_post_meta action to the Thumbnail service. |
| 1616 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1616 | + $this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 1617 | 1617 | |
| 1618 | 1618 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1619 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1619 | + $this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 1620 | 1620 | |
| 1621 | 1621 | // Register custom allowed redirect hosts. |
| 1622 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1622 | + $this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts'); |
|
| 1623 | 1623 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
| 1624 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1624 | + $this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect'); |
|
| 1625 | 1625 | |
| 1626 | 1626 | /* |
| 1627 | 1627 | * The old dashboard is replaced with dashboard v2. |
@@ -1639,46 +1639,46 @@ discard block |
||
| 1639 | 1639 | |
| 1640 | 1640 | // Hook save_post to the entity service to update custom fields (such as alternate labels). |
| 1641 | 1641 | // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
| 1642 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1643 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1642 | + $this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3); |
|
| 1643 | + $this->loader->add_action('save_post', $this->rating_service, 'set_rating_for', 20, 1); |
|
| 1644 | 1644 | |
| 1645 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1646 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1645 | + $this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1); |
|
| 1646 | + $this->loader->add_action('in_admin_header', $this->rating_service, 'in_admin_header'); |
|
| 1647 | 1647 | |
| 1648 | 1648 | // Entity listing customization (wp-admin/edit.php) |
| 1649 | 1649 | // Add custom columns. |
| 1650 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1650 | + $this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns'); |
|
| 1651 | 1651 | // no explicit entity as it prevents handling of other post types. |
| 1652 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1652 | + $this->loader->add_filter('manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2); |
|
| 1653 | 1653 | // Add 4W selection. |
| 1654 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1655 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1656 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1657 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1654 | + $this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope'); |
|
| 1655 | + $this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope'); |
|
| 1656 | + $this->loader->add_action('pre_get_posts', $this->entity_list_service, 'pre_get_posts'); |
|
| 1657 | + $this->loader->add_action('load-edit.php', $this->entity_list_service, 'load_edit'); |
|
| 1658 | 1658 | |
| 1659 | 1659 | /* |
| 1660 | 1660 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1661 | 1661 | * |
| 1662 | 1662 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1663 | 1663 | */ |
| 1664 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1665 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1664 | + if ( ! WL_ALL_ENTITY_TYPES) { |
|
| 1665 | + $this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args'); |
|
| 1666 | 1666 | } |
| 1667 | 1667 | |
| 1668 | 1668 | // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
| 1669 | 1669 | // entities. |
| 1670 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1670 | + $this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2); |
|
| 1671 | 1671 | |
| 1672 | 1672 | // Filter imported post meta. |
| 1673 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1673 | + $this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3); |
|
| 1674 | 1674 | |
| 1675 | 1675 | // Notify the import service when an import starts and ends. |
| 1676 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1677 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1676 | + $this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0); |
|
| 1677 | + $this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0); |
|
| 1678 | 1678 | |
| 1679 | 1679 | // Hook the AJAX wl_rebuild action to the Rebuild Service. |
| 1680 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1681 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1680 | + $this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild'); |
|
| 1681 | + $this->loader->add_action('wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild'); |
|
| 1682 | 1682 | |
| 1683 | 1683 | /** |
| 1684 | 1684 | * Filter: wl_feature__enable__screens. |
@@ -1688,34 +1688,34 @@ discard block |
||
| 1688 | 1688 | * @return bool |
| 1689 | 1689 | * @since 3.27.6 |
| 1690 | 1690 | */ |
| 1691 | - if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1691 | + if (apply_filters('wl_feature__enable__screens', true)) { |
|
| 1692 | 1692 | // Hook the menu to the Download Your Data page. |
| 1693 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1694 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1695 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1693 | + $this->loader->add_action('admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0); |
|
| 1694 | + $this->loader->add_action('admin_menu', $this->status_page, 'admin_menu', 100, 0); |
|
| 1695 | + $this->loader->add_action('admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0); |
|
| 1696 | 1696 | } |
| 1697 | 1697 | // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
| 1698 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1698 | + $this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10); |
|
| 1699 | 1699 | |
| 1700 | 1700 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1701 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1702 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1703 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1701 | + $this->loader->add_action('wp_ajax_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1702 | + $this->loader->add_action('admin_post_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1703 | + $this->loader->add_action('admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1704 | 1704 | |
| 1705 | 1705 | // Hook the AJAX wl_validate_key action to the Key Validation service. |
| 1706 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1706 | + $this->loader->add_action('wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key'); |
|
| 1707 | 1707 | |
| 1708 | 1708 | // Hook the AJAX wl_update_country_options action to the countries. |
| 1709 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1709 | + $this->loader->add_action('wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html'); |
|
| 1710 | 1710 | |
| 1711 | 1711 | // Hook the `admin_init` function to the Admin Setup. |
| 1712 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1712 | + $this->loader->add_action('admin_init', $this->admin_setup, 'admin_init'); |
|
| 1713 | 1713 | |
| 1714 | 1714 | // Hook the admin_init to the settings page. |
| 1715 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1716 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1715 | + $this->loader->add_action('admin_init', $this->settings_page, 'admin_init'); |
|
| 1716 | + $this->loader->add_action('admin_init', $this->analytics_settings_page, 'admin_init'); |
|
| 1717 | 1717 | |
| 1718 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1718 | + $this->loader->add_filter('admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction'); |
|
| 1719 | 1719 | |
| 1720 | 1720 | // Hook the menu creation on the general wordlift menu creation. |
| 1721 | 1721 | /** |
@@ -1726,8 +1726,8 @@ discard block |
||
| 1726 | 1726 | * @return bool |
| 1727 | 1727 | * @since 3.27.6 |
| 1728 | 1728 | */ |
| 1729 | - if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1730 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1729 | + if (apply_filters('wl_feature__enable__screens', true)) { |
|
| 1730 | + $this->loader->add_action('wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2); |
|
| 1731 | 1731 | } |
| 1732 | 1732 | /* |
| 1733 | 1733 | * Display the `Wordlift_Admin_Search_Rankings_Page` page. |
@@ -1736,7 +1736,7 @@ discard block |
||
| 1736 | 1736 | * |
| 1737 | 1737 | * @since 3.20.0 |
| 1738 | 1738 | */ |
| 1739 | - if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1739 | + if (in_array($this->configuration_service->get_package_type(), array('editorial', 'business'))) { |
|
| 1740 | 1740 | /** |
| 1741 | 1741 | * Filter: wl_feature__enable__screens. |
| 1742 | 1742 | * |
@@ -1745,18 +1745,18 @@ discard block |
||
| 1745 | 1745 | * @return bool |
| 1746 | 1746 | * @since 3.27.6 |
| 1747 | 1747 | */ |
| 1748 | - if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1748 | + if (apply_filters('wl_feature__enable__screens', true)) { |
|
| 1749 | 1749 | $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
| 1750 | - $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1750 | + $this->loader->add_action('wl_admin_menu', $admin_search_rankings_page, 'admin_menu'); |
|
| 1751 | 1751 | } |
| 1752 | 1752 | } |
| 1753 | 1753 | |
| 1754 | 1754 | // Hook key update. |
| 1755 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1756 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1755 | + $this->loader->add_action('pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2); |
|
| 1756 | + $this->loader->add_action('update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2); |
|
| 1757 | 1757 | |
| 1758 | 1758 | // Add additional action links to the WordLift plugin in the plugins page. |
| 1759 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1759 | + $this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1); |
|
| 1760 | 1760 | |
| 1761 | 1761 | /* |
| 1762 | 1762 | * Remove the Analytics Settings link from the plugin page. |
@@ -1767,25 +1767,25 @@ discard block |
||
| 1767 | 1767 | // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
| 1768 | 1768 | |
| 1769 | 1769 | // Hook the AJAX `wl_publisher` action name. |
| 1770 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1770 | + $this->loader->add_action('wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher'); |
|
| 1771 | 1771 | |
| 1772 | 1772 | // Hook row actions for the entity type list admin. |
| 1773 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1773 | + $this->loader->add_filter('wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2); |
|
| 1774 | 1774 | |
| 1775 | 1775 | /** Ajax actions. */ |
| 1776 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1776 | + $this->loader->add_action('wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export'); |
|
| 1777 | 1777 | |
| 1778 | 1778 | // Hook capabilities manipulation to allow access to entity type admin |
| 1779 | 1779 | // page on WordPress versions before 4.7. |
| 1780 | 1780 | global $wp_version; |
| 1781 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1782 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1781 | + if (version_compare($wp_version, '4.7', '<')) { |
|
| 1782 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4); |
|
| 1783 | 1783 | } |
| 1784 | 1784 | |
| 1785 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1785 | + $this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
| 1786 | 1786 | |
| 1787 | 1787 | /** Adapters. */ |
| 1788 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1788 | + $this->loader->add_filter('mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1); |
|
| 1789 | 1789 | /** |
| 1790 | 1790 | * Disabling Faq temporarily. |
| 1791 | 1791 | * Load the tinymce editor button on the tool bar. |
@@ -1796,56 +1796,56 @@ discard block |
||
| 1796 | 1796 | //$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
| 1797 | 1797 | |
| 1798 | 1798 | |
| 1799 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1800 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1801 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1799 | + $this->loader->add_action('wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all'); |
|
| 1800 | + $this->loader->add_action('wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create'); |
|
| 1801 | + $this->loader->add_action('wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete'); |
|
| 1802 | 1802 | /** |
| 1803 | 1803 | * @since 3.26.0 |
| 1804 | 1804 | */ |
| 1805 | - if ( apply_filters( 'wl_feature__enable__post_excerpt', true ) ) { |
|
| 1805 | + if (apply_filters('wl_feature__enable__post_excerpt', true)) { |
|
| 1806 | 1806 | $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
| 1807 | - $this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1807 | + $this->loader->add_action('do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box'); |
|
| 1808 | 1808 | // Adding Rest route for the post excerpt |
| 1809 | 1809 | Post_Excerpt_Rest_Controller::register_routes(); |
| 1810 | 1810 | } |
| 1811 | 1811 | |
| 1812 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1813 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1812 | + $this->loader->add_action('update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5); |
|
| 1813 | + $this->loader->add_action('delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5); |
|
| 1814 | 1814 | |
| 1815 | 1815 | // Handle the autocomplete request. |
| 1816 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1816 | + add_action('wp_ajax_wl_autocomplete', array( |
|
| 1817 | 1817 | $this->autocomplete_adapter, |
| 1818 | 1818 | 'wl_autocomplete', |
| 1819 | - ) ); |
|
| 1820 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1819 | + )); |
|
| 1820 | + add_action('wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1821 | 1821 | $this->autocomplete_adapter, |
| 1822 | 1822 | 'wl_autocomplete', |
| 1823 | - ) ); |
|
| 1823 | + )); |
|
| 1824 | 1824 | |
| 1825 | 1825 | // Hooks to restrict multisite super admin from manipulating entity types. |
| 1826 | - if ( is_multisite() ) { |
|
| 1827 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1826 | + if (is_multisite()) { |
|
| 1827 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4); |
|
| 1828 | 1828 | } |
| 1829 | 1829 | |
| 1830 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1830 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback($this->configuration_service); |
|
| 1831 | 1831 | |
| 1832 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1833 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1834 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1832 | + add_action('admin_footer', array($deactivator_feedback, 'render_feedback_popup')); |
|
| 1833 | + add_action('admin_enqueue_scripts', array($deactivator_feedback, 'enqueue_popup_scripts')); |
|
| 1834 | + add_action('wp_ajax_wl_deactivation_feedback', array($deactivator_feedback, 'wl_deactivation_feedback')); |
|
| 1835 | 1835 | |
| 1836 | 1836 | /** |
| 1837 | 1837 | * Always allow the `wordlift/classification` block. |
| 1838 | 1838 | * |
| 1839 | 1839 | * @since 3.23.0 |
| 1840 | 1840 | */ |
| 1841 | - add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1841 | + add_filter('allowed_block_types', function($value) { |
|
| 1842 | 1842 | |
| 1843 | - if ( true === $value ) { |
|
| 1843 | + if (true === $value) { |
|
| 1844 | 1844 | return $value; |
| 1845 | 1845 | } |
| 1846 | 1846 | |
| 1847 | - return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1848 | - }, PHP_INT_MAX ); |
|
| 1847 | + return array_merge((array) $value, array('wordlift/classification')); |
|
| 1848 | + }, PHP_INT_MAX); |
|
| 1849 | 1849 | |
| 1850 | 1850 | /** |
| 1851 | 1851 | * @since 3.27.7 |
@@ -1863,58 +1863,58 @@ discard block |
||
| 1863 | 1863 | */ |
| 1864 | 1864 | private function define_public_hooks() { |
| 1865 | 1865 | |
| 1866 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1866 | + $plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version()); |
|
| 1867 | 1867 | |
| 1868 | 1868 | // Register the entity post type. |
| 1869 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1869 | + $this->loader->add_action('init', $this->entity_post_type_service, 'register'); |
|
| 1870 | 1870 | |
| 1871 | 1871 | // Bind the link generation and handling hooks to the entity link service. |
| 1872 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1873 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1872 | + $this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4); |
|
| 1873 | + $this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1); |
|
| 1874 | 1874 | // $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 ); |
| 1875 | 1875 | // $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 ); |
| 1876 | 1876 | |
| 1877 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1878 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1879 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1877 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
| 1878 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
| 1879 | + $this->loader->add_action('wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts'); |
|
| 1880 | 1880 | |
| 1881 | 1881 | // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
| 1882 | - $this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1882 | + $this->loader->add_filter('the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags'); |
|
| 1883 | 1883 | // Hook the content filter service to add entity links. |
| 1884 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1885 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1884 | + if ( ! defined('WL_DISABLE_CONTENT_FILTER') || ! WL_DISABLE_CONTENT_FILTER) { |
|
| 1885 | + $this->loader->add_filter('the_content', $this->content_filter_service, 'the_content'); |
|
| 1886 | 1886 | } |
| 1887 | 1887 | |
| 1888 | 1888 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1889 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1889 | + $this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 1890 | 1890 | |
| 1891 | 1891 | // Hook the ShareThis service. |
| 1892 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1893 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1892 | + $this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99); |
|
| 1893 | + $this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99); |
|
| 1894 | 1894 | |
| 1895 | 1895 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1896 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1896 | + $this->loader->add_action('wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1897 | 1897 | |
| 1898 | 1898 | // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
| 1899 | 1899 | // in order to tweak WP's `WP_Query` to include entities in queries related |
| 1900 | 1900 | // to categories. |
| 1901 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1901 | + $this->loader->add_action('pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1); |
|
| 1902 | 1902 | |
| 1903 | 1903 | /* |
| 1904 | 1904 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1905 | 1905 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1906 | 1906 | * order of start time. |
| 1907 | 1907 | */ |
| 1908 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1908 | + $this->loader->add_action('pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1); |
|
| 1909 | 1909 | |
| 1910 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1910 | + $this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
| 1911 | 1911 | |
| 1912 | 1912 | // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
| 1913 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1913 | + $this->loader->add_action('save_post', $this->entity_type_adapter, 'save_post', 9, 3); |
|
| 1914 | 1914 | |
| 1915 | 1915 | // Analytics Script Frontend. |
| 1916 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1917 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1916 | + if ($this->configuration_service->is_analytics_enable()) { |
|
| 1917 | + $this->loader->add_action('wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10); |
|
| 1918 | 1918 | } |
| 1919 | 1919 | |
| 1920 | 1920 | } |
@@ -1967,11 +1967,11 @@ discard block |
||
| 1967 | 1967 | */ |
| 1968 | 1968 | private function load_cli_dependencies() { |
| 1969 | 1969 | |
| 1970 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1970 | + require_once plugin_dir_path(dirname(__FILE__)).'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1971 | 1971 | |
| 1972 | - $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 ); |
|
| 1972 | + $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); |
|
| 1973 | 1973 | |
| 1974 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1974 | + WP_CLI::add_command('wl references push', $push_reference_data_command); |
|
| 1975 | 1975 | |
| 1976 | 1976 | } |
| 1977 | 1977 | |
@@ -1996,13 +1996,13 @@ discard block |
||
| 1996 | 1996 | * @since 3.27.6 |
| 1997 | 1997 | */ |
| 1998 | 1998 | |
| 1999 | - wp_register_script( 'wl_enabled_blocks', false ); |
|
| 1999 | + wp_register_script('wl_enabled_blocks', false); |
|
| 2000 | 2000 | |
| 2001 | - $enabled_blocks = array( 'wordlift/products-navigator' ); |
|
| 2001 | + $enabled_blocks = array('wordlift/products-navigator'); |
|
| 2002 | 2002 | |
| 2003 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 2003 | + if (apply_filters('wl_feature__enable__blocks', true)) { |
|
| 2004 | 2004 | // To intimate JS |
| 2005 | - $enabled_blocks = array_merge( $enabled_blocks, array( |
|
| 2005 | + $enabled_blocks = array_merge($enabled_blocks, array( |
|
| 2006 | 2006 | 'wordlift/navigator', |
| 2007 | 2007 | 'wordlift/chord', |
| 2008 | 2008 | 'wordlift/geomap', |
@@ -2010,11 +2010,11 @@ discard block |
||
| 2010 | 2010 | 'wordlift/cloud', |
| 2011 | 2011 | 'wordlift/vocabulary', |
| 2012 | 2012 | 'wordlift/faceted-search' |
| 2013 | - ) ); |
|
| 2013 | + )); |
|
| 2014 | 2014 | } |
| 2015 | 2015 | |
| 2016 | - wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 2017 | - wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 2016 | + wp_localize_script('wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks); |
|
| 2017 | + wp_enqueue_script('wl_enabled_blocks'); |
|
| 2018 | 2018 | } |
| 2019 | 2019 | |
| 2020 | 2020 | } |
@@ -17,48 +17,48 @@ discard block |
||
| 17 | 17 | * @package Wordlift\Mappings\Validators |
| 18 | 18 | */ |
| 19 | 19 | class Post_Taxonomy_Term_Rule_Validator implements Rule_Validator { |
| 20 | - /** |
|
| 21 | - * @since 3.25.0 |
|
| 22 | - * Enum for the post taxonomy type rule validator. |
|
| 23 | - */ |
|
| 24 | - const POST_TAXONOMY = 'post_taxonomy'; |
|
| 20 | + /** |
|
| 21 | + * @since 3.25.0 |
|
| 22 | + * Enum for the post taxonomy type rule validator. |
|
| 23 | + */ |
|
| 24 | + const POST_TAXONOMY = 'post_taxonomy'; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Post_Taxonomy_Term_Rule_Validator constructor. |
|
| 28 | - * |
|
| 29 | - * When initializing the class hooks to `wl_mappings_rule_validators`. |
|
| 30 | - */ |
|
| 31 | - public function __construct() { |
|
| 26 | + /** |
|
| 27 | + * Post_Taxonomy_Term_Rule_Validator constructor. |
|
| 28 | + * |
|
| 29 | + * When initializing the class hooks to `wl_mappings_rule_validators`. |
|
| 30 | + */ |
|
| 31 | + public function __construct() { |
|
| 32 | 32 | |
| 33 | - add_filter( 'wl_mappings_rule_validators', array( $this, 'wl_mappings_rule_validators' ) ); |
|
| 33 | + add_filter( 'wl_mappings_rule_validators', array( $this, 'wl_mappings_rule_validators' ) ); |
|
| 34 | 34 | |
| 35 | - } |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Hook to `wl_mappings_rule_validators` to register ourselves. |
|
| 39 | - * |
|
| 40 | - * @param array $value An array with validators. |
|
| 41 | - * |
|
| 42 | - * @return array An array with validators plus ours. |
|
| 43 | - */ |
|
| 44 | - public function wl_mappings_rule_validators( $value ) { |
|
| 37 | + /** |
|
| 38 | + * Hook to `wl_mappings_rule_validators` to register ourselves. |
|
| 39 | + * |
|
| 40 | + * @param array $value An array with validators. |
|
| 41 | + * |
|
| 42 | + * @return array An array with validators plus ours. |
|
| 43 | + */ |
|
| 44 | + public function wl_mappings_rule_validators( $value ) { |
|
| 45 | 45 | |
| 46 | - $value[ self::POST_TAXONOMY ] = $this; |
|
| 46 | + $value[ self::POST_TAXONOMY ] = $this; |
|
| 47 | 47 | |
| 48 | - return $value; |
|
| 49 | - } |
|
| 48 | + return $value; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * {@inheritdoc} |
|
| 53 | - */ |
|
| 54 | - public function get_label() { |
|
| 55 | - return __( 'Post Taxonomy', 'wordlift' ); |
|
| 56 | - } |
|
| 51 | + /** |
|
| 52 | + * {@inheritdoc} |
|
| 53 | + */ |
|
| 54 | + public function get_label() { |
|
| 55 | + return __( 'Post Taxonomy', 'wordlift' ); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * {@inheritdoc} |
|
| 60 | - */ |
|
| 61 | - public function is_valid ( $identifier, $operator, $operand_1, $operand_2, $type ) { |
|
| 58 | + /** |
|
| 59 | + * {@inheritdoc} |
|
| 60 | + */ |
|
| 61 | + public function is_valid ( $identifier, $operator, $operand_1, $operand_2, $type ) { |
|
| 62 | 62 | $taxonomy = $operand_1; |
| 63 | 63 | $term_slug = $operand_2; |
| 64 | 64 | |
@@ -71,5 +71,5 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | return ( $is_object_in_term && self::IS_EQUAL_TO === $operator ) |
| 73 | 73 | || ( ! $is_object_in_term && self::IS_NOT_EQUAL_TO === $operator ); |
| 74 | - } |
|
| 74 | + } |
|
| 75 | 75 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function __construct() { |
| 32 | 32 | |
| 33 | - add_filter( 'wl_mappings_rule_validators', array( $this, 'wl_mappings_rule_validators' ) ); |
|
| 33 | + add_filter('wl_mappings_rule_validators', array($this, 'wl_mappings_rule_validators')); |
|
| 34 | 34 | |
| 35 | 35 | } |
| 36 | 36 | |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @return array An array with validators plus ours. |
| 43 | 43 | */ |
| 44 | - public function wl_mappings_rule_validators( $value ) { |
|
| 44 | + public function wl_mappings_rule_validators($value) { |
|
| 45 | 45 | |
| 46 | - $value[ self::POST_TAXONOMY ] = $this; |
|
| 46 | + $value[self::POST_TAXONOMY] = $this; |
|
| 47 | 47 | |
| 48 | 48 | return $value; |
| 49 | 49 | } |
@@ -52,24 +52,24 @@ discard block |
||
| 52 | 52 | * {@inheritdoc} |
| 53 | 53 | */ |
| 54 | 54 | public function get_label() { |
| 55 | - return __( 'Post Taxonomy', 'wordlift' ); |
|
| 55 | + return __('Post Taxonomy', 'wordlift'); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * {@inheritdoc} |
| 60 | 60 | */ |
| 61 | - public function is_valid ( $identifier, $operator, $operand_1, $operand_2, $type ) { |
|
| 61 | + public function is_valid($identifier, $operator, $operand_1, $operand_2, $type) { |
|
| 62 | 62 | $taxonomy = $operand_1; |
| 63 | 63 | $term_slug = $operand_2; |
| 64 | 64 | |
| 65 | 65 | if (get_post_type($identifier) !== 'post') { |
| 66 | 66 | return false; |
| 67 | 67 | } |
| 68 | - $is_object_in_term = is_object_in_term( $identifier, $taxonomy, $term_slug ); |
|
| 69 | - if ( is_wp_error( $is_object_in_term ) ) { |
|
| 68 | + $is_object_in_term = is_object_in_term($identifier, $taxonomy, $term_slug); |
|
| 69 | + if (is_wp_error($is_object_in_term)) { |
|
| 70 | 70 | return false; |
| 71 | 71 | } |
| 72 | - return ( $is_object_in_term && self::IS_EQUAL_TO === $operator ) |
|
| 73 | - || ( ! $is_object_in_term && self::IS_NOT_EQUAL_TO === $operator ); |
|
| 72 | + return ($is_object_in_term && self::IS_EQUAL_TO === $operator) |
|
| 73 | + || ( ! $is_object_in_term && self::IS_NOT_EQUAL_TO === $operator); |
|
| 74 | 74 | } |
| 75 | 75 | } |