@@ -12,44 +12,44 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class Sync_Hooks_Entity_Relation { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * @var \Wordlift_Entity_Service |
|
| 17 | - */ |
|
| 18 | - private $entity_service; |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * Entity_Dct_Relation constructor. |
|
| 22 | - * |
|
| 23 | - * @param $entity_service \Wordlift_Entity_Service |
|
| 24 | - */ |
|
| 25 | - public function __construct( $entity_service ) { |
|
| 26 | - $this->entity_service = $entity_service; |
|
| 27 | - |
|
| 28 | - add_filter( 'wl_dataset__sync_service__sync_item__jsonld', array( |
|
| 29 | - $this, |
|
| 30 | - 'wl_dataset__sync_service__sync_item__jsonld' |
|
| 31 | - ), 10, 2 ); |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - public function wl_dataset__sync_service__sync_item__jsonld( $jsonld, $post_id ) { |
|
| 35 | - |
|
| 36 | - // Choose the dcterm property according to the post type. |
|
| 37 | - $property = $this->entity_service->is_entity( $post_id ) |
|
| 38 | - ? 'http://purl.org/dc/terms/relation' |
|
| 39 | - : 'http://purl.org/dc/terms/references'; |
|
| 40 | - |
|
| 41 | - $references = array_unique( $this->entity_service->get_related_entities( $post_id ) ); |
|
| 42 | - |
|
| 43 | - // Bail out if there are no references. |
|
| 44 | - if ( empty( $references ) ) { |
|
| 45 | - return $jsonld; |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - $jsonld[0][ $property ] = array_values( array_map( function ( $item ) { |
|
| 49 | - return array( '@id' => $this->entity_service->get_uri( $item ) ); |
|
| 50 | - }, $references ) ); |
|
| 51 | - |
|
| 52 | - return $jsonld; |
|
| 53 | - } |
|
| 15 | + /** |
|
| 16 | + * @var \Wordlift_Entity_Service |
|
| 17 | + */ |
|
| 18 | + private $entity_service; |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * Entity_Dct_Relation constructor. |
|
| 22 | + * |
|
| 23 | + * @param $entity_service \Wordlift_Entity_Service |
|
| 24 | + */ |
|
| 25 | + public function __construct( $entity_service ) { |
|
| 26 | + $this->entity_service = $entity_service; |
|
| 27 | + |
|
| 28 | + add_filter( 'wl_dataset__sync_service__sync_item__jsonld', array( |
|
| 29 | + $this, |
|
| 30 | + 'wl_dataset__sync_service__sync_item__jsonld' |
|
| 31 | + ), 10, 2 ); |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + public function wl_dataset__sync_service__sync_item__jsonld( $jsonld, $post_id ) { |
|
| 35 | + |
|
| 36 | + // Choose the dcterm property according to the post type. |
|
| 37 | + $property = $this->entity_service->is_entity( $post_id ) |
|
| 38 | + ? 'http://purl.org/dc/terms/relation' |
|
| 39 | + : 'http://purl.org/dc/terms/references'; |
|
| 40 | + |
|
| 41 | + $references = array_unique( $this->entity_service->get_related_entities( $post_id ) ); |
|
| 42 | + |
|
| 43 | + // Bail out if there are no references. |
|
| 44 | + if ( empty( $references ) ) { |
|
| 45 | + return $jsonld; |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + $jsonld[0][ $property ] = array_values( array_map( function ( $item ) { |
|
| 49 | + return array( '@id' => $this->entity_service->get_uri( $item ) ); |
|
| 50 | + }, $references ) ); |
|
| 51 | + |
|
| 52 | + return $jsonld; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | 55 | } |
@@ -22,32 +22,32 @@ |
||
| 22 | 22 | * |
| 23 | 23 | * @param $entity_service \Wordlift_Entity_Service |
| 24 | 24 | */ |
| 25 | - public function __construct( $entity_service ) { |
|
| 25 | + public function __construct($entity_service) { |
|
| 26 | 26 | $this->entity_service = $entity_service; |
| 27 | 27 | |
| 28 | - add_filter( 'wl_dataset__sync_service__sync_item__jsonld', array( |
|
| 28 | + add_filter('wl_dataset__sync_service__sync_item__jsonld', array( |
|
| 29 | 29 | $this, |
| 30 | 30 | 'wl_dataset__sync_service__sync_item__jsonld' |
| 31 | - ), 10, 2 ); |
|
| 31 | + ), 10, 2); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function wl_dataset__sync_service__sync_item__jsonld( $jsonld, $post_id ) { |
|
| 34 | + public function wl_dataset__sync_service__sync_item__jsonld($jsonld, $post_id) { |
|
| 35 | 35 | |
| 36 | 36 | // Choose the dcterm property according to the post type. |
| 37 | - $property = $this->entity_service->is_entity( $post_id ) |
|
| 37 | + $property = $this->entity_service->is_entity($post_id) |
|
| 38 | 38 | ? 'http://purl.org/dc/terms/relation' |
| 39 | 39 | : 'http://purl.org/dc/terms/references'; |
| 40 | 40 | |
| 41 | - $references = array_unique( $this->entity_service->get_related_entities( $post_id ) ); |
|
| 41 | + $references = array_unique($this->entity_service->get_related_entities($post_id)); |
|
| 42 | 42 | |
| 43 | 43 | // Bail out if there are no references. |
| 44 | - if ( empty( $references ) ) { |
|
| 44 | + if (empty($references)) { |
|
| 45 | 45 | return $jsonld; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - $jsonld[0][ $property ] = array_values( array_map( function ( $item ) { |
|
| 49 | - return array( '@id' => $this->entity_service->get_uri( $item ) ); |
|
| 50 | - }, $references ) ); |
|
| 48 | + $jsonld[0][$property] = array_values(array_map(function($item) { |
|
| 49 | + return array('@id' => $this->entity_service->get_uri($item)); |
|
| 50 | + }, $references)); |
|
| 51 | 51 | |
| 52 | 52 | return $jsonld; |
| 53 | 53 | } |
@@ -7,19 +7,19 @@ |
||
| 7 | 7 | use Wordlift\Jsonld\Jsonld_Service; |
| 8 | 8 | |
| 9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | - exit; |
|
| 10 | + exit; |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | // Register the Dataset JSON Endpoint. The `$api_service` variable must be defined in the calling file (wordlift.php). |
| 14 | 14 | if ( apply_filters( 'wl_features__enable__dataset', false ) ) { |
| 15 | - $sync_service = new Sync_Service( $api_service, Jsonld_Service::get_instance() ); |
|
| 16 | - new Sync_Wpjson_Endpoint( $sync_service ); |
|
| 17 | - new Sync_Page(); |
|
| 15 | + $sync_service = new Sync_Service( $api_service, Jsonld_Service::get_instance() ); |
|
| 16 | + new Sync_Wpjson_Endpoint( $sync_service ); |
|
| 17 | + new Sync_Page(); |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @since 3.28.0 |
|
| 21 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1186 |
|
| 22 | - */ |
|
| 23 | - new Sync_Hooks_Entity_Relation( Wordlift_Entity_Service::get_instance() ); |
|
| 19 | + /** |
|
| 20 | + * @since 3.28.0 |
|
| 21 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1186 |
|
| 22 | + */ |
|
| 23 | + new Sync_Hooks_Entity_Relation( Wordlift_Entity_Service::get_instance() ); |
|
| 24 | 24 | |
| 25 | 25 | } |
@@ -6,20 +6,20 @@ |
||
| 6 | 6 | use Wordlift\Dataset\Sync_Wpjson_Endpoint; |
| 7 | 7 | use Wordlift\Jsonld\Jsonld_Service; |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if ( ! defined('ABSPATH')) { |
|
| 10 | 10 | exit; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | // Register the Dataset JSON Endpoint. The `$api_service` variable must be defined in the calling file (wordlift.php). |
| 14 | -if ( apply_filters( 'wl_features__enable__dataset', false ) ) { |
|
| 15 | - $sync_service = new Sync_Service( $api_service, Jsonld_Service::get_instance() ); |
|
| 16 | - new Sync_Wpjson_Endpoint( $sync_service ); |
|
| 14 | +if (apply_filters('wl_features__enable__dataset', false)) { |
|
| 15 | + $sync_service = new Sync_Service($api_service, Jsonld_Service::get_instance()); |
|
| 16 | + new Sync_Wpjson_Endpoint($sync_service); |
|
| 17 | 17 | new Sync_Page(); |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @since 3.28.0 |
| 21 | 21 | * @see https://github.com/insideout10/wordlift-plugin/issues/1186 |
| 22 | 22 | */ |
| 23 | - new Sync_Hooks_Entity_Relation( Wordlift_Entity_Service::get_instance() ); |
|
| 23 | + new Sync_Hooks_Entity_Relation(Wordlift_Entity_Service::get_instance()); |
|
| 24 | 24 | |
| 25 | 25 | } |
@@ -4,193 +4,193 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Sync_Background_Process extends \Wordlift_Plugin_WP_Background_Process { |
| 6 | 6 | |
| 7 | - protected $action = 'wl_dataset__sync'; |
|
| 8 | - |
|
| 9 | - /** |
|
| 10 | - * @var Sync_Service |
|
| 11 | - */ |
|
| 12 | - private $sync_service; |
|
| 13 | - |
|
| 14 | - /** |
|
| 15 | - * @var \Wordlift_Log_Service |
|
| 16 | - */ |
|
| 17 | - private $log; |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * Sync_Background_Process constructor. |
|
| 21 | - * |
|
| 22 | - * @param $sync_service Sync_Service A {@link Sync_Service} instance providing the supporting functions to this background process. |
|
| 23 | - */ |
|
| 24 | - public function __construct( $sync_service ) { |
|
| 25 | - parent::__construct(); |
|
| 26 | - |
|
| 27 | - $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 28 | - |
|
| 29 | - $this->sync_service = $sync_service; |
|
| 30 | - |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * This function is called: |
|
| 35 | - * - To start a new Synchronization, by passing a {@link Sync_Start_Message} instance. |
|
| 36 | - * - To synchronize a post, by passing a numeric ID. |
|
| 37 | - * |
|
| 38 | - * This function returns the parameter for the next call or NULL if there are no more posts to process. |
|
| 39 | - * |
|
| 40 | - * @param int[] $post_ids An array of post IDs. |
|
| 41 | - * |
|
| 42 | - * @return int[]|false The next post IDs or false if there are no more. |
|
| 43 | - */ |
|
| 44 | - protected function task( $post_ids ) { |
|
| 45 | - |
|
| 46 | - // Check if we must cancel. |
|
| 47 | - if ( $this->must_cancel() ) { |
|
| 48 | - $this->cancel(); |
|
| 49 | - |
|
| 50 | - return false; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - $this->log->debug( sprintf( "Synchronizing posts %s...", implode( ', ', $post_ids ) ) ); |
|
| 54 | - |
|
| 55 | - // Sync the item. |
|
| 56 | - return $this->sync_items( $post_ids ); |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * Start the background processing. |
|
| 61 | - * |
|
| 62 | - * @return bool True if the process has been started, otherwise false. |
|
| 63 | - */ |
|
| 64 | - public function start() { |
|
| 65 | - |
|
| 66 | - // Create a new Sync_Model state of `started`. |
|
| 67 | - if ( ! $this->is_started( self::get_state() ) ) { |
|
| 68 | - $this->log->debug( "Starting..." ); |
|
| 69 | - |
|
| 70 | - $sync_state = new Sync_State( time(), 0, $this->sync_service->count(), time(), 'started' ); |
|
| 71 | - update_option( '_wl_dataset_sync', $sync_state, false ); |
|
| 72 | - |
|
| 73 | - $next = $this->sync_service->next(); |
|
| 74 | - $this->push_to_queue( $next ); |
|
| 75 | - $this->save()->dispatch(); |
|
| 76 | - |
|
| 77 | - $this->log->debug( sprintf( 'Started with post IDs %s.', implode( ', ', $next ) ) ); |
|
| 78 | - |
|
| 79 | - return true; |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - return false; |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * Set the transient to cancel the process. The next time the process runs, it'll check whether this transient is |
|
| 87 | - * set and will stop processing. |
|
| 88 | - */ |
|
| 89 | - public function request_cancel() { |
|
| 90 | - |
|
| 91 | - set_transient( "{$this->action}__cancel", true ); |
|
| 92 | - |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * Get the sync state. |
|
| 97 | - * |
|
| 98 | - * @return Sync_State The {@link Sync_State}. |
|
| 99 | - */ |
|
| 100 | - public static function get_state() { |
|
| 101 | - |
|
| 102 | - try { |
|
| 103 | - return get_option( '_wl_dataset_sync', Sync_State::unknown() ); |
|
| 104 | - } catch ( \Exception $e ) { |
|
| 105 | - return Sync_State::unknown(); |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - /** |
|
| 111 | - * Check whether the provided state is `started` or not. |
|
| 112 | - * |
|
| 113 | - * @param Sync_State $state The {@link Sync_State}. |
|
| 114 | - * |
|
| 115 | - * @return bool True if the state is started. |
|
| 116 | - */ |
|
| 117 | - private function is_started( $state ) { |
|
| 118 | - return $state instanceof Sync_State && 'started' === $state->state && 30 > ( time() - $state->last_update ); |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * Check whether the process must cancel or not. |
|
| 123 | - * |
|
| 124 | - * @return bool Whether to cancel or not the process. |
|
| 125 | - */ |
|
| 126 | - private function must_cancel() { |
|
| 127 | - |
|
| 128 | - return get_transient( "{$this->action}__cancel" ); |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - /** |
|
| 132 | - * Cancels the current process. |
|
| 133 | - */ |
|
| 134 | - private function cancel() { |
|
| 135 | - |
|
| 136 | - $this->log->debug( "Cancelling synchronization..." ); |
|
| 137 | - |
|
| 138 | - // Cleanup the process data. |
|
| 139 | - $this->cancel_process(); |
|
| 140 | - |
|
| 141 | - // Set the state to cancelled. |
|
| 142 | - $state = self::get_state(); |
|
| 143 | - $state->set_state( 'cancelled' ); |
|
| 144 | - update_option( '_wl_dataset_sync', $state, false ); |
|
| 145 | - |
|
| 146 | - // Finally delete the transient. |
|
| 147 | - delete_transient( "{$this->action}__cancel" ); |
|
| 148 | - |
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - /** |
|
| 152 | - * Push the post with the provided ID to the remote platform. |
|
| 153 | - * |
|
| 154 | - * @param int[] $post_ids The post IDs. |
|
| 155 | - * |
|
| 156 | - * @return int[]|false The next post ID to process or false if processing is complete. |
|
| 157 | - */ |
|
| 158 | - private function sync_items( $post_ids ) { |
|
| 159 | - |
|
| 160 | - if ( ! is_array( $post_ids ) ) { |
|
| 161 | - $this->log->error( '$post_ids must be an array, received: ' . var_export( $post_ids, true ) ); |
|
| 162 | - return false; |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - // Sync this item. |
|
| 166 | - if ( $this->sync_service->sync_items( $post_ids ) ) { |
|
| 167 | - |
|
| 168 | - $next = $this->sync_service->next(); |
|
| 169 | - $next_state = isset( $next ) ? 'started' : 'ended'; |
|
| 170 | - |
|
| 171 | - /** |
|
| 172 | - * Update the synchronization meta data, by increasing the current index. |
|
| 173 | - * |
|
| 174 | - * @var Sync_State $sync The {@link Sync_State}. |
|
| 175 | - */ |
|
| 176 | - $state = self::get_state() |
|
| 177 | - ->increment_index( $this->sync_service->get_batch_size() ) |
|
| 178 | - ->set_state( $next_state ); |
|
| 179 | - update_option( '_wl_dataset_sync', $state, false ); |
|
| 180 | - |
|
| 181 | - $this->log->debug( "State updated to " . var_export( $state, true ) ); |
|
| 182 | - |
|
| 183 | - // Return the next IDs or false if there aren't. |
|
| 184 | - return isset( $next ) ? $next : false; |
|
| 185 | - } else { |
|
| 186 | - // Retry. |
|
| 187 | - // @@todo: put a limit to the number of retries. |
|
| 188 | - |
|
| 189 | - $this->log->error( sprintf( "Sync failed for posts %s.", implode( ', ', $post_ids ) ) ); |
|
| 190 | - |
|
| 191 | - return $post_ids; |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - } |
|
| 7 | + protected $action = 'wl_dataset__sync'; |
|
| 8 | + |
|
| 9 | + /** |
|
| 10 | + * @var Sync_Service |
|
| 11 | + */ |
|
| 12 | + private $sync_service; |
|
| 13 | + |
|
| 14 | + /** |
|
| 15 | + * @var \Wordlift_Log_Service |
|
| 16 | + */ |
|
| 17 | + private $log; |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * Sync_Background_Process constructor. |
|
| 21 | + * |
|
| 22 | + * @param $sync_service Sync_Service A {@link Sync_Service} instance providing the supporting functions to this background process. |
|
| 23 | + */ |
|
| 24 | + public function __construct( $sync_service ) { |
|
| 25 | + parent::__construct(); |
|
| 26 | + |
|
| 27 | + $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 28 | + |
|
| 29 | + $this->sync_service = $sync_service; |
|
| 30 | + |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * This function is called: |
|
| 35 | + * - To start a new Synchronization, by passing a {@link Sync_Start_Message} instance. |
|
| 36 | + * - To synchronize a post, by passing a numeric ID. |
|
| 37 | + * |
|
| 38 | + * This function returns the parameter for the next call or NULL if there are no more posts to process. |
|
| 39 | + * |
|
| 40 | + * @param int[] $post_ids An array of post IDs. |
|
| 41 | + * |
|
| 42 | + * @return int[]|false The next post IDs or false if there are no more. |
|
| 43 | + */ |
|
| 44 | + protected function task( $post_ids ) { |
|
| 45 | + |
|
| 46 | + // Check if we must cancel. |
|
| 47 | + if ( $this->must_cancel() ) { |
|
| 48 | + $this->cancel(); |
|
| 49 | + |
|
| 50 | + return false; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + $this->log->debug( sprintf( "Synchronizing posts %s...", implode( ', ', $post_ids ) ) ); |
|
| 54 | + |
|
| 55 | + // Sync the item. |
|
| 56 | + return $this->sync_items( $post_ids ); |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * Start the background processing. |
|
| 61 | + * |
|
| 62 | + * @return bool True if the process has been started, otherwise false. |
|
| 63 | + */ |
|
| 64 | + public function start() { |
|
| 65 | + |
|
| 66 | + // Create a new Sync_Model state of `started`. |
|
| 67 | + if ( ! $this->is_started( self::get_state() ) ) { |
|
| 68 | + $this->log->debug( "Starting..." ); |
|
| 69 | + |
|
| 70 | + $sync_state = new Sync_State( time(), 0, $this->sync_service->count(), time(), 'started' ); |
|
| 71 | + update_option( '_wl_dataset_sync', $sync_state, false ); |
|
| 72 | + |
|
| 73 | + $next = $this->sync_service->next(); |
|
| 74 | + $this->push_to_queue( $next ); |
|
| 75 | + $this->save()->dispatch(); |
|
| 76 | + |
|
| 77 | + $this->log->debug( sprintf( 'Started with post IDs %s.', implode( ', ', $next ) ) ); |
|
| 78 | + |
|
| 79 | + return true; |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + return false; |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * Set the transient to cancel the process. The next time the process runs, it'll check whether this transient is |
|
| 87 | + * set and will stop processing. |
|
| 88 | + */ |
|
| 89 | + public function request_cancel() { |
|
| 90 | + |
|
| 91 | + set_transient( "{$this->action}__cancel", true ); |
|
| 92 | + |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * Get the sync state. |
|
| 97 | + * |
|
| 98 | + * @return Sync_State The {@link Sync_State}. |
|
| 99 | + */ |
|
| 100 | + public static function get_state() { |
|
| 101 | + |
|
| 102 | + try { |
|
| 103 | + return get_option( '_wl_dataset_sync', Sync_State::unknown() ); |
|
| 104 | + } catch ( \Exception $e ) { |
|
| 105 | + return Sync_State::unknown(); |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | + * Check whether the provided state is `started` or not. |
|
| 112 | + * |
|
| 113 | + * @param Sync_State $state The {@link Sync_State}. |
|
| 114 | + * |
|
| 115 | + * @return bool True if the state is started. |
|
| 116 | + */ |
|
| 117 | + private function is_started( $state ) { |
|
| 118 | + return $state instanceof Sync_State && 'started' === $state->state && 30 > ( time() - $state->last_update ); |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * Check whether the process must cancel or not. |
|
| 123 | + * |
|
| 124 | + * @return bool Whether to cancel or not the process. |
|
| 125 | + */ |
|
| 126 | + private function must_cancel() { |
|
| 127 | + |
|
| 128 | + return get_transient( "{$this->action}__cancel" ); |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + /** |
|
| 132 | + * Cancels the current process. |
|
| 133 | + */ |
|
| 134 | + private function cancel() { |
|
| 135 | + |
|
| 136 | + $this->log->debug( "Cancelling synchronization..." ); |
|
| 137 | + |
|
| 138 | + // Cleanup the process data. |
|
| 139 | + $this->cancel_process(); |
|
| 140 | + |
|
| 141 | + // Set the state to cancelled. |
|
| 142 | + $state = self::get_state(); |
|
| 143 | + $state->set_state( 'cancelled' ); |
|
| 144 | + update_option( '_wl_dataset_sync', $state, false ); |
|
| 145 | + |
|
| 146 | + // Finally delete the transient. |
|
| 147 | + delete_transient( "{$this->action}__cancel" ); |
|
| 148 | + |
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + /** |
|
| 152 | + * Push the post with the provided ID to the remote platform. |
|
| 153 | + * |
|
| 154 | + * @param int[] $post_ids The post IDs. |
|
| 155 | + * |
|
| 156 | + * @return int[]|false The next post ID to process or false if processing is complete. |
|
| 157 | + */ |
|
| 158 | + private function sync_items( $post_ids ) { |
|
| 159 | + |
|
| 160 | + if ( ! is_array( $post_ids ) ) { |
|
| 161 | + $this->log->error( '$post_ids must be an array, received: ' . var_export( $post_ids, true ) ); |
|
| 162 | + return false; |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + // Sync this item. |
|
| 166 | + if ( $this->sync_service->sync_items( $post_ids ) ) { |
|
| 167 | + |
|
| 168 | + $next = $this->sync_service->next(); |
|
| 169 | + $next_state = isset( $next ) ? 'started' : 'ended'; |
|
| 170 | + |
|
| 171 | + /** |
|
| 172 | + * Update the synchronization meta data, by increasing the current index. |
|
| 173 | + * |
|
| 174 | + * @var Sync_State $sync The {@link Sync_State}. |
|
| 175 | + */ |
|
| 176 | + $state = self::get_state() |
|
| 177 | + ->increment_index( $this->sync_service->get_batch_size() ) |
|
| 178 | + ->set_state( $next_state ); |
|
| 179 | + update_option( '_wl_dataset_sync', $state, false ); |
|
| 180 | + |
|
| 181 | + $this->log->debug( "State updated to " . var_export( $state, true ) ); |
|
| 182 | + |
|
| 183 | + // Return the next IDs or false if there aren't. |
|
| 184 | + return isset( $next ) ? $next : false; |
|
| 185 | + } else { |
|
| 186 | + // Retry. |
|
| 187 | + // @@todo: put a limit to the number of retries. |
|
| 188 | + |
|
| 189 | + $this->log->error( sprintf( "Sync failed for posts %s.", implode( ', ', $post_ids ) ) ); |
|
| 190 | + |
|
| 191 | + return $post_ids; |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + } |
|
| 195 | 195 | |
| 196 | 196 | } |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param $sync_service Sync_Service A {@link Sync_Service} instance providing the supporting functions to this background process. |
| 23 | 23 | */ |
| 24 | - public function __construct( $sync_service ) { |
|
| 24 | + public function __construct($sync_service) { |
|
| 25 | 25 | parent::__construct(); |
| 26 | 26 | |
| 27 | - $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 27 | + $this->log = \Wordlift_Log_Service::get_logger(get_class()); |
|
| 28 | 28 | |
| 29 | 29 | $this->sync_service = $sync_service; |
| 30 | 30 | |
@@ -41,19 +41,19 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @return int[]|false The next post IDs or false if there are no more. |
| 43 | 43 | */ |
| 44 | - protected function task( $post_ids ) { |
|
| 44 | + protected function task($post_ids) { |
|
| 45 | 45 | |
| 46 | 46 | // Check if we must cancel. |
| 47 | - if ( $this->must_cancel() ) { |
|
| 47 | + if ($this->must_cancel()) { |
|
| 48 | 48 | $this->cancel(); |
| 49 | 49 | |
| 50 | 50 | return false; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $this->log->debug( sprintf( "Synchronizing posts %s...", implode( ', ', $post_ids ) ) ); |
|
| 53 | + $this->log->debug(sprintf("Synchronizing posts %s...", implode(', ', $post_ids))); |
|
| 54 | 54 | |
| 55 | 55 | // Sync the item. |
| 56 | - return $this->sync_items( $post_ids ); |
|
| 56 | + return $this->sync_items($post_ids); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -64,17 +64,17 @@ discard block |
||
| 64 | 64 | public function start() { |
| 65 | 65 | |
| 66 | 66 | // Create a new Sync_Model state of `started`. |
| 67 | - if ( ! $this->is_started( self::get_state() ) ) { |
|
| 68 | - $this->log->debug( "Starting..." ); |
|
| 67 | + if ( ! $this->is_started(self::get_state())) { |
|
| 68 | + $this->log->debug("Starting..."); |
|
| 69 | 69 | |
| 70 | - $sync_state = new Sync_State( time(), 0, $this->sync_service->count(), time(), 'started' ); |
|
| 71 | - update_option( '_wl_dataset_sync', $sync_state, false ); |
|
| 70 | + $sync_state = new Sync_State(time(), 0, $this->sync_service->count(), time(), 'started'); |
|
| 71 | + update_option('_wl_dataset_sync', $sync_state, false); |
|
| 72 | 72 | |
| 73 | 73 | $next = $this->sync_service->next(); |
| 74 | - $this->push_to_queue( $next ); |
|
| 74 | + $this->push_to_queue($next); |
|
| 75 | 75 | $this->save()->dispatch(); |
| 76 | 76 | |
| 77 | - $this->log->debug( sprintf( 'Started with post IDs %s.', implode( ', ', $next ) ) ); |
|
| 77 | + $this->log->debug(sprintf('Started with post IDs %s.', implode(', ', $next))); |
|
| 78 | 78 | |
| 79 | 79 | return true; |
| 80 | 80 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function request_cancel() { |
| 90 | 90 | |
| 91 | - set_transient( "{$this->action}__cancel", true ); |
|
| 91 | + set_transient("{$this->action}__cancel", true); |
|
| 92 | 92 | |
| 93 | 93 | } |
| 94 | 94 | |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | public static function get_state() { |
| 101 | 101 | |
| 102 | 102 | try { |
| 103 | - return get_option( '_wl_dataset_sync', Sync_State::unknown() ); |
|
| 104 | - } catch ( \Exception $e ) { |
|
| 103 | + return get_option('_wl_dataset_sync', Sync_State::unknown()); |
|
| 104 | + } catch (\Exception $e) { |
|
| 105 | 105 | return Sync_State::unknown(); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | * |
| 115 | 115 | * @return bool True if the state is started. |
| 116 | 116 | */ |
| 117 | - private function is_started( $state ) { |
|
| 118 | - return $state instanceof Sync_State && 'started' === $state->state && 30 > ( time() - $state->last_update ); |
|
| 117 | + private function is_started($state) { |
|
| 118 | + return $state instanceof Sync_State && 'started' === $state->state && 30 > (time() - $state->last_update); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | private function must_cancel() { |
| 127 | 127 | |
| 128 | - return get_transient( "{$this->action}__cancel" ); |
|
| 128 | + return get_transient("{$this->action}__cancel"); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -133,18 +133,18 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | private function cancel() { |
| 135 | 135 | |
| 136 | - $this->log->debug( "Cancelling synchronization..." ); |
|
| 136 | + $this->log->debug("Cancelling synchronization..."); |
|
| 137 | 137 | |
| 138 | 138 | // Cleanup the process data. |
| 139 | 139 | $this->cancel_process(); |
| 140 | 140 | |
| 141 | 141 | // Set the state to cancelled. |
| 142 | 142 | $state = self::get_state(); |
| 143 | - $state->set_state( 'cancelled' ); |
|
| 144 | - update_option( '_wl_dataset_sync', $state, false ); |
|
| 143 | + $state->set_state('cancelled'); |
|
| 144 | + update_option('_wl_dataset_sync', $state, false); |
|
| 145 | 145 | |
| 146 | 146 | // Finally delete the transient. |
| 147 | - delete_transient( "{$this->action}__cancel" ); |
|
| 147 | + delete_transient("{$this->action}__cancel"); |
|
| 148 | 148 | |
| 149 | 149 | } |
| 150 | 150 | |
@@ -155,18 +155,18 @@ discard block |
||
| 155 | 155 | * |
| 156 | 156 | * @return int[]|false The next post ID to process or false if processing is complete. |
| 157 | 157 | */ |
| 158 | - private function sync_items( $post_ids ) { |
|
| 158 | + private function sync_items($post_ids) { |
|
| 159 | 159 | |
| 160 | - if ( ! is_array( $post_ids ) ) { |
|
| 161 | - $this->log->error( '$post_ids must be an array, received: ' . var_export( $post_ids, true ) ); |
|
| 160 | + if ( ! is_array($post_ids)) { |
|
| 161 | + $this->log->error('$post_ids must be an array, received: '.var_export($post_ids, true)); |
|
| 162 | 162 | return false; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // Sync this item. |
| 166 | - if ( $this->sync_service->sync_items( $post_ids ) ) { |
|
| 166 | + if ($this->sync_service->sync_items($post_ids)) { |
|
| 167 | 167 | |
| 168 | 168 | $next = $this->sync_service->next(); |
| 169 | - $next_state = isset( $next ) ? 'started' : 'ended'; |
|
| 169 | + $next_state = isset($next) ? 'started' : 'ended'; |
|
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | 172 | * Update the synchronization meta data, by increasing the current index. |
@@ -174,19 +174,19 @@ discard block |
||
| 174 | 174 | * @var Sync_State $sync The {@link Sync_State}. |
| 175 | 175 | */ |
| 176 | 176 | $state = self::get_state() |
| 177 | - ->increment_index( $this->sync_service->get_batch_size() ) |
|
| 178 | - ->set_state( $next_state ); |
|
| 179 | - update_option( '_wl_dataset_sync', $state, false ); |
|
| 177 | + ->increment_index($this->sync_service->get_batch_size()) |
|
| 178 | + ->set_state($next_state); |
|
| 179 | + update_option('_wl_dataset_sync', $state, false); |
|
| 180 | 180 | |
| 181 | - $this->log->debug( "State updated to " . var_export( $state, true ) ); |
|
| 181 | + $this->log->debug("State updated to ".var_export($state, true)); |
|
| 182 | 182 | |
| 183 | 183 | // Return the next IDs or false if there aren't. |
| 184 | - return isset( $next ) ? $next : false; |
|
| 184 | + return isset($next) ? $next : false; |
|
| 185 | 185 | } else { |
| 186 | 186 | // Retry. |
| 187 | 187 | // @@todo: put a limit to the number of retries. |
| 188 | 188 | |
| 189 | - $this->log->error( sprintf( "Sync failed for posts %s.", implode( ', ', $post_ids ) ) ); |
|
| 189 | + $this->log->error(sprintf("Sync failed for posts %s.", implode(', ', $post_ids))); |
|
| 190 | 190 | |
| 191 | 191 | return $post_ids; |
| 192 | 192 | } |
@@ -4,46 +4,46 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Sync_State { |
| 6 | 6 | |
| 7 | - public $started; |
|
| 8 | - public $index; |
|
| 9 | - public $count; |
|
| 10 | - public $last_update; |
|
| 11 | - public $state; |
|
| 12 | - |
|
| 13 | - /** |
|
| 14 | - * Sync_Model constructor. |
|
| 15 | - * |
|
| 16 | - * @param $started |
|
| 17 | - * @param $index |
|
| 18 | - * @param $count |
|
| 19 | - * @param $last_update |
|
| 20 | - * @param $state |
|
| 21 | - */ |
|
| 22 | - public function __construct( $started, $index, $count, $last_update, $state ) { |
|
| 23 | - $this->started = $started; |
|
| 24 | - $this->index = $index; |
|
| 25 | - $this->count = (int) $count; |
|
| 26 | - $this->last_update = $last_update; |
|
| 27 | - $this->state = $state; |
|
| 28 | - } |
|
| 29 | - |
|
| 30 | - public function increment_index( $count ) { |
|
| 31 | - $this->index += $count; |
|
| 32 | - $this->last_update = time(); |
|
| 33 | - |
|
| 34 | - return $this; |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - public function set_state( $value ) { |
|
| 38 | - $this->state = $value; |
|
| 39 | - $this->last_update = time(); |
|
| 40 | - |
|
| 41 | - return $this; |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - public static function unknown() { |
|
| 45 | - |
|
| 46 | - return new self( time(), 0, 0, time(), 'unknown' ); |
|
| 47 | - } |
|
| 7 | + public $started; |
|
| 8 | + public $index; |
|
| 9 | + public $count; |
|
| 10 | + public $last_update; |
|
| 11 | + public $state; |
|
| 12 | + |
|
| 13 | + /** |
|
| 14 | + * Sync_Model constructor. |
|
| 15 | + * |
|
| 16 | + * @param $started |
|
| 17 | + * @param $index |
|
| 18 | + * @param $count |
|
| 19 | + * @param $last_update |
|
| 20 | + * @param $state |
|
| 21 | + */ |
|
| 22 | + public function __construct( $started, $index, $count, $last_update, $state ) { |
|
| 23 | + $this->started = $started; |
|
| 24 | + $this->index = $index; |
|
| 25 | + $this->count = (int) $count; |
|
| 26 | + $this->last_update = $last_update; |
|
| 27 | + $this->state = $state; |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + public function increment_index( $count ) { |
|
| 31 | + $this->index += $count; |
|
| 32 | + $this->last_update = time(); |
|
| 33 | + |
|
| 34 | + return $this; |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + public function set_state( $value ) { |
|
| 38 | + $this->state = $value; |
|
| 39 | + $this->last_update = time(); |
|
| 40 | + |
|
| 41 | + return $this; |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + public static function unknown() { |
|
| 45 | + |
|
| 46 | + return new self( time(), 0, 0, time(), 'unknown' ); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | } |
| 50 | 50 | \ No newline at end of file |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * @param $last_update |
| 20 | 20 | * @param $state |
| 21 | 21 | */ |
| 22 | - public function __construct( $started, $index, $count, $last_update, $state ) { |
|
| 22 | + public function __construct($started, $index, $count, $last_update, $state) { |
|
| 23 | 23 | $this->started = $started; |
| 24 | 24 | $this->index = $index; |
| 25 | 25 | $this->count = (int) $count; |
@@ -27,14 +27,14 @@ discard block |
||
| 27 | 27 | $this->state = $state; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function increment_index( $count ) { |
|
| 31 | - $this->index += $count; |
|
| 30 | + public function increment_index($count) { |
|
| 31 | + $this->index += $count; |
|
| 32 | 32 | $this->last_update = time(); |
| 33 | 33 | |
| 34 | 34 | return $this; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function set_state( $value ) { |
|
| 37 | + public function set_state($value) { |
|
| 38 | 38 | $this->state = $value; |
| 39 | 39 | $this->last_update = time(); |
| 40 | 40 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | public static function unknown() { |
| 45 | 45 | |
| 46 | - return new self( time(), 0, 0, time(), 'unknown' ); |
|
| 46 | + return new self(time(), 0, 0, time(), 'unknown'); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | } |
| 50 | 50 | \ No newline at end of file |
@@ -4,41 +4,41 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Response { |
| 6 | 6 | |
| 7 | - private $response; |
|
| 7 | + private $response; |
|
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * @var int|string |
|
| 11 | - */ |
|
| 12 | - private $code; |
|
| 9 | + /** |
|
| 10 | + * @var int|string |
|
| 11 | + */ |
|
| 12 | + private $code; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * @var bool |
|
| 16 | - */ |
|
| 17 | - private $is_success; |
|
| 14 | + /** |
|
| 15 | + * @var bool |
|
| 16 | + */ |
|
| 17 | + private $is_success; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @var string |
|
| 21 | - */ |
|
| 22 | - private $body; |
|
| 19 | + /** |
|
| 20 | + * @var string |
|
| 21 | + */ |
|
| 22 | + private $body; |
|
| 23 | 23 | |
| 24 | - public function __construct( $response ) { |
|
| 24 | + public function __construct( $response ) { |
|
| 25 | 25 | |
| 26 | - $this->response = $response; |
|
| 27 | - $this->code = wp_remote_retrieve_response_code( $this->response ); |
|
| 28 | - $this->is_success = ! empty( $this->code ) && 2 === intval( $this->code / 100 ); |
|
| 29 | - $this->body = wp_remote_retrieve_body( $this->response ); |
|
| 26 | + $this->response = $response; |
|
| 27 | + $this->code = wp_remote_retrieve_response_code( $this->response ); |
|
| 28 | + $this->is_success = ! empty( $this->code ) && 2 === intval( $this->code / 100 ); |
|
| 29 | + $this->body = wp_remote_retrieve_body( $this->response ); |
|
| 30 | 30 | |
| 31 | - } |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - public function is_success() { |
|
| 33 | + public function is_success() { |
|
| 34 | 34 | |
| 35 | - return $this->is_success; |
|
| 35 | + return $this->is_success; |
|
| 36 | 36 | |
| 37 | - } |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - public function get_body() { |
|
| 39 | + public function get_body() { |
|
| 40 | 40 | |
| 41 | - return $this->body; |
|
| 42 | - } |
|
| 41 | + return $this->body; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | 44 | } |
@@ -21,12 +21,12 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | private $body; |
| 23 | 23 | |
| 24 | - public function __construct( $response ) { |
|
| 24 | + public function __construct($response) { |
|
| 25 | 25 | |
| 26 | 26 | $this->response = $response; |
| 27 | - $this->code = wp_remote_retrieve_response_code( $this->response ); |
|
| 28 | - $this->is_success = ! empty( $this->code ) && 2 === intval( $this->code / 100 ); |
|
| 29 | - $this->body = wp_remote_retrieve_body( $this->response ); |
|
| 27 | + $this->code = wp_remote_retrieve_response_code($this->response); |
|
| 28 | + $this->is_success = ! empty($this->code) && 2 === intval($this->code / 100); |
|
| 29 | + $this->body = wp_remote_retrieve_body($this->response); |
|
| 30 | 30 | |
| 31 | 31 | } |
| 32 | 32 | |
@@ -64,1566 +64,1566 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | class Wordlift { |
| 66 | 66 | |
| 67 | - //<editor-fold desc="## FIELDS"> |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
| 71 | - * the plugin. |
|
| 72 | - * |
|
| 73 | - * @since 1.0.0 |
|
| 74 | - * @access protected |
|
| 75 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 76 | - */ |
|
| 77 | - protected $loader; |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * The unique identifier of this plugin. |
|
| 81 | - * |
|
| 82 | - * @since 1.0.0 |
|
| 83 | - * @access protected |
|
| 84 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 85 | - */ |
|
| 86 | - protected $plugin_name; |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * The current version of the plugin. |
|
| 90 | - * |
|
| 91 | - * @since 1.0.0 |
|
| 92 | - * @access protected |
|
| 93 | - * @var string $version The current version of the plugin. |
|
| 94 | - */ |
|
| 95 | - protected $version; |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 99 | - * |
|
| 100 | - * @since 3.12.0 |
|
| 101 | - * @access protected |
|
| 102 | - * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 103 | - */ |
|
| 104 | - protected $tinymce_adapter; |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * The {@link Faq_Tinymce_Adapter} instance |
|
| 108 | - * @since 3.26.0 |
|
| 109 | - * @access protected |
|
| 110 | - * @var Faq_Tinymce_Adapter $faq_tinymce_adapter . |
|
| 111 | - */ |
|
| 112 | - //protected $faq_tinymce_adapter; |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * The Thumbnail service. |
|
| 116 | - * |
|
| 117 | - * @since 3.1.5 |
|
| 118 | - * @access private |
|
| 119 | - * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 120 | - */ |
|
| 121 | - private $thumbnail_service; |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * The UI service. |
|
| 125 | - * |
|
| 126 | - * @since 3.2.0 |
|
| 127 | - * @access private |
|
| 128 | - * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 129 | - */ |
|
| 130 | - private $ui_service; |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * The Schema service. |
|
| 134 | - * |
|
| 135 | - * @since 3.3.0 |
|
| 136 | - * @access protected |
|
| 137 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 138 | - */ |
|
| 139 | - protected $schema_service; |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * The Entity service. |
|
| 143 | - * |
|
| 144 | - * @since 3.1.0 |
|
| 145 | - * @access protected |
|
| 146 | - * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 147 | - */ |
|
| 148 | - protected $entity_service; |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * The Topic Taxonomy service. |
|
| 152 | - * |
|
| 153 | - * @since 3.5.0 |
|
| 154 | - * @access private |
|
| 155 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 156 | - */ |
|
| 157 | - private $topic_taxonomy_service; |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * The Entity Types Taxonomy service. |
|
| 161 | - * |
|
| 162 | - * @since 3.18.0 |
|
| 163 | - * @access private |
|
| 164 | - * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 165 | - */ |
|
| 166 | - private $entity_types_taxonomy_service; |
|
| 167 | - |
|
| 168 | - /** |
|
| 169 | - * The User service. |
|
| 170 | - * |
|
| 171 | - * @since 3.1.7 |
|
| 172 | - * @access protected |
|
| 173 | - * @var \Wordlift_User_Service $user_service The User service. |
|
| 174 | - */ |
|
| 175 | - protected $user_service; |
|
| 176 | - |
|
| 177 | - /** |
|
| 178 | - * The Timeline service. |
|
| 179 | - * |
|
| 180 | - * @since 3.1.0 |
|
| 181 | - * @access private |
|
| 182 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 183 | - */ |
|
| 184 | - private $timeline_service; |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * The Redirect service. |
|
| 188 | - * |
|
| 189 | - * @since 3.2.0 |
|
| 190 | - * @access private |
|
| 191 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 192 | - */ |
|
| 193 | - private $redirect_service; |
|
| 194 | - |
|
| 195 | - /** |
|
| 196 | - * The Notice service. |
|
| 197 | - * |
|
| 198 | - * @since 3.3.0 |
|
| 199 | - * @access private |
|
| 200 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 201 | - */ |
|
| 202 | - private $notice_service; |
|
| 203 | - |
|
| 204 | - /** |
|
| 205 | - * The Entity list customization. |
|
| 206 | - * |
|
| 207 | - * @since 3.3.0 |
|
| 208 | - * @access protected |
|
| 209 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 210 | - */ |
|
| 211 | - protected $entity_list_service; |
|
| 212 | - |
|
| 213 | - /** |
|
| 214 | - * The Entity Types Taxonomy Walker. |
|
| 215 | - * |
|
| 216 | - * @since 3.1.0 |
|
| 217 | - * @access private |
|
| 218 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 219 | - */ |
|
| 220 | - private $entity_types_taxonomy_walker; |
|
| 221 | - |
|
| 222 | - /** |
|
| 223 | - * The ShareThis service. |
|
| 224 | - * |
|
| 225 | - * @since 3.2.0 |
|
| 226 | - * @access private |
|
| 227 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 228 | - */ |
|
| 229 | - private $sharethis_service; |
|
| 230 | - |
|
| 231 | - /** |
|
| 232 | - * The PrimaShop adapter. |
|
| 233 | - * |
|
| 234 | - * @since 3.2.3 |
|
| 235 | - * @access private |
|
| 236 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 237 | - */ |
|
| 238 | - private $primashop_adapter; |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * The WordLift Dashboard adapter. |
|
| 242 | - * |
|
| 243 | - * @since 3.4.0 |
|
| 244 | - * @access private |
|
| 245 | - * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 246 | - */ |
|
| 247 | - private $dashboard_service; |
|
| 248 | - |
|
| 249 | - /** |
|
| 250 | - * The entity type service. |
|
| 251 | - * |
|
| 252 | - * @since 3.6.0 |
|
| 253 | - * @access private |
|
| 254 | - * @var \Wordlift_Entity_Post_Type_Service |
|
| 255 | - */ |
|
| 256 | - private $entity_post_type_service; |
|
| 257 | - |
|
| 258 | - /** |
|
| 259 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 260 | - * |
|
| 261 | - * @since 3.6.0 |
|
| 262 | - * @access private |
|
| 263 | - * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 264 | - */ |
|
| 265 | - private $entity_link_service; |
|
| 266 | - |
|
| 267 | - /** |
|
| 268 | - * A {@link Wordlift_Sparql_Service} instance. |
|
| 269 | - * |
|
| 270 | - * @since 3.6.0 |
|
| 271 | - * @access protected |
|
| 272 | - * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 273 | - */ |
|
| 274 | - protected $sparql_service; |
|
| 275 | - |
|
| 276 | - /** |
|
| 277 | - * A {@link Wordlift_Import_Service} instance. |
|
| 278 | - * |
|
| 279 | - * @since 3.6.0 |
|
| 280 | - * @access private |
|
| 281 | - * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 282 | - */ |
|
| 283 | - private $import_service; |
|
| 284 | - |
|
| 285 | - /** |
|
| 286 | - * A {@link Wordlift_Rebuild_Service} instance. |
|
| 287 | - * |
|
| 288 | - * @since 3.6.0 |
|
| 289 | - * @access private |
|
| 290 | - * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 291 | - */ |
|
| 292 | - private $rebuild_service; |
|
| 293 | - |
|
| 294 | - /** |
|
| 295 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
| 296 | - * |
|
| 297 | - * @since 3.7.0 |
|
| 298 | - * @access protected |
|
| 299 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 300 | - */ |
|
| 301 | - protected $jsonld_service; |
|
| 302 | - |
|
| 303 | - /** |
|
| 304 | - * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 305 | - * |
|
| 306 | - * @since 3.14.0 |
|
| 307 | - * @access protected |
|
| 308 | - * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 309 | - */ |
|
| 310 | - protected $jsonld_website_converter; |
|
| 311 | - |
|
| 312 | - /** |
|
| 313 | - * A {@link Wordlift_Property_Factory} instance. |
|
| 314 | - * |
|
| 315 | - * @since 3.7.0 |
|
| 316 | - * @access private |
|
| 317 | - * @var \Wordlift_Property_Factory $property_factory |
|
| 318 | - */ |
|
| 319 | - private $property_factory; |
|
| 320 | - |
|
| 321 | - /** |
|
| 322 | - * The 'Download Your Data' page. |
|
| 323 | - * |
|
| 324 | - * @since 3.6.0 |
|
| 325 | - * @access private |
|
| 326 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 327 | - */ |
|
| 328 | - private $download_your_data_page; |
|
| 329 | - |
|
| 330 | - /** |
|
| 331 | - * The 'WordLift Settings' page. |
|
| 332 | - * |
|
| 333 | - * @since 3.11.0 |
|
| 334 | - * @access protected |
|
| 335 | - * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 336 | - */ |
|
| 337 | - protected $settings_page; |
|
| 338 | - |
|
| 339 | - /** |
|
| 340 | - * The install wizard page. |
|
| 341 | - * |
|
| 342 | - * @since 3.9.0 |
|
| 343 | - * @access private |
|
| 344 | - * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 345 | - */ |
|
| 346 | - public $admin_setup; |
|
| 347 | - |
|
| 348 | - /** |
|
| 349 | - * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 350 | - * linking of entities to their pages. |
|
| 351 | - * |
|
| 352 | - * @since 3.8.0 |
|
| 353 | - * @access private |
|
| 354 | - * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 355 | - */ |
|
| 356 | - private $content_filter_service; |
|
| 357 | - |
|
| 358 | - /** |
|
| 359 | - * The Faq Content filter service |
|
| 360 | - * @since 3.26.0 |
|
| 361 | - * @access private |
|
| 362 | - * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
| 363 | - */ |
|
| 364 | - private $faq_content_filter_service; |
|
| 365 | - |
|
| 366 | - /** |
|
| 367 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 368 | - * |
|
| 369 | - * @since 3.9.0 |
|
| 370 | - * @access private |
|
| 371 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 372 | - */ |
|
| 373 | - private $key_validation_service; |
|
| 374 | - |
|
| 375 | - /** |
|
| 376 | - * A {@link Wordlift_Rating_Service} instance. |
|
| 377 | - * |
|
| 378 | - * @since 3.10.0 |
|
| 379 | - * @access private |
|
| 380 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 381 | - */ |
|
| 382 | - private $rating_service; |
|
| 383 | - |
|
| 384 | - /** |
|
| 385 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 386 | - * |
|
| 387 | - * @since 3.10.0 |
|
| 388 | - * @access protected |
|
| 389 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 390 | - */ |
|
| 391 | - protected $post_to_jsonld_converter; |
|
| 392 | - |
|
| 393 | - /** |
|
| 394 | - * A {@link Wordlift_Configuration_Service} instance. |
|
| 395 | - * |
|
| 396 | - * @since 3.10.0 |
|
| 397 | - * @access protected |
|
| 398 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 399 | - */ |
|
| 400 | - protected $configuration_service; |
|
| 401 | - |
|
| 402 | - /** |
|
| 403 | - * A {@link Wordlift_Install_Service} instance. |
|
| 404 | - * |
|
| 405 | - * @since 3.18.0 |
|
| 406 | - * @access protected |
|
| 407 | - * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 408 | - */ |
|
| 409 | - protected $install_service; |
|
| 410 | - |
|
| 411 | - /** |
|
| 412 | - * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 413 | - * |
|
| 414 | - * @since 3.10.0 |
|
| 415 | - * @access protected |
|
| 416 | - * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 417 | - */ |
|
| 418 | - protected $entity_type_service; |
|
| 419 | - |
|
| 420 | - /** |
|
| 421 | - * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 422 | - * |
|
| 423 | - * @since 3.10.0 |
|
| 424 | - * @access protected |
|
| 425 | - * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 426 | - */ |
|
| 427 | - protected $entity_post_to_jsonld_converter; |
|
| 428 | - |
|
| 429 | - /** |
|
| 430 | - * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 431 | - * |
|
| 432 | - * @since 3.10.0 |
|
| 433 | - * @access protected |
|
| 434 | - * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 435 | - */ |
|
| 436 | - protected $postid_to_jsonld_converter; |
|
| 437 | - |
|
| 438 | - /** |
|
| 439 | - * The {@link Wordlift_Admin_Status_Page} class. |
|
| 440 | - * |
|
| 441 | - * @since 3.9.8 |
|
| 442 | - * @access private |
|
| 443 | - * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 444 | - */ |
|
| 445 | - private $status_page; |
|
| 446 | - |
|
| 447 | - /** |
|
| 448 | - * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 449 | - * |
|
| 450 | - * @since 3.11.0 |
|
| 451 | - * @access protected |
|
| 452 | - * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 453 | - */ |
|
| 454 | - protected $category_taxonomy_service; |
|
| 455 | - |
|
| 456 | - /** |
|
| 457 | - * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 458 | - * |
|
| 459 | - * @since 3.11.0 |
|
| 460 | - * @access protected |
|
| 461 | - * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 462 | - */ |
|
| 463 | - protected $entity_page_service; |
|
| 464 | - |
|
| 465 | - /** |
|
| 466 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 467 | - * |
|
| 468 | - * @since 3.11.0 |
|
| 469 | - * @access protected |
|
| 470 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 471 | - */ |
|
| 472 | - protected $settings_page_action_link; |
|
| 473 | - |
|
| 474 | - /** |
|
| 475 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 476 | - * |
|
| 477 | - * @since 3.11.0 |
|
| 478 | - * @access protected |
|
| 479 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 480 | - */ |
|
| 481 | - protected $analytics_settings_page_action_link; |
|
| 482 | - |
|
| 483 | - /** |
|
| 484 | - * The {@link Wordlift_Analytics_Connect} class. |
|
| 485 | - * |
|
| 486 | - * @since 3.11.0 |
|
| 487 | - * @access protected |
|
| 488 | - * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 489 | - */ |
|
| 490 | - protected $analytics_connect; |
|
| 491 | - |
|
| 492 | - /** |
|
| 493 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 494 | - * |
|
| 495 | - * @since 3.11.0 |
|
| 496 | - * @access protected |
|
| 497 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 498 | - */ |
|
| 499 | - protected $publisher_ajax_adapter; |
|
| 500 | - |
|
| 501 | - /** |
|
| 502 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 503 | - * |
|
| 504 | - * @since 3.11.0 |
|
| 505 | - * @access protected |
|
| 506 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 507 | - */ |
|
| 508 | - protected $input_element; |
|
| 509 | - |
|
| 510 | - /** |
|
| 511 | - * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 512 | - * |
|
| 513 | - * @since 3.13.0 |
|
| 514 | - * @access protected |
|
| 515 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 516 | - */ |
|
| 517 | - protected $radio_input_element; |
|
| 518 | - |
|
| 519 | - /** |
|
| 520 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 521 | - * |
|
| 522 | - * @since 3.11.0 |
|
| 523 | - * @access protected |
|
| 524 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 525 | - */ |
|
| 526 | - protected $language_select_element; |
|
| 527 | - |
|
| 528 | - /** |
|
| 529 | - * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 530 | - * |
|
| 531 | - * @since 3.18.0 |
|
| 532 | - * @access protected |
|
| 533 | - * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 534 | - */ |
|
| 535 | - protected $country_select_element; |
|
| 536 | - |
|
| 537 | - /** |
|
| 538 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 539 | - * |
|
| 540 | - * @since 3.11.0 |
|
| 541 | - * @access protected |
|
| 542 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 543 | - */ |
|
| 544 | - protected $publisher_element; |
|
| 545 | - |
|
| 546 | - /** |
|
| 547 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 548 | - * |
|
| 549 | - * @since 3.11.0 |
|
| 550 | - * @access protected |
|
| 551 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 552 | - */ |
|
| 553 | - protected $select2_element; |
|
| 554 | - |
|
| 555 | - /** |
|
| 556 | - * The controller for the entity type list admin page |
|
| 557 | - * |
|
| 558 | - * @since 3.11.0 |
|
| 559 | - * @access private |
|
| 560 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 561 | - */ |
|
| 562 | - private $entity_type_admin_page; |
|
| 563 | - |
|
| 564 | - /** |
|
| 565 | - * The controller for the entity type settings admin page |
|
| 566 | - * |
|
| 567 | - * @since 3.11.0 |
|
| 568 | - * @access private |
|
| 569 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 570 | - */ |
|
| 571 | - private $entity_type_settings_admin_page; |
|
| 572 | - |
|
| 573 | - /** |
|
| 574 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 575 | - * |
|
| 576 | - * @since 3.11.0 |
|
| 577 | - * @access protected |
|
| 578 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 579 | - */ |
|
| 580 | - protected $related_entities_cloud_widget; |
|
| 581 | - |
|
| 582 | - /** |
|
| 583 | - * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 584 | - * |
|
| 585 | - * @since 3.14.0 |
|
| 586 | - * @access protected |
|
| 587 | - * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 588 | - */ |
|
| 589 | - protected $author_element; |
|
| 590 | - |
|
| 591 | - /** |
|
| 592 | - * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 593 | - * |
|
| 594 | - * @since 3.12.0 |
|
| 595 | - * @access protected |
|
| 596 | - * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 597 | - */ |
|
| 598 | - protected $sample_data_service; |
|
| 599 | - |
|
| 600 | - /** |
|
| 601 | - * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 602 | - * |
|
| 603 | - * @since 3.12.0 |
|
| 604 | - * @access protected |
|
| 605 | - * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 606 | - */ |
|
| 607 | - protected $sample_data_ajax_adapter; |
|
| 608 | - |
|
| 609 | - /** |
|
| 610 | - * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 611 | - * |
|
| 612 | - * @since 3.14.3 |
|
| 613 | - * @access private |
|
| 614 | - * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 615 | - */ |
|
| 616 | - private $relation_rebuild_service; |
|
| 617 | - |
|
| 618 | - /** |
|
| 619 | - * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 620 | - * |
|
| 621 | - * @since 3.14.3 |
|
| 622 | - * @access private |
|
| 623 | - * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 624 | - */ |
|
| 625 | - private $relation_rebuild_adapter; |
|
| 626 | - |
|
| 627 | - /** |
|
| 628 | - * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 629 | - * |
|
| 630 | - * @since 3.18.0 |
|
| 631 | - * @access private |
|
| 632 | - * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 633 | - */ |
|
| 634 | - private $reference_rebuild_service; |
|
| 635 | - |
|
| 636 | - /** |
|
| 637 | - * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 638 | - * |
|
| 639 | - * @since 3.16.0 |
|
| 640 | - * @access protected |
|
| 641 | - * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 642 | - */ |
|
| 643 | - protected $google_analytics_export_service; |
|
| 644 | - |
|
| 645 | - /** |
|
| 646 | - * {@link Wordlift}'s singleton instance. |
|
| 647 | - * |
|
| 648 | - * @since 3.15.0 |
|
| 649 | - * @access protected |
|
| 650 | - * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 651 | - */ |
|
| 652 | - protected $entity_type_adapter; |
|
| 653 | - |
|
| 654 | - /** |
|
| 655 | - * The {@link Wordlift_Storage_Factory} instance. |
|
| 656 | - * |
|
| 657 | - * @since 3.15.0 |
|
| 658 | - * @access protected |
|
| 659 | - * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 660 | - */ |
|
| 661 | - protected $storage_factory; |
|
| 662 | - |
|
| 663 | - /** |
|
| 664 | - * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 665 | - * |
|
| 666 | - * @since 3.15.0 |
|
| 667 | - * @access protected |
|
| 668 | - * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 669 | - */ |
|
| 670 | - protected $rendition_factory; |
|
| 671 | - |
|
| 672 | - /** |
|
| 673 | - * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 674 | - * |
|
| 675 | - * @since 3.15.0 |
|
| 676 | - * @access private |
|
| 677 | - * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 678 | - */ |
|
| 679 | - private $autocomplete_adapter; |
|
| 680 | - |
|
| 681 | - /** |
|
| 682 | - * The {@link Wordlift_Relation_Service} instance. |
|
| 683 | - * |
|
| 684 | - * @since 3.15.0 |
|
| 685 | - * @access protected |
|
| 686 | - * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 687 | - */ |
|
| 688 | - protected $relation_service; |
|
| 689 | - |
|
| 690 | - /** |
|
| 691 | - * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 692 | - * |
|
| 693 | - * @since 3.16.0 |
|
| 694 | - * @access protected |
|
| 695 | - * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 696 | - * |
|
| 697 | - */ |
|
| 698 | - protected $cached_postid_to_jsonld_converter; |
|
| 699 | - |
|
| 700 | - /** |
|
| 701 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 702 | - * |
|
| 703 | - * @since 3.16.3 |
|
| 704 | - * @access protected |
|
| 705 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 706 | - */ |
|
| 707 | - protected $entity_uri_service; |
|
| 708 | - |
|
| 709 | - /** |
|
| 710 | - * The {@link Wordlift_Publisher_Service} instance. |
|
| 711 | - * |
|
| 712 | - * @since 3.19.0 |
|
| 713 | - * @access protected |
|
| 714 | - * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 715 | - */ |
|
| 716 | - protected $publisher_service; |
|
| 717 | - |
|
| 718 | - /** |
|
| 719 | - * The {@link Wordlift_Context_Cards_Service} instance. |
|
| 720 | - * |
|
| 721 | - * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
| 722 | - */ |
|
| 723 | - protected $context_cards_service; |
|
| 724 | - |
|
| 725 | - /** |
|
| 726 | - * {@link Wordlift}'s singleton instance. |
|
| 727 | - * |
|
| 728 | - * @since 3.11.2 |
|
| 729 | - * @access private |
|
| 730 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 731 | - */ |
|
| 732 | - private static $instance; |
|
| 733 | - |
|
| 734 | - //</editor-fold> |
|
| 735 | - |
|
| 736 | - /** |
|
| 737 | - * Define the core functionality of the plugin. |
|
| 738 | - * |
|
| 739 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 740 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 741 | - * the public-facing side of the site. |
|
| 742 | - * |
|
| 743 | - * @since 1.0.0 |
|
| 744 | - */ |
|
| 745 | - public function __construct() { |
|
| 746 | - |
|
| 747 | - self::$instance = $this; |
|
| 748 | - |
|
| 749 | - $this->plugin_name = 'wordlift'; |
|
| 750 | - $this->version = '3.27.6'; |
|
| 751 | - $this->load_dependencies(); |
|
| 752 | - $this->set_locale(); |
|
| 753 | - $this->define_admin_hooks(); |
|
| 754 | - $this->define_public_hooks(); |
|
| 755 | - |
|
| 756 | - // If we're in `WP_CLI` load the related files. |
|
| 757 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 758 | - $this->load_cli_dependencies(); |
|
| 759 | - } |
|
| 760 | - |
|
| 761 | - } |
|
| 762 | - |
|
| 763 | - /** |
|
| 764 | - * Get the singleton instance. |
|
| 765 | - * |
|
| 766 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 767 | - * @since 3.11.2 |
|
| 768 | - * |
|
| 769 | - */ |
|
| 770 | - public static function get_instance() { |
|
| 771 | - |
|
| 772 | - return self::$instance; |
|
| 773 | - } |
|
| 774 | - |
|
| 775 | - /** |
|
| 776 | - * Load the required dependencies for this plugin. |
|
| 777 | - * |
|
| 778 | - * Include the following files that make up the plugin: |
|
| 779 | - * |
|
| 780 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 781 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 782 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 783 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 784 | - * |
|
| 785 | - * Create an instance of the loader which will be used to register the hooks |
|
| 786 | - * with WordPress. |
|
| 787 | - * |
|
| 788 | - * @throws Exception |
|
| 789 | - * @since 1.0.0 |
|
| 790 | - * @access private |
|
| 791 | - */ |
|
| 792 | - private function load_dependencies() { |
|
| 793 | - |
|
| 794 | - /** |
|
| 795 | - * The class responsible for orchestrating the actions and filters of the |
|
| 796 | - * core plugin. |
|
| 797 | - */ |
|
| 798 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 799 | - |
|
| 800 | - // The class responsible for plugin uninstall. |
|
| 801 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 802 | - |
|
| 803 | - /** |
|
| 804 | - * The class responsible for defining internationalization functionality |
|
| 805 | - * of the plugin. |
|
| 806 | - */ |
|
| 807 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 808 | - |
|
| 809 | - /** |
|
| 810 | - * WordLift's supported languages. |
|
| 811 | - */ |
|
| 812 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 813 | - |
|
| 814 | - /** |
|
| 815 | - * WordLift's supported countries. |
|
| 816 | - */ |
|
| 817 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 818 | - |
|
| 819 | - /** |
|
| 820 | - * Provide support functions to sanitize data. |
|
| 821 | - */ |
|
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 823 | - |
|
| 824 | - /** Services. */ |
|
| 825 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 826 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 828 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 829 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 830 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 831 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 832 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 833 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 834 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 835 | - |
|
| 836 | - /** |
|
| 837 | - * The Query builder. |
|
| 838 | - */ |
|
| 839 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 840 | - |
|
| 841 | - /** |
|
| 842 | - * The Schema service. |
|
| 843 | - */ |
|
| 844 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 845 | - |
|
| 846 | - /** |
|
| 847 | - * The schema:url property service. |
|
| 848 | - */ |
|
| 849 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 850 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 851 | - |
|
| 852 | - /** |
|
| 853 | - * The UI service. |
|
| 854 | - */ |
|
| 855 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 856 | - |
|
| 857 | - /** |
|
| 858 | - * The Thumbnail service. |
|
| 859 | - */ |
|
| 860 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 861 | - |
|
| 862 | - /** |
|
| 863 | - * The Entity Types Taxonomy service. |
|
| 864 | - */ |
|
| 865 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 866 | - |
|
| 867 | - /** |
|
| 868 | - * The Entity service. |
|
| 869 | - */ |
|
| 870 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 871 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 872 | - |
|
| 873 | - // Add the entity rating service. |
|
| 874 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 875 | - |
|
| 876 | - /** |
|
| 877 | - * The User service. |
|
| 878 | - */ |
|
| 879 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 880 | - |
|
| 881 | - /** |
|
| 882 | - * The Timeline service. |
|
| 883 | - */ |
|
| 884 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 885 | - |
|
| 886 | - /** |
|
| 887 | - * The Topic Taxonomy service. |
|
| 888 | - */ |
|
| 889 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 890 | - |
|
| 891 | - /** |
|
| 892 | - * The SPARQL service. |
|
| 893 | - */ |
|
| 894 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 895 | - |
|
| 896 | - /** |
|
| 897 | - * The WordLift import service. |
|
| 898 | - */ |
|
| 899 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 900 | - |
|
| 901 | - /** |
|
| 902 | - * The WordLift URI service. |
|
| 903 | - */ |
|
| 904 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 905 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 906 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 907 | - |
|
| 908 | - /** |
|
| 909 | - * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 910 | - */ |
|
| 911 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 912 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 913 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 914 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 915 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 916 | - |
|
| 917 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 918 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 919 | - |
|
| 920 | - /** |
|
| 921 | - * Load the converters. |
|
| 922 | - */ |
|
| 923 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 924 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 925 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 926 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 927 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 928 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 929 | - |
|
| 930 | - /** |
|
| 931 | - * Load cache-related files. |
|
| 932 | - */ |
|
| 933 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 934 | - |
|
| 935 | - /** |
|
| 936 | - * Load the content filter. |
|
| 937 | - */ |
|
| 938 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 939 | - |
|
| 940 | - /* |
|
| 67 | + //<editor-fold desc="## FIELDS"> |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
| 71 | + * the plugin. |
|
| 72 | + * |
|
| 73 | + * @since 1.0.0 |
|
| 74 | + * @access protected |
|
| 75 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 76 | + */ |
|
| 77 | + protected $loader; |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * The unique identifier of this plugin. |
|
| 81 | + * |
|
| 82 | + * @since 1.0.0 |
|
| 83 | + * @access protected |
|
| 84 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 85 | + */ |
|
| 86 | + protected $plugin_name; |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * The current version of the plugin. |
|
| 90 | + * |
|
| 91 | + * @since 1.0.0 |
|
| 92 | + * @access protected |
|
| 93 | + * @var string $version The current version of the plugin. |
|
| 94 | + */ |
|
| 95 | + protected $version; |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 99 | + * |
|
| 100 | + * @since 3.12.0 |
|
| 101 | + * @access protected |
|
| 102 | + * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 103 | + */ |
|
| 104 | + protected $tinymce_adapter; |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * The {@link Faq_Tinymce_Adapter} instance |
|
| 108 | + * @since 3.26.0 |
|
| 109 | + * @access protected |
|
| 110 | + * @var Faq_Tinymce_Adapter $faq_tinymce_adapter . |
|
| 111 | + */ |
|
| 112 | + //protected $faq_tinymce_adapter; |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * The Thumbnail service. |
|
| 116 | + * |
|
| 117 | + * @since 3.1.5 |
|
| 118 | + * @access private |
|
| 119 | + * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 120 | + */ |
|
| 121 | + private $thumbnail_service; |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * The UI service. |
|
| 125 | + * |
|
| 126 | + * @since 3.2.0 |
|
| 127 | + * @access private |
|
| 128 | + * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 129 | + */ |
|
| 130 | + private $ui_service; |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * The Schema service. |
|
| 134 | + * |
|
| 135 | + * @since 3.3.0 |
|
| 136 | + * @access protected |
|
| 137 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 138 | + */ |
|
| 139 | + protected $schema_service; |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * The Entity service. |
|
| 143 | + * |
|
| 144 | + * @since 3.1.0 |
|
| 145 | + * @access protected |
|
| 146 | + * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 147 | + */ |
|
| 148 | + protected $entity_service; |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * The Topic Taxonomy service. |
|
| 152 | + * |
|
| 153 | + * @since 3.5.0 |
|
| 154 | + * @access private |
|
| 155 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 156 | + */ |
|
| 157 | + private $topic_taxonomy_service; |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * The Entity Types Taxonomy service. |
|
| 161 | + * |
|
| 162 | + * @since 3.18.0 |
|
| 163 | + * @access private |
|
| 164 | + * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 165 | + */ |
|
| 166 | + private $entity_types_taxonomy_service; |
|
| 167 | + |
|
| 168 | + /** |
|
| 169 | + * The User service. |
|
| 170 | + * |
|
| 171 | + * @since 3.1.7 |
|
| 172 | + * @access protected |
|
| 173 | + * @var \Wordlift_User_Service $user_service The User service. |
|
| 174 | + */ |
|
| 175 | + protected $user_service; |
|
| 176 | + |
|
| 177 | + /** |
|
| 178 | + * The Timeline service. |
|
| 179 | + * |
|
| 180 | + * @since 3.1.0 |
|
| 181 | + * @access private |
|
| 182 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 183 | + */ |
|
| 184 | + private $timeline_service; |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * The Redirect service. |
|
| 188 | + * |
|
| 189 | + * @since 3.2.0 |
|
| 190 | + * @access private |
|
| 191 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 192 | + */ |
|
| 193 | + private $redirect_service; |
|
| 194 | + |
|
| 195 | + /** |
|
| 196 | + * The Notice service. |
|
| 197 | + * |
|
| 198 | + * @since 3.3.0 |
|
| 199 | + * @access private |
|
| 200 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 201 | + */ |
|
| 202 | + private $notice_service; |
|
| 203 | + |
|
| 204 | + /** |
|
| 205 | + * The Entity list customization. |
|
| 206 | + * |
|
| 207 | + * @since 3.3.0 |
|
| 208 | + * @access protected |
|
| 209 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 210 | + */ |
|
| 211 | + protected $entity_list_service; |
|
| 212 | + |
|
| 213 | + /** |
|
| 214 | + * The Entity Types Taxonomy Walker. |
|
| 215 | + * |
|
| 216 | + * @since 3.1.0 |
|
| 217 | + * @access private |
|
| 218 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 219 | + */ |
|
| 220 | + private $entity_types_taxonomy_walker; |
|
| 221 | + |
|
| 222 | + /** |
|
| 223 | + * The ShareThis service. |
|
| 224 | + * |
|
| 225 | + * @since 3.2.0 |
|
| 226 | + * @access private |
|
| 227 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 228 | + */ |
|
| 229 | + private $sharethis_service; |
|
| 230 | + |
|
| 231 | + /** |
|
| 232 | + * The PrimaShop adapter. |
|
| 233 | + * |
|
| 234 | + * @since 3.2.3 |
|
| 235 | + * @access private |
|
| 236 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 237 | + */ |
|
| 238 | + private $primashop_adapter; |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * The WordLift Dashboard adapter. |
|
| 242 | + * |
|
| 243 | + * @since 3.4.0 |
|
| 244 | + * @access private |
|
| 245 | + * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 246 | + */ |
|
| 247 | + private $dashboard_service; |
|
| 248 | + |
|
| 249 | + /** |
|
| 250 | + * The entity type service. |
|
| 251 | + * |
|
| 252 | + * @since 3.6.0 |
|
| 253 | + * @access private |
|
| 254 | + * @var \Wordlift_Entity_Post_Type_Service |
|
| 255 | + */ |
|
| 256 | + private $entity_post_type_service; |
|
| 257 | + |
|
| 258 | + /** |
|
| 259 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 260 | + * |
|
| 261 | + * @since 3.6.0 |
|
| 262 | + * @access private |
|
| 263 | + * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 264 | + */ |
|
| 265 | + private $entity_link_service; |
|
| 266 | + |
|
| 267 | + /** |
|
| 268 | + * A {@link Wordlift_Sparql_Service} instance. |
|
| 269 | + * |
|
| 270 | + * @since 3.6.0 |
|
| 271 | + * @access protected |
|
| 272 | + * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 273 | + */ |
|
| 274 | + protected $sparql_service; |
|
| 275 | + |
|
| 276 | + /** |
|
| 277 | + * A {@link Wordlift_Import_Service} instance. |
|
| 278 | + * |
|
| 279 | + * @since 3.6.0 |
|
| 280 | + * @access private |
|
| 281 | + * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 282 | + */ |
|
| 283 | + private $import_service; |
|
| 284 | + |
|
| 285 | + /** |
|
| 286 | + * A {@link Wordlift_Rebuild_Service} instance. |
|
| 287 | + * |
|
| 288 | + * @since 3.6.0 |
|
| 289 | + * @access private |
|
| 290 | + * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 291 | + */ |
|
| 292 | + private $rebuild_service; |
|
| 293 | + |
|
| 294 | + /** |
|
| 295 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
| 296 | + * |
|
| 297 | + * @since 3.7.0 |
|
| 298 | + * @access protected |
|
| 299 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 300 | + */ |
|
| 301 | + protected $jsonld_service; |
|
| 302 | + |
|
| 303 | + /** |
|
| 304 | + * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 305 | + * |
|
| 306 | + * @since 3.14.0 |
|
| 307 | + * @access protected |
|
| 308 | + * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 309 | + */ |
|
| 310 | + protected $jsonld_website_converter; |
|
| 311 | + |
|
| 312 | + /** |
|
| 313 | + * A {@link Wordlift_Property_Factory} instance. |
|
| 314 | + * |
|
| 315 | + * @since 3.7.0 |
|
| 316 | + * @access private |
|
| 317 | + * @var \Wordlift_Property_Factory $property_factory |
|
| 318 | + */ |
|
| 319 | + private $property_factory; |
|
| 320 | + |
|
| 321 | + /** |
|
| 322 | + * The 'Download Your Data' page. |
|
| 323 | + * |
|
| 324 | + * @since 3.6.0 |
|
| 325 | + * @access private |
|
| 326 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 327 | + */ |
|
| 328 | + private $download_your_data_page; |
|
| 329 | + |
|
| 330 | + /** |
|
| 331 | + * The 'WordLift Settings' page. |
|
| 332 | + * |
|
| 333 | + * @since 3.11.0 |
|
| 334 | + * @access protected |
|
| 335 | + * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 336 | + */ |
|
| 337 | + protected $settings_page; |
|
| 338 | + |
|
| 339 | + /** |
|
| 340 | + * The install wizard page. |
|
| 341 | + * |
|
| 342 | + * @since 3.9.0 |
|
| 343 | + * @access private |
|
| 344 | + * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 345 | + */ |
|
| 346 | + public $admin_setup; |
|
| 347 | + |
|
| 348 | + /** |
|
| 349 | + * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 350 | + * linking of entities to their pages. |
|
| 351 | + * |
|
| 352 | + * @since 3.8.0 |
|
| 353 | + * @access private |
|
| 354 | + * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 355 | + */ |
|
| 356 | + private $content_filter_service; |
|
| 357 | + |
|
| 358 | + /** |
|
| 359 | + * The Faq Content filter service |
|
| 360 | + * @since 3.26.0 |
|
| 361 | + * @access private |
|
| 362 | + * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
| 363 | + */ |
|
| 364 | + private $faq_content_filter_service; |
|
| 365 | + |
|
| 366 | + /** |
|
| 367 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 368 | + * |
|
| 369 | + * @since 3.9.0 |
|
| 370 | + * @access private |
|
| 371 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 372 | + */ |
|
| 373 | + private $key_validation_service; |
|
| 374 | + |
|
| 375 | + /** |
|
| 376 | + * A {@link Wordlift_Rating_Service} instance. |
|
| 377 | + * |
|
| 378 | + * @since 3.10.0 |
|
| 379 | + * @access private |
|
| 380 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 381 | + */ |
|
| 382 | + private $rating_service; |
|
| 383 | + |
|
| 384 | + /** |
|
| 385 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 386 | + * |
|
| 387 | + * @since 3.10.0 |
|
| 388 | + * @access protected |
|
| 389 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 390 | + */ |
|
| 391 | + protected $post_to_jsonld_converter; |
|
| 392 | + |
|
| 393 | + /** |
|
| 394 | + * A {@link Wordlift_Configuration_Service} instance. |
|
| 395 | + * |
|
| 396 | + * @since 3.10.0 |
|
| 397 | + * @access protected |
|
| 398 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 399 | + */ |
|
| 400 | + protected $configuration_service; |
|
| 401 | + |
|
| 402 | + /** |
|
| 403 | + * A {@link Wordlift_Install_Service} instance. |
|
| 404 | + * |
|
| 405 | + * @since 3.18.0 |
|
| 406 | + * @access protected |
|
| 407 | + * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 408 | + */ |
|
| 409 | + protected $install_service; |
|
| 410 | + |
|
| 411 | + /** |
|
| 412 | + * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 413 | + * |
|
| 414 | + * @since 3.10.0 |
|
| 415 | + * @access protected |
|
| 416 | + * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 417 | + */ |
|
| 418 | + protected $entity_type_service; |
|
| 419 | + |
|
| 420 | + /** |
|
| 421 | + * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 422 | + * |
|
| 423 | + * @since 3.10.0 |
|
| 424 | + * @access protected |
|
| 425 | + * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 426 | + */ |
|
| 427 | + protected $entity_post_to_jsonld_converter; |
|
| 428 | + |
|
| 429 | + /** |
|
| 430 | + * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 431 | + * |
|
| 432 | + * @since 3.10.0 |
|
| 433 | + * @access protected |
|
| 434 | + * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 435 | + */ |
|
| 436 | + protected $postid_to_jsonld_converter; |
|
| 437 | + |
|
| 438 | + /** |
|
| 439 | + * The {@link Wordlift_Admin_Status_Page} class. |
|
| 440 | + * |
|
| 441 | + * @since 3.9.8 |
|
| 442 | + * @access private |
|
| 443 | + * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 444 | + */ |
|
| 445 | + private $status_page; |
|
| 446 | + |
|
| 447 | + /** |
|
| 448 | + * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 449 | + * |
|
| 450 | + * @since 3.11.0 |
|
| 451 | + * @access protected |
|
| 452 | + * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 453 | + */ |
|
| 454 | + protected $category_taxonomy_service; |
|
| 455 | + |
|
| 456 | + /** |
|
| 457 | + * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 458 | + * |
|
| 459 | + * @since 3.11.0 |
|
| 460 | + * @access protected |
|
| 461 | + * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 462 | + */ |
|
| 463 | + protected $entity_page_service; |
|
| 464 | + |
|
| 465 | + /** |
|
| 466 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 467 | + * |
|
| 468 | + * @since 3.11.0 |
|
| 469 | + * @access protected |
|
| 470 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 471 | + */ |
|
| 472 | + protected $settings_page_action_link; |
|
| 473 | + |
|
| 474 | + /** |
|
| 475 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 476 | + * |
|
| 477 | + * @since 3.11.0 |
|
| 478 | + * @access protected |
|
| 479 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 480 | + */ |
|
| 481 | + protected $analytics_settings_page_action_link; |
|
| 482 | + |
|
| 483 | + /** |
|
| 484 | + * The {@link Wordlift_Analytics_Connect} class. |
|
| 485 | + * |
|
| 486 | + * @since 3.11.0 |
|
| 487 | + * @access protected |
|
| 488 | + * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 489 | + */ |
|
| 490 | + protected $analytics_connect; |
|
| 491 | + |
|
| 492 | + /** |
|
| 493 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 494 | + * |
|
| 495 | + * @since 3.11.0 |
|
| 496 | + * @access protected |
|
| 497 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 498 | + */ |
|
| 499 | + protected $publisher_ajax_adapter; |
|
| 500 | + |
|
| 501 | + /** |
|
| 502 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 503 | + * |
|
| 504 | + * @since 3.11.0 |
|
| 505 | + * @access protected |
|
| 506 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 507 | + */ |
|
| 508 | + protected $input_element; |
|
| 509 | + |
|
| 510 | + /** |
|
| 511 | + * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 512 | + * |
|
| 513 | + * @since 3.13.0 |
|
| 514 | + * @access protected |
|
| 515 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 516 | + */ |
|
| 517 | + protected $radio_input_element; |
|
| 518 | + |
|
| 519 | + /** |
|
| 520 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 521 | + * |
|
| 522 | + * @since 3.11.0 |
|
| 523 | + * @access protected |
|
| 524 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 525 | + */ |
|
| 526 | + protected $language_select_element; |
|
| 527 | + |
|
| 528 | + /** |
|
| 529 | + * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 530 | + * |
|
| 531 | + * @since 3.18.0 |
|
| 532 | + * @access protected |
|
| 533 | + * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 534 | + */ |
|
| 535 | + protected $country_select_element; |
|
| 536 | + |
|
| 537 | + /** |
|
| 538 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 539 | + * |
|
| 540 | + * @since 3.11.0 |
|
| 541 | + * @access protected |
|
| 542 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 543 | + */ |
|
| 544 | + protected $publisher_element; |
|
| 545 | + |
|
| 546 | + /** |
|
| 547 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 548 | + * |
|
| 549 | + * @since 3.11.0 |
|
| 550 | + * @access protected |
|
| 551 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 552 | + */ |
|
| 553 | + protected $select2_element; |
|
| 554 | + |
|
| 555 | + /** |
|
| 556 | + * The controller for the entity type list admin page |
|
| 557 | + * |
|
| 558 | + * @since 3.11.0 |
|
| 559 | + * @access private |
|
| 560 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 561 | + */ |
|
| 562 | + private $entity_type_admin_page; |
|
| 563 | + |
|
| 564 | + /** |
|
| 565 | + * The controller for the entity type settings admin page |
|
| 566 | + * |
|
| 567 | + * @since 3.11.0 |
|
| 568 | + * @access private |
|
| 569 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 570 | + */ |
|
| 571 | + private $entity_type_settings_admin_page; |
|
| 572 | + |
|
| 573 | + /** |
|
| 574 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 575 | + * |
|
| 576 | + * @since 3.11.0 |
|
| 577 | + * @access protected |
|
| 578 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 579 | + */ |
|
| 580 | + protected $related_entities_cloud_widget; |
|
| 581 | + |
|
| 582 | + /** |
|
| 583 | + * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 584 | + * |
|
| 585 | + * @since 3.14.0 |
|
| 586 | + * @access protected |
|
| 587 | + * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 588 | + */ |
|
| 589 | + protected $author_element; |
|
| 590 | + |
|
| 591 | + /** |
|
| 592 | + * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 593 | + * |
|
| 594 | + * @since 3.12.0 |
|
| 595 | + * @access protected |
|
| 596 | + * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 597 | + */ |
|
| 598 | + protected $sample_data_service; |
|
| 599 | + |
|
| 600 | + /** |
|
| 601 | + * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 602 | + * |
|
| 603 | + * @since 3.12.0 |
|
| 604 | + * @access protected |
|
| 605 | + * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 606 | + */ |
|
| 607 | + protected $sample_data_ajax_adapter; |
|
| 608 | + |
|
| 609 | + /** |
|
| 610 | + * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 611 | + * |
|
| 612 | + * @since 3.14.3 |
|
| 613 | + * @access private |
|
| 614 | + * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 615 | + */ |
|
| 616 | + private $relation_rebuild_service; |
|
| 617 | + |
|
| 618 | + /** |
|
| 619 | + * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 620 | + * |
|
| 621 | + * @since 3.14.3 |
|
| 622 | + * @access private |
|
| 623 | + * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 624 | + */ |
|
| 625 | + private $relation_rebuild_adapter; |
|
| 626 | + |
|
| 627 | + /** |
|
| 628 | + * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 629 | + * |
|
| 630 | + * @since 3.18.0 |
|
| 631 | + * @access private |
|
| 632 | + * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 633 | + */ |
|
| 634 | + private $reference_rebuild_service; |
|
| 635 | + |
|
| 636 | + /** |
|
| 637 | + * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 638 | + * |
|
| 639 | + * @since 3.16.0 |
|
| 640 | + * @access protected |
|
| 641 | + * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 642 | + */ |
|
| 643 | + protected $google_analytics_export_service; |
|
| 644 | + |
|
| 645 | + /** |
|
| 646 | + * {@link Wordlift}'s singleton instance. |
|
| 647 | + * |
|
| 648 | + * @since 3.15.0 |
|
| 649 | + * @access protected |
|
| 650 | + * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 651 | + */ |
|
| 652 | + protected $entity_type_adapter; |
|
| 653 | + |
|
| 654 | + /** |
|
| 655 | + * The {@link Wordlift_Storage_Factory} instance. |
|
| 656 | + * |
|
| 657 | + * @since 3.15.0 |
|
| 658 | + * @access protected |
|
| 659 | + * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 660 | + */ |
|
| 661 | + protected $storage_factory; |
|
| 662 | + |
|
| 663 | + /** |
|
| 664 | + * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 665 | + * |
|
| 666 | + * @since 3.15.0 |
|
| 667 | + * @access protected |
|
| 668 | + * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 669 | + */ |
|
| 670 | + protected $rendition_factory; |
|
| 671 | + |
|
| 672 | + /** |
|
| 673 | + * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 674 | + * |
|
| 675 | + * @since 3.15.0 |
|
| 676 | + * @access private |
|
| 677 | + * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 678 | + */ |
|
| 679 | + private $autocomplete_adapter; |
|
| 680 | + |
|
| 681 | + /** |
|
| 682 | + * The {@link Wordlift_Relation_Service} instance. |
|
| 683 | + * |
|
| 684 | + * @since 3.15.0 |
|
| 685 | + * @access protected |
|
| 686 | + * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 687 | + */ |
|
| 688 | + protected $relation_service; |
|
| 689 | + |
|
| 690 | + /** |
|
| 691 | + * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 692 | + * |
|
| 693 | + * @since 3.16.0 |
|
| 694 | + * @access protected |
|
| 695 | + * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 696 | + * |
|
| 697 | + */ |
|
| 698 | + protected $cached_postid_to_jsonld_converter; |
|
| 699 | + |
|
| 700 | + /** |
|
| 701 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 702 | + * |
|
| 703 | + * @since 3.16.3 |
|
| 704 | + * @access protected |
|
| 705 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 706 | + */ |
|
| 707 | + protected $entity_uri_service; |
|
| 708 | + |
|
| 709 | + /** |
|
| 710 | + * The {@link Wordlift_Publisher_Service} instance. |
|
| 711 | + * |
|
| 712 | + * @since 3.19.0 |
|
| 713 | + * @access protected |
|
| 714 | + * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 715 | + */ |
|
| 716 | + protected $publisher_service; |
|
| 717 | + |
|
| 718 | + /** |
|
| 719 | + * The {@link Wordlift_Context_Cards_Service} instance. |
|
| 720 | + * |
|
| 721 | + * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
| 722 | + */ |
|
| 723 | + protected $context_cards_service; |
|
| 724 | + |
|
| 725 | + /** |
|
| 726 | + * {@link Wordlift}'s singleton instance. |
|
| 727 | + * |
|
| 728 | + * @since 3.11.2 |
|
| 729 | + * @access private |
|
| 730 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 731 | + */ |
|
| 732 | + private static $instance; |
|
| 733 | + |
|
| 734 | + //</editor-fold> |
|
| 735 | + |
|
| 736 | + /** |
|
| 737 | + * Define the core functionality of the plugin. |
|
| 738 | + * |
|
| 739 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 740 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 741 | + * the public-facing side of the site. |
|
| 742 | + * |
|
| 743 | + * @since 1.0.0 |
|
| 744 | + */ |
|
| 745 | + public function __construct() { |
|
| 746 | + |
|
| 747 | + self::$instance = $this; |
|
| 748 | + |
|
| 749 | + $this->plugin_name = 'wordlift'; |
|
| 750 | + $this->version = '3.27.6'; |
|
| 751 | + $this->load_dependencies(); |
|
| 752 | + $this->set_locale(); |
|
| 753 | + $this->define_admin_hooks(); |
|
| 754 | + $this->define_public_hooks(); |
|
| 755 | + |
|
| 756 | + // If we're in `WP_CLI` load the related files. |
|
| 757 | + if ( class_exists( 'WP_CLI' ) ) { |
|
| 758 | + $this->load_cli_dependencies(); |
|
| 759 | + } |
|
| 760 | + |
|
| 761 | + } |
|
| 762 | + |
|
| 763 | + /** |
|
| 764 | + * Get the singleton instance. |
|
| 765 | + * |
|
| 766 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 767 | + * @since 3.11.2 |
|
| 768 | + * |
|
| 769 | + */ |
|
| 770 | + public static function get_instance() { |
|
| 771 | + |
|
| 772 | + return self::$instance; |
|
| 773 | + } |
|
| 774 | + |
|
| 775 | + /** |
|
| 776 | + * Load the required dependencies for this plugin. |
|
| 777 | + * |
|
| 778 | + * Include the following files that make up the plugin: |
|
| 779 | + * |
|
| 780 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 781 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 782 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 783 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 784 | + * |
|
| 785 | + * Create an instance of the loader which will be used to register the hooks |
|
| 786 | + * with WordPress. |
|
| 787 | + * |
|
| 788 | + * @throws Exception |
|
| 789 | + * @since 1.0.0 |
|
| 790 | + * @access private |
|
| 791 | + */ |
|
| 792 | + private function load_dependencies() { |
|
| 793 | + |
|
| 794 | + /** |
|
| 795 | + * The class responsible for orchestrating the actions and filters of the |
|
| 796 | + * core plugin. |
|
| 797 | + */ |
|
| 798 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 799 | + |
|
| 800 | + // The class responsible for plugin uninstall. |
|
| 801 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 802 | + |
|
| 803 | + /** |
|
| 804 | + * The class responsible for defining internationalization functionality |
|
| 805 | + * of the plugin. |
|
| 806 | + */ |
|
| 807 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 808 | + |
|
| 809 | + /** |
|
| 810 | + * WordLift's supported languages. |
|
| 811 | + */ |
|
| 812 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 813 | + |
|
| 814 | + /** |
|
| 815 | + * WordLift's supported countries. |
|
| 816 | + */ |
|
| 817 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 818 | + |
|
| 819 | + /** |
|
| 820 | + * Provide support functions to sanitize data. |
|
| 821 | + */ |
|
| 822 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 823 | + |
|
| 824 | + /** Services. */ |
|
| 825 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 826 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 827 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 828 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 829 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 830 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 831 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 832 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 833 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 834 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 835 | + |
|
| 836 | + /** |
|
| 837 | + * The Query builder. |
|
| 838 | + */ |
|
| 839 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 840 | + |
|
| 841 | + /** |
|
| 842 | + * The Schema service. |
|
| 843 | + */ |
|
| 844 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 845 | + |
|
| 846 | + /** |
|
| 847 | + * The schema:url property service. |
|
| 848 | + */ |
|
| 849 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 850 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 851 | + |
|
| 852 | + /** |
|
| 853 | + * The UI service. |
|
| 854 | + */ |
|
| 855 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 856 | + |
|
| 857 | + /** |
|
| 858 | + * The Thumbnail service. |
|
| 859 | + */ |
|
| 860 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 861 | + |
|
| 862 | + /** |
|
| 863 | + * The Entity Types Taxonomy service. |
|
| 864 | + */ |
|
| 865 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 866 | + |
|
| 867 | + /** |
|
| 868 | + * The Entity service. |
|
| 869 | + */ |
|
| 870 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 871 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 872 | + |
|
| 873 | + // Add the entity rating service. |
|
| 874 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 875 | + |
|
| 876 | + /** |
|
| 877 | + * The User service. |
|
| 878 | + */ |
|
| 879 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 880 | + |
|
| 881 | + /** |
|
| 882 | + * The Timeline service. |
|
| 883 | + */ |
|
| 884 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 885 | + |
|
| 886 | + /** |
|
| 887 | + * The Topic Taxonomy service. |
|
| 888 | + */ |
|
| 889 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 890 | + |
|
| 891 | + /** |
|
| 892 | + * The SPARQL service. |
|
| 893 | + */ |
|
| 894 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 895 | + |
|
| 896 | + /** |
|
| 897 | + * The WordLift import service. |
|
| 898 | + */ |
|
| 899 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 900 | + |
|
| 901 | + /** |
|
| 902 | + * The WordLift URI service. |
|
| 903 | + */ |
|
| 904 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 905 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 906 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 907 | + |
|
| 908 | + /** |
|
| 909 | + * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 910 | + */ |
|
| 911 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 912 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 913 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 914 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 915 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 916 | + |
|
| 917 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 918 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 919 | + |
|
| 920 | + /** |
|
| 921 | + * Load the converters. |
|
| 922 | + */ |
|
| 923 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 924 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 925 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 926 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 927 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 928 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 929 | + |
|
| 930 | + /** |
|
| 931 | + * Load cache-related files. |
|
| 932 | + */ |
|
| 933 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 934 | + |
|
| 935 | + /** |
|
| 936 | + * Load the content filter. |
|
| 937 | + */ |
|
| 938 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 939 | + |
|
| 940 | + /* |
|
| 941 | 941 | * Load the excerpt helper. |
| 942 | 942 | */ |
| 943 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 944 | - |
|
| 945 | - /** |
|
| 946 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 947 | - * |
|
| 948 | - * @since 3.8.0 |
|
| 949 | - */ |
|
| 950 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 951 | - |
|
| 952 | - // The Publisher Service and the AJAX adapter. |
|
| 953 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 954 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 955 | - |
|
| 956 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 957 | - |
|
| 958 | - /** |
|
| 959 | - * Load the WordLift key validation service. |
|
| 960 | - */ |
|
| 961 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 962 | - |
|
| 963 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 964 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 965 | - |
|
| 966 | - // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 967 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 968 | - |
|
| 969 | - /** Linked Data. */ |
|
| 970 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 971 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 972 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 973 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 974 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 975 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 976 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 977 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 978 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 979 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 980 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 981 | - |
|
| 982 | - /** Linked Data Rendition. */ |
|
| 983 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 984 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 986 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 987 | - |
|
| 988 | - /** Services. */ |
|
| 989 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 990 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 991 | - |
|
| 992 | - /** Adapters. */ |
|
| 993 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 994 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 996 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 997 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 998 | - |
|
| 999 | - /** Async Tasks. */ |
|
| 1000 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 1001 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1002 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1003 | - |
|
| 1004 | - /** Autocomplete. */ |
|
| 1005 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1006 | - |
|
| 1007 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1008 | - |
|
| 1009 | - /** Analytics */ |
|
| 1010 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1011 | - |
|
| 1012 | - /** |
|
| 1013 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 1014 | - */ |
|
| 1015 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1016 | - |
|
| 1017 | - /** |
|
| 1018 | - * The class to customize the entity list admin page. |
|
| 1019 | - */ |
|
| 1020 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1021 | - |
|
| 1022 | - /** |
|
| 1023 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1024 | - */ |
|
| 1025 | - global $wp_version; |
|
| 1026 | - if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 1027 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1028 | - } else { |
|
| 1029 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1030 | - } |
|
| 1031 | - |
|
| 1032 | - /** |
|
| 1033 | - * The Notice service. |
|
| 1034 | - */ |
|
| 1035 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1036 | - |
|
| 1037 | - /** |
|
| 1038 | - * The PrimaShop adapter. |
|
| 1039 | - */ |
|
| 1040 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1041 | - |
|
| 1042 | - /** |
|
| 1043 | - * The WordLift Dashboard service. |
|
| 1044 | - */ |
|
| 1045 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1046 | - |
|
| 1047 | - /** |
|
| 1048 | - * The admin 'Install wizard' page. |
|
| 1049 | - */ |
|
| 1050 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1051 | - |
|
| 1052 | - /** |
|
| 1053 | - * The WordLift entity type list admin page controller. |
|
| 1054 | - */ |
|
| 1055 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1056 | - |
|
| 1057 | - /** |
|
| 1058 | - * The WordLift entity type settings admin page controller. |
|
| 1059 | - */ |
|
| 1060 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1061 | - |
|
| 1062 | - /** |
|
| 1063 | - * The admin 'Download Your Data' page. |
|
| 1064 | - */ |
|
| 1065 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1066 | - |
|
| 1067 | - /** |
|
| 1068 | - * The admin 'WordLift Settings' page. |
|
| 1069 | - */ |
|
| 1070 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1071 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1072 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1073 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1074 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1075 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1077 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1078 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1079 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1080 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1081 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1082 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1083 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1084 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1085 | - |
|
| 1086 | - /** Admin Pages */ |
|
| 1087 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1088 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1089 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1090 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1091 | - |
|
| 1092 | - /** |
|
| 1093 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 1094 | - * side of the site. |
|
| 1095 | - */ |
|
| 1096 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1097 | - |
|
| 1098 | - /** |
|
| 1099 | - * The shortcode abstract class. |
|
| 1100 | - */ |
|
| 1101 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1102 | - |
|
| 1103 | - /** |
|
| 1104 | - * The Timeline shortcode. |
|
| 1105 | - */ |
|
| 1106 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1107 | - |
|
| 1108 | - /** |
|
| 1109 | - * The Navigator shortcode. |
|
| 1110 | - */ |
|
| 1111 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1112 | - |
|
| 1113 | - /** |
|
| 1114 | - * The Products Navigator shortcode. |
|
| 1115 | - */ |
|
| 1116 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 1117 | - |
|
| 1118 | - /** |
|
| 1119 | - * The chord shortcode. |
|
| 1120 | - */ |
|
| 1121 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1122 | - |
|
| 1123 | - /** |
|
| 1124 | - * The geomap shortcode. |
|
| 1125 | - */ |
|
| 1126 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1127 | - |
|
| 1128 | - /** |
|
| 1129 | - * The entity cloud shortcode. |
|
| 1130 | - */ |
|
| 1131 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1132 | - |
|
| 1133 | - /** |
|
| 1134 | - * The entity glossary shortcode. |
|
| 1135 | - */ |
|
| 1136 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1137 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1138 | - |
|
| 1139 | - /** |
|
| 1140 | - * Faceted Search shortcode. |
|
| 1141 | - */ |
|
| 1142 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1143 | - |
|
| 1144 | - /** |
|
| 1145 | - * The ShareThis service. |
|
| 1146 | - */ |
|
| 1147 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1148 | - |
|
| 1149 | - /** |
|
| 1150 | - * The SEO service. |
|
| 1151 | - */ |
|
| 1152 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1153 | - |
|
| 1154 | - /** |
|
| 1155 | - * The AMP service. |
|
| 1156 | - */ |
|
| 1157 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1158 | - |
|
| 1159 | - /** Widgets */ |
|
| 1160 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1161 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1162 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1163 | - |
|
| 1164 | - /* |
|
| 943 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 944 | + |
|
| 945 | + /** |
|
| 946 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 947 | + * |
|
| 948 | + * @since 3.8.0 |
|
| 949 | + */ |
|
| 950 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 951 | + |
|
| 952 | + // The Publisher Service and the AJAX adapter. |
|
| 953 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 954 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 955 | + |
|
| 956 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 957 | + |
|
| 958 | + /** |
|
| 959 | + * Load the WordLift key validation service. |
|
| 960 | + */ |
|
| 961 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 962 | + |
|
| 963 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 964 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 965 | + |
|
| 966 | + // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 967 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 968 | + |
|
| 969 | + /** Linked Data. */ |
|
| 970 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 971 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 972 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 973 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 974 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 975 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 976 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 977 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 978 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 979 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 980 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 981 | + |
|
| 982 | + /** Linked Data Rendition. */ |
|
| 983 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 984 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 985 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 986 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 987 | + |
|
| 988 | + /** Services. */ |
|
| 989 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 990 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 991 | + |
|
| 992 | + /** Adapters. */ |
|
| 993 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 994 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 995 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 996 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 997 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 998 | + |
|
| 999 | + /** Async Tasks. */ |
|
| 1000 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 1001 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1002 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1003 | + |
|
| 1004 | + /** Autocomplete. */ |
|
| 1005 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1006 | + |
|
| 1007 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1008 | + |
|
| 1009 | + /** Analytics */ |
|
| 1010 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1011 | + |
|
| 1012 | + /** |
|
| 1013 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 1014 | + */ |
|
| 1015 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1016 | + |
|
| 1017 | + /** |
|
| 1018 | + * The class to customize the entity list admin page. |
|
| 1019 | + */ |
|
| 1020 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1021 | + |
|
| 1022 | + /** |
|
| 1023 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1024 | + */ |
|
| 1025 | + global $wp_version; |
|
| 1026 | + if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 1027 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1028 | + } else { |
|
| 1029 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1030 | + } |
|
| 1031 | + |
|
| 1032 | + /** |
|
| 1033 | + * The Notice service. |
|
| 1034 | + */ |
|
| 1035 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1036 | + |
|
| 1037 | + /** |
|
| 1038 | + * The PrimaShop adapter. |
|
| 1039 | + */ |
|
| 1040 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1041 | + |
|
| 1042 | + /** |
|
| 1043 | + * The WordLift Dashboard service. |
|
| 1044 | + */ |
|
| 1045 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1046 | + |
|
| 1047 | + /** |
|
| 1048 | + * The admin 'Install wizard' page. |
|
| 1049 | + */ |
|
| 1050 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1051 | + |
|
| 1052 | + /** |
|
| 1053 | + * The WordLift entity type list admin page controller. |
|
| 1054 | + */ |
|
| 1055 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1056 | + |
|
| 1057 | + /** |
|
| 1058 | + * The WordLift entity type settings admin page controller. |
|
| 1059 | + */ |
|
| 1060 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1061 | + |
|
| 1062 | + /** |
|
| 1063 | + * The admin 'Download Your Data' page. |
|
| 1064 | + */ |
|
| 1065 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1066 | + |
|
| 1067 | + /** |
|
| 1068 | + * The admin 'WordLift Settings' page. |
|
| 1069 | + */ |
|
| 1070 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1071 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1072 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1073 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1074 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1075 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1076 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1077 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1078 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1079 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1080 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1081 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1082 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1083 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1084 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1085 | + |
|
| 1086 | + /** Admin Pages */ |
|
| 1087 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1088 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1089 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1090 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1091 | + |
|
| 1092 | + /** |
|
| 1093 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 1094 | + * side of the site. |
|
| 1095 | + */ |
|
| 1096 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1097 | + |
|
| 1098 | + /** |
|
| 1099 | + * The shortcode abstract class. |
|
| 1100 | + */ |
|
| 1101 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1102 | + |
|
| 1103 | + /** |
|
| 1104 | + * The Timeline shortcode. |
|
| 1105 | + */ |
|
| 1106 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1107 | + |
|
| 1108 | + /** |
|
| 1109 | + * The Navigator shortcode. |
|
| 1110 | + */ |
|
| 1111 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1112 | + |
|
| 1113 | + /** |
|
| 1114 | + * The Products Navigator shortcode. |
|
| 1115 | + */ |
|
| 1116 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 1117 | + |
|
| 1118 | + /** |
|
| 1119 | + * The chord shortcode. |
|
| 1120 | + */ |
|
| 1121 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1122 | + |
|
| 1123 | + /** |
|
| 1124 | + * The geomap shortcode. |
|
| 1125 | + */ |
|
| 1126 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1127 | + |
|
| 1128 | + /** |
|
| 1129 | + * The entity cloud shortcode. |
|
| 1130 | + */ |
|
| 1131 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1132 | + |
|
| 1133 | + /** |
|
| 1134 | + * The entity glossary shortcode. |
|
| 1135 | + */ |
|
| 1136 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1137 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1138 | + |
|
| 1139 | + /** |
|
| 1140 | + * Faceted Search shortcode. |
|
| 1141 | + */ |
|
| 1142 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1143 | + |
|
| 1144 | + /** |
|
| 1145 | + * The ShareThis service. |
|
| 1146 | + */ |
|
| 1147 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1148 | + |
|
| 1149 | + /** |
|
| 1150 | + * The SEO service. |
|
| 1151 | + */ |
|
| 1152 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1153 | + |
|
| 1154 | + /** |
|
| 1155 | + * The AMP service. |
|
| 1156 | + */ |
|
| 1157 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1158 | + |
|
| 1159 | + /** Widgets */ |
|
| 1160 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1161 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1162 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1163 | + |
|
| 1164 | + /* |
|
| 1165 | 1165 | * Schema.org Services. |
| 1166 | 1166 | * |
| 1167 | 1167 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1168 | 1168 | */ |
| 1169 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1170 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1171 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1172 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1173 | - new Wordlift_Schemaorg_Sync_Service(); |
|
| 1174 | - $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1175 | - new Wordlift_Schemaorg_Class_Service(); |
|
| 1176 | - } else { |
|
| 1177 | - $schemaorg_property_service = null; |
|
| 1178 | - } |
|
| 1169 | + if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1170 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1171 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1172 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1173 | + new Wordlift_Schemaorg_Sync_Service(); |
|
| 1174 | + $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1175 | + new Wordlift_Schemaorg_Class_Service(); |
|
| 1176 | + } else { |
|
| 1177 | + $schemaorg_property_service = null; |
|
| 1178 | + } |
|
| 1179 | 1179 | |
| 1180 | - $this->loader = new Wordlift_Loader(); |
|
| 1180 | + $this->loader = new Wordlift_Loader(); |
|
| 1181 | 1181 | |
| 1182 | - // Instantiate a global logger. |
|
| 1183 | - global $wl_logger; |
|
| 1184 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1182 | + // Instantiate a global logger. |
|
| 1183 | + global $wl_logger; |
|
| 1184 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1185 | 1185 | |
| 1186 | - // Load the `wl-api` end-point. |
|
| 1187 | - new Wordlift_Http_Api(); |
|
| 1186 | + // Load the `wl-api` end-point. |
|
| 1187 | + new Wordlift_Http_Api(); |
|
| 1188 | 1188 | |
| 1189 | - // Load the Install Service. |
|
| 1190 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1191 | - $this->install_service = new Wordlift_Install_Service(); |
|
| 1189 | + // Load the Install Service. |
|
| 1190 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1191 | + $this->install_service = new Wordlift_Install_Service(); |
|
| 1192 | 1192 | |
| 1193 | - /** Services. */ |
|
| 1194 | - // Create the configuration service. |
|
| 1195 | - $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1196 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1193 | + /** Services. */ |
|
| 1194 | + // Create the configuration service. |
|
| 1195 | + $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1196 | + $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1197 | 1197 | |
| 1198 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1199 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1198 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1199 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1200 | 1200 | |
| 1201 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1202 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1201 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1202 | + $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1203 | 1203 | |
| 1204 | - // Create an instance of the UI service. |
|
| 1205 | - $this->ui_service = new Wordlift_UI_Service(); |
|
| 1204 | + // Create an instance of the UI service. |
|
| 1205 | + $this->ui_service = new Wordlift_UI_Service(); |
|
| 1206 | 1206 | |
| 1207 | - // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1208 | - $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1207 | + // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1208 | + $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1209 | 1209 | |
| 1210 | - $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1211 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1212 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1213 | - $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1210 | + $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1211 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1212 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1213 | + $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1214 | 1214 | |
| 1215 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1216 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1217 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1218 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1215 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1216 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1217 | + $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1218 | + $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1219 | 1219 | |
| 1220 | - // Instantiate the JSON-LD service. |
|
| 1221 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1220 | + // Instantiate the JSON-LD service. |
|
| 1221 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1222 | 1222 | |
| 1223 | - /** Linked Data. */ |
|
| 1224 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1225 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1223 | + /** Linked Data. */ |
|
| 1224 | + $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1225 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1226 | 1226 | |
| 1227 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1227 | + $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1228 | 1228 | |
| 1229 | - // Create a new instance of the Redirect service. |
|
| 1230 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1231 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1229 | + // Create a new instance of the Redirect service. |
|
| 1230 | + $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1231 | + $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1232 | 1232 | |
| 1233 | - if ( ! apply_filters( 'wl_features__enable__legacy_linked_data', true ) ) { |
|
| 1234 | - new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1235 | - } |
|
| 1233 | + if ( ! apply_filters( 'wl_features__enable__legacy_linked_data', true ) ) { |
|
| 1234 | + new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1235 | + } |
|
| 1236 | 1236 | |
| 1237 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1238 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1237 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1238 | + $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1239 | 1239 | |
| 1240 | - $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1240 | + $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1241 | 1241 | |
| 1242 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1243 | - $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1242 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1243 | + $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1244 | 1244 | |
| 1245 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1246 | - $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1245 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1246 | + $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1247 | 1247 | |
| 1248 | - // Create an instance of the PrimaShop adapter. |
|
| 1249 | - $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1248 | + // Create an instance of the PrimaShop adapter. |
|
| 1249 | + $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1250 | 1250 | |
| 1251 | - // Create an import service instance to hook later to WP's import function. |
|
| 1252 | - $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() ); |
|
| 1251 | + // Create an import service instance to hook later to WP's import function. |
|
| 1252 | + $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 | 1253 | |
| 1254 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1254 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1255 | 1255 | |
| 1256 | - // Create the entity rating service. |
|
| 1257 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1256 | + // Create the entity rating service. |
|
| 1257 | + $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1258 | 1258 | |
| 1259 | - // Create entity list customization (wp-admin/edit.php). |
|
| 1260 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1259 | + // Create entity list customization (wp-admin/edit.php). |
|
| 1260 | + $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1261 | 1261 | |
| 1262 | - // Create a new instance of the Redirect service. |
|
| 1263 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1262 | + // Create a new instance of the Redirect service. |
|
| 1263 | + $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1264 | 1264 | |
| 1265 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1266 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1267 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1268 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1265 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1266 | + $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1267 | + $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1268 | + $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1269 | 1269 | |
| 1270 | - $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1270 | + $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1271 | 1271 | |
| 1272 | - // Instantiate the JSON-LD service. |
|
| 1273 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1274 | - $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 ); |
|
| 1275 | - $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 ); |
|
| 1276 | - $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 ); |
|
| 1277 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1272 | + // Instantiate the JSON-LD service. |
|
| 1273 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1274 | + $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 ); |
|
| 1275 | + $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 ); |
|
| 1276 | + $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 ); |
|
| 1277 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1278 | 1278 | |
| 1279 | - $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1280 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache ); |
|
| 1281 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1279 | + $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1280 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache ); |
|
| 1281 | + $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1282 | 1282 | |
| 1283 | - /* |
|
| 1283 | + /* |
|
| 1284 | 1284 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
| 1285 | 1285 | * |
| 1286 | 1286 | * @see https://github.com/insideout10/wordlift-plugin/issues/892 |
| 1287 | 1287 | * |
| 1288 | 1288 | * @since 3.20.0 |
| 1289 | 1289 | */ |
| 1290 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1291 | - $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1292 | - $jsonld_service = new Jsonld_Service( $this->jsonld_service, $term_jsonld_adapter ); |
|
| 1293 | - new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service ); |
|
| 1294 | - |
|
| 1295 | - // Prints the JSON-LD in the head. |
|
| 1296 | - new Jsonld_Adapter( $this->jsonld_service ); |
|
| 1297 | - |
|
| 1298 | - new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service ); |
|
| 1299 | - |
|
| 1300 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1301 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1302 | - // Creating Faq Content filter service. |
|
| 1303 | - $this->faq_content_filter_service = new Faq_Content_Filter(); |
|
| 1304 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1305 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1306 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1307 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->entity_service ); |
|
| 1308 | - |
|
| 1309 | - /** |
|
| 1310 | - * Filter: wl_feature__enable__blocks. |
|
| 1311 | - * |
|
| 1312 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1313 | - * |
|
| 1314 | - * @return bool |
|
| 1315 | - * @since 3.27.6 |
|
| 1316 | - */ |
|
| 1317 | - $enabled_blocks = array( 'wordlift/products-navigator' ); |
|
| 1318 | - |
|
| 1319 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1320 | - // Initialize the short-codes. |
|
| 1321 | - new Wordlift_Navigator_Shortcode(); |
|
| 1322 | - new Wordlift_Chord_Shortcode(); |
|
| 1323 | - new Wordlift_Geomap_Shortcode(); |
|
| 1324 | - new Wordlift_Timeline_Shortcode(); |
|
| 1325 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1326 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1327 | - new Wordlift_Faceted_Search_Shortcode(); |
|
| 1328 | - |
|
| 1329 | - // To intimate JS |
|
| 1330 | - $enabled_blocks = $enabled_blocks + array( |
|
| 1331 | - 'wordlift/navigator', |
|
| 1332 | - 'wordlift/chord', |
|
| 1333 | - 'wordlift/geomap', |
|
| 1334 | - 'wordlift/timeline', |
|
| 1335 | - 'wordlift/cloud', |
|
| 1336 | - 'wordlift/vocabulary', |
|
| 1337 | - 'wordlift/faceted-search' |
|
| 1338 | - ); |
|
| 1339 | - } |
|
| 1340 | - |
|
| 1341 | - new Wordlift_Products_Navigator_Shortcode(); |
|
| 1342 | - add_action( 'wp_enqueue_scripts', function () use ( $enabled_blocks ) { |
|
| 1343 | - wp_register_script( 'wl_enabled_blocks', false ); |
|
| 1344 | - wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 1345 | - wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 1346 | - } ); |
|
| 1347 | - |
|
| 1348 | - // Initialize the Context Cards Service |
|
| 1349 | - $this->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
| 1350 | - |
|
| 1351 | - // Initialize the SEO service. |
|
| 1352 | - new Wordlift_Seo_Service(); |
|
| 1353 | - |
|
| 1354 | - // Initialize the AMP service. |
|
| 1355 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1356 | - |
|
| 1357 | - /** Services. */ |
|
| 1358 | - $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1359 | - new Wordlift_Image_Service(); |
|
| 1360 | - |
|
| 1361 | - /** Adapters. */ |
|
| 1362 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1363 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1364 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1365 | - //$this->faq_tinymce_adapter = new Faq_Tinymce_Adapter(); |
|
| 1366 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1367 | - |
|
| 1368 | - /* |
|
| 1290 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1291 | + $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1292 | + $jsonld_service = new Jsonld_Service( $this->jsonld_service, $term_jsonld_adapter ); |
|
| 1293 | + new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service ); |
|
| 1294 | + |
|
| 1295 | + // Prints the JSON-LD in the head. |
|
| 1296 | + new Jsonld_Adapter( $this->jsonld_service ); |
|
| 1297 | + |
|
| 1298 | + new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service ); |
|
| 1299 | + |
|
| 1300 | + $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1301 | + $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1302 | + // Creating Faq Content filter service. |
|
| 1303 | + $this->faq_content_filter_service = new Faq_Content_Filter(); |
|
| 1304 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1305 | + $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1306 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1307 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->entity_service ); |
|
| 1308 | + |
|
| 1309 | + /** |
|
| 1310 | + * Filter: wl_feature__enable__blocks. |
|
| 1311 | + * |
|
| 1312 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1313 | + * |
|
| 1314 | + * @return bool |
|
| 1315 | + * @since 3.27.6 |
|
| 1316 | + */ |
|
| 1317 | + $enabled_blocks = array( 'wordlift/products-navigator' ); |
|
| 1318 | + |
|
| 1319 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1320 | + // Initialize the short-codes. |
|
| 1321 | + new Wordlift_Navigator_Shortcode(); |
|
| 1322 | + new Wordlift_Chord_Shortcode(); |
|
| 1323 | + new Wordlift_Geomap_Shortcode(); |
|
| 1324 | + new Wordlift_Timeline_Shortcode(); |
|
| 1325 | + new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1326 | + new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1327 | + new Wordlift_Faceted_Search_Shortcode(); |
|
| 1328 | + |
|
| 1329 | + // To intimate JS |
|
| 1330 | + $enabled_blocks = $enabled_blocks + array( |
|
| 1331 | + 'wordlift/navigator', |
|
| 1332 | + 'wordlift/chord', |
|
| 1333 | + 'wordlift/geomap', |
|
| 1334 | + 'wordlift/timeline', |
|
| 1335 | + 'wordlift/cloud', |
|
| 1336 | + 'wordlift/vocabulary', |
|
| 1337 | + 'wordlift/faceted-search' |
|
| 1338 | + ); |
|
| 1339 | + } |
|
| 1340 | + |
|
| 1341 | + new Wordlift_Products_Navigator_Shortcode(); |
|
| 1342 | + add_action( 'wp_enqueue_scripts', function () use ( $enabled_blocks ) { |
|
| 1343 | + wp_register_script( 'wl_enabled_blocks', false ); |
|
| 1344 | + wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 1345 | + wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 1346 | + } ); |
|
| 1347 | + |
|
| 1348 | + // Initialize the Context Cards Service |
|
| 1349 | + $this->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
| 1350 | + |
|
| 1351 | + // Initialize the SEO service. |
|
| 1352 | + new Wordlift_Seo_Service(); |
|
| 1353 | + |
|
| 1354 | + // Initialize the AMP service. |
|
| 1355 | + new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1356 | + |
|
| 1357 | + /** Services. */ |
|
| 1358 | + $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1359 | + new Wordlift_Image_Service(); |
|
| 1360 | + |
|
| 1361 | + /** Adapters. */ |
|
| 1362 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1363 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1364 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1365 | + //$this->faq_tinymce_adapter = new Faq_Tinymce_Adapter(); |
|
| 1366 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1367 | + |
|
| 1368 | + /* |
|
| 1369 | 1369 | * Exclude our public js from WP-Rocket. |
| 1370 | 1370 | * |
| 1371 | 1371 | * @since 3.19.4 |
| 1372 | 1372 | * |
| 1373 | 1373 | * @see https://github.com/insideout10/wordlift-plugin/issues/842. |
| 1374 | 1374 | */ |
| 1375 | - new Wordlift_WpRocket_Adapter(); |
|
| 1376 | - |
|
| 1377 | - // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1378 | - $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1379 | - $this->sparql_service, |
|
| 1380 | - $uri_service |
|
| 1381 | - ); |
|
| 1382 | - |
|
| 1383 | - /** Async Tasks. */ |
|
| 1384 | - new Wordlift_Sparql_Query_Async_Task(); |
|
| 1385 | - new Wordlift_Push_References_Async_Task(); |
|
| 1386 | - |
|
| 1387 | - /** WordPress Admin UI. */ |
|
| 1388 | - |
|
| 1389 | - // UI elements. |
|
| 1390 | - $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1391 | - $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1392 | - $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1393 | - $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1394 | - $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1395 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1396 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1397 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1398 | - |
|
| 1399 | - $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 ); |
|
| 1400 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1401 | - |
|
| 1402 | - $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1403 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1404 | - $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1405 | - |
|
| 1406 | - // Pages. |
|
| 1407 | - /* |
|
| 1375 | + new Wordlift_WpRocket_Adapter(); |
|
| 1376 | + |
|
| 1377 | + // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1378 | + $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1379 | + $this->sparql_service, |
|
| 1380 | + $uri_service |
|
| 1381 | + ); |
|
| 1382 | + |
|
| 1383 | + /** Async Tasks. */ |
|
| 1384 | + new Wordlift_Sparql_Query_Async_Task(); |
|
| 1385 | + new Wordlift_Push_References_Async_Task(); |
|
| 1386 | + |
|
| 1387 | + /** WordPress Admin UI. */ |
|
| 1388 | + |
|
| 1389 | + // UI elements. |
|
| 1390 | + $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1391 | + $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1392 | + $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1393 | + $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1394 | + $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1395 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1396 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1397 | + $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1398 | + |
|
| 1399 | + $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 ); |
|
| 1400 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1401 | + |
|
| 1402 | + $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1403 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1404 | + $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1405 | + |
|
| 1406 | + // Pages. |
|
| 1407 | + /* |
|
| 1408 | 1408 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
| 1409 | 1409 | * |
| 1410 | 1410 | * @since 3.20.3 |
| 1411 | 1411 | * |
| 1412 | 1412 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1413 | 1413 | */ |
| 1414 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1415 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1416 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1417 | - } |
|
| 1418 | - new Wordlift_Entity_Type_Admin_Service(); |
|
| 1414 | + if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1415 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1416 | + new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1417 | + } |
|
| 1418 | + new Wordlift_Entity_Type_Admin_Service(); |
|
| 1419 | 1419 | |
| 1420 | - // create an instance of the entity type list admin page controller. |
|
| 1421 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1420 | + // create an instance of the entity type list admin page controller. |
|
| 1421 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1422 | 1422 | |
| 1423 | - // create an instance of the entity type setting admin page controller. |
|
| 1424 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1423 | + // create an instance of the entity type setting admin page controller. |
|
| 1424 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1425 | 1425 | |
| 1426 | - /** Widgets */ |
|
| 1427 | - $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1426 | + /** Widgets */ |
|
| 1427 | + $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1428 | 1428 | |
| 1429 | - /* WordPress Admin. */ |
|
| 1430 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1431 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1429 | + /* WordPress Admin. */ |
|
| 1430 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1431 | + $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1432 | 1432 | |
| 1433 | - // Create an instance of the install wizard. |
|
| 1434 | - $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 ); |
|
| 1433 | + // Create an instance of the install wizard. |
|
| 1434 | + $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 ); |
|
| 1435 | 1435 | |
| 1436 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1436 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1437 | 1437 | |
| 1438 | - // User Profile. |
|
| 1439 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1438 | + // User Profile. |
|
| 1439 | + new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1440 | 1440 | |
| 1441 | - $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1441 | + $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1442 | 1442 | |
| 1443 | - // Load the debug service if WP is in debug mode. |
|
| 1444 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1445 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1446 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1447 | - } |
|
| 1443 | + // Load the debug service if WP is in debug mode. |
|
| 1444 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1445 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1446 | + new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1447 | + } |
|
| 1448 | 1448 | |
| 1449 | - // Remote Image Service. |
|
| 1450 | - new Wordlift_Remote_Image_Service(); |
|
| 1449 | + // Remote Image Service. |
|
| 1450 | + new Wordlift_Remote_Image_Service(); |
|
| 1451 | 1451 | |
| 1452 | - /* |
|
| 1452 | + /* |
|
| 1453 | 1453 | * Provides mappings between post types and entity types. |
| 1454 | 1454 | * |
| 1455 | 1455 | * @since 3.20.0 |
| 1456 | 1456 | * |
| 1457 | 1457 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1458 | 1458 | */ |
| 1459 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1460 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1461 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1459 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1460 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1461 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1462 | 1462 | |
| 1463 | - // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1464 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1463 | + // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1464 | + new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1465 | 1465 | |
| 1466 | - /* |
|
| 1466 | + /* |
|
| 1467 | 1467 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
| 1468 | 1468 | * |
| 1469 | 1469 | * Eventually Batch Actions will become Batch Operations. |
| 1470 | 1470 | * |
| 1471 | 1471 | * @since 3.20.0 |
| 1472 | 1472 | */ |
| 1473 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1474 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1473 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1474 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1475 | 1475 | |
| 1476 | - /* |
|
| 1476 | + /* |
|
| 1477 | 1477 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
| 1478 | 1478 | * |
| 1479 | 1479 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
| 1480 | 1480 | * |
| 1481 | 1481 | * @since 3.20.0 |
| 1482 | 1482 | */ |
| 1483 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1484 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1483 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1484 | + new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1485 | 1485 | |
| 1486 | - /* |
|
| 1486 | + /* |
|
| 1487 | 1487 | * Load the Mappings JSON-LD post processing. |
| 1488 | 1488 | * |
| 1489 | 1489 | * @since 3.25.0 |
| 1490 | 1490 | */ |
| 1491 | 1491 | |
| 1492 | - $mappings_dbo = new Mappings_DBO(); |
|
| 1493 | - $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
| 1494 | - new Post_Type_Rule_Validator(); |
|
| 1495 | - // Taxonomy term rule validator for validating rules for term pages. |
|
| 1496 | - new Taxonomy_Term_Rule_Validator(); |
|
| 1497 | - $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1498 | - $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1499 | - $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1500 | - |
|
| 1501 | - new Url_To_Entity_Transform_Function( $this->entity_uri_service ); |
|
| 1502 | - new Taxonomy_To_Terms_Transform_Function(); |
|
| 1503 | - new Post_Id_To_Entity_Transform_Function(); |
|
| 1504 | - $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
| 1505 | - |
|
| 1506 | - /** |
|
| 1507 | - * @since 3.27.1 |
|
| 1508 | - * Intiailize the acf group data formatter. |
|
| 1509 | - */ |
|
| 1510 | - new Acf_Group_Formatter(); |
|
| 1511 | - new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1512 | - |
|
| 1513 | - /** |
|
| 1514 | - * @since 3.26.0 |
|
| 1515 | - * Initialize the Faq JSON LD converter here - disabled. |
|
| 1516 | - */ |
|
| 1517 | - // new Faq_To_Jsonld_Converter(); |
|
| 1518 | - /* |
|
| 1492 | + $mappings_dbo = new Mappings_DBO(); |
|
| 1493 | + $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
| 1494 | + new Post_Type_Rule_Validator(); |
|
| 1495 | + // Taxonomy term rule validator for validating rules for term pages. |
|
| 1496 | + new Taxonomy_Term_Rule_Validator(); |
|
| 1497 | + $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1498 | + $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1499 | + $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1500 | + |
|
| 1501 | + new Url_To_Entity_Transform_Function( $this->entity_uri_service ); |
|
| 1502 | + new Taxonomy_To_Terms_Transform_Function(); |
|
| 1503 | + new Post_Id_To_Entity_Transform_Function(); |
|
| 1504 | + $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
| 1505 | + |
|
| 1506 | + /** |
|
| 1507 | + * @since 3.27.1 |
|
| 1508 | + * Intiailize the acf group data formatter. |
|
| 1509 | + */ |
|
| 1510 | + new Acf_Group_Formatter(); |
|
| 1511 | + new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1512 | + |
|
| 1513 | + /** |
|
| 1514 | + * @since 3.26.0 |
|
| 1515 | + * Initialize the Faq JSON LD converter here - disabled. |
|
| 1516 | + */ |
|
| 1517 | + // new Faq_To_Jsonld_Converter(); |
|
| 1518 | + /* |
|
| 1519 | 1519 | * Use the Templates Ajax Endpoint to load HTML templates for the legacy Angular app via admin-ajax.php |
| 1520 | 1520 | * end-point. |
| 1521 | 1521 | * |
| 1522 | 1522 | * @see https://github.com/insideout10/wordlift-plugin/issues/834 |
| 1523 | 1523 | * @since 3.24.4 |
| 1524 | 1524 | */ |
| 1525 | - new Templates_Ajax_Endpoint(); |
|
| 1526 | - // Call this static method to register FAQ routes to rest api - disabled |
|
| 1527 | - //Faq_Rest_Controller::register_routes(); |
|
| 1525 | + new Templates_Ajax_Endpoint(); |
|
| 1526 | + // Call this static method to register FAQ routes to rest api - disabled |
|
| 1527 | + //Faq_Rest_Controller::register_routes(); |
|
| 1528 | 1528 | |
| 1529 | - /* |
|
| 1529 | + /* |
|
| 1530 | 1530 | * Create a singleton for the Analysis_Response_Ops_Factory. |
| 1531 | 1531 | */ |
| 1532 | - $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service ); |
|
| 1533 | - new Analysis_Response_Ops_Factory( |
|
| 1534 | - $this->entity_uri_service, |
|
| 1535 | - $this->entity_service, |
|
| 1536 | - $this->entity_type_service, |
|
| 1537 | - $this->storage_factory->post_images(), |
|
| 1538 | - $entity_helper |
|
| 1539 | - ); |
|
| 1540 | - |
|
| 1541 | - /** WL Autocomplete. */ |
|
| 1542 | - $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1543 | - new Local_Autocomplete_Service(), |
|
| 1544 | - new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ), |
|
| 1545 | - ) ); |
|
| 1546 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1547 | - |
|
| 1548 | - /** |
|
| 1549 | - * @since 3.27.2 |
|
| 1550 | - * Integrate the recipe maker jsonld & set recipe |
|
| 1551 | - * as default entity type to the wprm_recipe CPT. |
|
| 1552 | - */ |
|
| 1553 | - new Recipe_Maker_Post_Type_Hook(); |
|
| 1554 | - $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
| 1555 | - new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1556 | - new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1557 | - new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1558 | - new Yoast_Jsonld( $recipe_maker_validation_service ); |
|
| 1559 | - |
|
| 1560 | - /** |
|
| 1561 | - * @since 3.27.4 |
|
| 1562 | - * Add the faq duplicate markup hook. |
|
| 1563 | - */ |
|
| 1564 | - new Faq_Duplicate_Markup_Remover(); |
|
| 1565 | - } |
|
| 1566 | - |
|
| 1567 | - /** |
|
| 1568 | - * Define the locale for this plugin for internationalization. |
|
| 1569 | - * |
|
| 1570 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1571 | - * with WordPress. |
|
| 1572 | - * |
|
| 1573 | - * @since 1.0.0 |
|
| 1574 | - * @access private |
|
| 1575 | - */ |
|
| 1576 | - private function set_locale() { |
|
| 1577 | - |
|
| 1578 | - $plugin_i18n = new Wordlift_i18n(); |
|
| 1579 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1580 | - |
|
| 1581 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1582 | - |
|
| 1583 | - } |
|
| 1584 | - |
|
| 1585 | - /** |
|
| 1586 | - * Register all of the hooks related to the admin area functionality |
|
| 1587 | - * of the plugin. |
|
| 1588 | - * |
|
| 1589 | - * @since 1.0.0 |
|
| 1590 | - * @access private |
|
| 1591 | - */ |
|
| 1592 | - private function define_admin_hooks() { |
|
| 1593 | - |
|
| 1594 | - $plugin_admin = new Wordlift_Admin( |
|
| 1595 | - $this->get_plugin_name(), |
|
| 1596 | - $this->get_version(), |
|
| 1597 | - $this->configuration_service, |
|
| 1598 | - $this->notice_service, |
|
| 1599 | - $this->user_service |
|
| 1600 | - ); |
|
| 1601 | - |
|
| 1602 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1603 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1604 | - |
|
| 1605 | - // Hook the init action to taxonomy services. |
|
| 1606 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1607 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1608 | - |
|
| 1609 | - // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1610 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1611 | - |
|
| 1612 | - // Hook the added_post_meta action to the Thumbnail service. |
|
| 1613 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1614 | - |
|
| 1615 | - // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1616 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1617 | - |
|
| 1618 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1619 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1620 | - |
|
| 1621 | - // Register custom allowed redirect hosts. |
|
| 1622 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1623 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1624 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1625 | - |
|
| 1626 | - /* |
|
| 1532 | + $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service ); |
|
| 1533 | + new Analysis_Response_Ops_Factory( |
|
| 1534 | + $this->entity_uri_service, |
|
| 1535 | + $this->entity_service, |
|
| 1536 | + $this->entity_type_service, |
|
| 1537 | + $this->storage_factory->post_images(), |
|
| 1538 | + $entity_helper |
|
| 1539 | + ); |
|
| 1540 | + |
|
| 1541 | + /** WL Autocomplete. */ |
|
| 1542 | + $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1543 | + new Local_Autocomplete_Service(), |
|
| 1544 | + new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ), |
|
| 1545 | + ) ); |
|
| 1546 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1547 | + |
|
| 1548 | + /** |
|
| 1549 | + * @since 3.27.2 |
|
| 1550 | + * Integrate the recipe maker jsonld & set recipe |
|
| 1551 | + * as default entity type to the wprm_recipe CPT. |
|
| 1552 | + */ |
|
| 1553 | + new Recipe_Maker_Post_Type_Hook(); |
|
| 1554 | + $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
| 1555 | + new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1556 | + new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1557 | + new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1558 | + new Yoast_Jsonld( $recipe_maker_validation_service ); |
|
| 1559 | + |
|
| 1560 | + /** |
|
| 1561 | + * @since 3.27.4 |
|
| 1562 | + * Add the faq duplicate markup hook. |
|
| 1563 | + */ |
|
| 1564 | + new Faq_Duplicate_Markup_Remover(); |
|
| 1565 | + } |
|
| 1566 | + |
|
| 1567 | + /** |
|
| 1568 | + * Define the locale for this plugin for internationalization. |
|
| 1569 | + * |
|
| 1570 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1571 | + * with WordPress. |
|
| 1572 | + * |
|
| 1573 | + * @since 1.0.0 |
|
| 1574 | + * @access private |
|
| 1575 | + */ |
|
| 1576 | + private function set_locale() { |
|
| 1577 | + |
|
| 1578 | + $plugin_i18n = new Wordlift_i18n(); |
|
| 1579 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1580 | + |
|
| 1581 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1582 | + |
|
| 1583 | + } |
|
| 1584 | + |
|
| 1585 | + /** |
|
| 1586 | + * Register all of the hooks related to the admin area functionality |
|
| 1587 | + * of the plugin. |
|
| 1588 | + * |
|
| 1589 | + * @since 1.0.0 |
|
| 1590 | + * @access private |
|
| 1591 | + */ |
|
| 1592 | + private function define_admin_hooks() { |
|
| 1593 | + |
|
| 1594 | + $plugin_admin = new Wordlift_Admin( |
|
| 1595 | + $this->get_plugin_name(), |
|
| 1596 | + $this->get_version(), |
|
| 1597 | + $this->configuration_service, |
|
| 1598 | + $this->notice_service, |
|
| 1599 | + $this->user_service |
|
| 1600 | + ); |
|
| 1601 | + |
|
| 1602 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1603 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1604 | + |
|
| 1605 | + // Hook the init action to taxonomy services. |
|
| 1606 | + $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1607 | + $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1608 | + |
|
| 1609 | + // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1610 | + $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1611 | + |
|
| 1612 | + // Hook the added_post_meta action to the Thumbnail service. |
|
| 1613 | + $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1614 | + |
|
| 1615 | + // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1616 | + $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1617 | + |
|
| 1618 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1619 | + $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1620 | + |
|
| 1621 | + // Register custom allowed redirect hosts. |
|
| 1622 | + $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1623 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1624 | + $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1625 | + |
|
| 1626 | + /* |
|
| 1627 | 1627 | * The old dashboard is replaced with dashboard v2. |
| 1628 | 1628 | * |
| 1629 | 1629 | * The old dashboard service is still loaded because its functions are used. |
@@ -1632,356 +1632,356 @@ discard block |
||
| 1632 | 1632 | * |
| 1633 | 1633 | * @since 3.20.0 |
| 1634 | 1634 | */ |
| 1635 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1636 | - // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1637 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1638 | - // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1639 | - |
|
| 1640 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1641 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1642 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1643 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1644 | - |
|
| 1645 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1646 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1647 | - |
|
| 1648 | - // Entity listing customization (wp-admin/edit.php) |
|
| 1649 | - // Add custom columns. |
|
| 1650 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1651 | - // no explicit entity as it prevents handling of other post types. |
|
| 1652 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1653 | - // Add 4W selection. |
|
| 1654 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1655 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1656 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1657 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1658 | - |
|
| 1659 | - /* |
|
| 1635 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1636 | + // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1637 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1638 | + // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1639 | + |
|
| 1640 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1641 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1642 | + $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1643 | + $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1644 | + |
|
| 1645 | + $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1646 | + $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1647 | + |
|
| 1648 | + // Entity listing customization (wp-admin/edit.php) |
|
| 1649 | + // Add custom columns. |
|
| 1650 | + $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1651 | + // no explicit entity as it prevents handling of other post types. |
|
| 1652 | + $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1653 | + // Add 4W selection. |
|
| 1654 | + $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1655 | + $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1656 | + $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1657 | + $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1658 | + |
|
| 1659 | + /* |
|
| 1660 | 1660 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1661 | 1661 | * |
| 1662 | 1662 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1663 | 1663 | */ |
| 1664 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1665 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1666 | - } |
|
| 1667 | - |
|
| 1668 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1669 | - // entities. |
|
| 1670 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1671 | - |
|
| 1672 | - // Filter imported post meta. |
|
| 1673 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1674 | - |
|
| 1675 | - // Notify the import service when an import starts and ends. |
|
| 1676 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1677 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1678 | - |
|
| 1679 | - // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1680 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1681 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1682 | - |
|
| 1683 | - /** |
|
| 1684 | - * Filter: wl_feature__enable__screens. |
|
| 1685 | - * |
|
| 1686 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1687 | - * |
|
| 1688 | - * @return bool |
|
| 1689 | - * @since 3.27.6 |
|
| 1690 | - */ |
|
| 1691 | - if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1692 | - // Hook the menu to the Download Your Data page. |
|
| 1693 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1694 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1695 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1696 | - } |
|
| 1697 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1698 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1699 | - |
|
| 1700 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1701 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1702 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1703 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1704 | - |
|
| 1705 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1706 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1707 | - |
|
| 1708 | - // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1709 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1710 | - |
|
| 1711 | - // Hook the `admin_init` function to the Admin Setup. |
|
| 1712 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1713 | - |
|
| 1714 | - // Hook the admin_init to the settings page. |
|
| 1715 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1716 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1717 | - |
|
| 1718 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1719 | - |
|
| 1720 | - // Hook the menu creation on the general wordlift menu creation. |
|
| 1721 | - /** |
|
| 1722 | - * Filter: wl_feature__enable__screens. |
|
| 1723 | - * |
|
| 1724 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1725 | - * |
|
| 1726 | - * @return bool |
|
| 1727 | - * @since 3.27.6 |
|
| 1728 | - */ |
|
| 1729 | - if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1730 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1731 | - } |
|
| 1732 | - /* |
|
| 1664 | + if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1665 | + $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1666 | + } |
|
| 1667 | + |
|
| 1668 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1669 | + // entities. |
|
| 1670 | + $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1671 | + |
|
| 1672 | + // Filter imported post meta. |
|
| 1673 | + $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1674 | + |
|
| 1675 | + // Notify the import service when an import starts and ends. |
|
| 1676 | + $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1677 | + $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1678 | + |
|
| 1679 | + // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1680 | + $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1681 | + $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1682 | + |
|
| 1683 | + /** |
|
| 1684 | + * Filter: wl_feature__enable__screens. |
|
| 1685 | + * |
|
| 1686 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1687 | + * |
|
| 1688 | + * @return bool |
|
| 1689 | + * @since 3.27.6 |
|
| 1690 | + */ |
|
| 1691 | + if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1692 | + // Hook the menu to the Download Your Data page. |
|
| 1693 | + $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1694 | + $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1695 | + $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1696 | + } |
|
| 1697 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1698 | + $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1699 | + |
|
| 1700 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1701 | + $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1702 | + $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1703 | + $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1704 | + |
|
| 1705 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1706 | + $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1707 | + |
|
| 1708 | + // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1709 | + $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1710 | + |
|
| 1711 | + // Hook the `admin_init` function to the Admin Setup. |
|
| 1712 | + $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1713 | + |
|
| 1714 | + // Hook the admin_init to the settings page. |
|
| 1715 | + $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1716 | + $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1717 | + |
|
| 1718 | + $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1719 | + |
|
| 1720 | + // Hook the menu creation on the general wordlift menu creation. |
|
| 1721 | + /** |
|
| 1722 | + * Filter: wl_feature__enable__screens. |
|
| 1723 | + * |
|
| 1724 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1725 | + * |
|
| 1726 | + * @return bool |
|
| 1727 | + * @since 3.27.6 |
|
| 1728 | + */ |
|
| 1729 | + if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1730 | + $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1731 | + } |
|
| 1732 | + /* |
|
| 1733 | 1733 | * Display the `Wordlift_Admin_Search_Rankings_Page` page. |
| 1734 | 1734 | * |
| 1735 | 1735 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
| 1736 | 1736 | * |
| 1737 | 1737 | * @since 3.20.0 |
| 1738 | 1738 | */ |
| 1739 | - if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1740 | - /** |
|
| 1741 | - * Filter: wl_feature__enable__screens. |
|
| 1742 | - * |
|
| 1743 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1744 | - * |
|
| 1745 | - * @return bool |
|
| 1746 | - * @since 3.27.6 |
|
| 1747 | - */ |
|
| 1748 | - if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1749 | - $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
|
| 1750 | - $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1751 | - } |
|
| 1752 | - } |
|
| 1753 | - |
|
| 1754 | - // Hook key update. |
|
| 1755 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1756 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1757 | - |
|
| 1758 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1759 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1760 | - |
|
| 1761 | - /* |
|
| 1739 | + if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1740 | + /** |
|
| 1741 | + * Filter: wl_feature__enable__screens. |
|
| 1742 | + * |
|
| 1743 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1744 | + * |
|
| 1745 | + * @return bool |
|
| 1746 | + * @since 3.27.6 |
|
| 1747 | + */ |
|
| 1748 | + if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1749 | + $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
|
| 1750 | + $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1751 | + } |
|
| 1752 | + } |
|
| 1753 | + |
|
| 1754 | + // Hook key update. |
|
| 1755 | + $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1756 | + $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1757 | + |
|
| 1758 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1759 | + $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1760 | + |
|
| 1761 | + /* |
|
| 1762 | 1762 | * Remove the Analytics Settings link from the plugin page. |
| 1763 | 1763 | * |
| 1764 | 1764 | * @see https://github.com/insideout10/wordlift-plugin/issues/932 |
| 1765 | 1765 | * @since 3.21.1 |
| 1766 | 1766 | */ |
| 1767 | - // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1768 | - |
|
| 1769 | - // Hook the AJAX `wl_publisher` action name. |
|
| 1770 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1771 | - |
|
| 1772 | - // Hook row actions for the entity type list admin. |
|
| 1773 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1774 | - |
|
| 1775 | - /** Ajax actions. */ |
|
| 1776 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1777 | - |
|
| 1778 | - // Hook capabilities manipulation to allow access to entity type admin |
|
| 1779 | - // page on WordPress versions before 4.7. |
|
| 1780 | - global $wp_version; |
|
| 1781 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1782 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1783 | - } |
|
| 1784 | - |
|
| 1785 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1786 | - |
|
| 1787 | - /** Adapters. */ |
|
| 1788 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1789 | - /** |
|
| 1790 | - * Disabling Faq temporarily. |
|
| 1791 | - * Load the tinymce editor button on the tool bar. |
|
| 1792 | - * @since 3.26.0 |
|
| 1793 | - */ |
|
| 1794 | - //$this->loader->add_filter( 'tiny_mce_before_init', $this->faq_tinymce_adapter, 'register_custom_tags' ); |
|
| 1795 | - //$this->loader->add_filter( 'mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
| 1796 | - //$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
| 1797 | - |
|
| 1798 | - |
|
| 1799 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1800 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1801 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1802 | - /** |
|
| 1803 | - * @since 3.26.0 |
|
| 1804 | - * Post excerpt meta box would be only loaded when the language is set |
|
| 1805 | - * to english |
|
| 1806 | - */ |
|
| 1807 | - if ( $this->configuration_service->get_language_code() === 'en' && |
|
| 1808 | - apply_filters( 'wl_feature__enable__post_excerpt', true ) ) { |
|
| 1809 | - $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
| 1810 | - $this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1811 | - // Adding Rest route for the post excerpt |
|
| 1812 | - Post_Excerpt_Rest_Controller::register_routes(); |
|
| 1813 | - } |
|
| 1814 | - |
|
| 1815 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1816 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1817 | - |
|
| 1818 | - // Handle the autocomplete request. |
|
| 1819 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1820 | - $this->autocomplete_adapter, |
|
| 1821 | - 'wl_autocomplete', |
|
| 1822 | - ) ); |
|
| 1823 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1824 | - $this->autocomplete_adapter, |
|
| 1825 | - 'wl_autocomplete', |
|
| 1826 | - ) ); |
|
| 1827 | - |
|
| 1828 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1829 | - if ( is_multisite() ) { |
|
| 1830 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1831 | - } |
|
| 1832 | - |
|
| 1833 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1834 | - |
|
| 1835 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1836 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1837 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1838 | - |
|
| 1839 | - /** |
|
| 1840 | - * Always allow the `wordlift/classification` block. |
|
| 1841 | - * |
|
| 1842 | - * @since 3.23.0 |
|
| 1843 | - */ |
|
| 1844 | - add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1845 | - |
|
| 1846 | - if ( true === $value ) { |
|
| 1847 | - return $value; |
|
| 1848 | - } |
|
| 1849 | - |
|
| 1850 | - return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1851 | - }, PHP_INT_MAX ); |
|
| 1852 | - |
|
| 1853 | - } |
|
| 1854 | - |
|
| 1855 | - /** |
|
| 1856 | - * Register all of the hooks related to the public-facing functionality |
|
| 1857 | - * of the plugin. |
|
| 1858 | - * |
|
| 1859 | - * @since 1.0.0 |
|
| 1860 | - * @access private |
|
| 1861 | - */ |
|
| 1862 | - private function define_public_hooks() { |
|
| 1863 | - |
|
| 1864 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1865 | - |
|
| 1866 | - // Register the entity post type. |
|
| 1867 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1868 | - |
|
| 1869 | - // Bind the link generation and handling hooks to the entity link service. |
|
| 1870 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1871 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1872 | - $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 ); |
|
| 1873 | - $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 ); |
|
| 1874 | - |
|
| 1875 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1876 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1877 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1878 | - |
|
| 1879 | - // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
| 1880 | - $this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1881 | - // Hook the content filter service to add entity links. |
|
| 1882 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1883 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1884 | - } |
|
| 1885 | - |
|
| 1886 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1887 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1888 | - |
|
| 1889 | - // Hook the ShareThis service. |
|
| 1890 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1891 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1892 | - |
|
| 1893 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1894 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1895 | - |
|
| 1896 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1897 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1898 | - // to categories. |
|
| 1899 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1900 | - |
|
| 1901 | - /* |
|
| 1767 | + // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1768 | + |
|
| 1769 | + // Hook the AJAX `wl_publisher` action name. |
|
| 1770 | + $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1771 | + |
|
| 1772 | + // Hook row actions for the entity type list admin. |
|
| 1773 | + $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1774 | + |
|
| 1775 | + /** Ajax actions. */ |
|
| 1776 | + $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1777 | + |
|
| 1778 | + // Hook capabilities manipulation to allow access to entity type admin |
|
| 1779 | + // page on WordPress versions before 4.7. |
|
| 1780 | + global $wp_version; |
|
| 1781 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1782 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1783 | + } |
|
| 1784 | + |
|
| 1785 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1786 | + |
|
| 1787 | + /** Adapters. */ |
|
| 1788 | + $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1789 | + /** |
|
| 1790 | + * Disabling Faq temporarily. |
|
| 1791 | + * Load the tinymce editor button on the tool bar. |
|
| 1792 | + * @since 3.26.0 |
|
| 1793 | + */ |
|
| 1794 | + //$this->loader->add_filter( 'tiny_mce_before_init', $this->faq_tinymce_adapter, 'register_custom_tags' ); |
|
| 1795 | + //$this->loader->add_filter( 'mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
| 1796 | + //$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
| 1797 | + |
|
| 1798 | + |
|
| 1799 | + $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1800 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1801 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1802 | + /** |
|
| 1803 | + * @since 3.26.0 |
|
| 1804 | + * Post excerpt meta box would be only loaded when the language is set |
|
| 1805 | + * to english |
|
| 1806 | + */ |
|
| 1807 | + if ( $this->configuration_service->get_language_code() === 'en' && |
|
| 1808 | + apply_filters( 'wl_feature__enable__post_excerpt', true ) ) { |
|
| 1809 | + $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
| 1810 | + $this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1811 | + // Adding Rest route for the post excerpt |
|
| 1812 | + Post_Excerpt_Rest_Controller::register_routes(); |
|
| 1813 | + } |
|
| 1814 | + |
|
| 1815 | + $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1816 | + $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1817 | + |
|
| 1818 | + // Handle the autocomplete request. |
|
| 1819 | + add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1820 | + $this->autocomplete_adapter, |
|
| 1821 | + 'wl_autocomplete', |
|
| 1822 | + ) ); |
|
| 1823 | + add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1824 | + $this->autocomplete_adapter, |
|
| 1825 | + 'wl_autocomplete', |
|
| 1826 | + ) ); |
|
| 1827 | + |
|
| 1828 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1829 | + if ( is_multisite() ) { |
|
| 1830 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1831 | + } |
|
| 1832 | + |
|
| 1833 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1834 | + |
|
| 1835 | + add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1836 | + add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1837 | + add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1838 | + |
|
| 1839 | + /** |
|
| 1840 | + * Always allow the `wordlift/classification` block. |
|
| 1841 | + * |
|
| 1842 | + * @since 3.23.0 |
|
| 1843 | + */ |
|
| 1844 | + add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1845 | + |
|
| 1846 | + if ( true === $value ) { |
|
| 1847 | + return $value; |
|
| 1848 | + } |
|
| 1849 | + |
|
| 1850 | + return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1851 | + }, PHP_INT_MAX ); |
|
| 1852 | + |
|
| 1853 | + } |
|
| 1854 | + |
|
| 1855 | + /** |
|
| 1856 | + * Register all of the hooks related to the public-facing functionality |
|
| 1857 | + * of the plugin. |
|
| 1858 | + * |
|
| 1859 | + * @since 1.0.0 |
|
| 1860 | + * @access private |
|
| 1861 | + */ |
|
| 1862 | + private function define_public_hooks() { |
|
| 1863 | + |
|
| 1864 | + $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1865 | + |
|
| 1866 | + // Register the entity post type. |
|
| 1867 | + $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1868 | + |
|
| 1869 | + // Bind the link generation and handling hooks to the entity link service. |
|
| 1870 | + $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1871 | + $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1872 | + $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 ); |
|
| 1873 | + $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 ); |
|
| 1874 | + |
|
| 1875 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1876 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1877 | + $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1878 | + |
|
| 1879 | + // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
| 1880 | + $this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1881 | + // Hook the content filter service to add entity links. |
|
| 1882 | + if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1883 | + $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1884 | + } |
|
| 1885 | + |
|
| 1886 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1887 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1888 | + |
|
| 1889 | + // Hook the ShareThis service. |
|
| 1890 | + $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1891 | + $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1892 | + |
|
| 1893 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1894 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1895 | + |
|
| 1896 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1897 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1898 | + // to categories. |
|
| 1899 | + $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1900 | + |
|
| 1901 | + /* |
|
| 1902 | 1902 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1903 | 1903 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1904 | 1904 | * order of start time. |
| 1905 | 1905 | */ |
| 1906 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1907 | - |
|
| 1908 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1909 | - |
|
| 1910 | - // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1911 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1912 | - |
|
| 1913 | - // Analytics Script Frontend. |
|
| 1914 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1915 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1916 | - } |
|
| 1917 | - |
|
| 1918 | - } |
|
| 1919 | - |
|
| 1920 | - /** |
|
| 1921 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 1922 | - * |
|
| 1923 | - * @since 1.0.0 |
|
| 1924 | - */ |
|
| 1925 | - public function run() { |
|
| 1926 | - $this->loader->run(); |
|
| 1927 | - } |
|
| 1928 | - |
|
| 1929 | - /** |
|
| 1930 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 1931 | - * WordPress and to define internationalization functionality. |
|
| 1932 | - * |
|
| 1933 | - * @return string The name of the plugin. |
|
| 1934 | - * @since 1.0.0 |
|
| 1935 | - */ |
|
| 1936 | - public function get_plugin_name() { |
|
| 1937 | - return $this->plugin_name; |
|
| 1938 | - } |
|
| 1939 | - |
|
| 1940 | - /** |
|
| 1941 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1942 | - * |
|
| 1943 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1944 | - * @since 1.0.0 |
|
| 1945 | - */ |
|
| 1946 | - public function get_loader() { |
|
| 1947 | - return $this->loader; |
|
| 1948 | - } |
|
| 1949 | - |
|
| 1950 | - /** |
|
| 1951 | - * Retrieve the version number of the plugin. |
|
| 1952 | - * |
|
| 1953 | - * @return string The version number of the plugin. |
|
| 1954 | - * @since 1.0.0 |
|
| 1955 | - */ |
|
| 1956 | - public function get_version() { |
|
| 1957 | - return $this->version; |
|
| 1958 | - } |
|
| 1959 | - |
|
| 1960 | - /** |
|
| 1961 | - * Load dependencies for WP-CLI. |
|
| 1962 | - * |
|
| 1963 | - * @throws Exception |
|
| 1964 | - * @since 3.18.0 |
|
| 1965 | - */ |
|
| 1966 | - private function load_cli_dependencies() { |
|
| 1967 | - |
|
| 1968 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1969 | - |
|
| 1970 | - $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 ); |
|
| 1971 | - |
|
| 1972 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1973 | - |
|
| 1974 | - } |
|
| 1975 | - |
|
| 1976 | - /** |
|
| 1977 | - * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 1978 | - * |
|
| 1979 | - * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 1980 | - * @since 3.20.0 |
|
| 1981 | - */ |
|
| 1982 | - public function get_dashboard_service() { |
|
| 1983 | - |
|
| 1984 | - return $this->dashboard_service; |
|
| 1985 | - } |
|
| 1906 | + $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1907 | + |
|
| 1908 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1909 | + |
|
| 1910 | + // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1911 | + $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1912 | + |
|
| 1913 | + // Analytics Script Frontend. |
|
| 1914 | + if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1915 | + $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1916 | + } |
|
| 1917 | + |
|
| 1918 | + } |
|
| 1919 | + |
|
| 1920 | + /** |
|
| 1921 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 1922 | + * |
|
| 1923 | + * @since 1.0.0 |
|
| 1924 | + */ |
|
| 1925 | + public function run() { |
|
| 1926 | + $this->loader->run(); |
|
| 1927 | + } |
|
| 1928 | + |
|
| 1929 | + /** |
|
| 1930 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 1931 | + * WordPress and to define internationalization functionality. |
|
| 1932 | + * |
|
| 1933 | + * @return string The name of the plugin. |
|
| 1934 | + * @since 1.0.0 |
|
| 1935 | + */ |
|
| 1936 | + public function get_plugin_name() { |
|
| 1937 | + return $this->plugin_name; |
|
| 1938 | + } |
|
| 1939 | + |
|
| 1940 | + /** |
|
| 1941 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1942 | + * |
|
| 1943 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1944 | + * @since 1.0.0 |
|
| 1945 | + */ |
|
| 1946 | + public function get_loader() { |
|
| 1947 | + return $this->loader; |
|
| 1948 | + } |
|
| 1949 | + |
|
| 1950 | + /** |
|
| 1951 | + * Retrieve the version number of the plugin. |
|
| 1952 | + * |
|
| 1953 | + * @return string The version number of the plugin. |
|
| 1954 | + * @since 1.0.0 |
|
| 1955 | + */ |
|
| 1956 | + public function get_version() { |
|
| 1957 | + return $this->version; |
|
| 1958 | + } |
|
| 1959 | + |
|
| 1960 | + /** |
|
| 1961 | + * Load dependencies for WP-CLI. |
|
| 1962 | + * |
|
| 1963 | + * @throws Exception |
|
| 1964 | + * @since 3.18.0 |
|
| 1965 | + */ |
|
| 1966 | + private function load_cli_dependencies() { |
|
| 1967 | + |
|
| 1968 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1969 | + |
|
| 1970 | + $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 ); |
|
| 1971 | + |
|
| 1972 | + WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1973 | + |
|
| 1974 | + } |
|
| 1975 | + |
|
| 1976 | + /** |
|
| 1977 | + * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 1978 | + * |
|
| 1979 | + * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 1980 | + * @since 3.20.0 |
|
| 1981 | + */ |
|
| 1982 | + public function get_dashboard_service() { |
|
| 1983 | + |
|
| 1984 | + return $this->dashboard_service; |
|
| 1985 | + } |
|
| 1986 | 1986 | |
| 1987 | 1987 | } |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | $this->define_public_hooks(); |
| 755 | 755 | |
| 756 | 756 | // If we're in `WP_CLI` load the related files. |
| 757 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 757 | + if (class_exists('WP_CLI')) { |
|
| 758 | 758 | $this->load_cli_dependencies(); |
| 759 | 759 | } |
| 760 | 760 | |
@@ -795,381 +795,381 @@ discard block |
||
| 795 | 795 | * The class responsible for orchestrating the actions and filters of the |
| 796 | 796 | * core plugin. |
| 797 | 797 | */ |
| 798 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 798 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php'; |
|
| 799 | 799 | |
| 800 | 800 | // The class responsible for plugin uninstall. |
| 801 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 801 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-deactivator-feedback.php'; |
|
| 802 | 802 | |
| 803 | 803 | /** |
| 804 | 804 | * The class responsible for defining internationalization functionality |
| 805 | 805 | * of the plugin. |
| 806 | 806 | */ |
| 807 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 807 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php'; |
|
| 808 | 808 | |
| 809 | 809 | /** |
| 810 | 810 | * WordLift's supported languages. |
| 811 | 811 | */ |
| 812 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 812 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php'; |
|
| 813 | 813 | |
| 814 | 814 | /** |
| 815 | 815 | * WordLift's supported countries. |
| 816 | 816 | */ |
| 817 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 817 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-countries.php'; |
|
| 818 | 818 | |
| 819 | 819 | /** |
| 820 | 820 | * Provide support functions to sanitize data. |
| 821 | 821 | */ |
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 822 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php'; |
|
| 823 | 823 | |
| 824 | 824 | /** Services. */ |
| 825 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 826 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 828 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 829 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 830 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 831 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 832 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 833 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 834 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 825 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php'; |
|
| 826 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-http-api.php'; |
|
| 827 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php'; |
|
| 828 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php'; |
|
| 829 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php'; |
|
| 830 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php'; |
|
| 831 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php'; |
|
| 832 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-linked-data-service.php'; |
|
| 833 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-service.php'; |
|
| 834 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-image-service.php'; |
|
| 835 | 835 | |
| 836 | 836 | /** |
| 837 | 837 | * The Query builder. |
| 838 | 838 | */ |
| 839 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 839 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php'; |
|
| 840 | 840 | |
| 841 | 841 | /** |
| 842 | 842 | * The Schema service. |
| 843 | 843 | */ |
| 844 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 844 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php'; |
|
| 845 | 845 | |
| 846 | 846 | /** |
| 847 | 847 | * The schema:url property service. |
| 848 | 848 | */ |
| 849 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 850 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 849 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php'; |
|
| 850 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php'; |
|
| 851 | 851 | |
| 852 | 852 | /** |
| 853 | 853 | * The UI service. |
| 854 | 854 | */ |
| 855 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 855 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php'; |
|
| 856 | 856 | |
| 857 | 857 | /** |
| 858 | 858 | * The Thumbnail service. |
| 859 | 859 | */ |
| 860 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 860 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php'; |
|
| 861 | 861 | |
| 862 | 862 | /** |
| 863 | 863 | * The Entity Types Taxonomy service. |
| 864 | 864 | */ |
| 865 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 865 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 866 | 866 | |
| 867 | 867 | /** |
| 868 | 868 | * The Entity service. |
| 869 | 869 | */ |
| 870 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 871 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 870 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-uri-service.php'; |
|
| 871 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php'; |
|
| 872 | 872 | |
| 873 | 873 | // Add the entity rating service. |
| 874 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 874 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php'; |
|
| 875 | 875 | |
| 876 | 876 | /** |
| 877 | 877 | * The User service. |
| 878 | 878 | */ |
| 879 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 879 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php'; |
|
| 880 | 880 | |
| 881 | 881 | /** |
| 882 | 882 | * The Timeline service. |
| 883 | 883 | */ |
| 884 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 884 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php'; |
|
| 885 | 885 | |
| 886 | 886 | /** |
| 887 | 887 | * The Topic Taxonomy service. |
| 888 | 888 | */ |
| 889 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 889 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 890 | 890 | |
| 891 | 891 | /** |
| 892 | 892 | * The SPARQL service. |
| 893 | 893 | */ |
| 894 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 894 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sparql-service.php'; |
|
| 895 | 895 | |
| 896 | 896 | /** |
| 897 | 897 | * The WordLift import service. |
| 898 | 898 | */ |
| 899 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 899 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-import-service.php'; |
|
| 900 | 900 | |
| 901 | 901 | /** |
| 902 | 902 | * The WordLift URI service. |
| 903 | 903 | */ |
| 904 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 905 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 906 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 904 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php'; |
|
| 905 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php'; |
|
| 906 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-service.php'; |
|
| 907 | 907 | |
| 908 | 908 | /** |
| 909 | 909 | * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
| 910 | 910 | */ |
| 911 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 912 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 913 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 914 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 915 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 911 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-listable.php'; |
|
| 912 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 913 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 914 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 915 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 916 | 916 | |
| 917 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 918 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 917 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 918 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php'; |
|
| 919 | 919 | |
| 920 | 920 | /** |
| 921 | 921 | * Load the converters. |
| 922 | 922 | */ |
| 923 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 924 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 925 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 926 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 927 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 928 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 923 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php'; |
|
| 924 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 925 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 926 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 927 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 928 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 929 | 929 | |
| 930 | 930 | /** |
| 931 | 931 | * Load cache-related files. |
| 932 | 932 | */ |
| 933 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 933 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/cache/require.php'; |
|
| 934 | 934 | |
| 935 | 935 | /** |
| 936 | 936 | * Load the content filter. |
| 937 | 937 | */ |
| 938 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 938 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php'; |
|
| 939 | 939 | |
| 940 | 940 | /* |
| 941 | 941 | * Load the excerpt helper. |
| 942 | 942 | */ |
| 943 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 943 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 944 | 944 | |
| 945 | 945 | /** |
| 946 | 946 | * Load the JSON-LD service to publish entities using JSON-LD.s |
| 947 | 947 | * |
| 948 | 948 | * @since 3.8.0 |
| 949 | 949 | */ |
| 950 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 950 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php'; |
|
| 951 | 951 | |
| 952 | 952 | // The Publisher Service and the AJAX adapter. |
| 953 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 954 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 953 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php'; |
|
| 954 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 955 | 955 | |
| 956 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 956 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-adapter.php'; |
|
| 957 | 957 | |
| 958 | 958 | /** |
| 959 | 959 | * Load the WordLift key validation service. |
| 960 | 960 | */ |
| 961 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 961 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php'; |
|
| 962 | 962 | |
| 963 | 963 | // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
| 964 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 964 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 965 | 965 | |
| 966 | 966 | // Load the `Wordlift_Entity_Page_Service` class definition. |
| 967 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 967 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-page-service.php'; |
|
| 968 | 968 | |
| 969 | 969 | /** Linked Data. */ |
| 970 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 971 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 972 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 973 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 974 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 975 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 976 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 977 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 978 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 979 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 980 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 970 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 971 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 972 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 973 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 974 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 975 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 976 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 977 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 978 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 979 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 980 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 981 | 981 | |
| 982 | 982 | /** Linked Data Rendition. */ |
| 983 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 984 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 986 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 983 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 984 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 985 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 986 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 987 | 987 | |
| 988 | 988 | /** Services. */ |
| 989 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 990 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 989 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 990 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-api-service.php'; |
|
| 991 | 991 | |
| 992 | 992 | /** Adapters. */ |
| 993 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 994 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 996 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 997 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 993 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php'; |
|
| 994 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php'; |
|
| 995 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 996 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-adapter.php'; |
|
| 997 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-wprocket-adapter.php'; |
|
| 998 | 998 | |
| 999 | 999 | /** Async Tasks. */ |
| 1000 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 1001 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1002 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1000 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 1001 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1002 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1003 | 1003 | |
| 1004 | 1004 | /** Autocomplete. */ |
| 1005 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1005 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1006 | 1006 | |
| 1007 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1007 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-remote-image-service.php'; |
|
| 1008 | 1008 | |
| 1009 | 1009 | /** Analytics */ |
| 1010 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1010 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1011 | 1011 | |
| 1012 | 1012 | /** |
| 1013 | 1013 | * The class responsible for defining all actions that occur in the admin area. |
| 1014 | 1014 | */ |
| 1015 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1015 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php'; |
|
| 1016 | 1016 | |
| 1017 | 1017 | /** |
| 1018 | 1018 | * The class to customize the entity list admin page. |
| 1019 | 1019 | */ |
| 1020 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1020 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php'; |
|
| 1021 | 1021 | |
| 1022 | 1022 | /** |
| 1023 | 1023 | * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
| 1024 | 1024 | */ |
| 1025 | 1025 | global $wp_version; |
| 1026 | - if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 1027 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1026 | + if (version_compare($wp_version, '5.3', '<')) { |
|
| 1027 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1028 | 1028 | } else { |
| 1029 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1029 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1030 | 1030 | } |
| 1031 | 1031 | |
| 1032 | 1032 | /** |
| 1033 | 1033 | * The Notice service. |
| 1034 | 1034 | */ |
| 1035 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1035 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php'; |
|
| 1036 | 1036 | |
| 1037 | 1037 | /** |
| 1038 | 1038 | * The PrimaShop adapter. |
| 1039 | 1039 | */ |
| 1040 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1040 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php'; |
|
| 1041 | 1041 | |
| 1042 | 1042 | /** |
| 1043 | 1043 | * The WordLift Dashboard service. |
| 1044 | 1044 | */ |
| 1045 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1045 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php'; |
|
| 1046 | 1046 | |
| 1047 | 1047 | /** |
| 1048 | 1048 | * The admin 'Install wizard' page. |
| 1049 | 1049 | */ |
| 1050 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1050 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php'; |
|
| 1051 | 1051 | |
| 1052 | 1052 | /** |
| 1053 | 1053 | * The WordLift entity type list admin page controller. |
| 1054 | 1054 | */ |
| 1055 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1055 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1056 | 1056 | |
| 1057 | 1057 | /** |
| 1058 | 1058 | * The WordLift entity type settings admin page controller. |
| 1059 | 1059 | */ |
| 1060 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1060 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php'; |
|
| 1061 | 1061 | |
| 1062 | 1062 | /** |
| 1063 | 1063 | * The admin 'Download Your Data' page. |
| 1064 | 1064 | */ |
| 1065 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1065 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php'; |
|
| 1066 | 1066 | |
| 1067 | 1067 | /** |
| 1068 | 1068 | * The admin 'WordLift Settings' page. |
| 1069 | 1069 | */ |
| 1070 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1071 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1072 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1073 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1074 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1075 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1077 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1078 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1079 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1080 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1081 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1082 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1083 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1084 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1070 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1071 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1072 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1073 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1074 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1075 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1076 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1077 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1078 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1079 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1080 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php'; |
|
| 1081 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php'; |
|
| 1082 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1083 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1084 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1085 | 1085 | |
| 1086 | 1086 | /** Admin Pages */ |
| 1087 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1088 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1089 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1090 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1087 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1088 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-status-page.php'; |
|
| 1089 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1090 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1091 | 1091 | |
| 1092 | 1092 | /** |
| 1093 | 1093 | * The class responsible for defining all actions that occur in the public-facing |
| 1094 | 1094 | * side of the site. |
| 1095 | 1095 | */ |
| 1096 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1096 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php'; |
|
| 1097 | 1097 | |
| 1098 | 1098 | /** |
| 1099 | 1099 | * The shortcode abstract class. |
| 1100 | 1100 | */ |
| 1101 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1101 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php'; |
|
| 1102 | 1102 | |
| 1103 | 1103 | /** |
| 1104 | 1104 | * The Timeline shortcode. |
| 1105 | 1105 | */ |
| 1106 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1106 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php'; |
|
| 1107 | 1107 | |
| 1108 | 1108 | /** |
| 1109 | 1109 | * The Navigator shortcode. |
| 1110 | 1110 | */ |
| 1111 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1111 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php'; |
|
| 1112 | 1112 | |
| 1113 | 1113 | /** |
| 1114 | 1114 | * The Products Navigator shortcode. |
| 1115 | 1115 | */ |
| 1116 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 1116 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 1117 | 1117 | |
| 1118 | 1118 | /** |
| 1119 | 1119 | * The chord shortcode. |
| 1120 | 1120 | */ |
| 1121 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1121 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php'; |
|
| 1122 | 1122 | |
| 1123 | 1123 | /** |
| 1124 | 1124 | * The geomap shortcode. |
| 1125 | 1125 | */ |
| 1126 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1126 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php'; |
|
| 1127 | 1127 | |
| 1128 | 1128 | /** |
| 1129 | 1129 | * The entity cloud shortcode. |
| 1130 | 1130 | */ |
| 1131 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1131 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1132 | 1132 | |
| 1133 | 1133 | /** |
| 1134 | 1134 | * The entity glossary shortcode. |
| 1135 | 1135 | */ |
| 1136 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1137 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1136 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-alphabet-service.php'; |
|
| 1137 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1138 | 1138 | |
| 1139 | 1139 | /** |
| 1140 | 1140 | * Faceted Search shortcode. |
| 1141 | 1141 | */ |
| 1142 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1142 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1143 | 1143 | |
| 1144 | 1144 | /** |
| 1145 | 1145 | * The ShareThis service. |
| 1146 | 1146 | */ |
| 1147 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1147 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php'; |
|
| 1148 | 1148 | |
| 1149 | 1149 | /** |
| 1150 | 1150 | * The SEO service. |
| 1151 | 1151 | */ |
| 1152 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1152 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php'; |
|
| 1153 | 1153 | |
| 1154 | 1154 | /** |
| 1155 | 1155 | * The AMP service. |
| 1156 | 1156 | */ |
| 1157 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1157 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php'; |
|
| 1158 | 1158 | |
| 1159 | 1159 | /** Widgets */ |
| 1160 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1161 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1162 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1160 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php'; |
|
| 1161 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1162 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-context-cards.php'; |
|
| 1163 | 1163 | |
| 1164 | 1164 | /* |
| 1165 | 1165 | * Schema.org Services. |
| 1166 | 1166 | * |
| 1167 | 1167 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1168 | 1168 | */ |
| 1169 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1170 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1171 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1172 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1169 | + if (WL_ALL_ENTITY_TYPES) { |
|
| 1170 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1171 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1172 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1173 | 1173 | new Wordlift_Schemaorg_Sync_Service(); |
| 1174 | 1174 | $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
| 1175 | 1175 | new Wordlift_Schemaorg_Class_Service(); |
@@ -1181,25 +1181,25 @@ discard block |
||
| 1181 | 1181 | |
| 1182 | 1182 | // Instantiate a global logger. |
| 1183 | 1183 | global $wl_logger; |
| 1184 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1184 | + $wl_logger = Wordlift_Log_Service::get_logger('WordLift'); |
|
| 1185 | 1185 | |
| 1186 | 1186 | // Load the `wl-api` end-point. |
| 1187 | 1187 | new Wordlift_Http_Api(); |
| 1188 | 1188 | |
| 1189 | 1189 | // Load the Install Service. |
| 1190 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1190 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-service.php'; |
|
| 1191 | 1191 | $this->install_service = new Wordlift_Install_Service(); |
| 1192 | 1192 | |
| 1193 | 1193 | /** Services. */ |
| 1194 | 1194 | // Create the configuration service. |
| 1195 | 1195 | $this->configuration_service = new Wordlift_Configuration_Service(); |
| 1196 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1196 | + $api_service = new Wordlift_Api_Service($this->configuration_service); |
|
| 1197 | 1197 | |
| 1198 | 1198 | // Create an entity type service instance. It'll be later bound to the init action. |
| 1199 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1199 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path()); |
|
| 1200 | 1200 | |
| 1201 | 1201 | // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
| 1202 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1202 | + $this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_post_type_service, $this->configuration_service->get_entity_base_path()); |
|
| 1203 | 1203 | |
| 1204 | 1204 | // Create an instance of the UI service. |
| 1205 | 1205 | $this->ui_service = new Wordlift_UI_Service(); |
@@ -1208,34 +1208,34 @@ discard block |
||
| 1208 | 1208 | $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
| 1209 | 1209 | |
| 1210 | 1210 | $this->sparql_service = new Wordlift_Sparql_Service(); |
| 1211 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1211 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service($this->sparql_service); |
|
| 1212 | 1212 | $this->notice_service = new Wordlift_Notice_Service(); |
| 1213 | 1213 | $this->relation_service = new Wordlift_Relation_Service(); |
| 1214 | 1214 | |
| 1215 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1216 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1217 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1218 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1215 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'entity_uri/'); |
|
| 1216 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service($this->configuration_service, $entity_uri_cache_service); |
|
| 1217 | + $this->entity_service = new Wordlift_Entity_Service($this->ui_service, $this->relation_service, $this->entity_uri_service); |
|
| 1218 | + $this->user_service = new Wordlift_User_Service($this->sparql_service, $this->entity_service); |
|
| 1219 | 1219 | |
| 1220 | 1220 | // Instantiate the JSON-LD service. |
| 1221 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1221 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
| 1222 | 1222 | |
| 1223 | 1223 | /** Linked Data. */ |
| 1224 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1225 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1224 | + $this->storage_factory = new Wordlift_Storage_Factory($this->entity_service, $this->user_service, $property_getter); |
|
| 1225 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory($this->entity_service); |
|
| 1226 | 1226 | |
| 1227 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1227 | + $this->schema_service = new Wordlift_Schema_Service($this->storage_factory, $this->rendition_factory, $this->configuration_service); |
|
| 1228 | 1228 | |
| 1229 | 1229 | // Create a new instance of the Redirect service. |
| 1230 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1231 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1230 | + $this->redirect_service = new Wordlift_Redirect_Service($this->entity_uri_service); |
|
| 1231 | + $this->entity_type_service = new Wordlift_Entity_Type_Service($this->schema_service); |
|
| 1232 | 1232 | |
| 1233 | - if ( ! apply_filters( 'wl_features__enable__legacy_linked_data', true ) ) { |
|
| 1234 | - new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1233 | + if ( ! apply_filters('wl_features__enable__legacy_linked_data', true)) { |
|
| 1234 | + new Wordlift_Linked_Data_Service($this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service); |
|
| 1235 | 1235 | } |
| 1236 | 1236 | |
| 1237 | 1237 | // Create a new instance of the Timeline service and Timeline shortcode. |
| 1238 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1238 | + $this->timeline_service = new Wordlift_Timeline_Service($this->entity_service, $this->entity_type_service); |
|
| 1239 | 1239 | |
| 1240 | 1240 | $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
| 1241 | 1241 | |
@@ -1249,36 +1249,36 @@ discard block |
||
| 1249 | 1249 | $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
| 1250 | 1250 | |
| 1251 | 1251 | // Create an import service instance to hook later to WP's import function. |
| 1252 | - $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() ); |
|
| 1252 | + $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 | 1253 | |
| 1254 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1254 | + $uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']); |
|
| 1255 | 1255 | |
| 1256 | 1256 | // Create the entity rating service. |
| 1257 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1257 | + $this->rating_service = new Wordlift_Rating_Service($this->entity_service, $this->entity_type_service, $this->notice_service); |
|
| 1258 | 1258 | |
| 1259 | 1259 | // Create entity list customization (wp-admin/edit.php). |
| 1260 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1260 | + $this->entity_list_service = new Wordlift_Entity_List_Service($this->rating_service); |
|
| 1261 | 1261 | |
| 1262 | 1262 | // Create a new instance of the Redirect service. |
| 1263 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1263 | + $this->dashboard_service = new Wordlift_Dashboard_Service($this->rating_service, $this->entity_service); |
|
| 1264 | 1264 | |
| 1265 | 1265 | // Create an instance of the Publisher Service and the AJAX Adapter. |
| 1266 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1267 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1268 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1266 | + $this->publisher_service = new Wordlift_Publisher_Service($this->configuration_service); |
|
| 1267 | + $this->property_factory = new Wordlift_Property_Factory($schema_url_property_service); |
|
| 1268 | + $this->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service); |
|
| 1269 | 1269 | |
| 1270 | 1270 | $attachment_service = new Wordlift_Attachment_Service(); |
| 1271 | 1271 | |
| 1272 | 1272 | // Instantiate the JSON-LD service. |
| 1273 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1274 | - $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 ); |
|
| 1275 | - $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 ); |
|
| 1276 | - $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 ); |
|
| 1277 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1273 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
| 1274 | + $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); |
|
| 1275 | + $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); |
|
| 1276 | + $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); |
|
| 1277 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service); |
|
| 1278 | 1278 | |
| 1279 | - $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1280 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache ); |
|
| 1281 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1279 | + $jsonld_cache = new Ttl_Cache('jsonld', 86400); |
|
| 1280 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter($this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache); |
|
| 1281 | + $this->jsonld_service = new Wordlift_Jsonld_Service($this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter); |
|
| 1282 | 1282 | |
| 1283 | 1283 | /* |
| 1284 | 1284 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
@@ -1287,24 +1287,24 @@ discard block |
||
| 1287 | 1287 | * |
| 1288 | 1288 | * @since 3.20.0 |
| 1289 | 1289 | */ |
| 1290 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1291 | - $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1292 | - $jsonld_service = new Jsonld_Service( $this->jsonld_service, $term_jsonld_adapter ); |
|
| 1293 | - new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service ); |
|
| 1290 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1291 | + $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter($this->entity_uri_service, $this->jsonld_service); |
|
| 1292 | + $jsonld_service = new Jsonld_Service($this->jsonld_service, $term_jsonld_adapter); |
|
| 1293 | + new Jsonld_Endpoint($jsonld_service, $this->entity_uri_service); |
|
| 1294 | 1294 | |
| 1295 | 1295 | // Prints the JSON-LD in the head. |
| 1296 | - new Jsonld_Adapter( $this->jsonld_service ); |
|
| 1296 | + new Jsonld_Adapter($this->jsonld_service); |
|
| 1297 | 1297 | |
| 1298 | - new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service ); |
|
| 1298 | + new Jsonld_By_Id_Endpoint($this->jsonld_service, $this->entity_uri_service); |
|
| 1299 | 1299 | |
| 1300 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1301 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1300 | + $this->key_validation_service = new Wordlift_Key_Validation_Service($this->configuration_service); |
|
| 1301 | + $this->content_filter_service = new Wordlift_Content_Filter_Service($this->entity_service, $this->configuration_service, $this->entity_uri_service); |
|
| 1302 | 1302 | // Creating Faq Content filter service. |
| 1303 | 1303 | $this->faq_content_filter_service = new Faq_Content_Filter(); |
| 1304 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1305 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1306 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1307 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->entity_service ); |
|
| 1304 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service($this->content_filter_service, $this->entity_service); |
|
| 1305 | + $this->sample_data_service = new Wordlift_Sample_Data_Service($this->entity_type_service, $this->configuration_service, $this->user_service); |
|
| 1306 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter($this->sample_data_service); |
|
| 1307 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service($this->entity_service); |
|
| 1308 | 1308 | |
| 1309 | 1309 | /** |
| 1310 | 1310 | * Filter: wl_feature__enable__blocks. |
@@ -1314,16 +1314,16 @@ discard block |
||
| 1314 | 1314 | * @return bool |
| 1315 | 1315 | * @since 3.27.6 |
| 1316 | 1316 | */ |
| 1317 | - $enabled_blocks = array( 'wordlift/products-navigator' ); |
|
| 1317 | + $enabled_blocks = array('wordlift/products-navigator'); |
|
| 1318 | 1318 | |
| 1319 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1319 | + if (apply_filters('wl_feature__enable__blocks', true)) { |
|
| 1320 | 1320 | // Initialize the short-codes. |
| 1321 | 1321 | new Wordlift_Navigator_Shortcode(); |
| 1322 | 1322 | new Wordlift_Chord_Shortcode(); |
| 1323 | 1323 | new Wordlift_Geomap_Shortcode(); |
| 1324 | 1324 | new Wordlift_Timeline_Shortcode(); |
| 1325 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1326 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1325 | + new Wordlift_Related_Entities_Cloud_Shortcode($this->relation_service); |
|
| 1326 | + new Wordlift_Vocabulary_Shortcode($this->configuration_service); |
|
| 1327 | 1327 | new Wordlift_Faceted_Search_Shortcode(); |
| 1328 | 1328 | |
| 1329 | 1329 | // To intimate JS |
@@ -1339,10 +1339,10 @@ discard block |
||
| 1339 | 1339 | } |
| 1340 | 1340 | |
| 1341 | 1341 | new Wordlift_Products_Navigator_Shortcode(); |
| 1342 | - add_action( 'wp_enqueue_scripts', function () use ( $enabled_blocks ) { |
|
| 1343 | - wp_register_script( 'wl_enabled_blocks', false ); |
|
| 1344 | - wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 1345 | - wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 1342 | + add_action('wp_enqueue_scripts', function() use ($enabled_blocks) { |
|
| 1343 | + wp_register_script('wl_enabled_blocks', false); |
|
| 1344 | + wp_localize_script('wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks); |
|
| 1345 | + wp_enqueue_script('wl_enabled_blocks'); |
|
| 1346 | 1346 | } ); |
| 1347 | 1347 | |
| 1348 | 1348 | // Initialize the Context Cards Service |
@@ -1352,18 +1352,18 @@ discard block |
||
| 1352 | 1352 | new Wordlift_Seo_Service(); |
| 1353 | 1353 | |
| 1354 | 1354 | // Initialize the AMP service. |
| 1355 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1355 | + new Wordlift_AMP_Service($this->jsonld_service); |
|
| 1356 | 1356 | |
| 1357 | 1357 | /** Services. */ |
| 1358 | 1358 | $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
| 1359 | 1359 | new Wordlift_Image_Service(); |
| 1360 | 1360 | |
| 1361 | 1361 | /** Adapters. */ |
| 1362 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1363 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1364 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1362 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter($this->entity_type_service); |
|
| 1363 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter($this->publisher_service); |
|
| 1364 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter($this); |
|
| 1365 | 1365 | //$this->faq_tinymce_adapter = new Faq_Tinymce_Adapter(); |
| 1366 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1366 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter($this->relation_rebuild_service); |
|
| 1367 | 1367 | |
| 1368 | 1368 | /* |
| 1369 | 1369 | * Exclude our public js from WP-Rocket. |
@@ -1393,14 +1393,14 @@ discard block |
||
| 1393 | 1393 | $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
| 1394 | 1394 | $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
| 1395 | 1395 | $tabs_element = new Wordlift_Admin_Tabs_Element(); |
| 1396 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1397 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1396 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element($this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element); |
|
| 1397 | + $this->author_element = new Wordlift_Admin_Author_Element($this->publisher_service, $this->select2_element); |
|
| 1398 | 1398 | |
| 1399 | - $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 ); |
|
| 1400 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1399 | + $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); |
|
| 1400 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($this->settings_page); |
|
| 1401 | 1401 | |
| 1402 | - $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1403 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1402 | + $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page($this->configuration_service, $this->input_element, $this->radio_input_element); |
|
| 1403 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link($this->analytics_settings_page); |
|
| 1404 | 1404 | $this->analytics_connect = new Wordlift_Analytics_Connect(); |
| 1405 | 1405 | |
| 1406 | 1406 | // Pages. |
@@ -1411,9 +1411,9 @@ discard block |
||
| 1411 | 1411 | * |
| 1412 | 1412 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1413 | 1413 | */ |
| 1414 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1415 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1416 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1414 | + if (apply_filters('wl_can_see_classification_box', true)) { |
|
| 1415 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1416 | + new Wordlift_Admin_Post_Edit_Page($this); |
|
| 1417 | 1417 | } |
| 1418 | 1418 | new Wordlift_Entity_Type_Admin_Service(); |
| 1419 | 1419 | |
@@ -1427,23 +1427,23 @@ discard block |
||
| 1427 | 1427 | $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
| 1428 | 1428 | |
| 1429 | 1429 | /* WordPress Admin. */ |
| 1430 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1431 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1430 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service); |
|
| 1431 | + $this->status_page = new Wordlift_Admin_Status_Page($this->entity_service, $this->sparql_service); |
|
| 1432 | 1432 | |
| 1433 | 1433 | // Create an instance of the install wizard. |
| 1434 | - $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 ); |
|
| 1434 | + $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); |
|
| 1435 | 1435 | |
| 1436 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1436 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($this->entity_post_type_service); |
|
| 1437 | 1437 | |
| 1438 | 1438 | // User Profile. |
| 1439 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1439 | + new Wordlift_Admin_User_Profile_Page($this->author_element, $this->user_service); |
|
| 1440 | 1440 | |
| 1441 | 1441 | $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
| 1442 | 1442 | |
| 1443 | 1443 | // Load the debug service if WP is in debug mode. |
| 1444 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1445 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1446 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1444 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 1445 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php'; |
|
| 1446 | + new Wordlift_Debug_Service($this->entity_service, $uri_service); |
|
| 1447 | 1447 | } |
| 1448 | 1448 | |
| 1449 | 1449 | // Remote Image Service. |
@@ -1456,12 +1456,12 @@ discard block |
||
| 1456 | 1456 | * |
| 1457 | 1457 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1458 | 1458 | */ |
| 1459 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1460 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1461 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1459 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-batch-action.php'; |
|
| 1460 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1461 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1462 | 1462 | |
| 1463 | 1463 | // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
| 1464 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1464 | + new Wordlift_Mapping_Ajax_Adapter(new Wordlift_Mapping_Service(Wordlift_Entity_Type_Service::get_instance())); |
|
| 1465 | 1465 | |
| 1466 | 1466 | /* |
| 1467 | 1467 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
@@ -1470,8 +1470,8 @@ discard block |
||
| 1470 | 1470 | * |
| 1471 | 1471 | * @since 3.20.0 |
| 1472 | 1472 | */ |
| 1473 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1474 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1473 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1474 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1475 | 1475 | |
| 1476 | 1476 | /* |
| 1477 | 1477 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
@@ -1480,8 +1480,8 @@ discard block |
||
| 1480 | 1480 | * |
| 1481 | 1481 | * @since 3.20.0 |
| 1482 | 1482 | */ |
| 1483 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1484 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1483 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1484 | + new Wordlift_Search_Keyword_Taxonomy($api_service); |
|
| 1485 | 1485 | |
| 1486 | 1486 | /* |
| 1487 | 1487 | * Load the Mappings JSON-LD post processing. |
@@ -1494,11 +1494,11 @@ discard block |
||
| 1494 | 1494 | new Post_Type_Rule_Validator(); |
| 1495 | 1495 | // Taxonomy term rule validator for validating rules for term pages. |
| 1496 | 1496 | new Taxonomy_Term_Rule_Validator(); |
| 1497 | - $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1498 | - $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1499 | - $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1497 | + $rule_validators_registry = new Rule_Validators_Registry($default_rule_validator); |
|
| 1498 | + $rule_groups_validator = new Rule_Groups_Validator($rule_validators_registry); |
|
| 1499 | + $mappings_validator = new Mappings_Validator($mappings_dbo, $rule_groups_validator); |
|
| 1500 | 1500 | |
| 1501 | - new Url_To_Entity_Transform_Function( $this->entity_uri_service ); |
|
| 1501 | + new Url_To_Entity_Transform_Function($this->entity_uri_service); |
|
| 1502 | 1502 | new Taxonomy_To_Terms_Transform_Function(); |
| 1503 | 1503 | new Post_Id_To_Entity_Transform_Function(); |
| 1504 | 1504 | $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
@@ -1508,7 +1508,7 @@ discard block |
||
| 1508 | 1508 | * Intiailize the acf group data formatter. |
| 1509 | 1509 | */ |
| 1510 | 1510 | new Acf_Group_Formatter(); |
| 1511 | - new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1511 | + new Jsonld_Converter($mappings_validator, $mappings_transform_functions_registry); |
|
| 1512 | 1512 | |
| 1513 | 1513 | /** |
| 1514 | 1514 | * @since 3.26.0 |
@@ -1529,7 +1529,7 @@ discard block |
||
| 1529 | 1529 | /* |
| 1530 | 1530 | * Create a singleton for the Analysis_Response_Ops_Factory. |
| 1531 | 1531 | */ |
| 1532 | - $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service ); |
|
| 1532 | + $entity_helper = new Entity_Helper($this->entity_uri_service, $this->entity_service); |
|
| 1533 | 1533 | new Analysis_Response_Ops_Factory( |
| 1534 | 1534 | $this->entity_uri_service, |
| 1535 | 1535 | $this->entity_service, |
@@ -1539,11 +1539,11 @@ discard block |
||
| 1539 | 1539 | ); |
| 1540 | 1540 | |
| 1541 | 1541 | /** WL Autocomplete. */ |
| 1542 | - $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1542 | + $autocomplete_service = new All_Autocomplete_Service(array( |
|
| 1543 | 1543 | new Local_Autocomplete_Service(), |
| 1544 | - new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ), |
|
| 1545 | - ) ); |
|
| 1546 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1544 | + new Linked_Data_Autocomplete_Service($this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service), |
|
| 1545 | + )); |
|
| 1546 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter($autocomplete_service); |
|
| 1547 | 1547 | |
| 1548 | 1548 | /** |
| 1549 | 1549 | * @since 3.27.2 |
@@ -1552,10 +1552,10 @@ discard block |
||
| 1552 | 1552 | */ |
| 1553 | 1553 | new Recipe_Maker_Post_Type_Hook(); |
| 1554 | 1554 | $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
| 1555 | - new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1556 | - new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1557 | - new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1558 | - new Yoast_Jsonld( $recipe_maker_validation_service ); |
|
| 1555 | + new Recipe_Maker_Jsonld_Hook($attachment_service, $recipe_maker_validation_service); |
|
| 1556 | + new Recipe_Maker_After_Get_Jsonld_Hook($recipe_maker_validation_service); |
|
| 1557 | + new Recipe_Maker_Warning($recipe_maker_validation_service); |
|
| 1558 | + new Yoast_Jsonld($recipe_maker_validation_service); |
|
| 1559 | 1559 | |
| 1560 | 1560 | /** |
| 1561 | 1561 | * @since 3.27.4 |
@@ -1576,9 +1576,9 @@ discard block |
||
| 1576 | 1576 | private function set_locale() { |
| 1577 | 1577 | |
| 1578 | 1578 | $plugin_i18n = new Wordlift_i18n(); |
| 1579 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1579 | + $plugin_i18n->set_domain($this->get_plugin_name()); |
|
| 1580 | 1580 | |
| 1581 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1581 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
| 1582 | 1582 | |
| 1583 | 1583 | } |
| 1584 | 1584 | |
@@ -1599,29 +1599,29 @@ discard block |
||
| 1599 | 1599 | $this->user_service |
| 1600 | 1600 | ); |
| 1601 | 1601 | |
| 1602 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1603 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1602 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
| 1603 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11); |
|
| 1604 | 1604 | |
| 1605 | 1605 | // Hook the init action to taxonomy services. |
| 1606 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1607 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1606 | + $this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0); |
|
| 1607 | + $this->loader->add_action('init', $this->entity_types_taxonomy_service, 'init', 0); |
|
| 1608 | 1608 | |
| 1609 | 1609 | // Hook the deleted_post_meta action to the Thumbnail service. |
| 1610 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1610 | + $this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4); |
|
| 1611 | 1611 | |
| 1612 | 1612 | // Hook the added_post_meta action to the Thumbnail service. |
| 1613 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1613 | + $this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 1614 | 1614 | |
| 1615 | 1615 | // Hook the updated_post_meta action to the Thumbnail service. |
| 1616 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1616 | + $this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 1617 | 1617 | |
| 1618 | 1618 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1619 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1619 | + $this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 1620 | 1620 | |
| 1621 | 1621 | // Register custom allowed redirect hosts. |
| 1622 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1622 | + $this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts'); |
|
| 1623 | 1623 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
| 1624 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1624 | + $this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect'); |
|
| 1625 | 1625 | |
| 1626 | 1626 | /* |
| 1627 | 1627 | * The old dashboard is replaced with dashboard v2. |
@@ -1639,46 +1639,46 @@ discard block |
||
| 1639 | 1639 | |
| 1640 | 1640 | // Hook save_post to the entity service to update custom fields (such as alternate labels). |
| 1641 | 1641 | // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
| 1642 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1643 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1642 | + $this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3); |
|
| 1643 | + $this->loader->add_action('save_post', $this->rating_service, 'set_rating_for', 20, 1); |
|
| 1644 | 1644 | |
| 1645 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1646 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1645 | + $this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1); |
|
| 1646 | + $this->loader->add_action('in_admin_header', $this->rating_service, 'in_admin_header'); |
|
| 1647 | 1647 | |
| 1648 | 1648 | // Entity listing customization (wp-admin/edit.php) |
| 1649 | 1649 | // Add custom columns. |
| 1650 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1650 | + $this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns'); |
|
| 1651 | 1651 | // no explicit entity as it prevents handling of other post types. |
| 1652 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1652 | + $this->loader->add_filter('manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2); |
|
| 1653 | 1653 | // Add 4W selection. |
| 1654 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1655 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1656 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1657 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1654 | + $this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope'); |
|
| 1655 | + $this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope'); |
|
| 1656 | + $this->loader->add_action('pre_get_posts', $this->entity_list_service, 'pre_get_posts'); |
|
| 1657 | + $this->loader->add_action('load-edit.php', $this->entity_list_service, 'load_edit'); |
|
| 1658 | 1658 | |
| 1659 | 1659 | /* |
| 1660 | 1660 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1661 | 1661 | * |
| 1662 | 1662 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1663 | 1663 | */ |
| 1664 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1665 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1664 | + if ( ! WL_ALL_ENTITY_TYPES) { |
|
| 1665 | + $this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args'); |
|
| 1666 | 1666 | } |
| 1667 | 1667 | |
| 1668 | 1668 | // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
| 1669 | 1669 | // entities. |
| 1670 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1670 | + $this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2); |
|
| 1671 | 1671 | |
| 1672 | 1672 | // Filter imported post meta. |
| 1673 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1673 | + $this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3); |
|
| 1674 | 1674 | |
| 1675 | 1675 | // Notify the import service when an import starts and ends. |
| 1676 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1677 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1676 | + $this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0); |
|
| 1677 | + $this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0); |
|
| 1678 | 1678 | |
| 1679 | 1679 | // Hook the AJAX wl_rebuild action to the Rebuild Service. |
| 1680 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1681 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1680 | + $this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild'); |
|
| 1681 | + $this->loader->add_action('wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild'); |
|
| 1682 | 1682 | |
| 1683 | 1683 | /** |
| 1684 | 1684 | * Filter: wl_feature__enable__screens. |
@@ -1688,34 +1688,34 @@ discard block |
||
| 1688 | 1688 | * @return bool |
| 1689 | 1689 | * @since 3.27.6 |
| 1690 | 1690 | */ |
| 1691 | - if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1691 | + if (apply_filters('wl_feature__enable__screens', true)) { |
|
| 1692 | 1692 | // Hook the menu to the Download Your Data page. |
| 1693 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1694 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1695 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1693 | + $this->loader->add_action('admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0); |
|
| 1694 | + $this->loader->add_action('admin_menu', $this->status_page, 'admin_menu', 100, 0); |
|
| 1695 | + $this->loader->add_action('admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0); |
|
| 1696 | 1696 | } |
| 1697 | 1697 | // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
| 1698 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1698 | + $this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10); |
|
| 1699 | 1699 | |
| 1700 | 1700 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1701 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1702 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1703 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1701 | + $this->loader->add_action('wp_ajax_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1702 | + $this->loader->add_action('admin_post_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1703 | + $this->loader->add_action('admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1704 | 1704 | |
| 1705 | 1705 | // Hook the AJAX wl_validate_key action to the Key Validation service. |
| 1706 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1706 | + $this->loader->add_action('wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key'); |
|
| 1707 | 1707 | |
| 1708 | 1708 | // Hook the AJAX wl_update_country_options action to the countries. |
| 1709 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1709 | + $this->loader->add_action('wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html'); |
|
| 1710 | 1710 | |
| 1711 | 1711 | // Hook the `admin_init` function to the Admin Setup. |
| 1712 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1712 | + $this->loader->add_action('admin_init', $this->admin_setup, 'admin_init'); |
|
| 1713 | 1713 | |
| 1714 | 1714 | // Hook the admin_init to the settings page. |
| 1715 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1716 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1715 | + $this->loader->add_action('admin_init', $this->settings_page, 'admin_init'); |
|
| 1716 | + $this->loader->add_action('admin_init', $this->analytics_settings_page, 'admin_init'); |
|
| 1717 | 1717 | |
| 1718 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1718 | + $this->loader->add_filter('admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction'); |
|
| 1719 | 1719 | |
| 1720 | 1720 | // Hook the menu creation on the general wordlift menu creation. |
| 1721 | 1721 | /** |
@@ -1726,8 +1726,8 @@ discard block |
||
| 1726 | 1726 | * @return bool |
| 1727 | 1727 | * @since 3.27.6 |
| 1728 | 1728 | */ |
| 1729 | - if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1730 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1729 | + if (apply_filters('wl_feature__enable__screens', true)) { |
|
| 1730 | + $this->loader->add_action('wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2); |
|
| 1731 | 1731 | } |
| 1732 | 1732 | /* |
| 1733 | 1733 | * Display the `Wordlift_Admin_Search_Rankings_Page` page. |
@@ -1736,7 +1736,7 @@ discard block |
||
| 1736 | 1736 | * |
| 1737 | 1737 | * @since 3.20.0 |
| 1738 | 1738 | */ |
| 1739 | - if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1739 | + if (in_array($this->configuration_service->get_package_type(), array('editorial', 'business'))) { |
|
| 1740 | 1740 | /** |
| 1741 | 1741 | * Filter: wl_feature__enable__screens. |
| 1742 | 1742 | * |
@@ -1745,18 +1745,18 @@ discard block |
||
| 1745 | 1745 | * @return bool |
| 1746 | 1746 | * @since 3.27.6 |
| 1747 | 1747 | */ |
| 1748 | - if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1748 | + if (apply_filters('wl_feature__enable__screens', true)) { |
|
| 1749 | 1749 | $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
| 1750 | - $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1750 | + $this->loader->add_action('wl_admin_menu', $admin_search_rankings_page, 'admin_menu'); |
|
| 1751 | 1751 | } |
| 1752 | 1752 | } |
| 1753 | 1753 | |
| 1754 | 1754 | // Hook key update. |
| 1755 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1756 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1755 | + $this->loader->add_action('pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2); |
|
| 1756 | + $this->loader->add_action('update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2); |
|
| 1757 | 1757 | |
| 1758 | 1758 | // Add additional action links to the WordLift plugin in the plugins page. |
| 1759 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1759 | + $this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1); |
|
| 1760 | 1760 | |
| 1761 | 1761 | /* |
| 1762 | 1762 | * Remove the Analytics Settings link from the plugin page. |
@@ -1767,25 +1767,25 @@ discard block |
||
| 1767 | 1767 | // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
| 1768 | 1768 | |
| 1769 | 1769 | // Hook the AJAX `wl_publisher` action name. |
| 1770 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1770 | + $this->loader->add_action('wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher'); |
|
| 1771 | 1771 | |
| 1772 | 1772 | // Hook row actions for the entity type list admin. |
| 1773 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1773 | + $this->loader->add_filter('wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2); |
|
| 1774 | 1774 | |
| 1775 | 1775 | /** Ajax actions. */ |
| 1776 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1776 | + $this->loader->add_action('wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export'); |
|
| 1777 | 1777 | |
| 1778 | 1778 | // Hook capabilities manipulation to allow access to entity type admin |
| 1779 | 1779 | // page on WordPress versions before 4.7. |
| 1780 | 1780 | global $wp_version; |
| 1781 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1782 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1781 | + if (version_compare($wp_version, '4.7', '<')) { |
|
| 1782 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4); |
|
| 1783 | 1783 | } |
| 1784 | 1784 | |
| 1785 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1785 | + $this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
| 1786 | 1786 | |
| 1787 | 1787 | /** Adapters. */ |
| 1788 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1788 | + $this->loader->add_filter('mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1); |
|
| 1789 | 1789 | /** |
| 1790 | 1790 | * Disabling Faq temporarily. |
| 1791 | 1791 | * Load the tinymce editor button on the tool bar. |
@@ -1796,59 +1796,59 @@ discard block |
||
| 1796 | 1796 | //$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
| 1797 | 1797 | |
| 1798 | 1798 | |
| 1799 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1800 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1801 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1799 | + $this->loader->add_action('wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all'); |
|
| 1800 | + $this->loader->add_action('wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create'); |
|
| 1801 | + $this->loader->add_action('wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete'); |
|
| 1802 | 1802 | /** |
| 1803 | 1803 | * @since 3.26.0 |
| 1804 | 1804 | * Post excerpt meta box would be only loaded when the language is set |
| 1805 | 1805 | * to english |
| 1806 | 1806 | */ |
| 1807 | - if ( $this->configuration_service->get_language_code() === 'en' && |
|
| 1808 | - apply_filters( 'wl_feature__enable__post_excerpt', true ) ) { |
|
| 1807 | + if ($this->configuration_service->get_language_code() === 'en' && |
|
| 1808 | + apply_filters('wl_feature__enable__post_excerpt', true)) { |
|
| 1809 | 1809 | $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
| 1810 | - $this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1810 | + $this->loader->add_action('do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box'); |
|
| 1811 | 1811 | // Adding Rest route for the post excerpt |
| 1812 | 1812 | Post_Excerpt_Rest_Controller::register_routes(); |
| 1813 | 1813 | } |
| 1814 | 1814 | |
| 1815 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1816 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1815 | + $this->loader->add_action('update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5); |
|
| 1816 | + $this->loader->add_action('delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5); |
|
| 1817 | 1817 | |
| 1818 | 1818 | // Handle the autocomplete request. |
| 1819 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1819 | + add_action('wp_ajax_wl_autocomplete', array( |
|
| 1820 | 1820 | $this->autocomplete_adapter, |
| 1821 | 1821 | 'wl_autocomplete', |
| 1822 | - ) ); |
|
| 1823 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1822 | + )); |
|
| 1823 | + add_action('wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1824 | 1824 | $this->autocomplete_adapter, |
| 1825 | 1825 | 'wl_autocomplete', |
| 1826 | - ) ); |
|
| 1826 | + )); |
|
| 1827 | 1827 | |
| 1828 | 1828 | // Hooks to restrict multisite super admin from manipulating entity types. |
| 1829 | - if ( is_multisite() ) { |
|
| 1830 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1829 | + if (is_multisite()) { |
|
| 1830 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4); |
|
| 1831 | 1831 | } |
| 1832 | 1832 | |
| 1833 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1833 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback($this->configuration_service); |
|
| 1834 | 1834 | |
| 1835 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1836 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1837 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1835 | + add_action('admin_footer', array($deactivator_feedback, 'render_feedback_popup')); |
|
| 1836 | + add_action('admin_enqueue_scripts', array($deactivator_feedback, 'enqueue_popup_scripts')); |
|
| 1837 | + add_action('wp_ajax_wl_deactivation_feedback', array($deactivator_feedback, 'wl_deactivation_feedback')); |
|
| 1838 | 1838 | |
| 1839 | 1839 | /** |
| 1840 | 1840 | * Always allow the `wordlift/classification` block. |
| 1841 | 1841 | * |
| 1842 | 1842 | * @since 3.23.0 |
| 1843 | 1843 | */ |
| 1844 | - add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1844 | + add_filter('allowed_block_types', function($value) { |
|
| 1845 | 1845 | |
| 1846 | - if ( true === $value ) { |
|
| 1846 | + if (true === $value) { |
|
| 1847 | 1847 | return $value; |
| 1848 | 1848 | } |
| 1849 | 1849 | |
| 1850 | - return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1851 | - }, PHP_INT_MAX ); |
|
| 1850 | + return array_merge((array) $value, array('wordlift/classification')); |
|
| 1851 | + }, PHP_INT_MAX); |
|
| 1852 | 1852 | |
| 1853 | 1853 | } |
| 1854 | 1854 | |
@@ -1861,58 +1861,58 @@ discard block |
||
| 1861 | 1861 | */ |
| 1862 | 1862 | private function define_public_hooks() { |
| 1863 | 1863 | |
| 1864 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1864 | + $plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version()); |
|
| 1865 | 1865 | |
| 1866 | 1866 | // Register the entity post type. |
| 1867 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1867 | + $this->loader->add_action('init', $this->entity_post_type_service, 'register'); |
|
| 1868 | 1868 | |
| 1869 | 1869 | // Bind the link generation and handling hooks to the entity link service. |
| 1870 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1871 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1872 | - $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 ); |
|
| 1873 | - $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 ); |
|
| 1870 | + $this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4); |
|
| 1871 | + $this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1); |
|
| 1872 | + $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); |
|
| 1873 | + $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); |
|
| 1874 | 1874 | |
| 1875 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1876 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1877 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1875 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
| 1876 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
| 1877 | + $this->loader->add_action('wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts'); |
|
| 1878 | 1878 | |
| 1879 | 1879 | // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
| 1880 | - $this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1880 | + $this->loader->add_filter('the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags'); |
|
| 1881 | 1881 | // Hook the content filter service to add entity links. |
| 1882 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1883 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1882 | + if ( ! defined('WL_DISABLE_CONTENT_FILTER') || ! WL_DISABLE_CONTENT_FILTER) { |
|
| 1883 | + $this->loader->add_filter('the_content', $this->content_filter_service, 'the_content'); |
|
| 1884 | 1884 | } |
| 1885 | 1885 | |
| 1886 | 1886 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1887 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1887 | + $this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 1888 | 1888 | |
| 1889 | 1889 | // Hook the ShareThis service. |
| 1890 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1891 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1890 | + $this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99); |
|
| 1891 | + $this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99); |
|
| 1892 | 1892 | |
| 1893 | 1893 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1894 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1894 | + $this->loader->add_action('wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1895 | 1895 | |
| 1896 | 1896 | // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
| 1897 | 1897 | // in order to tweak WP's `WP_Query` to include entities in queries related |
| 1898 | 1898 | // to categories. |
| 1899 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1899 | + $this->loader->add_action('pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1); |
|
| 1900 | 1900 | |
| 1901 | 1901 | /* |
| 1902 | 1902 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1903 | 1903 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1904 | 1904 | * order of start time. |
| 1905 | 1905 | */ |
| 1906 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1906 | + $this->loader->add_action('pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1); |
|
| 1907 | 1907 | |
| 1908 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1908 | + $this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
| 1909 | 1909 | |
| 1910 | 1910 | // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
| 1911 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1911 | + $this->loader->add_action('save_post', $this->entity_type_adapter, 'save_post', 9, 3); |
|
| 1912 | 1912 | |
| 1913 | 1913 | // Analytics Script Frontend. |
| 1914 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1915 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1914 | + if ($this->configuration_service->is_analytics_enable()) { |
|
| 1915 | + $this->loader->add_action('wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10); |
|
| 1916 | 1916 | } |
| 1917 | 1917 | |
| 1918 | 1918 | } |
@@ -1965,11 +1965,11 @@ discard block |
||
| 1965 | 1965 | */ |
| 1966 | 1966 | private function load_cli_dependencies() { |
| 1967 | 1967 | |
| 1968 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1968 | + require_once plugin_dir_path(dirname(__FILE__)).'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1969 | 1969 | |
| 1970 | - $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 ); |
|
| 1970 | + $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); |
|
| 1971 | 1971 | |
| 1972 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1972 | + WP_CLI::add_command('wl references push', $push_reference_data_command); |
|
| 1973 | 1973 | |
| 1974 | 1974 | } |
| 1975 | 1975 | |
@@ -15,432 +15,432 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Wordlift_Post_To_Jsonld_Converter extends Wordlift_Abstract_Post_To_Jsonld_Converter { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * A {@link Wordlift_Configuration_Service} instance. |
|
| 20 | - * |
|
| 21 | - * @since 3.10.0 |
|
| 22 | - * @access private |
|
| 23 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 24 | - */ |
|
| 25 | - private $configuration_service; |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * A {@link Wordlift_Log_Service} instance. |
|
| 29 | - * |
|
| 30 | - * @since 3.10.0 |
|
| 31 | - * @access private |
|
| 32 | - * @var Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 33 | - */ |
|
| 34 | - private $log; |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * Wordlift_Post_To_Jsonld_Converter constructor. |
|
| 38 | - * |
|
| 39 | - * @param \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 40 | - * @param \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
| 41 | - * @param \Wordlift_User_Service $user_service A {@link Wordlift_User_Service} instance. |
|
| 42 | - * @param \Wordlift_Attachment_Service $attachment_service A {@link Wordlift_Attachment_Service} instance. |
|
| 43 | - * @param \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 44 | - * |
|
| 45 | - * @since 3.10.0 |
|
| 46 | - * |
|
| 47 | - */ |
|
| 48 | - public function __construct( $entity_type_service, $entity_service, $user_service, $attachment_service, $configuration_service ) { |
|
| 49 | - parent::__construct( $entity_type_service, $entity_service, $user_service, $attachment_service ); |
|
| 50 | - |
|
| 51 | - $this->configuration_service = $configuration_service; |
|
| 52 | - |
|
| 53 | - // Set a reference to the logger. |
|
| 54 | - $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Post_To_Jsonld_Converter' ); |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * Convert the provided {@link WP_Post} to a JSON-LD array. Any entity reference |
|
| 59 | - * found while processing the post is set in the $references array. |
|
| 60 | - * |
|
| 61 | - * @param int $post_id The post id. |
|
| 62 | - * @param array $references An array of entity references. |
|
| 63 | - * @param array $references_infos |
|
| 64 | - * |
|
| 65 | - * @return array A JSON-LD array. |
|
| 66 | - * @since 3.10.0 |
|
| 67 | - */ |
|
| 68 | - public function convert( $post_id, &$references = array(), &$references_infos = array() ) { |
|
| 69 | - |
|
| 70 | - // Get the post instance. |
|
| 71 | - if ( null === $post = get_post( $post_id ) ) { |
|
| 72 | - // Post not found. |
|
| 73 | - return null; |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - // Get the base JSON-LD and the list of entities referenced by this entity. |
|
| 77 | - $jsonld = parent::convert( $post_id, $references, $references_infos ); |
|
| 78 | - |
|
| 79 | - // Set WebPage by default. |
|
| 80 | - if ( empty( $jsonld['@type'] ) ) { |
|
| 81 | - $jsonld['@type'] = 'WebPage'; |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - // Get the entity name. |
|
| 85 | - $jsonld['headline'] = $post->post_title; |
|
| 86 | - |
|
| 87 | - // Set the published and modified dates. |
|
| 88 | - /* |
|
| 18 | + /** |
|
| 19 | + * A {@link Wordlift_Configuration_Service} instance. |
|
| 20 | + * |
|
| 21 | + * @since 3.10.0 |
|
| 22 | + * @access private |
|
| 23 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 24 | + */ |
|
| 25 | + private $configuration_service; |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * A {@link Wordlift_Log_Service} instance. |
|
| 29 | + * |
|
| 30 | + * @since 3.10.0 |
|
| 31 | + * @access private |
|
| 32 | + * @var Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 33 | + */ |
|
| 34 | + private $log; |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * Wordlift_Post_To_Jsonld_Converter constructor. |
|
| 38 | + * |
|
| 39 | + * @param \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 40 | + * @param \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
| 41 | + * @param \Wordlift_User_Service $user_service A {@link Wordlift_User_Service} instance. |
|
| 42 | + * @param \Wordlift_Attachment_Service $attachment_service A {@link Wordlift_Attachment_Service} instance. |
|
| 43 | + * @param \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 44 | + * |
|
| 45 | + * @since 3.10.0 |
|
| 46 | + * |
|
| 47 | + */ |
|
| 48 | + public function __construct( $entity_type_service, $entity_service, $user_service, $attachment_service, $configuration_service ) { |
|
| 49 | + parent::__construct( $entity_type_service, $entity_service, $user_service, $attachment_service ); |
|
| 50 | + |
|
| 51 | + $this->configuration_service = $configuration_service; |
|
| 52 | + |
|
| 53 | + // Set a reference to the logger. |
|
| 54 | + $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Post_To_Jsonld_Converter' ); |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * Convert the provided {@link WP_Post} to a JSON-LD array. Any entity reference |
|
| 59 | + * found while processing the post is set in the $references array. |
|
| 60 | + * |
|
| 61 | + * @param int $post_id The post id. |
|
| 62 | + * @param array $references An array of entity references. |
|
| 63 | + * @param array $references_infos |
|
| 64 | + * |
|
| 65 | + * @return array A JSON-LD array. |
|
| 66 | + * @since 3.10.0 |
|
| 67 | + */ |
|
| 68 | + public function convert( $post_id, &$references = array(), &$references_infos = array() ) { |
|
| 69 | + |
|
| 70 | + // Get the post instance. |
|
| 71 | + if ( null === $post = get_post( $post_id ) ) { |
|
| 72 | + // Post not found. |
|
| 73 | + return null; |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + // Get the base JSON-LD and the list of entities referenced by this entity. |
|
| 77 | + $jsonld = parent::convert( $post_id, $references, $references_infos ); |
|
| 78 | + |
|
| 79 | + // Set WebPage by default. |
|
| 80 | + if ( empty( $jsonld['@type'] ) ) { |
|
| 81 | + $jsonld['@type'] = 'WebPage'; |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + // Get the entity name. |
|
| 85 | + $jsonld['headline'] = $post->post_title; |
|
| 86 | + |
|
| 87 | + // Set the published and modified dates. |
|
| 88 | + /* |
|
| 89 | 89 | * Set the `datePublished` and `dateModified` using the local timezone. |
| 90 | 90 | * |
| 91 | 91 | * @see https://github.com/insideout10/wordlift-plugin/issues/887 |
| 92 | 92 | * |
| 93 | 93 | * @since 3.20.0 |
| 94 | 94 | */ |
| 95 | - try { |
|
| 96 | - $default_timezone = date_default_timezone_get(); |
|
| 97 | - $timezone = get_option( 'timezone_string' ); |
|
| 98 | - if ( ! empty( $timezone ) ) { |
|
| 99 | - date_default_timezone_set( $timezone ); |
|
| 100 | - } |
|
| 101 | - $jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i:sP', false, $post ); |
|
| 102 | - $jsonld['dateModified'] = get_post_modified_time( 'Y-m-d\TH:i:sP', false, $post ); |
|
| 103 | - date_default_timezone_set( $default_timezone ); |
|
| 104 | - } catch ( Exception $e ) { |
|
| 105 | - $jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false ); |
|
| 106 | - $jsonld['dateModified'] = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false ); |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - // Get the word count for the post. |
|
| 110 | - /* |
|
| 95 | + try { |
|
| 96 | + $default_timezone = date_default_timezone_get(); |
|
| 97 | + $timezone = get_option( 'timezone_string' ); |
|
| 98 | + if ( ! empty( $timezone ) ) { |
|
| 99 | + date_default_timezone_set( $timezone ); |
|
| 100 | + } |
|
| 101 | + $jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i:sP', false, $post ); |
|
| 102 | + $jsonld['dateModified'] = get_post_modified_time( 'Y-m-d\TH:i:sP', false, $post ); |
|
| 103 | + date_default_timezone_set( $default_timezone ); |
|
| 104 | + } catch ( Exception $e ) { |
|
| 105 | + $jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false ); |
|
| 106 | + $jsonld['dateModified'] = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false ); |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + // Get the word count for the post. |
|
| 110 | + /* |
|
| 111 | 111 | * Do not display the `wordCount` on a `WebPage`. |
| 112 | 112 | * |
| 113 | 113 | * @see https://github.com/insideout10/wordlift-plugin/issues/888 |
| 114 | 114 | * |
| 115 | 115 | * @since 3.20.0 |
| 116 | 116 | */ |
| 117 | - if ( ! empty( $jsonld['@type'] ) && 'WebPage' !== $jsonld['@type'] ) { |
|
| 118 | - $post_adapter = new Wordlift_Post_Adapter( $post_id ); |
|
| 119 | - $jsonld['wordCount'] = $post_adapter->word_count(); |
|
| 120 | - } |
|
| 117 | + if ( ! empty( $jsonld['@type'] ) && 'WebPage' !== $jsonld['@type'] ) { |
|
| 118 | + $post_adapter = new Wordlift_Post_Adapter( $post_id ); |
|
| 119 | + $jsonld['wordCount'] = $post_adapter->word_count(); |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - /* |
|
| 122 | + /* |
|
| 123 | 123 | * Add keywords, articleSection, commentCount and inLanguage properties to `Article` JSON-LD |
| 124 | 124 | * |
| 125 | 125 | * @see https://github.com/insideout10/wordlift-plugin/issues/1140 |
| 126 | 126 | * |
| 127 | 127 | * @since 3.27.2 |
| 128 | 128 | */ |
| 129 | - if ( ! empty( $jsonld['@type'] ) && 'Article' === $jsonld['@type'] ) { |
|
| 130 | - $post_adapter = new Wordlift_Post_Adapter( $post_id ); |
|
| 131 | - $keywords = $post_adapter->keywords(); |
|
| 132 | - $article_section = $post_adapter->article_section(); |
|
| 133 | - $comment_count = $post_adapter->comment_count(); |
|
| 134 | - $locale = $post_adapter->locale(); |
|
| 135 | - |
|
| 136 | - if ( isset( $keywords ) ) { |
|
| 137 | - $jsonld['keywords'] = $keywords; |
|
| 138 | - } |
|
| 139 | - if ( isset( $article_section ) ) { |
|
| 140 | - $jsonld['articleSection'] = $article_section; |
|
| 141 | - } |
|
| 142 | - $jsonld['commentCount'] = $comment_count; |
|
| 143 | - $jsonld['inLanguage'] = $locale; |
|
| 144 | - $post_adapter->add_mentions( $post_id, $references ); |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - // Set the publisher. |
|
| 148 | - $this->set_publisher( $jsonld ); |
|
| 149 | - |
|
| 150 | - // Process the references if any. |
|
| 151 | - if ( 0 < count( $references ) ) { |
|
| 152 | - |
|
| 153 | - // Prepare the `about` and `mentions` array. |
|
| 154 | - $about = $mentions = array(); |
|
| 155 | - |
|
| 156 | - // If the entity is in the title, then it should be an `about`. |
|
| 157 | - foreach ( $references as $reference ) { |
|
| 158 | - |
|
| 159 | - // Get the entity labels. |
|
| 160 | - $labels = $this->entity_service->get_labels( $reference ); |
|
| 161 | - |
|
| 162 | - // Get the entity URI. |
|
| 163 | - $item = array( |
|
| 164 | - '@id' => $this->entity_service->get_uri( $reference ), |
|
| 165 | - ); |
|
| 166 | - |
|
| 167 | - $escaped_labels = array_map( function ( $value ) { |
|
| 168 | - return preg_quote( $value, '/' ); |
|
| 169 | - }, $labels ); |
|
| 170 | - |
|
| 171 | - // Check if the labels match any part of the title. |
|
| 172 | - $matches = 1 === preg_match( '/' . implode( '|', $escaped_labels ) . '/', $post->post_title ); |
|
| 173 | - |
|
| 174 | - // If the title matches, assign the entity to the about, otherwise to the mentions. |
|
| 175 | - if ( $matches ) { |
|
| 176 | - $about[] = $item; |
|
| 177 | - } else { |
|
| 178 | - $mentions[] = $item; |
|
| 179 | - } |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - // If we have abouts, assign them to the JSON-LD. |
|
| 183 | - if ( 0 < count( $about ) ) { |
|
| 184 | - $jsonld['about'] = $about; |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - // If we have mentions, assign them to the JSON-LD. |
|
| 188 | - if ( 0 < count( $mentions ) ) { |
|
| 189 | - $jsonld['mentions'] = $mentions; |
|
| 190 | - } |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - // Finally set the author. |
|
| 194 | - $jsonld['author'] = $this->get_author( $post->post_author, $references ); |
|
| 195 | - |
|
| 196 | - /** |
|
| 197 | - * Call the `wl_post_jsonld_array` filter. This filter allows 3rd parties to also modify the references. |
|
| 198 | - * |
|
| 199 | - * @param array $value { |
|
| 200 | - * |
|
| 201 | - * @type array $jsonld The JSON-LD structure. |
|
| 202 | - * @type int[] $references An array of post IDs. |
|
| 203 | - * } |
|
| 204 | - * @since 3.25.0 |
|
| 205 | - * |
|
| 206 | - * @see https://www.geeklab.info/2010/04/wordpress-pass-variables-by-reference-with-apply_filter/ |
|
| 207 | - * |
|
| 208 | - * @api |
|
| 209 | - */ |
|
| 210 | - $ret_val = apply_filters( 'wl_post_jsonld_array', array( |
|
| 211 | - 'jsonld' => $jsonld, |
|
| 212 | - 'references' => $references, |
|
| 213 | - ), $post_id ); |
|
| 214 | - $jsonld = $ret_val['jsonld']; |
|
| 215 | - $references = $ret_val['references']; |
|
| 216 | - |
|
| 217 | - /** |
|
| 218 | - * Call the `wl_post_jsonld` filter. |
|
| 219 | - * |
|
| 220 | - * @param array $jsonld The JSON-LD structure. |
|
| 221 | - * @param int $post_id The {@link WP_Post} `id`. |
|
| 222 | - * @param array $references The array of referenced entities. |
|
| 223 | - * |
|
| 224 | - * @since 3.14.0 |
|
| 225 | - * |
|
| 226 | - * @api |
|
| 227 | - */ |
|
| 228 | - return apply_filters( 'wl_post_jsonld', $jsonld, $post_id, $references ); |
|
| 229 | - } |
|
| 230 | - |
|
| 231 | - /** |
|
| 232 | - * Get the author's JSON-LD fragment. |
|
| 233 | - * |
|
| 234 | - * The JSON-LD fragment is generated using the {@link WP_User}'s data or |
|
| 235 | - * the referenced entity if configured for the {@link WP_User}. |
|
| 236 | - * |
|
| 237 | - * @param int $author_id The author {@link WP_User}'s `id`. |
|
| 238 | - * @param array $references An array of referenced entities. |
|
| 239 | - * |
|
| 240 | - * @return string|array A JSON-LD structure. |
|
| 241 | - * @since 3.14.0 |
|
| 242 | - * |
|
| 243 | - */ |
|
| 244 | - private function get_author( $author_id, &$references ) { |
|
| 245 | - |
|
| 246 | - // Get the entity bound to this user. |
|
| 247 | - $entity_id = $this->user_service->get_entity( $author_id ); |
|
| 248 | - |
|
| 249 | - // If there's no entity bound return a simple author structure. |
|
| 250 | - if ( empty( $entity_id ) || 'publish' !== get_post_status( $entity_id ) ) { |
|
| 251 | - |
|
| 252 | - $author = get_the_author_meta( 'display_name', $author_id ); |
|
| 253 | - $author_uri = $this->user_service->get_uri( $author_id ); |
|
| 254 | - |
|
| 255 | - return array( |
|
| 256 | - '@type' => 'Person', |
|
| 257 | - '@id' => $author_uri, |
|
| 258 | - 'name' => $author, |
|
| 259 | - ); |
|
| 260 | - } |
|
| 261 | - |
|
| 262 | - // Add the author to the references. |
|
| 263 | - $author_uri = $this->entity_service->get_uri( $entity_id ); |
|
| 264 | - $references[] = $entity_id; |
|
| 265 | - |
|
| 266 | - // Return the JSON-LD for the referenced entity. |
|
| 267 | - return array( |
|
| 268 | - '@id' => $author_uri, |
|
| 269 | - ); |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - /** |
|
| 273 | - * Enrich the provided params array with publisher data, if available. |
|
| 274 | - * |
|
| 275 | - * @param array $params The parameters array. |
|
| 276 | - * |
|
| 277 | - * @since 3.10.0 |
|
| 278 | - * |
|
| 279 | - */ |
|
| 280 | - protected function set_publisher( &$params ) { |
|
| 281 | - |
|
| 282 | - // If the publisher id isn't set don't do anything. |
|
| 283 | - if ( null === $publisher_id = $this->configuration_service->get_publisher_id() ) { |
|
| 284 | - return; |
|
| 285 | - } |
|
| 286 | - |
|
| 287 | - // Get the post instance. |
|
| 288 | - if ( null === $post = get_post( $publisher_id ) ) { |
|
| 289 | - // Publisher not found. |
|
| 290 | - return; |
|
| 291 | - } |
|
| 292 | - |
|
| 293 | - // Get the item id. |
|
| 294 | - $id = $this->entity_service->get_uri( $publisher_id ); |
|
| 295 | - |
|
| 296 | - // Get the type. |
|
| 297 | - $type = $this->entity_type_service->get( $publisher_id ); |
|
| 298 | - |
|
| 299 | - // Get the name. |
|
| 300 | - $name = $post->post_title; |
|
| 301 | - |
|
| 302 | - // Set the publisher data. |
|
| 303 | - $params['publisher'] = array( |
|
| 304 | - '@type' => $this->relative_to_context( $type['uri'] ), |
|
| 305 | - '@id' => $id, |
|
| 306 | - 'name' => $name, |
|
| 307 | - ); |
|
| 308 | - |
|
| 309 | - // Add the sameAs values associated with the publisher. |
|
| 310 | - $storage_factory = Wordlift_Storage_Factory::get_instance(); |
|
| 311 | - $sameas = $storage_factory->post_meta( Wordlift_Schema_Service::FIELD_SAME_AS )->get( $publisher_id ); |
|
| 312 | - if ( ! empty( $sameas ) ) { |
|
| 313 | - $params['publisher']['sameAs'] = $sameas; |
|
| 314 | - } |
|
| 315 | - |
|
| 316 | - // Set the logo, only for http://schema.org/Organization as Person doesn't |
|
| 317 | - // support the logo property. |
|
| 318 | - // |
|
| 319 | - // See http://schema.org/logo. |
|
| 320 | - if ( 'http://schema.org/Organization' !== $type['uri'] ) { |
|
| 321 | - return; |
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - // Get the publisher logo. |
|
| 325 | - $publisher_logo = $this->get_publisher_logo( $post->ID ); |
|
| 326 | - |
|
| 327 | - // Bail out if the publisher logo isn't set. |
|
| 328 | - if ( false === $publisher_logo ) { |
|
| 329 | - return; |
|
| 330 | - } |
|
| 331 | - |
|
| 332 | - // Copy over some useful properties. |
|
| 333 | - // |
|
| 334 | - // See https://developers.google.com/search/docs/data-types/articles. |
|
| 335 | - $params['publisher']['logo']['@type'] = 'ImageObject'; |
|
| 336 | - $params['publisher']['logo']['url'] = $publisher_logo['url']; |
|
| 337 | - |
|
| 338 | - // If you specify a "width" or "height" value you should leave out |
|
| 339 | - // 'px'. For example: "width":"4608px" should be "width":"4608". |
|
| 340 | - // |
|
| 341 | - // See https://github.com/insideout10/wordlift-plugin/issues/451. |
|
| 342 | - $params['publisher']['logo']['width'] = $publisher_logo['width']; |
|
| 343 | - $params['publisher']['logo']['height'] = $publisher_logo['height']; |
|
| 344 | - |
|
| 345 | - } |
|
| 346 | - |
|
| 347 | - /** |
|
| 348 | - * Get the publisher logo structure. |
|
| 349 | - * |
|
| 350 | - * The function returns false when the publisher logo cannot be determined, i.e.: |
|
| 351 | - * - the post has no featured image. |
|
| 352 | - * - the featured image has no file. |
|
| 353 | - * - a wp_image_editor instance cannot be instantiated on the original file or on the publisher logo file. |
|
| 354 | - * |
|
| 355 | - * @param int $post_id The post id. |
|
| 356 | - * |
|
| 357 | - * @return array|false Returns an array with the `url`, `width` and `height` for the publisher logo or false in case |
|
| 358 | - * of errors. |
|
| 359 | - * @since 3.19.2 |
|
| 360 | - * @see https://github.com/insideout10/wordlift-plugin/issues/823 related issue. |
|
| 361 | - * |
|
| 362 | - */ |
|
| 363 | - private function get_publisher_logo( $post_id ) { |
|
| 364 | - |
|
| 365 | - // Get the featured image for the post. |
|
| 366 | - $thumbnail_id = get_post_thumbnail_id( $post_id ); |
|
| 367 | - |
|
| 368 | - // Bail out if thumbnail not available. |
|
| 369 | - if ( empty( $thumbnail_id ) || 0 === $thumbnail_id ) { |
|
| 370 | - $this->log->info( "Featured image not set for post $post_id." ); |
|
| 371 | - |
|
| 372 | - return false; |
|
| 373 | - } |
|
| 374 | - |
|
| 375 | - // Get the uploads base URL. |
|
| 376 | - $uploads_dir = wp_upload_dir(); |
|
| 377 | - |
|
| 378 | - // Get the attachment metadata. |
|
| 379 | - $metadata = wp_get_attachment_metadata( $thumbnail_id ); |
|
| 380 | - |
|
| 381 | - // Bail out if the file isn't set. |
|
| 382 | - if ( ! isset( $metadata['file'] ) ) { |
|
| 383 | - $this->log->warn( "Featured image file not found for post $post_id." ); |
|
| 384 | - |
|
| 385 | - return false; |
|
| 386 | - } |
|
| 387 | - |
|
| 388 | - // Retrieve the relative filename, e.g. "2018/05/logo_publisher.png" |
|
| 389 | - $path = $uploads_dir['basedir'] . DIRECTORY_SEPARATOR . $metadata['file']; |
|
| 390 | - |
|
| 391 | - // Use image src, if local file does not exist. @see https://github.com/insideout10/wordlift-plugin/issues/1149 |
|
| 392 | - if ( ! file_exists( $path ) ) { |
|
| 393 | - $this->log->warn( "Featured image file $path doesn't exist for post $post_id." ); |
|
| 394 | - |
|
| 395 | - $attachment_image_src = wp_get_attachment_image_src( $thumbnail_id, '' ); |
|
| 396 | - if ( $attachment_image_src ) { |
|
| 397 | - return array( |
|
| 398 | - 'url' => $attachment_image_src[0], |
|
| 399 | - 'width' => $attachment_image_src[1], |
|
| 400 | - 'height' => $attachment_image_src[2], |
|
| 401 | - ); |
|
| 402 | - } |
|
| 403 | - |
|
| 404 | - // Bail out if we cant fetch wp_get_attachment_image_src |
|
| 405 | - return false; |
|
| 406 | - |
|
| 407 | - } |
|
| 408 | - |
|
| 409 | - // Try to get the image editor and bail out if the editor cannot be instantiated. |
|
| 410 | - $original_file_editor = wp_get_image_editor( $path ); |
|
| 411 | - if ( is_wp_error( $original_file_editor ) ) { |
|
| 412 | - $this->log->warn( "Cannot instantiate WP Image Editor on file $path for post $post_id." ); |
|
| 413 | - |
|
| 414 | - return false; |
|
| 415 | - } |
|
| 416 | - |
|
| 417 | - // Generate the publisher logo filename, we cannot use the `width` and `height` because we're scaling |
|
| 418 | - // and we don't actually know the end values. |
|
| 419 | - $publisher_logo_path = $original_file_editor->generate_filename( '-publisher-logo' ); |
|
| 420 | - |
|
| 421 | - // If the file doesn't exist yet, create it. |
|
| 422 | - if ( ! file_exists( $publisher_logo_path ) ) { |
|
| 423 | - $original_file_editor->resize( 600, 60 ); |
|
| 424 | - $original_file_editor->save( $publisher_logo_path ); |
|
| 425 | - } |
|
| 426 | - |
|
| 427 | - // Try to get the image editor and bail out if the editor cannot be instantiated. |
|
| 428 | - $publisher_logo_editor = wp_get_image_editor( $publisher_logo_path ); |
|
| 429 | - if ( is_wp_error( $publisher_logo_editor ) ) { |
|
| 430 | - $this->log->warn( "Cannot instantiate WP Image Editor on file $publisher_logo_path for post $post_id." ); |
|
| 431 | - |
|
| 432 | - return false; |
|
| 433 | - } |
|
| 434 | - |
|
| 435 | - // Get the actual size. |
|
| 436 | - $size = $publisher_logo_editor->get_size(); |
|
| 437 | - |
|
| 438 | - // Finally return the array with data. |
|
| 439 | - return array( |
|
| 440 | - 'url' => $uploads_dir['baseurl'] . substr( $publisher_logo_path, strlen( $uploads_dir['basedir'] ) ), |
|
| 441 | - 'width' => $size['width'], |
|
| 442 | - 'height' => $size['height'], |
|
| 443 | - ); |
|
| 444 | - } |
|
| 129 | + if ( ! empty( $jsonld['@type'] ) && 'Article' === $jsonld['@type'] ) { |
|
| 130 | + $post_adapter = new Wordlift_Post_Adapter( $post_id ); |
|
| 131 | + $keywords = $post_adapter->keywords(); |
|
| 132 | + $article_section = $post_adapter->article_section(); |
|
| 133 | + $comment_count = $post_adapter->comment_count(); |
|
| 134 | + $locale = $post_adapter->locale(); |
|
| 135 | + |
|
| 136 | + if ( isset( $keywords ) ) { |
|
| 137 | + $jsonld['keywords'] = $keywords; |
|
| 138 | + } |
|
| 139 | + if ( isset( $article_section ) ) { |
|
| 140 | + $jsonld['articleSection'] = $article_section; |
|
| 141 | + } |
|
| 142 | + $jsonld['commentCount'] = $comment_count; |
|
| 143 | + $jsonld['inLanguage'] = $locale; |
|
| 144 | + $post_adapter->add_mentions( $post_id, $references ); |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + // Set the publisher. |
|
| 148 | + $this->set_publisher( $jsonld ); |
|
| 149 | + |
|
| 150 | + // Process the references if any. |
|
| 151 | + if ( 0 < count( $references ) ) { |
|
| 152 | + |
|
| 153 | + // Prepare the `about` and `mentions` array. |
|
| 154 | + $about = $mentions = array(); |
|
| 155 | + |
|
| 156 | + // If the entity is in the title, then it should be an `about`. |
|
| 157 | + foreach ( $references as $reference ) { |
|
| 158 | + |
|
| 159 | + // Get the entity labels. |
|
| 160 | + $labels = $this->entity_service->get_labels( $reference ); |
|
| 161 | + |
|
| 162 | + // Get the entity URI. |
|
| 163 | + $item = array( |
|
| 164 | + '@id' => $this->entity_service->get_uri( $reference ), |
|
| 165 | + ); |
|
| 166 | + |
|
| 167 | + $escaped_labels = array_map( function ( $value ) { |
|
| 168 | + return preg_quote( $value, '/' ); |
|
| 169 | + }, $labels ); |
|
| 170 | + |
|
| 171 | + // Check if the labels match any part of the title. |
|
| 172 | + $matches = 1 === preg_match( '/' . implode( '|', $escaped_labels ) . '/', $post->post_title ); |
|
| 173 | + |
|
| 174 | + // If the title matches, assign the entity to the about, otherwise to the mentions. |
|
| 175 | + if ( $matches ) { |
|
| 176 | + $about[] = $item; |
|
| 177 | + } else { |
|
| 178 | + $mentions[] = $item; |
|
| 179 | + } |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + // If we have abouts, assign them to the JSON-LD. |
|
| 183 | + if ( 0 < count( $about ) ) { |
|
| 184 | + $jsonld['about'] = $about; |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + // If we have mentions, assign them to the JSON-LD. |
|
| 188 | + if ( 0 < count( $mentions ) ) { |
|
| 189 | + $jsonld['mentions'] = $mentions; |
|
| 190 | + } |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + // Finally set the author. |
|
| 194 | + $jsonld['author'] = $this->get_author( $post->post_author, $references ); |
|
| 195 | + |
|
| 196 | + /** |
|
| 197 | + * Call the `wl_post_jsonld_array` filter. This filter allows 3rd parties to also modify the references. |
|
| 198 | + * |
|
| 199 | + * @param array $value { |
|
| 200 | + * |
|
| 201 | + * @type array $jsonld The JSON-LD structure. |
|
| 202 | + * @type int[] $references An array of post IDs. |
|
| 203 | + * } |
|
| 204 | + * @since 3.25.0 |
|
| 205 | + * |
|
| 206 | + * @see https://www.geeklab.info/2010/04/wordpress-pass-variables-by-reference-with-apply_filter/ |
|
| 207 | + * |
|
| 208 | + * @api |
|
| 209 | + */ |
|
| 210 | + $ret_val = apply_filters( 'wl_post_jsonld_array', array( |
|
| 211 | + 'jsonld' => $jsonld, |
|
| 212 | + 'references' => $references, |
|
| 213 | + ), $post_id ); |
|
| 214 | + $jsonld = $ret_val['jsonld']; |
|
| 215 | + $references = $ret_val['references']; |
|
| 216 | + |
|
| 217 | + /** |
|
| 218 | + * Call the `wl_post_jsonld` filter. |
|
| 219 | + * |
|
| 220 | + * @param array $jsonld The JSON-LD structure. |
|
| 221 | + * @param int $post_id The {@link WP_Post} `id`. |
|
| 222 | + * @param array $references The array of referenced entities. |
|
| 223 | + * |
|
| 224 | + * @since 3.14.0 |
|
| 225 | + * |
|
| 226 | + * @api |
|
| 227 | + */ |
|
| 228 | + return apply_filters( 'wl_post_jsonld', $jsonld, $post_id, $references ); |
|
| 229 | + } |
|
| 230 | + |
|
| 231 | + /** |
|
| 232 | + * Get the author's JSON-LD fragment. |
|
| 233 | + * |
|
| 234 | + * The JSON-LD fragment is generated using the {@link WP_User}'s data or |
|
| 235 | + * the referenced entity if configured for the {@link WP_User}. |
|
| 236 | + * |
|
| 237 | + * @param int $author_id The author {@link WP_User}'s `id`. |
|
| 238 | + * @param array $references An array of referenced entities. |
|
| 239 | + * |
|
| 240 | + * @return string|array A JSON-LD structure. |
|
| 241 | + * @since 3.14.0 |
|
| 242 | + * |
|
| 243 | + */ |
|
| 244 | + private function get_author( $author_id, &$references ) { |
|
| 245 | + |
|
| 246 | + // Get the entity bound to this user. |
|
| 247 | + $entity_id = $this->user_service->get_entity( $author_id ); |
|
| 248 | + |
|
| 249 | + // If there's no entity bound return a simple author structure. |
|
| 250 | + if ( empty( $entity_id ) || 'publish' !== get_post_status( $entity_id ) ) { |
|
| 251 | + |
|
| 252 | + $author = get_the_author_meta( 'display_name', $author_id ); |
|
| 253 | + $author_uri = $this->user_service->get_uri( $author_id ); |
|
| 254 | + |
|
| 255 | + return array( |
|
| 256 | + '@type' => 'Person', |
|
| 257 | + '@id' => $author_uri, |
|
| 258 | + 'name' => $author, |
|
| 259 | + ); |
|
| 260 | + } |
|
| 261 | + |
|
| 262 | + // Add the author to the references. |
|
| 263 | + $author_uri = $this->entity_service->get_uri( $entity_id ); |
|
| 264 | + $references[] = $entity_id; |
|
| 265 | + |
|
| 266 | + // Return the JSON-LD for the referenced entity. |
|
| 267 | + return array( |
|
| 268 | + '@id' => $author_uri, |
|
| 269 | + ); |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + /** |
|
| 273 | + * Enrich the provided params array with publisher data, if available. |
|
| 274 | + * |
|
| 275 | + * @param array $params The parameters array. |
|
| 276 | + * |
|
| 277 | + * @since 3.10.0 |
|
| 278 | + * |
|
| 279 | + */ |
|
| 280 | + protected function set_publisher( &$params ) { |
|
| 281 | + |
|
| 282 | + // If the publisher id isn't set don't do anything. |
|
| 283 | + if ( null === $publisher_id = $this->configuration_service->get_publisher_id() ) { |
|
| 284 | + return; |
|
| 285 | + } |
|
| 286 | + |
|
| 287 | + // Get the post instance. |
|
| 288 | + if ( null === $post = get_post( $publisher_id ) ) { |
|
| 289 | + // Publisher not found. |
|
| 290 | + return; |
|
| 291 | + } |
|
| 292 | + |
|
| 293 | + // Get the item id. |
|
| 294 | + $id = $this->entity_service->get_uri( $publisher_id ); |
|
| 295 | + |
|
| 296 | + // Get the type. |
|
| 297 | + $type = $this->entity_type_service->get( $publisher_id ); |
|
| 298 | + |
|
| 299 | + // Get the name. |
|
| 300 | + $name = $post->post_title; |
|
| 301 | + |
|
| 302 | + // Set the publisher data. |
|
| 303 | + $params['publisher'] = array( |
|
| 304 | + '@type' => $this->relative_to_context( $type['uri'] ), |
|
| 305 | + '@id' => $id, |
|
| 306 | + 'name' => $name, |
|
| 307 | + ); |
|
| 308 | + |
|
| 309 | + // Add the sameAs values associated with the publisher. |
|
| 310 | + $storage_factory = Wordlift_Storage_Factory::get_instance(); |
|
| 311 | + $sameas = $storage_factory->post_meta( Wordlift_Schema_Service::FIELD_SAME_AS )->get( $publisher_id ); |
|
| 312 | + if ( ! empty( $sameas ) ) { |
|
| 313 | + $params['publisher']['sameAs'] = $sameas; |
|
| 314 | + } |
|
| 315 | + |
|
| 316 | + // Set the logo, only for http://schema.org/Organization as Person doesn't |
|
| 317 | + // support the logo property. |
|
| 318 | + // |
|
| 319 | + // See http://schema.org/logo. |
|
| 320 | + if ( 'http://schema.org/Organization' !== $type['uri'] ) { |
|
| 321 | + return; |
|
| 322 | + } |
|
| 323 | + |
|
| 324 | + // Get the publisher logo. |
|
| 325 | + $publisher_logo = $this->get_publisher_logo( $post->ID ); |
|
| 326 | + |
|
| 327 | + // Bail out if the publisher logo isn't set. |
|
| 328 | + if ( false === $publisher_logo ) { |
|
| 329 | + return; |
|
| 330 | + } |
|
| 331 | + |
|
| 332 | + // Copy over some useful properties. |
|
| 333 | + // |
|
| 334 | + // See https://developers.google.com/search/docs/data-types/articles. |
|
| 335 | + $params['publisher']['logo']['@type'] = 'ImageObject'; |
|
| 336 | + $params['publisher']['logo']['url'] = $publisher_logo['url']; |
|
| 337 | + |
|
| 338 | + // If you specify a "width" or "height" value you should leave out |
|
| 339 | + // 'px'. For example: "width":"4608px" should be "width":"4608". |
|
| 340 | + // |
|
| 341 | + // See https://github.com/insideout10/wordlift-plugin/issues/451. |
|
| 342 | + $params['publisher']['logo']['width'] = $publisher_logo['width']; |
|
| 343 | + $params['publisher']['logo']['height'] = $publisher_logo['height']; |
|
| 344 | + |
|
| 345 | + } |
|
| 346 | + |
|
| 347 | + /** |
|
| 348 | + * Get the publisher logo structure. |
|
| 349 | + * |
|
| 350 | + * The function returns false when the publisher logo cannot be determined, i.e.: |
|
| 351 | + * - the post has no featured image. |
|
| 352 | + * - the featured image has no file. |
|
| 353 | + * - a wp_image_editor instance cannot be instantiated on the original file or on the publisher logo file. |
|
| 354 | + * |
|
| 355 | + * @param int $post_id The post id. |
|
| 356 | + * |
|
| 357 | + * @return array|false Returns an array with the `url`, `width` and `height` for the publisher logo or false in case |
|
| 358 | + * of errors. |
|
| 359 | + * @since 3.19.2 |
|
| 360 | + * @see https://github.com/insideout10/wordlift-plugin/issues/823 related issue. |
|
| 361 | + * |
|
| 362 | + */ |
|
| 363 | + private function get_publisher_logo( $post_id ) { |
|
| 364 | + |
|
| 365 | + // Get the featured image for the post. |
|
| 366 | + $thumbnail_id = get_post_thumbnail_id( $post_id ); |
|
| 367 | + |
|
| 368 | + // Bail out if thumbnail not available. |
|
| 369 | + if ( empty( $thumbnail_id ) || 0 === $thumbnail_id ) { |
|
| 370 | + $this->log->info( "Featured image not set for post $post_id." ); |
|
| 371 | + |
|
| 372 | + return false; |
|
| 373 | + } |
|
| 374 | + |
|
| 375 | + // Get the uploads base URL. |
|
| 376 | + $uploads_dir = wp_upload_dir(); |
|
| 377 | + |
|
| 378 | + // Get the attachment metadata. |
|
| 379 | + $metadata = wp_get_attachment_metadata( $thumbnail_id ); |
|
| 380 | + |
|
| 381 | + // Bail out if the file isn't set. |
|
| 382 | + if ( ! isset( $metadata['file'] ) ) { |
|
| 383 | + $this->log->warn( "Featured image file not found for post $post_id." ); |
|
| 384 | + |
|
| 385 | + return false; |
|
| 386 | + } |
|
| 387 | + |
|
| 388 | + // Retrieve the relative filename, e.g. "2018/05/logo_publisher.png" |
|
| 389 | + $path = $uploads_dir['basedir'] . DIRECTORY_SEPARATOR . $metadata['file']; |
|
| 390 | + |
|
| 391 | + // Use image src, if local file does not exist. @see https://github.com/insideout10/wordlift-plugin/issues/1149 |
|
| 392 | + if ( ! file_exists( $path ) ) { |
|
| 393 | + $this->log->warn( "Featured image file $path doesn't exist for post $post_id." ); |
|
| 394 | + |
|
| 395 | + $attachment_image_src = wp_get_attachment_image_src( $thumbnail_id, '' ); |
|
| 396 | + if ( $attachment_image_src ) { |
|
| 397 | + return array( |
|
| 398 | + 'url' => $attachment_image_src[0], |
|
| 399 | + 'width' => $attachment_image_src[1], |
|
| 400 | + 'height' => $attachment_image_src[2], |
|
| 401 | + ); |
|
| 402 | + } |
|
| 403 | + |
|
| 404 | + // Bail out if we cant fetch wp_get_attachment_image_src |
|
| 405 | + return false; |
|
| 406 | + |
|
| 407 | + } |
|
| 408 | + |
|
| 409 | + // Try to get the image editor and bail out if the editor cannot be instantiated. |
|
| 410 | + $original_file_editor = wp_get_image_editor( $path ); |
|
| 411 | + if ( is_wp_error( $original_file_editor ) ) { |
|
| 412 | + $this->log->warn( "Cannot instantiate WP Image Editor on file $path for post $post_id." ); |
|
| 413 | + |
|
| 414 | + return false; |
|
| 415 | + } |
|
| 416 | + |
|
| 417 | + // Generate the publisher logo filename, we cannot use the `width` and `height` because we're scaling |
|
| 418 | + // and we don't actually know the end values. |
|
| 419 | + $publisher_logo_path = $original_file_editor->generate_filename( '-publisher-logo' ); |
|
| 420 | + |
|
| 421 | + // If the file doesn't exist yet, create it. |
|
| 422 | + if ( ! file_exists( $publisher_logo_path ) ) { |
|
| 423 | + $original_file_editor->resize( 600, 60 ); |
|
| 424 | + $original_file_editor->save( $publisher_logo_path ); |
|
| 425 | + } |
|
| 426 | + |
|
| 427 | + // Try to get the image editor and bail out if the editor cannot be instantiated. |
|
| 428 | + $publisher_logo_editor = wp_get_image_editor( $publisher_logo_path ); |
|
| 429 | + if ( is_wp_error( $publisher_logo_editor ) ) { |
|
| 430 | + $this->log->warn( "Cannot instantiate WP Image Editor on file $publisher_logo_path for post $post_id." ); |
|
| 431 | + |
|
| 432 | + return false; |
|
| 433 | + } |
|
| 434 | + |
|
| 435 | + // Get the actual size. |
|
| 436 | + $size = $publisher_logo_editor->get_size(); |
|
| 437 | + |
|
| 438 | + // Finally return the array with data. |
|
| 439 | + return array( |
|
| 440 | + 'url' => $uploads_dir['baseurl'] . substr( $publisher_logo_path, strlen( $uploads_dir['basedir'] ) ), |
|
| 441 | + 'width' => $size['width'], |
|
| 442 | + 'height' => $size['height'], |
|
| 443 | + ); |
|
| 444 | + } |
|
| 445 | 445 | |
| 446 | 446 | } |
@@ -45,13 +45,13 @@ discard block |
||
| 45 | 45 | * @since 3.10.0 |
| 46 | 46 | * |
| 47 | 47 | */ |
| 48 | - public function __construct( $entity_type_service, $entity_service, $user_service, $attachment_service, $configuration_service ) { |
|
| 49 | - parent::__construct( $entity_type_service, $entity_service, $user_service, $attachment_service ); |
|
| 48 | + public function __construct($entity_type_service, $entity_service, $user_service, $attachment_service, $configuration_service) { |
|
| 49 | + parent::__construct($entity_type_service, $entity_service, $user_service, $attachment_service); |
|
| 50 | 50 | |
| 51 | 51 | $this->configuration_service = $configuration_service; |
| 52 | 52 | |
| 53 | 53 | // Set a reference to the logger. |
| 54 | - $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Post_To_Jsonld_Converter' ); |
|
| 54 | + $this->log = Wordlift_Log_Service::get_logger('Wordlift_Post_To_Jsonld_Converter'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -65,19 +65,19 @@ discard block |
||
| 65 | 65 | * @return array A JSON-LD array. |
| 66 | 66 | * @since 3.10.0 |
| 67 | 67 | */ |
| 68 | - public function convert( $post_id, &$references = array(), &$references_infos = array() ) { |
|
| 68 | + public function convert($post_id, &$references = array(), &$references_infos = array()) { |
|
| 69 | 69 | |
| 70 | 70 | // Get the post instance. |
| 71 | - if ( null === $post = get_post( $post_id ) ) { |
|
| 71 | + if (null === $post = get_post($post_id)) { |
|
| 72 | 72 | // Post not found. |
| 73 | 73 | return null; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // Get the base JSON-LD and the list of entities referenced by this entity. |
| 77 | - $jsonld = parent::convert( $post_id, $references, $references_infos ); |
|
| 77 | + $jsonld = parent::convert($post_id, $references, $references_infos); |
|
| 78 | 78 | |
| 79 | 79 | // Set WebPage by default. |
| 80 | - if ( empty( $jsonld['@type'] ) ) { |
|
| 80 | + if (empty($jsonld['@type'])) { |
|
| 81 | 81 | $jsonld['@type'] = 'WebPage'; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -94,16 +94,16 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | try { |
| 96 | 96 | $default_timezone = date_default_timezone_get(); |
| 97 | - $timezone = get_option( 'timezone_string' ); |
|
| 98 | - if ( ! empty( $timezone ) ) { |
|
| 99 | - date_default_timezone_set( $timezone ); |
|
| 97 | + $timezone = get_option('timezone_string'); |
|
| 98 | + if ( ! empty($timezone)) { |
|
| 99 | + date_default_timezone_set($timezone); |
|
| 100 | 100 | } |
| 101 | - $jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i:sP', false, $post ); |
|
| 102 | - $jsonld['dateModified'] = get_post_modified_time( 'Y-m-d\TH:i:sP', false, $post ); |
|
| 103 | - date_default_timezone_set( $default_timezone ); |
|
| 104 | - } catch ( Exception $e ) { |
|
| 105 | - $jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false ); |
|
| 106 | - $jsonld['dateModified'] = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false ); |
|
| 101 | + $jsonld['datePublished'] = get_post_time('Y-m-d\TH:i:sP', false, $post); |
|
| 102 | + $jsonld['dateModified'] = get_post_modified_time('Y-m-d\TH:i:sP', false, $post); |
|
| 103 | + date_default_timezone_set($default_timezone); |
|
| 104 | + } catch (Exception $e) { |
|
| 105 | + $jsonld['datePublished'] = get_post_time('Y-m-d\TH:i', true, $post, false); |
|
| 106 | + $jsonld['dateModified'] = get_post_modified_time('Y-m-d\TH:i', true, $post, false); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | // Get the word count for the post. |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | * |
| 115 | 115 | * @since 3.20.0 |
| 116 | 116 | */ |
| 117 | - if ( ! empty( $jsonld['@type'] ) && 'WebPage' !== $jsonld['@type'] ) { |
|
| 118 | - $post_adapter = new Wordlift_Post_Adapter( $post_id ); |
|
| 117 | + if ( ! empty($jsonld['@type']) && 'WebPage' !== $jsonld['@type']) { |
|
| 118 | + $post_adapter = new Wordlift_Post_Adapter($post_id); |
|
| 119 | 119 | $jsonld['wordCount'] = $post_adapter->word_count(); |
| 120 | 120 | } |
| 121 | 121 | |
@@ -126,53 +126,53 @@ discard block |
||
| 126 | 126 | * |
| 127 | 127 | * @since 3.27.2 |
| 128 | 128 | */ |
| 129 | - if ( ! empty( $jsonld['@type'] ) && 'Article' === $jsonld['@type'] ) { |
|
| 130 | - $post_adapter = new Wordlift_Post_Adapter( $post_id ); |
|
| 129 | + if ( ! empty($jsonld['@type']) && 'Article' === $jsonld['@type']) { |
|
| 130 | + $post_adapter = new Wordlift_Post_Adapter($post_id); |
|
| 131 | 131 | $keywords = $post_adapter->keywords(); |
| 132 | 132 | $article_section = $post_adapter->article_section(); |
| 133 | 133 | $comment_count = $post_adapter->comment_count(); |
| 134 | 134 | $locale = $post_adapter->locale(); |
| 135 | 135 | |
| 136 | - if ( isset( $keywords ) ) { |
|
| 136 | + if (isset($keywords)) { |
|
| 137 | 137 | $jsonld['keywords'] = $keywords; |
| 138 | 138 | } |
| 139 | - if ( isset( $article_section ) ) { |
|
| 139 | + if (isset($article_section)) { |
|
| 140 | 140 | $jsonld['articleSection'] = $article_section; |
| 141 | 141 | } |
| 142 | 142 | $jsonld['commentCount'] = $comment_count; |
| 143 | 143 | $jsonld['inLanguage'] = $locale; |
| 144 | - $post_adapter->add_mentions( $post_id, $references ); |
|
| 144 | + $post_adapter->add_mentions($post_id, $references); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // Set the publisher. |
| 148 | - $this->set_publisher( $jsonld ); |
|
| 148 | + $this->set_publisher($jsonld); |
|
| 149 | 149 | |
| 150 | 150 | // Process the references if any. |
| 151 | - if ( 0 < count( $references ) ) { |
|
| 151 | + if (0 < count($references)) { |
|
| 152 | 152 | |
| 153 | 153 | // Prepare the `about` and `mentions` array. |
| 154 | 154 | $about = $mentions = array(); |
| 155 | 155 | |
| 156 | 156 | // If the entity is in the title, then it should be an `about`. |
| 157 | - foreach ( $references as $reference ) { |
|
| 157 | + foreach ($references as $reference) { |
|
| 158 | 158 | |
| 159 | 159 | // Get the entity labels. |
| 160 | - $labels = $this->entity_service->get_labels( $reference ); |
|
| 160 | + $labels = $this->entity_service->get_labels($reference); |
|
| 161 | 161 | |
| 162 | 162 | // Get the entity URI. |
| 163 | 163 | $item = array( |
| 164 | - '@id' => $this->entity_service->get_uri( $reference ), |
|
| 164 | + '@id' => $this->entity_service->get_uri($reference), |
|
| 165 | 165 | ); |
| 166 | 166 | |
| 167 | - $escaped_labels = array_map( function ( $value ) { |
|
| 168 | - return preg_quote( $value, '/' ); |
|
| 169 | - }, $labels ); |
|
| 167 | + $escaped_labels = array_map(function($value) { |
|
| 168 | + return preg_quote($value, '/'); |
|
| 169 | + }, $labels); |
|
| 170 | 170 | |
| 171 | 171 | // Check if the labels match any part of the title. |
| 172 | - $matches = 1 === preg_match( '/' . implode( '|', $escaped_labels ) . '/', $post->post_title ); |
|
| 172 | + $matches = 1 === preg_match('/'.implode('|', $escaped_labels).'/', $post->post_title); |
|
| 173 | 173 | |
| 174 | 174 | // If the title matches, assign the entity to the about, otherwise to the mentions. |
| 175 | - if ( $matches ) { |
|
| 175 | + if ($matches) { |
|
| 176 | 176 | $about[] = $item; |
| 177 | 177 | } else { |
| 178 | 178 | $mentions[] = $item; |
@@ -180,18 +180,18 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | // If we have abouts, assign them to the JSON-LD. |
| 183 | - if ( 0 < count( $about ) ) { |
|
| 183 | + if (0 < count($about)) { |
|
| 184 | 184 | $jsonld['about'] = $about; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | // If we have mentions, assign them to the JSON-LD. |
| 188 | - if ( 0 < count( $mentions ) ) { |
|
| 188 | + if (0 < count($mentions)) { |
|
| 189 | 189 | $jsonld['mentions'] = $mentions; |
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | // Finally set the author. |
| 194 | - $jsonld['author'] = $this->get_author( $post->post_author, $references ); |
|
| 194 | + $jsonld['author'] = $this->get_author($post->post_author, $references); |
|
| 195 | 195 | |
| 196 | 196 | /** |
| 197 | 197 | * Call the `wl_post_jsonld_array` filter. This filter allows 3rd parties to also modify the references. |
@@ -207,10 +207,10 @@ discard block |
||
| 207 | 207 | * |
| 208 | 208 | * @api |
| 209 | 209 | */ |
| 210 | - $ret_val = apply_filters( 'wl_post_jsonld_array', array( |
|
| 210 | + $ret_val = apply_filters('wl_post_jsonld_array', array( |
|
| 211 | 211 | 'jsonld' => $jsonld, |
| 212 | 212 | 'references' => $references, |
| 213 | - ), $post_id ); |
|
| 213 | + ), $post_id); |
|
| 214 | 214 | $jsonld = $ret_val['jsonld']; |
| 215 | 215 | $references = $ret_val['references']; |
| 216 | 216 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * |
| 226 | 226 | * @api |
| 227 | 227 | */ |
| 228 | - return apply_filters( 'wl_post_jsonld', $jsonld, $post_id, $references ); |
|
| 228 | + return apply_filters('wl_post_jsonld', $jsonld, $post_id, $references); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /** |
@@ -241,16 +241,16 @@ discard block |
||
| 241 | 241 | * @since 3.14.0 |
| 242 | 242 | * |
| 243 | 243 | */ |
| 244 | - private function get_author( $author_id, &$references ) { |
|
| 244 | + private function get_author($author_id, &$references) { |
|
| 245 | 245 | |
| 246 | 246 | // Get the entity bound to this user. |
| 247 | - $entity_id = $this->user_service->get_entity( $author_id ); |
|
| 247 | + $entity_id = $this->user_service->get_entity($author_id); |
|
| 248 | 248 | |
| 249 | 249 | // If there's no entity bound return a simple author structure. |
| 250 | - if ( empty( $entity_id ) || 'publish' !== get_post_status( $entity_id ) ) { |
|
| 250 | + if (empty($entity_id) || 'publish' !== get_post_status($entity_id)) { |
|
| 251 | 251 | |
| 252 | - $author = get_the_author_meta( 'display_name', $author_id ); |
|
| 253 | - $author_uri = $this->user_service->get_uri( $author_id ); |
|
| 252 | + $author = get_the_author_meta('display_name', $author_id); |
|
| 253 | + $author_uri = $this->user_service->get_uri($author_id); |
|
| 254 | 254 | |
| 255 | 255 | return array( |
| 256 | 256 | '@type' => 'Person', |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | // Add the author to the references. |
| 263 | - $author_uri = $this->entity_service->get_uri( $entity_id ); |
|
| 263 | + $author_uri = $this->entity_service->get_uri($entity_id); |
|
| 264 | 264 | $references[] = $entity_id; |
| 265 | 265 | |
| 266 | 266 | // Return the JSON-LD for the referenced entity. |
@@ -277,39 +277,39 @@ discard block |
||
| 277 | 277 | * @since 3.10.0 |
| 278 | 278 | * |
| 279 | 279 | */ |
| 280 | - protected function set_publisher( &$params ) { |
|
| 280 | + protected function set_publisher(&$params) { |
|
| 281 | 281 | |
| 282 | 282 | // If the publisher id isn't set don't do anything. |
| 283 | - if ( null === $publisher_id = $this->configuration_service->get_publisher_id() ) { |
|
| 283 | + if (null === $publisher_id = $this->configuration_service->get_publisher_id()) { |
|
| 284 | 284 | return; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | // Get the post instance. |
| 288 | - if ( null === $post = get_post( $publisher_id ) ) { |
|
| 288 | + if (null === $post = get_post($publisher_id)) { |
|
| 289 | 289 | // Publisher not found. |
| 290 | 290 | return; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | // Get the item id. |
| 294 | - $id = $this->entity_service->get_uri( $publisher_id ); |
|
| 294 | + $id = $this->entity_service->get_uri($publisher_id); |
|
| 295 | 295 | |
| 296 | 296 | // Get the type. |
| 297 | - $type = $this->entity_type_service->get( $publisher_id ); |
|
| 297 | + $type = $this->entity_type_service->get($publisher_id); |
|
| 298 | 298 | |
| 299 | 299 | // Get the name. |
| 300 | 300 | $name = $post->post_title; |
| 301 | 301 | |
| 302 | 302 | // Set the publisher data. |
| 303 | 303 | $params['publisher'] = array( |
| 304 | - '@type' => $this->relative_to_context( $type['uri'] ), |
|
| 304 | + '@type' => $this->relative_to_context($type['uri']), |
|
| 305 | 305 | '@id' => $id, |
| 306 | 306 | 'name' => $name, |
| 307 | 307 | ); |
| 308 | 308 | |
| 309 | 309 | // Add the sameAs values associated with the publisher. |
| 310 | 310 | $storage_factory = Wordlift_Storage_Factory::get_instance(); |
| 311 | - $sameas = $storage_factory->post_meta( Wordlift_Schema_Service::FIELD_SAME_AS )->get( $publisher_id ); |
|
| 312 | - if ( ! empty( $sameas ) ) { |
|
| 311 | + $sameas = $storage_factory->post_meta(Wordlift_Schema_Service::FIELD_SAME_AS)->get($publisher_id); |
|
| 312 | + if ( ! empty($sameas)) { |
|
| 313 | 313 | $params['publisher']['sameAs'] = $sameas; |
| 314 | 314 | } |
| 315 | 315 | |
@@ -317,15 +317,15 @@ discard block |
||
| 317 | 317 | // support the logo property. |
| 318 | 318 | // |
| 319 | 319 | // See http://schema.org/logo. |
| 320 | - if ( 'http://schema.org/Organization' !== $type['uri'] ) { |
|
| 320 | + if ('http://schema.org/Organization' !== $type['uri']) { |
|
| 321 | 321 | return; |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | // Get the publisher logo. |
| 325 | - $publisher_logo = $this->get_publisher_logo( $post->ID ); |
|
| 325 | + $publisher_logo = $this->get_publisher_logo($post->ID); |
|
| 326 | 326 | |
| 327 | 327 | // Bail out if the publisher logo isn't set. |
| 328 | - if ( false === $publisher_logo ) { |
|
| 328 | + if (false === $publisher_logo) { |
|
| 329 | 329 | return; |
| 330 | 330 | } |
| 331 | 331 | |
@@ -360,14 +360,14 @@ discard block |
||
| 360 | 360 | * @see https://github.com/insideout10/wordlift-plugin/issues/823 related issue. |
| 361 | 361 | * |
| 362 | 362 | */ |
| 363 | - private function get_publisher_logo( $post_id ) { |
|
| 363 | + private function get_publisher_logo($post_id) { |
|
| 364 | 364 | |
| 365 | 365 | // Get the featured image for the post. |
| 366 | - $thumbnail_id = get_post_thumbnail_id( $post_id ); |
|
| 366 | + $thumbnail_id = get_post_thumbnail_id($post_id); |
|
| 367 | 367 | |
| 368 | 368 | // Bail out if thumbnail not available. |
| 369 | - if ( empty( $thumbnail_id ) || 0 === $thumbnail_id ) { |
|
| 370 | - $this->log->info( "Featured image not set for post $post_id." ); |
|
| 369 | + if (empty($thumbnail_id) || 0 === $thumbnail_id) { |
|
| 370 | + $this->log->info("Featured image not set for post $post_id."); |
|
| 371 | 371 | |
| 372 | 372 | return false; |
| 373 | 373 | } |
@@ -376,24 +376,24 @@ discard block |
||
| 376 | 376 | $uploads_dir = wp_upload_dir(); |
| 377 | 377 | |
| 378 | 378 | // Get the attachment metadata. |
| 379 | - $metadata = wp_get_attachment_metadata( $thumbnail_id ); |
|
| 379 | + $metadata = wp_get_attachment_metadata($thumbnail_id); |
|
| 380 | 380 | |
| 381 | 381 | // Bail out if the file isn't set. |
| 382 | - if ( ! isset( $metadata['file'] ) ) { |
|
| 383 | - $this->log->warn( "Featured image file not found for post $post_id." ); |
|
| 382 | + if ( ! isset($metadata['file'])) { |
|
| 383 | + $this->log->warn("Featured image file not found for post $post_id."); |
|
| 384 | 384 | |
| 385 | 385 | return false; |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | // Retrieve the relative filename, e.g. "2018/05/logo_publisher.png" |
| 389 | - $path = $uploads_dir['basedir'] . DIRECTORY_SEPARATOR . $metadata['file']; |
|
| 389 | + $path = $uploads_dir['basedir'].DIRECTORY_SEPARATOR.$metadata['file']; |
|
| 390 | 390 | |
| 391 | 391 | // Use image src, if local file does not exist. @see https://github.com/insideout10/wordlift-plugin/issues/1149 |
| 392 | - if ( ! file_exists( $path ) ) { |
|
| 393 | - $this->log->warn( "Featured image file $path doesn't exist for post $post_id." ); |
|
| 392 | + if ( ! file_exists($path)) { |
|
| 393 | + $this->log->warn("Featured image file $path doesn't exist for post $post_id."); |
|
| 394 | 394 | |
| 395 | - $attachment_image_src = wp_get_attachment_image_src( $thumbnail_id, '' ); |
|
| 396 | - if ( $attachment_image_src ) { |
|
| 395 | + $attachment_image_src = wp_get_attachment_image_src($thumbnail_id, ''); |
|
| 396 | + if ($attachment_image_src) { |
|
| 397 | 397 | return array( |
| 398 | 398 | 'url' => $attachment_image_src[0], |
| 399 | 399 | 'width' => $attachment_image_src[1], |
@@ -407,27 +407,27 @@ discard block |
||
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | // Try to get the image editor and bail out if the editor cannot be instantiated. |
| 410 | - $original_file_editor = wp_get_image_editor( $path ); |
|
| 411 | - if ( is_wp_error( $original_file_editor ) ) { |
|
| 412 | - $this->log->warn( "Cannot instantiate WP Image Editor on file $path for post $post_id." ); |
|
| 410 | + $original_file_editor = wp_get_image_editor($path); |
|
| 411 | + if (is_wp_error($original_file_editor)) { |
|
| 412 | + $this->log->warn("Cannot instantiate WP Image Editor on file $path for post $post_id."); |
|
| 413 | 413 | |
| 414 | 414 | return false; |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | // Generate the publisher logo filename, we cannot use the `width` and `height` because we're scaling |
| 418 | 418 | // and we don't actually know the end values. |
| 419 | - $publisher_logo_path = $original_file_editor->generate_filename( '-publisher-logo' ); |
|
| 419 | + $publisher_logo_path = $original_file_editor->generate_filename('-publisher-logo'); |
|
| 420 | 420 | |
| 421 | 421 | // If the file doesn't exist yet, create it. |
| 422 | - if ( ! file_exists( $publisher_logo_path ) ) { |
|
| 423 | - $original_file_editor->resize( 600, 60 ); |
|
| 424 | - $original_file_editor->save( $publisher_logo_path ); |
|
| 422 | + if ( ! file_exists($publisher_logo_path)) { |
|
| 423 | + $original_file_editor->resize(600, 60); |
|
| 424 | + $original_file_editor->save($publisher_logo_path); |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | // Try to get the image editor and bail out if the editor cannot be instantiated. |
| 428 | - $publisher_logo_editor = wp_get_image_editor( $publisher_logo_path ); |
|
| 429 | - if ( is_wp_error( $publisher_logo_editor ) ) { |
|
| 430 | - $this->log->warn( "Cannot instantiate WP Image Editor on file $publisher_logo_path for post $post_id." ); |
|
| 428 | + $publisher_logo_editor = wp_get_image_editor($publisher_logo_path); |
|
| 429 | + if (is_wp_error($publisher_logo_editor)) { |
|
| 430 | + $this->log->warn("Cannot instantiate WP Image Editor on file $publisher_logo_path for post $post_id."); |
|
| 431 | 431 | |
| 432 | 432 | return false; |
| 433 | 433 | } |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | |
| 438 | 438 | // Finally return the array with data. |
| 439 | 439 | return array( |
| 440 | - 'url' => $uploads_dir['baseurl'] . substr( $publisher_logo_path, strlen( $uploads_dir['basedir'] ) ), |
|
| 440 | + 'url' => $uploads_dir['baseurl'].substr($publisher_logo_path, strlen($uploads_dir['basedir'])), |
|
| 441 | 441 | 'width' => $size['width'], |
| 442 | 442 | 'height' => $size['height'], |
| 443 | 443 | ); |