@@ -5,99 +5,99 @@ |
||
| 5 | 5 | use Wordlift\Object_Type_Enum; |
| 6 | 6 | |
| 7 | 7 | class Sync_User_Hooks extends Abstract_Sync_Hooks { |
| 8 | - /** |
|
| 9 | - * @var \Wordlift_Log_Service |
|
| 10 | - */ |
|
| 11 | - private $log; |
|
| 12 | - |
|
| 13 | - /** |
|
| 14 | - * @var Sync_Service |
|
| 15 | - */ |
|
| 16 | - private $sync_service; |
|
| 17 | - |
|
| 18 | - /** |
|
| 19 | - * Sync_User_Hooks constructor. |
|
| 20 | - * |
|
| 21 | - * @param Sync_Service $sync_service |
|
| 22 | - */ |
|
| 23 | - function __construct( Sync_Service $sync_service ) { |
|
| 24 | - parent::__construct(); |
|
| 25 | - |
|
| 26 | - $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 27 | - |
|
| 28 | - $this->sync_service = $sync_service; |
|
| 29 | - |
|
| 30 | - $this->register_hooks(); |
|
| 31 | - |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - private function register_hooks() { |
|
| 35 | - /** |
|
| 36 | - * Register hooks for user and meta. |
|
| 37 | - */ |
|
| 38 | - add_action( 'user_register', array( $this, 'changed_user' ) ); |
|
| 39 | - add_action( 'profile_update', array( $this, 'changed_user' ) ); |
|
| 40 | - add_action( 'added_user_meta', array( $this, 'changed_user_meta' ), 10, 3 ); |
|
| 41 | - add_action( 'updated_user_meta', array( $this, 'changed_user_meta' ), 10, 3 ); |
|
| 42 | - add_action( 'deleted_user_meta', array( $this, 'changed_user_meta' ), 10, 3 ); |
|
| 43 | - add_action( 'delete_user', array( $this, 'delete_user' ) ); |
|
| 44 | - |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - public function changed_user( $user_id ) { |
|
| 48 | - |
|
| 49 | - $this->sync( $user_id ); |
|
| 50 | - |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - public function changed_user_meta( $meta_id, $user_id, $meta_key ) { |
|
| 54 | - |
|
| 55 | - if ( in_array( $meta_key, |
|
| 56 | - apply_filters( 'wl_dataset__sync_user_hooks__ignored_meta_keys', |
|
| 57 | - apply_filters( 'wl_dataset__sync_hooks__ignored_meta_keys', |
|
| 58 | - array( |
|
| 59 | - 'rich_editing', |
|
| 60 | - 'comment_shortcuts', |
|
| 61 | - 'admin_color', |
|
| 62 | - 'use_ssl', |
|
| 63 | - 'show_admin_bar_front', |
|
| 64 | - 'wptests_capabilities', |
|
| 65 | - 'wptests_user_level', |
|
| 66 | - 'dismissed_wp_pointers', |
|
| 67 | - 'entity_url', |
|
| 68 | - ) ) ) ) ) { |
|
| 69 | - return; |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - $this->sync( $user_id ); |
|
| 73 | - |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - private function sync( $user_id ) { |
|
| 77 | - $this->enqueue( array( 'do_sync', $user_id ) ); |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - public function do_sync( $user_id ) { |
|
| 81 | - |
|
| 82 | - try { |
|
| 83 | - $this->sync_service->sync_one( Object_Type_Enum::USER, (int) $user_id ); |
|
| 84 | - } catch ( \Exception $e ) { |
|
| 85 | - $this->log->error( "An error occurred while trying to sync user $user_id: " . $e->getMessage(), $e ); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - public function delete_user( $user_id ) { |
|
| 91 | - $this->enqueue( array( 'do_delete', $user_id ) ); |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - public function do_delete( $user_id ) { |
|
| 95 | - try { |
|
| 96 | - $this->sync_service->delete_one( Object_Type_Enum::USER, $user_id ); |
|
| 97 | - } catch ( \Exception $e ) { |
|
| 98 | - $this->log->error( "An error occurred while trying to delete user $user_id: " . $e->getMessage(), $e ); |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - } |
|
| 8 | + /** |
|
| 9 | + * @var \Wordlift_Log_Service |
|
| 10 | + */ |
|
| 11 | + private $log; |
|
| 12 | + |
|
| 13 | + /** |
|
| 14 | + * @var Sync_Service |
|
| 15 | + */ |
|
| 16 | + private $sync_service; |
|
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * Sync_User_Hooks constructor. |
|
| 20 | + * |
|
| 21 | + * @param Sync_Service $sync_service |
|
| 22 | + */ |
|
| 23 | + function __construct( Sync_Service $sync_service ) { |
|
| 24 | + parent::__construct(); |
|
| 25 | + |
|
| 26 | + $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 27 | + |
|
| 28 | + $this->sync_service = $sync_service; |
|
| 29 | + |
|
| 30 | + $this->register_hooks(); |
|
| 31 | + |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + private function register_hooks() { |
|
| 35 | + /** |
|
| 36 | + * Register hooks for user and meta. |
|
| 37 | + */ |
|
| 38 | + add_action( 'user_register', array( $this, 'changed_user' ) ); |
|
| 39 | + add_action( 'profile_update', array( $this, 'changed_user' ) ); |
|
| 40 | + add_action( 'added_user_meta', array( $this, 'changed_user_meta' ), 10, 3 ); |
|
| 41 | + add_action( 'updated_user_meta', array( $this, 'changed_user_meta' ), 10, 3 ); |
|
| 42 | + add_action( 'deleted_user_meta', array( $this, 'changed_user_meta' ), 10, 3 ); |
|
| 43 | + add_action( 'delete_user', array( $this, 'delete_user' ) ); |
|
| 44 | + |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + public function changed_user( $user_id ) { |
|
| 48 | + |
|
| 49 | + $this->sync( $user_id ); |
|
| 50 | + |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + public function changed_user_meta( $meta_id, $user_id, $meta_key ) { |
|
| 54 | + |
|
| 55 | + if ( in_array( $meta_key, |
|
| 56 | + apply_filters( 'wl_dataset__sync_user_hooks__ignored_meta_keys', |
|
| 57 | + apply_filters( 'wl_dataset__sync_hooks__ignored_meta_keys', |
|
| 58 | + array( |
|
| 59 | + 'rich_editing', |
|
| 60 | + 'comment_shortcuts', |
|
| 61 | + 'admin_color', |
|
| 62 | + 'use_ssl', |
|
| 63 | + 'show_admin_bar_front', |
|
| 64 | + 'wptests_capabilities', |
|
| 65 | + 'wptests_user_level', |
|
| 66 | + 'dismissed_wp_pointers', |
|
| 67 | + 'entity_url', |
|
| 68 | + ) ) ) ) ) { |
|
| 69 | + return; |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + $this->sync( $user_id ); |
|
| 73 | + |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + private function sync( $user_id ) { |
|
| 77 | + $this->enqueue( array( 'do_sync', $user_id ) ); |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + public function do_sync( $user_id ) { |
|
| 81 | + |
|
| 82 | + try { |
|
| 83 | + $this->sync_service->sync_one( Object_Type_Enum::USER, (int) $user_id ); |
|
| 84 | + } catch ( \Exception $e ) { |
|
| 85 | + $this->log->error( "An error occurred while trying to sync user $user_id: " . $e->getMessage(), $e ); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + public function delete_user( $user_id ) { |
|
| 91 | + $this->enqueue( array( 'do_delete', $user_id ) ); |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + public function do_delete( $user_id ) { |
|
| 95 | + try { |
|
| 96 | + $this->sync_service->delete_one( Object_Type_Enum::USER, $user_id ); |
|
| 97 | + } catch ( \Exception $e ) { |
|
| 98 | + $this->log->error( "An error occurred while trying to delete user $user_id: " . $e->getMessage(), $e ); |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | 103 | } |
| 104 | 104 | \ No newline at end of file |
@@ -20,10 +20,10 @@ discard block |
||
| 20 | 20 | * |
| 21 | 21 | * @param Sync_Service $sync_service |
| 22 | 22 | */ |
| 23 | - function __construct( Sync_Service $sync_service ) { |
|
| 23 | + function __construct(Sync_Service $sync_service) { |
|
| 24 | 24 | parent::__construct(); |
| 25 | 25 | |
| 26 | - $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 26 | + $this->log = \Wordlift_Log_Service::get_logger(get_class()); |
|
| 27 | 27 | |
| 28 | 28 | $this->sync_service = $sync_service; |
| 29 | 29 | |
@@ -35,26 +35,26 @@ discard block |
||
| 35 | 35 | /** |
| 36 | 36 | * Register hooks for user and meta. |
| 37 | 37 | */ |
| 38 | - add_action( 'user_register', array( $this, 'changed_user' ) ); |
|
| 39 | - add_action( 'profile_update', array( $this, 'changed_user' ) ); |
|
| 40 | - add_action( 'added_user_meta', array( $this, 'changed_user_meta' ), 10, 3 ); |
|
| 41 | - add_action( 'updated_user_meta', array( $this, 'changed_user_meta' ), 10, 3 ); |
|
| 42 | - add_action( 'deleted_user_meta', array( $this, 'changed_user_meta' ), 10, 3 ); |
|
| 43 | - add_action( 'delete_user', array( $this, 'delete_user' ) ); |
|
| 38 | + add_action('user_register', array($this, 'changed_user')); |
|
| 39 | + add_action('profile_update', array($this, 'changed_user')); |
|
| 40 | + add_action('added_user_meta', array($this, 'changed_user_meta'), 10, 3); |
|
| 41 | + add_action('updated_user_meta', array($this, 'changed_user_meta'), 10, 3); |
|
| 42 | + add_action('deleted_user_meta', array($this, 'changed_user_meta'), 10, 3); |
|
| 43 | + add_action('delete_user', array($this, 'delete_user')); |
|
| 44 | 44 | |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function changed_user( $user_id ) { |
|
| 47 | + public function changed_user($user_id) { |
|
| 48 | 48 | |
| 49 | - $this->sync( $user_id ); |
|
| 49 | + $this->sync($user_id); |
|
| 50 | 50 | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function changed_user_meta( $meta_id, $user_id, $meta_key ) { |
|
| 53 | + public function changed_user_meta($meta_id, $user_id, $meta_key) { |
|
| 54 | 54 | |
| 55 | - if ( in_array( $meta_key, |
|
| 56 | - apply_filters( 'wl_dataset__sync_user_hooks__ignored_meta_keys', |
|
| 57 | - apply_filters( 'wl_dataset__sync_hooks__ignored_meta_keys', |
|
| 55 | + if (in_array($meta_key, |
|
| 56 | + apply_filters('wl_dataset__sync_user_hooks__ignored_meta_keys', |
|
| 57 | + apply_filters('wl_dataset__sync_hooks__ignored_meta_keys', |
|
| 58 | 58 | array( |
| 59 | 59 | 'rich_editing', |
| 60 | 60 | 'comment_shortcuts', |
@@ -65,37 +65,37 @@ discard block |
||
| 65 | 65 | 'wptests_user_level', |
| 66 | 66 | 'dismissed_wp_pointers', |
| 67 | 67 | 'entity_url', |
| 68 | - ) ) ) ) ) { |
|
| 68 | + ))))) { |
|
| 69 | 69 | return; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $this->sync( $user_id ); |
|
| 72 | + $this->sync($user_id); |
|
| 73 | 73 | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - private function sync( $user_id ) { |
|
| 77 | - $this->enqueue( array( 'do_sync', $user_id ) ); |
|
| 76 | + private function sync($user_id) { |
|
| 77 | + $this->enqueue(array('do_sync', $user_id)); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function do_sync( $user_id ) { |
|
| 80 | + public function do_sync($user_id) { |
|
| 81 | 81 | |
| 82 | 82 | try { |
| 83 | - $this->sync_service->sync_one( Object_Type_Enum::USER, (int) $user_id ); |
|
| 84 | - } catch ( \Exception $e ) { |
|
| 85 | - $this->log->error( "An error occurred while trying to sync user $user_id: " . $e->getMessage(), $e ); |
|
| 83 | + $this->sync_service->sync_one(Object_Type_Enum::USER, (int) $user_id); |
|
| 84 | + } catch (\Exception $e) { |
|
| 85 | + $this->log->error("An error occurred while trying to sync user $user_id: ".$e->getMessage(), $e); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - public function delete_user( $user_id ) { |
|
| 91 | - $this->enqueue( array( 'do_delete', $user_id ) ); |
|
| 90 | + public function delete_user($user_id) { |
|
| 91 | + $this->enqueue(array('do_delete', $user_id)); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - public function do_delete( $user_id ) { |
|
| 94 | + public function do_delete($user_id) { |
|
| 95 | 95 | try { |
| 96 | - $this->sync_service->delete_one( Object_Type_Enum::USER, $user_id ); |
|
| 97 | - } catch ( \Exception $e ) { |
|
| 98 | - $this->log->error( "An error occurred while trying to delete user $user_id: " . $e->getMessage(), $e ); |
|
| 96 | + $this->sync_service->delete_one(Object_Type_Enum::USER, $user_id); |
|
| 97 | + } catch (\Exception $e) { |
|
| 98 | + $this->log->error("An error occurred while trying to delete user $user_id: ".$e->getMessage(), $e); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | } |
@@ -5,109 +5,109 @@ |
||
| 5 | 5 | use Wordlift\Object_Type_Enum; |
| 6 | 6 | |
| 7 | 7 | class Sync_Post_Hooks extends Abstract_Sync_Hooks { |
| 8 | - /** |
|
| 9 | - * @var \Wordlift_Log_Service |
|
| 10 | - */ |
|
| 11 | - private $log; |
|
| 12 | - |
|
| 13 | - /** |
|
| 14 | - * @var Sync_Service |
|
| 15 | - */ |
|
| 16 | - private $sync_service; |
|
| 17 | - |
|
| 18 | - /** |
|
| 19 | - * @var Sync_Object_Adapter_Factory |
|
| 20 | - */ |
|
| 21 | - private $sync_object_factory; |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * Sync_Post_Hooks constructor. |
|
| 25 | - * |
|
| 26 | - * @param Sync_Service $sync_service |
|
| 27 | - * @param Sync_Object_Adapter_Factory $sync_object_factory |
|
| 28 | - */ |
|
| 29 | - function __construct( $sync_service, $sync_object_factory ) { |
|
| 30 | - parent::__construct(); |
|
| 31 | - |
|
| 32 | - $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 33 | - |
|
| 34 | - $this->sync_service = $sync_service; |
|
| 35 | - $this->sync_object_factory = $sync_object_factory; |
|
| 36 | - |
|
| 37 | - $this->register_hooks(); |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - private function register_hooks() { |
|
| 41 | - /** |
|
| 42 | - * Register hooks for post and meta. |
|
| 43 | - */ |
|
| 44 | - add_action( 'save_post', array( $this, 'save_post' ) ); |
|
| 45 | - add_action( 'added_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 46 | - add_action( 'updated_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 47 | - add_action( 'deleted_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 48 | - add_action( 'delete_post', array( $this, 'delete_post' ) ); |
|
| 49 | - |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - public function save_post( $post_id ) { |
|
| 53 | - |
|
| 54 | - if ( ! in_array( get_post_type( $post_id ), \Wordlift_Entity_Service::valid_entity_post_types() ) ) { |
|
| 55 | - return; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - $this->sync( $post_id ); |
|
| 59 | - |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - public function changed_post_meta( $meta_id, $post_id, $meta_key, $_meta_value ) { |
|
| 63 | - |
|
| 64 | - if ( in_array( $meta_key, |
|
| 65 | - apply_filters( 'wl_dataset__sync_post_hooks__ignored_meta_keys', |
|
| 66 | - apply_filters( 'wl_dataset__sync_hooks__ignored_meta_keys', |
|
| 67 | - array( |
|
| 68 | - '_pingme', |
|
| 69 | - '_encloseme', |
|
| 70 | - 'entity_url', |
|
| 71 | - ) ) ) ) |
|
| 72 | - || ! in_array( get_post_type( $post_id ), \Wordlift_Entity_Service::valid_entity_post_types() ) |
|
| 73 | - ) { |
|
| 74 | - return; |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - $this->sync( $post_id ); |
|
| 78 | - |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - private function sync( $post_id ) { |
|
| 82 | - $this->enqueue( array( 'do_sync', $post_id ) ); |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - public function do_sync( $post_id ) { |
|
| 86 | - try { |
|
| 87 | - $post = get_post( $post_id ); |
|
| 88 | - if ( !isset( $post ) ) { |
|
| 89 | - return; |
|
| 90 | - } |
|
| 91 | - $this->sync_service->sync_many( array( |
|
| 92 | - $this->sync_object_factory->create( Object_Type_Enum::POST, $post_id ), |
|
| 93 | - $this->sync_object_factory->create( Object_Type_Enum::USER, $post->post_author ) |
|
| 94 | - ) ); |
|
| 95 | - } catch ( \Exception $e ) { |
|
| 96 | - $this->log->error( "An error occurred while trying to sync post $post_id: " . $e->getMessage(), $e ); |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - public function delete_post( $post_id ) { |
|
| 102 | - $this->enqueue( array( 'do_delete', $post_id ) ); |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - public function do_delete( $post_id ) { |
|
| 106 | - try { |
|
| 107 | - $this->sync_service->delete_one( Object_Type_Enum::POST, $post_id ); |
|
| 108 | - } catch ( \Exception $e ) { |
|
| 109 | - $this->log->error( "An error occurred while trying to delete post $post_id: " . $e->getMessage(), $e ); |
|
| 110 | - } |
|
| 111 | - } |
|
| 8 | + /** |
|
| 9 | + * @var \Wordlift_Log_Service |
|
| 10 | + */ |
|
| 11 | + private $log; |
|
| 12 | + |
|
| 13 | + /** |
|
| 14 | + * @var Sync_Service |
|
| 15 | + */ |
|
| 16 | + private $sync_service; |
|
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * @var Sync_Object_Adapter_Factory |
|
| 20 | + */ |
|
| 21 | + private $sync_object_factory; |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * Sync_Post_Hooks constructor. |
|
| 25 | + * |
|
| 26 | + * @param Sync_Service $sync_service |
|
| 27 | + * @param Sync_Object_Adapter_Factory $sync_object_factory |
|
| 28 | + */ |
|
| 29 | + function __construct( $sync_service, $sync_object_factory ) { |
|
| 30 | + parent::__construct(); |
|
| 31 | + |
|
| 32 | + $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 33 | + |
|
| 34 | + $this->sync_service = $sync_service; |
|
| 35 | + $this->sync_object_factory = $sync_object_factory; |
|
| 36 | + |
|
| 37 | + $this->register_hooks(); |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + private function register_hooks() { |
|
| 41 | + /** |
|
| 42 | + * Register hooks for post and meta. |
|
| 43 | + */ |
|
| 44 | + add_action( 'save_post', array( $this, 'save_post' ) ); |
|
| 45 | + add_action( 'added_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 46 | + add_action( 'updated_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 47 | + add_action( 'deleted_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 48 | + add_action( 'delete_post', array( $this, 'delete_post' ) ); |
|
| 49 | + |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + public function save_post( $post_id ) { |
|
| 53 | + |
|
| 54 | + if ( ! in_array( get_post_type( $post_id ), \Wordlift_Entity_Service::valid_entity_post_types() ) ) { |
|
| 55 | + return; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + $this->sync( $post_id ); |
|
| 59 | + |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + public function changed_post_meta( $meta_id, $post_id, $meta_key, $_meta_value ) { |
|
| 63 | + |
|
| 64 | + if ( in_array( $meta_key, |
|
| 65 | + apply_filters( 'wl_dataset__sync_post_hooks__ignored_meta_keys', |
|
| 66 | + apply_filters( 'wl_dataset__sync_hooks__ignored_meta_keys', |
|
| 67 | + array( |
|
| 68 | + '_pingme', |
|
| 69 | + '_encloseme', |
|
| 70 | + 'entity_url', |
|
| 71 | + ) ) ) ) |
|
| 72 | + || ! in_array( get_post_type( $post_id ), \Wordlift_Entity_Service::valid_entity_post_types() ) |
|
| 73 | + ) { |
|
| 74 | + return; |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + $this->sync( $post_id ); |
|
| 78 | + |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + private function sync( $post_id ) { |
|
| 82 | + $this->enqueue( array( 'do_sync', $post_id ) ); |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + public function do_sync( $post_id ) { |
|
| 86 | + try { |
|
| 87 | + $post = get_post( $post_id ); |
|
| 88 | + if ( !isset( $post ) ) { |
|
| 89 | + return; |
|
| 90 | + } |
|
| 91 | + $this->sync_service->sync_many( array( |
|
| 92 | + $this->sync_object_factory->create( Object_Type_Enum::POST, $post_id ), |
|
| 93 | + $this->sync_object_factory->create( Object_Type_Enum::USER, $post->post_author ) |
|
| 94 | + ) ); |
|
| 95 | + } catch ( \Exception $e ) { |
|
| 96 | + $this->log->error( "An error occurred while trying to sync post $post_id: " . $e->getMessage(), $e ); |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + public function delete_post( $post_id ) { |
|
| 102 | + $this->enqueue( array( 'do_delete', $post_id ) ); |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + public function do_delete( $post_id ) { |
|
| 106 | + try { |
|
| 107 | + $this->sync_service->delete_one( Object_Type_Enum::POST, $post_id ); |
|
| 108 | + } catch ( \Exception $e ) { |
|
| 109 | + $this->log->error( "An error occurred while trying to delete post $post_id: " . $e->getMessage(), $e ); |
|
| 110 | + } |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | 113 | } |
@@ -26,10 +26,10 @@ discard block |
||
| 26 | 26 | * @param Sync_Service $sync_service |
| 27 | 27 | * @param Sync_Object_Adapter_Factory $sync_object_factory |
| 28 | 28 | */ |
| 29 | - function __construct( $sync_service, $sync_object_factory ) { |
|
| 29 | + function __construct($sync_service, $sync_object_factory) { |
|
| 30 | 30 | parent::__construct(); |
| 31 | 31 | |
| 32 | - $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 32 | + $this->log = \Wordlift_Log_Service::get_logger(get_class()); |
|
| 33 | 33 | |
| 34 | 34 | $this->sync_service = $sync_service; |
| 35 | 35 | $this->sync_object_factory = $sync_object_factory; |
@@ -41,72 +41,72 @@ discard block |
||
| 41 | 41 | /** |
| 42 | 42 | * Register hooks for post and meta. |
| 43 | 43 | */ |
| 44 | - add_action( 'save_post', array( $this, 'save_post' ) ); |
|
| 45 | - add_action( 'added_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 46 | - add_action( 'updated_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 47 | - add_action( 'deleted_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 48 | - add_action( 'delete_post', array( $this, 'delete_post' ) ); |
|
| 44 | + add_action('save_post', array($this, 'save_post')); |
|
| 45 | + add_action('added_post_meta', array($this, 'changed_post_meta'), 10, 4); |
|
| 46 | + add_action('updated_post_meta', array($this, 'changed_post_meta'), 10, 4); |
|
| 47 | + add_action('deleted_post_meta', array($this, 'changed_post_meta'), 10, 4); |
|
| 48 | + add_action('delete_post', array($this, 'delete_post')); |
|
| 49 | 49 | |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function save_post( $post_id ) { |
|
| 52 | + public function save_post($post_id) { |
|
| 53 | 53 | |
| 54 | - if ( ! in_array( get_post_type( $post_id ), \Wordlift_Entity_Service::valid_entity_post_types() ) ) { |
|
| 54 | + if ( ! in_array(get_post_type($post_id), \Wordlift_Entity_Service::valid_entity_post_types())) { |
|
| 55 | 55 | return; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $this->sync( $post_id ); |
|
| 58 | + $this->sync($post_id); |
|
| 59 | 59 | |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public function changed_post_meta( $meta_id, $post_id, $meta_key, $_meta_value ) { |
|
| 62 | + public function changed_post_meta($meta_id, $post_id, $meta_key, $_meta_value) { |
|
| 63 | 63 | |
| 64 | - if ( in_array( $meta_key, |
|
| 65 | - apply_filters( 'wl_dataset__sync_post_hooks__ignored_meta_keys', |
|
| 66 | - apply_filters( 'wl_dataset__sync_hooks__ignored_meta_keys', |
|
| 64 | + if (in_array($meta_key, |
|
| 65 | + apply_filters('wl_dataset__sync_post_hooks__ignored_meta_keys', |
|
| 66 | + apply_filters('wl_dataset__sync_hooks__ignored_meta_keys', |
|
| 67 | 67 | array( |
| 68 | 68 | '_pingme', |
| 69 | 69 | '_encloseme', |
| 70 | 70 | 'entity_url', |
| 71 | - ) ) ) ) |
|
| 72 | - || ! in_array( get_post_type( $post_id ), \Wordlift_Entity_Service::valid_entity_post_types() ) |
|
| 71 | + )))) |
|
| 72 | + || ! in_array(get_post_type($post_id), \Wordlift_Entity_Service::valid_entity_post_types()) |
|
| 73 | 73 | ) { |
| 74 | 74 | return; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $this->sync( $post_id ); |
|
| 77 | + $this->sync($post_id); |
|
| 78 | 78 | |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - private function sync( $post_id ) { |
|
| 82 | - $this->enqueue( array( 'do_sync', $post_id ) ); |
|
| 81 | + private function sync($post_id) { |
|
| 82 | + $this->enqueue(array('do_sync', $post_id)); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - public function do_sync( $post_id ) { |
|
| 85 | + public function do_sync($post_id) { |
|
| 86 | 86 | try { |
| 87 | - $post = get_post( $post_id ); |
|
| 88 | - if ( !isset( $post ) ) { |
|
| 87 | + $post = get_post($post_id); |
|
| 88 | + if ( ! isset($post)) { |
|
| 89 | 89 | return; |
| 90 | 90 | } |
| 91 | - $this->sync_service->sync_many( array( |
|
| 92 | - $this->sync_object_factory->create( Object_Type_Enum::POST, $post_id ), |
|
| 93 | - $this->sync_object_factory->create( Object_Type_Enum::USER, $post->post_author ) |
|
| 94 | - ) ); |
|
| 95 | - } catch ( \Exception $e ) { |
|
| 96 | - $this->log->error( "An error occurred while trying to sync post $post_id: " . $e->getMessage(), $e ); |
|
| 91 | + $this->sync_service->sync_many(array( |
|
| 92 | + $this->sync_object_factory->create(Object_Type_Enum::POST, $post_id), |
|
| 93 | + $this->sync_object_factory->create(Object_Type_Enum::USER, $post->post_author) |
|
| 94 | + )); |
|
| 95 | + } catch (\Exception $e) { |
|
| 96 | + $this->log->error("An error occurred while trying to sync post $post_id: ".$e->getMessage(), $e); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - public function delete_post( $post_id ) { |
|
| 102 | - $this->enqueue( array( 'do_delete', $post_id ) ); |
|
| 101 | + public function delete_post($post_id) { |
|
| 102 | + $this->enqueue(array('do_delete', $post_id)); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - public function do_delete( $post_id ) { |
|
| 105 | + public function do_delete($post_id) { |
|
| 106 | 106 | try { |
| 107 | - $this->sync_service->delete_one( Object_Type_Enum::POST, $post_id ); |
|
| 108 | - } catch ( \Exception $e ) { |
|
| 109 | - $this->log->error( "An error occurred while trying to delete post $post_id: " . $e->getMessage(), $e ); |
|
| 107 | + $this->sync_service->delete_one(Object_Type_Enum::POST, $post_id); |
|
| 108 | + } catch (\Exception $e) { |
|
| 109 | + $this->log->error("An error occurred while trying to delete post $post_id: ".$e->getMessage(), $e); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
@@ -4,26 +4,26 @@ |
||
| 4 | 4 | |
| 5 | 5 | abstract class Abstract_Sync_Hooks { |
| 6 | 6 | |
| 7 | - private $queue = array(); |
|
| 7 | + private $queue = array(); |
|
| 8 | 8 | |
| 9 | - function __construct() { |
|
| 9 | + function __construct() { |
|
| 10 | 10 | |
| 11 | - add_action( 'shutdown', array( $this, 'shutdown' ) ); |
|
| 11 | + add_action( 'shutdown', array( $this, 'shutdown' ) ); |
|
| 12 | 12 | |
| 13 | - } |
|
| 13 | + } |
|
| 14 | 14 | |
| 15 | - protected function enqueue( $item ) { |
|
| 15 | + protected function enqueue( $item ) { |
|
| 16 | 16 | |
| 17 | - if ( empty( $this->queue ) || $item !== $this->queue[ count( $this->queue ) - 1 ] ) { |
|
| 18 | - $this->queue[] = $item; |
|
| 19 | - } |
|
| 17 | + if ( empty( $this->queue ) || $item !== $this->queue[ count( $this->queue ) - 1 ] ) { |
|
| 18 | + $this->queue[] = $item; |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - } |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - public function shutdown() { |
|
| 24 | - foreach ( $this->queue as $callback ) { |
|
| 25 | - call_user_func( array( $this, $callback[0] ), $callback[1] ); |
|
| 26 | - } |
|
| 27 | - } |
|
| 23 | + public function shutdown() { |
|
| 24 | + foreach ( $this->queue as $callback ) { |
|
| 25 | + call_user_func( array( $this, $callback[0] ), $callback[1] ); |
|
| 26 | + } |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | 29 | } |
@@ -8,21 +8,21 @@ |
||
| 8 | 8 | |
| 9 | 9 | function __construct() { |
| 10 | 10 | |
| 11 | - add_action( 'shutdown', array( $this, 'shutdown' ) ); |
|
| 11 | + add_action('shutdown', array($this, 'shutdown')); |
|
| 12 | 12 | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - protected function enqueue( $item ) { |
|
| 15 | + protected function enqueue($item) { |
|
| 16 | 16 | |
| 17 | - if ( empty( $this->queue ) || $item !== $this->queue[ count( $this->queue ) - 1 ] ) { |
|
| 17 | + if (empty($this->queue) || $item !== $this->queue[count($this->queue) - 1]) { |
|
| 18 | 18 | $this->queue[] = $item; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | public function shutdown() { |
| 24 | - foreach ( $this->queue as $callback ) { |
|
| 25 | - call_user_func( array( $this, $callback[0] ), $callback[1] ); |
|
| 24 | + foreach ($this->queue as $callback) { |
|
| 25 | + call_user_func(array($this, $callback[0]), $callback[1]); |
|
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | |
@@ -66,1556 +66,1556 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | class Wordlift { |
| 68 | 68 | |
| 69 | - //<editor-fold desc="## FIELDS"> |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
| 73 | - * the plugin. |
|
| 74 | - * |
|
| 75 | - * @since 1.0.0 |
|
| 76 | - * @access protected |
|
| 77 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 78 | - */ |
|
| 79 | - protected $loader; |
|
| 80 | - |
|
| 81 | - /** |
|
| 82 | - * The unique identifier of this plugin. |
|
| 83 | - * |
|
| 84 | - * @since 1.0.0 |
|
| 85 | - * @access protected |
|
| 86 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 87 | - */ |
|
| 88 | - protected $plugin_name; |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * The current version of the plugin. |
|
| 92 | - * |
|
| 93 | - * @since 1.0.0 |
|
| 94 | - * @access protected |
|
| 95 | - * @var string $version The current version of the plugin. |
|
| 96 | - */ |
|
| 97 | - protected $version; |
|
| 98 | - |
|
| 99 | - /** |
|
| 100 | - * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 101 | - * |
|
| 102 | - * @since 3.12.0 |
|
| 103 | - * @access protected |
|
| 104 | - * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 105 | - */ |
|
| 106 | - protected $tinymce_adapter; |
|
| 107 | - |
|
| 108 | - /** |
|
| 109 | - * The {@link Faq_Tinymce_Adapter} instance |
|
| 110 | - * @since 3.26.0 |
|
| 111 | - * @access protected |
|
| 112 | - * @var Faq_Tinymce_Adapter $faq_tinymce_adapter . |
|
| 113 | - */ |
|
| 114 | - //protected $faq_tinymce_adapter; |
|
| 115 | - |
|
| 116 | - /** |
|
| 117 | - * The Thumbnail service. |
|
| 118 | - * |
|
| 119 | - * @since 3.1.5 |
|
| 120 | - * @access private |
|
| 121 | - * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 122 | - */ |
|
| 123 | - private $thumbnail_service; |
|
| 124 | - |
|
| 125 | - /** |
|
| 126 | - * The UI service. |
|
| 127 | - * |
|
| 128 | - * @since 3.2.0 |
|
| 129 | - * @access private |
|
| 130 | - * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 131 | - */ |
|
| 132 | - private $ui_service; |
|
| 133 | - |
|
| 134 | - /** |
|
| 135 | - * The Schema service. |
|
| 136 | - * |
|
| 137 | - * @since 3.3.0 |
|
| 138 | - * @access protected |
|
| 139 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 140 | - */ |
|
| 141 | - protected $schema_service; |
|
| 142 | - |
|
| 143 | - /** |
|
| 144 | - * The Entity service. |
|
| 145 | - * |
|
| 146 | - * @since 3.1.0 |
|
| 147 | - * @access protected |
|
| 148 | - * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 149 | - */ |
|
| 150 | - protected $entity_service; |
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * The Topic Taxonomy service. |
|
| 154 | - * |
|
| 155 | - * @since 3.5.0 |
|
| 156 | - * @access private |
|
| 157 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 158 | - */ |
|
| 159 | - private $topic_taxonomy_service; |
|
| 160 | - |
|
| 161 | - /** |
|
| 162 | - * The Entity Types Taxonomy service. |
|
| 163 | - * |
|
| 164 | - * @since 3.18.0 |
|
| 165 | - * @access private |
|
| 166 | - * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 167 | - */ |
|
| 168 | - private $entity_types_taxonomy_service; |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * The User service. |
|
| 172 | - * |
|
| 173 | - * @since 3.1.7 |
|
| 174 | - * @access protected |
|
| 175 | - * @var \Wordlift_User_Service $user_service The User service. |
|
| 176 | - */ |
|
| 177 | - protected $user_service; |
|
| 178 | - |
|
| 179 | - /** |
|
| 180 | - * The Timeline service. |
|
| 181 | - * |
|
| 182 | - * @since 3.1.0 |
|
| 183 | - * @access private |
|
| 184 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 185 | - */ |
|
| 186 | - private $timeline_service; |
|
| 187 | - |
|
| 188 | - /** |
|
| 189 | - * The Redirect service. |
|
| 190 | - * |
|
| 191 | - * @since 3.2.0 |
|
| 192 | - * @access private |
|
| 193 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 194 | - */ |
|
| 195 | - private $redirect_service; |
|
| 196 | - |
|
| 197 | - /** |
|
| 198 | - * The Notice service. |
|
| 199 | - * |
|
| 200 | - * @since 3.3.0 |
|
| 201 | - * @access private |
|
| 202 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 203 | - */ |
|
| 204 | - private $notice_service; |
|
| 205 | - |
|
| 206 | - /** |
|
| 207 | - * The Entity list customization. |
|
| 208 | - * |
|
| 209 | - * @since 3.3.0 |
|
| 210 | - * @access protected |
|
| 211 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 212 | - */ |
|
| 213 | - protected $entity_list_service; |
|
| 214 | - |
|
| 215 | - /** |
|
| 216 | - * The Entity Types Taxonomy Walker. |
|
| 217 | - * |
|
| 218 | - * @since 3.1.0 |
|
| 219 | - * @access private |
|
| 220 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 221 | - */ |
|
| 222 | - private $entity_types_taxonomy_walker; |
|
| 223 | - |
|
| 224 | - /** |
|
| 225 | - * The ShareThis service. |
|
| 226 | - * |
|
| 227 | - * @since 3.2.0 |
|
| 228 | - * @access private |
|
| 229 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 230 | - */ |
|
| 231 | - private $sharethis_service; |
|
| 232 | - |
|
| 233 | - /** |
|
| 234 | - * The PrimaShop adapter. |
|
| 235 | - * |
|
| 236 | - * @since 3.2.3 |
|
| 237 | - * @access private |
|
| 238 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 239 | - */ |
|
| 240 | - private $primashop_adapter; |
|
| 241 | - |
|
| 242 | - /** |
|
| 243 | - * The WordLift Dashboard adapter. |
|
| 244 | - * |
|
| 245 | - * @since 3.4.0 |
|
| 246 | - * @access private |
|
| 247 | - * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 248 | - */ |
|
| 249 | - private $dashboard_service; |
|
| 250 | - |
|
| 251 | - /** |
|
| 252 | - * The entity type service. |
|
| 253 | - * |
|
| 254 | - * @since 3.6.0 |
|
| 255 | - * @access private |
|
| 256 | - * @var \Wordlift_Entity_Post_Type_Service |
|
| 257 | - */ |
|
| 258 | - private $entity_post_type_service; |
|
| 259 | - |
|
| 260 | - /** |
|
| 261 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 262 | - * |
|
| 263 | - * @since 3.6.0 |
|
| 264 | - * @access private |
|
| 265 | - * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 266 | - */ |
|
| 267 | - private $entity_link_service; |
|
| 268 | - |
|
| 269 | - /** |
|
| 270 | - * A {@link Wordlift_Sparql_Service} instance. |
|
| 271 | - * |
|
| 272 | - * @since 3.6.0 |
|
| 273 | - * @access protected |
|
| 274 | - * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 275 | - */ |
|
| 276 | - protected $sparql_service; |
|
| 277 | - |
|
| 278 | - /** |
|
| 279 | - * A {@link Wordlift_Import_Service} instance. |
|
| 280 | - * |
|
| 281 | - * @since 3.6.0 |
|
| 282 | - * @access private |
|
| 283 | - * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 284 | - */ |
|
| 285 | - private $import_service; |
|
| 286 | - |
|
| 287 | - /** |
|
| 288 | - * A {@link Wordlift_Rebuild_Service} instance. |
|
| 289 | - * |
|
| 290 | - * @since 3.6.0 |
|
| 291 | - * @access private |
|
| 292 | - * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 293 | - */ |
|
| 294 | - private $rebuild_service; |
|
| 295 | - |
|
| 296 | - /** |
|
| 297 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
| 298 | - * |
|
| 299 | - * @since 3.7.0 |
|
| 300 | - * @access protected |
|
| 301 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 302 | - */ |
|
| 303 | - protected $jsonld_service; |
|
| 304 | - |
|
| 305 | - /** |
|
| 306 | - * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 307 | - * |
|
| 308 | - * @since 3.14.0 |
|
| 309 | - * @access protected |
|
| 310 | - * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 311 | - */ |
|
| 312 | - protected $jsonld_website_converter; |
|
| 313 | - |
|
| 314 | - /** |
|
| 315 | - * A {@link Wordlift_Property_Factory} instance. |
|
| 316 | - * |
|
| 317 | - * @since 3.7.0 |
|
| 318 | - * @access private |
|
| 319 | - * @var \Wordlift_Property_Factory $property_factory |
|
| 320 | - */ |
|
| 321 | - private $property_factory; |
|
| 322 | - |
|
| 323 | - /** |
|
| 324 | - * The 'Download Your Data' page. |
|
| 325 | - * |
|
| 326 | - * @since 3.6.0 |
|
| 327 | - * @access private |
|
| 328 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 329 | - */ |
|
| 330 | - private $download_your_data_page; |
|
| 331 | - |
|
| 332 | - /** |
|
| 333 | - * The 'WordLift Settings' page. |
|
| 334 | - * |
|
| 335 | - * @since 3.11.0 |
|
| 336 | - * @access protected |
|
| 337 | - * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 338 | - */ |
|
| 339 | - protected $settings_page; |
|
| 340 | - |
|
| 341 | - /** |
|
| 342 | - * The install wizard page. |
|
| 343 | - * |
|
| 344 | - * @since 3.9.0 |
|
| 345 | - * @access private |
|
| 346 | - * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 347 | - */ |
|
| 348 | - public $admin_setup; |
|
| 349 | - |
|
| 350 | - /** |
|
| 351 | - * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 352 | - * linking of entities to their pages. |
|
| 353 | - * |
|
| 354 | - * @since 3.8.0 |
|
| 355 | - * @access private |
|
| 356 | - * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 357 | - */ |
|
| 358 | - private $content_filter_service; |
|
| 359 | - |
|
| 360 | - /** |
|
| 361 | - * The Faq Content filter service |
|
| 362 | - * @since 3.26.0 |
|
| 363 | - * @access private |
|
| 364 | - * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
| 365 | - */ |
|
| 366 | - private $faq_content_filter_service; |
|
| 367 | - |
|
| 368 | - /** |
|
| 369 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 370 | - * |
|
| 371 | - * @since 3.9.0 |
|
| 372 | - * @access private |
|
| 373 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 374 | - */ |
|
| 375 | - private $key_validation_service; |
|
| 376 | - |
|
| 377 | - /** |
|
| 378 | - * A {@link Wordlift_Rating_Service} instance. |
|
| 379 | - * |
|
| 380 | - * @since 3.10.0 |
|
| 381 | - * @access private |
|
| 382 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 383 | - */ |
|
| 384 | - private $rating_service; |
|
| 385 | - |
|
| 386 | - /** |
|
| 387 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 388 | - * |
|
| 389 | - * @since 3.10.0 |
|
| 390 | - * @access protected |
|
| 391 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 392 | - */ |
|
| 393 | - protected $post_to_jsonld_converter; |
|
| 394 | - |
|
| 395 | - /** |
|
| 396 | - * A {@link Wordlift_Configuration_Service} instance. |
|
| 397 | - * |
|
| 398 | - * @since 3.10.0 |
|
| 399 | - * @access protected |
|
| 400 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 401 | - */ |
|
| 402 | - protected $configuration_service; |
|
| 403 | - |
|
| 404 | - /** |
|
| 405 | - * A {@link Wordlift_Install_Service} instance. |
|
| 406 | - * |
|
| 407 | - * @since 3.18.0 |
|
| 408 | - * @access protected |
|
| 409 | - * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 410 | - */ |
|
| 411 | - protected $install_service; |
|
| 412 | - |
|
| 413 | - /** |
|
| 414 | - * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 415 | - * |
|
| 416 | - * @since 3.10.0 |
|
| 417 | - * @access protected |
|
| 418 | - * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 419 | - */ |
|
| 420 | - protected $entity_type_service; |
|
| 421 | - |
|
| 422 | - /** |
|
| 423 | - * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 424 | - * |
|
| 425 | - * @since 3.10.0 |
|
| 426 | - * @access protected |
|
| 427 | - * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 428 | - */ |
|
| 429 | - protected $entity_post_to_jsonld_converter; |
|
| 430 | - |
|
| 431 | - /** |
|
| 432 | - * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 433 | - * |
|
| 434 | - * @since 3.10.0 |
|
| 435 | - * @access protected |
|
| 436 | - * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 437 | - */ |
|
| 438 | - protected $postid_to_jsonld_converter; |
|
| 439 | - |
|
| 440 | - /** |
|
| 441 | - * The {@link Wordlift_Admin_Status_Page} class. |
|
| 442 | - * |
|
| 443 | - * @since 3.9.8 |
|
| 444 | - * @access private |
|
| 445 | - * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 446 | - */ |
|
| 447 | - private $status_page; |
|
| 448 | - |
|
| 449 | - /** |
|
| 450 | - * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 451 | - * |
|
| 452 | - * @since 3.11.0 |
|
| 453 | - * @access protected |
|
| 454 | - * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 455 | - */ |
|
| 456 | - protected $category_taxonomy_service; |
|
| 457 | - |
|
| 458 | - /** |
|
| 459 | - * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 460 | - * |
|
| 461 | - * @since 3.11.0 |
|
| 462 | - * @access protected |
|
| 463 | - * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 464 | - */ |
|
| 465 | - protected $entity_page_service; |
|
| 466 | - |
|
| 467 | - /** |
|
| 468 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 469 | - * |
|
| 470 | - * @since 3.11.0 |
|
| 471 | - * @access protected |
|
| 472 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 473 | - */ |
|
| 474 | - protected $settings_page_action_link; |
|
| 475 | - |
|
| 476 | - /** |
|
| 477 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 478 | - * |
|
| 479 | - * @since 3.11.0 |
|
| 480 | - * @access protected |
|
| 481 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 482 | - */ |
|
| 483 | - protected $analytics_settings_page_action_link; |
|
| 484 | - |
|
| 485 | - /** |
|
| 486 | - * The {@link Wordlift_Analytics_Connect} class. |
|
| 487 | - * |
|
| 488 | - * @since 3.11.0 |
|
| 489 | - * @access protected |
|
| 490 | - * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 491 | - */ |
|
| 492 | - protected $analytics_connect; |
|
| 493 | - |
|
| 494 | - /** |
|
| 495 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 496 | - * |
|
| 497 | - * @since 3.11.0 |
|
| 498 | - * @access protected |
|
| 499 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 500 | - */ |
|
| 501 | - protected $publisher_ajax_adapter; |
|
| 502 | - |
|
| 503 | - /** |
|
| 504 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 505 | - * |
|
| 506 | - * @since 3.11.0 |
|
| 507 | - * @access protected |
|
| 508 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 509 | - */ |
|
| 510 | - protected $input_element; |
|
| 511 | - |
|
| 512 | - /** |
|
| 513 | - * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 514 | - * |
|
| 515 | - * @since 3.13.0 |
|
| 516 | - * @access protected |
|
| 517 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 518 | - */ |
|
| 519 | - protected $radio_input_element; |
|
| 520 | - |
|
| 521 | - /** |
|
| 522 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 523 | - * |
|
| 524 | - * @since 3.11.0 |
|
| 525 | - * @access protected |
|
| 526 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 527 | - */ |
|
| 528 | - protected $language_select_element; |
|
| 529 | - |
|
| 530 | - /** |
|
| 531 | - * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 532 | - * |
|
| 533 | - * @since 3.18.0 |
|
| 534 | - * @access protected |
|
| 535 | - * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 536 | - */ |
|
| 537 | - protected $country_select_element; |
|
| 538 | - |
|
| 539 | - /** |
|
| 540 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 541 | - * |
|
| 542 | - * @since 3.11.0 |
|
| 543 | - * @access protected |
|
| 544 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 545 | - */ |
|
| 546 | - protected $publisher_element; |
|
| 547 | - |
|
| 548 | - /** |
|
| 549 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 550 | - * |
|
| 551 | - * @since 3.11.0 |
|
| 552 | - * @access protected |
|
| 553 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 554 | - */ |
|
| 555 | - protected $select2_element; |
|
| 556 | - |
|
| 557 | - /** |
|
| 558 | - * The controller for the entity type list admin page |
|
| 559 | - * |
|
| 560 | - * @since 3.11.0 |
|
| 561 | - * @access private |
|
| 562 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 563 | - */ |
|
| 564 | - private $entity_type_admin_page; |
|
| 565 | - |
|
| 566 | - /** |
|
| 567 | - * The controller for the entity type settings admin page |
|
| 568 | - * |
|
| 569 | - * @since 3.11.0 |
|
| 570 | - * @access private |
|
| 571 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 572 | - */ |
|
| 573 | - private $entity_type_settings_admin_page; |
|
| 574 | - |
|
| 575 | - /** |
|
| 576 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 577 | - * |
|
| 578 | - * @since 3.11.0 |
|
| 579 | - * @access protected |
|
| 580 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 581 | - */ |
|
| 582 | - protected $related_entities_cloud_widget; |
|
| 583 | - |
|
| 584 | - /** |
|
| 585 | - * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 586 | - * |
|
| 587 | - * @since 3.14.0 |
|
| 588 | - * @access protected |
|
| 589 | - * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 590 | - */ |
|
| 591 | - protected $author_element; |
|
| 592 | - |
|
| 593 | - /** |
|
| 594 | - * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 595 | - * |
|
| 596 | - * @since 3.12.0 |
|
| 597 | - * @access protected |
|
| 598 | - * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 599 | - */ |
|
| 600 | - protected $sample_data_service; |
|
| 601 | - |
|
| 602 | - /** |
|
| 603 | - * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 604 | - * |
|
| 605 | - * @since 3.12.0 |
|
| 606 | - * @access protected |
|
| 607 | - * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 608 | - */ |
|
| 609 | - protected $sample_data_ajax_adapter; |
|
| 610 | - |
|
| 611 | - /** |
|
| 612 | - * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 613 | - * |
|
| 614 | - * @since 3.14.3 |
|
| 615 | - * @access private |
|
| 616 | - * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 617 | - */ |
|
| 618 | - private $relation_rebuild_service; |
|
| 619 | - |
|
| 620 | - /** |
|
| 621 | - * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 622 | - * |
|
| 623 | - * @since 3.14.3 |
|
| 624 | - * @access private |
|
| 625 | - * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 626 | - */ |
|
| 627 | - private $relation_rebuild_adapter; |
|
| 628 | - |
|
| 629 | - /** |
|
| 630 | - * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 631 | - * |
|
| 632 | - * @since 3.18.0 |
|
| 633 | - * @access private |
|
| 634 | - * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 635 | - */ |
|
| 636 | - private $reference_rebuild_service; |
|
| 637 | - |
|
| 638 | - /** |
|
| 639 | - * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 640 | - * |
|
| 641 | - * @since 3.16.0 |
|
| 642 | - * @access protected |
|
| 643 | - * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 644 | - */ |
|
| 645 | - protected $google_analytics_export_service; |
|
| 646 | - |
|
| 647 | - /** |
|
| 648 | - * {@link Wordlift}'s singleton instance. |
|
| 649 | - * |
|
| 650 | - * @since 3.15.0 |
|
| 651 | - * @access protected |
|
| 652 | - * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 653 | - */ |
|
| 654 | - protected $entity_type_adapter; |
|
| 655 | - |
|
| 656 | - /** |
|
| 657 | - * The {@link Wordlift_Storage_Factory} instance. |
|
| 658 | - * |
|
| 659 | - * @since 3.15.0 |
|
| 660 | - * @access protected |
|
| 661 | - * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 662 | - */ |
|
| 663 | - protected $storage_factory; |
|
| 664 | - |
|
| 665 | - /** |
|
| 666 | - * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 667 | - * |
|
| 668 | - * @since 3.15.0 |
|
| 669 | - * @access protected |
|
| 670 | - * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 671 | - */ |
|
| 672 | - protected $rendition_factory; |
|
| 673 | - |
|
| 674 | - /** |
|
| 675 | - * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 676 | - * |
|
| 677 | - * @since 3.15.0 |
|
| 678 | - * @access private |
|
| 679 | - * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 680 | - */ |
|
| 681 | - private $autocomplete_adapter; |
|
| 682 | - |
|
| 683 | - /** |
|
| 684 | - * The {@link Wordlift_Relation_Service} instance. |
|
| 685 | - * |
|
| 686 | - * @since 3.15.0 |
|
| 687 | - * @access protected |
|
| 688 | - * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 689 | - */ |
|
| 690 | - protected $relation_service; |
|
| 691 | - |
|
| 692 | - /** |
|
| 693 | - * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 694 | - * |
|
| 695 | - * @since 3.16.0 |
|
| 696 | - * @access protected |
|
| 697 | - * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 698 | - * |
|
| 699 | - */ |
|
| 700 | - protected $cached_postid_to_jsonld_converter; |
|
| 701 | - |
|
| 702 | - /** |
|
| 703 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 704 | - * |
|
| 705 | - * @since 3.16.3 |
|
| 706 | - * @access protected |
|
| 707 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 708 | - */ |
|
| 709 | - protected $entity_uri_service; |
|
| 710 | - |
|
| 711 | - /** |
|
| 712 | - * The {@link Wordlift_Publisher_Service} instance. |
|
| 713 | - * |
|
| 714 | - * @since 3.19.0 |
|
| 715 | - * @access protected |
|
| 716 | - * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 717 | - */ |
|
| 718 | - protected $publisher_service; |
|
| 719 | - |
|
| 720 | - /** |
|
| 721 | - * The {@link Wordlift_Context_Cards_Service} instance. |
|
| 722 | - * |
|
| 723 | - * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
| 724 | - */ |
|
| 725 | - protected $context_cards_service; |
|
| 726 | - |
|
| 727 | - /** |
|
| 728 | - * {@link Wordlift}'s singleton instance. |
|
| 729 | - * |
|
| 730 | - * @since 3.11.2 |
|
| 731 | - * @access private |
|
| 732 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 733 | - */ |
|
| 734 | - private static $instance; |
|
| 735 | - |
|
| 736 | - //</editor-fold> |
|
| 737 | - |
|
| 738 | - /** |
|
| 739 | - * Define the core functionality of the plugin. |
|
| 740 | - * |
|
| 741 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 742 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 743 | - * the public-facing side of the site. |
|
| 744 | - * |
|
| 745 | - * @since 1.0.0 |
|
| 746 | - */ |
|
| 747 | - public function __construct() { |
|
| 748 | - |
|
| 749 | - self::$instance = $this; |
|
| 750 | - |
|
| 751 | - $this->plugin_name = 'wordlift'; |
|
| 752 | - $this->version = '3.27.7.1'; |
|
| 753 | - $this->load_dependencies(); |
|
| 754 | - $this->set_locale(); |
|
| 755 | - $this->define_admin_hooks(); |
|
| 756 | - $this->define_public_hooks(); |
|
| 757 | - |
|
| 758 | - // If we're in `WP_CLI` load the related files. |
|
| 759 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 760 | - $this->load_cli_dependencies(); |
|
| 761 | - } |
|
| 762 | - |
|
| 763 | - } |
|
| 764 | - |
|
| 765 | - /** |
|
| 766 | - * Get the singleton instance. |
|
| 767 | - * |
|
| 768 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 769 | - * @since 3.11.2 |
|
| 770 | - * |
|
| 771 | - */ |
|
| 772 | - public static function get_instance() { |
|
| 773 | - |
|
| 774 | - return self::$instance; |
|
| 775 | - } |
|
| 776 | - |
|
| 777 | - /** |
|
| 778 | - * Load the required dependencies for this plugin. |
|
| 779 | - * |
|
| 780 | - * Include the following files that make up the plugin: |
|
| 781 | - * |
|
| 782 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 783 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 784 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 785 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 786 | - * |
|
| 787 | - * Create an instance of the loader which will be used to register the hooks |
|
| 788 | - * with WordPress. |
|
| 789 | - * |
|
| 790 | - * @throws Exception |
|
| 791 | - * @since 1.0.0 |
|
| 792 | - * @access private |
|
| 793 | - */ |
|
| 794 | - private function load_dependencies() { |
|
| 795 | - |
|
| 796 | - /** |
|
| 797 | - * The class responsible for orchestrating the actions and filters of the |
|
| 798 | - * core plugin. |
|
| 799 | - */ |
|
| 800 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 801 | - |
|
| 802 | - // The class responsible for plugin uninstall. |
|
| 803 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 804 | - |
|
| 805 | - /** |
|
| 806 | - * The class responsible for defining internationalization functionality |
|
| 807 | - * of the plugin. |
|
| 808 | - */ |
|
| 809 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 810 | - |
|
| 811 | - /** |
|
| 812 | - * WordLift's supported languages. |
|
| 813 | - */ |
|
| 814 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 815 | - |
|
| 816 | - /** |
|
| 817 | - * WordLift's supported countries. |
|
| 818 | - */ |
|
| 819 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 820 | - |
|
| 821 | - /** |
|
| 822 | - * Provide support functions to sanitize data. |
|
| 823 | - */ |
|
| 824 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 825 | - |
|
| 826 | - /** Services. */ |
|
| 827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 828 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 829 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 830 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 831 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 832 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 833 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 834 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 835 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 836 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 837 | - |
|
| 838 | - /** |
|
| 839 | - * The Query builder. |
|
| 840 | - */ |
|
| 841 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 842 | - |
|
| 843 | - /** |
|
| 844 | - * The Schema service. |
|
| 845 | - */ |
|
| 846 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 847 | - |
|
| 848 | - /** |
|
| 849 | - * The schema:url property service. |
|
| 850 | - */ |
|
| 851 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 852 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 853 | - |
|
| 854 | - /** |
|
| 855 | - * The UI service. |
|
| 856 | - */ |
|
| 857 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 858 | - |
|
| 859 | - /** |
|
| 860 | - * The Thumbnail service. |
|
| 861 | - */ |
|
| 862 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 863 | - |
|
| 864 | - /** |
|
| 865 | - * The Entity Types Taxonomy service. |
|
| 866 | - */ |
|
| 867 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 868 | - |
|
| 869 | - /** |
|
| 870 | - * The Entity service. |
|
| 871 | - */ |
|
| 872 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 873 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 874 | - |
|
| 875 | - // Add the entity rating service. |
|
| 876 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 877 | - |
|
| 878 | - /** |
|
| 879 | - * The User service. |
|
| 880 | - */ |
|
| 881 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 882 | - |
|
| 883 | - /** |
|
| 884 | - * The Timeline service. |
|
| 885 | - */ |
|
| 886 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 887 | - |
|
| 888 | - /** |
|
| 889 | - * The Topic Taxonomy service. |
|
| 890 | - */ |
|
| 891 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 892 | - |
|
| 893 | - /** |
|
| 894 | - * The SPARQL service. |
|
| 895 | - */ |
|
| 896 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 897 | - |
|
| 898 | - /** |
|
| 899 | - * The WordLift import service. |
|
| 900 | - */ |
|
| 901 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 902 | - |
|
| 903 | - /** |
|
| 904 | - * The WordLift URI service. |
|
| 905 | - */ |
|
| 906 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 907 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 908 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 909 | - |
|
| 910 | - /** |
|
| 911 | - * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 912 | - */ |
|
| 913 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 914 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 915 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 916 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 917 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 918 | - |
|
| 919 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 920 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 921 | - |
|
| 922 | - /** |
|
| 923 | - * Load the converters. |
|
| 924 | - */ |
|
| 925 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 926 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 927 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 928 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 929 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 930 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 931 | - |
|
| 932 | - /** |
|
| 933 | - * Load cache-related files. |
|
| 934 | - */ |
|
| 935 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 936 | - |
|
| 937 | - /** |
|
| 938 | - * Load the content filter. |
|
| 939 | - */ |
|
| 940 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 941 | - |
|
| 942 | - /* |
|
| 69 | + //<editor-fold desc="## FIELDS"> |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
| 73 | + * the plugin. |
|
| 74 | + * |
|
| 75 | + * @since 1.0.0 |
|
| 76 | + * @access protected |
|
| 77 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 78 | + */ |
|
| 79 | + protected $loader; |
|
| 80 | + |
|
| 81 | + /** |
|
| 82 | + * The unique identifier of this plugin. |
|
| 83 | + * |
|
| 84 | + * @since 1.0.0 |
|
| 85 | + * @access protected |
|
| 86 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 87 | + */ |
|
| 88 | + protected $plugin_name; |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * The current version of the plugin. |
|
| 92 | + * |
|
| 93 | + * @since 1.0.0 |
|
| 94 | + * @access protected |
|
| 95 | + * @var string $version The current version of the plugin. |
|
| 96 | + */ |
|
| 97 | + protected $version; |
|
| 98 | + |
|
| 99 | + /** |
|
| 100 | + * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 101 | + * |
|
| 102 | + * @since 3.12.0 |
|
| 103 | + * @access protected |
|
| 104 | + * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 105 | + */ |
|
| 106 | + protected $tinymce_adapter; |
|
| 107 | + |
|
| 108 | + /** |
|
| 109 | + * The {@link Faq_Tinymce_Adapter} instance |
|
| 110 | + * @since 3.26.0 |
|
| 111 | + * @access protected |
|
| 112 | + * @var Faq_Tinymce_Adapter $faq_tinymce_adapter . |
|
| 113 | + */ |
|
| 114 | + //protected $faq_tinymce_adapter; |
|
| 115 | + |
|
| 116 | + /** |
|
| 117 | + * The Thumbnail service. |
|
| 118 | + * |
|
| 119 | + * @since 3.1.5 |
|
| 120 | + * @access private |
|
| 121 | + * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 122 | + */ |
|
| 123 | + private $thumbnail_service; |
|
| 124 | + |
|
| 125 | + /** |
|
| 126 | + * The UI service. |
|
| 127 | + * |
|
| 128 | + * @since 3.2.0 |
|
| 129 | + * @access private |
|
| 130 | + * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 131 | + */ |
|
| 132 | + private $ui_service; |
|
| 133 | + |
|
| 134 | + /** |
|
| 135 | + * The Schema service. |
|
| 136 | + * |
|
| 137 | + * @since 3.3.0 |
|
| 138 | + * @access protected |
|
| 139 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 140 | + */ |
|
| 141 | + protected $schema_service; |
|
| 142 | + |
|
| 143 | + /** |
|
| 144 | + * The Entity service. |
|
| 145 | + * |
|
| 146 | + * @since 3.1.0 |
|
| 147 | + * @access protected |
|
| 148 | + * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 149 | + */ |
|
| 150 | + protected $entity_service; |
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * The Topic Taxonomy service. |
|
| 154 | + * |
|
| 155 | + * @since 3.5.0 |
|
| 156 | + * @access private |
|
| 157 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 158 | + */ |
|
| 159 | + private $topic_taxonomy_service; |
|
| 160 | + |
|
| 161 | + /** |
|
| 162 | + * The Entity Types Taxonomy service. |
|
| 163 | + * |
|
| 164 | + * @since 3.18.0 |
|
| 165 | + * @access private |
|
| 166 | + * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 167 | + */ |
|
| 168 | + private $entity_types_taxonomy_service; |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * The User service. |
|
| 172 | + * |
|
| 173 | + * @since 3.1.7 |
|
| 174 | + * @access protected |
|
| 175 | + * @var \Wordlift_User_Service $user_service The User service. |
|
| 176 | + */ |
|
| 177 | + protected $user_service; |
|
| 178 | + |
|
| 179 | + /** |
|
| 180 | + * The Timeline service. |
|
| 181 | + * |
|
| 182 | + * @since 3.1.0 |
|
| 183 | + * @access private |
|
| 184 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 185 | + */ |
|
| 186 | + private $timeline_service; |
|
| 187 | + |
|
| 188 | + /** |
|
| 189 | + * The Redirect service. |
|
| 190 | + * |
|
| 191 | + * @since 3.2.0 |
|
| 192 | + * @access private |
|
| 193 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 194 | + */ |
|
| 195 | + private $redirect_service; |
|
| 196 | + |
|
| 197 | + /** |
|
| 198 | + * The Notice service. |
|
| 199 | + * |
|
| 200 | + * @since 3.3.0 |
|
| 201 | + * @access private |
|
| 202 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 203 | + */ |
|
| 204 | + private $notice_service; |
|
| 205 | + |
|
| 206 | + /** |
|
| 207 | + * The Entity list customization. |
|
| 208 | + * |
|
| 209 | + * @since 3.3.0 |
|
| 210 | + * @access protected |
|
| 211 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 212 | + */ |
|
| 213 | + protected $entity_list_service; |
|
| 214 | + |
|
| 215 | + /** |
|
| 216 | + * The Entity Types Taxonomy Walker. |
|
| 217 | + * |
|
| 218 | + * @since 3.1.0 |
|
| 219 | + * @access private |
|
| 220 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 221 | + */ |
|
| 222 | + private $entity_types_taxonomy_walker; |
|
| 223 | + |
|
| 224 | + /** |
|
| 225 | + * The ShareThis service. |
|
| 226 | + * |
|
| 227 | + * @since 3.2.0 |
|
| 228 | + * @access private |
|
| 229 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 230 | + */ |
|
| 231 | + private $sharethis_service; |
|
| 232 | + |
|
| 233 | + /** |
|
| 234 | + * The PrimaShop adapter. |
|
| 235 | + * |
|
| 236 | + * @since 3.2.3 |
|
| 237 | + * @access private |
|
| 238 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 239 | + */ |
|
| 240 | + private $primashop_adapter; |
|
| 241 | + |
|
| 242 | + /** |
|
| 243 | + * The WordLift Dashboard adapter. |
|
| 244 | + * |
|
| 245 | + * @since 3.4.0 |
|
| 246 | + * @access private |
|
| 247 | + * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 248 | + */ |
|
| 249 | + private $dashboard_service; |
|
| 250 | + |
|
| 251 | + /** |
|
| 252 | + * The entity type service. |
|
| 253 | + * |
|
| 254 | + * @since 3.6.0 |
|
| 255 | + * @access private |
|
| 256 | + * @var \Wordlift_Entity_Post_Type_Service |
|
| 257 | + */ |
|
| 258 | + private $entity_post_type_service; |
|
| 259 | + |
|
| 260 | + /** |
|
| 261 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 262 | + * |
|
| 263 | + * @since 3.6.0 |
|
| 264 | + * @access private |
|
| 265 | + * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 266 | + */ |
|
| 267 | + private $entity_link_service; |
|
| 268 | + |
|
| 269 | + /** |
|
| 270 | + * A {@link Wordlift_Sparql_Service} instance. |
|
| 271 | + * |
|
| 272 | + * @since 3.6.0 |
|
| 273 | + * @access protected |
|
| 274 | + * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 275 | + */ |
|
| 276 | + protected $sparql_service; |
|
| 277 | + |
|
| 278 | + /** |
|
| 279 | + * A {@link Wordlift_Import_Service} instance. |
|
| 280 | + * |
|
| 281 | + * @since 3.6.0 |
|
| 282 | + * @access private |
|
| 283 | + * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 284 | + */ |
|
| 285 | + private $import_service; |
|
| 286 | + |
|
| 287 | + /** |
|
| 288 | + * A {@link Wordlift_Rebuild_Service} instance. |
|
| 289 | + * |
|
| 290 | + * @since 3.6.0 |
|
| 291 | + * @access private |
|
| 292 | + * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 293 | + */ |
|
| 294 | + private $rebuild_service; |
|
| 295 | + |
|
| 296 | + /** |
|
| 297 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
| 298 | + * |
|
| 299 | + * @since 3.7.0 |
|
| 300 | + * @access protected |
|
| 301 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 302 | + */ |
|
| 303 | + protected $jsonld_service; |
|
| 304 | + |
|
| 305 | + /** |
|
| 306 | + * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 307 | + * |
|
| 308 | + * @since 3.14.0 |
|
| 309 | + * @access protected |
|
| 310 | + * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 311 | + */ |
|
| 312 | + protected $jsonld_website_converter; |
|
| 313 | + |
|
| 314 | + /** |
|
| 315 | + * A {@link Wordlift_Property_Factory} instance. |
|
| 316 | + * |
|
| 317 | + * @since 3.7.0 |
|
| 318 | + * @access private |
|
| 319 | + * @var \Wordlift_Property_Factory $property_factory |
|
| 320 | + */ |
|
| 321 | + private $property_factory; |
|
| 322 | + |
|
| 323 | + /** |
|
| 324 | + * The 'Download Your Data' page. |
|
| 325 | + * |
|
| 326 | + * @since 3.6.0 |
|
| 327 | + * @access private |
|
| 328 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 329 | + */ |
|
| 330 | + private $download_your_data_page; |
|
| 331 | + |
|
| 332 | + /** |
|
| 333 | + * The 'WordLift Settings' page. |
|
| 334 | + * |
|
| 335 | + * @since 3.11.0 |
|
| 336 | + * @access protected |
|
| 337 | + * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 338 | + */ |
|
| 339 | + protected $settings_page; |
|
| 340 | + |
|
| 341 | + /** |
|
| 342 | + * The install wizard page. |
|
| 343 | + * |
|
| 344 | + * @since 3.9.0 |
|
| 345 | + * @access private |
|
| 346 | + * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 347 | + */ |
|
| 348 | + public $admin_setup; |
|
| 349 | + |
|
| 350 | + /** |
|
| 351 | + * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 352 | + * linking of entities to their pages. |
|
| 353 | + * |
|
| 354 | + * @since 3.8.0 |
|
| 355 | + * @access private |
|
| 356 | + * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 357 | + */ |
|
| 358 | + private $content_filter_service; |
|
| 359 | + |
|
| 360 | + /** |
|
| 361 | + * The Faq Content filter service |
|
| 362 | + * @since 3.26.0 |
|
| 363 | + * @access private |
|
| 364 | + * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
| 365 | + */ |
|
| 366 | + private $faq_content_filter_service; |
|
| 367 | + |
|
| 368 | + /** |
|
| 369 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 370 | + * |
|
| 371 | + * @since 3.9.0 |
|
| 372 | + * @access private |
|
| 373 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 374 | + */ |
|
| 375 | + private $key_validation_service; |
|
| 376 | + |
|
| 377 | + /** |
|
| 378 | + * A {@link Wordlift_Rating_Service} instance. |
|
| 379 | + * |
|
| 380 | + * @since 3.10.0 |
|
| 381 | + * @access private |
|
| 382 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 383 | + */ |
|
| 384 | + private $rating_service; |
|
| 385 | + |
|
| 386 | + /** |
|
| 387 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 388 | + * |
|
| 389 | + * @since 3.10.0 |
|
| 390 | + * @access protected |
|
| 391 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 392 | + */ |
|
| 393 | + protected $post_to_jsonld_converter; |
|
| 394 | + |
|
| 395 | + /** |
|
| 396 | + * A {@link Wordlift_Configuration_Service} instance. |
|
| 397 | + * |
|
| 398 | + * @since 3.10.0 |
|
| 399 | + * @access protected |
|
| 400 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 401 | + */ |
|
| 402 | + protected $configuration_service; |
|
| 403 | + |
|
| 404 | + /** |
|
| 405 | + * A {@link Wordlift_Install_Service} instance. |
|
| 406 | + * |
|
| 407 | + * @since 3.18.0 |
|
| 408 | + * @access protected |
|
| 409 | + * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 410 | + */ |
|
| 411 | + protected $install_service; |
|
| 412 | + |
|
| 413 | + /** |
|
| 414 | + * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 415 | + * |
|
| 416 | + * @since 3.10.0 |
|
| 417 | + * @access protected |
|
| 418 | + * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 419 | + */ |
|
| 420 | + protected $entity_type_service; |
|
| 421 | + |
|
| 422 | + /** |
|
| 423 | + * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 424 | + * |
|
| 425 | + * @since 3.10.0 |
|
| 426 | + * @access protected |
|
| 427 | + * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 428 | + */ |
|
| 429 | + protected $entity_post_to_jsonld_converter; |
|
| 430 | + |
|
| 431 | + /** |
|
| 432 | + * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 433 | + * |
|
| 434 | + * @since 3.10.0 |
|
| 435 | + * @access protected |
|
| 436 | + * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 437 | + */ |
|
| 438 | + protected $postid_to_jsonld_converter; |
|
| 439 | + |
|
| 440 | + /** |
|
| 441 | + * The {@link Wordlift_Admin_Status_Page} class. |
|
| 442 | + * |
|
| 443 | + * @since 3.9.8 |
|
| 444 | + * @access private |
|
| 445 | + * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 446 | + */ |
|
| 447 | + private $status_page; |
|
| 448 | + |
|
| 449 | + /** |
|
| 450 | + * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 451 | + * |
|
| 452 | + * @since 3.11.0 |
|
| 453 | + * @access protected |
|
| 454 | + * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 455 | + */ |
|
| 456 | + protected $category_taxonomy_service; |
|
| 457 | + |
|
| 458 | + /** |
|
| 459 | + * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 460 | + * |
|
| 461 | + * @since 3.11.0 |
|
| 462 | + * @access protected |
|
| 463 | + * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 464 | + */ |
|
| 465 | + protected $entity_page_service; |
|
| 466 | + |
|
| 467 | + /** |
|
| 468 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 469 | + * |
|
| 470 | + * @since 3.11.0 |
|
| 471 | + * @access protected |
|
| 472 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 473 | + */ |
|
| 474 | + protected $settings_page_action_link; |
|
| 475 | + |
|
| 476 | + /** |
|
| 477 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 478 | + * |
|
| 479 | + * @since 3.11.0 |
|
| 480 | + * @access protected |
|
| 481 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 482 | + */ |
|
| 483 | + protected $analytics_settings_page_action_link; |
|
| 484 | + |
|
| 485 | + /** |
|
| 486 | + * The {@link Wordlift_Analytics_Connect} class. |
|
| 487 | + * |
|
| 488 | + * @since 3.11.0 |
|
| 489 | + * @access protected |
|
| 490 | + * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 491 | + */ |
|
| 492 | + protected $analytics_connect; |
|
| 493 | + |
|
| 494 | + /** |
|
| 495 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 496 | + * |
|
| 497 | + * @since 3.11.0 |
|
| 498 | + * @access protected |
|
| 499 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 500 | + */ |
|
| 501 | + protected $publisher_ajax_adapter; |
|
| 502 | + |
|
| 503 | + /** |
|
| 504 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 505 | + * |
|
| 506 | + * @since 3.11.0 |
|
| 507 | + * @access protected |
|
| 508 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 509 | + */ |
|
| 510 | + protected $input_element; |
|
| 511 | + |
|
| 512 | + /** |
|
| 513 | + * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 514 | + * |
|
| 515 | + * @since 3.13.0 |
|
| 516 | + * @access protected |
|
| 517 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 518 | + */ |
|
| 519 | + protected $radio_input_element; |
|
| 520 | + |
|
| 521 | + /** |
|
| 522 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 523 | + * |
|
| 524 | + * @since 3.11.0 |
|
| 525 | + * @access protected |
|
| 526 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 527 | + */ |
|
| 528 | + protected $language_select_element; |
|
| 529 | + |
|
| 530 | + /** |
|
| 531 | + * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 532 | + * |
|
| 533 | + * @since 3.18.0 |
|
| 534 | + * @access protected |
|
| 535 | + * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 536 | + */ |
|
| 537 | + protected $country_select_element; |
|
| 538 | + |
|
| 539 | + /** |
|
| 540 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 541 | + * |
|
| 542 | + * @since 3.11.0 |
|
| 543 | + * @access protected |
|
| 544 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 545 | + */ |
|
| 546 | + protected $publisher_element; |
|
| 547 | + |
|
| 548 | + /** |
|
| 549 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 550 | + * |
|
| 551 | + * @since 3.11.0 |
|
| 552 | + * @access protected |
|
| 553 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 554 | + */ |
|
| 555 | + protected $select2_element; |
|
| 556 | + |
|
| 557 | + /** |
|
| 558 | + * The controller for the entity type list admin page |
|
| 559 | + * |
|
| 560 | + * @since 3.11.0 |
|
| 561 | + * @access private |
|
| 562 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 563 | + */ |
|
| 564 | + private $entity_type_admin_page; |
|
| 565 | + |
|
| 566 | + /** |
|
| 567 | + * The controller for the entity type settings admin page |
|
| 568 | + * |
|
| 569 | + * @since 3.11.0 |
|
| 570 | + * @access private |
|
| 571 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 572 | + */ |
|
| 573 | + private $entity_type_settings_admin_page; |
|
| 574 | + |
|
| 575 | + /** |
|
| 576 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 577 | + * |
|
| 578 | + * @since 3.11.0 |
|
| 579 | + * @access protected |
|
| 580 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 581 | + */ |
|
| 582 | + protected $related_entities_cloud_widget; |
|
| 583 | + |
|
| 584 | + /** |
|
| 585 | + * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 586 | + * |
|
| 587 | + * @since 3.14.0 |
|
| 588 | + * @access protected |
|
| 589 | + * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 590 | + */ |
|
| 591 | + protected $author_element; |
|
| 592 | + |
|
| 593 | + /** |
|
| 594 | + * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 595 | + * |
|
| 596 | + * @since 3.12.0 |
|
| 597 | + * @access protected |
|
| 598 | + * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 599 | + */ |
|
| 600 | + protected $sample_data_service; |
|
| 601 | + |
|
| 602 | + /** |
|
| 603 | + * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 604 | + * |
|
| 605 | + * @since 3.12.0 |
|
| 606 | + * @access protected |
|
| 607 | + * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 608 | + */ |
|
| 609 | + protected $sample_data_ajax_adapter; |
|
| 610 | + |
|
| 611 | + /** |
|
| 612 | + * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 613 | + * |
|
| 614 | + * @since 3.14.3 |
|
| 615 | + * @access private |
|
| 616 | + * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 617 | + */ |
|
| 618 | + private $relation_rebuild_service; |
|
| 619 | + |
|
| 620 | + /** |
|
| 621 | + * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 622 | + * |
|
| 623 | + * @since 3.14.3 |
|
| 624 | + * @access private |
|
| 625 | + * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 626 | + */ |
|
| 627 | + private $relation_rebuild_adapter; |
|
| 628 | + |
|
| 629 | + /** |
|
| 630 | + * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 631 | + * |
|
| 632 | + * @since 3.18.0 |
|
| 633 | + * @access private |
|
| 634 | + * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 635 | + */ |
|
| 636 | + private $reference_rebuild_service; |
|
| 637 | + |
|
| 638 | + /** |
|
| 639 | + * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 640 | + * |
|
| 641 | + * @since 3.16.0 |
|
| 642 | + * @access protected |
|
| 643 | + * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 644 | + */ |
|
| 645 | + protected $google_analytics_export_service; |
|
| 646 | + |
|
| 647 | + /** |
|
| 648 | + * {@link Wordlift}'s singleton instance. |
|
| 649 | + * |
|
| 650 | + * @since 3.15.0 |
|
| 651 | + * @access protected |
|
| 652 | + * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 653 | + */ |
|
| 654 | + protected $entity_type_adapter; |
|
| 655 | + |
|
| 656 | + /** |
|
| 657 | + * The {@link Wordlift_Storage_Factory} instance. |
|
| 658 | + * |
|
| 659 | + * @since 3.15.0 |
|
| 660 | + * @access protected |
|
| 661 | + * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 662 | + */ |
|
| 663 | + protected $storage_factory; |
|
| 664 | + |
|
| 665 | + /** |
|
| 666 | + * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 667 | + * |
|
| 668 | + * @since 3.15.0 |
|
| 669 | + * @access protected |
|
| 670 | + * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 671 | + */ |
|
| 672 | + protected $rendition_factory; |
|
| 673 | + |
|
| 674 | + /** |
|
| 675 | + * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 676 | + * |
|
| 677 | + * @since 3.15.0 |
|
| 678 | + * @access private |
|
| 679 | + * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 680 | + */ |
|
| 681 | + private $autocomplete_adapter; |
|
| 682 | + |
|
| 683 | + /** |
|
| 684 | + * The {@link Wordlift_Relation_Service} instance. |
|
| 685 | + * |
|
| 686 | + * @since 3.15.0 |
|
| 687 | + * @access protected |
|
| 688 | + * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 689 | + */ |
|
| 690 | + protected $relation_service; |
|
| 691 | + |
|
| 692 | + /** |
|
| 693 | + * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 694 | + * |
|
| 695 | + * @since 3.16.0 |
|
| 696 | + * @access protected |
|
| 697 | + * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 698 | + * |
|
| 699 | + */ |
|
| 700 | + protected $cached_postid_to_jsonld_converter; |
|
| 701 | + |
|
| 702 | + /** |
|
| 703 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 704 | + * |
|
| 705 | + * @since 3.16.3 |
|
| 706 | + * @access protected |
|
| 707 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 708 | + */ |
|
| 709 | + protected $entity_uri_service; |
|
| 710 | + |
|
| 711 | + /** |
|
| 712 | + * The {@link Wordlift_Publisher_Service} instance. |
|
| 713 | + * |
|
| 714 | + * @since 3.19.0 |
|
| 715 | + * @access protected |
|
| 716 | + * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 717 | + */ |
|
| 718 | + protected $publisher_service; |
|
| 719 | + |
|
| 720 | + /** |
|
| 721 | + * The {@link Wordlift_Context_Cards_Service} instance. |
|
| 722 | + * |
|
| 723 | + * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
| 724 | + */ |
|
| 725 | + protected $context_cards_service; |
|
| 726 | + |
|
| 727 | + /** |
|
| 728 | + * {@link Wordlift}'s singleton instance. |
|
| 729 | + * |
|
| 730 | + * @since 3.11.2 |
|
| 731 | + * @access private |
|
| 732 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 733 | + */ |
|
| 734 | + private static $instance; |
|
| 735 | + |
|
| 736 | + //</editor-fold> |
|
| 737 | + |
|
| 738 | + /** |
|
| 739 | + * Define the core functionality of the plugin. |
|
| 740 | + * |
|
| 741 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 742 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 743 | + * the public-facing side of the site. |
|
| 744 | + * |
|
| 745 | + * @since 1.0.0 |
|
| 746 | + */ |
|
| 747 | + public function __construct() { |
|
| 748 | + |
|
| 749 | + self::$instance = $this; |
|
| 750 | + |
|
| 751 | + $this->plugin_name = 'wordlift'; |
|
| 752 | + $this->version = '3.27.7.1'; |
|
| 753 | + $this->load_dependencies(); |
|
| 754 | + $this->set_locale(); |
|
| 755 | + $this->define_admin_hooks(); |
|
| 756 | + $this->define_public_hooks(); |
|
| 757 | + |
|
| 758 | + // If we're in `WP_CLI` load the related files. |
|
| 759 | + if ( class_exists( 'WP_CLI' ) ) { |
|
| 760 | + $this->load_cli_dependencies(); |
|
| 761 | + } |
|
| 762 | + |
|
| 763 | + } |
|
| 764 | + |
|
| 765 | + /** |
|
| 766 | + * Get the singleton instance. |
|
| 767 | + * |
|
| 768 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 769 | + * @since 3.11.2 |
|
| 770 | + * |
|
| 771 | + */ |
|
| 772 | + public static function get_instance() { |
|
| 773 | + |
|
| 774 | + return self::$instance; |
|
| 775 | + } |
|
| 776 | + |
|
| 777 | + /** |
|
| 778 | + * Load the required dependencies for this plugin. |
|
| 779 | + * |
|
| 780 | + * Include the following files that make up the plugin: |
|
| 781 | + * |
|
| 782 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 783 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 784 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 785 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 786 | + * |
|
| 787 | + * Create an instance of the loader which will be used to register the hooks |
|
| 788 | + * with WordPress. |
|
| 789 | + * |
|
| 790 | + * @throws Exception |
|
| 791 | + * @since 1.0.0 |
|
| 792 | + * @access private |
|
| 793 | + */ |
|
| 794 | + private function load_dependencies() { |
|
| 795 | + |
|
| 796 | + /** |
|
| 797 | + * The class responsible for orchestrating the actions and filters of the |
|
| 798 | + * core plugin. |
|
| 799 | + */ |
|
| 800 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 801 | + |
|
| 802 | + // The class responsible for plugin uninstall. |
|
| 803 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 804 | + |
|
| 805 | + /** |
|
| 806 | + * The class responsible for defining internationalization functionality |
|
| 807 | + * of the plugin. |
|
| 808 | + */ |
|
| 809 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 810 | + |
|
| 811 | + /** |
|
| 812 | + * WordLift's supported languages. |
|
| 813 | + */ |
|
| 814 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 815 | + |
|
| 816 | + /** |
|
| 817 | + * WordLift's supported countries. |
|
| 818 | + */ |
|
| 819 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 820 | + |
|
| 821 | + /** |
|
| 822 | + * Provide support functions to sanitize data. |
|
| 823 | + */ |
|
| 824 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 825 | + |
|
| 826 | + /** Services. */ |
|
| 827 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 828 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 829 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 830 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 831 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 832 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 833 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 834 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 835 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 836 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 837 | + |
|
| 838 | + /** |
|
| 839 | + * The Query builder. |
|
| 840 | + */ |
|
| 841 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 842 | + |
|
| 843 | + /** |
|
| 844 | + * The Schema service. |
|
| 845 | + */ |
|
| 846 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 847 | + |
|
| 848 | + /** |
|
| 849 | + * The schema:url property service. |
|
| 850 | + */ |
|
| 851 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 852 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 853 | + |
|
| 854 | + /** |
|
| 855 | + * The UI service. |
|
| 856 | + */ |
|
| 857 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 858 | + |
|
| 859 | + /** |
|
| 860 | + * The Thumbnail service. |
|
| 861 | + */ |
|
| 862 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 863 | + |
|
| 864 | + /** |
|
| 865 | + * The Entity Types Taxonomy service. |
|
| 866 | + */ |
|
| 867 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 868 | + |
|
| 869 | + /** |
|
| 870 | + * The Entity service. |
|
| 871 | + */ |
|
| 872 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 873 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 874 | + |
|
| 875 | + // Add the entity rating service. |
|
| 876 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 877 | + |
|
| 878 | + /** |
|
| 879 | + * The User service. |
|
| 880 | + */ |
|
| 881 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 882 | + |
|
| 883 | + /** |
|
| 884 | + * The Timeline service. |
|
| 885 | + */ |
|
| 886 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 887 | + |
|
| 888 | + /** |
|
| 889 | + * The Topic Taxonomy service. |
|
| 890 | + */ |
|
| 891 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 892 | + |
|
| 893 | + /** |
|
| 894 | + * The SPARQL service. |
|
| 895 | + */ |
|
| 896 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 897 | + |
|
| 898 | + /** |
|
| 899 | + * The WordLift import service. |
|
| 900 | + */ |
|
| 901 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 902 | + |
|
| 903 | + /** |
|
| 904 | + * The WordLift URI service. |
|
| 905 | + */ |
|
| 906 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 907 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 908 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 909 | + |
|
| 910 | + /** |
|
| 911 | + * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 912 | + */ |
|
| 913 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 914 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 915 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 916 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 917 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 918 | + |
|
| 919 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 920 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 921 | + |
|
| 922 | + /** |
|
| 923 | + * Load the converters. |
|
| 924 | + */ |
|
| 925 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 926 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 927 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 928 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 929 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 930 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 931 | + |
|
| 932 | + /** |
|
| 933 | + * Load cache-related files. |
|
| 934 | + */ |
|
| 935 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 936 | + |
|
| 937 | + /** |
|
| 938 | + * Load the content filter. |
|
| 939 | + */ |
|
| 940 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 941 | + |
|
| 942 | + /* |
|
| 943 | 943 | * Load the excerpt helper. |
| 944 | 944 | */ |
| 945 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 946 | - |
|
| 947 | - /** |
|
| 948 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 949 | - * |
|
| 950 | - * @since 3.8.0 |
|
| 951 | - */ |
|
| 952 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 953 | - |
|
| 954 | - // The Publisher Service and the AJAX adapter. |
|
| 955 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 956 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 957 | - |
|
| 958 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 959 | - |
|
| 960 | - /** |
|
| 961 | - * Load the WordLift key validation service. |
|
| 962 | - */ |
|
| 963 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 964 | - |
|
| 965 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 966 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 967 | - |
|
| 968 | - // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 969 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 970 | - |
|
| 971 | - /** Linked Data. */ |
|
| 972 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 973 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 974 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 975 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 976 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 977 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 978 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 979 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 980 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 981 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 982 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 983 | - |
|
| 984 | - /** Linked Data Rendition. */ |
|
| 985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 986 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 987 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 988 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 989 | - |
|
| 990 | - /** Services. */ |
|
| 991 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 992 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 993 | - |
|
| 994 | - /** Adapters. */ |
|
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 996 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 997 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 999 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 1000 | - |
|
| 1001 | - /** Async Tasks. */ |
|
| 1002 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 1003 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1004 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1005 | - |
|
| 1006 | - /** Autocomplete. */ |
|
| 1007 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1008 | - |
|
| 1009 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1010 | - |
|
| 1011 | - /** Analytics */ |
|
| 1012 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1013 | - |
|
| 1014 | - /** |
|
| 1015 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 1016 | - */ |
|
| 1017 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1018 | - |
|
| 1019 | - /** |
|
| 1020 | - * The class to customize the entity list admin page. |
|
| 1021 | - */ |
|
| 1022 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1023 | - |
|
| 1024 | - /** |
|
| 1025 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1026 | - */ |
|
| 1027 | - global $wp_version; |
|
| 1028 | - if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 1029 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1030 | - } else { |
|
| 1031 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1032 | - } |
|
| 1033 | - |
|
| 1034 | - /** |
|
| 1035 | - * The Notice service. |
|
| 1036 | - */ |
|
| 1037 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1038 | - |
|
| 1039 | - /** |
|
| 1040 | - * The PrimaShop adapter. |
|
| 1041 | - */ |
|
| 1042 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1043 | - |
|
| 1044 | - /** |
|
| 1045 | - * The WordLift Dashboard service. |
|
| 1046 | - */ |
|
| 1047 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1048 | - |
|
| 1049 | - /** |
|
| 1050 | - * The admin 'Install wizard' page. |
|
| 1051 | - */ |
|
| 1052 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1053 | - |
|
| 1054 | - /** |
|
| 1055 | - * The WordLift entity type list admin page controller. |
|
| 1056 | - */ |
|
| 1057 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1058 | - |
|
| 1059 | - /** |
|
| 1060 | - * The WordLift entity type settings admin page controller. |
|
| 1061 | - */ |
|
| 1062 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1063 | - |
|
| 1064 | - /** |
|
| 1065 | - * The admin 'Download Your Data' page. |
|
| 1066 | - */ |
|
| 1067 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1068 | - |
|
| 1069 | - /** |
|
| 1070 | - * The admin 'WordLift Settings' page. |
|
| 1071 | - */ |
|
| 1072 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1073 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1074 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1075 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1077 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1078 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1079 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1080 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1081 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1082 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1083 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1084 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1085 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1086 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1087 | - |
|
| 1088 | - /** Admin Pages */ |
|
| 1089 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1090 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1091 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1092 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1093 | - |
|
| 1094 | - /** |
|
| 1095 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 1096 | - * side of the site. |
|
| 1097 | - */ |
|
| 1098 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1099 | - |
|
| 1100 | - /** |
|
| 1101 | - * The shortcode abstract class. |
|
| 1102 | - */ |
|
| 1103 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1104 | - |
|
| 1105 | - /** |
|
| 1106 | - * The Timeline shortcode. |
|
| 1107 | - */ |
|
| 1108 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1109 | - |
|
| 1110 | - /** |
|
| 1111 | - * The Navigator shortcode. |
|
| 1112 | - */ |
|
| 1113 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1114 | - |
|
| 1115 | - /** |
|
| 1116 | - * The Products Navigator shortcode. |
|
| 1117 | - */ |
|
| 1118 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 1119 | - |
|
| 1120 | - /** |
|
| 1121 | - * The chord shortcode. |
|
| 1122 | - */ |
|
| 1123 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1124 | - |
|
| 1125 | - /** |
|
| 1126 | - * The geomap shortcode. |
|
| 1127 | - */ |
|
| 1128 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1129 | - |
|
| 1130 | - /** |
|
| 1131 | - * The entity cloud shortcode. |
|
| 1132 | - */ |
|
| 1133 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1134 | - |
|
| 1135 | - /** |
|
| 1136 | - * The entity glossary shortcode. |
|
| 1137 | - */ |
|
| 1138 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1139 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1140 | - |
|
| 1141 | - /** |
|
| 1142 | - * Faceted Search shortcode. |
|
| 1143 | - */ |
|
| 1144 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1145 | - |
|
| 1146 | - /** |
|
| 1147 | - * The ShareThis service. |
|
| 1148 | - */ |
|
| 1149 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1150 | - |
|
| 1151 | - /** |
|
| 1152 | - * The SEO service. |
|
| 1153 | - */ |
|
| 1154 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1155 | - |
|
| 1156 | - /** |
|
| 1157 | - * The AMP service. |
|
| 1158 | - */ |
|
| 1159 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1160 | - |
|
| 1161 | - /** Widgets */ |
|
| 1162 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1163 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1164 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1165 | - |
|
| 1166 | - /* |
|
| 945 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 946 | + |
|
| 947 | + /** |
|
| 948 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 949 | + * |
|
| 950 | + * @since 3.8.0 |
|
| 951 | + */ |
|
| 952 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 953 | + |
|
| 954 | + // The Publisher Service and the AJAX adapter. |
|
| 955 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 956 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 957 | + |
|
| 958 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 959 | + |
|
| 960 | + /** |
|
| 961 | + * Load the WordLift key validation service. |
|
| 962 | + */ |
|
| 963 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 964 | + |
|
| 965 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 966 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 967 | + |
|
| 968 | + // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 969 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 970 | + |
|
| 971 | + /** Linked Data. */ |
|
| 972 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 973 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 974 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 975 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 976 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 977 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 978 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 979 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 980 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 981 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 982 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 983 | + |
|
| 984 | + /** Linked Data Rendition. */ |
|
| 985 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 986 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 987 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 988 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 989 | + |
|
| 990 | + /** Services. */ |
|
| 991 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 992 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 993 | + |
|
| 994 | + /** Adapters. */ |
|
| 995 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 996 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 997 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 998 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 999 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 1000 | + |
|
| 1001 | + /** Async Tasks. */ |
|
| 1002 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 1003 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1004 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1005 | + |
|
| 1006 | + /** Autocomplete. */ |
|
| 1007 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1008 | + |
|
| 1009 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1010 | + |
|
| 1011 | + /** Analytics */ |
|
| 1012 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1013 | + |
|
| 1014 | + /** |
|
| 1015 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 1016 | + */ |
|
| 1017 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1018 | + |
|
| 1019 | + /** |
|
| 1020 | + * The class to customize the entity list admin page. |
|
| 1021 | + */ |
|
| 1022 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1023 | + |
|
| 1024 | + /** |
|
| 1025 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1026 | + */ |
|
| 1027 | + global $wp_version; |
|
| 1028 | + if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 1029 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1030 | + } else { |
|
| 1031 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1032 | + } |
|
| 1033 | + |
|
| 1034 | + /** |
|
| 1035 | + * The Notice service. |
|
| 1036 | + */ |
|
| 1037 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1038 | + |
|
| 1039 | + /** |
|
| 1040 | + * The PrimaShop adapter. |
|
| 1041 | + */ |
|
| 1042 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1043 | + |
|
| 1044 | + /** |
|
| 1045 | + * The WordLift Dashboard service. |
|
| 1046 | + */ |
|
| 1047 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1048 | + |
|
| 1049 | + /** |
|
| 1050 | + * The admin 'Install wizard' page. |
|
| 1051 | + */ |
|
| 1052 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1053 | + |
|
| 1054 | + /** |
|
| 1055 | + * The WordLift entity type list admin page controller. |
|
| 1056 | + */ |
|
| 1057 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1058 | + |
|
| 1059 | + /** |
|
| 1060 | + * The WordLift entity type settings admin page controller. |
|
| 1061 | + */ |
|
| 1062 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1063 | + |
|
| 1064 | + /** |
|
| 1065 | + * The admin 'Download Your Data' page. |
|
| 1066 | + */ |
|
| 1067 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1068 | + |
|
| 1069 | + /** |
|
| 1070 | + * The admin 'WordLift Settings' page. |
|
| 1071 | + */ |
|
| 1072 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1073 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1074 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1075 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1076 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1077 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1078 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1079 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1080 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1081 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1082 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1083 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1084 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1085 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1086 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1087 | + |
|
| 1088 | + /** Admin Pages */ |
|
| 1089 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1090 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1091 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1092 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1093 | + |
|
| 1094 | + /** |
|
| 1095 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 1096 | + * side of the site. |
|
| 1097 | + */ |
|
| 1098 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1099 | + |
|
| 1100 | + /** |
|
| 1101 | + * The shortcode abstract class. |
|
| 1102 | + */ |
|
| 1103 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1104 | + |
|
| 1105 | + /** |
|
| 1106 | + * The Timeline shortcode. |
|
| 1107 | + */ |
|
| 1108 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1109 | + |
|
| 1110 | + /** |
|
| 1111 | + * The Navigator shortcode. |
|
| 1112 | + */ |
|
| 1113 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1114 | + |
|
| 1115 | + /** |
|
| 1116 | + * The Products Navigator shortcode. |
|
| 1117 | + */ |
|
| 1118 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 1119 | + |
|
| 1120 | + /** |
|
| 1121 | + * The chord shortcode. |
|
| 1122 | + */ |
|
| 1123 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1124 | + |
|
| 1125 | + /** |
|
| 1126 | + * The geomap shortcode. |
|
| 1127 | + */ |
|
| 1128 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1129 | + |
|
| 1130 | + /** |
|
| 1131 | + * The entity cloud shortcode. |
|
| 1132 | + */ |
|
| 1133 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1134 | + |
|
| 1135 | + /** |
|
| 1136 | + * The entity glossary shortcode. |
|
| 1137 | + */ |
|
| 1138 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1139 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1140 | + |
|
| 1141 | + /** |
|
| 1142 | + * Faceted Search shortcode. |
|
| 1143 | + */ |
|
| 1144 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1145 | + |
|
| 1146 | + /** |
|
| 1147 | + * The ShareThis service. |
|
| 1148 | + */ |
|
| 1149 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1150 | + |
|
| 1151 | + /** |
|
| 1152 | + * The SEO service. |
|
| 1153 | + */ |
|
| 1154 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1155 | + |
|
| 1156 | + /** |
|
| 1157 | + * The AMP service. |
|
| 1158 | + */ |
|
| 1159 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1160 | + |
|
| 1161 | + /** Widgets */ |
|
| 1162 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1163 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1164 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1165 | + |
|
| 1166 | + /* |
|
| 1167 | 1167 | * Schema.org Services. |
| 1168 | 1168 | * |
| 1169 | 1169 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1170 | 1170 | */ |
| 1171 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1172 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1173 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1174 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1175 | - new Wordlift_Schemaorg_Sync_Service(); |
|
| 1176 | - $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1177 | - new Wordlift_Schemaorg_Class_Service(); |
|
| 1178 | - } else { |
|
| 1179 | - $schemaorg_property_service = null; |
|
| 1180 | - } |
|
| 1171 | + if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1172 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1173 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1174 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1175 | + new Wordlift_Schemaorg_Sync_Service(); |
|
| 1176 | + $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1177 | + new Wordlift_Schemaorg_Class_Service(); |
|
| 1178 | + } else { |
|
| 1179 | + $schemaorg_property_service = null; |
|
| 1180 | + } |
|
| 1181 | 1181 | |
| 1182 | - $this->loader = new Wordlift_Loader(); |
|
| 1182 | + $this->loader = new Wordlift_Loader(); |
|
| 1183 | 1183 | |
| 1184 | - // Instantiate a global logger. |
|
| 1185 | - global $wl_logger; |
|
| 1186 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1184 | + // Instantiate a global logger. |
|
| 1185 | + global $wl_logger; |
|
| 1186 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1187 | 1187 | |
| 1188 | - // Load the `wl-api` end-point. |
|
| 1189 | - new Wordlift_Http_Api(); |
|
| 1188 | + // Load the `wl-api` end-point. |
|
| 1189 | + new Wordlift_Http_Api(); |
|
| 1190 | 1190 | |
| 1191 | - // Load the Install Service. |
|
| 1192 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1193 | - $this->install_service = new Wordlift_Install_Service(); |
|
| 1191 | + // Load the Install Service. |
|
| 1192 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1193 | + $this->install_service = new Wordlift_Install_Service(); |
|
| 1194 | 1194 | |
| 1195 | - /** Services. */ |
|
| 1196 | - // Create the configuration service. |
|
| 1197 | - $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1198 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1195 | + /** Services. */ |
|
| 1196 | + // Create the configuration service. |
|
| 1197 | + $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1198 | + $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1199 | 1199 | |
| 1200 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1201 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1200 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1201 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1202 | 1202 | |
| 1203 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1204 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1203 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1204 | + $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1205 | 1205 | |
| 1206 | - // Create an instance of the UI service. |
|
| 1207 | - $this->ui_service = new Wordlift_UI_Service(); |
|
| 1206 | + // Create an instance of the UI service. |
|
| 1207 | + $this->ui_service = new Wordlift_UI_Service(); |
|
| 1208 | 1208 | |
| 1209 | - // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1210 | - $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1209 | + // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1210 | + $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1211 | 1211 | |
| 1212 | - $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1213 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1214 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1215 | - $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1212 | + $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1213 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1214 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1215 | + $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1216 | 1216 | |
| 1217 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1218 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1219 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1220 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1217 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1218 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1219 | + $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1220 | + $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1221 | 1221 | |
| 1222 | - // Instantiate the JSON-LD service. |
|
| 1223 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1222 | + // Instantiate the JSON-LD service. |
|
| 1223 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1224 | 1224 | |
| 1225 | - /** Linked Data. */ |
|
| 1226 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1227 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1225 | + /** Linked Data. */ |
|
| 1226 | + $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1227 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1228 | 1228 | |
| 1229 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1229 | + $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1230 | 1230 | |
| 1231 | - // Create a new instance of the Redirect service. |
|
| 1232 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1233 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1231 | + // Create a new instance of the Redirect service. |
|
| 1232 | + $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1233 | + $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1234 | 1234 | |
| 1235 | - if ( apply_filters( 'wl_feature__enable__dataset-ng', false ) ) { |
|
| 1236 | - new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1237 | - } |
|
| 1235 | + if ( apply_filters( 'wl_feature__enable__dataset-ng', false ) ) { |
|
| 1236 | + new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1237 | + } |
|
| 1238 | 1238 | |
| 1239 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1240 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1239 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1240 | + $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1241 | 1241 | |
| 1242 | - $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1242 | + $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1243 | 1243 | |
| 1244 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1245 | - $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1244 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1245 | + $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1246 | 1246 | |
| 1247 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1248 | - $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1247 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1248 | + $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1249 | 1249 | |
| 1250 | - // Create an instance of the PrimaShop adapter. |
|
| 1251 | - $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1250 | + // Create an instance of the PrimaShop adapter. |
|
| 1251 | + $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1252 | 1252 | |
| 1253 | - // Create an import service instance to hook later to WP's import function. |
|
| 1254 | - $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 | + // Create an import service instance to hook later to WP's import function. |
|
| 1254 | + $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() ); |
|
| 1255 | 1255 | |
| 1256 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1256 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1257 | 1257 | |
| 1258 | - // Create the entity rating service. |
|
| 1259 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1258 | + // Create the entity rating service. |
|
| 1259 | + $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1260 | 1260 | |
| 1261 | - // Create entity list customization (wp-admin/edit.php). |
|
| 1262 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1261 | + // Create entity list customization (wp-admin/edit.php). |
|
| 1262 | + $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1263 | 1263 | |
| 1264 | - // Create a new instance of the Redirect service. |
|
| 1265 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1264 | + // Create a new instance of the Redirect service. |
|
| 1265 | + $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1266 | 1266 | |
| 1267 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1268 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1269 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1270 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1267 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1268 | + $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1269 | + $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1270 | + $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1271 | 1271 | |
| 1272 | - $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1272 | + $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1273 | 1273 | |
| 1274 | - // Instantiate the JSON-LD service. |
|
| 1275 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1276 | - $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 ); |
|
| 1277 | - $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 ); |
|
| 1278 | - $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 ); |
|
| 1279 | - $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 | + // Instantiate the JSON-LD service. |
|
| 1275 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1276 | + $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 ); |
|
| 1277 | + $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 ); |
|
| 1278 | + $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 ); |
|
| 1279 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1280 | 1280 | |
| 1281 | - $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1282 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache ); |
|
| 1283 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1281 | + $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1282 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache ); |
|
| 1283 | + $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1284 | 1284 | |
| 1285 | - /* |
|
| 1285 | + /* |
|
| 1286 | 1286 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
| 1287 | 1287 | * |
| 1288 | 1288 | * @see https://github.com/insideout10/wordlift-plugin/issues/892 |
| 1289 | 1289 | * |
| 1290 | 1290 | * @since 3.20.0 |
| 1291 | 1291 | */ |
| 1292 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1293 | - $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1294 | - $jsonld_service = new Jsonld_Service( |
|
| 1295 | - $this->jsonld_service, |
|
| 1296 | - $term_jsonld_adapter, |
|
| 1297 | - new Jsonld_User_Service( $this->user_service ) ); |
|
| 1298 | - new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service ); |
|
| 1299 | - |
|
| 1300 | - // Prints the JSON-LD in the head. |
|
| 1301 | - new Jsonld_Adapter( $this->jsonld_service ); |
|
| 1302 | - |
|
| 1303 | - new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service ); |
|
| 1304 | - |
|
| 1305 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1306 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1307 | - // Creating Faq Content filter service. |
|
| 1308 | - $this->faq_content_filter_service = new Faq_Content_Filter(); |
|
| 1309 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1310 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1311 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1312 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->entity_service ); |
|
| 1313 | - |
|
| 1314 | - $this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' ); |
|
| 1315 | - |
|
| 1316 | - /** |
|
| 1317 | - * Filter: wl_feature__enable__blocks. |
|
| 1318 | - * |
|
| 1319 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1320 | - * |
|
| 1321 | - * @return bool |
|
| 1322 | - * @since 3.27.6 |
|
| 1323 | - */ |
|
| 1324 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1325 | - // Initialize the short-codes. |
|
| 1326 | - new Wordlift_Navigator_Shortcode(); |
|
| 1327 | - new Wordlift_Chord_Shortcode(); |
|
| 1328 | - new Wordlift_Geomap_Shortcode(); |
|
| 1329 | - new Wordlift_Timeline_Shortcode(); |
|
| 1330 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1331 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1332 | - new Wordlift_Faceted_Search_Shortcode(); |
|
| 1333 | - } |
|
| 1334 | - |
|
| 1335 | - new Wordlift_Products_Navigator_Shortcode(); |
|
| 1336 | - |
|
| 1337 | - |
|
| 1338 | - // Initialize the Context Cards Service |
|
| 1339 | - $this->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
| 1340 | - |
|
| 1341 | - // Initialize the SEO service. |
|
| 1342 | - new Wordlift_Seo_Service(); |
|
| 1343 | - |
|
| 1344 | - // Initialize the AMP service. |
|
| 1345 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1346 | - |
|
| 1347 | - /** Services. */ |
|
| 1348 | - $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1349 | - new Wordlift_Image_Service(); |
|
| 1350 | - |
|
| 1351 | - /** Adapters. */ |
|
| 1352 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1353 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1354 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1355 | - //$this->faq_tinymce_adapter = new Faq_Tinymce_Adapter(); |
|
| 1356 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1357 | - |
|
| 1358 | - /* |
|
| 1292 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1293 | + $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1294 | + $jsonld_service = new Jsonld_Service( |
|
| 1295 | + $this->jsonld_service, |
|
| 1296 | + $term_jsonld_adapter, |
|
| 1297 | + new Jsonld_User_Service( $this->user_service ) ); |
|
| 1298 | + new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service ); |
|
| 1299 | + |
|
| 1300 | + // Prints the JSON-LD in the head. |
|
| 1301 | + new Jsonld_Adapter( $this->jsonld_service ); |
|
| 1302 | + |
|
| 1303 | + new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service ); |
|
| 1304 | + |
|
| 1305 | + $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1306 | + $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1307 | + // Creating Faq Content filter service. |
|
| 1308 | + $this->faq_content_filter_service = new Faq_Content_Filter(); |
|
| 1309 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1310 | + $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1311 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1312 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->entity_service ); |
|
| 1313 | + |
|
| 1314 | + $this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' ); |
|
| 1315 | + |
|
| 1316 | + /** |
|
| 1317 | + * Filter: wl_feature__enable__blocks. |
|
| 1318 | + * |
|
| 1319 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1320 | + * |
|
| 1321 | + * @return bool |
|
| 1322 | + * @since 3.27.6 |
|
| 1323 | + */ |
|
| 1324 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1325 | + // Initialize the short-codes. |
|
| 1326 | + new Wordlift_Navigator_Shortcode(); |
|
| 1327 | + new Wordlift_Chord_Shortcode(); |
|
| 1328 | + new Wordlift_Geomap_Shortcode(); |
|
| 1329 | + new Wordlift_Timeline_Shortcode(); |
|
| 1330 | + new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1331 | + new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1332 | + new Wordlift_Faceted_Search_Shortcode(); |
|
| 1333 | + } |
|
| 1334 | + |
|
| 1335 | + new Wordlift_Products_Navigator_Shortcode(); |
|
| 1336 | + |
|
| 1337 | + |
|
| 1338 | + // Initialize the Context Cards Service |
|
| 1339 | + $this->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
| 1340 | + |
|
| 1341 | + // Initialize the SEO service. |
|
| 1342 | + new Wordlift_Seo_Service(); |
|
| 1343 | + |
|
| 1344 | + // Initialize the AMP service. |
|
| 1345 | + new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1346 | + |
|
| 1347 | + /** Services. */ |
|
| 1348 | + $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1349 | + new Wordlift_Image_Service(); |
|
| 1350 | + |
|
| 1351 | + /** Adapters. */ |
|
| 1352 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1353 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1354 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1355 | + //$this->faq_tinymce_adapter = new Faq_Tinymce_Adapter(); |
|
| 1356 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1357 | + |
|
| 1358 | + /* |
|
| 1359 | 1359 | * Exclude our public js from WP-Rocket. |
| 1360 | 1360 | * |
| 1361 | 1361 | * @since 3.19.4 |
| 1362 | 1362 | * |
| 1363 | 1363 | * @see https://github.com/insideout10/wordlift-plugin/issues/842. |
| 1364 | 1364 | */ |
| 1365 | - new Wordlift_WpRocket_Adapter(); |
|
| 1366 | - |
|
| 1367 | - // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1368 | - $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1369 | - $this->sparql_service, |
|
| 1370 | - $uri_service |
|
| 1371 | - ); |
|
| 1372 | - |
|
| 1373 | - /** Async Tasks. */ |
|
| 1374 | - if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) { |
|
| 1375 | - new Wordlift_Sparql_Query_Async_Task(); |
|
| 1376 | - new Wordlift_Push_References_Async_Task(); |
|
| 1377 | - } |
|
| 1378 | - |
|
| 1379 | - /** WordPress Admin UI. */ |
|
| 1380 | - |
|
| 1381 | - // UI elements. |
|
| 1382 | - $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1383 | - $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1384 | - $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1385 | - $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1386 | - $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1387 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1388 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1389 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1390 | - |
|
| 1391 | - $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 ); |
|
| 1392 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1393 | - |
|
| 1394 | - $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1395 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1396 | - $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1397 | - |
|
| 1398 | - // Pages. |
|
| 1399 | - /* |
|
| 1365 | + new Wordlift_WpRocket_Adapter(); |
|
| 1366 | + |
|
| 1367 | + // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1368 | + $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1369 | + $this->sparql_service, |
|
| 1370 | + $uri_service |
|
| 1371 | + ); |
|
| 1372 | + |
|
| 1373 | + /** Async Tasks. */ |
|
| 1374 | + if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) { |
|
| 1375 | + new Wordlift_Sparql_Query_Async_Task(); |
|
| 1376 | + new Wordlift_Push_References_Async_Task(); |
|
| 1377 | + } |
|
| 1378 | + |
|
| 1379 | + /** WordPress Admin UI. */ |
|
| 1380 | + |
|
| 1381 | + // UI elements. |
|
| 1382 | + $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1383 | + $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1384 | + $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1385 | + $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1386 | + $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1387 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1388 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1389 | + $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1390 | + |
|
| 1391 | + $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 ); |
|
| 1392 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1393 | + |
|
| 1394 | + $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1395 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1396 | + $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1397 | + |
|
| 1398 | + // Pages. |
|
| 1399 | + /* |
|
| 1400 | 1400 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
| 1401 | 1401 | * |
| 1402 | 1402 | * @since 3.20.3 |
| 1403 | 1403 | * |
| 1404 | 1404 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1405 | 1405 | */ |
| 1406 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1407 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1408 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1409 | - } |
|
| 1410 | - new Wordlift_Entity_Type_Admin_Service(); |
|
| 1406 | + if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1407 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1408 | + new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1409 | + } |
|
| 1410 | + new Wordlift_Entity_Type_Admin_Service(); |
|
| 1411 | 1411 | |
| 1412 | - // create an instance of the entity type list admin page controller. |
|
| 1413 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1412 | + // create an instance of the entity type list admin page controller. |
|
| 1413 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1414 | 1414 | |
| 1415 | - // create an instance of the entity type setting admin page controller. |
|
| 1416 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1415 | + // create an instance of the entity type setting admin page controller. |
|
| 1416 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1417 | 1417 | |
| 1418 | - /** Widgets */ |
|
| 1419 | - $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1418 | + /** Widgets */ |
|
| 1419 | + $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1420 | 1420 | |
| 1421 | - /* WordPress Admin. */ |
|
| 1422 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1423 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1421 | + /* WordPress Admin. */ |
|
| 1422 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1423 | + $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1424 | 1424 | |
| 1425 | - // Create an instance of the install wizard. |
|
| 1426 | - $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 ); |
|
| 1425 | + // Create an instance of the install wizard. |
|
| 1426 | + $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 | 1427 | |
| 1428 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1428 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1429 | 1429 | |
| 1430 | - // User Profile. |
|
| 1431 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1430 | + // User Profile. |
|
| 1431 | + new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1432 | 1432 | |
| 1433 | - $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1433 | + $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1434 | 1434 | |
| 1435 | - // Load the debug service if WP is in debug mode. |
|
| 1436 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1437 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1438 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1439 | - } |
|
| 1435 | + // Load the debug service if WP is in debug mode. |
|
| 1436 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1437 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1438 | + new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1439 | + } |
|
| 1440 | 1440 | |
| 1441 | - // Remote Image Service. |
|
| 1442 | - new Wordlift_Remote_Image_Service(); |
|
| 1441 | + // Remote Image Service. |
|
| 1442 | + new Wordlift_Remote_Image_Service(); |
|
| 1443 | 1443 | |
| 1444 | - /* |
|
| 1444 | + /* |
|
| 1445 | 1445 | * Provides mappings between post types and entity types. |
| 1446 | 1446 | * |
| 1447 | 1447 | * @since 3.20.0 |
| 1448 | 1448 | * |
| 1449 | 1449 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1450 | 1450 | */ |
| 1451 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1452 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1453 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1451 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1452 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1453 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1454 | 1454 | |
| 1455 | - // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1456 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1455 | + // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1456 | + new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1457 | 1457 | |
| 1458 | - /* |
|
| 1458 | + /* |
|
| 1459 | 1459 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
| 1460 | 1460 | * |
| 1461 | 1461 | * Eventually Batch Actions will become Batch Operations. |
| 1462 | 1462 | * |
| 1463 | 1463 | * @since 3.20.0 |
| 1464 | 1464 | */ |
| 1465 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1466 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1465 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1466 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1467 | 1467 | |
| 1468 | - /* |
|
| 1468 | + /* |
|
| 1469 | 1469 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
| 1470 | 1470 | * |
| 1471 | 1471 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
| 1472 | 1472 | * |
| 1473 | 1473 | * @since 3.20.0 |
| 1474 | 1474 | */ |
| 1475 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1476 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1475 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1476 | + new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1477 | 1477 | |
| 1478 | - /* |
|
| 1478 | + /* |
|
| 1479 | 1479 | * Load the Mappings JSON-LD post processing. |
| 1480 | 1480 | * |
| 1481 | 1481 | * @since 3.25.0 |
| 1482 | 1482 | */ |
| 1483 | 1483 | |
| 1484 | - $mappings_dbo = new Mappings_DBO(); |
|
| 1485 | - $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
| 1486 | - new Post_Type_Rule_Validator(); |
|
| 1487 | - // Taxonomy term rule validator for validating rules for term pages. |
|
| 1488 | - new Taxonomy_Term_Rule_Validator(); |
|
| 1489 | - $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1490 | - $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1491 | - $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1492 | - |
|
| 1493 | - new Url_To_Entity_Transform_Function( $this->entity_uri_service ); |
|
| 1494 | - new Taxonomy_To_Terms_Transform_Function(); |
|
| 1495 | - new Post_Id_To_Entity_Transform_Function(); |
|
| 1496 | - $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
| 1497 | - |
|
| 1498 | - /** |
|
| 1499 | - * @since 3.27.1 |
|
| 1500 | - * Intiailize the acf group data formatter. |
|
| 1501 | - */ |
|
| 1502 | - new Acf_Group_Formatter(); |
|
| 1503 | - new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1504 | - |
|
| 1505 | - /** |
|
| 1506 | - * @since 3.26.0 |
|
| 1507 | - * Initialize the Faq JSON LD converter here - disabled. |
|
| 1508 | - */ |
|
| 1509 | - // new Faq_To_Jsonld_Converter(); |
|
| 1510 | - /* |
|
| 1484 | + $mappings_dbo = new Mappings_DBO(); |
|
| 1485 | + $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
| 1486 | + new Post_Type_Rule_Validator(); |
|
| 1487 | + // Taxonomy term rule validator for validating rules for term pages. |
|
| 1488 | + new Taxonomy_Term_Rule_Validator(); |
|
| 1489 | + $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1490 | + $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1491 | + $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1492 | + |
|
| 1493 | + new Url_To_Entity_Transform_Function( $this->entity_uri_service ); |
|
| 1494 | + new Taxonomy_To_Terms_Transform_Function(); |
|
| 1495 | + new Post_Id_To_Entity_Transform_Function(); |
|
| 1496 | + $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
| 1497 | + |
|
| 1498 | + /** |
|
| 1499 | + * @since 3.27.1 |
|
| 1500 | + * Intiailize the acf group data formatter. |
|
| 1501 | + */ |
|
| 1502 | + new Acf_Group_Formatter(); |
|
| 1503 | + new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1504 | + |
|
| 1505 | + /** |
|
| 1506 | + * @since 3.26.0 |
|
| 1507 | + * Initialize the Faq JSON LD converter here - disabled. |
|
| 1508 | + */ |
|
| 1509 | + // new Faq_To_Jsonld_Converter(); |
|
| 1510 | + /* |
|
| 1511 | 1511 | * Use the Templates Ajax Endpoint to load HTML templates for the legacy Angular app via admin-ajax.php |
| 1512 | 1512 | * end-point. |
| 1513 | 1513 | * |
| 1514 | 1514 | * @see https://github.com/insideout10/wordlift-plugin/issues/834 |
| 1515 | 1515 | * @since 3.24.4 |
| 1516 | 1516 | */ |
| 1517 | - new Templates_Ajax_Endpoint(); |
|
| 1518 | - // Call this static method to register FAQ routes to rest api - disabled |
|
| 1519 | - //Faq_Rest_Controller::register_routes(); |
|
| 1517 | + new Templates_Ajax_Endpoint(); |
|
| 1518 | + // Call this static method to register FAQ routes to rest api - disabled |
|
| 1519 | + //Faq_Rest_Controller::register_routes(); |
|
| 1520 | 1520 | |
| 1521 | - /* |
|
| 1521 | + /* |
|
| 1522 | 1522 | * Create a singleton for the Analysis_Response_Ops_Factory. |
| 1523 | 1523 | */ |
| 1524 | - $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service ); |
|
| 1525 | - new Analysis_Response_Ops_Factory( |
|
| 1526 | - $this->entity_uri_service, |
|
| 1527 | - $this->entity_service, |
|
| 1528 | - $this->entity_type_service, |
|
| 1529 | - $this->storage_factory->post_images(), |
|
| 1530 | - $entity_helper |
|
| 1531 | - ); |
|
| 1532 | - |
|
| 1533 | - /** WL Autocomplete. */ |
|
| 1534 | - $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1535 | - new Local_Autocomplete_Service(), |
|
| 1536 | - new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ), |
|
| 1537 | - ) ); |
|
| 1538 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1539 | - |
|
| 1540 | - /** |
|
| 1541 | - * @since 3.27.2 |
|
| 1542 | - * Integrate the recipe maker jsonld & set recipe |
|
| 1543 | - * as default entity type to the wprm_recipe CPT. |
|
| 1544 | - */ |
|
| 1545 | - new Recipe_Maker_Post_Type_Hook(); |
|
| 1546 | - $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
| 1547 | - new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1548 | - new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1549 | - new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1550 | - new Yoast_Jsonld( $recipe_maker_validation_service ); |
|
| 1551 | - |
|
| 1552 | - /** |
|
| 1553 | - * @since 3.27.4 |
|
| 1554 | - * Add the faq duplicate markup hook. |
|
| 1555 | - */ |
|
| 1556 | - new Faq_Duplicate_Markup_Remover(); |
|
| 1557 | - } |
|
| 1558 | - |
|
| 1559 | - /** |
|
| 1560 | - * Define the locale for this plugin for internationalization. |
|
| 1561 | - * |
|
| 1562 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1563 | - * with WordPress. |
|
| 1564 | - * |
|
| 1565 | - * @since 1.0.0 |
|
| 1566 | - * @access private |
|
| 1567 | - */ |
|
| 1568 | - private function set_locale() { |
|
| 1569 | - |
|
| 1570 | - $plugin_i18n = new Wordlift_i18n(); |
|
| 1571 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1572 | - |
|
| 1573 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1574 | - |
|
| 1575 | - } |
|
| 1576 | - |
|
| 1577 | - /** |
|
| 1578 | - * Register all of the hooks related to the admin area functionality |
|
| 1579 | - * of the plugin. |
|
| 1580 | - * |
|
| 1581 | - * @since 1.0.0 |
|
| 1582 | - * @access private |
|
| 1583 | - */ |
|
| 1584 | - private function define_admin_hooks() { |
|
| 1585 | - |
|
| 1586 | - $plugin_admin = new Wordlift_Admin( |
|
| 1587 | - $this->get_plugin_name(), |
|
| 1588 | - $this->get_version(), |
|
| 1589 | - $this->configuration_service, |
|
| 1590 | - $this->notice_service, |
|
| 1591 | - $this->user_service |
|
| 1592 | - ); |
|
| 1593 | - |
|
| 1594 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1595 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1596 | - |
|
| 1597 | - // Hook the init action to taxonomy services. |
|
| 1598 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1599 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1600 | - |
|
| 1601 | - // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1602 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1603 | - |
|
| 1604 | - // Hook the added_post_meta action to the Thumbnail service. |
|
| 1605 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1606 | - |
|
| 1607 | - // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1608 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1609 | - |
|
| 1610 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1611 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1612 | - |
|
| 1613 | - // Register custom allowed redirect hosts. |
|
| 1614 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1615 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1616 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1617 | - |
|
| 1618 | - /* |
|
| 1524 | + $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service ); |
|
| 1525 | + new Analysis_Response_Ops_Factory( |
|
| 1526 | + $this->entity_uri_service, |
|
| 1527 | + $this->entity_service, |
|
| 1528 | + $this->entity_type_service, |
|
| 1529 | + $this->storage_factory->post_images(), |
|
| 1530 | + $entity_helper |
|
| 1531 | + ); |
|
| 1532 | + |
|
| 1533 | + /** WL Autocomplete. */ |
|
| 1534 | + $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1535 | + new Local_Autocomplete_Service(), |
|
| 1536 | + new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ), |
|
| 1537 | + ) ); |
|
| 1538 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1539 | + |
|
| 1540 | + /** |
|
| 1541 | + * @since 3.27.2 |
|
| 1542 | + * Integrate the recipe maker jsonld & set recipe |
|
| 1543 | + * as default entity type to the wprm_recipe CPT. |
|
| 1544 | + */ |
|
| 1545 | + new Recipe_Maker_Post_Type_Hook(); |
|
| 1546 | + $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
| 1547 | + new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1548 | + new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1549 | + new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1550 | + new Yoast_Jsonld( $recipe_maker_validation_service ); |
|
| 1551 | + |
|
| 1552 | + /** |
|
| 1553 | + * @since 3.27.4 |
|
| 1554 | + * Add the faq duplicate markup hook. |
|
| 1555 | + */ |
|
| 1556 | + new Faq_Duplicate_Markup_Remover(); |
|
| 1557 | + } |
|
| 1558 | + |
|
| 1559 | + /** |
|
| 1560 | + * Define the locale for this plugin for internationalization. |
|
| 1561 | + * |
|
| 1562 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1563 | + * with WordPress. |
|
| 1564 | + * |
|
| 1565 | + * @since 1.0.0 |
|
| 1566 | + * @access private |
|
| 1567 | + */ |
|
| 1568 | + private function set_locale() { |
|
| 1569 | + |
|
| 1570 | + $plugin_i18n = new Wordlift_i18n(); |
|
| 1571 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1572 | + |
|
| 1573 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1574 | + |
|
| 1575 | + } |
|
| 1576 | + |
|
| 1577 | + /** |
|
| 1578 | + * Register all of the hooks related to the admin area functionality |
|
| 1579 | + * of the plugin. |
|
| 1580 | + * |
|
| 1581 | + * @since 1.0.0 |
|
| 1582 | + * @access private |
|
| 1583 | + */ |
|
| 1584 | + private function define_admin_hooks() { |
|
| 1585 | + |
|
| 1586 | + $plugin_admin = new Wordlift_Admin( |
|
| 1587 | + $this->get_plugin_name(), |
|
| 1588 | + $this->get_version(), |
|
| 1589 | + $this->configuration_service, |
|
| 1590 | + $this->notice_service, |
|
| 1591 | + $this->user_service |
|
| 1592 | + ); |
|
| 1593 | + |
|
| 1594 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1595 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1596 | + |
|
| 1597 | + // Hook the init action to taxonomy services. |
|
| 1598 | + $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1599 | + $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1600 | + |
|
| 1601 | + // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1602 | + $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1603 | + |
|
| 1604 | + // Hook the added_post_meta action to the Thumbnail service. |
|
| 1605 | + $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1606 | + |
|
| 1607 | + // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1608 | + $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1609 | + |
|
| 1610 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1611 | + $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1612 | + |
|
| 1613 | + // Register custom allowed redirect hosts. |
|
| 1614 | + $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1615 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1616 | + $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1617 | + |
|
| 1618 | + /* |
|
| 1619 | 1619 | * The old dashboard is replaced with dashboard v2. |
| 1620 | 1620 | * |
| 1621 | 1621 | * The old dashboard service is still loaded because its functions are used. |
@@ -1624,389 +1624,389 @@ discard block |
||
| 1624 | 1624 | * |
| 1625 | 1625 | * @since 3.20.0 |
| 1626 | 1626 | */ |
| 1627 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1628 | - // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1629 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1630 | - // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1631 | - |
|
| 1632 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1633 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1634 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1635 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1636 | - |
|
| 1637 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1638 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1639 | - |
|
| 1640 | - // Entity listing customization (wp-admin/edit.php) |
|
| 1641 | - // Add custom columns. |
|
| 1642 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1643 | - // no explicit entity as it prevents handling of other post types. |
|
| 1644 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1645 | - // Add 4W selection. |
|
| 1646 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1647 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1648 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1649 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1650 | - |
|
| 1651 | - /* |
|
| 1627 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1628 | + // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1629 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1630 | + // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1631 | + |
|
| 1632 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1633 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1634 | + $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1635 | + $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1636 | + |
|
| 1637 | + $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1638 | + $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1639 | + |
|
| 1640 | + // Entity listing customization (wp-admin/edit.php) |
|
| 1641 | + // Add custom columns. |
|
| 1642 | + $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1643 | + // no explicit entity as it prevents handling of other post types. |
|
| 1644 | + $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1645 | + // Add 4W selection. |
|
| 1646 | + $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1647 | + $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1648 | + $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1649 | + $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1650 | + |
|
| 1651 | + /* |
|
| 1652 | 1652 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1653 | 1653 | * |
| 1654 | 1654 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1655 | 1655 | */ |
| 1656 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1657 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1658 | - } |
|
| 1659 | - |
|
| 1660 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1661 | - // entities. |
|
| 1662 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1663 | - |
|
| 1664 | - // Filter imported post meta. |
|
| 1665 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1666 | - |
|
| 1667 | - // Notify the import service when an import starts and ends. |
|
| 1668 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1669 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1670 | - |
|
| 1671 | - // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1672 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1673 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1674 | - |
|
| 1675 | - /** |
|
| 1676 | - * Filter: wl_feature__enable__screens. |
|
| 1677 | - * |
|
| 1678 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1679 | - * |
|
| 1680 | - * @return bool |
|
| 1681 | - * @since 3.27.6 |
|
| 1682 | - */ |
|
| 1683 | - if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1684 | - // Hook the menu to the Download Your Data page. |
|
| 1685 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1686 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1687 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1688 | - } |
|
| 1689 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1690 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1691 | - |
|
| 1692 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1693 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1694 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1695 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1696 | - |
|
| 1697 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1698 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1699 | - |
|
| 1700 | - // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1701 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1702 | - |
|
| 1703 | - // Hook the `admin_init` function to the Admin Setup. |
|
| 1704 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1705 | - |
|
| 1706 | - // Hook the admin_init to the settings page. |
|
| 1707 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1708 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1709 | - |
|
| 1710 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1711 | - |
|
| 1712 | - // Hook the menu creation on the general wordlift menu creation. |
|
| 1713 | - /** |
|
| 1714 | - * Filter: wl_feature__enable__screens. |
|
| 1715 | - * |
|
| 1716 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1717 | - * |
|
| 1718 | - * @return bool |
|
| 1719 | - * @since 3.27.6 |
|
| 1720 | - */ |
|
| 1721 | - if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1722 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1723 | - } |
|
| 1724 | - /* |
|
| 1656 | + if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1657 | + $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1658 | + } |
|
| 1659 | + |
|
| 1660 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1661 | + // entities. |
|
| 1662 | + $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1663 | + |
|
| 1664 | + // Filter imported post meta. |
|
| 1665 | + $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1666 | + |
|
| 1667 | + // Notify the import service when an import starts and ends. |
|
| 1668 | + $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1669 | + $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1670 | + |
|
| 1671 | + // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1672 | + $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1673 | + $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1674 | + |
|
| 1675 | + /** |
|
| 1676 | + * Filter: wl_feature__enable__screens. |
|
| 1677 | + * |
|
| 1678 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1679 | + * |
|
| 1680 | + * @return bool |
|
| 1681 | + * @since 3.27.6 |
|
| 1682 | + */ |
|
| 1683 | + if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1684 | + // Hook the menu to the Download Your Data page. |
|
| 1685 | + $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1686 | + $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1687 | + $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1688 | + } |
|
| 1689 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1690 | + $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1691 | + |
|
| 1692 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1693 | + $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1694 | + $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1695 | + $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1696 | + |
|
| 1697 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1698 | + $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1699 | + |
|
| 1700 | + // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1701 | + $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1702 | + |
|
| 1703 | + // Hook the `admin_init` function to the Admin Setup. |
|
| 1704 | + $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1705 | + |
|
| 1706 | + // Hook the admin_init to the settings page. |
|
| 1707 | + $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1708 | + $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1709 | + |
|
| 1710 | + $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1711 | + |
|
| 1712 | + // Hook the menu creation on the general wordlift menu creation. |
|
| 1713 | + /** |
|
| 1714 | + * Filter: wl_feature__enable__screens. |
|
| 1715 | + * |
|
| 1716 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1717 | + * |
|
| 1718 | + * @return bool |
|
| 1719 | + * @since 3.27.6 |
|
| 1720 | + */ |
|
| 1721 | + if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1722 | + $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1723 | + } |
|
| 1724 | + /* |
|
| 1725 | 1725 | * Display the `Wordlift_Admin_Search_Rankings_Page` page. |
| 1726 | 1726 | * |
| 1727 | 1727 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
| 1728 | 1728 | * |
| 1729 | 1729 | * @since 3.20.0 |
| 1730 | 1730 | */ |
| 1731 | - if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1732 | - /** |
|
| 1733 | - * Filter: wl_feature__enable__screens. |
|
| 1734 | - * |
|
| 1735 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1736 | - * |
|
| 1737 | - * @return bool |
|
| 1738 | - * @since 3.27.6 |
|
| 1739 | - */ |
|
| 1740 | - if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1741 | - $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
|
| 1742 | - $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1743 | - } |
|
| 1744 | - } |
|
| 1745 | - |
|
| 1746 | - // Hook key update. |
|
| 1747 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1748 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1749 | - |
|
| 1750 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1751 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1752 | - |
|
| 1753 | - /* |
|
| 1731 | + if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1732 | + /** |
|
| 1733 | + * Filter: wl_feature__enable__screens. |
|
| 1734 | + * |
|
| 1735 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1736 | + * |
|
| 1737 | + * @return bool |
|
| 1738 | + * @since 3.27.6 |
|
| 1739 | + */ |
|
| 1740 | + if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1741 | + $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
|
| 1742 | + $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1743 | + } |
|
| 1744 | + } |
|
| 1745 | + |
|
| 1746 | + // Hook key update. |
|
| 1747 | + $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1748 | + $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1749 | + |
|
| 1750 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1751 | + $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1752 | + |
|
| 1753 | + /* |
|
| 1754 | 1754 | * Remove the Analytics Settings link from the plugin page. |
| 1755 | 1755 | * |
| 1756 | 1756 | * @see https://github.com/insideout10/wordlift-plugin/issues/932 |
| 1757 | 1757 | * @since 3.21.1 |
| 1758 | 1758 | */ |
| 1759 | - // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1760 | - |
|
| 1761 | - // Hook the AJAX `wl_publisher` action name. |
|
| 1762 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1763 | - |
|
| 1764 | - // Hook row actions for the entity type list admin. |
|
| 1765 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1766 | - |
|
| 1767 | - /** Ajax actions. */ |
|
| 1768 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1769 | - |
|
| 1770 | - // Hook capabilities manipulation to allow access to entity type admin |
|
| 1771 | - // page on WordPress versions before 4.7. |
|
| 1772 | - global $wp_version; |
|
| 1773 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1774 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1775 | - } |
|
| 1776 | - |
|
| 1777 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1778 | - |
|
| 1779 | - /** Adapters. */ |
|
| 1780 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1781 | - /** |
|
| 1782 | - * Disabling Faq temporarily. |
|
| 1783 | - * Load the tinymce editor button on the tool bar. |
|
| 1784 | - * @since 3.26.0 |
|
| 1785 | - */ |
|
| 1786 | - //$this->loader->add_filter( 'tiny_mce_before_init', $this->faq_tinymce_adapter, 'register_custom_tags' ); |
|
| 1787 | - //$this->loader->add_filter( 'mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
| 1788 | - //$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
| 1789 | - |
|
| 1790 | - |
|
| 1791 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1792 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1793 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1794 | - /** |
|
| 1795 | - * @since 3.26.0 |
|
| 1796 | - */ |
|
| 1797 | - if ( apply_filters( 'wl_feature__enable__post_excerpt', true ) ) { |
|
| 1798 | - $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
| 1799 | - $this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1800 | - // Adding Rest route for the post excerpt |
|
| 1801 | - Post_Excerpt_Rest_Controller::register_routes(); |
|
| 1802 | - } |
|
| 1803 | - |
|
| 1804 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1805 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1806 | - |
|
| 1807 | - // Handle the autocomplete request. |
|
| 1808 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1809 | - $this->autocomplete_adapter, |
|
| 1810 | - 'wl_autocomplete', |
|
| 1811 | - ) ); |
|
| 1812 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1813 | - $this->autocomplete_adapter, |
|
| 1814 | - 'wl_autocomplete', |
|
| 1815 | - ) ); |
|
| 1816 | - |
|
| 1817 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1818 | - if ( is_multisite() ) { |
|
| 1819 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1820 | - } |
|
| 1821 | - |
|
| 1822 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1823 | - |
|
| 1824 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1825 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1826 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1827 | - |
|
| 1828 | - /** |
|
| 1829 | - * Always allow the `wordlift/classification` block. |
|
| 1830 | - * |
|
| 1831 | - * @since 3.23.0 |
|
| 1832 | - */ |
|
| 1833 | - add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1834 | - |
|
| 1835 | - if ( true === $value ) { |
|
| 1836 | - return $value; |
|
| 1837 | - } |
|
| 1838 | - |
|
| 1839 | - return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1840 | - }, PHP_INT_MAX ); |
|
| 1841 | - |
|
| 1842 | - /** |
|
| 1843 | - * @since 3.27.7 |
|
| 1844 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
| 1845 | - */ |
|
| 1846 | - new Top_Entities(); |
|
| 1847 | - } |
|
| 1848 | - |
|
| 1849 | - /** |
|
| 1850 | - * Register all of the hooks related to the public-facing functionality |
|
| 1851 | - * of the plugin. |
|
| 1852 | - * |
|
| 1853 | - * @since 1.0.0 |
|
| 1854 | - * @access private |
|
| 1855 | - */ |
|
| 1856 | - private function define_public_hooks() { |
|
| 1857 | - |
|
| 1858 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1859 | - |
|
| 1860 | - // Register the entity post type. |
|
| 1861 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1862 | - |
|
| 1863 | - // Bind the link generation and handling hooks to the entity link service. |
|
| 1864 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1865 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1866 | - // $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 ); |
|
| 1867 | - // $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 ); |
|
| 1868 | - |
|
| 1869 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1870 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1871 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1872 | - |
|
| 1873 | - // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
| 1874 | - $this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1875 | - // Hook the content filter service to add entity links. |
|
| 1876 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1877 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1878 | - } |
|
| 1879 | - |
|
| 1880 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1881 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1882 | - |
|
| 1883 | - // Hook the ShareThis service. |
|
| 1884 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1885 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1886 | - |
|
| 1887 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1888 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1889 | - |
|
| 1890 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1891 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1892 | - // to categories. |
|
| 1893 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1894 | - |
|
| 1895 | - /* |
|
| 1759 | + // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1760 | + |
|
| 1761 | + // Hook the AJAX `wl_publisher` action name. |
|
| 1762 | + $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1763 | + |
|
| 1764 | + // Hook row actions for the entity type list admin. |
|
| 1765 | + $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1766 | + |
|
| 1767 | + /** Ajax actions. */ |
|
| 1768 | + $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1769 | + |
|
| 1770 | + // Hook capabilities manipulation to allow access to entity type admin |
|
| 1771 | + // page on WordPress versions before 4.7. |
|
| 1772 | + global $wp_version; |
|
| 1773 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1774 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1775 | + } |
|
| 1776 | + |
|
| 1777 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1778 | + |
|
| 1779 | + /** Adapters. */ |
|
| 1780 | + $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1781 | + /** |
|
| 1782 | + * Disabling Faq temporarily. |
|
| 1783 | + * Load the tinymce editor button on the tool bar. |
|
| 1784 | + * @since 3.26.0 |
|
| 1785 | + */ |
|
| 1786 | + //$this->loader->add_filter( 'tiny_mce_before_init', $this->faq_tinymce_adapter, 'register_custom_tags' ); |
|
| 1787 | + //$this->loader->add_filter( 'mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
| 1788 | + //$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
| 1789 | + |
|
| 1790 | + |
|
| 1791 | + $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1792 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1793 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1794 | + /** |
|
| 1795 | + * @since 3.26.0 |
|
| 1796 | + */ |
|
| 1797 | + if ( apply_filters( 'wl_feature__enable__post_excerpt', true ) ) { |
|
| 1798 | + $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
| 1799 | + $this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1800 | + // Adding Rest route for the post excerpt |
|
| 1801 | + Post_Excerpt_Rest_Controller::register_routes(); |
|
| 1802 | + } |
|
| 1803 | + |
|
| 1804 | + $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1805 | + $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1806 | + |
|
| 1807 | + // Handle the autocomplete request. |
|
| 1808 | + add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1809 | + $this->autocomplete_adapter, |
|
| 1810 | + 'wl_autocomplete', |
|
| 1811 | + ) ); |
|
| 1812 | + add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1813 | + $this->autocomplete_adapter, |
|
| 1814 | + 'wl_autocomplete', |
|
| 1815 | + ) ); |
|
| 1816 | + |
|
| 1817 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1818 | + if ( is_multisite() ) { |
|
| 1819 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1820 | + } |
|
| 1821 | + |
|
| 1822 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1823 | + |
|
| 1824 | + add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1825 | + add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1826 | + add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1827 | + |
|
| 1828 | + /** |
|
| 1829 | + * Always allow the `wordlift/classification` block. |
|
| 1830 | + * |
|
| 1831 | + * @since 3.23.0 |
|
| 1832 | + */ |
|
| 1833 | + add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1834 | + |
|
| 1835 | + if ( true === $value ) { |
|
| 1836 | + return $value; |
|
| 1837 | + } |
|
| 1838 | + |
|
| 1839 | + return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1840 | + }, PHP_INT_MAX ); |
|
| 1841 | + |
|
| 1842 | + /** |
|
| 1843 | + * @since 3.27.7 |
|
| 1844 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
| 1845 | + */ |
|
| 1846 | + new Top_Entities(); |
|
| 1847 | + } |
|
| 1848 | + |
|
| 1849 | + /** |
|
| 1850 | + * Register all of the hooks related to the public-facing functionality |
|
| 1851 | + * of the plugin. |
|
| 1852 | + * |
|
| 1853 | + * @since 1.0.0 |
|
| 1854 | + * @access private |
|
| 1855 | + */ |
|
| 1856 | + private function define_public_hooks() { |
|
| 1857 | + |
|
| 1858 | + $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1859 | + |
|
| 1860 | + // Register the entity post type. |
|
| 1861 | + $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1862 | + |
|
| 1863 | + // Bind the link generation and handling hooks to the entity link service. |
|
| 1864 | + $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1865 | + $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1866 | + // $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 ); |
|
| 1867 | + // $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 ); |
|
| 1868 | + |
|
| 1869 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1870 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1871 | + $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1872 | + |
|
| 1873 | + // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
| 1874 | + $this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1875 | + // Hook the content filter service to add entity links. |
|
| 1876 | + if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1877 | + $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1878 | + } |
|
| 1879 | + |
|
| 1880 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1881 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1882 | + |
|
| 1883 | + // Hook the ShareThis service. |
|
| 1884 | + $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1885 | + $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1886 | + |
|
| 1887 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1888 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1889 | + |
|
| 1890 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1891 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1892 | + // to categories. |
|
| 1893 | + $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1894 | + |
|
| 1895 | + /* |
|
| 1896 | 1896 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1897 | 1897 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1898 | 1898 | * order of start time. |
| 1899 | 1899 | */ |
| 1900 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1901 | - |
|
| 1902 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1903 | - |
|
| 1904 | - // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1905 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1906 | - |
|
| 1907 | - // Analytics Script Frontend. |
|
| 1908 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1909 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1910 | - } |
|
| 1911 | - |
|
| 1912 | - } |
|
| 1913 | - |
|
| 1914 | - /** |
|
| 1915 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 1916 | - * |
|
| 1917 | - * @since 1.0.0 |
|
| 1918 | - */ |
|
| 1919 | - public function run() { |
|
| 1920 | - $this->loader->run(); |
|
| 1921 | - } |
|
| 1922 | - |
|
| 1923 | - /** |
|
| 1924 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 1925 | - * WordPress and to define internationalization functionality. |
|
| 1926 | - * |
|
| 1927 | - * @return string The name of the plugin. |
|
| 1928 | - * @since 1.0.0 |
|
| 1929 | - */ |
|
| 1930 | - public function get_plugin_name() { |
|
| 1931 | - return $this->plugin_name; |
|
| 1932 | - } |
|
| 1933 | - |
|
| 1934 | - /** |
|
| 1935 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1936 | - * |
|
| 1937 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1938 | - * @since 1.0.0 |
|
| 1939 | - */ |
|
| 1940 | - public function get_loader() { |
|
| 1941 | - return $this->loader; |
|
| 1942 | - } |
|
| 1943 | - |
|
| 1944 | - /** |
|
| 1945 | - * Retrieve the version number of the plugin. |
|
| 1946 | - * |
|
| 1947 | - * @return string The version number of the plugin. |
|
| 1948 | - * @since 1.0.0 |
|
| 1949 | - */ |
|
| 1950 | - public function get_version() { |
|
| 1951 | - return $this->version; |
|
| 1952 | - } |
|
| 1953 | - |
|
| 1954 | - /** |
|
| 1955 | - * Load dependencies for WP-CLI. |
|
| 1956 | - * |
|
| 1957 | - * @throws Exception |
|
| 1958 | - * @since 3.18.0 |
|
| 1959 | - */ |
|
| 1960 | - private function load_cli_dependencies() { |
|
| 1961 | - |
|
| 1962 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1963 | - |
|
| 1964 | - $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 ); |
|
| 1965 | - |
|
| 1966 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1967 | - |
|
| 1968 | - } |
|
| 1969 | - |
|
| 1970 | - /** |
|
| 1971 | - * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 1972 | - * |
|
| 1973 | - * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 1974 | - * @since 3.20.0 |
|
| 1975 | - */ |
|
| 1976 | - public function get_dashboard_service() { |
|
| 1977 | - |
|
| 1978 | - return $this->dashboard_service; |
|
| 1979 | - } |
|
| 1980 | - |
|
| 1981 | - public function add_wl_enabled_blocks() { |
|
| 1982 | - /** |
|
| 1983 | - * Filter: wl_feature__enable__blocks. |
|
| 1984 | - * |
|
| 1985 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1986 | - * |
|
| 1987 | - * @return bool |
|
| 1988 | - * @since 3.27.6 |
|
| 1989 | - */ |
|
| 1990 | - |
|
| 1991 | - wp_register_script( 'wl_enabled_blocks', false ); |
|
| 1992 | - |
|
| 1993 | - $enabled_blocks = array( 'wordlift/products-navigator' ); |
|
| 1994 | - |
|
| 1995 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1996 | - // To intimate JS |
|
| 1997 | - $enabled_blocks = array_merge( $enabled_blocks, array( |
|
| 1998 | - 'wordlift/navigator', |
|
| 1999 | - 'wordlift/chord', |
|
| 2000 | - 'wordlift/geomap', |
|
| 2001 | - 'wordlift/timeline', |
|
| 2002 | - 'wordlift/cloud', |
|
| 2003 | - 'wordlift/vocabulary', |
|
| 2004 | - 'wordlift/faceted-search' |
|
| 2005 | - ) ); |
|
| 2006 | - } |
|
| 2007 | - |
|
| 2008 | - wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 2009 | - wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 2010 | - } |
|
| 1900 | + $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1901 | + |
|
| 1902 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1903 | + |
|
| 1904 | + // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1905 | + $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1906 | + |
|
| 1907 | + // Analytics Script Frontend. |
|
| 1908 | + if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1909 | + $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1910 | + } |
|
| 1911 | + |
|
| 1912 | + } |
|
| 1913 | + |
|
| 1914 | + /** |
|
| 1915 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 1916 | + * |
|
| 1917 | + * @since 1.0.0 |
|
| 1918 | + */ |
|
| 1919 | + public function run() { |
|
| 1920 | + $this->loader->run(); |
|
| 1921 | + } |
|
| 1922 | + |
|
| 1923 | + /** |
|
| 1924 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 1925 | + * WordPress and to define internationalization functionality. |
|
| 1926 | + * |
|
| 1927 | + * @return string The name of the plugin. |
|
| 1928 | + * @since 1.0.0 |
|
| 1929 | + */ |
|
| 1930 | + public function get_plugin_name() { |
|
| 1931 | + return $this->plugin_name; |
|
| 1932 | + } |
|
| 1933 | + |
|
| 1934 | + /** |
|
| 1935 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1936 | + * |
|
| 1937 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1938 | + * @since 1.0.0 |
|
| 1939 | + */ |
|
| 1940 | + public function get_loader() { |
|
| 1941 | + return $this->loader; |
|
| 1942 | + } |
|
| 1943 | + |
|
| 1944 | + /** |
|
| 1945 | + * Retrieve the version number of the plugin. |
|
| 1946 | + * |
|
| 1947 | + * @return string The version number of the plugin. |
|
| 1948 | + * @since 1.0.0 |
|
| 1949 | + */ |
|
| 1950 | + public function get_version() { |
|
| 1951 | + return $this->version; |
|
| 1952 | + } |
|
| 1953 | + |
|
| 1954 | + /** |
|
| 1955 | + * Load dependencies for WP-CLI. |
|
| 1956 | + * |
|
| 1957 | + * @throws Exception |
|
| 1958 | + * @since 3.18.0 |
|
| 1959 | + */ |
|
| 1960 | + private function load_cli_dependencies() { |
|
| 1961 | + |
|
| 1962 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1963 | + |
|
| 1964 | + $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 ); |
|
| 1965 | + |
|
| 1966 | + WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1967 | + |
|
| 1968 | + } |
|
| 1969 | + |
|
| 1970 | + /** |
|
| 1971 | + * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 1972 | + * |
|
| 1973 | + * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 1974 | + * @since 3.20.0 |
|
| 1975 | + */ |
|
| 1976 | + public function get_dashboard_service() { |
|
| 1977 | + |
|
| 1978 | + return $this->dashboard_service; |
|
| 1979 | + } |
|
| 1980 | + |
|
| 1981 | + public function add_wl_enabled_blocks() { |
|
| 1982 | + /** |
|
| 1983 | + * Filter: wl_feature__enable__blocks. |
|
| 1984 | + * |
|
| 1985 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1986 | + * |
|
| 1987 | + * @return bool |
|
| 1988 | + * @since 3.27.6 |
|
| 1989 | + */ |
|
| 1990 | + |
|
| 1991 | + wp_register_script( 'wl_enabled_blocks', false ); |
|
| 1992 | + |
|
| 1993 | + $enabled_blocks = array( 'wordlift/products-navigator' ); |
|
| 1994 | + |
|
| 1995 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1996 | + // To intimate JS |
|
| 1997 | + $enabled_blocks = array_merge( $enabled_blocks, array( |
|
| 1998 | + 'wordlift/navigator', |
|
| 1999 | + 'wordlift/chord', |
|
| 2000 | + 'wordlift/geomap', |
|
| 2001 | + 'wordlift/timeline', |
|
| 2002 | + 'wordlift/cloud', |
|
| 2003 | + 'wordlift/vocabulary', |
|
| 2004 | + 'wordlift/faceted-search' |
|
| 2005 | + ) ); |
|
| 2006 | + } |
|
| 2007 | + |
|
| 2008 | + wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 2009 | + wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 2010 | + } |
|
| 2011 | 2011 | |
| 2012 | 2012 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | use Wordlift\Api\Default_Api_Service; |
| 14 | 14 | |
| 15 | 15 | if ( ! defined( 'ABSPATH' ) ) { |
| 16 | - exit; |
|
| 16 | + exit; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -23,721 +23,721 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | class Wordlift_Configuration_Service { |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * The entity base path option name. |
|
| 28 | - * |
|
| 29 | - * @since 3.6.0 |
|
| 30 | - */ |
|
| 31 | - const ENTITY_BASE_PATH_KEY = 'wl_entity_base_path'; |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * The skip wizard (admin installation wizard) option name. |
|
| 35 | - * |
|
| 36 | - * @since 3.9.0 |
|
| 37 | - */ |
|
| 38 | - const SKIP_WIZARD = 'wl_skip_wizard'; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * WordLift's key option name. |
|
| 42 | - * |
|
| 43 | - * @since 3.9.0 |
|
| 44 | - */ |
|
| 45 | - const KEY = 'key'; |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * WordLift's configured language option name. |
|
| 49 | - * |
|
| 50 | - * @since 3.9.0 |
|
| 51 | - */ |
|
| 52 | - const LANGUAGE = 'site_language'; |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * WordLift's configured country code. |
|
| 56 | - * |
|
| 57 | - * @since 3.18.0 |
|
| 58 | - */ |
|
| 59 | - const COUNTRY_CODE = 'country_code'; |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * The publisher entity post ID option name. |
|
| 63 | - * |
|
| 64 | - * @since 3.9.0 |
|
| 65 | - */ |
|
| 66 | - const PUBLISHER_ID = 'publisher_id'; |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * The dataset URI option name |
|
| 70 | - * |
|
| 71 | - * @since 3.10.0 |
|
| 72 | - */ |
|
| 73 | - const DATASET_URI = 'redlink_dataset_uri'; |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * The link by default option name. |
|
| 77 | - * |
|
| 78 | - * @since 3.11.0 |
|
| 79 | - */ |
|
| 80 | - const LINK_BY_DEFAULT = 'link_by_default'; |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * The analytics enable option. |
|
| 84 | - * |
|
| 85 | - * @since 3.21.0 |
|
| 86 | - */ |
|
| 87 | - const ANALYTICS_ENABLE = 'analytics_enable'; |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * The analytics entity uri dimension option. |
|
| 91 | - * |
|
| 92 | - * @since 3.21.0 |
|
| 93 | - */ |
|
| 94 | - const ANALYTICS_ENTITY_URI_DIMENSION = 'analytics_entity_uri_dimension'; |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * The analytics entity type dimension option. |
|
| 98 | - * |
|
| 99 | - * @since 3.21.0 |
|
| 100 | - */ |
|
| 101 | - const ANALYTICS_ENTITY_TYPE_DIMENSION = 'analytics_entity_type_dimension'; |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * The user preferences about sharing data option. |
|
| 105 | - * |
|
| 106 | - * @since 3.19.0 |
|
| 107 | - */ |
|
| 108 | - const SEND_DIAGNOSTIC = 'send_diagnostic'; |
|
| 109 | - |
|
| 110 | - /** |
|
| 111 | - * The package type configuration key. |
|
| 112 | - * |
|
| 113 | - * @since 3.20.0 |
|
| 114 | - */ |
|
| 115 | - const PACKAGE_TYPE = 'package_type'; |
|
| 116 | - |
|
| 117 | - /** |
|
| 118 | - * The {@link Wordlift_Log_Service} instance. |
|
| 119 | - * |
|
| 120 | - * @since 3.16.0 |
|
| 121 | - * |
|
| 122 | - * @var \Wordlift_Log_Service $log The {@link Wordlift_Log_Service} instance. |
|
| 123 | - */ |
|
| 124 | - private $log; |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * The Wordlift_Configuration_Service's singleton instance. |
|
| 128 | - * |
|
| 129 | - * @since 3.6.0 |
|
| 130 | - * |
|
| 131 | - * @access private |
|
| 132 | - * @var \Wordlift_Configuration_Service $instance Wordlift_Configuration_Service's singleton instance. |
|
| 133 | - */ |
|
| 134 | - private static $instance; |
|
| 135 | - |
|
| 136 | - /** |
|
| 137 | - * Create a Wordlift_Configuration_Service's instance. |
|
| 138 | - * |
|
| 139 | - * @since 3.6.0 |
|
| 140 | - */ |
|
| 141 | - public function __construct() { |
|
| 142 | - |
|
| 143 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 144 | - |
|
| 145 | - self::$instance = $this; |
|
| 146 | - |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - /** |
|
| 150 | - * Get the singleton instance. |
|
| 151 | - * |
|
| 152 | - * @return \Wordlift_Configuration_Service |
|
| 153 | - * @since 3.6.0 |
|
| 154 | - * |
|
| 155 | - */ |
|
| 156 | - public static function get_instance() { |
|
| 157 | - |
|
| 158 | - return self::$instance; |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - /** |
|
| 162 | - * Get a configuration given the option name and a key. The option value is |
|
| 163 | - * expected to be an array. |
|
| 164 | - * |
|
| 165 | - * @param string $option The option name. |
|
| 166 | - * @param string $key A key in the option value array. |
|
| 167 | - * @param string $default The default value in case the key is not found (by default an empty string). |
|
| 168 | - * |
|
| 169 | - * @return mixed The configuration value or the default value if not found. |
|
| 170 | - * @since 3.6.0 |
|
| 171 | - * |
|
| 172 | - */ |
|
| 173 | - private function get( $option, $key, $default = '' ) { |
|
| 174 | - |
|
| 175 | - $options = get_option( $option, array() ); |
|
| 176 | - |
|
| 177 | - return isset( $options[ $key ] ) ? $options[ $key ] : $default; |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - /** |
|
| 181 | - * Set a configuration parameter. |
|
| 182 | - * |
|
| 183 | - * @param string $option Name of option to retrieve. Expected to not be SQL-escaped. |
|
| 184 | - * @param string $key The value key. |
|
| 185 | - * @param mixed $value The value. |
|
| 186 | - * |
|
| 187 | - * @since 3.9.0 |
|
| 188 | - * |
|
| 189 | - */ |
|
| 190 | - private function set( $option, $key, $value ) { |
|
| 191 | - |
|
| 192 | - $values = get_option( $option ); |
|
| 193 | - $values = isset( $values ) ? $values : array(); |
|
| 194 | - $values[ $key ] = $value; |
|
| 195 | - update_option( $option, $values ); |
|
| 196 | - |
|
| 197 | - } |
|
| 198 | - |
|
| 199 | - /** |
|
| 200 | - * Get the entity base path, by default 'entity'. |
|
| 201 | - * |
|
| 202 | - * @return string The entity base path. |
|
| 203 | - * @since 3.6.0 |
|
| 204 | - * |
|
| 205 | - */ |
|
| 206 | - public function get_entity_base_path() { |
|
| 207 | - |
|
| 208 | - return $this->get( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, 'entity' ); |
|
| 209 | - } |
|
| 210 | - |
|
| 211 | - /** |
|
| 212 | - * Get the entity base path. |
|
| 213 | - * |
|
| 214 | - * @param string $value The entity base path. |
|
| 215 | - * |
|
| 216 | - * @since 3.9.0 |
|
| 217 | - * |
|
| 218 | - */ |
|
| 219 | - public function set_entity_base_path( $value ) { |
|
| 220 | - |
|
| 221 | - $this->set( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, $value ); |
|
| 222 | - |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - /** |
|
| 226 | - * Whether the installation skip wizard should be skipped. |
|
| 227 | - * |
|
| 228 | - * @return bool True if it should be skipped otherwise false. |
|
| 229 | - * @since 3.9.0 |
|
| 230 | - * |
|
| 231 | - */ |
|
| 232 | - public function is_skip_wizard() { |
|
| 233 | - |
|
| 234 | - return $this->get( 'wl_general_settings', self::SKIP_WIZARD, false ); |
|
| 235 | - } |
|
| 236 | - |
|
| 237 | - /** |
|
| 238 | - * Set the skip wizard parameter. |
|
| 239 | - * |
|
| 240 | - * @param bool $value True to skip the wizard. We expect a boolean value. |
|
| 241 | - * |
|
| 242 | - * @since 3.9.0 |
|
| 243 | - * |
|
| 244 | - */ |
|
| 245 | - public function set_skip_wizard( $value ) { |
|
| 246 | - |
|
| 247 | - $this->set( 'wl_general_settings', self::SKIP_WIZARD, true === $value ); |
|
| 248 | - |
|
| 249 | - } |
|
| 250 | - |
|
| 251 | - /** |
|
| 252 | - * Get WordLift's key. |
|
| 253 | - * |
|
| 254 | - * @return string WordLift's key or an empty string if not set. |
|
| 255 | - * @since 3.9.0 |
|
| 256 | - * |
|
| 257 | - */ |
|
| 258 | - public function get_key() { |
|
| 259 | - |
|
| 260 | - return $this->get( 'wl_general_settings', self::KEY, '' ); |
|
| 261 | - } |
|
| 262 | - |
|
| 263 | - /** |
|
| 264 | - * Set WordLift's key. |
|
| 265 | - * |
|
| 266 | - * @param string $value WordLift's key. |
|
| 267 | - * |
|
| 268 | - * @since 3.9.0 |
|
| 269 | - * |
|
| 270 | - */ |
|
| 271 | - public function set_key( $value ) { |
|
| 272 | - |
|
| 273 | - $this->set( 'wl_general_settings', self::KEY, $value ); |
|
| 274 | - } |
|
| 275 | - |
|
| 276 | - /** |
|
| 277 | - * Get WordLift's configured language, by default 'en'. |
|
| 278 | - * |
|
| 279 | - * Note that WordLift's language is used when writing strings to the Linked Data dataset, not for the analysis. |
|
| 280 | - * |
|
| 281 | - * @return string WordLift's configured language code ('en' by default). |
|
| 282 | - * @since 3.9.0 |
|
| 283 | - * |
|
| 284 | - */ |
|
| 285 | - public function get_language_code() { |
|
| 286 | - |
|
| 287 | - return $this->get( 'wl_general_settings', self::LANGUAGE, 'en' ); |
|
| 288 | - } |
|
| 289 | - |
|
| 290 | - /** |
|
| 291 | - * Set WordLift's language code, used when storing strings to the Linked Data dataset. |
|
| 292 | - * |
|
| 293 | - * @param string $value WordLift's language code. |
|
| 294 | - * |
|
| 295 | - * @since 3.9.0 |
|
| 296 | - * |
|
| 297 | - */ |
|
| 298 | - public function set_language_code( $value ) { |
|
| 299 | - |
|
| 300 | - $this->set( 'wl_general_settings', self::LANGUAGE, $value ); |
|
| 301 | - |
|
| 302 | - } |
|
| 303 | - |
|
| 304 | - /** |
|
| 305 | - * Set the user preferences about sharing diagnostic with us. |
|
| 306 | - * |
|
| 307 | - * @param string $value The user preferences(yes/no). |
|
| 308 | - * |
|
| 309 | - * @since 3.19.0 |
|
| 310 | - * |
|
| 311 | - */ |
|
| 312 | - public function set_diagnostic_preferences( $value ) { |
|
| 313 | - |
|
| 314 | - $this->set( 'wl_general_settings', self::SEND_DIAGNOSTIC, $value ); |
|
| 315 | - |
|
| 316 | - } |
|
| 317 | - |
|
| 318 | - /** |
|
| 319 | - * Get the user preferences about sharing diagnostic. |
|
| 320 | - * |
|
| 321 | - * @since 3.19.0 |
|
| 322 | - */ |
|
| 323 | - public function get_diagnostic_preferences() { |
|
| 324 | - |
|
| 325 | - return $this->get( 'wl_general_settings', self::SEND_DIAGNOSTIC, 'no' ); |
|
| 326 | - } |
|
| 327 | - |
|
| 328 | - /** |
|
| 329 | - * Get WordLift's configured country code, by default 'us'. |
|
| 330 | - * |
|
| 331 | - * @return string WordLift's configured country code ('us' by default). |
|
| 332 | - * @since 3.18.0 |
|
| 333 | - * |
|
| 334 | - */ |
|
| 335 | - public function get_country_code() { |
|
| 336 | - |
|
| 337 | - return $this->get( 'wl_general_settings', self::COUNTRY_CODE, 'us' ); |
|
| 338 | - } |
|
| 339 | - |
|
| 340 | - /** |
|
| 341 | - * Set WordLift's country code. |
|
| 342 | - * |
|
| 343 | - * @param string $value WordLift's country code. |
|
| 344 | - * |
|
| 345 | - * @since 3.18.0 |
|
| 346 | - * |
|
| 347 | - */ |
|
| 348 | - public function set_country_code( $value ) { |
|
| 349 | - |
|
| 350 | - $this->set( 'wl_general_settings', self::COUNTRY_CODE, $value ); |
|
| 351 | - |
|
| 352 | - } |
|
| 353 | - |
|
| 354 | - /** |
|
| 355 | - * Get the publisher entity post id. |
|
| 356 | - * |
|
| 357 | - * The publisher entity post id points to an entity post which contains the data for the publisher used in schema.org |
|
| 358 | - * Article markup. |
|
| 359 | - * |
|
| 360 | - * @return int|NULL The publisher entity post id or NULL if not set. |
|
| 361 | - * @since 3.9.0 |
|
| 362 | - * |
|
| 363 | - */ |
|
| 364 | - public function get_publisher_id() { |
|
| 365 | - |
|
| 366 | - return $this->get( 'wl_general_settings', self::PUBLISHER_ID, null ); |
|
| 367 | - } |
|
| 368 | - |
|
| 369 | - /** |
|
| 370 | - * Set the publisher entity post id. |
|
| 371 | - * |
|
| 372 | - * @param int $value The publisher entity post id. |
|
| 373 | - * |
|
| 374 | - * @since 3.9.0 |
|
| 375 | - * |
|
| 376 | - */ |
|
| 377 | - public function set_publisher_id( $value ) { |
|
| 378 | - |
|
| 379 | - $this->set( 'wl_general_settings', self::PUBLISHER_ID, $value ); |
|
| 380 | - |
|
| 381 | - } |
|
| 382 | - |
|
| 383 | - /** |
|
| 384 | - * Get the dataset URI. |
|
| 385 | - * |
|
| 386 | - * @return string The dataset URI or an empty string if not set. |
|
| 387 | - * @since 3.10.0 |
|
| 388 | - * @since 3.27.7 Always return null if `wl_features__enable__dataset` is disabled. |
|
| 389 | - * |
|
| 390 | - */ |
|
| 391 | - public function get_dataset_uri() { |
|
| 392 | - |
|
| 393 | - if ( apply_filters( 'wl_features__enable__dataset', true ) ) { |
|
| 394 | - return $this->get( 'wl_advanced_settings', self::DATASET_URI, null ); |
|
| 395 | - } else { |
|
| 396 | - return null; |
|
| 397 | - } |
|
| 398 | - } |
|
| 399 | - |
|
| 400 | - /** |
|
| 401 | - * Set the dataset URI. |
|
| 402 | - * |
|
| 403 | - * @param string $value The dataset URI. |
|
| 404 | - * |
|
| 405 | - * @since 3.10.0 |
|
| 406 | - * |
|
| 407 | - */ |
|
| 408 | - public function set_dataset_uri( $value ) { |
|
| 409 | - |
|
| 410 | - $this->set( 'wl_advanced_settings', self::DATASET_URI, $value ); |
|
| 411 | - } |
|
| 412 | - |
|
| 413 | - /** |
|
| 414 | - * Get the package type. |
|
| 415 | - * |
|
| 416 | - * @return string The package type or an empty string if not set. |
|
| 417 | - * @since 3.20.0 |
|
| 418 | - * |
|
| 419 | - */ |
|
| 420 | - public function get_package_type() { |
|
| 421 | - |
|
| 422 | - return $this->get( 'wl_advanced_settings', self::PACKAGE_TYPE, null ); |
|
| 423 | - } |
|
| 424 | - |
|
| 425 | - /** |
|
| 426 | - * Set the package type. |
|
| 427 | - * |
|
| 428 | - * @param string $value The package type. |
|
| 429 | - * |
|
| 430 | - * @since 3.20.0 |
|
| 431 | - * |
|
| 432 | - */ |
|
| 433 | - public function set_package_type( $value ) { |
|
| 434 | - |
|
| 435 | - $this->set( 'wl_advanced_settings', self::PACKAGE_TYPE, $value ); |
|
| 436 | - } |
|
| 437 | - |
|
| 438 | - /** |
|
| 439 | - * Intercept the change of the WordLift key in order to set the dataset URI. |
|
| 440 | - * |
|
| 441 | - * |
|
| 442 | - * @since 3.20.0 as of #761, we save settings every time a key is set, not only when the key changes, so to |
|
| 443 | - * store the configuration parameters such as country or language. |
|
| 444 | - * @since 3.11.0 |
|
| 445 | - * |
|
| 446 | - * @see https://github.com/insideout10/wordlift-plugin/issues/761 |
|
| 447 | - * |
|
| 448 | - * @param array $old_value The old settings. |
|
| 449 | - * @param array $new_value The new settings. |
|
| 450 | - */ |
|
| 451 | - public function update_key( $old_value, $new_value ) { |
|
| 452 | - |
|
| 453 | - // Check the old key value and the new one. We're going to ask for the dataset URI only if the key has changed. |
|
| 454 | - // $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
| 455 | - $new_key = isset( $new_value['key'] ) ? $new_value['key'] : ''; |
|
| 456 | - |
|
| 457 | - // If the key hasn't changed, don't do anything. |
|
| 458 | - // WARN The 'update_option' hook is fired only if the new and old value are not equal. |
|
| 459 | - // if ( $old_key === $new_key ) { |
|
| 460 | - // return; |
|
| 461 | - // } |
|
| 462 | - |
|
| 463 | - // If the key is empty, empty the dataset URI. |
|
| 464 | - if ( '' === $new_key ) { |
|
| 465 | - $this->set_dataset_uri( '' ); |
|
| 466 | - } |
|
| 467 | - |
|
| 468 | - // make the request to the remote server. |
|
| 469 | - $this->get_remote_dataset_uri( $new_key ); |
|
| 470 | - |
|
| 471 | - } |
|
| 472 | - |
|
| 473 | - /** |
|
| 474 | - * Handle retrieving the dataset uri from the remote server. |
|
| 475 | - * |
|
| 476 | - * If a valid dataset uri is returned it is stored in the appropriate option, |
|
| 477 | - * otherwise the option is set to empty string. |
|
| 478 | - * |
|
| 479 | - * @param string $key The key to be used. |
|
| 480 | - * |
|
| 481 | - * @since 3.12.0 |
|
| 482 | - * |
|
| 483 | - * @since 3.17.0 send the site URL and get the dataset URI. |
|
| 484 | - */ |
|
| 485 | - public function get_remote_dataset_uri( $key ) { |
|
| 486 | - |
|
| 487 | - $this->log->trace( 'Getting the remote dataset URI and package type...' ); |
|
| 488 | - |
|
| 489 | - if ( empty( $key ) ) { |
|
| 490 | - $this->log->warn( 'Key set to empty value.' ); |
|
| 491 | - |
|
| 492 | - $this->set_dataset_uri( '' ); |
|
| 493 | - $this->set_package_type( null ); |
|
| 494 | - |
|
| 495 | - return; |
|
| 496 | - } |
|
| 497 | - |
|
| 498 | - /** |
|
| 499 | - * Allow 3rd parties to change the site_url. |
|
| 500 | - * |
|
| 501 | - * @param string $site_url The site url. |
|
| 502 | - * |
|
| 503 | - * @see https://github.com/insideout10/wordlift-plugin/issues/850 |
|
| 504 | - * |
|
| 505 | - * @since 3.20.0 |
|
| 506 | - * |
|
| 507 | - */ |
|
| 508 | - $home_url = defined( 'WP_HOME' ) ? WP_HOME : get_option( 'home' ); |
|
| 509 | - $site_url = apply_filters( 'wl_production_site_url', untrailingslashit( $home_url ) ); |
|
| 510 | - |
|
| 511 | - // Build the URL. |
|
| 512 | - $url = '/accounts' |
|
| 513 | - . '?key=' . rawurlencode( $key ) |
|
| 514 | - . '&url=' . rawurlencode( $site_url ) |
|
| 515 | - . '&country=' . $this->get_country_code() |
|
| 516 | - . '&language=' . $this->get_language_code(); |
|
| 517 | - |
|
| 518 | - $api_service = Default_Api_Service::get_instance(); |
|
| 519 | - /** |
|
| 520 | - * @since 3.27.7.1 |
|
| 521 | - * The Key should be passed to headers, otherwise api would return null. |
|
| 522 | - */ |
|
| 523 | - $headers = array( |
|
| 524 | - 'Authorization' => "Key $key", |
|
| 525 | - ); |
|
| 526 | - $response = $api_service->request( 'PUT', $url, $headers )->get_response(); |
|
| 527 | - |
|
| 528 | - // The response is an error. |
|
| 529 | - if ( is_wp_error( $response ) ) { |
|
| 530 | - $this->log->error( 'An error occurred setting the dataset URI: ' . $response->get_error_message() ); |
|
| 531 | - |
|
| 532 | - $this->set_dataset_uri( '' ); |
|
| 533 | - $this->set_package_type( null ); |
|
| 534 | - |
|
| 535 | - return; |
|
| 536 | - } |
|
| 537 | - |
|
| 538 | - // The response is not OK. |
|
| 539 | - if ( ! is_array( $response ) || 200 !== (int) $response['response']['code'] ) { |
|
| 540 | - $base_url = $api_service->get_base_url(); |
|
| 541 | - |
|
| 542 | - if ( ! is_array( $response ) ) { |
|
| 543 | - $this->log->error( "Unexpected response when opening URL $base_url$url: " . var_export( $response, true ) ); |
|
| 544 | - } else { |
|
| 545 | - $this->log->error( "Unexpected status code when opening URL $base_url$url: " . $response['response']['code'] . "\n" . var_export( $response, true ) ); |
|
| 546 | - } |
|
| 547 | - |
|
| 548 | - |
|
| 549 | - $this->set_dataset_uri( '' ); |
|
| 550 | - $this->set_package_type( null ); |
|
| 551 | - |
|
| 552 | - return; |
|
| 553 | - } |
|
| 554 | - |
|
| 555 | - /* |
|
| 26 | + /** |
|
| 27 | + * The entity base path option name. |
|
| 28 | + * |
|
| 29 | + * @since 3.6.0 |
|
| 30 | + */ |
|
| 31 | + const ENTITY_BASE_PATH_KEY = 'wl_entity_base_path'; |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * The skip wizard (admin installation wizard) option name. |
|
| 35 | + * |
|
| 36 | + * @since 3.9.0 |
|
| 37 | + */ |
|
| 38 | + const SKIP_WIZARD = 'wl_skip_wizard'; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * WordLift's key option name. |
|
| 42 | + * |
|
| 43 | + * @since 3.9.0 |
|
| 44 | + */ |
|
| 45 | + const KEY = 'key'; |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * WordLift's configured language option name. |
|
| 49 | + * |
|
| 50 | + * @since 3.9.0 |
|
| 51 | + */ |
|
| 52 | + const LANGUAGE = 'site_language'; |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * WordLift's configured country code. |
|
| 56 | + * |
|
| 57 | + * @since 3.18.0 |
|
| 58 | + */ |
|
| 59 | + const COUNTRY_CODE = 'country_code'; |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * The publisher entity post ID option name. |
|
| 63 | + * |
|
| 64 | + * @since 3.9.0 |
|
| 65 | + */ |
|
| 66 | + const PUBLISHER_ID = 'publisher_id'; |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * The dataset URI option name |
|
| 70 | + * |
|
| 71 | + * @since 3.10.0 |
|
| 72 | + */ |
|
| 73 | + const DATASET_URI = 'redlink_dataset_uri'; |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * The link by default option name. |
|
| 77 | + * |
|
| 78 | + * @since 3.11.0 |
|
| 79 | + */ |
|
| 80 | + const LINK_BY_DEFAULT = 'link_by_default'; |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * The analytics enable option. |
|
| 84 | + * |
|
| 85 | + * @since 3.21.0 |
|
| 86 | + */ |
|
| 87 | + const ANALYTICS_ENABLE = 'analytics_enable'; |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * The analytics entity uri dimension option. |
|
| 91 | + * |
|
| 92 | + * @since 3.21.0 |
|
| 93 | + */ |
|
| 94 | + const ANALYTICS_ENTITY_URI_DIMENSION = 'analytics_entity_uri_dimension'; |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * The analytics entity type dimension option. |
|
| 98 | + * |
|
| 99 | + * @since 3.21.0 |
|
| 100 | + */ |
|
| 101 | + const ANALYTICS_ENTITY_TYPE_DIMENSION = 'analytics_entity_type_dimension'; |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * The user preferences about sharing data option. |
|
| 105 | + * |
|
| 106 | + * @since 3.19.0 |
|
| 107 | + */ |
|
| 108 | + const SEND_DIAGNOSTIC = 'send_diagnostic'; |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | + * The package type configuration key. |
|
| 112 | + * |
|
| 113 | + * @since 3.20.0 |
|
| 114 | + */ |
|
| 115 | + const PACKAGE_TYPE = 'package_type'; |
|
| 116 | + |
|
| 117 | + /** |
|
| 118 | + * The {@link Wordlift_Log_Service} instance. |
|
| 119 | + * |
|
| 120 | + * @since 3.16.0 |
|
| 121 | + * |
|
| 122 | + * @var \Wordlift_Log_Service $log The {@link Wordlift_Log_Service} instance. |
|
| 123 | + */ |
|
| 124 | + private $log; |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * The Wordlift_Configuration_Service's singleton instance. |
|
| 128 | + * |
|
| 129 | + * @since 3.6.0 |
|
| 130 | + * |
|
| 131 | + * @access private |
|
| 132 | + * @var \Wordlift_Configuration_Service $instance Wordlift_Configuration_Service's singleton instance. |
|
| 133 | + */ |
|
| 134 | + private static $instance; |
|
| 135 | + |
|
| 136 | + /** |
|
| 137 | + * Create a Wordlift_Configuration_Service's instance. |
|
| 138 | + * |
|
| 139 | + * @since 3.6.0 |
|
| 140 | + */ |
|
| 141 | + public function __construct() { |
|
| 142 | + |
|
| 143 | + $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 144 | + |
|
| 145 | + self::$instance = $this; |
|
| 146 | + |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * Get the singleton instance. |
|
| 151 | + * |
|
| 152 | + * @return \Wordlift_Configuration_Service |
|
| 153 | + * @since 3.6.0 |
|
| 154 | + * |
|
| 155 | + */ |
|
| 156 | + public static function get_instance() { |
|
| 157 | + |
|
| 158 | + return self::$instance; |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + /** |
|
| 162 | + * Get a configuration given the option name and a key. The option value is |
|
| 163 | + * expected to be an array. |
|
| 164 | + * |
|
| 165 | + * @param string $option The option name. |
|
| 166 | + * @param string $key A key in the option value array. |
|
| 167 | + * @param string $default The default value in case the key is not found (by default an empty string). |
|
| 168 | + * |
|
| 169 | + * @return mixed The configuration value or the default value if not found. |
|
| 170 | + * @since 3.6.0 |
|
| 171 | + * |
|
| 172 | + */ |
|
| 173 | + private function get( $option, $key, $default = '' ) { |
|
| 174 | + |
|
| 175 | + $options = get_option( $option, array() ); |
|
| 176 | + |
|
| 177 | + return isset( $options[ $key ] ) ? $options[ $key ] : $default; |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + /** |
|
| 181 | + * Set a configuration parameter. |
|
| 182 | + * |
|
| 183 | + * @param string $option Name of option to retrieve. Expected to not be SQL-escaped. |
|
| 184 | + * @param string $key The value key. |
|
| 185 | + * @param mixed $value The value. |
|
| 186 | + * |
|
| 187 | + * @since 3.9.0 |
|
| 188 | + * |
|
| 189 | + */ |
|
| 190 | + private function set( $option, $key, $value ) { |
|
| 191 | + |
|
| 192 | + $values = get_option( $option ); |
|
| 193 | + $values = isset( $values ) ? $values : array(); |
|
| 194 | + $values[ $key ] = $value; |
|
| 195 | + update_option( $option, $values ); |
|
| 196 | + |
|
| 197 | + } |
|
| 198 | + |
|
| 199 | + /** |
|
| 200 | + * Get the entity base path, by default 'entity'. |
|
| 201 | + * |
|
| 202 | + * @return string The entity base path. |
|
| 203 | + * @since 3.6.0 |
|
| 204 | + * |
|
| 205 | + */ |
|
| 206 | + public function get_entity_base_path() { |
|
| 207 | + |
|
| 208 | + return $this->get( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, 'entity' ); |
|
| 209 | + } |
|
| 210 | + |
|
| 211 | + /** |
|
| 212 | + * Get the entity base path. |
|
| 213 | + * |
|
| 214 | + * @param string $value The entity base path. |
|
| 215 | + * |
|
| 216 | + * @since 3.9.0 |
|
| 217 | + * |
|
| 218 | + */ |
|
| 219 | + public function set_entity_base_path( $value ) { |
|
| 220 | + |
|
| 221 | + $this->set( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, $value ); |
|
| 222 | + |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + /** |
|
| 226 | + * Whether the installation skip wizard should be skipped. |
|
| 227 | + * |
|
| 228 | + * @return bool True if it should be skipped otherwise false. |
|
| 229 | + * @since 3.9.0 |
|
| 230 | + * |
|
| 231 | + */ |
|
| 232 | + public function is_skip_wizard() { |
|
| 233 | + |
|
| 234 | + return $this->get( 'wl_general_settings', self::SKIP_WIZARD, false ); |
|
| 235 | + } |
|
| 236 | + |
|
| 237 | + /** |
|
| 238 | + * Set the skip wizard parameter. |
|
| 239 | + * |
|
| 240 | + * @param bool $value True to skip the wizard. We expect a boolean value. |
|
| 241 | + * |
|
| 242 | + * @since 3.9.0 |
|
| 243 | + * |
|
| 244 | + */ |
|
| 245 | + public function set_skip_wizard( $value ) { |
|
| 246 | + |
|
| 247 | + $this->set( 'wl_general_settings', self::SKIP_WIZARD, true === $value ); |
|
| 248 | + |
|
| 249 | + } |
|
| 250 | + |
|
| 251 | + /** |
|
| 252 | + * Get WordLift's key. |
|
| 253 | + * |
|
| 254 | + * @return string WordLift's key or an empty string if not set. |
|
| 255 | + * @since 3.9.0 |
|
| 256 | + * |
|
| 257 | + */ |
|
| 258 | + public function get_key() { |
|
| 259 | + |
|
| 260 | + return $this->get( 'wl_general_settings', self::KEY, '' ); |
|
| 261 | + } |
|
| 262 | + |
|
| 263 | + /** |
|
| 264 | + * Set WordLift's key. |
|
| 265 | + * |
|
| 266 | + * @param string $value WordLift's key. |
|
| 267 | + * |
|
| 268 | + * @since 3.9.0 |
|
| 269 | + * |
|
| 270 | + */ |
|
| 271 | + public function set_key( $value ) { |
|
| 272 | + |
|
| 273 | + $this->set( 'wl_general_settings', self::KEY, $value ); |
|
| 274 | + } |
|
| 275 | + |
|
| 276 | + /** |
|
| 277 | + * Get WordLift's configured language, by default 'en'. |
|
| 278 | + * |
|
| 279 | + * Note that WordLift's language is used when writing strings to the Linked Data dataset, not for the analysis. |
|
| 280 | + * |
|
| 281 | + * @return string WordLift's configured language code ('en' by default). |
|
| 282 | + * @since 3.9.0 |
|
| 283 | + * |
|
| 284 | + */ |
|
| 285 | + public function get_language_code() { |
|
| 286 | + |
|
| 287 | + return $this->get( 'wl_general_settings', self::LANGUAGE, 'en' ); |
|
| 288 | + } |
|
| 289 | + |
|
| 290 | + /** |
|
| 291 | + * Set WordLift's language code, used when storing strings to the Linked Data dataset. |
|
| 292 | + * |
|
| 293 | + * @param string $value WordLift's language code. |
|
| 294 | + * |
|
| 295 | + * @since 3.9.0 |
|
| 296 | + * |
|
| 297 | + */ |
|
| 298 | + public function set_language_code( $value ) { |
|
| 299 | + |
|
| 300 | + $this->set( 'wl_general_settings', self::LANGUAGE, $value ); |
|
| 301 | + |
|
| 302 | + } |
|
| 303 | + |
|
| 304 | + /** |
|
| 305 | + * Set the user preferences about sharing diagnostic with us. |
|
| 306 | + * |
|
| 307 | + * @param string $value The user preferences(yes/no). |
|
| 308 | + * |
|
| 309 | + * @since 3.19.0 |
|
| 310 | + * |
|
| 311 | + */ |
|
| 312 | + public function set_diagnostic_preferences( $value ) { |
|
| 313 | + |
|
| 314 | + $this->set( 'wl_general_settings', self::SEND_DIAGNOSTIC, $value ); |
|
| 315 | + |
|
| 316 | + } |
|
| 317 | + |
|
| 318 | + /** |
|
| 319 | + * Get the user preferences about sharing diagnostic. |
|
| 320 | + * |
|
| 321 | + * @since 3.19.0 |
|
| 322 | + */ |
|
| 323 | + public function get_diagnostic_preferences() { |
|
| 324 | + |
|
| 325 | + return $this->get( 'wl_general_settings', self::SEND_DIAGNOSTIC, 'no' ); |
|
| 326 | + } |
|
| 327 | + |
|
| 328 | + /** |
|
| 329 | + * Get WordLift's configured country code, by default 'us'. |
|
| 330 | + * |
|
| 331 | + * @return string WordLift's configured country code ('us' by default). |
|
| 332 | + * @since 3.18.0 |
|
| 333 | + * |
|
| 334 | + */ |
|
| 335 | + public function get_country_code() { |
|
| 336 | + |
|
| 337 | + return $this->get( 'wl_general_settings', self::COUNTRY_CODE, 'us' ); |
|
| 338 | + } |
|
| 339 | + |
|
| 340 | + /** |
|
| 341 | + * Set WordLift's country code. |
|
| 342 | + * |
|
| 343 | + * @param string $value WordLift's country code. |
|
| 344 | + * |
|
| 345 | + * @since 3.18.0 |
|
| 346 | + * |
|
| 347 | + */ |
|
| 348 | + public function set_country_code( $value ) { |
|
| 349 | + |
|
| 350 | + $this->set( 'wl_general_settings', self::COUNTRY_CODE, $value ); |
|
| 351 | + |
|
| 352 | + } |
|
| 353 | + |
|
| 354 | + /** |
|
| 355 | + * Get the publisher entity post id. |
|
| 356 | + * |
|
| 357 | + * The publisher entity post id points to an entity post which contains the data for the publisher used in schema.org |
|
| 358 | + * Article markup. |
|
| 359 | + * |
|
| 360 | + * @return int|NULL The publisher entity post id or NULL if not set. |
|
| 361 | + * @since 3.9.0 |
|
| 362 | + * |
|
| 363 | + */ |
|
| 364 | + public function get_publisher_id() { |
|
| 365 | + |
|
| 366 | + return $this->get( 'wl_general_settings', self::PUBLISHER_ID, null ); |
|
| 367 | + } |
|
| 368 | + |
|
| 369 | + /** |
|
| 370 | + * Set the publisher entity post id. |
|
| 371 | + * |
|
| 372 | + * @param int $value The publisher entity post id. |
|
| 373 | + * |
|
| 374 | + * @since 3.9.0 |
|
| 375 | + * |
|
| 376 | + */ |
|
| 377 | + public function set_publisher_id( $value ) { |
|
| 378 | + |
|
| 379 | + $this->set( 'wl_general_settings', self::PUBLISHER_ID, $value ); |
|
| 380 | + |
|
| 381 | + } |
|
| 382 | + |
|
| 383 | + /** |
|
| 384 | + * Get the dataset URI. |
|
| 385 | + * |
|
| 386 | + * @return string The dataset URI or an empty string if not set. |
|
| 387 | + * @since 3.10.0 |
|
| 388 | + * @since 3.27.7 Always return null if `wl_features__enable__dataset` is disabled. |
|
| 389 | + * |
|
| 390 | + */ |
|
| 391 | + public function get_dataset_uri() { |
|
| 392 | + |
|
| 393 | + if ( apply_filters( 'wl_features__enable__dataset', true ) ) { |
|
| 394 | + return $this->get( 'wl_advanced_settings', self::DATASET_URI, null ); |
|
| 395 | + } else { |
|
| 396 | + return null; |
|
| 397 | + } |
|
| 398 | + } |
|
| 399 | + |
|
| 400 | + /** |
|
| 401 | + * Set the dataset URI. |
|
| 402 | + * |
|
| 403 | + * @param string $value The dataset URI. |
|
| 404 | + * |
|
| 405 | + * @since 3.10.0 |
|
| 406 | + * |
|
| 407 | + */ |
|
| 408 | + public function set_dataset_uri( $value ) { |
|
| 409 | + |
|
| 410 | + $this->set( 'wl_advanced_settings', self::DATASET_URI, $value ); |
|
| 411 | + } |
|
| 412 | + |
|
| 413 | + /** |
|
| 414 | + * Get the package type. |
|
| 415 | + * |
|
| 416 | + * @return string The package type or an empty string if not set. |
|
| 417 | + * @since 3.20.0 |
|
| 418 | + * |
|
| 419 | + */ |
|
| 420 | + public function get_package_type() { |
|
| 421 | + |
|
| 422 | + return $this->get( 'wl_advanced_settings', self::PACKAGE_TYPE, null ); |
|
| 423 | + } |
|
| 424 | + |
|
| 425 | + /** |
|
| 426 | + * Set the package type. |
|
| 427 | + * |
|
| 428 | + * @param string $value The package type. |
|
| 429 | + * |
|
| 430 | + * @since 3.20.0 |
|
| 431 | + * |
|
| 432 | + */ |
|
| 433 | + public function set_package_type( $value ) { |
|
| 434 | + |
|
| 435 | + $this->set( 'wl_advanced_settings', self::PACKAGE_TYPE, $value ); |
|
| 436 | + } |
|
| 437 | + |
|
| 438 | + /** |
|
| 439 | + * Intercept the change of the WordLift key in order to set the dataset URI. |
|
| 440 | + * |
|
| 441 | + * |
|
| 442 | + * @since 3.20.0 as of #761, we save settings every time a key is set, not only when the key changes, so to |
|
| 443 | + * store the configuration parameters such as country or language. |
|
| 444 | + * @since 3.11.0 |
|
| 445 | + * |
|
| 446 | + * @see https://github.com/insideout10/wordlift-plugin/issues/761 |
|
| 447 | + * |
|
| 448 | + * @param array $old_value The old settings. |
|
| 449 | + * @param array $new_value The new settings. |
|
| 450 | + */ |
|
| 451 | + public function update_key( $old_value, $new_value ) { |
|
| 452 | + |
|
| 453 | + // Check the old key value and the new one. We're going to ask for the dataset URI only if the key has changed. |
|
| 454 | + // $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
| 455 | + $new_key = isset( $new_value['key'] ) ? $new_value['key'] : ''; |
|
| 456 | + |
|
| 457 | + // If the key hasn't changed, don't do anything. |
|
| 458 | + // WARN The 'update_option' hook is fired only if the new and old value are not equal. |
|
| 459 | + // if ( $old_key === $new_key ) { |
|
| 460 | + // return; |
|
| 461 | + // } |
|
| 462 | + |
|
| 463 | + // If the key is empty, empty the dataset URI. |
|
| 464 | + if ( '' === $new_key ) { |
|
| 465 | + $this->set_dataset_uri( '' ); |
|
| 466 | + } |
|
| 467 | + |
|
| 468 | + // make the request to the remote server. |
|
| 469 | + $this->get_remote_dataset_uri( $new_key ); |
|
| 470 | + |
|
| 471 | + } |
|
| 472 | + |
|
| 473 | + /** |
|
| 474 | + * Handle retrieving the dataset uri from the remote server. |
|
| 475 | + * |
|
| 476 | + * If a valid dataset uri is returned it is stored in the appropriate option, |
|
| 477 | + * otherwise the option is set to empty string. |
|
| 478 | + * |
|
| 479 | + * @param string $key The key to be used. |
|
| 480 | + * |
|
| 481 | + * @since 3.12.0 |
|
| 482 | + * |
|
| 483 | + * @since 3.17.0 send the site URL and get the dataset URI. |
|
| 484 | + */ |
|
| 485 | + public function get_remote_dataset_uri( $key ) { |
|
| 486 | + |
|
| 487 | + $this->log->trace( 'Getting the remote dataset URI and package type...' ); |
|
| 488 | + |
|
| 489 | + if ( empty( $key ) ) { |
|
| 490 | + $this->log->warn( 'Key set to empty value.' ); |
|
| 491 | + |
|
| 492 | + $this->set_dataset_uri( '' ); |
|
| 493 | + $this->set_package_type( null ); |
|
| 494 | + |
|
| 495 | + return; |
|
| 496 | + } |
|
| 497 | + |
|
| 498 | + /** |
|
| 499 | + * Allow 3rd parties to change the site_url. |
|
| 500 | + * |
|
| 501 | + * @param string $site_url The site url. |
|
| 502 | + * |
|
| 503 | + * @see https://github.com/insideout10/wordlift-plugin/issues/850 |
|
| 504 | + * |
|
| 505 | + * @since 3.20.0 |
|
| 506 | + * |
|
| 507 | + */ |
|
| 508 | + $home_url = defined( 'WP_HOME' ) ? WP_HOME : get_option( 'home' ); |
|
| 509 | + $site_url = apply_filters( 'wl_production_site_url', untrailingslashit( $home_url ) ); |
|
| 510 | + |
|
| 511 | + // Build the URL. |
|
| 512 | + $url = '/accounts' |
|
| 513 | + . '?key=' . rawurlencode( $key ) |
|
| 514 | + . '&url=' . rawurlencode( $site_url ) |
|
| 515 | + . '&country=' . $this->get_country_code() |
|
| 516 | + . '&language=' . $this->get_language_code(); |
|
| 517 | + |
|
| 518 | + $api_service = Default_Api_Service::get_instance(); |
|
| 519 | + /** |
|
| 520 | + * @since 3.27.7.1 |
|
| 521 | + * The Key should be passed to headers, otherwise api would return null. |
|
| 522 | + */ |
|
| 523 | + $headers = array( |
|
| 524 | + 'Authorization' => "Key $key", |
|
| 525 | + ); |
|
| 526 | + $response = $api_service->request( 'PUT', $url, $headers )->get_response(); |
|
| 527 | + |
|
| 528 | + // The response is an error. |
|
| 529 | + if ( is_wp_error( $response ) ) { |
|
| 530 | + $this->log->error( 'An error occurred setting the dataset URI: ' . $response->get_error_message() ); |
|
| 531 | + |
|
| 532 | + $this->set_dataset_uri( '' ); |
|
| 533 | + $this->set_package_type( null ); |
|
| 534 | + |
|
| 535 | + return; |
|
| 536 | + } |
|
| 537 | + |
|
| 538 | + // The response is not OK. |
|
| 539 | + if ( ! is_array( $response ) || 200 !== (int) $response['response']['code'] ) { |
|
| 540 | + $base_url = $api_service->get_base_url(); |
|
| 541 | + |
|
| 542 | + if ( ! is_array( $response ) ) { |
|
| 543 | + $this->log->error( "Unexpected response when opening URL $base_url$url: " . var_export( $response, true ) ); |
|
| 544 | + } else { |
|
| 545 | + $this->log->error( "Unexpected status code when opening URL $base_url$url: " . $response['response']['code'] . "\n" . var_export( $response, true ) ); |
|
| 546 | + } |
|
| 547 | + |
|
| 548 | + |
|
| 549 | + $this->set_dataset_uri( '' ); |
|
| 550 | + $this->set_package_type( null ); |
|
| 551 | + |
|
| 552 | + return; |
|
| 553 | + } |
|
| 554 | + |
|
| 555 | + /* |
|
| 556 | 556 | * We also store the package type. |
| 557 | 557 | * |
| 558 | 558 | * @since 3.20.0 |
| 559 | 559 | */ |
| 560 | - $json = json_decode( $response['body'] ); |
|
| 561 | - /** |
|
| 562 | - * @since 3.27.7 |
|
| 563 | - * Remove the trailing slash returned from the new platform api. |
|
| 564 | - */ |
|
| 565 | - $dataset_uri = untrailingslashit( $json->datasetURI ); |
|
| 566 | - $package_type = isset( $json->packageType ) ? $json->packageType : null; |
|
| 567 | - |
|
| 568 | - $this->log->info( "Updating [ dataset uri :: $dataset_uri ][ package type :: $package_type ]..." ); |
|
| 569 | - |
|
| 570 | - $this->set_dataset_uri( $dataset_uri ); |
|
| 571 | - $this->set_package_type( $package_type ); |
|
| 572 | - } |
|
| 573 | - |
|
| 574 | - /** |
|
| 575 | - * Handle the edge case where a user submits the same key again |
|
| 576 | - * when he does not have the dataset uri to regain it. |
|
| 577 | - * |
|
| 578 | - * This can not be handled in the normal option update hook because |
|
| 579 | - * it is not being triggered when the save value equals to the one already |
|
| 580 | - * in the DB. |
|
| 581 | - * |
|
| 582 | - * @param mixed $value The new, unserialized option value. |
|
| 583 | - * @param mixed $old_value The old option value. |
|
| 584 | - * |
|
| 585 | - * @return mixed The same value in the $value parameter |
|
| 586 | - * @since 3.12.0 |
|
| 587 | - * |
|
| 588 | - */ |
|
| 589 | - function maybe_update_dataset_uri( $value, $old_value ) { |
|
| 590 | - |
|
| 591 | - // Check the old key value and the new one. Here we're only handling the |
|
| 592 | - // case where the key hasn't changed and the dataset URI isn't set. The |
|
| 593 | - // other case, i.e. a new key is inserted, is handled at `update_key`. |
|
| 594 | - $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
| 595 | - $new_key = isset( $value['key'] ) ? $value['key'] : ''; |
|
| 596 | - |
|
| 597 | - $dataset_uri = $this->get_dataset_uri(); |
|
| 598 | - |
|
| 599 | - if ( ! empty( $new_key ) && $new_key === $old_key && empty( $dataset_uri ) ) { |
|
| 600 | - |
|
| 601 | - // make the request to the remote server to try to get the dataset uri. |
|
| 602 | - $this->get_remote_dataset_uri( $new_key ); |
|
| 603 | - } |
|
| 604 | - |
|
| 605 | - return $value; |
|
| 606 | - } |
|
| 607 | - |
|
| 608 | - /** |
|
| 609 | - * Get the API URI to retrieve the dataset URI using the WordLift Key. |
|
| 610 | - * |
|
| 611 | - * @param string $key The WordLift key to use. |
|
| 612 | - * |
|
| 613 | - * @return string The API URI. |
|
| 614 | - * @since 3.11.0 |
|
| 615 | - * |
|
| 616 | - */ |
|
| 617 | - public function get_accounts_by_key_dataset_uri( $key ) { |
|
| 618 | - |
|
| 619 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "accounts/key=$key/dataset_uri"; |
|
| 620 | - } |
|
| 621 | - |
|
| 622 | - /** |
|
| 623 | - * Get the `accounts` end point. |
|
| 624 | - * |
|
| 625 | - * @return string The `accounts` end point. |
|
| 626 | - * @since 3.16.0 |
|
| 627 | - * |
|
| 628 | - */ |
|
| 629 | - public function get_accounts() { |
|
| 630 | - |
|
| 631 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'accounts'; |
|
| 632 | - } |
|
| 633 | - |
|
| 634 | - /** |
|
| 635 | - * Get the `link by default` option. |
|
| 636 | - * |
|
| 637 | - * @return bool True if entities must be linked by default otherwise false. |
|
| 638 | - * @since 3.13.0 |
|
| 639 | - * |
|
| 640 | - */ |
|
| 641 | - public function is_link_by_default() { |
|
| 642 | - |
|
| 643 | - return 'yes' === $this->get( 'wl_general_settings', self::LINK_BY_DEFAULT, 'yes' ); |
|
| 644 | - } |
|
| 645 | - |
|
| 646 | - /** |
|
| 647 | - * Set the `link by default` option. |
|
| 648 | - * |
|
| 649 | - * @param bool $value True to enabling linking by default, otherwise false. |
|
| 650 | - * |
|
| 651 | - * @since 3.13.0 |
|
| 652 | - * |
|
| 653 | - */ |
|
| 654 | - public function set_link_by_default( $value ) { |
|
| 655 | - |
|
| 656 | - $this->set( 'wl_general_settings', self::LINK_BY_DEFAULT, true === $value ? 'yes' : 'no' ); |
|
| 657 | - } |
|
| 658 | - |
|
| 659 | - /** |
|
| 660 | - * Get the 'analytics-enable' option. |
|
| 661 | - * |
|
| 662 | - * @return string 'no' or 'yes' representing bool. |
|
| 663 | - * @since 3.21.0 |
|
| 664 | - * |
|
| 665 | - */ |
|
| 666 | - public function is_analytics_enable() { |
|
| 667 | - return 'yes' === $this->get( 'wl_analytics_settings', self::ANALYTICS_ENABLE, 'no' ); |
|
| 668 | - } |
|
| 669 | - |
|
| 670 | - /** |
|
| 671 | - * Set the `analytics-enable` option. |
|
| 672 | - * |
|
| 673 | - * @param bool $value True to enabling analytics, otherwise false. |
|
| 674 | - * |
|
| 675 | - * @since 3.21.0 |
|
| 676 | - * |
|
| 677 | - */ |
|
| 678 | - public function set_is_analytics_enable( $value ) { |
|
| 679 | - |
|
| 680 | - $this->set( 'wl_general_settings', self::ANALYTICS_ENABLE, true === $value ? 'yes' : 'no' ); |
|
| 681 | - } |
|
| 682 | - |
|
| 683 | - /** |
|
| 684 | - * Get the 'analytics-entity-uri-dimention' option. |
|
| 685 | - * |
|
| 686 | - * @return int |
|
| 687 | - * @since 3.21.0 |
|
| 688 | - * |
|
| 689 | - */ |
|
| 690 | - public function get_analytics_entity_uri_dimension() { |
|
| 691 | - return (int) $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_URI_DIMENSION, 1 ); |
|
| 692 | - } |
|
| 693 | - |
|
| 694 | - /** |
|
| 695 | - * Get the 'analytics-entity-type-dimension' option. |
|
| 696 | - * |
|
| 697 | - * @return int |
|
| 698 | - * @since 3.21.0 |
|
| 699 | - * |
|
| 700 | - */ |
|
| 701 | - public function get_analytics_entity_type_dimension() { |
|
| 702 | - return $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_TYPE_DIMENSION, 2 ); |
|
| 703 | - } |
|
| 704 | - |
|
| 705 | - /** |
|
| 706 | - * Get the URL to perform autocomplete request. |
|
| 707 | - * |
|
| 708 | - * @return string The URL to call to perform the autocomplete request. |
|
| 709 | - * @since 3.15.0 |
|
| 710 | - * |
|
| 711 | - */ |
|
| 712 | - public function get_autocomplete_url() { |
|
| 713 | - |
|
| 714 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'autocomplete'; |
|
| 715 | - |
|
| 716 | - } |
|
| 717 | - |
|
| 718 | - /** |
|
| 719 | - * Get the URL to perform feedback deactivation request. |
|
| 720 | - * |
|
| 721 | - * @return string The URL to call to perform the feedback deactivation request. |
|
| 722 | - * @since 3.19.0 |
|
| 723 | - * |
|
| 724 | - */ |
|
| 725 | - public function get_deactivation_feedback_url() { |
|
| 726 | - |
|
| 727 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'feedbacks'; |
|
| 728 | - |
|
| 729 | - } |
|
| 730 | - |
|
| 731 | - /** |
|
| 732 | - * Get the base API URL. |
|
| 733 | - * |
|
| 734 | - * @return string The base API URL. |
|
| 735 | - * @since 3.20.0 |
|
| 736 | - * |
|
| 737 | - */ |
|
| 738 | - public function get_api_url() { |
|
| 739 | - |
|
| 740 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE; |
|
| 741 | - } |
|
| 560 | + $json = json_decode( $response['body'] ); |
|
| 561 | + /** |
|
| 562 | + * @since 3.27.7 |
|
| 563 | + * Remove the trailing slash returned from the new platform api. |
|
| 564 | + */ |
|
| 565 | + $dataset_uri = untrailingslashit( $json->datasetURI ); |
|
| 566 | + $package_type = isset( $json->packageType ) ? $json->packageType : null; |
|
| 567 | + |
|
| 568 | + $this->log->info( "Updating [ dataset uri :: $dataset_uri ][ package type :: $package_type ]..." ); |
|
| 569 | + |
|
| 570 | + $this->set_dataset_uri( $dataset_uri ); |
|
| 571 | + $this->set_package_type( $package_type ); |
|
| 572 | + } |
|
| 573 | + |
|
| 574 | + /** |
|
| 575 | + * Handle the edge case where a user submits the same key again |
|
| 576 | + * when he does not have the dataset uri to regain it. |
|
| 577 | + * |
|
| 578 | + * This can not be handled in the normal option update hook because |
|
| 579 | + * it is not being triggered when the save value equals to the one already |
|
| 580 | + * in the DB. |
|
| 581 | + * |
|
| 582 | + * @param mixed $value The new, unserialized option value. |
|
| 583 | + * @param mixed $old_value The old option value. |
|
| 584 | + * |
|
| 585 | + * @return mixed The same value in the $value parameter |
|
| 586 | + * @since 3.12.0 |
|
| 587 | + * |
|
| 588 | + */ |
|
| 589 | + function maybe_update_dataset_uri( $value, $old_value ) { |
|
| 590 | + |
|
| 591 | + // Check the old key value and the new one. Here we're only handling the |
|
| 592 | + // case where the key hasn't changed and the dataset URI isn't set. The |
|
| 593 | + // other case, i.e. a new key is inserted, is handled at `update_key`. |
|
| 594 | + $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
| 595 | + $new_key = isset( $value['key'] ) ? $value['key'] : ''; |
|
| 596 | + |
|
| 597 | + $dataset_uri = $this->get_dataset_uri(); |
|
| 598 | + |
|
| 599 | + if ( ! empty( $new_key ) && $new_key === $old_key && empty( $dataset_uri ) ) { |
|
| 600 | + |
|
| 601 | + // make the request to the remote server to try to get the dataset uri. |
|
| 602 | + $this->get_remote_dataset_uri( $new_key ); |
|
| 603 | + } |
|
| 604 | + |
|
| 605 | + return $value; |
|
| 606 | + } |
|
| 607 | + |
|
| 608 | + /** |
|
| 609 | + * Get the API URI to retrieve the dataset URI using the WordLift Key. |
|
| 610 | + * |
|
| 611 | + * @param string $key The WordLift key to use. |
|
| 612 | + * |
|
| 613 | + * @return string The API URI. |
|
| 614 | + * @since 3.11.0 |
|
| 615 | + * |
|
| 616 | + */ |
|
| 617 | + public function get_accounts_by_key_dataset_uri( $key ) { |
|
| 618 | + |
|
| 619 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "accounts/key=$key/dataset_uri"; |
|
| 620 | + } |
|
| 621 | + |
|
| 622 | + /** |
|
| 623 | + * Get the `accounts` end point. |
|
| 624 | + * |
|
| 625 | + * @return string The `accounts` end point. |
|
| 626 | + * @since 3.16.0 |
|
| 627 | + * |
|
| 628 | + */ |
|
| 629 | + public function get_accounts() { |
|
| 630 | + |
|
| 631 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'accounts'; |
|
| 632 | + } |
|
| 633 | + |
|
| 634 | + /** |
|
| 635 | + * Get the `link by default` option. |
|
| 636 | + * |
|
| 637 | + * @return bool True if entities must be linked by default otherwise false. |
|
| 638 | + * @since 3.13.0 |
|
| 639 | + * |
|
| 640 | + */ |
|
| 641 | + public function is_link_by_default() { |
|
| 642 | + |
|
| 643 | + return 'yes' === $this->get( 'wl_general_settings', self::LINK_BY_DEFAULT, 'yes' ); |
|
| 644 | + } |
|
| 645 | + |
|
| 646 | + /** |
|
| 647 | + * Set the `link by default` option. |
|
| 648 | + * |
|
| 649 | + * @param bool $value True to enabling linking by default, otherwise false. |
|
| 650 | + * |
|
| 651 | + * @since 3.13.0 |
|
| 652 | + * |
|
| 653 | + */ |
|
| 654 | + public function set_link_by_default( $value ) { |
|
| 655 | + |
|
| 656 | + $this->set( 'wl_general_settings', self::LINK_BY_DEFAULT, true === $value ? 'yes' : 'no' ); |
|
| 657 | + } |
|
| 658 | + |
|
| 659 | + /** |
|
| 660 | + * Get the 'analytics-enable' option. |
|
| 661 | + * |
|
| 662 | + * @return string 'no' or 'yes' representing bool. |
|
| 663 | + * @since 3.21.0 |
|
| 664 | + * |
|
| 665 | + */ |
|
| 666 | + public function is_analytics_enable() { |
|
| 667 | + return 'yes' === $this->get( 'wl_analytics_settings', self::ANALYTICS_ENABLE, 'no' ); |
|
| 668 | + } |
|
| 669 | + |
|
| 670 | + /** |
|
| 671 | + * Set the `analytics-enable` option. |
|
| 672 | + * |
|
| 673 | + * @param bool $value True to enabling analytics, otherwise false. |
|
| 674 | + * |
|
| 675 | + * @since 3.21.0 |
|
| 676 | + * |
|
| 677 | + */ |
|
| 678 | + public function set_is_analytics_enable( $value ) { |
|
| 679 | + |
|
| 680 | + $this->set( 'wl_general_settings', self::ANALYTICS_ENABLE, true === $value ? 'yes' : 'no' ); |
|
| 681 | + } |
|
| 682 | + |
|
| 683 | + /** |
|
| 684 | + * Get the 'analytics-entity-uri-dimention' option. |
|
| 685 | + * |
|
| 686 | + * @return int |
|
| 687 | + * @since 3.21.0 |
|
| 688 | + * |
|
| 689 | + */ |
|
| 690 | + public function get_analytics_entity_uri_dimension() { |
|
| 691 | + return (int) $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_URI_DIMENSION, 1 ); |
|
| 692 | + } |
|
| 693 | + |
|
| 694 | + /** |
|
| 695 | + * Get the 'analytics-entity-type-dimension' option. |
|
| 696 | + * |
|
| 697 | + * @return int |
|
| 698 | + * @since 3.21.0 |
|
| 699 | + * |
|
| 700 | + */ |
|
| 701 | + public function get_analytics_entity_type_dimension() { |
|
| 702 | + return $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_TYPE_DIMENSION, 2 ); |
|
| 703 | + } |
|
| 704 | + |
|
| 705 | + /** |
|
| 706 | + * Get the URL to perform autocomplete request. |
|
| 707 | + * |
|
| 708 | + * @return string The URL to call to perform the autocomplete request. |
|
| 709 | + * @since 3.15.0 |
|
| 710 | + * |
|
| 711 | + */ |
|
| 712 | + public function get_autocomplete_url() { |
|
| 713 | + |
|
| 714 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'autocomplete'; |
|
| 715 | + |
|
| 716 | + } |
|
| 717 | + |
|
| 718 | + /** |
|
| 719 | + * Get the URL to perform feedback deactivation request. |
|
| 720 | + * |
|
| 721 | + * @return string The URL to call to perform the feedback deactivation request. |
|
| 722 | + * @since 3.19.0 |
|
| 723 | + * |
|
| 724 | + */ |
|
| 725 | + public function get_deactivation_feedback_url() { |
|
| 726 | + |
|
| 727 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'feedbacks'; |
|
| 728 | + |
|
| 729 | + } |
|
| 730 | + |
|
| 731 | + /** |
|
| 732 | + * Get the base API URL. |
|
| 733 | + * |
|
| 734 | + * @return string The base API URL. |
|
| 735 | + * @since 3.20.0 |
|
| 736 | + * |
|
| 737 | + */ |
|
| 738 | + public function get_api_url() { |
|
| 739 | + |
|
| 740 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE; |
|
| 741 | + } |
|
| 742 | 742 | |
| 743 | 743 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | use Wordlift\Api\Default_Api_Service; |
| 14 | 14 | |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | public function __construct() { |
| 142 | 142 | |
| 143 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 143 | + $this->log = Wordlift_Log_Service::get_logger(get_class()); |
|
| 144 | 144 | |
| 145 | 145 | self::$instance = $this; |
| 146 | 146 | |
@@ -170,11 +170,11 @@ discard block |
||
| 170 | 170 | * @since 3.6.0 |
| 171 | 171 | * |
| 172 | 172 | */ |
| 173 | - private function get( $option, $key, $default = '' ) { |
|
| 173 | + private function get($option, $key, $default = '') { |
|
| 174 | 174 | |
| 175 | - $options = get_option( $option, array() ); |
|
| 175 | + $options = get_option($option, array()); |
|
| 176 | 176 | |
| 177 | - return isset( $options[ $key ] ) ? $options[ $key ] : $default; |
|
| 177 | + return isset($options[$key]) ? $options[$key] : $default; |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | /** |
@@ -187,12 +187,12 @@ discard block |
||
| 187 | 187 | * @since 3.9.0 |
| 188 | 188 | * |
| 189 | 189 | */ |
| 190 | - private function set( $option, $key, $value ) { |
|
| 190 | + private function set($option, $key, $value) { |
|
| 191 | 191 | |
| 192 | - $values = get_option( $option ); |
|
| 193 | - $values = isset( $values ) ? $values : array(); |
|
| 194 | - $values[ $key ] = $value; |
|
| 195 | - update_option( $option, $values ); |
|
| 192 | + $values = get_option($option); |
|
| 193 | + $values = isset($values) ? $values : array(); |
|
| 194 | + $values[$key] = $value; |
|
| 195 | + update_option($option, $values); |
|
| 196 | 196 | |
| 197 | 197 | } |
| 198 | 198 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | public function get_entity_base_path() { |
| 207 | 207 | |
| 208 | - return $this->get( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, 'entity' ); |
|
| 208 | + return $this->get('wl_general_settings', self::ENTITY_BASE_PATH_KEY, 'entity'); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
@@ -216,9 +216,9 @@ discard block |
||
| 216 | 216 | * @since 3.9.0 |
| 217 | 217 | * |
| 218 | 218 | */ |
| 219 | - public function set_entity_base_path( $value ) { |
|
| 219 | + public function set_entity_base_path($value) { |
|
| 220 | 220 | |
| 221 | - $this->set( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, $value ); |
|
| 221 | + $this->set('wl_general_settings', self::ENTITY_BASE_PATH_KEY, $value); |
|
| 222 | 222 | |
| 223 | 223 | } |
| 224 | 224 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | */ |
| 232 | 232 | public function is_skip_wizard() { |
| 233 | 233 | |
| 234 | - return $this->get( 'wl_general_settings', self::SKIP_WIZARD, false ); |
|
| 234 | + return $this->get('wl_general_settings', self::SKIP_WIZARD, false); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /** |
@@ -242,9 +242,9 @@ discard block |
||
| 242 | 242 | * @since 3.9.0 |
| 243 | 243 | * |
| 244 | 244 | */ |
| 245 | - public function set_skip_wizard( $value ) { |
|
| 245 | + public function set_skip_wizard($value) { |
|
| 246 | 246 | |
| 247 | - $this->set( 'wl_general_settings', self::SKIP_WIZARD, true === $value ); |
|
| 247 | + $this->set('wl_general_settings', self::SKIP_WIZARD, true === $value); |
|
| 248 | 248 | |
| 249 | 249 | } |
| 250 | 250 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | public function get_key() { |
| 259 | 259 | |
| 260 | - return $this->get( 'wl_general_settings', self::KEY, '' ); |
|
| 260 | + return $this->get('wl_general_settings', self::KEY, ''); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /** |
@@ -268,9 +268,9 @@ discard block |
||
| 268 | 268 | * @since 3.9.0 |
| 269 | 269 | * |
| 270 | 270 | */ |
| 271 | - public function set_key( $value ) { |
|
| 271 | + public function set_key($value) { |
|
| 272 | 272 | |
| 273 | - $this->set( 'wl_general_settings', self::KEY, $value ); |
|
| 273 | + $this->set('wl_general_settings', self::KEY, $value); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | /** |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | public function get_language_code() { |
| 286 | 286 | |
| 287 | - return $this->get( 'wl_general_settings', self::LANGUAGE, 'en' ); |
|
| 287 | + return $this->get('wl_general_settings', self::LANGUAGE, 'en'); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | /** |
@@ -295,9 +295,9 @@ discard block |
||
| 295 | 295 | * @since 3.9.0 |
| 296 | 296 | * |
| 297 | 297 | */ |
| 298 | - public function set_language_code( $value ) { |
|
| 298 | + public function set_language_code($value) { |
|
| 299 | 299 | |
| 300 | - $this->set( 'wl_general_settings', self::LANGUAGE, $value ); |
|
| 300 | + $this->set('wl_general_settings', self::LANGUAGE, $value); |
|
| 301 | 301 | |
| 302 | 302 | } |
| 303 | 303 | |
@@ -309,9 +309,9 @@ discard block |
||
| 309 | 309 | * @since 3.19.0 |
| 310 | 310 | * |
| 311 | 311 | */ |
| 312 | - public function set_diagnostic_preferences( $value ) { |
|
| 312 | + public function set_diagnostic_preferences($value) { |
|
| 313 | 313 | |
| 314 | - $this->set( 'wl_general_settings', self::SEND_DIAGNOSTIC, $value ); |
|
| 314 | + $this->set('wl_general_settings', self::SEND_DIAGNOSTIC, $value); |
|
| 315 | 315 | |
| 316 | 316 | } |
| 317 | 317 | |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | */ |
| 323 | 323 | public function get_diagnostic_preferences() { |
| 324 | 324 | |
| 325 | - return $this->get( 'wl_general_settings', self::SEND_DIAGNOSTIC, 'no' ); |
|
| 325 | + return $this->get('wl_general_settings', self::SEND_DIAGNOSTIC, 'no'); |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | /** |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | public function get_country_code() { |
| 336 | 336 | |
| 337 | - return $this->get( 'wl_general_settings', self::COUNTRY_CODE, 'us' ); |
|
| 337 | + return $this->get('wl_general_settings', self::COUNTRY_CODE, 'us'); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | /** |
@@ -345,9 +345,9 @@ discard block |
||
| 345 | 345 | * @since 3.18.0 |
| 346 | 346 | * |
| 347 | 347 | */ |
| 348 | - public function set_country_code( $value ) { |
|
| 348 | + public function set_country_code($value) { |
|
| 349 | 349 | |
| 350 | - $this->set( 'wl_general_settings', self::COUNTRY_CODE, $value ); |
|
| 350 | + $this->set('wl_general_settings', self::COUNTRY_CODE, $value); |
|
| 351 | 351 | |
| 352 | 352 | } |
| 353 | 353 | |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | */ |
| 364 | 364 | public function get_publisher_id() { |
| 365 | 365 | |
| 366 | - return $this->get( 'wl_general_settings', self::PUBLISHER_ID, null ); |
|
| 366 | + return $this->get('wl_general_settings', self::PUBLISHER_ID, null); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | /** |
@@ -374,9 +374,9 @@ discard block |
||
| 374 | 374 | * @since 3.9.0 |
| 375 | 375 | * |
| 376 | 376 | */ |
| 377 | - public function set_publisher_id( $value ) { |
|
| 377 | + public function set_publisher_id($value) { |
|
| 378 | 378 | |
| 379 | - $this->set( 'wl_general_settings', self::PUBLISHER_ID, $value ); |
|
| 379 | + $this->set('wl_general_settings', self::PUBLISHER_ID, $value); |
|
| 380 | 380 | |
| 381 | 381 | } |
| 382 | 382 | |
@@ -390,8 +390,8 @@ discard block |
||
| 390 | 390 | */ |
| 391 | 391 | public function get_dataset_uri() { |
| 392 | 392 | |
| 393 | - if ( apply_filters( 'wl_features__enable__dataset', true ) ) { |
|
| 394 | - return $this->get( 'wl_advanced_settings', self::DATASET_URI, null ); |
|
| 393 | + if (apply_filters('wl_features__enable__dataset', true)) { |
|
| 394 | + return $this->get('wl_advanced_settings', self::DATASET_URI, null); |
|
| 395 | 395 | } else { |
| 396 | 396 | return null; |
| 397 | 397 | } |
@@ -405,9 +405,9 @@ discard block |
||
| 405 | 405 | * @since 3.10.0 |
| 406 | 406 | * |
| 407 | 407 | */ |
| 408 | - public function set_dataset_uri( $value ) { |
|
| 408 | + public function set_dataset_uri($value) { |
|
| 409 | 409 | |
| 410 | - $this->set( 'wl_advanced_settings', self::DATASET_URI, $value ); |
|
| 410 | + $this->set('wl_advanced_settings', self::DATASET_URI, $value); |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | /** |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | */ |
| 420 | 420 | public function get_package_type() { |
| 421 | 421 | |
| 422 | - return $this->get( 'wl_advanced_settings', self::PACKAGE_TYPE, null ); |
|
| 422 | + return $this->get('wl_advanced_settings', self::PACKAGE_TYPE, null); |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | /** |
@@ -430,9 +430,9 @@ discard block |
||
| 430 | 430 | * @since 3.20.0 |
| 431 | 431 | * |
| 432 | 432 | */ |
| 433 | - public function set_package_type( $value ) { |
|
| 433 | + public function set_package_type($value) { |
|
| 434 | 434 | |
| 435 | - $this->set( 'wl_advanced_settings', self::PACKAGE_TYPE, $value ); |
|
| 435 | + $this->set('wl_advanced_settings', self::PACKAGE_TYPE, $value); |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | /** |
@@ -448,11 +448,11 @@ discard block |
||
| 448 | 448 | * @param array $old_value The old settings. |
| 449 | 449 | * @param array $new_value The new settings. |
| 450 | 450 | */ |
| 451 | - public function update_key( $old_value, $new_value ) { |
|
| 451 | + public function update_key($old_value, $new_value) { |
|
| 452 | 452 | |
| 453 | 453 | // Check the old key value and the new one. We're going to ask for the dataset URI only if the key has changed. |
| 454 | 454 | // $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
| 455 | - $new_key = isset( $new_value['key'] ) ? $new_value['key'] : ''; |
|
| 455 | + $new_key = isset($new_value['key']) ? $new_value['key'] : ''; |
|
| 456 | 456 | |
| 457 | 457 | // If the key hasn't changed, don't do anything. |
| 458 | 458 | // WARN The 'update_option' hook is fired only if the new and old value are not equal. |
@@ -461,12 +461,12 @@ discard block |
||
| 461 | 461 | // } |
| 462 | 462 | |
| 463 | 463 | // If the key is empty, empty the dataset URI. |
| 464 | - if ( '' === $new_key ) { |
|
| 465 | - $this->set_dataset_uri( '' ); |
|
| 464 | + if ('' === $new_key) { |
|
| 465 | + $this->set_dataset_uri(''); |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | // make the request to the remote server. |
| 469 | - $this->get_remote_dataset_uri( $new_key ); |
|
| 469 | + $this->get_remote_dataset_uri($new_key); |
|
| 470 | 470 | |
| 471 | 471 | } |
| 472 | 472 | |
@@ -482,15 +482,15 @@ discard block |
||
| 482 | 482 | * |
| 483 | 483 | * @since 3.17.0 send the site URL and get the dataset URI. |
| 484 | 484 | */ |
| 485 | - public function get_remote_dataset_uri( $key ) { |
|
| 485 | + public function get_remote_dataset_uri($key) { |
|
| 486 | 486 | |
| 487 | - $this->log->trace( 'Getting the remote dataset URI and package type...' ); |
|
| 487 | + $this->log->trace('Getting the remote dataset URI and package type...'); |
|
| 488 | 488 | |
| 489 | - if ( empty( $key ) ) { |
|
| 490 | - $this->log->warn( 'Key set to empty value.' ); |
|
| 489 | + if (empty($key)) { |
|
| 490 | + $this->log->warn('Key set to empty value.'); |
|
| 491 | 491 | |
| 492 | - $this->set_dataset_uri( '' ); |
|
| 493 | - $this->set_package_type( null ); |
|
| 492 | + $this->set_dataset_uri(''); |
|
| 493 | + $this->set_package_type(null); |
|
| 494 | 494 | |
| 495 | 495 | return; |
| 496 | 496 | } |
@@ -505,15 +505,15 @@ discard block |
||
| 505 | 505 | * @since 3.20.0 |
| 506 | 506 | * |
| 507 | 507 | */ |
| 508 | - $home_url = defined( 'WP_HOME' ) ? WP_HOME : get_option( 'home' ); |
|
| 509 | - $site_url = apply_filters( 'wl_production_site_url', untrailingslashit( $home_url ) ); |
|
| 508 | + $home_url = defined('WP_HOME') ? WP_HOME : get_option('home'); |
|
| 509 | + $site_url = apply_filters('wl_production_site_url', untrailingslashit($home_url)); |
|
| 510 | 510 | |
| 511 | 511 | // Build the URL. |
| 512 | 512 | $url = '/accounts' |
| 513 | - . '?key=' . rawurlencode( $key ) |
|
| 514 | - . '&url=' . rawurlencode( $site_url ) |
|
| 515 | - . '&country=' . $this->get_country_code() |
|
| 516 | - . '&language=' . $this->get_language_code(); |
|
| 513 | + . '?key='.rawurlencode($key) |
|
| 514 | + . '&url='.rawurlencode($site_url) |
|
| 515 | + . '&country='.$this->get_country_code() |
|
| 516 | + . '&language='.$this->get_language_code(); |
|
| 517 | 517 | |
| 518 | 518 | $api_service = Default_Api_Service::get_instance(); |
| 519 | 519 | /** |
@@ -523,31 +523,31 @@ discard block |
||
| 523 | 523 | $headers = array( |
| 524 | 524 | 'Authorization' => "Key $key", |
| 525 | 525 | ); |
| 526 | - $response = $api_service->request( 'PUT', $url, $headers )->get_response(); |
|
| 526 | + $response = $api_service->request('PUT', $url, $headers)->get_response(); |
|
| 527 | 527 | |
| 528 | 528 | // The response is an error. |
| 529 | - if ( is_wp_error( $response ) ) { |
|
| 530 | - $this->log->error( 'An error occurred setting the dataset URI: ' . $response->get_error_message() ); |
|
| 529 | + if (is_wp_error($response)) { |
|
| 530 | + $this->log->error('An error occurred setting the dataset URI: '.$response->get_error_message()); |
|
| 531 | 531 | |
| 532 | - $this->set_dataset_uri( '' ); |
|
| 533 | - $this->set_package_type( null ); |
|
| 532 | + $this->set_dataset_uri(''); |
|
| 533 | + $this->set_package_type(null); |
|
| 534 | 534 | |
| 535 | 535 | return; |
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | // The response is not OK. |
| 539 | - if ( ! is_array( $response ) || 200 !== (int) $response['response']['code'] ) { |
|
| 539 | + if ( ! is_array($response) || 200 !== (int) $response['response']['code']) { |
|
| 540 | 540 | $base_url = $api_service->get_base_url(); |
| 541 | 541 | |
| 542 | - if ( ! is_array( $response ) ) { |
|
| 543 | - $this->log->error( "Unexpected response when opening URL $base_url$url: " . var_export( $response, true ) ); |
|
| 542 | + if ( ! is_array($response)) { |
|
| 543 | + $this->log->error("Unexpected response when opening URL $base_url$url: ".var_export($response, true)); |
|
| 544 | 544 | } else { |
| 545 | - $this->log->error( "Unexpected status code when opening URL $base_url$url: " . $response['response']['code'] . "\n" . var_export( $response, true ) ); |
|
| 545 | + $this->log->error("Unexpected status code when opening URL $base_url$url: ".$response['response']['code']."\n".var_export($response, true)); |
|
| 546 | 546 | } |
| 547 | 547 | |
| 548 | 548 | |
| 549 | - $this->set_dataset_uri( '' ); |
|
| 550 | - $this->set_package_type( null ); |
|
| 549 | + $this->set_dataset_uri(''); |
|
| 550 | + $this->set_package_type(null); |
|
| 551 | 551 | |
| 552 | 552 | return; |
| 553 | 553 | } |
@@ -557,18 +557,18 @@ discard block |
||
| 557 | 557 | * |
| 558 | 558 | * @since 3.20.0 |
| 559 | 559 | */ |
| 560 | - $json = json_decode( $response['body'] ); |
|
| 560 | + $json = json_decode($response['body']); |
|
| 561 | 561 | /** |
| 562 | 562 | * @since 3.27.7 |
| 563 | 563 | * Remove the trailing slash returned from the new platform api. |
| 564 | 564 | */ |
| 565 | - $dataset_uri = untrailingslashit( $json->datasetURI ); |
|
| 566 | - $package_type = isset( $json->packageType ) ? $json->packageType : null; |
|
| 565 | + $dataset_uri = untrailingslashit($json->datasetURI); |
|
| 566 | + $package_type = isset($json->packageType) ? $json->packageType : null; |
|
| 567 | 567 | |
| 568 | - $this->log->info( "Updating [ dataset uri :: $dataset_uri ][ package type :: $package_type ]..." ); |
|
| 568 | + $this->log->info("Updating [ dataset uri :: $dataset_uri ][ package type :: $package_type ]..."); |
|
| 569 | 569 | |
| 570 | - $this->set_dataset_uri( $dataset_uri ); |
|
| 571 | - $this->set_package_type( $package_type ); |
|
| 570 | + $this->set_dataset_uri($dataset_uri); |
|
| 571 | + $this->set_package_type($package_type); |
|
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | /** |
@@ -586,20 +586,20 @@ discard block |
||
| 586 | 586 | * @since 3.12.0 |
| 587 | 587 | * |
| 588 | 588 | */ |
| 589 | - function maybe_update_dataset_uri( $value, $old_value ) { |
|
| 589 | + function maybe_update_dataset_uri($value, $old_value) { |
|
| 590 | 590 | |
| 591 | 591 | // Check the old key value and the new one. Here we're only handling the |
| 592 | 592 | // case where the key hasn't changed and the dataset URI isn't set. The |
| 593 | 593 | // other case, i.e. a new key is inserted, is handled at `update_key`. |
| 594 | - $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
| 595 | - $new_key = isset( $value['key'] ) ? $value['key'] : ''; |
|
| 594 | + $old_key = isset($old_value['key']) ? $old_value['key'] : ''; |
|
| 595 | + $new_key = isset($value['key']) ? $value['key'] : ''; |
|
| 596 | 596 | |
| 597 | 597 | $dataset_uri = $this->get_dataset_uri(); |
| 598 | 598 | |
| 599 | - if ( ! empty( $new_key ) && $new_key === $old_key && empty( $dataset_uri ) ) { |
|
| 599 | + if ( ! empty($new_key) && $new_key === $old_key && empty($dataset_uri)) { |
|
| 600 | 600 | |
| 601 | 601 | // make the request to the remote server to try to get the dataset uri. |
| 602 | - $this->get_remote_dataset_uri( $new_key ); |
|
| 602 | + $this->get_remote_dataset_uri($new_key); |
|
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | return $value; |
@@ -614,9 +614,9 @@ discard block |
||
| 614 | 614 | * @since 3.11.0 |
| 615 | 615 | * |
| 616 | 616 | */ |
| 617 | - public function get_accounts_by_key_dataset_uri( $key ) { |
|
| 617 | + public function get_accounts_by_key_dataset_uri($key) { |
|
| 618 | 618 | |
| 619 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "accounts/key=$key/dataset_uri"; |
|
| 619 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE."accounts/key=$key/dataset_uri"; |
|
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | /** |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | */ |
| 629 | 629 | public function get_accounts() { |
| 630 | 630 | |
| 631 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'accounts'; |
|
| 631 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE.'accounts'; |
|
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | /** |
@@ -640,7 +640,7 @@ discard block |
||
| 640 | 640 | */ |
| 641 | 641 | public function is_link_by_default() { |
| 642 | 642 | |
| 643 | - return 'yes' === $this->get( 'wl_general_settings', self::LINK_BY_DEFAULT, 'yes' ); |
|
| 643 | + return 'yes' === $this->get('wl_general_settings', self::LINK_BY_DEFAULT, 'yes'); |
|
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | /** |
@@ -651,9 +651,9 @@ discard block |
||
| 651 | 651 | * @since 3.13.0 |
| 652 | 652 | * |
| 653 | 653 | */ |
| 654 | - public function set_link_by_default( $value ) { |
|
| 654 | + public function set_link_by_default($value) { |
|
| 655 | 655 | |
| 656 | - $this->set( 'wl_general_settings', self::LINK_BY_DEFAULT, true === $value ? 'yes' : 'no' ); |
|
| 656 | + $this->set('wl_general_settings', self::LINK_BY_DEFAULT, true === $value ? 'yes' : 'no'); |
|
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | /** |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | * |
| 665 | 665 | */ |
| 666 | 666 | public function is_analytics_enable() { |
| 667 | - return 'yes' === $this->get( 'wl_analytics_settings', self::ANALYTICS_ENABLE, 'no' ); |
|
| 667 | + return 'yes' === $this->get('wl_analytics_settings', self::ANALYTICS_ENABLE, 'no'); |
|
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | /** |
@@ -675,9 +675,9 @@ discard block |
||
| 675 | 675 | * @since 3.21.0 |
| 676 | 676 | * |
| 677 | 677 | */ |
| 678 | - public function set_is_analytics_enable( $value ) { |
|
| 678 | + public function set_is_analytics_enable($value) { |
|
| 679 | 679 | |
| 680 | - $this->set( 'wl_general_settings', self::ANALYTICS_ENABLE, true === $value ? 'yes' : 'no' ); |
|
| 680 | + $this->set('wl_general_settings', self::ANALYTICS_ENABLE, true === $value ? 'yes' : 'no'); |
|
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | /** |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | * |
| 689 | 689 | */ |
| 690 | 690 | public function get_analytics_entity_uri_dimension() { |
| 691 | - return (int) $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_URI_DIMENSION, 1 ); |
|
| 691 | + return (int) $this->get('wl_analytics_settings', self::ANALYTICS_ENTITY_URI_DIMENSION, 1); |
|
| 692 | 692 | } |
| 693 | 693 | |
| 694 | 694 | /** |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | * |
| 700 | 700 | */ |
| 701 | 701 | public function get_analytics_entity_type_dimension() { |
| 702 | - return $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_TYPE_DIMENSION, 2 ); |
|
| 702 | + return $this->get('wl_analytics_settings', self::ANALYTICS_ENTITY_TYPE_DIMENSION, 2); |
|
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | /** |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | */ |
| 712 | 712 | public function get_autocomplete_url() { |
| 713 | 713 | |
| 714 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'autocomplete'; |
|
| 714 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE.'autocomplete'; |
|
| 715 | 715 | |
| 716 | 716 | } |
| 717 | 717 | |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | */ |
| 725 | 725 | public function get_deactivation_feedback_url() { |
| 726 | 726 | |
| 727 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'feedbacks'; |
|
| 727 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE.'feedbacks'; |
|
| 728 | 728 | |
| 729 | 729 | } |
| 730 | 730 | |